diff --git a/client/assets/styles/vbox.less b/client/assets/styles/vbox.less index 209f31de..aab8da8e 100644 --- a/client/assets/styles/vbox.less +++ b/client/assets/styles/vbox.less @@ -116,7 +116,7 @@ }; } - .reclaiming { + .Refunding { button:not([disabled]) { &, &:hover, &:active { background: @red; diff --git a/client/src/actions.jsx b/client/src/actions.jsx index 00b32e31..f6745548 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -49,7 +49,7 @@ export const setTeamSelect = value => ({ type: 'SET_TEAM_SELECT', value: Array.f export const setTutorial = value => ({ type: 'SET_TUTORIAL', value }); export const setTutorialGame = value => ({ type: 'SET_TUTORIAL_GAME', value }); -export const setVboxSelected = value => ({ type: 'SET_VBOX_SELECTED', value }); +export const setVboxSelected = value => ({ type: 'SET_VBOX_SELECTED', value: Object.create(value) }); export const setVboxCombiner = value => ({ type: 'SET_VBOX_COMBINER', value }); export const setVboxHighlight = value => ({ type: 'SET_VBOX_HIGHLIGHT', value }); export const setVboxInfo = value => ({ type: 'SET_VBOX_INFO', value }); diff --git a/client/src/components/instance.constructs.jsx b/client/src/components/instance.constructs.jsx index c0a0b36d..5a752394 100644 --- a/client/src/components/instance.constructs.jsx +++ b/client/src/components/instance.constructs.jsx @@ -24,8 +24,8 @@ const addState = connect( tutorial, } = state; - function sendVboxAcceptEquip(constructId) { - return ws.sendVboxAcceptEquip(instance.id, vboxSelected.storeSelect[0][0], vboxSelected.storeSelect[0][1], constructId); + function sendVboxBuyEquip(constructId) { + return ws.sendVboxBuyEquip(instance.id, vboxSelected.storeSelect[0][0], vboxSelected.storeSelect[0][1], constructId); } function sendVboxApply(constructId, i) { @@ -40,7 +40,7 @@ const addState = connect( instance, player, account, - sendVboxAcceptEquip, + sendVboxBuyEquip, sendVboxUnequipApply, sendVboxApply, itemInfo, @@ -83,7 +83,7 @@ function Construct(props) { itemInfo, // Function Calls sendVboxApply, - sendVboxAcceptEquip, + sendVboxBuyEquip, sendVboxUnequipApply, setItemUnequip, setInfo, @@ -98,7 +98,7 @@ function Construct(props) { const duplicateSkill = construct.skills.length !== 0 && construct.skills.every(sk => { if (!itemEquip && itemEquip !== 0) return false; if (!sk) return false; - return sk.skill === vbox.bound[itemEquip]; + return sk.skill === vbox.stash[itemEquip]; }); const tutorialDisableEquip = tutorialShouldDisableEquip(tutorial, iter, instance, construct); function onClick(e) { @@ -106,7 +106,7 @@ function Construct(props) { e.preventDefault(); if (duplicateSkill || tutorialDisableEquip) return true; if (itemEquip !== -1) return sendVboxApply(construct.id, itemEquip); - if (vboxSelected.storeSelect.length === 1) return sendVboxAcceptEquip(construct.id); + if (vboxSelected.storeSelect.length === 1) return sendVboxBuyEquip(construct.id); if (itemUnequip.length && itemUnequip[0] !== construct.id) return sendVboxUnequipApply(construct.id); setItemUnequip([]); return true; @@ -136,7 +136,7 @@ function Construct(props) { return true; } - const equipping = skillList.includes(vbox.bound[itemEquip]) && !skill + const equipping = skillList.includes(vbox.stash[itemEquip]) && !skill && !tutorialDisableEquip && !duplicateSkill && i === construct.skills.length; const border = () => { if (!skill) return ''; @@ -169,7 +169,7 @@ function Construct(props) { const s = construct.specs[i]; if (!s) { - const equipping = specList.includes(vbox.bound[itemEquip]) && i === construct.specs.length; + const equipping = specList.includes(vbox.stash[itemEquip]) && i === construct.specs.length; const classes = `${equipping ? 'equipping' : 'gray'} empty`; return ( ); } diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index f00e9b63..2891e060 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -27,22 +27,22 @@ const addState = connect( return ws.clearTutorial(instance.id); } - function sendVboxDiscard() { - return ws.sendVboxDiscard(instance.id); + function sendVboxRefill() { + return ws.sendVboxRefill(instance.id); } - function sendVboxAccept(group, index) { + function sendVboxBuy(group, index) { if (!(vboxSelected.storeSelect.length === 1 && vboxSelected.stashSelect.length === 0)) return false; document.activeElement.blur(); - return ws.sendVboxAccept(instance.id, group, index); + return ws.sendVboxBuy(instance.id, group, index); } function sendVboxCombine() { return ws.sendVboxCombine(instance.id, vboxSelected.stashSelect, vboxSelected.storeSelect); } - function sendVboxReclaim(i) { - return ws.sendVboxReclaim(instance.id, i); + function sendVboxRefund(i) { + return ws.sendVboxRefund(instance.id, i); } function sendItemUnequip([constructId, item]) { @@ -60,10 +60,10 @@ const addState = connect( clearTutorial, sendItemUnequip, - sendVboxAccept, + sendVboxBuy, sendVboxCombine, - sendVboxDiscard, - sendVboxReclaim, + sendVboxRefill, + sendVboxRefund, }; }, @@ -109,10 +109,10 @@ class Vbox extends preact.Component { clearTutorial, dispatchVboxSelect, sendItemUnequip, - sendVboxAccept, + sendVboxBuy, sendVboxCombine, - sendVboxDiscard, - sendVboxReclaim, + sendVboxRefill, + sendVboxRefund, setInfo, } = args; @@ -122,7 +122,7 @@ class Vbox extends preact.Component { const setVboxSelected = v => dispatchVboxSelect(v, { itemInfo, itemUnequip, vbox }); const clearVboxSelected = () => setVboxSelected({ storeSelect: [], stashSelect: [] }); - const vboxBuySelected = () => sendVboxAccept(storeSelect[0][0], storeSelect[0][1]); + const vboxBuySelected = () => sendVboxBuy(storeSelect[0][0], storeSelect[0][1]); function vboxHover(e, v) { if (v) { @@ -151,7 +151,7 @@ class Vbox extends preact.Component { && instance.time_control === 'Practice' && instance.rounds.length === 1) } onClick={e => e.stopPropagation()} - onMouseDown={() => sendVboxDiscard()}> + onMouseDown={() => sendVboxRefill()}> refill
2b @@ -161,7 +161,7 @@ class Vbox extends preact.Component { function stashHdr() { const refund = storeSelect.length === 0 && stashSelect.length === 1 - ? itemInfo.items.find(i => i.item === vbox.bound[stashSelect[0]]).cost + ? itemInfo.items.find(i => i.item === vbox.stash[stashSelect[0]]).cost : 0; const tutorialDisabled = tutorial && tutorial < 8 && instance.time_control === 'Practice' && instance.rounds.length === 1; @@ -172,7 +172,7 @@ class Vbox extends preact.Component { onClick={e => e.stopPropagation()} onMouseDown={e => { e.stopPropagation(); - sendVboxReclaim(vboxSelected.stashSelect[0]); + sendVboxRefund(vboxSelected.stashSelect[0]); }}> refund
{refund}b diff --git a/client/src/components/vbox.stash.jsx b/client/src/components/vbox.stash.jsx index 97511443..cec94686 100644 --- a/client/src/components/vbox.stash.jsx +++ b/client/src/components/vbox.stash.jsx @@ -81,7 +81,7 @@ class stashElement extends preact.Component { } if (notValidCombo) { - setInfo(vbox.bound[i]); + setInfo(vbox.stash[i]); return setVboxSelected({ storeSelect: [], stashSelect: [i] }); } @@ -123,7 +123,7 @@ class stashElement extends preact.Component { onDragOver={ev => ev.preventDefault()} onDrop={stashClick} > - {range(0, 6).map(i => stashBtn(vbox.bound[i], i))} + {range(0, 6).map(i => stashBtn(vbox.stash[i], i.toString()))} ); } diff --git a/client/src/components/vbox.store.jsx b/client/src/components/vbox.store.jsx index 9a168fc6..f4d1878c 100644 --- a/client/src/components/vbox.store.jsx +++ b/client/src/components/vbox.store.jsx @@ -32,7 +32,7 @@ class storeElement extends preact.Component { const { storeSelect, stashSelect } = vboxSelected; function availableBtn(v, group, index) { - if (!v) return ; + if (!v) return ; const selected = storeSelect.length && storeSelect.some(vs => vs[0] === group && vs[1] === index); const notValidCombo = vboxHighlight && !vboxHighlight.includes(v); @@ -63,7 +63,7 @@ class storeElement extends preact.Component { const disabled = vbox.bits <= group; return (