This commit is contained in:
Cmdr McDonald
2017-04-23 16:06:14 +01:00
parent c130b52b7c
commit 59a5ba0227
13 changed files with 393 additions and 141 deletions

View File

@@ -0,0 +1,225 @@
{
"free": false,
"id": 2,
"modules": {
"Armour": {
"module": {
"free": false,
"id": 128049280,
"name": "CobraMkIII_Armour_Grade1",
"on": true,
"priority": 1,
"value": 0
}
},
"FrameShiftDrive": {
"module": {
"free": false,
"id": 128064117,
"name": "Int_Hyperdrive_Size4_Class5",
"on": true,
"priority": 4,
"value": 1610080
}
},
"FuelTank": {
"module": {
"free": false,
"id": 128064349,
"name": "Int_FuelTank_Size4_Class3",
"on": true,
"priority": 1,
"value": 24734
}
},
"LifeSupport": {
"module": {
"free": false,
"id": 128064149,
"name": "Int_LifeSupport_Size3_Class2",
"on": true,
"priority": 0,
"value": 10133
}
},
"MainEngines": {
"module": {
"free": false,
"id": 128064079,
"name": "Int_Engine_Size4_Class2",
"on": true,
"priority": 0,
"value": 59633
}
},
"PaintJob": {
"module": {
"free": false,
"id": 128741033,
"name": "PaintJob_CobraMKIII_Corrosive_05",
"on": true,
"priority": 1,
"value": 0
}
},
"PlanetaryApproachSuite": {
"module": {
"free": false,
"id": 128672317,
"name": "Int_PlanetApproachSuite",
"on": true,
"priority": 1,
"value": 500
}
},
"PowerDistributor": {
"module": {
"free": false,
"id": 128064179,
"name": "Int_PowerDistributor_Size1_Class2",
"on": true,
"priority": 2,
"value": 1293
}
},
"PowerPlant": {
"module": {
"free": false,
"id": 128064037,
"name": "Int_Powerplant_Size2_Class5",
"on": true,
"priority": 1,
"value": 160224
}
},
"Radar": {
"module": {
"free": false,
"id": 128064229,
"name": "Int_Sensors_Size3_Class2",
"on": true,
"priority": 0,
"value": 10133
}
},
"ShipID0": {
"module": {
"free": false,
"id": 128758976,
"name": "Nameplate_ShipID_Black",
"on": true,
"priority": 1,
"value": 0
}
},
"ShipID1": {
"module": {
"free": false,
"id": 128758976,
"name": "Nameplate_ShipID_Black",
"on": true,
"priority": 1,
"value": 0
}
},
"ShipKitBumper": {
"module": {
"free": false,
"id": 128740698,
"name": "CobraMkIII_ShipkitRaider1_Bumper1",
"on": true,
"priority": 1,
"value": 0
}
},
"ShipKitSpoiler": {
"module": {
"free": false,
"id": 128740701,
"name": "CobraMkIII_ShipkitRaider1_Spoiler1",
"on": true,
"priority": 1,
"value": 0
}
},
"ShipKitTail": {
"module": {
"free": false,
"id": 128740705,
"name": "CobraMkIII_ShipkitRaider1_Tail2",
"on": true,
"priority": 1,
"value": 0
}
},
"ShipKitWings": {
"module": {
"free": false,
"id": 128740707,
"name": "CobraMkIII_ShipkitRaider1_Wings1",
"on": true,
"priority": 1,
"value": 0
}
},
"ShipName0": {
"module": {
"free": false,
"id": 128758944,
"name": "Nameplate_Explorer01_Black",
"on": true,
"priority": 1,
"value": 0
}
},
"ShipName1": {
"module": {
"free": false,
"id": 128758944,
"name": "Nameplate_Explorer01_Black",
"on": true,
"priority": 1,
"value": 0
}
},
"Slot01_Size4": {
"module": {
"free": false,
"id": 128666663,
"name": "Int_FuelScoop_Size4_Class3",
"on": true,
"priority": 2,
"value": 178898
}
},
"Slot02_Size4": [],
"Slot03_Size4": [],
"Slot04_Size2": [],
"Slot05_Size2": {
"module": {
"free": false,
"id": 128663561,
"name": "Int_StellarBodyDiscoveryScanner_Advanced",
"on": true,
"priority": 2,
"value": 1545000
}
},
"Slot06_Size2": {
"module": {
"free": false,
"id": 128666634,
"name": "Int_DetailedSurfaceScanner_Tiny",
"on": true,
"priority": 2,
"value": 250000
}
}
},
"name": "CobraMkIII",
"value": {
"hull": 205287,
"modules": 3850628,
"unloaned": 1751109
}
}

View File

@@ -264,6 +264,18 @@ describe('Import Modal', function() {
expect(MockRouter.go.mock.calls.length).toBe(1);
expect(MockRouter.go.mock.calls[0][0]).toBe('/outfit/type_7_transport?code=A0patfFflidasdf5----0404040005050504044d2402.AwRj4yrI.CwRgDBlVK7EiA%3D%3D%3D.&bn=Imported%20Type-7%20Transporter');
});
it('imports a valid companion API build', function() {
const importData = require('./fixtures/companion-api-import-4');
pasteText(JSON.stringify(importData));
expect(modal.state.importValid).toBeTruthy();
expect(modal.state.errorMsg).toEqual(null);
expect(modal.state.singleBuild).toBe(true);
clickProceed();
expect(MockRouter.go.mock.calls.length).toBe(1);
expect(MockRouter.go.mock.calls[0][0]).toBe('outfit/cobra_mk_iii?code=A0p0tdFaldd3sdf4------34---2f2i.AwRj4yKA.CwRgDMYExre1Rcg%3D..EweloBhBGA2EoFMCGBzANokMK6A%3D');
});
});
describe('Import E:D Shipyard Builds', function() {

8
d3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -24,7 +24,7 @@
"deploy": "npm run lint && npm test && npm run build && npm run rsync"
},
"jest": {
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"transform": {".*": "<rootDir>/node_modules/babel-jest"},
"testRegex": "(/__tests__/test-.*|\\.(test|spec))\\.js$",
"moduleFileExtensions": [
"js",
@@ -37,7 +37,6 @@
"<rootDir>/node_modules/lodash",
"<rootDir>/node_modules/react",
"<rootDir>/node_modules/react-dom",
"<rootDir>/node_modules/react-addons-test-utils",
"<rootDir>/node_modules/react-testutils-additions",
"<rootDir>/node_modules/fbjs",
"<rootDir>/node_modules/fbemitter",
@@ -64,28 +63,27 @@
"babel-preset-stage-0": "*",
"css-loader": "^0.23.0",
"d3-selection": "1",
"eslint": "2.2.0",
"eslint-plugin-react": "^4.0.0",
"eslint": "3.19.0",
"eslint-plugin-react": "^6.10.3",
"expose-loader": "^0.7.1",
"express": "^4.13.3",
"extract-text-webpack-plugin": "2.0.0",
"file-loader": "^0.8.4",
"html-webpack-plugin": "^2.28.0",
"jest-cli": "^16.0.1",
"jest-cli": "^19.0.2",
"jsen": "^0.6.0",
"json-loader": "^0.5.3",
"less": "^2.5.3",
"less-loader": "^2.2.1",
"react-addons-perf": "^15.4.2",
"react-addons-test-utils": "^15.0.1",
"react-measure": "^1.4.6",
"react-testutils-additions": "^15.1.0",
"react-testutils-additions": "^15.2.0",
"rimraf": "^2.4.3",
"rollup": "0.36",
"rollup-plugin-node-resolve": "2",
"style-loader": "^0.13.0",
"url-loader": "^0.5.6",
"webpack": "^2.2.1",
"webpack": "^2.4.1",
"webpack-dev-server": "^2.4.1"
},
"dependencies": {
@@ -94,6 +92,7 @@
"classnames": "^2.2.0",
"coriolis-data": "EDCD/coriolis-data",
"d3": "4.6.0",
"detect-browser": "^1.7.0",
"fbemitter": "^2.0.0",
"lodash": "^4.15.0",
"lz-string": "^1.4.4",

View File

@@ -43,7 +43,7 @@ export default class JumpRange extends TranslatedComponent {
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.code != this.props.code) {
this.setState({ fuelLevel: 1,
calcJumpRangeFunc: this._calcJumpRange.bind(this, nextProps.ship) });
calcJumpRangeFunc: this._calcJumpRange.bind(this, nextProps.ship) });
}
return true;
}

View File

@@ -5,6 +5,7 @@ import { wrapCtxMenu } from '../utils/UtilityFunctions';
import { canMount } from '../utils/SlotFunctions';
import { Equalizer } from '../components/SvgIcons';
import cn from 'classnames';
const browser = require('detect-browser');
/**
* Abstract Slot Section
@@ -76,8 +77,10 @@ export default class SlotSection extends TranslatedComponent {
* @param {Event} e Drag Event
*/
_drag(originSlot, e) {
e.dataTransfer.setData('text/html', e.currentTarget);
e.dataTransfer.effectAllowed = 'all';
if (!browser || (browser.name !== 'edge' && browser.name !== 'ie')) {
e.dataTransfer.setData('text/html', e.currentTarget);
}
e.dataTransfer.effectAllowed = 'copyMove';
this.setState({ originSlot, copy: e.getModifierState('Alt') });
this._close();
}
@@ -94,10 +97,14 @@ export default class SlotSection extends TranslatedComponent {
if (os) {
// Show correct icon
const effect = this.state.copy ? 'copy' : 'move';
e.dataTransfer.dropEffect = os != targetSlot && canMount(this.props.ship, targetSlot, os.m.grp, os.m.class) ? effect : 'none';
if (!browser || (browser.name !== 'edge' && browser.name !== 'ie')) {
e.dataTransfer.dropEffect = os != targetSlot && canMount(this.props.ship, targetSlot, os.m.grp, os.m.class) ? effect : 'none';
}
this.setState({ targetSlot });
} else {
e.dataTransfer.dropEffect = 'none';
if (!browser || (browser.name !== 'edge' && browser.name !== 'ie')) {
e.dataTransfer.dropEffect = 'none';
}
}
}
@@ -107,7 +114,9 @@ export default class SlotSection extends TranslatedComponent {
*/
_dragOverNone(e) {
e.preventDefault();
e.dataTransfer.dropEffect = 'none';
if (!browser || (browser.name !== 'edge' && browser.name !== 'ie')) {
e.dataTransfer.dropEffect = 'none';
}
this.setState({ targetSlot: null });
}

View File

@@ -95,6 +95,10 @@ class ValueLabel extends React.Component {
value: PropTypes.number
};
/**
* Render offence
* @return {React.Component} contents
*/
render() {
const { x, y, payload, value } = this.props;

View File

@@ -60,11 +60,11 @@ export default class WeaponDamageChart extends TranslatedComponent {
const maxRange = this._calcMaxRange(nextProps.ship);
const maxDps = this._calcMaxSDps(nextProps.ship, nextProps.opponent, opponentShields, opponentArmour);
this.setState({ weaponNames,
opponentShields,
opponentArmour,
maxRange,
maxDps,
calcSDpsFunc: this._calcSDps.bind(this, nextProps.ship, weaponNames, nextProps.opponent, opponentShields, opponentArmour, nextProps.hull)
opponentShields,
opponentArmour,
maxRange,
maxDps,
calcSDpsFunc: this._calcSDps.bind(this, nextProps.ship, weaponNames, nextProps.opponent, opponentShields, opponentArmour, nextProps.hull)
});
}
return true;

View File

@@ -17,7 +17,7 @@ import ModalImport from '../components/ModalImport';
import { FloppyDisk, Bin, Download, Embed, Rocket, LinkIcon } from '../components/SvgIcons';
import ShortenUrl from '../utils/ShortenUrl';
import { comparisonBBCode } from '../utils/BBCode';
const browser = require('detect-browser');
/**
* Creates a comparator based on the specified predicate
@@ -228,8 +228,10 @@ export default class ComparisonPage extends Page {
let placeholder = this.placeholder = document.createElement('li');
placeholder.style.width = Math.round(this.dragged.offsetWidth) + 'px';
placeholder.className = 'facet-placeholder';
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text/html', e.currentTarget);
if (!browser || (browser.name !== 'edge' && browser.name !== 'ie')) {
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text/html', e.currentTarget);
}
}
/**

View File

@@ -65,7 +65,7 @@ function shipSummary(shipId, shipData) {
th = ship.standard[1].maxClass + 'A';
}
ship.optimizeMass({ th: th, fsd: '2D', ft: '1C' }); // Optmize mass with Max Thrusters
ship.optimizeMass({ th, fsd: '2D', ft: '1C' }); // Optmize mass with Max Thrusters
summary.topSpeed = ship.topSpeed;
summary.topBoost = ship.topBoost;
summary.baseArmour = ship.armour;

View File

@@ -168,10 +168,10 @@ function normValues(minMass, optMass, maxMass, minMul, optMul, maxMul, mass, bas
const res = base * mul;
return [res * (1 - (engpip * 4)),
res * (1 - (engpip * 3)),
res * (1 - (engpip * 2)),
res * (1 - (engpip * 1)),
res];
res * (1 - (engpip * 3)),
res * (1 - (engpip * 2)),
res * (1 - (engpip * 1)),
res];
}
/**

View File

@@ -105,115 +105,115 @@ export const BulkheadNames = [
* @type {Array}
*/
export const ShipFacets = [
{ // 0
title: 'agility',
props: ['topPitch', 'topRoll', 'topYaw'],
lbls: ['pitch', 'roll', 'yaw'],
fmt: 'f1',
i: 0
},
{ // 1
title: 'speed',
props: ['topSpeed', 'topBoost'],
lbls: ['thrusters', 'boost'],
unit: 'm/s',
fmt: 'int',
i: 1
},
{ // 2
title: 'armour',
props: ['armour'],
fmt: 'int',
i: 2
},
{ // 3
title: 'shields',
props: ['shield'],
unit: 'MJ',
fmt: 'int',
i: 3
},
{ // 4
title: 'jump range',
props: ['unladenRange', 'fullTankRange', 'ladenRange'],
lbls: ['max', 'full tank', 'laden'],
unit: 'LY',
fmt: 'round',
i: 4
},
{ // 5
title: 'mass',
props: ['unladenMass', 'ladenMass'],
lbls: ['unladen', 'laden'],
unit: 'T',
fmt: 'round',
i: 5
},
{ // 6
title: 'cargo',
props: ['cargoCapacity'],
unit: 'T',
fmt: 'int',
i: 6
},
{ // 7
title: 'fuel',
props: ['fuelCapacity'],
unit: 'T',
fmt: 'int',
i: 7
},
{ // 8
title: 'power',
props: ['powerRetracted', 'powerDeployed', 'powerAvailable'],
lbls: ['retracted', 'deployed', 'available'],
unit: 'MW',
fmt: 'f2',
i: 8
},
{ // 9
title: 'cost',
props: ['totalCost'],
unit: 'CR',
fmt: 'int',
i: 9
},
{ // 10
title: 'fastest range',
props: ['unladenFastestRange', 'ladenFastestRange'],
lbls: ['unladen', 'laden'],
unit: 'LY',
fmt: 'round',
i: 10
},
{ // 11
title: 'DPS',
props: ['totalDps', 'totalExplDps', 'totalKinDps', 'totalThermDps'],
lbls: ['total', 'explosive', 'kinetic', 'thermal'],
fmt: 'round',
i: 11
},
{ // 14
title: 'Sustained DPS',
props: ['totalSDps', 'totalExplSDps', 'totalKinSDps', 'totalThermSDps'],
lbls: ['total', 'explosive', 'kinetic', 'thermal'],
fmt: 'round',
i: 14
},
{ // 12
title: 'EPS',
props: ['totalEps'],
lbls: ['EPS'],
fmt: 'round',
i: 12
},
{ // 13
title: 'HPS',
props: ['totalHps'],
lbls: ['HPS'],
fmt: 'round',
i: 13
}
{ // 0
title: 'agility',
props: ['topPitch', 'topRoll', 'topYaw'],
lbls: ['pitch', 'roll', 'yaw'],
fmt: 'f1',
i: 0
},
{ // 1
title: 'speed',
props: ['topSpeed', 'topBoost'],
lbls: ['thrusters', 'boost'],
unit: 'm/s',
fmt: 'int',
i: 1
},
{ // 2
title: 'armour',
props: ['armour'],
fmt: 'int',
i: 2
},
{ // 3
title: 'shields',
props: ['shield'],
unit: 'MJ',
fmt: 'int',
i: 3
},
{ // 4
title: 'jump range',
props: ['unladenRange', 'fullTankRange', 'ladenRange'],
lbls: ['max', 'full tank', 'laden'],
unit: 'LY',
fmt: 'round',
i: 4
},
{ // 5
title: 'mass',
props: ['unladenMass', 'ladenMass'],
lbls: ['unladen', 'laden'],
unit: 'T',
fmt: 'round',
i: 5
},
{ // 6
title: 'cargo',
props: ['cargoCapacity'],
unit: 'T',
fmt: 'int',
i: 6
},
{ // 7
title: 'fuel',
props: ['fuelCapacity'],
unit: 'T',
fmt: 'int',
i: 7
},
{ // 8
title: 'power',
props: ['powerRetracted', 'powerDeployed', 'powerAvailable'],
lbls: ['retracted', 'deployed', 'available'],
unit: 'MW',
fmt: 'f2',
i: 8
},
{ // 9
title: 'cost',
props: ['totalCost'],
unit: 'CR',
fmt: 'int',
i: 9
},
{ // 10
title: 'fastest range',
props: ['unladenFastestRange', 'ladenFastestRange'],
lbls: ['unladen', 'laden'],
unit: 'LY',
fmt: 'round',
i: 10
},
{ // 11
title: 'DPS',
props: ['totalDps', 'totalExplDps', 'totalKinDps', 'totalThermDps'],
lbls: ['total', 'explosive', 'kinetic', 'thermal'],
fmt: 'round',
i: 11
},
{ // 14
title: 'Sustained DPS',
props: ['totalSDps', 'totalExplSDps', 'totalKinSDps', 'totalThermSDps'],
lbls: ['total', 'explosive', 'kinetic', 'thermal'],
fmt: 'round',
i: 14
},
{ // 12
title: 'EPS',
props: ['totalEps'],
lbls: ['EPS'],
fmt: 'round',
i: 12
},
{ // 13
title: 'HPS',
props: ['totalHps'],
lbls: ['HPS'],
fmt: 'round',
i: 13
}
];
/**

View File

@@ -18,6 +18,7 @@ CopyDirPlugin.prototype.apply = function(compiler) {
};
module.exports = {
cache: true,
entry: {
app: ['babel-polyfill', path.resolve(__dirname, 'src/app/index')],
lib: ['d3', 'react', 'react-dom', 'classnames', 'fbemitter', 'lz-string']
@@ -76,7 +77,7 @@ module.exports = {
rules: [
{ test: /\.css$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader'}) },
{ test: /\.less$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader',use: 'css-loader!less-loader'}) },
{ test: /\.(js|jsx)$/, loaders: [ 'babel-loader' ], include: path.join(__dirname, 'src') },
{ test: /\.(js|jsx)$/, loader: 'babel-loader?cacheDirectory=true', include: path.join(__dirname, 'src') },
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream' },