From f1d804e3a1d02d30ce937cd5ed5f4de5a8317dbe Mon Sep 17 00:00:00 2001 From: Colin McLeod Date: Mon, 29 Jun 2015 11:57:29 -0700 Subject: [PATCH] Adding total DPS to outfit page and comparisons --- app/js/shipyard/factory-ship.js | 11 +++++++++++ app/js/shipyard/module-shipyard.js | 7 +++++++ app/views/modal-import.html | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/js/shipyard/factory-ship.js b/app/js/shipyard/factory-ship.js index 871816fa..d8d04206 100755 --- a/app/js/shipyard/factory-ship.js +++ b/app/js/shipyard/factory-ship.js @@ -88,6 +88,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength', this.totalCost = this.c.incCost ? this.c.discountedCost : 0; this.unladenMass = this.mass; this.armourTotal = this.armour; + this.totalDps = 0; this.bulkheads.c = null; this.useBulkhead(comps.bulkheads || 0, true); @@ -258,6 +259,8 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength', } else if (slot.c.grp == 'sb') { this.shieldMultiplier += slot.c.shieldmul * (enabled ? 1 : -1); this.updateShieldStrength(); + } else if (slot.c.dps) { + this.totalDps += slot.c.dps * (enabled ? 1 : -1); } this.updatePower(); @@ -308,6 +311,10 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength', if (old.power && slot.enabled) { this.priorityBands[slot.priority][powerUsageType(slot, old)] -= old.power; powerChange = true; + + if (old.dps) { + this.totalDps -= old.dps; + } } this.unladenMass -= old.mass || 0; } @@ -338,6 +345,10 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength', if (n.power && slot.enabled) { this.priorityBands[slot.priority][powerUsageType(slot, n)] += n.power; powerChange = true; + + if (n.dps) { + this.totalDps += n.dps; + } } this.unladenMass += n.mass || 0; } diff --git a/app/js/shipyard/module-shipyard.js b/app/js/shipyard/module-shipyard.js index d648be5d..f7018df1 100755 --- a/app/js/shipyard/module-shipyard.js +++ b/app/js/shipyard/module-shipyard.js @@ -163,6 +163,13 @@ angular.module('shipyard', ['ngLodash']) lbls: ['Unladen', 'Laden'], unit: 'LY', fmt: 'fRound' + }, + { // 11 + title: 'DPS', + props: ['totalDps'], + lbls: ['Dps'], + unit: '', + fmt: 'fRound' } ]) /** diff --git a/app/views/modal-import.html b/app/views/modal-import.html index 1cc472c4..38bdeb75 100755 --- a/app/views/modal-import.html +++ b/app/views/modal-import.html @@ -6,7 +6,7 @@
- +
ShipBuild NameAction