equip items from vbox

This commit is contained in:
Mashy
2019-11-05 10:00:40 +10:00
parent d4169e86c3
commit c4e42457be
7 changed files with 38 additions and 18 deletions
@@ -20,9 +20,14 @@ const addState = connect(
itemInfo,
itemEquip,
navInstance,
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);
}
@@ -35,11 +40,13 @@ const addState = connect(
instance,
player,
account,
sendVboxAcceptEquip,
sendVboxApply,
itemInfo,
itemEquip,
navInstance,
sendUnequip,
vboxSelected,
tutorial,
};
},
@@ -79,11 +86,13 @@ function Construct(props) {
instance,
mobileVisible,
player,
vboxSelected,
tutorial,
// Static Info
itemInfo,
// Function Calls
sendVboxApply,
sendVboxAcceptEquip,
sendUnequip,
setActiveConstruct,
setItemUnequip,
@@ -104,6 +113,7 @@ function Construct(props) {
e.stopPropagation();
e.preventDefault();
if (duplicateSkill || tutorialDisableEquip) return true;
if (vboxSelected[0]) sendVboxAcceptEquip(construct.id);
if (itemEquip !== null) sendVboxApply(construct.id, itemEquip);
setItemEquip(null);
return setActiveConstruct(construct);
@@ -254,6 +264,7 @@ class InstanceConstructs extends preact.Component {
// 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;
}
@@ -265,12 +276,14 @@ class InstanceConstructs extends preact.Component {
navInstance,
player,
tutorial,
vboxSelected,
// Static data
itemInfo,
// Function calls
setInfo,
setActiveConstruct,
sendVboxApply,
sendVboxAcceptEquip,
setVboxHighlight,
setItemUnequip,
setItemEquip,
@@ -293,11 +306,13 @@ class InstanceConstructs extends preact.Component {
setItemEquip,
player,
sendVboxApply,
sendVboxAcceptEquip,
setInfo,
setActiveConstruct,
itemInfo,
setVboxHighlight,
sendUnequip,
vboxSelected,
tutorial,
mobileVisible: navInstance === i + 1,
});