Fixed some issues
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"Weapons": {
|
||||
"Stick": { "cost": 50, "purchasable": true, "saleable": true, "scientistsRequired": 1, "combatBoost": 0.02 },
|
||||
"Dagger": { "cost": 75, "purchasable": true, "saleable": true, "scientistsRequired": 2, "combatBoost": 0.03 },
|
||||
"Sword": { "cost": 100, "purchasable": true, "saleable": true, "scientistsRequired": 3, "combatBoost": 0.04 },
|
||||
"Longsword": { "cost": 150, "purchasable": true, "saleable": true, "scientistsRequired": 4, "combatBoost": 0.05 },
|
||||
"Frying Pan": { "cost": 200, "purchasable": true, "saleable": true, "scientistsRequired": 5, "combatBoost": 0.06 }
|
||||
"Stick": { "cost": 50, "purchasable": true, "saleable": true, "scientistsRequired": 1, "visible": true, "combatBoost": 0.02 },
|
||||
"Dagger": { "cost": 75, "purchasable": true, "saleable": true, "scientistsRequired": 2, "visible": true, "combatBoost": 0.03 },
|
||||
"Sword": { "cost": 100, "purchasable": true, "saleable": true, "scientistsRequired": 3, "visible": true, "combatBoost": 0.04 },
|
||||
"Longsword": { "cost": 150, "purchasable": true, "saleable": true, "scientistsRequired": 4, "visible": true, "combatBoost": 0.05 },
|
||||
"Frying Pan": { "cost": 200, "purchasable": true, "saleable": true, "scientistsRequired": 5, "visible": true, "combatBoost": 0.06 }
|
||||
},
|
||||
"Armour": {
|
||||
"Leather": { "cost": 75, "purchasable": false, "saleable": true, "scientistsRequired": 2, "combatBoost": 0.02 },
|
||||
"Gambeson": { "cost": 100, "purchasable": false, "saleable": true, "scientistsRequired": 3, "combatBoost": 0.03 },
|
||||
"Chainmail": { "cost": 150, "purchasable": false, "saleable": true, "scientistsRequired": 4, "combatBoost": 0.04 },
|
||||
"Platemail": { "cost": 200, "purchasable": false, "saleable": true, "scientistsRequired": 5, "combatBoost": 0.05 }
|
||||
"Leather": { "cost": 75, "purchasable": false, "saleable": true, "scientistsRequired": 2, "visible": true, "combatBoost": 0.02 },
|
||||
"Gambeson": { "cost": 100, "purchasable": false, "saleable": true, "scientistsRequired": 3, "visible": true, "combatBoost": 0.03 },
|
||||
"Chainmail": { "cost": 150, "purchasable": false, "saleable": true, "scientistsRequired": 4, "visible": true, "combatBoost": 0.04 },
|
||||
"Platemail": { "cost": 200, "purchasable": false, "saleable": true, "scientistsRequired": 5, "visible": true, "combatBoost": 0.05 }
|
||||
},
|
||||
"Consumables": {
|
||||
"Potion": { "cost": 100, "purchasable": true, "saleable": true, "scientistsRequired": 1, "combatBoost": 0.04 }
|
||||
"Potion": { "cost": 100, "purchasable": true, "saleable": true, "scientistsRequired": 1, "visible": true, "combatBoost": 0.04 }
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,10 @@ class Equipment extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
let display = this.flattenStructure(this.state, this.props.scientists);
|
||||
|
||||
//if there are no scientists
|
||||
if (this.props.scientists <= 0) {
|
||||
if (this.props.scientists <= 0 && display.length === 0) {
|
||||
return (
|
||||
<div className='panel'>
|
||||
<p className='centered'>You have no scientists!</p>
|
||||
@@ -27,8 +29,6 @@ class Equipment extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
let display = this.flattenStructure(this.state, this.props.scientists);
|
||||
|
||||
return (
|
||||
<div className='panel'>
|
||||
<div className='table'>
|
||||
@@ -91,13 +91,13 @@ class Equipment extends React.Component {
|
||||
|
||||
Object.keys(structure.statistics).map((type) => {
|
||||
Object.keys(structure.statistics[type]).map((name) => {
|
||||
//don't render high level items
|
||||
if (structure.statistics[type][name].scientistsRequired > scientists) {
|
||||
//don't render high level items you don't own
|
||||
if (structure.statistics[type][name].scientistsRequired > scientists && !structure.owned[name]) {
|
||||
return;
|
||||
}
|
||||
|
||||
//if you can't buy it and you down own it, don't render it (for legendary items)
|
||||
if (!structure.statistics[type][name].purchasable && !structure.owned[name]) {
|
||||
//if you can't see it and you don't own it, don't render it (for legendary items)
|
||||
if (!structure.statistics[type][name].visible && !structure.owned[name]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,8 @@ class Equipment extends React.Component {
|
||||
name: name,
|
||||
type: type,
|
||||
owned: (structure.owned && structure.owned[name]) || 0,
|
||||
...structure.statistics[type][name]
|
||||
...structure.statistics[type][name],
|
||||
purchasable: structure.statistics[type][name].purchasable && structure.statistics[type][name].scientistsRequired <= scientists //negate purchasing of too-high-level items
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user