what a goddamn nightmare
This commit is contained in:
parent
52bec725f7
commit
a2b1e2d3ff
@ -420,19 +420,25 @@ button.equipping {
|
|||||||
|
|
||||||
.thresholds {
|
.thresholds {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row-wrap;
|
flex-flow: column;
|
||||||
/*align-items: center;*/
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thresholds hr {
|
||||||
|
margin: 1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colour-reqs {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spec-goals {
|
.thresholds figure svg {
|
||||||
}
|
|
||||||
|
|
||||||
.spec-goals figure svg {
|
|
||||||
height: 2em;
|
height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spec-goals .unmet {
|
.thresholds .unmet {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
const { Fragment } = require('preact');
|
||||||
const range = require('lodash/range');
|
const range = require('lodash/range');
|
||||||
|
|
||||||
const { INFO } = require('./../constants');
|
const { INFO } = require('./../constants');
|
||||||
@ -43,32 +44,54 @@ function InfoComponent(args) {
|
|||||||
});
|
});
|
||||||
const teamColours = { red, blue, green };
|
const teamColours = { red, blue, green };
|
||||||
|
|
||||||
const breaks = fullInfo.values;
|
const colourReqs = fullInfo.values.bonuses || [];
|
||||||
const colourReqs = fullInfo.values || [];
|
|
||||||
|
|
||||||
const thresholdEl = colourReqs.map((c, i) => {
|
const thresholds = colourReqs.map((bonus, i) => {
|
||||||
const numIcons = Math.max(...breaks);
|
const colours = ['red', 'green', 'blue'];
|
||||||
const dots = range(0, numIcons).map(j => {
|
const colourGoals = colours.map(c => {
|
||||||
const unmet = teamColours[c] < j + 1;
|
const colourReq = bonus.req[c];
|
||||||
const caption = breaks.includes(j + 1)
|
if (colourReqs === 0) return false;
|
||||||
? '+ x'
|
|
||||||
: '';
|
|
||||||
|
|
||||||
const reqClass = unmet
|
const start = i === 0
|
||||||
? 'unmet'
|
? 0
|
||||||
: '';
|
: colourReqs[i - 1].req[c];
|
||||||
|
|
||||||
|
const dots = range(start, colourReq).map(j => {
|
||||||
|
const unmet = teamColours[c] < j + 1;
|
||||||
|
|
||||||
|
const reqClass = unmet
|
||||||
|
? 'unmet'
|
||||||
|
: '';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<figure key={j} alt={c.colour} className={reqClass} >
|
||||||
|
{COLOUR_ICONS[c].svg(`stat-icon ${COLOUR_ICONS[c].colour}`)}
|
||||||
|
</figure>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<figure key={j} alt={c.colour} className={reqClass} >
|
<div key={c}>
|
||||||
{COLOUR_ICONS[c].svg(`stat-icon ${COLOUR_ICONS[c].colour}`)}
|
{dots}
|
||||||
<figcaption>{caption}</figcaption>
|
</div>
|
||||||
</figure>
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const reqsMet = colours.every(c => teamColours[c] >= bonus.req[c]);
|
||||||
|
|
||||||
|
const reqClass = reqsMet
|
||||||
|
? ''
|
||||||
|
: 'unmet';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={i} className="spec-goals">
|
<div key={i} className="spec-goal">
|
||||||
{dots}
|
<div className="colour-reqs">
|
||||||
|
{colourGoals}
|
||||||
|
</div>
|
||||||
|
<div className={reqClass}>
|
||||||
|
+ {bonus.bonus}
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -78,7 +101,7 @@ function InfoComponent(args) {
|
|||||||
<h2>{info}</h2>
|
<h2>{info}</h2>
|
||||||
<div>{fullInfo.description}</div>
|
<div>{fullInfo.description}</div>
|
||||||
<div className="thresholds">
|
<div className="thresholds">
|
||||||
{thresholdEl}
|
{thresholds}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -3,7 +3,7 @@ const preact = require('preact');
|
|||||||
const range = require('lodash/range');
|
const range = require('lodash/range');
|
||||||
|
|
||||||
const shapes = require('./shapes');
|
const shapes = require('./shapes');
|
||||||
const { SPECS, STATS, instanceConstruct } = require('../utils');
|
const { STATS, instanceConstruct } = require('../utils');
|
||||||
const actions = require('../actions');
|
const actions = require('../actions');
|
||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
@ -152,6 +152,8 @@ function Construct(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const specInfo = itemInfo.items.find(i => i.item === s);
|
||||||
|
|
||||||
function specClick(e) {
|
function specClick(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setItemUnequip(s);
|
setItemUnequip(s);
|
||||||
@ -174,8 +176,8 @@ function Construct(props) {
|
|||||||
onClick={specClick}
|
onClick={specClick}
|
||||||
onDblClick={specDblClick}
|
onDblClick={specDblClick}
|
||||||
onMouseOver={e => hoverInfo(e, s)} >
|
onMouseOver={e => hoverInfo(e, s)} >
|
||||||
{SPECS[s].svg(`stat-icon ${SPECS[s].colour}`)}
|
{shapes[specInfo.values.shape.toLowerCase()](`stat-icon ${specInfo.values.colour}`)}
|
||||||
<figcaption>{SPECS[s].caption}</figcaption>
|
<figcaption>{s}</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -64,9 +64,11 @@ function Equipment(props) {
|
|||||||
const isSkill = fullInfo && fullInfo.skill;
|
const isSkill = fullInfo && fullInfo.skill;
|
||||||
const isSpec = fullInfo && fullInfo.spec;
|
const isSpec = fullInfo && fullInfo.spec;
|
||||||
|
|
||||||
|
console.log('isSkill', isSkill, fullInfo);
|
||||||
|
|
||||||
function skillClick(e, i) {
|
function skillClick(e, i) {
|
||||||
if (itemUnequip && activeConstruct) return false;
|
if (itemUnequip && activeConstruct) return false;
|
||||||
const value = vbox.bound[i];
|
// const value = vbox.bound[i];
|
||||||
setItemEquip(i);
|
setItemEquip(i);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -87,31 +89,31 @@ function Equipment(props) {
|
|||||||
const skillClass = isSkill ? 'skills highlight' : 'skills';
|
const skillClass = isSkill ? 'skills highlight' : 'skills';
|
||||||
const specClass = isSpec ? 'specs highlight' : 'specs';
|
const specClass = isSpec ? 'specs highlight' : 'specs';
|
||||||
|
|
||||||
const skillList = itemInfo.items.filter(v => v.skill).map(v => v.item);
|
|
||||||
const specList = itemInfo.items.filter(v => v.spec).map(v => v.item);
|
|
||||||
|
|
||||||
const skills = range(0, 9).map(i => {
|
const skills = range(0, 9).map(i => {
|
||||||
const item = convertItem(vbox.bound[i]);
|
const item = convertItem(vbox.bound[i]);
|
||||||
if (skillList.includes(item)) {
|
const skillInfo = itemInfo.items.find(i => i.item === item);
|
||||||
|
if (skillInfo && skillInfo.skill) {
|
||||||
return (
|
return (
|
||||||
<button key={i} onClick={e => skillClick(e, i)} onMouseOver={e => hoverInfo(e, item)}>
|
<button key={i} onClick={e => skillClick(e, i)} onMouseOver={e => hoverInfo(e, item)}>
|
||||||
{item}
|
{item}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
} return false;
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
const specs = range(0, 9).map(i => {
|
const specs = range(0, 9).map(i => {
|
||||||
const item = convertItem(vbox.bound[i]);
|
const item = convertItem(vbox.bound[i]);
|
||||||
const fullInfo = itemInfo.items.find(i => i.item === item);
|
const specInfo = itemInfo.items.find(i => i.item === item);
|
||||||
if (fullInfo.spec) {
|
if (specInfo && specInfo.spec) {
|
||||||
return (
|
return (
|
||||||
<figure key={i} onClick={e => skillClick(e, i)} onMouseOver={e => hoverInfo(e, item)} >
|
<figure key={i} onClick={e => skillClick(e, i)} onMouseOver={e => hoverInfo(e, item)} >
|
||||||
{shapes[fullInfo.values.shape.toLowerCase()](`stat-icon ${itemInfo[item].colour}`)}
|
{shapes[specInfo.values.shape.toLowerCase()](`stat-icon ${specInfo.values.colour}`)}
|
||||||
<figcaption>{item}</figcaption>
|
<figcaption>{item}</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
);
|
);
|
||||||
} return false;
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (skills.every(s => !s)) skills.push(<button disabled={true}> </button>);
|
if (skills.every(s => !s)) skills.push(<button disabled={true}> </button>);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user