Merge branch 'develop'

This commit is contained in:
willyb321
2019-04-27 10:31:37 +10:00
5 changed files with 29 additions and 70 deletions

View File

@@ -269,6 +269,8 @@ function gaTrack(path) {
} }
} }
ReactGA.pageview(path); ReactGA.pageview(path);
const _paq = window._paq || [];
_paq.push(['trackPageView']);
} }
/** /**

View File

@@ -639,15 +639,6 @@ export default class Module {
return this.get('protection', modified); 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 * Get the duration for this module
* @param {Boolean} [modified=true] Whether to take modifications into account * @param {Boolean} [modified=true] Whether to take modifications into account
@@ -792,24 +783,6 @@ export default class Module {
return this.get('distdraw', modified); 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 * Get the DPS for this module
* @param {Boolean} [modified=true] Whether to take modifications into account * @param {Boolean} [modified=true] Whether to take modifications into account
@@ -875,7 +848,7 @@ export default class Module {
*/ */
getHps(modified = true) { getHps(modified = true) {
// HPS is a synthetic value // 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 // We don't use rpshot here as dist draw is per combined shot
let rof = this.getRoF(modified) || 1; let rof = this.getRoF(modified) || 1;
@@ -912,24 +885,6 @@ export default class Module {
return this.get('reload', modified); 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. * Get the rate of fire for this module.
* The rate of fire is a combination value, and needs to take in to account * 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 * @return {Number} the rate of fire for this module
*/ */
getRoF(modified = true) { getRoF(modified = true) {
const burst = this.getBurst(modified) || 1; const burst = this.get('burst', modified) || 1;
const burstRoF = this.getBurstRoF(modified) || 1; const burstRoF = this.get('burstrof', modified) || 1;
const intRoF = this.get('rof', modified); const intRoF = this.get('rof', modified);
return burst / (((burst - 1) / burstRoF) + 1 / intRoF); return burst / (((burst - 1) / burstRoF) + 1 / intRoF);

View File

@@ -372,9 +372,7 @@ export function getPercent(m) {
let value = _getValue(m, featureName); let value = _getValue(m, featureName);
let mult; let mult;
if (featureName == 'shieldboost') { if (Modifications.modifications[featureName].higherbetter) {
mult = ((1 + value) * (1 + m.shieldboost)) - 1 - m.shieldboost;
} else if (Modifications.modifications[featureName].higherbetter) {
// Higher is better, but is this making it better or worse? // Higher is better, but is this making it better or worse?
if (features[featureName][0] < 0 || (features[featureName][0] === 0 && features[featureName][1] < 0)) { 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); mult = Math.round((value - features[featureName][1]) / (features[featureName][0] - features[featureName][1]) * 100);

View File

@@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import Persist from '../stores/Persist'; import Persist from '../stores/Persist';
import * as ModuleUtils from '../shipyard/ModuleUtils'; 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 * 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) { export function diffDetails(language, m, mm) {
let { formats, translate, units } = language; let { formats, translate, units } = language;
let propDiffs = []; let propDiffs = [];
m = new Module(m);
// Module-specific items // Module-specific items
if (m.grp === 'pp') { if (m.grp === 'pp') {
let mPowerGeneration = m.pgen || 0; let mPowerGeneration = m.getPowerGeneration() || 0;
let mmPowerGeneration = mm ? mm.getPowerGeneration() : 0; let mmPowerGeneration = mm ? mm.getPowerGeneration() : 0;
if (mPowerGeneration != mmPowerGeneration) propDiffs.push(<div key='pgen'>{translate('pgen')}: <span className={diffClass(mPowerGeneration, mmPowerGeneration)}>{diff(formats.round, mPowerGeneration, mmPowerGeneration)}{units.MW}</span></div>); if (mPowerGeneration != mmPowerGeneration) propDiffs.push(<div key='pgen'>{translate('pgen')}: <span className={diffClass(mPowerGeneration, mmPowerGeneration)}>{diff(formats.round, mPowerGeneration, mmPowerGeneration)}{units.MW}</span></div>);
} else { } else {
let mPowerUsage = m.power || 0; let mPowerUsage = m.getPowerUsage() || 0;
let mmPowerUsage = mm ? mm.getPowerUsage() || 0 : 0; let mmPowerUsage = mm ? mm.getPowerUsage() || 0 : 0;
if (mPowerUsage != mmPowerUsage) propDiffs.push(<div key='power'>{translate('power')}: <span className={diffClass(mPowerUsage, mmPowerUsage, true)}>{diff(formats.round, mPowerUsage, mmPowerUsage)}{units.MW}</span></div>); if (mPowerUsage != mmPowerUsage) propDiffs.push(<div key='power'>{translate('power')}: <span className={diffClass(mPowerUsage, mmPowerUsage, true)}>{diff(formats.round, mPowerUsage, mmPowerUsage)}{units.MW}</span></div>);
} }
let mDps = m.damage * (m.rpshot || 1) * (m.rof || 1); let mDps = m.getDps() || 0;
let mmDps = mm ? mm.getDps() || 0 : 0; let mmDps = mm ? mm.getDps() || 0 : 0;
if (mDps && mDps != mmDps) propDiffs.push(<div key='dps'>{translate('dps')}: <span className={diffClass(mmDps, mDps, true)}>{diff(formats.round, mDps, mmDps)}</span></div>); if (mDps && mDps != mmDps) propDiffs.push(<div key='dps'>{translate('dps')}: <span className={diffClass(mmDps, mDps, true)}>{diff(formats.round, mDps, mmDps)}</span></div>);
@@ -164,7 +166,7 @@ export function diffDetails(language, m, mm) {
if (mAffectsShield) { if (mAffectsShield) {
if (m.grp == 'sb') { // Both m and mm must be utility modules if this is true 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 { } else {
newShield = this.calcShieldStrengthWith(m); newShield = this.calcShieldStrengthWith(m);
} }
@@ -179,7 +181,7 @@ export function diffDetails(language, m, mm) {
} }
if (m.grp === 'mrp') { if (m.grp === 'mrp') {
let mProtection = m.protection; let mProtection = m.getProtection();
let mmProtection = mm ? mm.getProtection() || 0 : 0; let mmProtection = mm ? mm.getProtection() || 0 : 0;
if (mProtection != mmProtection) { if (mProtection != mmProtection) {
propDiffs.push(<div key='protection'>{translate('protection')}: <span className={diffClass(mmProtection, mProtection, true)}>{diff(formats.pct, mProtection, mmProtection)}</span></div>); propDiffs.push(<div key='protection'>{translate('protection')}: <span className={diffClass(mmProtection, mProtection, true)}>{diff(formats.pct, mProtection, mmProtection)}</span></div>);
@@ -187,7 +189,7 @@ export function diffDetails(language, m, mm) {
} }
if (m.grp === 'hr') { if (m.grp === 'hr') {
let mHullReinforcement = m.hullreinforcement; let mHullReinforcement = m.getHullReinforcement();
let mmHullReinforcement = mm ? mm.getHullReinforcement() || 0 : 0; let mmHullReinforcement = mm ? mm.getHullReinforcement() || 0 : 0;
if (mHullReinforcement && mHullReinforcement != mmHullReinforcement) propDiffs.push(<div key='hullreinforcement'>{translate('hullreinforcement')}: <span className={diffClass(mmHullReinforcement, mHullReinforcement, true)}>{diff(formats.round, mHullReinforcement, mmHullReinforcement)}</span></div>); if (mHullReinforcement && mHullReinforcement != mmHullReinforcement) propDiffs.push(<div key='hullreinforcement'>{translate('hullreinforcement')}: <span className={diffClass(mmHullReinforcement, mHullReinforcement, true)}>{diff(formats.round, mHullReinforcement, mmHullReinforcement)}</span></div>);
} }
@@ -219,7 +221,7 @@ export function diffDetails(language, m, mm) {
let mmCost = mm ? mm.cost : 0; let mmCost = mm ? mm.cost : 0;
if (mCost != mmCost) propDiffs.push(<div key='cost'>{translate('cost')}: <span className={diffClass(mCost, mmCost, true) }>{formats.int(mCost ? Math.round(mCost * (1 - Persist.getModuleDiscount())) : 0)}{units.CR}</span></div>); if (mCost != mmCost) propDiffs.push(<div key='cost'>{translate('cost')}: <span className={diffClass(mCost, mmCost, true) }>{formats.int(mCost ? Math.round(mCost * (1 - Persist.getModuleDiscount())) : 0)}{units.CR}</span></div>);
let mMass = m.mass || 0; let mMass = m.getMass() || 0;
let mmMass = mm ? mm.getMass() : 0; let mmMass = mm ? mm.getMass() : 0;
if (mMass != mmMass) propDiffs.push(<div key='mass'>{translate('mass')}: <span className={diffClass(mMass, mmMass, true)}>{diff(formats.round, mMass, mmMass)}{units.T}</span></div>); if (mMass != mmMass) propDiffs.push(<div key='mass'>{translate('mass')}: <span className={diffClass(mMass, mmMass, true)}>{diff(formats.round, mMass, mmMass)}{units.T}</span></div>);
@@ -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; let mmIntegrity = mm ? mm.getIntegrity() || 0 : 0;
if (mIntegrity != mmIntegrity) { if (mIntegrity != mmIntegrity) {
propDiffs.push(<div key='integrity'>{translate('integrity')}: <span className={diffClass(mmIntegrity, mIntegrity, true)}>{diff(formats.round, mIntegrity, mmIntegrity)}</span></div>); propDiffs.push(<div key='integrity'>{translate('integrity')}: <span className={diffClass(mmIntegrity, mIntegrity, true)}>{diff(formats.round, mIntegrity, mmIntegrity)}</span></div>);

View File

@@ -41,24 +41,26 @@
<script async src='https://www.google-analytics.com/analytics.js'></script> <script async src='https://www.google-analytics.com/analytics.js'></script>
<% } %> <% } %>
<!-- Piwik --> <!-- Matomo -->
<!-- <script type="text/javascript"> <script type="text/javascript">
var _paq = _paq || []; var _paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */ /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setCookieDomain", "*.coriolis.edcd.io"]); _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setCookieDomain", "*.coriolis.io"]);
_paq.push(['trackPageView']); _paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']); _paq.push(['enableLinkTracking']);
(function() { (function() {
var u="//stats.isadankme.me/"; var u="//stats.willb.dev/";
_paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '4']); _paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})(); })();
</script>--> </script>
<!-- End Piwik Code --> <!-- End Matomo Code -->
<!-- Bugsnag -->
<!-- Bugsnag -->
<script src="https://d2wy8f7a9ursnm.cloudfront.net/v5.0.0/bugsnag.min.js"></script> <script src="https://d2wy8f7a9ursnm.cloudfront.net/v5.0.0/bugsnag.min.js"></script>
<script> <script>
window.bugsnagClient = bugsnag('ba9fae819372850fb660755341fa6ef5', {appVersion: window.BUGSNAG_VERSION || undefined}) window.bugsnagClient = bugsnag('ba9fae819372850fb660755341fa6ef5', {appVersion: window.BUGSNAG_VERSION || undefined})