mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b44f5fe27 | ||
|
|
7332dc69ed | ||
|
|
381387c04f | ||
|
|
e0db9fdfb0 | ||
|
|
a8d66b22af | ||
|
|
bdc1e622f9 | ||
|
|
ad8130ae9b | ||
|
|
394a3bb9f1 | ||
|
|
54907b462c | ||
|
|
1350de1910 | ||
|
|
89d3fd69e1 | ||
|
|
7325081ec9 | ||
|
|
680872a302 | ||
|
|
a3c65d6c69 | ||
|
|
a189265326 | ||
|
|
b447e913ff | ||
|
|
b5a249fb4b | ||
|
|
ae081c147e | ||
|
|
3ce0d0bdd8 | ||
|
|
a71abd9fe3 | ||
|
|
f1d804e3a1 | ||
|
|
aa7479d111 | ||
|
|
7c23fb3884 | ||
|
|
b707015d9c | ||
|
|
10d5611dcd | ||
|
|
9009a2a434 | ||
|
|
8b98a98faf | ||
|
|
44de3e4bbc | ||
|
|
ba2e9a12b0 | ||
|
|
57304f55c1 | ||
|
|
1eea358c35 | ||
|
|
f671b7c34f | ||
|
|
211028d80d | ||
|
|
c79359ea2f | ||
|
|
93f92da1df | ||
|
|
6fb2247dd7 |
@@ -7,7 +7,7 @@
|
||||
<!-- Standard headers -->
|
||||
<meta name="description" content="A ship outfitting and comparison tool for Elite Dangerous">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="viewport" content="width = device-width, initial-scale = 1.0">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="manifest" href="/images/logo/manifest.json">
|
||||
<link rel="icon" sizes="152x152 192x192" type="image/png" href="/images/logo/192x192.png">
|
||||
<link rel="shortcut icon" href="/images/logo/favicon.ico">
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
angular.module('app', ['ui.router', 'ct.ui.router.extras.sticky', 'ui.sortable', 'shipyard', 'ngLodash', 'app.templates'])
|
||||
.run(['$rootScope', '$location', '$window', '$document', '$state', 'commonArray', 'shipPurpose', 'shipSize', 'hardPointClass', 'GroupMap', 'Persist',
|
||||
function($rootScope, $location, $window, $doc, $state, CArr, shipPurpose, sz, hpc, GroupMap, Persist) {
|
||||
.run(['$rootScope', '$location', '$window', '$document', '$state', 'commonArray', 'shipPurpose', 'shipSize', 'hardPointClass', 'GroupMap', 'Persist', 'Discounts',
|
||||
function($rootScope, $location, $window, $doc, $state, CArr, shipPurpose, sz, hpc, GroupMap, Persist, Discounts) {
|
||||
// App is running as a standalone web app on tablet/mobile
|
||||
var isStandAlone = $window.navigator.standalone || ($window.external && $window.external.msIsSiteMode && $window.external.msIsSiteMode());
|
||||
var isStandAlone;
|
||||
// This was causing issues on Windows phones ($window.external was causing Angular js to throw an exception). Backup is to try this and set isStandAlone to false if this fails.
|
||||
try {
|
||||
isStandAlone = $window.navigator.standalone || ($window.external && $window.external.msIsSiteMode && $window.external.msIsSiteMode());
|
||||
} catch (ex) {
|
||||
isStandAlone = false;
|
||||
}
|
||||
|
||||
// Redirect any state transition errors to the error controller/state
|
||||
$rootScope.$on('$stateChangeError', function(e, toState, toParams, fromState, fromParams, error) {
|
||||
@@ -34,13 +40,18 @@ function($rootScope, $location, $window, $doc, $state, CArr, shipPurpose, sz, hp
|
||||
$rootScope.HPC = hpc;
|
||||
$rootScope.GMAP = GroupMap;
|
||||
$rootScope.insurance = { opts: [{ name: 'Standard', pct: 0.05 }, { name: 'Alpha', pct: 0.025 }, { name: 'Beta', pct: 0.035 }] };
|
||||
$rootScope.discounts = { opts: [{ name: 'None', pct: 1 }, { name: 'Founders World - 10%', pct: 0.90 }] };
|
||||
$rootScope. discounts = { opts: Discounts };
|
||||
$rootScope.STATUS = ['', 'DISABLED', 'OFF', 'ON'];
|
||||
$rootScope.STATUS_CLASS = ['', 'disabled', 'warning', 'secondary-disabled'];
|
||||
$rootScope.title = 'Coriolis';
|
||||
|
||||
$rootScope.cName = function(c) {
|
||||
return c.c ? c.c.name ? c.c.name : GroupMap[c.c.grp] : null;
|
||||
/**
|
||||
* Returns the name of the component mounted in the specified slot
|
||||
* @param {Object} slot The slot object
|
||||
* @return {String} The component name
|
||||
*/
|
||||
$rootScope.cName = function(slot) {
|
||||
return slot.c ? slot.c.name ? slot.c.name : GroupMap[slot.c.grp] : null;
|
||||
};
|
||||
|
||||
// Formatters
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
angular.module('app').controller('OutfitController', ['$window', '$rootScope', '$scope', '$state', '$stateParams', 'ShipsDB', 'Ship', 'Components', 'Serializer', 'Persist', 'calcTotalRange', function($window, $rootScope, $scope, $state, $p, Ships, Ship, Components, Serializer, Persist, calcTotalRange) {
|
||||
angular.module('app').controller('OutfitController', ['$window', '$rootScope', '$scope', '$state', '$stateParams', 'ShipsDB', 'Ship', 'Components', 'Serializer', 'Persist', 'calcTotalRange', 'calcSpeed', function($window, $rootScope, $scope, $state, $p, Ships, Ship, Components, Serializer, Persist, calcTotalRange, calcSpeed) {
|
||||
var win = angular.element($window); // Angularized window object for event triggering
|
||||
var data = Ships[$p.shipId]; // Retrieve the basic ship properties, slots and defaults
|
||||
var ship = new Ship($p.shipId, data.properties, data.slots); // Create a new Ship instance
|
||||
var win = angular.element($window); // Angularized window object for event triggering
|
||||
var retrofitShip = new Ship($p.shipId, data.properties, data.slots); // Create a new Ship for retrofit comparison
|
||||
|
||||
// Update the ship instance with the code (if provided) or the 'factory' defaults.
|
||||
if ($p.code) {
|
||||
@@ -30,11 +31,27 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
$scope.selectedSlot = null;
|
||||
$scope.savedCode = Persist.getBuild(ship.id, $scope.buildName);
|
||||
$scope.canSave = Persist.isEnabled();
|
||||
$scope.allBuilds = Persist.builds;
|
||||
$scope.fuel = 0;
|
||||
$scope.pwrDesc = false;
|
||||
$scope.pwrPredicate = 'type';
|
||||
$scope.retroDesc = false;
|
||||
$scope.retroPredicate = 'netCost';
|
||||
$scope.costDesc = true;
|
||||
$scope.costPredicate = 'c.cost';
|
||||
$scope.costTab = Persist.getCostTab() || 'costs';
|
||||
|
||||
if ($scope.savedCode) {
|
||||
Serializer.toShip(retrofitShip, $scope.savedCode); // Populate components from last save
|
||||
$scope.retrofitBuild = $scope.buildName;
|
||||
} else {
|
||||
retrofitShip.buildWith(data.defaults);
|
||||
$scope.retrofitBuild = null;
|
||||
}
|
||||
|
||||
ship.applyDiscounts($rootScope.discounts.ship, $rootScope.discounts.components);
|
||||
retrofitShip.applyDiscounts($rootScope.discounts.ship, $rootScope.discounts.components);
|
||||
updateRetrofitCosts();
|
||||
|
||||
$scope.jrSeries = {
|
||||
xMin: 0,
|
||||
@@ -55,8 +72,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
title: 'Jump Range',
|
||||
unit: 'LY'
|
||||
}
|
||||
},
|
||||
watch: $scope.fsd
|
||||
}
|
||||
};
|
||||
|
||||
$scope.trSeries = {
|
||||
@@ -78,8 +94,30 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
title: 'Total Range',
|
||||
unit: 'LY'
|
||||
}
|
||||
},
|
||||
watch: $scope.fsd
|
||||
}
|
||||
};
|
||||
|
||||
$scope.speedSeries = {
|
||||
xMin: 0,
|
||||
xMax: ship.cargoCapacity,
|
||||
yMax: 500,
|
||||
yMin: 0,
|
||||
series: ['speed', 'boost'],
|
||||
func: function(cargo) { // X Axis is Cargo
|
||||
return calcSpeed(ship.unladenMass + $scope.fuel + cargo, ship.speed, ship.boost, $scope.th.c);
|
||||
}
|
||||
};
|
||||
$scope.speedChart = {
|
||||
labels: {
|
||||
xAxis: {
|
||||
title: 'Cargo',
|
||||
unit: 'T'
|
||||
},
|
||||
yAxis: {
|
||||
title: 'Speed',
|
||||
unit: 'm/s'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -122,8 +160,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
ship.useBulkhead(id);
|
||||
}
|
||||
$scope.selectedSlot = null;
|
||||
$scope.code = Serializer.fromShip(ship);
|
||||
updateState();
|
||||
updateState(Serializer.fromShip(ship));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -133,8 +170,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
$scope.reloadBuild = function() {
|
||||
if ($scope.buildName && $scope.savedCode) {
|
||||
Serializer.toShip(ship, $scope.savedCode); // Repopulate with components from last save
|
||||
$scope.code = $scope.savedCode;
|
||||
updateState();
|
||||
updateState($scope.savedCode);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -149,8 +185,7 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
ship.hardpoints.forEach(function(slot) { ship.use(slot, null, null); });
|
||||
ship.internal.forEach(function(slot) { ship.use(slot, null, null); });
|
||||
ship.useBulkhead(0);
|
||||
$scope.code = Serializer.fromShip(ship);
|
||||
updateState();
|
||||
updateState(Serializer.fromShip(ship));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -169,7 +204,10 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
if ($scope.code != $scope.savedCode) {
|
||||
Persist.saveBuild(ship.id, $scope.buildName, $scope.code);
|
||||
$scope.savedCode = $scope.code;
|
||||
updateState();
|
||||
if ($scope.retrofitBuild === $scope.buildName) {
|
||||
Serializer.toShip(retrofitShip, $scope.code);
|
||||
}
|
||||
updateState($scope.code);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -212,27 +250,29 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
$scope.pwrPredicate = key;
|
||||
};
|
||||
|
||||
$scope.sortRetrofit = function(key) {
|
||||
$scope.retroDesc = $scope.retroPredicate == key ? !$scope.retroDesc : $scope.retroDesc;
|
||||
$scope.retroPredicate = key;
|
||||
};
|
||||
|
||||
/**
|
||||
* Toggle the power on/off for the selected component
|
||||
* @param {object} item The component being toggled
|
||||
*/
|
||||
$scope.togglePwr = function(c) {
|
||||
ship.setSlotEnabled(c, !c.enabled);
|
||||
$scope.code = Serializer.fromShip(ship);
|
||||
updateState();
|
||||
updateState(Serializer.fromShip(ship));
|
||||
};
|
||||
|
||||
$scope.incPriority = function(c) {
|
||||
if (ship.changePriority(c, c.priority + 1)) {
|
||||
$scope.code = Serializer.fromShip(ship);
|
||||
updateState();
|
||||
updateState(Serializer.fromShip(ship));
|
||||
}
|
||||
};
|
||||
|
||||
$scope.decPriority = function(c) {
|
||||
if (ship.changePriority(c, c.priority - 1)) {
|
||||
$scope.code = Serializer.fromShip(ship);
|
||||
updateState();
|
||||
updateState(Serializer.fromShip(ship));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -249,19 +289,83 @@ angular.module('app').controller('OutfitController', ['$window', '$rootScope', '
|
||||
return ship.getSlotStatus(slot, true);
|
||||
};
|
||||
|
||||
$scope.setRetrofitBase = function() {
|
||||
if ($scope.retrofitBuild) {
|
||||
Serializer.toShip(retrofitShip, Persist.getBuild(ship.id, $scope.retrofitBuild));
|
||||
} else {
|
||||
retrofitShip.buildWith(data.defaults);
|
||||
}
|
||||
updateRetrofitCosts();
|
||||
};
|
||||
|
||||
// Utilify functions
|
||||
|
||||
function updateState() {
|
||||
function updateState(code) {
|
||||
$scope.code = code;
|
||||
$state.go('outfit', { shipId: ship.id, code: $scope.code, bn: $scope.buildName }, { location: 'replace', notify: false });
|
||||
$scope.trSeries.xMax = $scope.jrSeries.xMax = ship.cargoCapacity;
|
||||
$scope.speedSeries.xMax = $scope.trSeries.xMax = $scope.jrSeries.xMax = ship.cargoCapacity;
|
||||
$scope.jrSeries.yMax = ship.unladenRange;
|
||||
$scope.trSeries.yMax = ship.unladenTotalRange;
|
||||
updateRetrofitCosts();
|
||||
win.triggerHandler('pwrchange');
|
||||
}
|
||||
|
||||
function updateRetrofitCosts() {
|
||||
var costs = $scope.retrofitList = [];
|
||||
var cName = $rootScope.cName;
|
||||
var total = 0, i, l, item;
|
||||
|
||||
if (ship.bulkheads.id != retrofitShip.bulkheads.id) {
|
||||
item = {
|
||||
buyClassRating: ship.bulkheads.c.class + ship.bulkheads.c.rating,
|
||||
buyName: cName(ship.bulkheads),
|
||||
sellClassRating: retrofitShip.bulkheads.c.class + retrofitShip.bulkheads.c.rating,
|
||||
sellName: cName(retrofitShip.bulkheads),
|
||||
netCost: ship.bulkheads.discountedCost - retrofitShip.bulkheads.discountedCost
|
||||
};
|
||||
costs.push(item);
|
||||
total += item.netCost;
|
||||
}
|
||||
|
||||
for (var g in { common: 1, internal: 1, hardpoints: 1 }) {
|
||||
var retroSlotGroup = retrofitShip[g];
|
||||
var slotGroup = ship[g];
|
||||
for (i = 0, l = slotGroup.length; i < l; i++) {
|
||||
if (slotGroup[i].id != retroSlotGroup[i].id) {
|
||||
item = { netCost: 0 };
|
||||
if (slotGroup[i].id) {
|
||||
item.buyName = cName(slotGroup[i]);
|
||||
item.buyClassRating = slotGroup[i].c.class + slotGroup[i].c.rating;
|
||||
item.netCost = slotGroup[i].discountedCost;
|
||||
}
|
||||
if (retroSlotGroup[i].id) {
|
||||
item.sellName = cName(retroSlotGroup[i]);
|
||||
item.sellClassRating = retroSlotGroup[i].c.class + retroSlotGroup[i].c.rating;
|
||||
item.netCost -= retroSlotGroup[i].discountedCost;
|
||||
}
|
||||
costs.push(item);
|
||||
total += item.netCost;
|
||||
}
|
||||
}
|
||||
}
|
||||
$scope.retrofitTotal = total;
|
||||
}
|
||||
|
||||
$scope.updateCostTab = function(tab) {
|
||||
Persist.setCostTab(tab);
|
||||
$scope.costTab = tab;
|
||||
};
|
||||
|
||||
// Hide any open menu/slot/etc if the background is clicked
|
||||
$scope.$on('close', function() {
|
||||
$scope.selectedSlot = null;
|
||||
});
|
||||
|
||||
// Hide any open menu/slot/etc if the background is clicked
|
||||
$scope.$on('discountChange', function() {
|
||||
ship.applyDiscounts($rootScope.discounts.ship, $rootScope.discounts.components);
|
||||
retrofitShip.applyDiscounts($rootScope.discounts.ship, $rootScope.discounts.components);
|
||||
updateRetrofitCosts();
|
||||
});
|
||||
|
||||
}]);
|
||||
|
||||
@@ -21,7 +21,7 @@ angular.module('app').directive('componentSelect', function() {
|
||||
list.push((o.maxmass && mass > o.maxmass) ? ' disabled"' : '" cpid="', id, '">');
|
||||
|
||||
if (o.mode) {
|
||||
list.push('<svg cpid="', id, '" class="icon lg"><use xlink:href="#mount-', o.mode, '"></use></svg> ');
|
||||
list.push('<svg cpid="', id, '" class="icon lg"><use cpid="', id, '" xlink:href="#mount-', o.mode, '"></use></svg> ');
|
||||
}
|
||||
|
||||
list.push(o.class, o.rating);
|
||||
|
||||
@@ -13,8 +13,10 @@ angular.module('app').directive('shipyardHeader', ['lodash', '$rootScope', 'Pers
|
||||
scope.bs = Persist.state;
|
||||
|
||||
var insIndex = _.findIndex($rootScope.insurance.opts, 'name', Persist.getInsurance());
|
||||
var savedDiscounts = Persist.getDiscount() || [1, 1];
|
||||
$rootScope.insurance.current = $rootScope.insurance.opts[insIndex != -1 ? insIndex : 0];
|
||||
$rootScope.discounts.current = $rootScope.discounts.opts[Persist.getDiscount() || 0];
|
||||
$rootScope.discounts.ship = savedDiscounts[0];
|
||||
$rootScope.discounts.components = savedDiscounts[1];
|
||||
|
||||
// Close menus if a navigation change event occurs
|
||||
$rootScope.$on('$stateChangeStart', function() {
|
||||
@@ -38,7 +40,8 @@ angular.module('app').directive('shipyardHeader', ['lodash', '$rootScope', 'Pers
|
||||
* Save selected discount option
|
||||
*/
|
||||
scope.updateDiscount = function() {
|
||||
Persist.setDiscount($rootScope.discounts.opts.indexOf($rootScope.discounts.current));
|
||||
Persist.setDiscount([$rootScope.discounts.ship, $rootScope.discounts.components]);
|
||||
$rootScope.$broadcast('discountChange');
|
||||
};
|
||||
|
||||
scope.openMenu = function(e, menu) {
|
||||
|
||||
190
app/js/directives/directive-line-chart.js
Normal file
190
app/js/directives/directive-line-chart.js
Normal file
@@ -0,0 +1,190 @@
|
||||
angular.module('app').directive('lineChart', ['$window', function($window) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
config: '=',
|
||||
series: '='
|
||||
},
|
||||
link: function(scope, element) {
|
||||
var seriesConfig = scope.series,
|
||||
series = seriesConfig.series,
|
||||
color = d3.scale.ordinal().range([ '#ff8c0d', '#1fb0ff', '#a05d56', '#d0743c']),
|
||||
config = scope.config,
|
||||
labels = config.labels,
|
||||
margin = { top: 15, right: 15, bottom: 35, left: 60 },
|
||||
fmt = d3.format('.3r'),
|
||||
fmtLong = d3.format('.2f'),
|
||||
func = seriesConfig.func,
|
||||
drag = d3.behavior.drag(),
|
||||
dragging = false,
|
||||
// Define Scales
|
||||
x = d3.scale.linear(),
|
||||
y = d3.scale.linear(),
|
||||
// Define Axes
|
||||
xAxis = d3.svg.axis().scale(x).outerTickSize(0).orient('bottom').tickFormat(d3.format('.2r')),
|
||||
yAxis = d3.svg.axis().scale(y).ticks(6).outerTickSize(0).orient('left').tickFormat(fmt),
|
||||
data = [];
|
||||
|
||||
// Create chart
|
||||
var svg = d3.select(element[0]).append('svg');
|
||||
var vis = svg.append('g').attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
|
||||
var lines = vis.append('g');
|
||||
|
||||
// Define Area
|
||||
var line = d3.svg.line().y(function(d) { return y(d[1]); });
|
||||
|
||||
// Create Y Axis SVG Elements
|
||||
var yTxt = vis.append('g').attr('class', 'y axis')
|
||||
.append('text')
|
||||
.attr('transform', 'rotate(-90)')
|
||||
.attr('y', -50)
|
||||
.attr('dy', '.1em')
|
||||
.style('text-anchor', 'middle')
|
||||
.text(labels.yAxis.title + ' (' + labels.yAxis.unit + ')');
|
||||
// Create X Axis SVG Elements
|
||||
var xLbl = vis.append('g').attr('class', 'x axis');
|
||||
var xTxt = xLbl.append('text')
|
||||
.attr('y', 30)
|
||||
.attr('dy', '.1em')
|
||||
.style('text-anchor', 'middle')
|
||||
.text(labels.xAxis.title + ' (' + labels.xAxis.unit + ')');
|
||||
|
||||
// Create and Add tooltip
|
||||
var tipWidth = (Math.max(labels.yAxis.unit.length, labels.xAxis.unit.length) * 1.25) + 2;
|
||||
var tips = vis.append('g').style('display', 'none');
|
||||
|
||||
var background = vis.append('rect') // Background to capture hover/drag
|
||||
.attr('fill-opacity', 0)
|
||||
.on('mouseover', showTip)
|
||||
.on('mouseout', hideTip)
|
||||
.on('mousemove', moveTip)
|
||||
.call(drag);
|
||||
|
||||
drag
|
||||
.on('dragstart', function() {
|
||||
dragging = true;
|
||||
moveTip.call(this);
|
||||
showTip();
|
||||
})
|
||||
.on('dragend', function() {
|
||||
dragging = false;
|
||||
hideTip();
|
||||
})
|
||||
.on('drag', moveTip);
|
||||
|
||||
/**
|
||||
* Watch for changes in the series data (mass changes, etc)
|
||||
*/
|
||||
scope.$watchCollection('series', render);
|
||||
angular.element($window).bind('orientationchange resize render', render);
|
||||
|
||||
function render() {
|
||||
var width = element[0].parentElement.offsetWidth,
|
||||
height = width * 0.5,
|
||||
xMax = seriesConfig.xMax,
|
||||
xMin = seriesConfig.xMin,
|
||||
yMax = seriesConfig.yMax,
|
||||
yMin = seriesConfig.yMin,
|
||||
w = width - margin.left - margin.right,
|
||||
h = height - margin.top - margin.bottom,
|
||||
s, val, yVal, delta;
|
||||
|
||||
data.length = 0; // Reset Data array
|
||||
|
||||
if (seriesConfig.xMax == seriesConfig.xMin) {
|
||||
line.x(function(d, i) { return i * w; });
|
||||
} else {
|
||||
line.x(function(d) { return x(d[0]); });
|
||||
}
|
||||
|
||||
if (series) {
|
||||
for (s = 0; s < series.length; s++) {
|
||||
data.push([]);
|
||||
}
|
||||
|
||||
if (xMax == xMin) {
|
||||
yVal = func(xMin);
|
||||
for (s = 0; s < series.length; s++) {
|
||||
data[s].push( [ xMin, yVal[ series[s] ] ], [ 1, yVal[ series[s] ] ]);
|
||||
}
|
||||
} else {
|
||||
delta = (xMax - xMin) / 30; // Only render 30 points on the graph
|
||||
for (val = xMin; val <= xMax; val += delta) {
|
||||
yVal = func(val);
|
||||
for (s = 0; s < series.length; s++) {
|
||||
data[s].push([ val, yVal[ series[s] ] ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
var seriesData = [];
|
||||
if (xMax == xMin) {
|
||||
yVal = func(xMin);
|
||||
seriesData.push([ xMin, yVal ], [ 1, yVal ]);
|
||||
} else {
|
||||
delta = (xMax - xMin) / 30; // Only render 30 points on the graph
|
||||
for (val = xMin; val <= xMax; val += delta) {
|
||||
seriesData.push([val, func(val) ]);
|
||||
}
|
||||
}
|
||||
|
||||
data.push(seriesData);
|
||||
}
|
||||
|
||||
// Update Chart Size
|
||||
svg.attr('width', width).attr('height', height);
|
||||
background.attr('height', h).attr('width', w);
|
||||
|
||||
// Update domain and scale for axes
|
||||
x.range([0, w]).domain([xMin, xMax]).clamp(true);
|
||||
xLbl.attr('transform', 'translate(0,' + h + ')');
|
||||
xTxt.attr('x', w / 2);
|
||||
y.range([h, 0]).domain([yMin, yMax]);
|
||||
yTxt.attr('x', -h / 2);
|
||||
vis.selectAll('.y.axis').call(yAxis);
|
||||
vis.selectAll('.x.axis').call(xAxis);
|
||||
|
||||
lines.selectAll('path.line')
|
||||
.data(data)
|
||||
.attr('d', line) // Update existing series
|
||||
.enter() // Add new series
|
||||
.append('path')
|
||||
.attr('class', 'line')
|
||||
.attr('stroke', function(d, i) { return color(i); })
|
||||
.attr('stroke-width', 2)
|
||||
.attr('d', line);
|
||||
|
||||
var tip = tips.selectAll('g.tooltip').data(data).enter().append('g').attr('class', 'tooltip');
|
||||
tip.append('rect').attr('width', tipWidth + 'em').attr('height', '2em').attr('x', '0.5em').attr('y', '-1em').attr('class', 'tip');
|
||||
tip.append('circle').attr('class', 'marker').attr('r', 4);
|
||||
tip.append('text').attr('class', 'label x').attr('y', '-0.25em');
|
||||
tip.append('text').attr('class', 'label y').attr('y', '0.85em');
|
||||
}
|
||||
|
||||
function showTip() {
|
||||
tips.style('display', null);
|
||||
}
|
||||
|
||||
function hideTip() {
|
||||
if (!dragging) {
|
||||
tips.style('display', 'none');
|
||||
}
|
||||
}
|
||||
|
||||
function moveTip() {
|
||||
var xPos = d3.mouse(this)[0], x0 = x.invert(xPos), y0 = func(x0), flip = (x0 / x.domain()[1] > 0.65);
|
||||
var tip = tips.selectAll('g.tooltip').attr('transform', function(d, i) { return 'translate(' + x(x0) + ',' + y(series ? y0[series[i]] : y0) + ')'; });
|
||||
tip.selectAll('rect').attr('x', flip ? (-tipWidth - 0.5) + 'em' : '0.5em').style('text-anchor', flip ? 'end' : 'start');
|
||||
tip.selectAll('text.label').attr('x', flip ? '-1em' : '1em').style('text-anchor', flip ? 'end' : 'start');
|
||||
tip.selectAll('text.label.x').text(fmtLong(x0) + ' ' + labels.xAxis.unit);
|
||||
tips.selectAll('text.label.y').text(function(d, i) { return fmtLong(series ? y0[series[i]] : y0) + ' ' + labels.yAxis.unit; });
|
||||
}
|
||||
|
||||
scope.$on('$destroy', function() {
|
||||
angular.element($window).unbind('orientationchange resize render', render);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
}]);
|
||||
@@ -189,7 +189,7 @@ angular.module('app').service('Persist', ['$window', 'lodash', function($window,
|
||||
*/
|
||||
this.setDiscount = function(val) {
|
||||
if (this.lsEnabled) {
|
||||
return localStorage.setItem('discount', val);
|
||||
return localStorage.setItem('discounts', angular.toJson(val));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -199,7 +199,28 @@ angular.module('app').service('Persist', ['$window', 'lodash', function($window,
|
||||
*/
|
||||
this.getDiscount = function() {
|
||||
if (this.lsEnabled) {
|
||||
return localStorage.getItem('discount');
|
||||
return angular.fromJson(localStorage.getItem('discounts'));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Persist selected cost tab
|
||||
* @param {number} val Discount value/amount
|
||||
*/
|
||||
this.setCostTab = function(tabName) {
|
||||
if (this.lsEnabled) {
|
||||
return localStorage.setItem('costTab', tabName);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the saved discount
|
||||
* @return {number} val Discount value/amount
|
||||
*/
|
||||
this.getCostTab = function() {
|
||||
if (this.lsEnabled) {
|
||||
return localStorage.getItem('costTab');
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
function Ship(id, properties, slots) {
|
||||
this.id = id;
|
||||
this.cargoScoop = { c: Components.cargoScoop(), type: 'SYS' };
|
||||
this.bulkheads = { incCost: true, maxClass: 8, discount: 1 };
|
||||
this.bulkheads = { incCost: true, maxClass: 8 };
|
||||
|
||||
for (var p in properties) { this[p] = properties[p]; } // Copy all base properties from shipData
|
||||
|
||||
@@ -36,10 +36,11 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
var slotGroup = slots[slotType];
|
||||
var group = this[slotType] = []; // Initialize Slot group (Common, Hardpoints, Internal)
|
||||
for (var i = 0; i < slotGroup.length; i++) {
|
||||
group.push({ id: null, c: null, incCost: true, maxClass: slotGroup[i], discount: 1 });
|
||||
group.push({ id: null, c: null, incCost: true, maxClass: slotGroup[i] });
|
||||
}
|
||||
}
|
||||
this.c = { incCost: true, discount: 1, c: { name: this.name, cost: this.cost } }; // Make a 'Ship' component similar to other components
|
||||
// Make a Ship 'slot'/item similar to other slots
|
||||
this.c = { incCost: true, type: 'SHIP', discountedCost: this.cost, c: { name: this.name, cost: this.cost } };
|
||||
|
||||
this.costList = _.union(this.internal, this.common, this.hardpoints);
|
||||
this.costList.push(this.bulkheads); // Add The bulkheads
|
||||
@@ -54,6 +55,9 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
this.powerList.unshift(this.common[2]); // Add FSD
|
||||
this.powerList.unshift(this.common[0]); // Add Power Plant
|
||||
|
||||
this.shipDiscount = 1;
|
||||
this.componentDiscount = 1;
|
||||
|
||||
this.priorityBands = [
|
||||
{ deployed: 0, retracted: 0, retOnly: 0 },
|
||||
{ deployed: 0, retracted: 0, retOnly: 0 },
|
||||
@@ -81,9 +85,10 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
this.ladenMass = 0;
|
||||
this.armourAdded = 0;
|
||||
this.shieldMultiplier = 1;
|
||||
this.totalCost = this.cost;
|
||||
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);
|
||||
@@ -106,6 +111,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
common[i].priority = priorities ? priorities[i + 1] * 1 : 0;
|
||||
common[i].type = 'SYS';
|
||||
common[i].c = common[i].id = null; // Resetting 'old' component if there was one
|
||||
common[i].discountedCost = 0;
|
||||
this.use(common[i], comps.common[i], Components.common(i, comps.common[i]), true);
|
||||
}
|
||||
|
||||
@@ -119,6 +125,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
hps[i].priority = priorities ? priorities[cl + i] * 1 : 0;
|
||||
hps[i].type = hps[i].maxClass ? 'WEP' : 'SYS';
|
||||
hps[i].c = hps[i].id = null; // Resetting 'old' component if there was one
|
||||
hps[i].discountedCost = 0;
|
||||
|
||||
if (comps.hardpoints[i] !== 0) {
|
||||
this.use(hps[i], comps.hardpoints[i], Components.hardpoints(comps.hardpoints[i]), true);
|
||||
@@ -133,6 +140,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
internal[i].priority = priorities ? priorities[cl + i] * 1 : 0;
|
||||
internal[i].type = 'SYS';
|
||||
internal[i].id = internal[i].c = null; // Resetting 'old' component if there was one
|
||||
internal[i].discountedCost = 0;
|
||||
|
||||
if (comps.internal[i] !== 0) {
|
||||
this.use(internal[i], comps.internal[i], Components.internal(comps.internal[i]), true);
|
||||
@@ -149,6 +157,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
var oldBulkhead = this.bulkheads.c;
|
||||
this.bulkheads.id = index;
|
||||
this.bulkheads.c = Components.bulkheads(this.id, index);
|
||||
this.bulkheads.discountedCost = this.bulkheads.c.cost * this.componentDiscount;
|
||||
this.updateStats(this.bulkheads, this.bulkheads.c, oldBulkhead, preventUpdate);
|
||||
};
|
||||
|
||||
@@ -171,11 +180,13 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
if (!preventUpdate && similarSlot && similarSlot !== slot) {
|
||||
this.updateStats(similarSlot, null, similarSlot.c, true); // Update stats but don't trigger a global update
|
||||
similarSlot.id = similarSlot.c = null; // Empty the slot
|
||||
similarSlot.discountedCost = 0;
|
||||
}
|
||||
}
|
||||
var oldComponent = slot.c;
|
||||
slot.id = id;
|
||||
slot.c = component;
|
||||
slot.discountedCost = (component && component.cost) ? component.cost * this.componentDiscount : 0;
|
||||
this.updateStats(slot, component, oldComponent, preventUpdate);
|
||||
}
|
||||
};
|
||||
@@ -232,7 +243,7 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
|
||||
Ship.prototype.setCostIncluded = function(item, included) {
|
||||
if (item.incCost != included && item.c) {
|
||||
this.totalCost += included ? item.c.cost : -item.c.cost;
|
||||
this.totalCost += included ? item.discountedCost : -item.discountedCost;
|
||||
}
|
||||
item.incCost = included;
|
||||
};
|
||||
@@ -248,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();
|
||||
@@ -292,12 +305,16 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
}
|
||||
|
||||
if (slot.incCost && old.cost) {
|
||||
this.totalCost -= old.cost;
|
||||
this.totalCost -= old.cost * this.componentDiscount;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -322,12 +339,16 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
}
|
||||
|
||||
if (slot.incCost && n.cost) {
|
||||
this.totalCost += n.cost;
|
||||
this.totalCost += n.cost * this.componentDiscount;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -377,5 +398,28 @@ angular.module('shipyard').factory('Ship', ['Components', 'calcShieldStrength',
|
||||
this.maxJumpCount = Math.ceil(this.fuelCapacity / fsd.maxfuel);
|
||||
};
|
||||
|
||||
/**
|
||||
* Recalculate all item costs and total based on discounts.
|
||||
* @param {number} shipDiscount Ship cost multiplier discount (e.g. 0.9 === 10% discount)
|
||||
* @param {number} componentDiscount Component cost multiplier discount (e.g. 0.75 === 25% discount)
|
||||
*/
|
||||
Ship.prototype.applyDiscounts = function(shipDiscount, componentDiscount) {
|
||||
var total = 0;
|
||||
var costList = this.costList;
|
||||
|
||||
for (var i = 0, l = costList.length; i < l; i++) {
|
||||
var item = costList[i];
|
||||
if (item.c && item.c.cost) {
|
||||
item.discountedCost = item.c.cost * (item.type == 'SHIP' ? shipDiscount : componentDiscount);
|
||||
if (item.incCost) {
|
||||
total += item.discountedCost;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.shipDiscount = shipDiscount;
|
||||
this.componentDiscount = componentDiscount;
|
||||
this.totalCost = total;
|
||||
};
|
||||
|
||||
return Ship;
|
||||
}]);
|
||||
|
||||
@@ -163,8 +163,28 @@ angular.module('shipyard', ['ngLodash'])
|
||||
lbls: ['Unladen', 'Laden'],
|
||||
unit: 'LY',
|
||||
fmt: 'fRound'
|
||||
},
|
||||
{ // 11
|
||||
title: 'DPS',
|
||||
props: ['totalDps'],
|
||||
lbls: ['Dps'],
|
||||
unit: '',
|
||||
fmt: 'fRound'
|
||||
}
|
||||
])
|
||||
/**
|
||||
* Set of all available / theoretical discounts
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
.value('Discounts', {
|
||||
'None': 1,
|
||||
'5%': 0.95,
|
||||
'10%': 0.90,
|
||||
'15%': 0.85,
|
||||
'20%': 0.80,
|
||||
'25%': 0.75
|
||||
})
|
||||
/**
|
||||
* Calculate the maximum single jump range based on mass and a specific FSD
|
||||
*
|
||||
@@ -208,9 +228,6 @@ angular.module('shipyard', ['ngLodash'])
|
||||
* @return {number} Approximate shield strengh in MJ
|
||||
*/
|
||||
.value('calcShieldStrength', function(mass, shields, sg, multiplier) {
|
||||
if (!sg) {
|
||||
return 0;
|
||||
}
|
||||
if (mass <= sg.minmass) {
|
||||
return shields * multiplier * sg.minmul;
|
||||
}
|
||||
@@ -221,4 +238,20 @@ angular.module('shipyard', ['ngLodash'])
|
||||
return shields * multiplier * (sg.optmul + (mass - sg.optmass) / (sg.maxmass - sg.optmass) * (sg.maxmul - sg.optmul));
|
||||
}
|
||||
return shields * multiplier * sg.maxmul;
|
||||
})
|
||||
/**
|
||||
* Calculate the a ships speed based on mass, and thrusters. Currently Innacurate / Incomplete :(
|
||||
*
|
||||
* @private
|
||||
* @param {number} mass Current mass of the ship
|
||||
* @param {number} baseSpeed Base speed m/s for ship
|
||||
* @param {number} baseBoost Base boost m/s for ship
|
||||
* @param {object} thrusters The shield generator used
|
||||
* @return {object} Approximate speed and boost speed in m/s
|
||||
*/
|
||||
.value('calcSpeed', function(mass, baseSpeed, baseBoost) { //, thrusters) {
|
||||
//var speed = baseSpeed * (1 + ((thrusters.optmass / mass) * 0.1 ) ); // TODO: find thruser coefficient(s)
|
||||
//var boost = baseBoost * (1 + ((thrusters.optmass / mass) * 0.1 ) );
|
||||
|
||||
return { boost: baseSpeed, speed: baseBoost };
|
||||
});
|
||||
|
||||
@@ -22,7 +22,10 @@
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
text-rendering: optimizeLegibility;
|
||||
overflow-x: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -40,7 +43,9 @@ div, a, li {
|
||||
|
||||
#main {
|
||||
margin: 0;
|
||||
padding: 0.5em 0;
|
||||
padding: 0.5em 0.5em;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
min-height: 90%;
|
||||
clear: both;
|
||||
text-align: center;
|
||||
|
||||
@@ -15,16 +15,6 @@
|
||||
width: 100%;
|
||||
});
|
||||
|
||||
.medPhone({
|
||||
.axis {
|
||||
font-size: 0.8em;
|
||||
|
||||
g.tick:nth-child(2n + 1) text {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
h3 {
|
||||
text-align: center;
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ header {
|
||||
}
|
||||
|
||||
.smallTablet({
|
||||
position: static;
|
||||
position: initial;
|
||||
});
|
||||
}
|
||||
@@ -83,6 +84,19 @@ header {
|
||||
-webkit-overflow-scrolling: touch;
|
||||
max-height: 500px;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 0.5em;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: @warning-disabled;
|
||||
}
|
||||
|
||||
|
||||
.smallTablet({
|
||||
max-height: 400px;
|
||||
left: 0;
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
input {
|
||||
background: none;
|
||||
line-height: 1.3em;
|
||||
width: 20em;
|
||||
width: 15em;
|
||||
font-size: 0.9em;
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
@@ -99,6 +99,12 @@
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.optional-hide {
|
||||
.largePhone({
|
||||
display: none;
|
||||
});
|
||||
}
|
||||
|
||||
table.total {
|
||||
width: 100%;
|
||||
|
||||
@@ -113,6 +119,26 @@ table.total {
|
||||
}
|
||||
}
|
||||
|
||||
.tabs {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 1px;
|
||||
|
||||
&, th {
|
||||
border-collapse: collapse;
|
||||
color: @primary-disabled;
|
||||
background-color: @primary-bg;
|
||||
border: 1px solid @primary-disabled;
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
||||
.active {
|
||||
color: @primary-bg;
|
||||
background-color: @primary-disabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.group {
|
||||
width: 25%;
|
||||
padding: 0.5em 0.2em;
|
||||
@@ -139,20 +165,21 @@ table.total {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
tbody tr:hover {
|
||||
background-color: @warning-bg;
|
||||
}
|
||||
|
||||
|
||||
.smallTablet({
|
||||
width: 50%;
|
||||
|
||||
.axis.x {
|
||||
g.tick:nth-child(2n + 1) text {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
.largePhone({
|
||||
width: 100%;
|
||||
});
|
||||
|
||||
&.dbl {
|
||||
&.half {
|
||||
width: 50%;
|
||||
|
||||
.tablet({
|
||||
@@ -166,20 +193,10 @@ table.total {
|
||||
});
|
||||
}
|
||||
|
||||
&.semi {
|
||||
width: 50%;
|
||||
&.third {
|
||||
width: 33%;
|
||||
|
||||
.smallTablet({
|
||||
.axis {
|
||||
font-size: 0.8em;
|
||||
|
||||
g.tick:nth-child(2n + 1) text {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
.medPhone({
|
||||
.largePhone({
|
||||
width: 100% !important;
|
||||
});
|
||||
}
|
||||
@@ -235,9 +252,6 @@ table.total {
|
||||
&:nth-child(3) {
|
||||
display: none;
|
||||
}
|
||||
&:nth-child(2) {
|
||||
font-size: 0.7em;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
select {
|
||||
.border-radius(0);
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
color: @primary-disabled;
|
||||
font-family: @fStandard;
|
||||
font-size: 1em;
|
||||
background-color: transparent;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
padding: 0.1em 0.5em;
|
||||
outline:none;
|
||||
border: 0;
|
||||
|
||||
&:focus {
|
||||
outline:none;
|
||||
}
|
||||
|
||||
&::-moz-focus-inner {
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.select {
|
||||
color: @primary-disabled;
|
||||
position: absolute;
|
||||
@@ -15,6 +39,19 @@
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 0.5em;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
background-color: transparent;
|
||||
border-left: 1px solid @primary;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: @primary-disabled;
|
||||
}
|
||||
|
||||
.select-group {
|
||||
line-height: 1.5em;
|
||||
text-align: left;
|
||||
|
||||
@@ -43,7 +43,6 @@ thead {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tbody tr {
|
||||
|
||||
&.tr {
|
||||
@@ -55,6 +54,12 @@ tbody tr {
|
||||
}
|
||||
}
|
||||
|
||||
&.highlight {
|
||||
&:hover {
|
||||
background-color: @warning-bg;
|
||||
}
|
||||
}
|
||||
|
||||
td {
|
||||
line-height: 1.4em;
|
||||
padding: 0 0.3em;
|
||||
|
||||
@@ -53,8 +53,12 @@
|
||||
<li><select ng-model="insurance.current" ng-options="ins.name for (i,ins) in insurance.opts" ng-change="updateInsurance()"></select></li>
|
||||
</ul><br>
|
||||
<ul>
|
||||
Discount
|
||||
<li><select ng-model="discounts.current" ng-options="d.name for (i,d) in discounts.opts" ng-change="updateDiscount()"></select></li>
|
||||
Ship Discount
|
||||
<li><select ng-model="discounts.ship" ng-options="i for (i,d) in discounts.opts" ng-change="updateDiscount()"></select></li>
|
||||
</ul><br>
|
||||
<ul>
|
||||
Component Discount
|
||||
<li><select ng-model="discounts.components" ng-options="i for (i,d) in discounts.opts" ng-change="updateDiscount()"></select></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<ul>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
{{c.c.class}}{{c.c.rating}} {{c.c.name || lbl}}
|
||||
<div class="r">{{c.c.mass || c.c.capacity || '0'}} <u>T</u></div>
|
||||
<div class="cb"></div>
|
||||
<div class="l" ng-if="c.c.optmass">Opt: {{c.c.optmass}} <u>T</u></div>
|
||||
<div class="l" ng-if="c.c.maxmass">Max: {{c.c.maxmass}} <u>T</u></div>
|
||||
<div class="l" ng-if="c.c.optmass">Optimal Mass: {{c.c.optmass}} <u>T</u></div>
|
||||
<div class="l" ng-if="c.c.maxmass">Max Mass: {{c.c.maxmass}} <u>T</u></div>
|
||||
<div class="l" ng-if="c.c.bins">{{c.c.bins}} <u>Bins</u></div>
|
||||
<div class="l" ng-if="c.c.rate">Rate: {{c.c.rate}} <u>Kg/s</u> Refuel Time: {{$r.fTime(fuel * 1000 / c.c.rate)}}</div>
|
||||
<div class="l" ng-if="c.c.ammo">Ammo: {{c.c.ammo}}</div>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
|
||||
<div ng-show="processed">
|
||||
<table class="l" style="overflow:hidden;margin: 1em 0;">
|
||||
<table class="l" style="overflow:hidden;margin: 1em 0; width: 100%;">
|
||||
<thead><tr><th>Ship</th><th>Build Name</th><th>Action</th></tr></thead>
|
||||
<tbody ng-repeat="(shipId,shipBuilds) in builds">
|
||||
<tr class="cb" ng-repeat="(buildName, b) in shipBuilds">
|
||||
|
||||
@@ -30,16 +30,18 @@
|
||||
<th rowspan="2">Agility</th>
|
||||
<th rowspan="2">Speed</th>
|
||||
<th rowspan="2">Boost</th>
|
||||
<th rowspan="2">DPS</th>
|
||||
<th rowspan="2">Armour</th>
|
||||
<th rowspan="2">Shields</th>
|
||||
<th colspan="2">Mass</th>
|
||||
<th colspan="3">Mass</th>
|
||||
<th rowspan="2">Cargo</th>
|
||||
<th rowspan="2">Fuel</th>
|
||||
<th colspan="3">Jump Range</th>
|
||||
<th colspan="3">Total Range</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="lft">Unladen</th>
|
||||
<th class="lft">Hull</th>
|
||||
<th>Unladen</th>
|
||||
<th>Laden</th>
|
||||
<th class="lft">Max</th>
|
||||
<th>Full Tank</th>
|
||||
@@ -55,8 +57,10 @@
|
||||
<td>{{ship.agility}}/10</td>
|
||||
<td>{{fRound(ship.speed)}} <u>m/s</u></td>
|
||||
<td>{{fRound(ship.boost)}} <u>m/s</u></td>
|
||||
<td>{{fRound(ship.totalDps)}}</td>
|
||||
<td>{{ship.armourTotal}} <span ng-if="ship.armourAdded">({{ship.armour}} + {{ship.armourAdded}})</span></td>
|
||||
<td>{{fRound(ship.shieldStrength)}} <u>MJ</u> <span ng-if="ship.shieldMultiplier > 1 && ship.shieldStrength > 0">({{fRPct(ship.shieldMultiplier)}})</span></td>
|
||||
<td>{{ship.mass}} <u>T</u></td>
|
||||
<td>{{fRound(ship.unladenMass)}} <u>T</u></td>
|
||||
<td>{{fRound(ship.ladenMass)}} <u>T</u></td>
|
||||
<td>{{fRound(ship.cargoCapacity)}} <u>T</u></td>
|
||||
@@ -196,7 +200,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="group dbl" id="componentPriority">
|
||||
<div class="group half" id="componentPriority">
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr class="main">
|
||||
@@ -210,7 +214,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td ng-click="togglePwr(c)">{{pp.c.class}}{{pp.c.rating}}</td>
|
||||
<td>{{pp.c.class}}{{pp.c.rating}}</td>
|
||||
<td class="le shorten">Power Plant</td>
|
||||
<td><u>SYS</u></td>
|
||||
<td>1</td>
|
||||
@@ -220,7 +224,7 @@
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr><td style="line-height:0;" colspan="8"><hr style="margin: 0 0 3px;background: #ff8c0d;border: 0;height: 1px;" /></td></tr>
|
||||
<tr ng-repeat="c in powerList | orderBy:pwrPredicate:pwrDesc" ng-if="c.c.power" ng-class="{disabled:!c.enabled}">
|
||||
<tr class="highlight" ng-repeat="c in powerList | orderBy:pwrPredicate:pwrDesc" ng-if="c.c.power" ng-class="{disabled:!c.enabled}">
|
||||
<td style="width:1em;" ng-click="togglePwr(c)">{{c.c.class}}{{c.c.rating}}</td>
|
||||
<td class="le shorten" ng-click="togglePwr(c)" ng-bind="cName(c)"></td>
|
||||
<td ng-click="togglePwr(c)"><u ng-bind="c.type"></u></td>
|
||||
@@ -236,45 +240,111 @@
|
||||
<div style="margin-top: 1em" power-bands bands="priorityBands" available="ship.powerAvailable"></div>
|
||||
</div>
|
||||
|
||||
<div class="group dbl">
|
||||
<table style="width:100%">
|
||||
<div class="group half">
|
||||
<table class="tabs">
|
||||
<thead>
|
||||
<tr class="main">
|
||||
<th colspan="2" class="sortable le" ng-click="sortCost(cName)">Component</th>
|
||||
<th class="sortable le" ng-click="sortCost('c.cost')">Credits</th>
|
||||
<tr>
|
||||
<th style="width:50%" ng-class="{active: costTab == 'retrofit'}" ng-click="updateCostTab('retrofit')">Retrofit Costs</th>
|
||||
<th style="width:50%" ng-class="{active: costTab == 'costs'}" ng-click="updateCostTab('costs')">Costs</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="c in costList | orderBy:costPredicate:costDesc" ng-if="c.c.cost > 0" ng-class="{disabled:!c.incCost}">
|
||||
<td class="toggleable" style="width:1em;" ng-click="toggleCost(c)">{{c.c.class}}{{c.c.rating}}</td>
|
||||
<td class="le toggleable shorten" ng-bind="cName(c)" ng-click="toggleCost(c)"></td>
|
||||
<td class="ri toggleable" ng-click="toggleCost(c)">{{fCrd(discounts.current.pct * c.c.cost)}} <u>CR</u></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="total">
|
||||
|
||||
<div ng-if="costTab == 'costs'">
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr class="main">
|
||||
<th colspan="2" class="sortable le" ng-click="sortCost(cName)">
|
||||
Component
|
||||
<u class="optional-hide" ng-if="discounts.ship < 1">[Ship {{fRPct(1 - discounts.ship)}} off]</u>
|
||||
<u class="optional-hide" ng-if="discounts.components < 1">[Components {{fRPct(1 - discounts.components)}} off]</u>
|
||||
</th>
|
||||
<th class="sortable le" ng-click="sortCost('discountedCost')">Credits</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="highlight" ng-repeat="item in costList | orderBy:costPredicate:costDesc" ng-if="item.c.cost > 0" ng-class="{disabled:!item.incCost}">
|
||||
<td class="toggleable" style="width:1em;" ng-click="toggleCost(item)">{{item.c.class}}{{item.c.rating}}</td>
|
||||
<td class="le toggleable shorten" ng-click="toggleCost(item)">{{cName(item)}}</td>
|
||||
<td class="ri toggleable" ng-click="toggleCost(item)">{{fCrd(item.discountedCost)}} <u>CR</u></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="total">
|
||||
<tr class="ri">
|
||||
<td class="lbl">Total</td>
|
||||
<td>{{fCrd(ship.totalCost * discounts.current.pct)}} <u>CR</u></td>
|
||||
<td>{{fCrd(ship.totalCost)}} <u>CR</u></td>
|
||||
</tr>
|
||||
<tr class="ri">
|
||||
<td class="lbl">Insurance</td>
|
||||
<td>{{fCrd(ship.totalCost * discounts.current.pct * insurance.current.pct)}} <u>CR</u></td>
|
||||
<td>{{fCrd(ship.totalCost * insurance.current.pct)}} <u>CR</u></td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div ng-if="costTab == 'retrofit'">
|
||||
<div class="scroll-x">
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr class="main">
|
||||
<th colspan="2" class="sortable le" ng-click="sortRetrofit('sellName')">Sell</th>
|
||||
<th colspan="2" class="sortable le" ng-click="sortRetrofit('buyName')">Buy</th>
|
||||
<th class="sortable le" ng-click="sortRetrofit('netCost')">
|
||||
Net Cost <u class="optional-hide" ng-if="discounts.components < 1">[{{fRPct(1 - discounts.components)}} off]</u>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-if="!retrofitList || retrofitList.length == 0">
|
||||
<td colspan="5" style="padding: 3em 0;">No Retrofitting changes</td>
|
||||
</tr>
|
||||
<tr class="highlight" ng-repeat="item in retrofitList | orderBy:retroPredicate:retroDesc">
|
||||
<td style="width:1em;">{{item.sellClassRating}}</td>
|
||||
<td class="le shorten">{{item.sellName}}</td>
|
||||
<td style="width:1em;">{{item.buyClassRating}}</td>
|
||||
<td class="le shorten">{{item.buyName}}</td>
|
||||
<td class="ri" ng-class="item.netCost > 0 ? 'warning' : 'secondary-disabled'">{{ fCrd(item.netCost)}} <u>CR</u></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<table class="total">
|
||||
<tr class="ri">
|
||||
<td class="lbl">Cost</td>
|
||||
<td colspan="2" ng-class="retrofitTotal > 0 ? 'warning' : 'secondary-disabled'">{{fCrd(retrofitTotal)}} <u>CR</u></td>
|
||||
</tr>
|
||||
<tr class="ri">
|
||||
<td class="lbl">Retrofit from</td>
|
||||
<td class="cen" style="border-right:none;width: 1em;"><u class="primary-disabled">▾</u></td>
|
||||
<td style="border-left:none;padding:0;">
|
||||
<select style="width: 100%;padding: 0" ng-model="$parent.retrofitBuild" ng-change="setRetrofitBase()" ng-options="name as name for (name, build) in allBuilds[ship.id]">
|
||||
<option value="">Stock / Standard</option>
|
||||
</select>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="group semi">
|
||||
<div class="group half">
|
||||
<h1>Jump Range</h1>
|
||||
<div area-chart config="jrChart" series="jrSeries"></div>
|
||||
<div line-chart config="jrChart" series="jrSeries"></div>
|
||||
</div>
|
||||
|
||||
<div class="group semi">
|
||||
<div class="group half">
|
||||
<h1>Total Range</h1>
|
||||
<div area-chart config="trChart" series="trSeries"></div>
|
||||
<div line-chart config="trChart" series="trSeries"></div>
|
||||
</div>
|
||||
|
||||
<div class="group dbl">
|
||||
<!-- TODO: Add back in once calcSpeed is dynamic and accurate
|
||||
<div class="group third">
|
||||
<h1>Thruster Speed</h1>
|
||||
<div line-chart config="speedChart" series="speedSeries"></div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="group half">
|
||||
<div slider max="ship.fuelCapacity" unit="'T'" on-change="::fuelChange(val)" style="position:relative; margin: 0 auto;">
|
||||
<svg class="icon xl primary-disabled" style="position:absolute;height: 100%;"><use xlink:href="#fuel"></use></svg>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"dependencies": {
|
||||
"d3": "~3.5.5",
|
||||
"ng-lodash": "~0.2.0",
|
||||
"ui-router-extras": "~0.0.13",
|
||||
"ui-router-extras": "0.0.13",
|
||||
"angular-ui-router": "^0.2.15",
|
||||
"d3-tip": "~0.6.7",
|
||||
"ng-sortable": "~1.2.1",
|
||||
|
||||
@@ -123,28 +123,28 @@
|
||||
"class": 1,
|
||||
"rating": "I",
|
||||
"cost": 1017200,
|
||||
"mass": 21
|
||||
"mass": 4
|
||||
},
|
||||
{
|
||||
"name": "Military Grade Composite",
|
||||
"class": 1,
|
||||
"rating": "I",
|
||||
"cost": 2288600,
|
||||
"mass": 42
|
||||
"mass": 8
|
||||
},
|
||||
{
|
||||
"name": "Mirrored Surface Composite",
|
||||
"class": 1,
|
||||
"rating": "I",
|
||||
"cost": 5408800,
|
||||
"mass": 42
|
||||
"mass": 8
|
||||
},
|
||||
{
|
||||
"name": "Reactive Surface Composite",
|
||||
"class": 1,
|
||||
"rating": "I",
|
||||
"cost": 5993700,
|
||||
"mass": 42
|
||||
"mass": 8
|
||||
}
|
||||
],
|
||||
"cobra_mk_iii": [
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
{
|
||||
"Fuel Transfer Limpet Ctrl": [
|
||||
{ "id": "Ff", "grp":"fx", "class":7, "rating":"E", "cost": 437400, "mass": 80.0, "power":-0.55, "range":1.02, "maximum": 8 },
|
||||
{ "id": "Fg", "grp":"fx", "class":7, "rating":"D", "cost": 874800, "mass": 32.0, "power":-0.41, "range":1.36, "maximum": 8 },
|
||||
{ "id": "Fh", "grp":"fx", "class":7, "rating":"C", "cost":1749600, "mass": 80.0, "power":-0.69, "range":1.70, "maximum": 8 },
|
||||
{ "id": "Fi", "grp":"fx", "class":7, "rating":"B", "cost":3499200, "mass":128.0, "power":-0.97, "range":2.04, "maximum": 8 },
|
||||
{ "id": "Fj", "grp":"fx", "class":7, "rating":"A", "cost":6998400, "mass": 80.0, "power":-0.83, "range":2.38, "maximum": 8 },
|
||||
{ "id": "Ff", "grp":"fx", "class":7, "rating":"E", "cost": 437400, "mass": 80.0, "power":0.55, "range":1.02, "maximum": 8 },
|
||||
{ "id": "Fg", "grp":"fx", "class":7, "rating":"D", "cost": 874800, "mass": 32.0, "power":0.41, "range":1.36, "maximum": 8 },
|
||||
{ "id": "Fh", "grp":"fx", "class":7, "rating":"C", "cost":1749600, "mass": 80.0, "power":0.69, "range":1.70, "maximum": 8 },
|
||||
{ "id": "Fi", "grp":"fx", "class":7, "rating":"B", "cost":3499200, "mass":128.0, "power":0.97, "range":2.04, "maximum": 8 },
|
||||
{ "id": "Fj", "grp":"fx", "class":7, "rating":"A", "cost":6998400, "mass": 80.0, "power":0.83, "range":2.38, "maximum": 8 },
|
||||
|
||||
{ "id": "Fa", "grp":"fx", "class":5, "rating":"E", "cost": 48600, "mass": 20.0, "power":-0.40, "range":0.78, "maximum": 4 },
|
||||
{ "id": "Fb", "grp":"fx", "class":5, "rating":"D", "cost": 97200, "mass": 8.0, "power":-0.30, "range":1.04, "maximum": 4 },
|
||||
{ "id": "Fc", "grp":"fx", "class":5, "rating":"C", "cost": 194400, "mass": 20.0, "power":-0.50, "range":1.30, "maximum": 4 },
|
||||
{ "id": "Fd", "grp":"fx", "class":5, "rating":"B", "cost": 388800, "mass": 32.0, "power":-0.97, "range":1.56, "maximum": 4 },
|
||||
{ "id": "Fe", "grp":"fx", "class":5, "rating":"A", "cost": 777600, "mass": 20.0, "power":-0.60, "range":1.82, "maximum": 4 },
|
||||
{ "id": "Fa", "grp":"fx", "class":5, "rating":"E", "cost": 48600, "mass": 20.0, "power":0.40, "range":0.78, "maximum": 4 },
|
||||
{ "id": "Fb", "grp":"fx", "class":5, "rating":"D", "cost": 97200, "mass": 8.0, "power":0.30, "range":1.04, "maximum": 4 },
|
||||
{ "id": "Fc", "grp":"fx", "class":5, "rating":"C", "cost": 194400, "mass": 20.0, "power":0.50, "range":1.30, "maximum": 4 },
|
||||
{ "id": "Fd", "grp":"fx", "class":5, "rating":"B", "cost": 388800, "mass": 32.0, "power":0.97, "range":1.56, "maximum": 4 },
|
||||
{ "id": "Fe", "grp":"fx", "class":5, "rating":"A", "cost": 777600, "mass": 20.0, "power":0.60, "range":1.82, "maximum": 4 },
|
||||
|
||||
{ "id": "F5", "grp":"fx", "class":3, "rating":"E", "cost": 5400, "mass": 5.0, "power":-0.27, "range":0.66, "maximum": 2 },
|
||||
{ "id": "F6", "grp":"fx", "class":3, "rating":"D", "cost": 10800, "mass": 2.0, "power":-0.20, "range":0.88, "maximum": 2 },
|
||||
{ "id": "F7", "grp":"fx", "class":3, "rating":"C", "cost": 21600, "mass": 5.0, "power":-0.34, "range":1.10, "maximum": 2 },
|
||||
{ "id": "F8", "grp":"fx", "class":3, "rating":"B", "cost": 43200, "mass": 8.0, "power":-0.48, "range":1.32, "maximum": 2 },
|
||||
{ "id": "F9", "grp":"fx", "class":3, "rating":"A", "cost": 86400, "mass": 5.0, "power":-0.41, "range":1.54, "maximum": 2 },
|
||||
{ "id": "F5", "grp":"fx", "class":3, "rating":"E", "cost": 5400, "mass": 5.0, "power":0.27, "range":0.66, "maximum": 2 },
|
||||
{ "id": "F6", "grp":"fx", "class":3, "rating":"D", "cost": 10800, "mass": 2.0, "power":0.20, "range":0.88, "maximum": 2 },
|
||||
{ "id": "F7", "grp":"fx", "class":3, "rating":"C", "cost": 21600, "mass": 5.0, "power":0.34, "range":1.10, "maximum": 2 },
|
||||
{ "id": "F8", "grp":"fx", "class":3, "rating":"B", "cost": 43200, "mass": 8.0, "power":0.48, "range":1.32, "maximum": 2 },
|
||||
{ "id": "F9", "grp":"fx", "class":3, "rating":"A", "cost": 86400, "mass": 5.0, "power":0.41, "range":1.54, "maximum": 2 },
|
||||
|
||||
{ "id": "F0", "grp":"fx", "class":1, "rating":"E", "cost": 600, "mass": 1.3, "power":-0.18, "range":0.60, "maximum": 1 },
|
||||
{ "id": "F1", "grp":"fx", "class":1, "rating":"D", "cost": 1200, "mass": 0.5, "power":-0.14, "range":0.80, "maximum": 1 },
|
||||
{ "id": "F2", "grp":"fx", "class":1, "rating":"C", "cost": 2400, "mass": 1.3, "power":-0.23, "range":1.00, "maximum": 1 },
|
||||
{ "id": "F3", "grp":"fx", "class":1, "rating":"B", "cost": 4800, "mass": 2.0, "power":-0.32, "range":1.20, "maximum": 1 },
|
||||
{ "id": "F4", "grp":"fx", "class":1, "rating":"A", "cost": 9600, "mass": 1.3, "power":-0.28, "range":1.40, "maximum": 1 }
|
||||
{ "id": "F0", "grp":"fx", "class":1, "rating":"E", "cost": 600, "mass": 1.3, "power":0.18, "range":0.60, "maximum": 1 },
|
||||
{ "id": "F1", "grp":"fx", "class":1, "rating":"D", "cost": 1200, "mass": 0.5, "power":0.14, "range":0.80, "maximum": 1 },
|
||||
{ "id": "F2", "grp":"fx", "class":1, "rating":"C", "cost": 2400, "mass": 1.3, "power":0.23, "range":1.00, "maximum": 1 },
|
||||
{ "id": "F3", "grp":"fx", "class":1, "rating":"B", "cost": 4800, "mass": 2.0, "power":0.32, "range":1.20, "maximum": 1 },
|
||||
{ "id": "F4", "grp":"fx", "class":1, "rating":"A", "cost": 9600, "mass": 1.3, "power":0.28, "range":1.40, "maximum": 1 }
|
||||
]
|
||||
}
|
||||
@@ -1,52 +1,12 @@
|
||||
{
|
||||
"Fuel Tank": [
|
||||
{
|
||||
"id": "f1",
|
||||
"grp": "ft",
|
||||
"class": 1,
|
||||
"rating": "C",
|
||||
"cost": 1000,
|
||||
"capacity": 2
|
||||
},
|
||||
{
|
||||
"id": "f2",
|
||||
"grp": "ft",
|
||||
"class": 2,
|
||||
"rating": "C",
|
||||
"cost": 3750,
|
||||
"capacity": 4
|
||||
},
|
||||
{
|
||||
"id": "f3",
|
||||
"grp": "ft",
|
||||
"class": 3,
|
||||
"rating": "C",
|
||||
"cost": 7063,
|
||||
"capacity": 8
|
||||
},
|
||||
{
|
||||
"id": "f4",
|
||||
"grp": "ft",
|
||||
"class": 4,
|
||||
"rating": "C",
|
||||
"cost": 24734,
|
||||
"capacity": 16
|
||||
},
|
||||
{
|
||||
"id": "f5",
|
||||
"grp": "ft",
|
||||
"class": 5,
|
||||
"rating": "C",
|
||||
"cost": 97754,
|
||||
"capacity": 32
|
||||
},
|
||||
{
|
||||
"id": "f6",
|
||||
"grp": "ft",
|
||||
"class": 6,
|
||||
"rating": "C",
|
||||
"cost": 341577,
|
||||
"capacity": 64
|
||||
}
|
||||
{ "id": "f1", "grp": "ft", "class": 1, "rating": "C", "cost": 1000, "capacity": 2 },
|
||||
{ "id": "f2", "grp": "ft", "class": 2, "rating": "C", "cost": 3750, "capacity": 4 },
|
||||
{ "id": "f3", "grp": "ft", "class": 3, "rating": "C", "cost": 7063, "capacity": 8 },
|
||||
{ "id": "f4", "grp": "ft", "class": 4, "rating": "C", "cost": 24734, "capacity": 16 },
|
||||
{ "id": "f5", "grp": "ft", "class": 5, "rating": "C", "cost": 97754, "capacity": 32 },
|
||||
{ "id": "f6", "grp": "ft", "class": 6, "rating": "C", "cost": 341577, "capacity": 64 },
|
||||
{ "id": "f7", "grp": "ft", "class": 7, "rating": "C", "cost": 1780900, "capacity": 128 },
|
||||
{ "id": "f8", "grp": "ft", "class": 8, "rating": "C", "cost": 5428400, "capacity": 256 }
|
||||
]
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
{
|
||||
"Prospector Limpet Ctrl": [
|
||||
{ "id": "Pf", "grp":"pc", "class":7, "rating":"E", "cost": 437400, "mass": 80.0, "power":-0.55, "range": 5.10, "maximum": 8 },
|
||||
{ "id": "Pg", "grp":"pc", "class":7, "rating":"D", "cost": 874800, "mass": 32.0, "power":-0.41, "range": 6.80, "maximum": 8 },
|
||||
{ "id": "Ph", "grp":"pc", "class":7, "rating":"C", "cost":1749600, "mass": 80.0, "power":-0.69, "range": 8.50, "maximum": 8 },
|
||||
{ "id": "Pi", "grp":"pc", "class":7, "rating":"B", "cost":3499200, "mass":128.0, "power":-0.97, "range":10.20, "maximum": 8 },
|
||||
{ "id": "Pj", "grp":"pc", "class":7, "rating":"A", "cost":6998400, "mass": 80.0, "power":-0.83, "range":11.90, "maximum": 8 },
|
||||
{ "id": "Pf", "grp":"pc", "class":7, "rating":"E", "cost": 437400, "mass": 80.0, "power":0.55, "range": 5.10, "maximum": 8 },
|
||||
{ "id": "Pg", "grp":"pc", "class":7, "rating":"D", "cost": 874800, "mass": 32.0, "power":0.41, "range": 6.80, "maximum": 8 },
|
||||
{ "id": "Ph", "grp":"pc", "class":7, "rating":"C", "cost":1749600, "mass": 80.0, "power":0.69, "range": 8.50, "maximum": 8 },
|
||||
{ "id": "Pi", "grp":"pc", "class":7, "rating":"B", "cost":3499200, "mass":128.0, "power":0.97, "range":10.20, "maximum": 8 },
|
||||
{ "id": "Pj", "grp":"pc", "class":7, "rating":"A", "cost":6998400, "mass": 80.0, "power":0.83, "range":11.90, "maximum": 8 },
|
||||
|
||||
{ "id": "Pa", "grp":"pc", "class":5, "rating":"E", "cost": 48600, "mass": 20.0, "power":-0.40, "range": 3.90, "maximum": 4 },
|
||||
{ "id": "Pb", "grp":"pc", "class":5, "rating":"D", "cost": 97200, "mass": 8.0, "power":-0.30, "range": 5.20, "maximum": 4 },
|
||||
{ "id": "Pc", "grp":"pc", "class":5, "rating":"C", "cost": 194400, "mass": 20.0, "power":-0.50, "range": 6.50, "maximum": 4 },
|
||||
{ "id": "Pd", "grp":"pc", "class":5, "rating":"B", "cost": 388800, "mass": 32.0, "power":-0.97, "range": 7.80, "maximum": 4 },
|
||||
{ "id": "Pe", "grp":"pc", "class":5, "rating":"A", "cost": 777600, "mass": 20.0, "power":-0.60, "range": 9.10, "maximum": 4 },
|
||||
{ "id": "Pa", "grp":"pc", "class":5, "rating":"E", "cost": 48600, "mass": 20.0, "power":0.40, "range": 3.90, "maximum": 4 },
|
||||
{ "id": "Pb", "grp":"pc", "class":5, "rating":"D", "cost": 97200, "mass": 8.0, "power":0.30, "range": 5.20, "maximum": 4 },
|
||||
{ "id": "Pc", "grp":"pc", "class":5, "rating":"C", "cost": 194400, "mass": 20.0, "power":0.50, "range": 6.50, "maximum": 4 },
|
||||
{ "id": "Pd", "grp":"pc", "class":5, "rating":"B", "cost": 388800, "mass": 32.0, "power":0.97, "range": 7.80, "maximum": 4 },
|
||||
{ "id": "Pe", "grp":"pc", "class":5, "rating":"A", "cost": 777600, "mass": 20.0, "power":0.60, "range": 9.10, "maximum": 4 },
|
||||
|
||||
{ "id": "P5", "grp":"pc", "class":3, "rating":"E", "cost": 5400, "mass": 5.0, "power":-0.27, "range": 3.30, "maximum": 2 },
|
||||
{ "id": "P6", "grp":"pc", "class":3, "rating":"D", "cost": 10800, "mass": 2.0, "power":-0.20, "range": 4.40, "maximum": 2 },
|
||||
{ "id": "P7", "grp":"pc", "class":3, "rating":"C", "cost": 21600, "mass": 5.0, "power":-0.34, "range": 5.50, "maximum": 2 },
|
||||
{ "id": "P8", "grp":"pc", "class":3, "rating":"B", "cost": 43200, "mass": 8.0, "power":-0.48, "range": 6.60, "maximum": 2 },
|
||||
{ "id": "P9", "grp":"pc", "class":3, "rating":"A", "cost": 86400, "mass": 5.0, "power":-0.41, "range": 7.70, "maximum": 2 },
|
||||
{ "id": "P5", "grp":"pc", "class":3, "rating":"E", "cost": 5400, "mass": 5.0, "power":0.27, "range": 3.30, "maximum": 2 },
|
||||
{ "id": "P6", "grp":"pc", "class":3, "rating":"D", "cost": 10800, "mass": 2.0, "power":0.20, "range": 4.40, "maximum": 2 },
|
||||
{ "id": "P7", "grp":"pc", "class":3, "rating":"C", "cost": 21600, "mass": 5.0, "power":0.34, "range": 5.50, "maximum": 2 },
|
||||
{ "id": "P8", "grp":"pc", "class":3, "rating":"B", "cost": 43200, "mass": 8.0, "power":0.48, "range": 6.60, "maximum": 2 },
|
||||
{ "id": "P9", "grp":"pc", "class":3, "rating":"A", "cost": 86400, "mass": 5.0, "power":0.41, "range": 7.70, "maximum": 2 },
|
||||
|
||||
{ "id": "P0", "grp":"pc", "class":1, "rating":"E", "cost": 600, "mass": 1.3, "power":-0.18, "range": 3.00, "maximum": 1 },
|
||||
{ "id": "P1", "grp":"pc", "class":1, "rating":"D", "cost": 1200, "mass": 0.5, "power":-0.14, "range": 4.00, "maximum": 1 },
|
||||
{ "id": "P2", "grp":"pc", "class":1, "rating":"C", "cost": 2400, "mass": 1.3, "power":-0.23, "range": 5.00, "maximum": 1 },
|
||||
{ "id": "P3", "grp":"pc", "class":1, "rating":"B", "cost": 4800, "mass": 2.0, "power":-0.32, "range": 6.00, "maximum": 1 },
|
||||
{ "id": "P4", "grp":"pc", "class":1, "rating":"A", "cost": 9600, "mass": 1.3, "power":-0.28, "range": 7.00, "maximum": 1 }
|
||||
{ "id": "P0", "grp":"pc", "class":1, "rating":"E", "cost": 600, "mass": 1.3, "power":0.18, "range": 3.00, "maximum": 1 },
|
||||
{ "id": "P1", "grp":"pc", "class":1, "rating":"D", "cost": 1200, "mass": 0.5, "power":0.14, "range": 4.00, "maximum": 1 },
|
||||
{ "id": "P2", "grp":"pc", "class":1, "rating":"C", "cost": 2400, "mass": 1.3, "power":0.23, "range": 5.00, "maximum": 1 },
|
||||
{ "id": "P3", "grp":"pc", "class":1, "rating":"B", "cost": 4800, "mass": 2.0, "power":0.32, "range": 6.00, "maximum": 1 },
|
||||
{ "id": "P4", "grp":"pc", "class":1, "rating":"A", "cost": 9600, "mass": 1.3, "power":0.28, "range": 7.00, "maximum": 1 }
|
||||
]
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
"cost": 18969990,
|
||||
"speed": 180,
|
||||
"boost": 300,
|
||||
"agility": 0,
|
||||
"agility": 2,
|
||||
"shields": 200,
|
||||
"armour": 540,
|
||||
"fuelcost": 50,
|
||||
|
||||
@@ -140,7 +140,7 @@ gulp.task('generateIndexHTML', function(done) {
|
||||
gulp.src('app/index.html')
|
||||
.pipe(template({
|
||||
version: pkg.version,
|
||||
date : (new Date()).toLocaleDateString(),
|
||||
date : new Date().toISOString().slice(0, 10),
|
||||
uaTracking: process.env.CORIOLIS_UA_TRACKING || false,
|
||||
svgContent: svgIconsContent,
|
||||
gapiKey: process.env.CORIOLIS_GAPI_KEY
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "coriolis_shipyard",
|
||||
"version": "0.13.3",
|
||||
"version": "1.0.3",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cmmcleod/coriolis"
|
||||
|
||||
50
test/tests/test-controller-outfit.js
Normal file
50
test/tests/test-controller-outfit.js
Normal file
@@ -0,0 +1,50 @@
|
||||
describe("Outfit Controller", function() {
|
||||
beforeEach(module('app'));
|
||||
|
||||
var outfitController, scope;
|
||||
|
||||
var eventStub = {
|
||||
preventDefault: function(){ },
|
||||
stopPropagation: function(){ }
|
||||
};
|
||||
|
||||
beforeEach(inject(function(_$rootScope_, $controller) {
|
||||
$rootScope = _$rootScope_;
|
||||
$rootScope.discounts = { ship: 1, components: 1};
|
||||
$stateParams = { shipId: 'anaconda'};
|
||||
scope = $rootScope.$new();
|
||||
outfitController = $controller('OutfitController', { $rootScope: $rootScope, $scope: scope, $stateParams: $stateParams });
|
||||
}));
|
||||
|
||||
describe("Retrofitting Costs", function() {
|
||||
|
||||
it("are empty by default", function() {
|
||||
expect(scope.retrofitTotal).toEqual(0);
|
||||
expect(scope.retrofitList.length).toEqual(0);
|
||||
});
|
||||
|
||||
it("updates on bulkheads change", function() {
|
||||
scope.select('b', scope.ship.bulkheads, eventStub, "1"); // Use Reinforced Alloy Bulkheads
|
||||
expect(scope.retrofitTotal).toEqual(58787780);
|
||||
expect(scope.retrofitList.length).toEqual(1);
|
||||
scope.select('b', scope.ship.bulkheads, eventStub, "0"); // Use Reinforced Alloy Bulkheads
|
||||
expect(scope.retrofitTotal).toEqual(0);
|
||||
expect(scope.retrofitList.length).toEqual(0);
|
||||
});
|
||||
|
||||
it("updates on component change", function() {
|
||||
scope.select('h', scope.ship.hardpoints[0], eventStub, "0u"); // 3C/F Beam Laser
|
||||
expect(scope.retrofitTotal).toEqual(1177600);
|
||||
expect(scope.retrofitList.length).toEqual(1);
|
||||
scope.select('h', scope.ship.hardpoints[6], eventStub, "empty"); // Remove default pulse laser
|
||||
scope.select('h', scope.ship.hardpoints[7], eventStub, "empty"); // Remove default pulse laser
|
||||
expect(scope.retrofitTotal).toEqual(1173200);
|
||||
expect(scope.retrofitList.length).toEqual(3);
|
||||
scope.select('i', scope.ship.internal[3], eventStub, "11"); // Use 6A Auto field maintenance unit
|
||||
expect(scope.retrofitTotal).toEqual(16478701);
|
||||
expect(scope.retrofitList.length).toEqual(4);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -68,6 +68,37 @@ describe("Ship Factory", function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("discounts hull and components properly", function() {
|
||||
var id = 'cobra_mk_iii';
|
||||
var cobra = DB.ships[id];
|
||||
var testShip = new Ship(id, cobra.properties, cobra.slots);
|
||||
testShip.buildWith(cobra.defaults);
|
||||
|
||||
var originalHullCost = testShip.cost;
|
||||
var originalTotalCost = testShip.totalCost;
|
||||
var discount = 0.9;
|
||||
|
||||
expect(testShip.c.discountedCost).toEqual(originalHullCost, 'Hull cost does not match');
|
||||
|
||||
testShip.applyDiscounts(discount, discount);
|
||||
|
||||
// Floating point errors cause miniscule decimal places which are handled in the app by rounding/formatting
|
||||
|
||||
expect(Math.floor(testShip.c.discountedCost)).toEqual(Math.floor(originalHullCost * discount), 'Discounted Hull cost does not match');
|
||||
expect(Math.floor(testShip.totalCost)).toEqual(Math.floor(originalTotalCost * discount), 'Discounted Total cost does not match');
|
||||
|
||||
testShip.applyDiscounts(1, 1); // No discount, 100% of cost
|
||||
|
||||
expect(testShip.c.discountedCost).toEqual(originalHullCost, 'Hull cost does not match');
|
||||
expect(testShip.totalCost).toEqual(originalTotalCost, 'Total cost does not match');
|
||||
|
||||
testShip.applyDiscounts(discount, 1); // Only discount hull
|
||||
|
||||
expect(Math.floor(testShip.c.discountedCost)).toEqual(Math.round(originalHullCost * discount), 'Discounted Hull cost does not match');
|
||||
expect(testShip.totalCost).toEqual(originalTotalCost - originalHullCost + testShip.c.discountedCost, 'Total cost does not match');
|
||||
|
||||
});
|
||||
|
||||
it("enforces a single shield generator", function() {
|
||||
var id = 'anaconda';
|
||||
var anacondaData = DB.ships[id];
|
||||
|
||||
Reference in New Issue
Block a user