Merge pull request #107 from sf302/master

Reload costs refinements
This commit is contained in:
Colin McLeod
2015-10-14 00:15:43 -07:00
6 changed files with 49 additions and 17 deletions

View File

@@ -40,8 +40,8 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
$scope.retroPredicate = 'netCost';
$scope.costDesc = true;
$scope.costPredicate = 'c.cost';
$scope.ammoDesc = false;
$scope.ammoPredicate = 'ammoName';
$scope.ammoDesc = true;
$scope.ammoPredicate = 'ammoUnitCost';
$scope.costTab = Persist.getCostTab() || 'costs';
if ($scope.savedCode) {
@@ -461,6 +461,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
$scope.fuelChange = function(fuel) {
$scope.fuel = fuel;
updateAmmoCosts();
win.triggerHandler('render');
};
@@ -555,29 +556,32 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
function updateAmmoCosts() {
var costs = $scope.ammoList = [];
var total = 0, i, l, item;
var total = 0, i, l, item, q, limpets = 0, scoop = false;
for (var g in { common: 1, internal: 1, hardpoints: 1 }) {
var slotGroup = ship[g];
for (i = 0, l = slotGroup.length; i < l; i++) {
var q = 0;
if (slotGroup[i].id) {
//special cases needed for fuel, SCB and AFMU since they don't use standard ammo/clip
if (slotGroup[i].c.grp == 'ft') {
q = slotGroup[i].c.capacity;
slotGroup[i].c.ammocost = 50;
}
if (slotGroup[i].c.grp == 'scb') {
q = slotGroup[i].c.cells;
}
if (slotGroup[i].c.grp == 'am') {
q = slotGroup[i].c.ammo;
//special cases needed for SCB, AFMU, and limpet controllers since they don't use standard ammo/clip
q = 0;
switch (slotGroup[i].c.grp) {
case 'fs': //skip fuel calculation if scoop present
scoop = true;
break;
case 'scb':
q = slotGroup[i].c.cells;
break;
case 'am':
q = slotGroup[i].c.ammo;
break;
case 'fx': case 'hb': case 'cc': case 'pc':
limpets = ship.cargoCapacity;
break;
default:
q = slotGroup[i].c.clip + slotGroup[i].c.ammo;
}
//calculate ammo costs only if a cost is specified
if (slotGroup[i].c.ammocost > 0) {
if (q == 0) {
q = slotGroup[i].c.clip + slotGroup[i].c.ammo;
}
item = {
ammoClassRating: slotGroup[i].c.class + slotGroup[i].c.rating,
ammoName: slotGroup[i].c.name || slotGroup[i].c.grp,
@@ -591,6 +595,29 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
}
}
}
//limpets if controllers exist and cargo space available
if (limpets > 0) {
item = {
ammoName: 'limpets',
ammoMax: ship.cargoCapacity,
ammoUnitCost: 101,
ammoTotalCost: ship.cargoCapacity * 101
};
costs.push(item);
total += item.ammoTotalCost;
}
//calculate refuel costs if no scoop present
if (!scoop) {
item = {
ammoName: 'fuel',
ammoMax: $scope.fuel,
ammoUnitCost: 50,
ammoTotalCost: $scope.fuel * 50
};
costs.push(item);
total += item.ammoTotalCost;
}
$scope.ammoTotal = total;
}

View File

@@ -115,6 +115,7 @@ angular.module('app').config(['$translateProvider', 'localeFormatProvider', func
laden: 'Beladen',
language: 'Sprache',
large: 'Groß',
limpets: 'Krallen',
ls: 'Lebenserhaltung',
'Lightweight Alloy': 'Leichte Legierung',
'lock factor': 'Massensperrefaktor',

View File

@@ -105,6 +105,7 @@ angular.module('app').config(['$translateProvider', function($translateProvider)
laden: 'laden',
language: 'language',
large: 'large',
'limpets': 'Limpets',
ls: 'life support',
'Lightweight Alloy': 'Lightweight Alloy',
'lock factor': 'lock factor',

View File

@@ -115,6 +115,7 @@ angular.module('app').config(['$translateProvider', 'localeFormatProvider', func
'large': 'Grande',
'ls': 'Soporte vital',
'Lightweight Alloy': 'Aleaci\u00f3n ligera',
'limpets': 'Drones',
'lock factor': 'factor de bloqueo',
'mass': 'Masa',
'max': 'm\u00e1x',

View File

@@ -106,6 +106,7 @@ angular.module('app').config(['$translateProvider', 'localeFormatProvider', func
large: 'large',
ls: 'Systèmes de survie',
'Lightweight Alloy': 'alliage léger',
'limpets': 'Patelles',
'lock factor': 'facteur inhibition de masse',
LS: 'SL',
LY: 'AL',

View File

@@ -124,6 +124,7 @@ angular.module('app').config(['$translateProvider', 'localeFormatProvider', func
large: 'большой',
ls: 'Система жизнеобеспечения',
'Lightweight Alloy': 'Легкий сплав',
'limpets': 'Дроны',
'lock factor': 'Масс. блок',
LS: 'Св.сек',
LY: 'Св.лет',