diff --git a/VERSION b/VERSION index 9dbb0c00..081af9a1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.7.0 \ No newline at end of file +1.7.1 \ No newline at end of file diff --git a/WORKLOG.md b/WORKLOG.md index cdfa63f6..d8ff9e55 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -36,7 +36,6 @@ - Strike + SpeedRR -> StrikeSpeed (strike has Y% more speed) - Strike + LifeRR -> StrikeLife (Strike recharges X% of damage as red life) -* equip from shop (buy and equip without putting in your inventory) for bases * move item from one construct to another * ACP @@ -89,7 +88,6 @@ $$$ * Highlight (dota) colour * fx colours + styles -* ??? (PROBS NOT) drag and drop buy / equip / unequip items ??? * modules * troll life -> dmg * prince of peace diff --git a/acp/package.json b/acp/package.json index c90324b5..48ed247e 100644 --- a/acp/package.json +++ b/acp/package.json @@ -1,6 +1,6 @@ { "name": "mnml-client", - "version": "1.7.0", + "version": "1.7.1", "description": "", "main": "index.js", "scripts": { diff --git a/client/assets/styles/instance.less b/client/assets/styles/instance.less index cf1e43a0..b6fc4c3f 100644 --- a/client/assets/styles/instance.less +++ b/client/assets/styles/instance.less @@ -203,6 +203,9 @@ button { height: 3em; } + label { + display: flex; + } } .specs { @@ -228,6 +231,10 @@ // font-size: 75%; line-height: initial; } + + label { + display: flex; + } } .stats { diff --git a/client/assets/styles/vbox.less b/client/assets/styles/vbox.less index a7545fff..95b77615 100644 --- a/client/assets/styles/vbox.less +++ b/client/assets/styles/vbox.less @@ -83,7 +83,7 @@ &.highlight { color: black; background: @white; - border: 1px solid @white; + // border: 1px solid @white; (this bangs around the vbox) // overwrite the classes on white svg elements svg { diff --git a/client/package.json b/client/package.json index 40922a43..f446e92c 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "mnml-client", - "version": "1.7.0", + "version": "1.7.1", "description": "", "main": "index.js", "scripts": { diff --git a/client/src/components/buttons.jsx b/client/src/components/buttons.jsx index c2f72b15..af6f0f72 100644 --- a/client/src/components/buttons.jsx +++ b/client/src/components/buttons.jsx @@ -1,4 +1,5 @@ -module.exports = { // This will need to be edited if we change server recipes +// This will need to be edited if we change server recipes +module.exports = { // Attack Strike: () => 'red-border', Blast: () => 'blue-border', @@ -7,7 +8,7 @@ module.exports = { // This will need to be edited if we change server recipes Slay: () => 'red-green-border', Siphon: () => 'blue-green-border', // Stun - Link: () => 'blue-greenborder', + Link: () => 'blue-green-border', Bash: () => 'red-border', Sleep: () => 'green-border', Ruin: () => 'blue-border', @@ -31,9 +32,9 @@ module.exports = { // This will need to be edited if we change server recipes Restrict: () => 'red-border', Purge: () => 'green-border', Silence: () => 'blue-border', - Curse: () => 'red-green-border', + Invert: () => 'red-green-border', Decay: () => 'blue-green-border', - Invert: () => 'red-blue-border', + Curse: () => 'red-blue-border', // // Lifes Upgrades // LifeGG: () => 'green-border', diff --git a/client/src/components/instance.constructs.jsx b/client/src/components/instance.constructs.jsx index 5168df19..0012c1b8 100644 --- a/client/src/components/instance.constructs.jsx +++ b/client/src/components/instance.constructs.jsx @@ -20,9 +20,15 @@ const addState = connect( account, itemInfo, itemEquip, + itemUnequip, + vboxSelected, tutorial, } = state; + function sendVboxAcceptEquip(constructId) { + return ws.sendVboxAcceptEquip(instance.id, vboxSelected[0], vboxSelected[1], constructId); + } + function sendVboxApply(constructId, i) { return ws.sendVboxApply(instance.id, constructId, i); } @@ -31,14 +37,22 @@ const addState = connect( return ws.sendVboxUnequip(instance.id, constructId, item); } + function sendVboxUnequipApply(targetConstructId) { + return ws.sendVboxUnequipApply(instance.id, itemUnequip[0], itemUnequip[1], targetConstructId); + } + return { instance, player, account, + sendVboxAcceptEquip, + sendVboxUnequipApply, sendVboxApply, itemInfo, itemEquip, + itemUnequip, sendUnequip, + vboxSelected, tutorial, }; }, @@ -75,20 +89,23 @@ function Construct(props) { construct, iter, itemEquip, + itemUnequip, instance, player, + vboxSelected, tutorial, // Static Info itemInfo, // Function Calls sendVboxApply, + sendVboxAcceptEquip, + sendVboxUnequipApply, sendUnequip, setActiveConstruct, setItemUnequip, setItemEquip, setInfo, } = props; - const { vbox } = player; const duplicateSkill = construct.skills.length !== 0 && construct.skills.every(sk => { @@ -97,14 +114,16 @@ function Construct(props) { return sk.skill === vbox.bound[itemEquip]; }); const tutorialDisableEquip = tutorialShouldDisableEquip(tutorial, iter, instance, construct); - function onClick(e) { e.stopPropagation(); e.preventDefault(); if (duplicateSkill || tutorialDisableEquip) return true; - if (itemEquip !== null) sendVboxApply(construct.id, itemEquip); + if (itemEquip !== null) return sendVboxApply(construct.id, itemEquip); + if (vboxSelected[0]) return sendVboxAcceptEquip(construct.id); + if (itemUnequip.length && itemUnequip[0] !== construct.id) return sendVboxUnequipApply(construct.id); setItemEquip(null); - return setActiveConstruct(construct); + setItemUnequip([]); + return true; } function hoverInfo(e, info) { @@ -151,15 +170,20 @@ function Construct(props) { const classes = `${equipping ? 'equipping' : ''} ${!skill ? 'empty' : ''} ${border()}`; return ( - + ); }); @@ -193,13 +217,15 @@ function Construct(props) { return ( - + ); }); @@ -221,7 +247,7 @@ function Construct(props) { const classes = `instance-construct`; const avatarMouseOver = e => hoverInfo(e, `constructAvatar ${construct.name}`); return ( -
+
ev.preventDefault()} onDrop={onClick}>

hoverInfo(e, `constructName ${construct.name}`)}>{construct.name}

hoverInfo(e, 'constructSkills')} > @@ -240,10 +266,12 @@ function Construct(props) { class InstanceConstructs extends preact.Component { shouldComponentUpdate(newProps) { if (newProps.itemEquip !== this.props.itemEquip) return true; + if (newProps.itemUnequip !== this.props.itemUnequip) return true; if (newProps.tutorial !== this.props.tutorial) return true; // JSON or Array objects if (newProps.player !== this.props.player) return true; if (newProps.instance !== this.props.instance) return true; + if (newProps.vboxSelected !== this.props.vboxSelected) return true; return false; } @@ -251,15 +279,19 @@ class InstanceConstructs extends preact.Component { const { // Changing state variables itemEquip, + itemUnequip, instance, player, tutorial, + vboxSelected, // Static data itemInfo, // Function calls setInfo, setActiveConstruct, sendVboxApply, + sendVboxAcceptEquip, + sendVboxUnequipApply, setVboxHighlight, setItemUnequip, setItemEquip, @@ -277,16 +309,20 @@ class InstanceConstructs extends preact.Component { iter: i, construct: player.constructs[i], itemEquip, + itemUnequip, instance, setItemUnequip, setItemEquip, player, sendVboxApply, + sendVboxAcceptEquip, + sendVboxUnequipApply, setInfo, setActiveConstruct, itemInfo, setVboxHighlight, sendUnequip, + vboxSelected, tutorial, }); }); diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index 366f87af..5b1385dd 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -28,6 +28,7 @@ const addState = connect( } function sendVboxAccept(group, index) { + document.activeElement.blur(); return ws.sendVboxAccept(instance.id, group, index); } @@ -190,8 +191,6 @@ class Vbox extends preact.Component { e.stopPropagation(); setItemEquip(null); setCombiner([]); - - if (selected) return clearVboxSelected(); setInfo(vbox.free[group][index]); return setVboxSelected([group, index]); } @@ -213,28 +212,20 @@ class Vbox extends preact.Component { const classes = `${v.toLowerCase()} ${selected ? 'highlight' : ''} ${comboHighlight}`; - if (shapes[v]) { - return ( + const vboxObject = shapes[v] ? shapes[v]() : v; + return ( + ); } @@ -314,7 +305,8 @@ class Vbox extends preact.Component { // removing const combinerIndex = combiner.indexOf(i); if (combinerIndex > -1) { - return combinerChange(without(combiner, i)); + return true; + // return combinerChange(without(combiner, i)); } combiner.push(i); @@ -330,26 +322,22 @@ class Vbox extends preact.Component { const highlighted = combiner.indexOf(i) > -1; const border = buttons[removeTier(v)] ? buttons[removeTier(v)]() : ''; const classes = `${highlighted ? 'highlight' : border} ${comboHighlight}`; - if (shapes[v]) { - return ( + + const invObject = shapes[v] ? shapes[v]() : v; + + return ( + ); } @@ -404,7 +392,10 @@ class Vbox extends preact.Component {
e.stopPropagation()} - style={vboxSelecting || (itemUnequip.length) ? { cursor: 'pointer' } : null}> + style={vboxSelecting || (itemUnequip.length) ? { cursor: 'pointer' } : null} + onDragOver={ev => ev.preventDefault()} + onDrop={inventoryClick} + >

e.target.scrollIntoView(true)} diff --git a/client/src/events.jsx b/client/src/events.jsx index 5515ddba..c295e0e5 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -190,6 +190,7 @@ function registerEvents(store) { store.dispatch(actions.setItemEquip(null)); store.dispatch(actions.setItemUnequip([])); store.dispatch(actions.setVboxHighlight([])); + store.dispatch(actions.setVboxSelected([])); } function setAccountInstances(v) { diff --git a/client/src/socket.jsx b/client/src/socket.jsx index 340310b8..b89bc187 100644 --- a/client/src/socket.jsx +++ b/client/src/socket.jsx @@ -82,6 +82,11 @@ function createSocket(events) { events.clearInstance(); } + function sendVboxAcceptEquip(instanceId, group, index, constructId) { + send(['VboxAcceptEquip', { instance_id: instanceId, group, index, construct_id: constructId }]); + events.clearInstance(); + } + function sendVboxApply(instanceId, constructId, index) { send(['VboxApply', { instance_id: instanceId, construct_id: constructId, index }]); events.clearInstance(); @@ -92,6 +97,11 @@ function createSocket(events) { events.clearInstance(); } + function sendVboxUnequipApply(instanceId, constructId, target, targetConstructId) { + send(['VboxUnequipApply', { instance_id: instanceId, construct_id: constructId, target, target_construct_id: targetConstructId }]); + events.clearInstance(); + } + function sendVboxDiscard(instanceId) { send(['VboxDiscard', { instance_id: instanceId }]); events.clearInstance(); @@ -99,7 +109,7 @@ function createSocket(events) { function sendVboxCombine(instanceId, indices) { send(['VboxCombine', { instance_id: instanceId, indices }]); - events.clearCombiner(); + events.clearInstance(); } function sendVboxReclaim(instanceId, index) { @@ -382,11 +392,13 @@ function createSocket(events) { sendInstanceChat, sendVboxAccept, + sendVboxAcceptEquip, sendVboxApply, sendVboxReclaim, sendVboxCombine, sendVboxDiscard, sendVboxUnequip, + sendVboxUnequipApply, sendItemInfo, diff --git a/ops/package.json b/ops/package.json index 808951f4..876bd4cf 100755 --- a/ops/package.json +++ b/ops/package.json @@ -1,6 +1,6 @@ { "name": "mnml-ops", - "version": "1.7.0", + "version": "1.7.1", "description": "", "main": "index.js", "scripts": { diff --git a/server/Cargo.toml b/server/Cargo.toml index 52007285..40e26480 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mnml" -version = "1.7.0" +version = "1.7.1" authors = ["ntr "] [dependencies] diff --git a/server/src/account.rs b/server/src/account.rs index 22224568..8e8a1b6f 100644 --- a/server/src/account.rs +++ b/server/src/account.rs @@ -67,13 +67,13 @@ pub fn select(db: &Db, id: Uuid) -> Result { pub fn chat_wheel(_db: &Db, _id: Uuid) -> Result, Error> { return Ok(vec![ - "gl".to_string(), - "hf".to_string(), "gg".to_string(), - "thx".to_string(), - "nice".to_string(), + "glhf".to_string(), "hmm".to_string(), "ok".to_string(), + "rekt".to_string(), + "thx".to_string(), + "nice".to_string(), "...".to_string(), ]) } diff --git a/server/src/img.rs b/server/src/img.rs index 5e0603a2..3ac57908 100644 --- a/server/src/img.rs +++ b/server/src/img.rs @@ -274,6 +274,10 @@ pub fn smile(id: Uuid) -> Result { ("M0,0 L50,25 M50,0 L0,25", 1), // x ("M0,0 L50,12.5 L0,25", 1), // > ("M50,0 L0,12.5 L50,25", 1), // < + ("M0,0 L0,25 L50,25", 1), // L + ("M50,0 L50,25 L0,25", 1), // J + ("M0,0 L50,0 M50,6.25 L50,12.5 M50,18.75 L50,25", 1), // ; + ("M12.5,0 L37.5,0 L37.5,25 L12.5,25 L12.5,0", 1), // o ]; let eye_left_dist = WeightedIndex::new(eyes_left.iter().map(|v| v.1))?; @@ -283,10 +287,14 @@ pub fn smile(id: Uuid) -> Result { ("M150,0 L175,25 L200,0", 1), // v ("M150,25 L175,0 L200,25", 1), // ^ ("M150,0 L200,0", 1), // - - ("M150,25 L200,25", 1), // - + ("M150,25 L200,25", 1), // _ ("M150,0 L200,25 M200,0 L150,25", 1), // x ("M150,0 L200,12.5 L150,25", 1), // > ("M200,0 L150,12.5 L200,25", 1), // < + ("M150,0 L150,25 L200,25", 1), // L + ("M200,0 L200,25 L150,25", 1), // J + ("M150,0 L200,0 M150,6.25 L150,12.5 M150,18.75 L150,25", 1), // ; + ("M162.5,0 L187.5,0 L187.5,25 L162.5,25 L162.5,0", 1), // o ]; let eye_right_dist= WeightedIndex::new(eyes_right.iter().map(|v| v.1))?; @@ -297,8 +305,15 @@ pub fn smile(id: Uuid) -> Result { ("M50,75 L150,75 L150,100 L50,100 L50,75", 1), // box ("M50,75 L75,100 L100,75 L125,100 L150,75", 1), // w ("M50,75 L75,75 L75,87.5 M75,75 L125,75 L125,87.5 M125,75 L150,75", 1), // vamp + ("M50,75 L150,75 M50,75 L50,87.5 M75,75 L75,87.5 M100,75 L100,87.5 M125,75 L125,87.5 M150,75 L150,87.5", 1), // mm ("M75,75 L125,75 L125,100 L75,100 L75,75", 1), // o ("M50,75 L150,100 M150,75 L50,100", 1), // x + ("M50,75 L150,75 L150,100 L125,100 L125,75", 1), // p + ("M50,75 L150,75 M50,75 L50,100 L75,100 L75,75", 1), // d + // ("M50,75 L50,100 L150,100 L150,75", 1), // u + ("M50,100 L50,75 L150,75 L150,100", 1), // n + ("M50,75 L50,100 L150,75 L150,100", 1), // Z + ("M50,87.5 L100,75 L150,87.5 L100,100 L50,87.5", 1), // Z ]; let mouth_dist = WeightedIndex::new(mouths.iter().map(|v| v.1))?; diff --git a/server/src/instance.rs b/server/src/instance.rs index 2e65b9d6..5dc79652 100644 --- a/server/src/instance.rs +++ b/server/src/instance.rs @@ -473,10 +473,10 @@ impl Instance { Ok(self) } - pub fn vbox_accept(mut self, account: Uuid, group: usize, index: usize) -> Result { + pub fn vbox_accept(mut self, account: Uuid, group: usize, index: usize, construct_id: Option) -> Result { self.vbox_action_allowed(account)?; self.account_player(account)? - .vbox_accept(group, index)?; + .vbox_accept(group, index, construct_id)?; Ok(self) } @@ -501,10 +501,10 @@ impl Instance { Ok(self) } - pub fn vbox_unequip(mut self, account: Uuid, target: Item, construct_id: Uuid) -> Result { + pub fn vbox_unequip(mut self, account: Uuid, target: Item, construct_id: Uuid, target_construct_id: Option) -> Result { self.vbox_action_allowed(account)?; self.account_player(account)? - .vbox_unequip(target, construct_id)?; + .vbox_unequip(target, construct_id, target_construct_id)?; Ok(self) } } diff --git a/server/src/item.rs b/server/src/item.rs index 52b3bb8b..4d5604f0 100644 --- a/server/src/item.rs +++ b/server/src/item.rs @@ -620,70 +620,70 @@ impl Item { // Lifes Upgrades Item::LifeGG | Item::LifeGGPlus | - Item::LifeGGPlusPlus => format!("Increases construct GreenLife by {:?}. + Item::LifeGGPlusPlus => format!("Increases construct GreenLife by {:?}. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), Item::LifeRR | Item::LifeRRPlus | - Item::LifeRRPlusPlus => format!("Increases construct RedLife by {:?}. + Item::LifeRRPlusPlus => format!("Increases construct RedLife by {:?}. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), - Item::LifeBB | - Item::LifeBBPlus | - Item::LifeBBPlusPlus => format!("Increases construct BlueLife by {:?}. + Item::LifeBB | + Item::LifeBBPlus | + Item::LifeBBPlusPlus => format!("Increases construct BlueLife by {:?}. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), Item::LifeRG | Item::LifeRGPlus | - Item::LifeRGPlusPlus => format!("Increases construct RedLife and GreenLife by {:?}. + Item::LifeRGPlusPlus => format!("Increases construct RedLife and GreenLife by {:?}. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), Item::LifeGB | Item::LifeGBPlus | - Item::LifeGBPlusPlus => format!("Increases construct GreenLife and BlueLife by {:?}. + Item::LifeGBPlusPlus => format!("Increases construct GreenLife and BlueLife by {:?}. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), Item::LifeRB | Item::LifeRBPlus | - Item::LifeRBPlusPlus => format!("Increases construct RedLife and BlueLife by {:?}. + Item::LifeRBPlusPlus => format!("Increases construct RedLife and BlueLife by {:?}. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), // Power Upgrades - Item::PowerRR | - Item::PowerRRPlus | - Item::PowerRRPlusPlus => format!("Increases construct RedPower by {:?}%. + Item::PowerRR | + Item::PowerRRPlus | + Item::PowerRRPlusPlus => format!("Increases construct RedPower by {:?}%. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), Item::PowerBB | Item::PowerBBPlus | - Item::PowerBBPlusPlus => format!("Increases construct BluePower by {:?}%. + Item::PowerBBPlusPlus => format!("Increases construct BluePower by {:?}%. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), Item::PowerGG | Item::PowerGGPlus | - Item::PowerGGPlusPlus => format!("Increases construct GreenPower by {:?}%. + Item::PowerGGPlusPlus => format!("Increases construct GreenPower by {:?}%. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), Item::PowerRG | Item::PowerRGPlus | - Item::PowerRGPlusPlus => format!("Increases construct GreenPower and RedPower by {:?}%. + Item::PowerRGPlusPlus => format!("Increases construct GreenPower and RedPower by {:?}%. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), Item::PowerGB | Item::PowerGBPlus | - Item::PowerGBPlusPlus => format!("Increases construct GreenPower and BluePower by {:?}%. + Item::PowerGBPlusPlus => format!("Increases construct GreenPower and BluePower by {:?}%. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), Item::PowerRB | Item::PowerRBPlus | - Item::PowerRBPlusPlus => format!("Increases construct RedPower and BluePower by {:?}%. + Item::PowerRBPlusPlus => format!("Increases construct RedPower and BluePower by {:?}%. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), @@ -705,7 +705,7 @@ impl Item { Item::SpeedGGPlusPlus | Item::SpeedRGPlusPlus | Item::SpeedGBPlusPlus | - Item::SpeedRBPlusPlus => format!("Increases construct SpeedStat by {:?}%. + Item::SpeedRBPlusPlus => format!("Increases construct SpeedStat by {:?}%. If your team meets total colour thresholds the spec provides additional bonuses.", self.into_spec().unwrap().values().base()), @@ -796,7 +796,7 @@ impl Item { Item::Hybrid| Item::HybridPlus | Item::HybridPlusPlus => format!( - "Hybrid increases GreenPower by {:?}%. + "Hybrid increases GreenPower by {:?}%. Blue based Attack skills will blast again dealing {:?}% GreenPower as blue damage. Lasts {:?}T.", self.into_skill().unwrap().effect()[0].get_multiplier() - 100, @@ -823,7 +823,7 @@ impl Item { Item::Purge| Item::PurgePlus | Item::PurgePlusPlus => format!( - "Remove buffs from target construct. + "Remove buffs from target construct. Applies purge disabling target green skills for {:?}T.", self.into_skill().unwrap().effect()[0].get_duration()), @@ -836,7 +836,7 @@ impl Item { Item::Reflect| Item::ReflectPlus | Item::ReflectPlusPlus => format!( - "Reflect incoming blue skills to source. Lasts {:?}T. + "Reflect incoming blue skills to source. Lasts {:?}T. Recharges target BlueLife based on {:?}% BluePower.", self.into_skill().unwrap().effect()[0].get_duration(), self.into_skill().unwrap().multiplier()), @@ -943,6 +943,11 @@ impl Item { } } + // !!!!!! + // IF YOU CHANGE A COMBO + // BE SURE TO EDIT BUTTONS.JSX TOO + // !!!!!! + fn combo(&self) -> Vec { match self { Item::Intercept => vec![Item::Buff, Item::Red, Item::Red], diff --git a/server/src/player.rs b/server/src/player.rs index 994d7f4c..0e0baf56 100644 --- a/server/src/player.rs +++ b/server/src/player.rs @@ -256,8 +256,12 @@ impl Player { Ok(self) } - pub fn vbox_accept(&mut self, group: usize, index: usize) -> Result<&mut Player, Error> { - self.vbox.accept(group, index)?; + pub fn vbox_accept(&mut self, group: usize, index: usize, construct_id: Option) -> Result<&mut Player, Error> { + self.vbox.accept(group, index, construct_id)?; + if construct_id.is_some() { + let equip_index = self.vbox.bound.len() - 1; + self.vbox_apply(equip_index, construct_id.expect("no construct"))?; + } Ok(self) } @@ -320,8 +324,8 @@ impl Player { Ok(self) } - pub fn vbox_unequip(&mut self, target: Item, construct_id: Uuid) -> Result<&mut Player, Error> { - if self.vbox.bound.len() >= 9 { + pub fn vbox_unequip(&mut self, target: Item, construct_id: Uuid, target_construct_id: Option) -> Result<&mut Player, Error> { + if self.vbox.bound.len() >= 9 && !target_construct_id.is_some() { return Err(err_msg("too many items bound")); } @@ -354,7 +358,12 @@ impl Player { } self.vbox.bound.push(target); - self.vbox.bound.sort_unstable(); + + if target_construct_id.is_some() { + let equip_index = self.vbox.bound.len() - 1; + self.vbox_apply(equip_index, target_construct_id.expect("no construct"))?; + } + // self.vbox.bound.sort_unstable(); Ok(self) } diff --git a/server/src/rpc.rs b/server/src/rpc.rs index 29d89d34..e0db439a 100644 --- a/server/src/rpc.rs +++ b/server/src/rpc.rs @@ -1,6 +1,5 @@ use std::time::{Instant}; -use std::thread::{spawn, sleep}; -use std::time; +use std::thread::{spawn}; use std::str; @@ -113,10 +112,12 @@ pub enum RpcRequest { InstanceChat { instance_id: Uuid, index: usize }, VboxAccept { instance_id: Uuid, group: usize, index: usize }, + VboxAcceptEquip { instance_id: Uuid, group: usize, index: usize, construct_id: Uuid }, VboxDiscard { instance_id: Uuid }, VboxCombine { instance_id: Uuid, indices: Vec }, VboxApply { instance_id: Uuid, construct_id: Uuid, index: usize }, VboxUnequip { instance_id: Uuid, construct_id: Uuid, target: Item }, + VboxUnequipApply { instance_id: Uuid, construct_id: Uuid, target: Item, target_construct_id: Uuid }, VboxReclaim { instance_id: Uuid, index: usize }, } @@ -235,7 +236,10 @@ impl Connection { Ok(instance_abandon(&mut tx, account, instance_id)?), RpcRequest::VboxAccept { instance_id, group, index } => - Ok(RpcMessage::InstanceState(vbox_accept(&mut tx, account, instance_id, group, index)?)), + Ok(RpcMessage::InstanceState(vbox_accept(&mut tx, account, instance_id, group, index, None)?)), + + RpcRequest::VboxAcceptEquip { instance_id, group, index, construct_id } => + Ok(RpcMessage::InstanceState(vbox_accept(&mut tx, account, instance_id, group, index, Some(construct_id))?)), RpcRequest::VboxApply { instance_id, construct_id, index } => Ok(RpcMessage::InstanceState(vbox_apply(&mut tx, account, instance_id, construct_id, index)?)), @@ -250,7 +254,10 @@ impl Connection { Ok(RpcMessage::InstanceState(vbox_reclaim(&mut tx, account, instance_id, index)?)), RpcRequest::VboxUnequip { instance_id, construct_id, target } => - Ok(RpcMessage::InstanceState(vbox_unequip(&mut tx, account, instance_id, construct_id, target)?)), + Ok(RpcMessage::InstanceState(vbox_unequip(&mut tx, account, instance_id, construct_id, target, None)?)), + + RpcRequest::VboxUnequipApply { instance_id, construct_id, target, target_construct_id } => + Ok(RpcMessage::InstanceState(vbox_unequip(&mut tx, account, instance_id, construct_id, target, Some(target_construct_id))?)), RpcRequest::MtxConstructSpawn {} => Ok(RpcMessage::ConstructSpawn(mtx::new_construct(&mut tx, account)?)), diff --git a/server/src/skill.rs b/server/src/skill.rs index 1f655e6d..ceccf0f8 100644 --- a/server/src/skill.rs +++ b/server/src/skill.rs @@ -831,13 +831,13 @@ impl Skill { // Buff base Skill::HybridBlast => 50, - + Skill::HasteStrike => 60, - + Skill::Intercept=> 80, Skill::InterceptPlus => 110, Skill::InterceptPlusPlus => 150, - + Skill::TriageTick=> 75, Skill::TriageTickPlus => 110, Skill::TriageTickPlusPlus => 140, @@ -1392,7 +1392,10 @@ fn sustain(source: &mut Construct, target: &mut Construct, mut results: Resoluti if red > 0 || blue > 0 { EventStages::PostOnly } else { EventStages::NoStages } } - _ => panic!("not recharge") + _ => { + warn!("no recharge event found {:?}", e); + EventStages::NoStages + } }; results.push(Resolution::new(source, target).event(e).stages(stages)); @@ -1411,7 +1414,10 @@ fn intercept(source: &mut Construct, target: &mut Construct, mut results: Resolu if red > 0 || blue > 0 { EventStages::PostOnly } else { EventStages::NoStages } } - _ => panic!("not recharge") + _ => { + warn!("no recharge event found {:?}", e); + EventStages::NoStages + } }; results.push(Resolution::new(source, target).event(e).stages(stages)); @@ -1713,7 +1719,10 @@ fn reflect(source: &mut Construct, target: &mut Construct, mut results: Resoluti if red > 0 || blue > 0 { EventStages::PostOnly } else { EventStages::NoStages } } - _ => panic!("not recharge") + _ => { + warn!("no recharge event found {:?}", e); + EventStages::NoStages + } }; results.push(Resolution::new(source, target).event(e).stages(stages)); return results;; @@ -1728,7 +1737,10 @@ fn recharge(source: &mut Construct, target: &mut Construct, mut results: Resolut if red > 0 || blue > 0 { EventStages::AllStages } else { EventStages::StartEnd } } - _ => panic!("not recharge") + _ => { + warn!("no recharge event found {:?}", e); + EventStages::NoStages + } }; results.push(Resolution::new(source, target).event(e).stages(stages)); return results; diff --git a/server/src/vbox.rs b/server/src/vbox.rs index 162f48de..3488b14d 100644 --- a/server/src/vbox.rs +++ b/server/src/vbox.rs @@ -99,8 +99,8 @@ impl Vbox { self } - pub fn accept(&mut self, i: usize, j: usize) -> Result<&mut Vbox, Error> { - if self.bound.len() >= 9 { + pub fn accept(&mut self, i: usize, j: usize, construct_id: Option) -> Result<&mut Vbox, Error> { + if self.bound.len() >= 9 && !construct_id.is_some() { return Err(err_msg("too many items bound")); } @@ -130,7 +130,7 @@ impl Vbox { pub fn bot_accept(&mut self, i: usize) -> Result<&mut Vbox, Error> { let buy_index = self.free[i].iter().position(|item| item.is_some()); - self.accept(i, buy_index.expect("no valid buys")) + self.accept(i, buy_index.expect("no valid buys"), None) } pub fn reclaim(&mut self, i: usize) -> Result<&mut Vbox, Error> { @@ -181,9 +181,9 @@ pub fn vbox_discard(tx: &mut Transaction, account: &Account, instance_id: Uuid) return instance_update(tx, instance); } -pub fn vbox_accept(tx: &mut Transaction, account: &Account, instance_id: Uuid, group: usize, index: usize) -> Result { +pub fn vbox_accept(tx: &mut Transaction, account: &Account, instance_id: Uuid, group: usize, index: usize, construct_id: Option) -> Result { let instance = instance_get(tx, instance_id)? - .vbox_accept(account.id, group, index)?; + .vbox_accept(account.id, group, index, construct_id)?; return instance_update(tx, instance); } @@ -205,9 +205,9 @@ pub fn vbox_apply(tx: &mut Transaction, account: &Account, instance_id: Uuid, co return instance_update(tx, instance); } -pub fn vbox_unequip(tx: &mut Transaction, account: &Account, instance_id: Uuid, construct_id: Uuid, target: Item) -> Result { +pub fn vbox_unequip(tx: &mut Transaction, account: &Account, instance_id: Uuid, construct_id: Uuid, target: Item, target_construct_id: Option) -> Result { let instance = instance_get(tx, instance_id)? - .vbox_unequip(account.id, target, construct_id)?; + .vbox_unequip(account.id, target, construct_id, target_construct_id)?; return instance_update(tx, instance); }