move item into its own mod
This commit is contained in:
@@ -4,8 +4,8 @@ export const setAccount = value => ({ type: SET_ACCOUNT, value });
|
||||
export const SET_CRYPS = 'SET_CRYPS';
|
||||
export const setCryps = value => ({ type: SET_CRYPS, value });
|
||||
|
||||
export const SET_VBOX_INFO = 'SET_VBOX_INFO';
|
||||
export const setVboxInfo = value => ({ type: SET_VBOX_INFO, value });
|
||||
export const SET_ITEM_INFO = 'SET_ITEM_INFO';
|
||||
export const setItemInfo = value => ({ type: SET_ITEM_INFO, value });
|
||||
|
||||
export const SET_SKIP = 'SET_SKIP';
|
||||
export const setSkip = value => ({ type: SET_SKIP, value });
|
||||
|
||||
@@ -15,7 +15,7 @@ function Info(args) {
|
||||
sendUnequip,
|
||||
instance,
|
||||
player,
|
||||
vboxInfo,
|
||||
itemInfo,
|
||||
vboxHidden,
|
||||
} = args;
|
||||
|
||||
@@ -166,7 +166,7 @@ function Info(args) {
|
||||
if (!player) return false;
|
||||
|
||||
if (!(combiner.every(u => u === null))) {
|
||||
const filteredCombos = vboxInfo.combos
|
||||
const filteredCombos = itemInfo.combos
|
||||
.filter(combo => combiner.every(u => u === null
|
||||
|| combo.units.includes(player.vbox.bound[u])));
|
||||
if (filteredCombos.length > 6) return false;
|
||||
@@ -183,7 +183,7 @@ function Info(args) {
|
||||
</table>
|
||||
);
|
||||
}
|
||||
const vboxCombos = vboxInfo.combos.filter(c => c.units.includes(info[1]));
|
||||
const vboxCombos = itemInfo.combos.filter(c => c.units.includes(info[1]));
|
||||
if (vboxCombos.length > 6) return false;
|
||||
return (
|
||||
<table>
|
||||
|
||||
@@ -11,7 +11,7 @@ const addState = connect(
|
||||
info,
|
||||
ws,
|
||||
instance,
|
||||
vboxInfo,
|
||||
itemInfo,
|
||||
vboxHidden,
|
||||
player,
|
||||
} = state;
|
||||
@@ -27,7 +27,7 @@ const addState = connect(
|
||||
sendUnequip,
|
||||
instance,
|
||||
player,
|
||||
vboxInfo,
|
||||
itemInfo,
|
||||
vboxHidden,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -8,8 +8,8 @@ const shapes = require('./shapes');
|
||||
|
||||
const addState = connect(
|
||||
function receiveState(state) {
|
||||
const { activeCryp, player, vboxInfo } = state;
|
||||
return { activeCryp, player, vboxInfo };
|
||||
const { activeCryp, player, itemInfo } = state;
|
||||
return { activeCryp, player, itemInfo };
|
||||
},
|
||||
|
||||
function receiveDispatch(dispatch) {
|
||||
@@ -38,7 +38,7 @@ function InfoCryp(args) {
|
||||
const {
|
||||
activeCryp,
|
||||
player,
|
||||
vboxInfo,
|
||||
itemInfo,
|
||||
|
||||
setVboxHidden,
|
||||
setInfo,
|
||||
@@ -52,8 +52,8 @@ function InfoCryp(args) {
|
||||
if (!cryp) return false;
|
||||
|
||||
function setHighlight(type) {
|
||||
if (type === 'skill') return setVboxHighlight(vboxInfo.items.filter(v => v.skill).map(v => v.v));
|
||||
if (type === 'spec') return setVboxHighlight(vboxInfo.items.filter(v => v.spec).map(v => v.v));
|
||||
if (type === 'skill') return setVboxHighlight(itemInfo.items.filter(v => v.skill).map(v => v.v));
|
||||
if (type === 'spec') return setVboxHighlight(itemInfo.items.filter(v => v.spec).map(v => v.v));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ const actions = require('../actions');
|
||||
|
||||
const addState = connect(
|
||||
function receiveState(state) {
|
||||
const { ws, instance, player, account, vboxHidden, vboxInfo, activeItem, activeCryp } = state;
|
||||
const { ws, instance, player, account, vboxHidden, itemInfo, activeItem, activeCryp } = state;
|
||||
|
||||
function sendInstanceReady() {
|
||||
return ws.sendInstanceReady(instance.id);
|
||||
@@ -18,7 +18,7 @@ const addState = connect(
|
||||
return ws.sendVboxApply(instance.id, crypId, i);
|
||||
}
|
||||
|
||||
return { instance, player, account, sendInstanceReady, sendVboxApply, vboxHidden, vboxInfo, activeItem, activeCryp };
|
||||
return { instance, player, account, sendInstanceReady, sendVboxApply, vboxHidden, itemInfo, activeItem, activeCryp };
|
||||
},
|
||||
|
||||
function receiveDispatch(dispatch) {
|
||||
@@ -57,12 +57,12 @@ function Cryp(props) {
|
||||
setInfo,
|
||||
setActiveCryp,
|
||||
setVboxHighlight,
|
||||
vboxInfo,
|
||||
itemInfo,
|
||||
} = props;
|
||||
|
||||
function setHighlight(type) {
|
||||
if (type === 'skill') return setVboxHighlight(vboxInfo.items.filter(v => v.skill).map(v => v.v));
|
||||
if (type === 'spec') return setVboxHighlight(vboxInfo.items.filter(v => v.spec).map(v => v.v));
|
||||
if (type === 'skill') return setVboxHighlight(itemInfo.items.filter(v => v.skill).map(v => v.v));
|
||||
if (type === 'spec') return setVboxHighlight(itemInfo.items.filter(v => v.spec).map(v => v.v));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@ function Cryp(props) {
|
||||
}
|
||||
|
||||
const { vbox } = player;
|
||||
const skillList = vboxInfo.items.filter(v => v.skill).map(v => v.v);
|
||||
const specList = vboxInfo.items.filter(v => v.spec).map(v => v.v);
|
||||
const skillList = itemInfo.items.filter(v => v.skill).map(v => v.v);
|
||||
const specList = itemInfo.items.filter(v => v.spec).map(v => v.v);
|
||||
|
||||
const skills = range(0, 3).map(i => {
|
||||
const skill = cryp.skills[i];
|
||||
@@ -194,7 +194,7 @@ function InstanceCryps(props) {
|
||||
|
||||
sendVboxApply,
|
||||
vboxHidden,
|
||||
vboxInfo,
|
||||
itemInfo,
|
||||
setVboxHighlight,
|
||||
} = props;
|
||||
|
||||
@@ -202,7 +202,7 @@ function InstanceCryps(props) {
|
||||
if (instance.phase === 'Lobby') return false;
|
||||
|
||||
const cryps = player.cryps.map((c, i) => Cryp({
|
||||
activeCryp, activeItem, cryp: c, player, sendVboxApply, setInfo, setActiveCryp, vboxInfo, setVboxHighlight,
|
||||
activeCryp, activeItem, cryp: c, player, sendVboxApply, setInfo, setActiveCryp, itemInfo, setVboxHighlight,
|
||||
}));
|
||||
|
||||
const classes = `cryp-list ${vboxHidden ? '' : 'hidden'}`;
|
||||
|
||||
@@ -7,13 +7,13 @@ const { convertItem, SPECS } = require('./../utils');
|
||||
|
||||
const addState = connect(
|
||||
function receiveState(state) {
|
||||
const { player, vboxInfo, info, ws, instance } = state;
|
||||
const { player, itemInfo, info, ws, instance } = state;
|
||||
|
||||
function sendUnequip(crypId, item) {
|
||||
return ws.sendVboxUnequip(instance.id, crypId, item);
|
||||
}
|
||||
|
||||
return { player, vboxInfo, info, sendUnequip };
|
||||
return { player, itemInfo, info, sendUnequip };
|
||||
},
|
||||
|
||||
function receiveDispatch(dispatch) {
|
||||
@@ -38,7 +38,7 @@ function Equipment(props) {
|
||||
const {
|
||||
player,
|
||||
info,
|
||||
vboxInfo,
|
||||
itemInfo,
|
||||
sendUnequip,
|
||||
setInfo,
|
||||
setActiveItem,
|
||||
@@ -70,8 +70,8 @@ function Equipment(props) {
|
||||
const specClass = infoType === 'spec' ? 'specs highlight' : 'specs';
|
||||
|
||||
// const classes = `right ${skill ? '' : 'action'}`;
|
||||
const skillList = vboxInfo.items.filter(v => v.skill).map(v => v.v);
|
||||
const specList = vboxInfo.items.filter(v => v.spec).map(v => v.v);
|
||||
const skillList = itemInfo.items.filter(v => v.skill).map(v => v.v);
|
||||
const specList = itemInfo.items.filter(v => v.spec).map(v => v.v);
|
||||
|
||||
|
||||
const skills = range(0, 9).map(i => {
|
||||
|
||||
@@ -26,7 +26,7 @@ function Vbox(args) {
|
||||
vboxHidden,
|
||||
vboxHighlight,
|
||||
setVboxHighlight,
|
||||
vboxInfo,
|
||||
itemInfo,
|
||||
} = args;
|
||||
|
||||
if (!player) return false;
|
||||
@@ -39,10 +39,10 @@ function Vbox(args) {
|
||||
|
||||
const combinerValues = newCombiner.map(cv => player.vbox.bound[cv]).filter(cv => cv);
|
||||
|
||||
const filteredCombos = vboxInfo.combos
|
||||
const filteredCombos = itemInfo.combos
|
||||
.filter(combo => combinerValues.every(u => combo.units.includes(u)));
|
||||
|
||||
const comboValues = vboxInfo.items.filter(v => {
|
||||
const comboValues = itemInfo.items.filter(v => {
|
||||
if (!filteredCombos.some(c => c.units.includes(v.v))) return false;
|
||||
if (!['Red', 'Green', 'Blue'].includes(v.v) && combinerValues.includes(v.v)) return false;
|
||||
return true;
|
||||
|
||||
@@ -17,7 +17,7 @@ const addState = connect(
|
||||
info,
|
||||
vboxHidden,
|
||||
vboxHighlight,
|
||||
vboxInfo,
|
||||
itemInfo,
|
||||
} = state;
|
||||
|
||||
function sendVboxApply(i) {
|
||||
@@ -48,7 +48,7 @@ const addState = connect(
|
||||
activeItem,
|
||||
activeCryp,
|
||||
info,
|
||||
vboxInfo,
|
||||
itemInfo,
|
||||
vboxHidden,
|
||||
vboxHighlight,
|
||||
sendVboxAccept,
|
||||
|
||||
@@ -37,7 +37,7 @@ function registerEvents(store) {
|
||||
crypAnimations();
|
||||
|
||||
function setPing(ping) {
|
||||
store.dispatch(actions.setPing(ping));
|
||||
store.dispatch(actions.setPing(ping));
|
||||
}
|
||||
|
||||
function setCryps(cryps) {
|
||||
@@ -158,8 +158,8 @@ function registerEvents(store) {
|
||||
console.log('EVENT ->', 'crypStatusUpdate', { id, skill, target });
|
||||
}
|
||||
|
||||
function setVboxInfo(v) {
|
||||
return store.dispatch(actions.setVboxInfo(v));
|
||||
function setItemInfo(v) {
|
||||
return store.dispatch(actions.setItemInfo(v));
|
||||
}
|
||||
|
||||
// events.on('SET_PLAYER', setInstance);
|
||||
@@ -220,7 +220,7 @@ function registerEvents(store) {
|
||||
setZone,
|
||||
setPing,
|
||||
setScores,
|
||||
setVboxInfo,
|
||||
setItemInfo,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,6 @@ module.exports = {
|
||||
showLog: createReducer(false, actions.SET_SHOW_LOG),
|
||||
vboxHidden: createReducer(false, actions.SET_VBOX_HIDDEN),
|
||||
vboxHighlight: createReducer([], actions.SET_VBOX_HIGHLIGHT),
|
||||
vboxInfo: createReducer({ combos: [], items: [] }, actions.SET_VBOX_INFO),
|
||||
itemInfo: createReducer({ combos: [], items: [] }, actions.SET_VBOX_INFO),
|
||||
ws: createReducer(null, actions.SET_WS),
|
||||
};
|
||||
|
||||
@@ -114,8 +114,8 @@ function createSocket(events) {
|
||||
send({ method: 'player_vbox_reclaim', params: { instance_id: instanceId, index } });
|
||||
}
|
||||
|
||||
function sendVboxInfo() {
|
||||
send({ method: 'vbox_info', params: {} });
|
||||
function sendItemInfo() {
|
||||
send({ method: 'item_info', params: {} });
|
||||
}
|
||||
|
||||
function sendGameSkill(gameId, crypId, targetCrypId, skill) {
|
||||
@@ -177,7 +177,7 @@ function createSocket(events) {
|
||||
|
||||
function accountInstanceList(res) {
|
||||
const [struct, playerList] = res;
|
||||
sendVboxInfo();
|
||||
sendItemInfo();
|
||||
events.setInstanceList(playerList);
|
||||
}
|
||||
|
||||
@@ -228,9 +228,9 @@ function createSocket(events) {
|
||||
clearTimeout(instanceStateTimeout);
|
||||
}
|
||||
|
||||
function vboxInfo(response) {
|
||||
function itemInfo(response) {
|
||||
const [structName, info] = response;
|
||||
events.setVboxInfo(info);
|
||||
events.setItemInfo(info);
|
||||
}
|
||||
|
||||
function pong() {
|
||||
@@ -255,7 +255,7 @@ function createSocket(events) {
|
||||
zone_state: zoneState,
|
||||
zone_close: res => console.log(res),
|
||||
instance_state: instanceState,
|
||||
vbox_info: vboxInfo,
|
||||
item_info: itemInfo,
|
||||
pong,
|
||||
};
|
||||
|
||||
@@ -367,7 +367,7 @@ function createSocket(events) {
|
||||
sendVboxCombine,
|
||||
sendVboxDiscard,
|
||||
sendVboxUnequip,
|
||||
sendVboxInfo,
|
||||
sendItemInfo,
|
||||
startInstanceStateTimeout,
|
||||
startGameStateTimeout,
|
||||
connect,
|
||||
|
||||
Reference in New Issue
Block a user