From e00680113f5f85503c664b683c9c442c20b3cbdd Mon Sep 17 00:00:00 2001 From: Cmdr McDonald Date: Wed, 3 May 2017 19:15:07 +0100 Subject: [PATCH] Do not add hidden features --- src/app/utils/BlueprintFunctions.js | 69 +++++++++++++++++------------ 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/src/app/utils/BlueprintFunctions.js b/src/app/utils/BlueprintFunctions.js index 42e6430c..fe5f2aa9 100644 --- a/src/app/utils/BlueprintFunctions.js +++ b/src/app/utils/BlueprintFunctions.js @@ -11,6 +11,9 @@ import { Modifications } from 'coriolis-data/dist'; * @returns {Object} The react components */ export function blueprintTooltip(translate, blueprint, engineers, grp, m) { +console.log(`blueprint is ${JSON.stringify(blueprint)}`); +console.log(`engineers is ${JSON.stringify(engineers)}`); +console.log(`m is ${JSON.stringify(m)}`); const effects = []; for (const feature in blueprint.features) { const featureIsBeneficial = isBeneficial(feature, blueprint.features[feature]); @@ -39,6 +42,7 @@ export function blueprintTooltip(translate, blueprint, engineers, grp, m) { current /= 100; } const currentIsBeneficial = isValueBeneficial(feature, current); +console.log(`${feature}`); effects.push( {translate(feature, grp)} @@ -64,35 +68,7 @@ export function blueprintTooltip(translate, blueprint, engineers, grp, m) { for (const feature in m.mods) { if (!blueprint.features[feature]) { const featureDef = Modifications.modifications[feature]; - let symbol = ''; - if (feature === 'jitter') { - symbol = '°'; - } else if (featureDef.type === 'percentage') { - symbol = '%'; - } - let current = m.getModValue(feature); - if (featureDef.type === 'percentage' || featureDef.name === 'burst' || featureDef.name === 'burstrof') { - current = Math.round(current / 10) / 10; - } else if (featureDef.type === 'numeric') { - current /= 100; - } - const currentIsBeneficial = isValueBeneficial(feature, current); - effects.push( - - {translate(feature, grp)} -   - {current}{symbol} -   - - ); - } - } - - // We also add in any benefits from specials that aren't covered above - if (m.blueprint && m.blueprint.special) { - for (const feature in Modifications.modifierActions[m.blueprint.special.edname]) { - if (!blueprint.features[feature] && !m.mods.feature) { - const featureDef = Modifications.modifications[feature]; + if (featureDef && !featureDef.hidden) { let symbol = ''; if (feature === 'jitter') { symbol = '°'; @@ -106,6 +82,7 @@ export function blueprintTooltip(translate, blueprint, engineers, grp, m) { current /= 100; } const currentIsBeneficial = isValueBeneficial(feature, current); +console.log(`${feature}`); effects.push( {translate(feature, grp)} @@ -117,7 +94,41 @@ export function blueprintTooltip(translate, blueprint, engineers, grp, m) { } } } + + // We also add in any benefits from specials that aren't covered above + if (m.blueprint && m.blueprint.special) { + for (const feature in Modifications.modifierActions[m.blueprint.special.edname]) { + if (!blueprint.features[feature] && !m.mods.feature) { + const featureDef = Modifications.modifications[feature]; + if (featureDef && !featureDef.hidden) { + let symbol = ''; + if (feature === 'jitter') { + symbol = '°'; + } else if (featureDef.type === 'percentage') { + symbol = '%'; + } + let current = m.getModValue(feature); + if (featureDef.type === 'percentage' || featureDef.name === 'burst' || featureDef.name === 'burstrof') { + current = Math.round(current / 10) / 10; + } else if (featureDef.type === 'numeric') { + current /= 100; + } + const currentIsBeneficial = isValueBeneficial(feature, current); +console.log(`${feature}`); + effects.push( + + {translate(feature, grp)} +   + {current}{symbol} +   + + ); + } + } + } + } } + let components; if (!m) { components = [];