From 331844f904562ef05d2f8a58da6fcfddf2b79273 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 20 May 2019 12:31:37 +1000 Subject: [PATCH] client var -> item --- client/src/actions.jsx | 2 +- client/src/components/info.component.jsx | 16 +++++------ client/src/components/info.cryp.jsx | 4 +-- client/src/components/instance.container.jsx | 4 +-- client/src/components/instance.cryps.jsx | 28 ++++++++++---------- client/src/components/instance.equip.jsx | 20 +++++++------- client/src/components/vbox.component.jsx | 14 +++++----- client/src/components/vbox.container.jsx | 4 +-- client/src/events.jsx | 6 ++--- client/src/reducers.jsx | 4 +-- client/src/socket.jsx | 2 +- client/src/utils.jsx | 4 +-- 12 files changed, 54 insertions(+), 54 deletions(-) diff --git a/client/src/actions.jsx b/client/src/actions.jsx index deffd2ec..01ca414c 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -53,7 +53,7 @@ export const SET_ACTIVE_CRYP = 'SET_ACTIVE_CRYP'; export const setActiveCryp = value => ({ type: SET_ACTIVE_CRYP, value }); export const SET_ACTIVE_VAR = 'SET_ACTIVE_VAR'; -export const setActiveVar = value => ({ type: SET_ACTIVE_VAR, value }); +export const setActiveItem = value => ({ type: SET_ACTIVE_VAR, value }); export const SET_INFO = 'SET_INFO'; export const setInfo = value => ({ type: SET_INFO, value }); diff --git a/client/src/components/info.component.jsx b/client/src/components/info.component.jsx index 6284790e..bb1175b1 100644 --- a/client/src/components/info.component.jsx +++ b/client/src/components/info.component.jsx @@ -2,7 +2,7 @@ const preact = require('preact'); const range = require('lodash/range'); const { ITEMS: { SKILLS, COLOURS, SPECS: SPEC_CONSTANT } } = require('./../constants'); -const { COLOUR_ICONS, STATS, SPECS, convertVar, crypAvatar } = require('../utils'); +const { COLOUR_ICONS, STATS, SPECS, convertItem, crypAvatar } = require('../utils'); const shapes = require('./shapes'); const InfoCryp = require('./info.cryp'); @@ -19,7 +19,7 @@ function Info(args) { vboxHidden, } = args; - function CrypVar() { + function CrypItem() { if (!info) return false; const [type, value] = info; if (!type) return false; @@ -48,7 +48,7 @@ function Info(args) { return console.warn('UNHANLDED VAR', value); } return ( -
+
{value} - {itemDetails.description}
); @@ -175,8 +175,8 @@ function Info(args) { {filteredCombos.map((c, i) => - {convertVar(c.var)} - {c.units.map((u, j) => {convertVar(u)})} + {convertItem(c.item)} + {c.units.map((u, j) => {convertItem(u)})} )} @@ -190,8 +190,8 @@ function Info(args) { {vboxCombos.map((c, i) => - {convertVar(c.var)} - {c.units.map((u, j) => {convertVar(u)})} + {convertItem(c.item)} + {c.units.map((u, j) => {convertItem(u)})} )} @@ -207,7 +207,7 @@ function Info(args) { return (
- +
); diff --git a/client/src/components/info.cryp.jsx b/client/src/components/info.cryp.jsx index b64c837f..230864dc 100644 --- a/client/src/components/info.cryp.jsx +++ b/client/src/components/info.cryp.jsx @@ -52,8 +52,8 @@ function InfoCryp(args) { if (!cryp) return false; function setHighlight(type) { - if (type === 'skill') return setVboxHighlight(vboxInfo.vars.filter(v => v.skill).map(v => v.v)); - if (type === 'spec') return setVboxHighlight(vboxInfo.vars.filter(v => v.spec).map(v => v.v)); + 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)); return false; } diff --git a/client/src/components/instance.container.jsx b/client/src/components/instance.container.jsx index d7e32140..206333e9 100644 --- a/client/src/components/instance.container.jsx +++ b/client/src/components/instance.container.jsx @@ -6,7 +6,7 @@ const Instance = require('./instance.component'); const addState = connect( function receiveState(state) { - const { ws, instance, player, account, activeVar, vboxHidden } = state; + const { ws, instance, player, account, activeItem, vboxHidden } = state; function sendInstanceReady() { return ws.sendInstanceReady(instance.id); @@ -16,7 +16,7 @@ const addState = connect( return ws.sendVboxApply(instance.id, crypId, i); } - return { instance, player, account, sendInstanceReady, sendVboxApply, activeVar, vboxHidden }; + return { instance, player, account, sendInstanceReady, sendVboxApply, activeItem, vboxHidden }; }, function receiveDispatch(dispatch) { diff --git a/client/src/components/instance.cryps.jsx b/client/src/components/instance.cryps.jsx index 007930c5..95dae84d 100644 --- a/client/src/components/instance.cryps.jsx +++ b/client/src/components/instance.cryps.jsx @@ -8,7 +8,7 @@ const actions = require('../actions'); const addState = connect( function receiveState(state) { - const { ws, instance, player, account, vboxHidden, vboxInfo, activeVar, activeCryp } = state; + const { ws, instance, player, account, vboxHidden, vboxInfo, 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, activeVar, activeCryp }; + return { instance, player, account, sendInstanceReady, sendVboxApply, vboxHidden, vboxInfo, activeItem, activeCryp }; }, function receiveDispatch(dispatch) { @@ -50,7 +50,7 @@ const addState = connect( function Cryp(props) { const { activeCryp, - activeVar, + activeItem, cryp, player, sendVboxApply, @@ -61,21 +61,21 @@ function Cryp(props) { } = props; function setHighlight(type) { - if (type === 'skill') return setVboxHighlight(vboxInfo.vars.filter(v => v.skill).map(v => v.v)); - if (type === 'spec') return setVboxHighlight(vboxInfo.vars.filter(v => v.spec).map(v => v.v)); + 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)); return false; } function onClick(e) { e.stopPropagation(); e.preventDefault(); - if (activeVar !== null) sendVboxApply(cryp.id, activeVar); + if (activeItem !== null) sendVboxApply(cryp.id, activeItem); return setActiveCryp(cryp); } const { vbox } = player; - const skillList = vboxInfo.vars.filter(v => v.skill).map(v => v.v); - const specList = vboxInfo.vars.filter(v => v.spec).map(v => v.v); + 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 skills = range(0, 3).map(i => { const skill = cryp.skills[i]; @@ -84,7 +84,7 @@ function Cryp(props) { : (+); function skillClick(e) { - if (!skill && activeVar !== null) return sendVboxApply(cryp.id, activeVar); + if (!skill && activeItem !== null) return sendVboxApply(cryp.id, activeItem); if (!skill) setHighlight('skill'); else setInfo('skill', { skill: skill.skill, cryp }); e.stopPropagation(); @@ -92,7 +92,7 @@ function Cryp(props) { } const action = skill ? '' : 'action'; - const equip = skillList.includes(vbox.bound[activeVar]) && !skill ? 'equip' : ''; + const equip = skillList.includes(vbox.bound[activeItem]) && !skill ? 'equip' : ''; const classes = `right ${action} ${equip}`; return ( @@ -104,13 +104,13 @@ function Cryp(props) { function blankSpecClick(e) { e.stopPropagation(); - if (activeVar !== null) return sendVboxApply(cryp.id, activeVar); + if (activeItem !== null) return sendVboxApply(cryp.id, activeItem); setHighlight('spec'); return setActiveCryp(cryp); } if (!s) { - const equip = specList.includes(vbox.bound[activeVar]) ? 'equip-spec' : 'gray'; + const equip = specList.includes(vbox.bound[activeItem]) ? 'equip-spec' : 'gray'; return (
{shapes.diamond(`stat-icon ${equip}`)} @@ -185,7 +185,7 @@ function Cryp(props) { function InstanceCryps(props) { const { activeCryp, - activeVar, + activeItem, player, instance, // clearInfo, @@ -202,7 +202,7 @@ function InstanceCryps(props) { if (instance.phase === 'Lobby') return false; const cryps = player.cryps.map((c, i) => Cryp({ - activeCryp, activeVar, cryp: c, player, sendVboxApply, setInfo, setActiveCryp, vboxInfo, setVboxHighlight, + activeCryp, activeItem, cryp: c, player, sendVboxApply, setInfo, setActiveCryp, vboxInfo, setVboxHighlight, })); const classes = `cryp-list ${vboxHidden ? '' : 'hidden'}`; diff --git a/client/src/components/instance.equip.jsx b/client/src/components/instance.equip.jsx index aaf34f16..a45ca744 100644 --- a/client/src/components/instance.equip.jsx +++ b/client/src/components/instance.equip.jsx @@ -3,7 +3,7 @@ const preact = require('preact'); const range = require('lodash/range'); const actions = require('../actions'); -const { convertVar, SPECS } = require('./../utils'); +const { convertItem, SPECS } = require('./../utils'); const addState = connect( function receiveState(state) { @@ -25,11 +25,11 @@ const addState = connect( return dispatch(actions.setInfo([])); } - function setActiveVar(v) { - return dispatch(actions.setActiveVar(v)); + function setActiveItem(v) { + return dispatch(actions.setActiveItem(v)); } - return { setInfo, setActiveVar, clearInfo }; + return { setInfo, setActiveItem, clearInfo }; } ); @@ -41,7 +41,7 @@ function Equipment(props) { vboxInfo, sendUnequip, setInfo, - setActiveVar, + setActiveItem, } = props; const { vbox } = player; @@ -51,7 +51,7 @@ function Equipment(props) { function boundClick(e, i) { const value = vbox.bound[i]; setInfo('item', value); - setActiveVar(i); + setActiveItem(i); return false; } @@ -70,12 +70,12 @@ function Equipment(props) { const specClass = infoType === 'spec' ? 'specs highlight' : 'specs'; // const classes = `right ${skill ? '' : 'action'}`; - const skillList = vboxInfo.vars.filter(v => v.skill).map(v => v.v); - const specList = vboxInfo.vars.filter(v => v.spec).map(v => v.v); + 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 skills = range(0, 9).map(i => { - const item = convertVar(vbox.bound[i]); + const item = convertItem(vbox.bound[i]); if (skillList.includes(item)) { return (