Show specials; handle import of specials

This commit is contained in:
Cmdr McDonald
2016-11-27 19:43:43 +00:00
parent 37f889e317
commit 2c9237626d
7 changed files with 441 additions and 18 deletions

View File

@@ -277,6 +277,7 @@ export function shipFromJson(json) {
function _addModifications(module, modifiers, blueprint, grade) {
if (!modifiers || !modifiers.modifiers) return;
var special;
for (const i in modifiers.modifiers) {
// Look up the modifiers to find what we need to do
const modifierActions = Modifications.modifierActions[modifiers.modifiers[i].name];
@@ -295,14 +296,22 @@ function _addModifications(module, modifiers, blueprint, grade) {
module.setModValue(action, ((1 + mod) * (1 + actionValue) - 1) * 10000);
}
}
// Note the special if present
if (modifiers.modifiers[i].name && modifiers.modifiers[i].name.startsWith('special_')) {
special = Modifications.specials[modifiers.modifiers[i].name];
}
}
// Add the blueprint ID and grade
// Add the blueprint ID, grade and special
if (blueprint) {
module.blueprint = Modifications.blueprints[blueprint];
module.blueprint = Object.assign({}, Modifications.blueprints[blueprint]);
if (grade) {
module.blueprint.grade = Number(grade);
}
if (special) {
module.blueprint.special = special;
}
}
// Need to fix up a few items