diff --git a/src/app/Router.js b/src/app/Router.js index 3e7f19e1..37bd2305 100644 --- a/src/app/Router.js +++ b/src/app/Router.js @@ -269,6 +269,8 @@ function gaTrack(path) { } } ReactGA.pageview(path); + const _paq = window._paq || []; + _paq.push(['trackPageView']); } /** diff --git a/src/app/shipyard/Module.js b/src/app/shipyard/Module.js index cb37a9a7..8efd1bb4 100755 --- a/src/app/shipyard/Module.js +++ b/src/app/shipyard/Module.js @@ -639,15 +639,6 @@ export default class Module { return this.get('protection', modified); } - /** - * Get the delay for this module - * @param {Boolean} [modified=true] Whether to take modifications into account - * @return {Number} the delay of this module - */ - getDelay(modified = true) { - return this.get('delay', modified); - } - /** * Get the duration for this module * @param {Boolean} [modified=true] Whether to take modifications into account @@ -792,24 +783,6 @@ export default class Module { return this.get('distdraw', modified); } - /** - * Get the thermal load for this module - * @param {Boolean} [modified=true] Whether to take modifications into account - * @return {Number} the thermal load of this module - */ - getThermalLoad(modified = true) { - return this.get('thermload', modified); - } - - /** - * Get the rounds per shot for this module - * @param {Boolean} [modified=true] Whether to take modifications into account - * @return {Number} the rounds per shot of this module - */ - getRoundsPerShot(modified = true) { - return this.get('roundspershot', modified); - } - /** * Get the DPS for this module * @param {Boolean} [modified=true] Whether to take modifications into account @@ -875,7 +848,7 @@ export default class Module { */ getHps(modified = true) { // HPS is a synthetic value - let heat = this.getThermalLoad(modified); + let heat = this.get('thermload', modified); // We don't use rpshot here as dist draw is per combined shot let rof = this.getRoF(modified) || 1; @@ -912,24 +885,6 @@ export default class Module { return this.get('reload', modified); } - /** - * Get the burst size for this module - * @param {Boolean} [modified=true] Whether to take modifications into account - * @return {Number} the burst size of this module - */ - getBurst(modified = true) { - return this.get('burst', modified); - } - - /** - * Get the burst rate of fire for this module - * @param {Boolean} [modified=true] Whether to take modifications into account - * @return {Number} the burst rate of fire of this module - */ - getBurstRoF(modified = true) { - return this.get('burstrof', modified); - } - /** * Get the rate of fire for this module. * The rate of fire is a combination value, and needs to take in to account @@ -940,8 +895,8 @@ export default class Module { * @return {Number} the rate of fire for this module */ getRoF(modified = true) { - const burst = this.getBurst(modified) || 1; - const burstRoF = this.getBurstRoF(modified) || 1; + const burst = this.get('burst', modified) || 1; + const burstRoF = this.get('burstrof', modified) || 1; const intRoF = this.get('rof', modified); return burst / (((burst - 1) / burstRoF) + 1 / intRoF); diff --git a/src/app/utils/BlueprintFunctions.js b/src/app/utils/BlueprintFunctions.js index 2c38449d..93f26a14 100644 --- a/src/app/utils/BlueprintFunctions.js +++ b/src/app/utils/BlueprintFunctions.js @@ -372,9 +372,7 @@ export function getPercent(m) { let value = _getValue(m, featureName); let mult; - if (featureName == 'shieldboost') { - mult = ((1 + value) * (1 + m.shieldboost)) - 1 - m.shieldboost; - } else if (Modifications.modifications[featureName].higherbetter) { + if (Modifications.modifications[featureName].higherbetter) { // Higher is better, but is this making it better or worse? if (features[featureName][0] < 0 || (features[featureName][0] === 0 && features[featureName][1] < 0)) { mult = Math.round((value - features[featureName][1]) / (features[featureName][0] - features[featureName][1]) * 100); diff --git a/src/app/utils/SlotFunctions.js b/src/app/utils/SlotFunctions.js index 6c3245ff..8a969f3b 100644 --- a/src/app/utils/SlotFunctions.js +++ b/src/app/utils/SlotFunctions.js @@ -1,6 +1,7 @@ import React from 'react'; import Persist from '../stores/Persist'; import * as ModuleUtils from '../shipyard/ModuleUtils'; +import Module from '../shipyard/Module'; /** * Determine if a slot on a ship can mount a module of a particular class and group @@ -139,20 +140,21 @@ function diff(format, mVal, mmVal) { export function diffDetails(language, m, mm) { let { formats, translate, units } = language; let propDiffs = []; + m = new Module(m); // Module-specific items if (m.grp === 'pp') { - let mPowerGeneration = m.pgen || 0; + let mPowerGeneration = m.getPowerGeneration() || 0; let mmPowerGeneration = mm ? mm.getPowerGeneration() : 0; if (mPowerGeneration != mmPowerGeneration) propDiffs.push(
{translate('pgen')}: {diff(formats.round, mPowerGeneration, mmPowerGeneration)}{units.MW}
); } else { - let mPowerUsage = m.power || 0; + let mPowerUsage = m.getPowerUsage() || 0; let mmPowerUsage = mm ? mm.getPowerUsage() || 0 : 0; if (mPowerUsage != mmPowerUsage) propDiffs.push(
{translate('power')}: {diff(formats.round, mPowerUsage, mmPowerUsage)}{units.MW}
); } - let mDps = m.damage * (m.rpshot || 1) * (m.rof || 1); + let mDps = m.getDps() || 0; let mmDps = mm ? mm.getDps() || 0 : 0; if (mDps && mDps != mmDps) propDiffs.push(
{translate('dps')}: {diff(formats.round, mDps, mmDps)}
); @@ -164,7 +166,7 @@ export function diffDetails(language, m, mm) { if (mAffectsShield) { if (m.grp == 'sb') { // Both m and mm must be utility modules if this is true - newShield = this.calcShieldStrengthWith(null, m.shieldboost - (mm ? mm.getShieldBoost() || 0 : 0)); + newShield = this.calcShieldStrengthWith(null, m.getShieldBoost() - (mm ? mm.getShieldBoost() || 0 : 0)); } else { newShield = this.calcShieldStrengthWith(m); } @@ -179,7 +181,7 @@ export function diffDetails(language, m, mm) { } if (m.grp === 'mrp') { - let mProtection = m.protection; + let mProtection = m.getProtection(); let mmProtection = mm ? mm.getProtection() || 0 : 0; if (mProtection != mmProtection) { propDiffs.push(
{translate('protection')}: {diff(formats.pct, mProtection, mmProtection)}
); @@ -187,7 +189,7 @@ export function diffDetails(language, m, mm) { } if (m.grp === 'hr') { - let mHullReinforcement = m.hullreinforcement; + let mHullReinforcement = m.getHullReinforcement(); let mmHullReinforcement = mm ? mm.getHullReinforcement() || 0 : 0; if (mHullReinforcement && mHullReinforcement != mmHullReinforcement) propDiffs.push(
{translate('hullreinforcement')}: {diff(formats.round, mHullReinforcement, mmHullReinforcement)}
); } @@ -219,7 +221,7 @@ export function diffDetails(language, m, mm) { let mmCost = mm ? mm.cost : 0; if (mCost != mmCost) propDiffs.push(
{translate('cost')}: {formats.int(mCost ? Math.round(mCost * (1 - Persist.getModuleDiscount())) : 0)}{units.CR}
); - let mMass = m.mass || 0; + let mMass = m.getMass() || 0; let mmMass = mm ? mm.getMass() : 0; if (mMass != mmMass) propDiffs.push(
{translate('mass')}: {diff(formats.round, mMass, mmMass)}{units.T}
); @@ -240,7 +242,7 @@ export function diffDetails(language, m, mm) { } } - let mIntegrity = m.integrity || 0; + let mIntegrity = m.getIntegrity() || 0; let mmIntegrity = mm ? mm.getIntegrity() || 0 : 0; if (mIntegrity != mmIntegrity) { propDiffs.push(
{translate('integrity')}: {diff(formats.round, mIntegrity, mmIntegrity)}
); diff --git a/src/index.ejs b/src/index.ejs index 784b8414..37381f38 100644 --- a/src/index.ejs +++ b/src/index.ejs @@ -41,24 +41,26 @@ <% } %> - - + --> - + + - + +