From ab78b410470f85be44d6de8dfda70e029aa1b81a Mon Sep 17 00:00:00 2001 From: Mashy Date: Wed, 3 Apr 2019 23:14:51 +1000 Subject: [PATCH] Show equipped specs --- client/src/components/info.component.jsx | 44 ++++++++++---------- client/src/components/instance.component.jsx | 13 +++--- client/src/utils.jsx | 7 ++++ 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/client/src/components/info.component.jsx b/client/src/components/info.component.jsx index 4eb9db82..0674b523 100644 --- a/client/src/components/info.component.jsx +++ b/client/src/components/info.component.jsx @@ -8,13 +8,20 @@ function Info(args) { } = args; if (!info) return (
 
); + if (info.type === 'item') { + return ( +
+ {info.value} - what does it do? +
+ ); + } + if (info.type === 'skill') { return (
{info.value.skill}
{SKILLS[info.value.skill].description}
-
{SKILLS[info.value.skill].upgrades}
); } + if (info.type === 'spec') { + return ( +
+
+
{info.value.spec}
+
{SPECS[info.value.spec].description}
+
+ +
+ ); + } + if (info.type === 'cryp') { const stats = [ { stat: 'hp', disp: 'Hp', colour: '#1FF01F' }, @@ -32,35 +53,16 @@ function Info(args) { { stat: 'green_damage', disp: 'Green Damage', colour: '#1FF01F' }, { stat: 'speed', disp: 'Speed', colour: '#FFD123' }, ].map((s, i) => ( -
{s.disp}: {info.value[s.stat].max}
+
{s.disp}: {info.value[s.stat].base} -> {info.value[s.stat].max}
)); - const skills = info.value.skills.map((s, i) => ); - return (
{info.value.name}
{stats} - {skills}
); } - /*if (info.item) { - if (SKILLS[info.item]) { - itemDetails = SKILLS[info.item]; - } else if (SPECS[info.item]) { - itemDetails = SPECS[info.item]; - } else if (COLOURS[info.item]) { - itemDetails = COLOURS[info.item]; - } - }*/ - - -/* const unequip = (itemDetails && info.cryp) - ? - : null; -*/ - } module.exports = Info; diff --git a/client/src/components/instance.component.jsx b/client/src/components/instance.component.jsx index e8340934..92a6a666 100644 --- a/client/src/components/instance.component.jsx +++ b/client/src/components/instance.component.jsx @@ -7,7 +7,7 @@ const InfoContainer = require('./info.container'); const molecule = require('./molecule'); const shapes = require('./shapes'); -const { STATS } = require('../utils'); +const { STATS, SPECS } = require('../utils'); function Cryp(cryp, sendVboxApply, setInfo) { const skills = range(0, 4).map(i => { @@ -29,11 +29,10 @@ function Cryp(cryp, sendVboxApply, setInfo) { const item = parseInt(e.dataTransfer.getData('text'), 10); return sendVboxApply(cryp.id, item); } - - const stats = Object.values(STATS).map((s, i) => ( -
- {s.svg(`stat-icon ${s.colour}`)} -
{cryp[s.stat].value}
+ const specs = cryp.specs.map((s, i) => ( +
setInfo('spec', { spec: s, cryp })}> + {SPECS[s].svg(`stat-icon ${SPECS[s].colour}`)} +
{i}
)); @@ -54,7 +53,7 @@ function Cryp(cryp, sendVboxApply, setInfo) {
- {stats} + {specs}
); diff --git a/client/src/utils.jsx b/client/src/utils.jsx index 2a4cf361..2360be49 100644 --- a/client/src/utils.jsx +++ b/client/src/utils.jsx @@ -64,6 +64,12 @@ const STATS = { speed: { stat: 'speed', colour: 'yellow', svg: shapes.triangle }, }; +const SPECS = { + Hp: { colour: 'green', svg: shapes.square }, + Damage: { colour: 'red', svg: shapes.hexagon }, + Speed: { colour: 'yellow', svg: shapes.diamond }, +}; + module.exports = { stringSort, numSort, @@ -71,4 +77,5 @@ module.exports = { requestAvatar, NULL_UUID, STATS, + SPECS, };