From 70f3796d14b7bc2f4716f6dc962371eff9d751ad Mon Sep 17 00:00:00 2001 From: ntr Date: Wed, 8 May 2019 18:54:50 +1000 Subject: [PATCH] blaheah --- client/src/components/info.component.jsx | 27 ++++++++++++++++++++---- client/src/components/info.container.jsx | 23 ++------------------ client/src/components/vbox.component.jsx | 7 ++++-- client/src/events.jsx | 1 + 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/client/src/components/info.component.jsx b/client/src/components/info.component.jsx index 5c67d946..b62226c7 100644 --- a/client/src/components/info.component.jsx +++ b/client/src/components/info.component.jsx @@ -10,14 +10,12 @@ const InfoCryp = require('./info.cryp'); function Info(args) { const { activeCryp, - setActiveCryp, info, + combiner, sendUnequip, instance, player, - setInfo, vboxInfo, - setVboxHidden, vboxHidden, } = args; @@ -160,6 +158,27 @@ function Info(args) { function Combos() { if (!info[0]) return false; if (activeCryp) return false; + if (!player) return false; + + if (combiner[0] !== null) { + + const filteredCombos = vboxInfo.combos + .filter(combo => combiner.every(u => u === null || combo.units.includes(player.vbox.bound[u]))); + + return ( + + + {filteredCombos.map((c, i) => + + + {c.units.map(u => )} + + )} + +
{convertVar(c.var)}{convertVar(u)}
+ ); + } + return ( @@ -183,8 +202,8 @@ function Info(args) { return (
- +
); diff --git a/client/src/components/info.container.jsx b/client/src/components/info.container.jsx index c9220fce..9acd039a 100644 --- a/client/src/components/info.container.jsx +++ b/client/src/components/info.container.jsx @@ -7,6 +7,7 @@ const addState = connect( function receiveState(state) { const { activeCryp, + combiner, info, ws, instance, @@ -22,6 +23,7 @@ const addState = connect( return { activeCryp, info, + combiner, sendUnequip, instance, player, @@ -29,27 +31,6 @@ const addState = connect( vboxHidden, }; }, - - function receiveDispatch(dispatch) { - function setInfo(item, value) { - dispatch(actions.setInfo([item, value])); - } - - function setActiveCryp(value) { - dispatch(actions.setActiveCryp(value)); - } - - function setVboxHidden(value) { - dispatch(actions.setVboxHidden(value)); - } - - return { - setInfo, - setVboxHidden, - setActiveCryp, - }; - } - ); module.exports = addState(Info); diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index 7e1032a9..ba883045 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -106,14 +106,17 @@ function Vbox(args) { // INVENTORY // function boundClick(e, i, highlight) { - if (reclaiming && vbox.bound[i]) sendVboxReclaim(i); + const value = vbox.bound[i]; + if (reclaiming && value) sendVboxReclaim(i); else if (highlight && activeCryp) { sendVboxApply(i); showTeam(); - } else if (vbox.bound[i]) { + } else if (value) { const insert = combiner.findIndex(j => j === null); if (insert === -1) return setCombiner([i, null, null]); combiner[insert] = i; + setInfo('item', value); + setActiveCryp(null); return setCombiner(combiner); } return false; diff --git a/client/src/events.jsx b/client/src/events.jsx index cfdff2ec..869b91e5 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -96,6 +96,7 @@ function registerEvents(store) { } function clearCombiner() { + store.dispatch(actions.setInfo(null)); store.dispatch(actions.setCombiner([null, null, null])); }