diff --git a/src/app/components/AvailableModulesMenu.jsx b/src/app/components/AvailableModulesMenu.jsx
index 6d10c191..2fc495d8 100644
--- a/src/app/components/AvailableModulesMenu.jsx
+++ b/src/app/components/AvailableModulesMenu.jsx
@@ -90,7 +90,7 @@ const CATEGORIES = {
'experimental': ['axmc', 'axmr', 'rfl', 'xs', 'sfn', 'rcpl'],
// Guardian
- 'guardian': ['gpp', 'gpc', 'ggc']
+ 'guardian': ['gpp', 'gpd', 'gpc', 'ggc']
};
/**
diff --git a/src/app/components/ModalShoppingList.jsx b/src/app/components/ModalShoppingList.jsx
index f9f0a9d3..b143a66f 100644
--- a/src/app/components/ModalShoppingList.jsx
+++ b/src/app/components/ModalShoppingList.jsx
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import TranslatedComponent from './TranslatedComponent';
-import ShortenUrl from '../utils/ShortenUrl';
+import request from 'superagent';
import Persist from '../stores/Persist';
/**
@@ -22,7 +22,9 @@ export default class ModalShoppingList extends TranslatedComponent {
this.state = {
matsList: '',
mats: {},
- matsPerGrade: Persist.getRolls()
+ cmdrName: Persist.getCmdr(),
+ matsPerGrade: Persist.getRolls(),
+ blueprints: []
};
}
@@ -31,6 +33,61 @@ export default class ModalShoppingList extends TranslatedComponent {
*/
componentDidMount() {
this.renderMats();
+ this.registerBPs();
+ }
+
+ /**
+ * Convert mats object to string
+ */
+ registerBPs() {
+ const ship = this.props.ship;
+ let blueprints = [];
+ for (const module of ship.costList) {
+ if (module.type === 'SHIP') {
+ continue;
+ }
+ if (module.m && module.m.blueprint) {
+ if (!module.m.blueprint.grade || !module.m.blueprint.grades) {
+ continue;
+ }
+ for (const g in module.m.blueprint.grades) {
+ if (g > module.m.blueprint.grade) {
+ continue;
+ }
+ blueprints.push({ blueprint: module.m.blueprint.grades[g], number: this.state.matsPerGrade[g] });
+ }
+ }
+ }
+ this.setState({ blueprints });
+ }
+
+ /**
+ * Send all blueprints to ED Engineer
+ * @param {SyntheticEvent} event React event
+ */
+ sendToEDEng(event) {
+ event.preventDefault();
+ event.target.disabled = true;
+ event.target.innerText = 'Sending...';
+ let countSent = 0;
+ let countTotal = this.state.blueprints.length;
+ const target = event.target;
+ for (const i of this.state.blueprints) {
+ request
+ .patch(`http://localhost:44405/${this.state.cmdrName}/shopping-list`)
+ .field('uuid', i.blueprint.uuid)
+ .field('size', i.number)
+ .end((err, res) => {
+ if (err) {
+ console.log(err);
+ }
+ countSent++;
+ if (countSent === countTotal) {
+ target.disabled = false;
+ target.innerText = 'Send to EDEngineer';
+ }
+ });
+ }
}
/**
@@ -86,6 +143,17 @@ export default class ModalShoppingList extends TranslatedComponent {
this.setState({ matsPerGrade: newState });
Persist.setRolls(newState);
this.renderMats();
+ this.registerBPs();
+ }
+
+ /**
+ * Handler for changing roll amounts
+ * @param {SyntheticEvent} e React Event
+ */
+ cmdrChangeHandler(e) {
+ let cmdrName = e.target.value;
+ this.setState({ cmdrName });
+ Persist.setCmdr(cmdrName);
}
/**
@@ -95,6 +163,8 @@ export default class ModalShoppingList extends TranslatedComponent {
render() {
let translate = this.context.language.translate;
this.changeHandler = this.changeHandler.bind(this);
+ this.cmdrChangeHandler = this.cmdrChangeHandler.bind(this);
+ this.sendToEDEng = this.sendToEDEng.bind(this);
return
e.stopPropagation() }>
{translate('PHRASE_SHOPPING_MATS')}
@@ -114,6 +184,11 @@ export default class ModalShoppingList extends TranslatedComponent {
+
+
+
+
+
;
}
diff --git a/src/app/components/StandardSlot.jsx b/src/app/components/StandardSlot.jsx
index 18ba79a1..54ce4733 100644
--- a/src/app/components/StandardSlot.jsx
+++ b/src/app/components/StandardSlot.jsx
@@ -67,6 +67,9 @@ export default class StandardSlot extends TranslatedComponent {
if (m && m.name && m.name === 'Guardian Hybrid Power Plant') {
validMods = [];
}
+ if (m && m.name && m.name === 'Guardian Power Distributor') {
+ validMods = [];
+ }
let showModuleResistances = Persist.showModuleResistances();
let mass = m.getMass() || m.cargo || m.fuel || 0;
diff --git a/src/app/i18n/en.json b/src/app/i18n/en.json
index c2c5d9dd..ff504e94 100644
--- a/src/app/i18n/en.json
+++ b/src/app/i18n/en.json
@@ -139,6 +139,7 @@
"t": "thrusters",
"tp": "Torpedo Pylon",
"ul": "Burst Laser",
+ "Send To EDEngineer": "Send To EDEngineer",
"ws": "Frame Shift Wake Scanner",
"rpl": "Repair Limpet Controller",
"rcpl": "Recon Limpet Controller",
diff --git a/src/app/shipyard/Constants.js b/src/app/shipyard/Constants.js
index e7421e2f..70569e65 100755
--- a/src/app/shipyard/Constants.js
+++ b/src/app/shipyard/Constants.js
@@ -18,7 +18,7 @@ export const ModuleGroupToName = {
// Standard
pp: 'Power Plant',
gpp: 'Guardian Hybrid Power Plant',
- gpd: 'Guardian Hybrid Power Distributor',
+ gpd: 'Guardian Power Distributor',
t: 'Thrusters',
fsd: 'Frame Shift Drive',
ls: 'Life Support',
diff --git a/src/app/stores/Persist.js b/src/app/stores/Persist.js
index 74418318..dc162909 100644
--- a/src/app/stores/Persist.js
+++ b/src/app/stores/Persist.js
@@ -5,6 +5,7 @@ const LS_KEY_BUILDS = 'builds';
const LS_KEY_COMPARISONS = 'comparisons';
const LS_KEY_LANG = 'NG_TRANSLATE_LANG_KEY';
const LS_KEY_COST_TAB = 'costTab';
+const LS_KEY_CMDR_NAME = 'cmdrName';
const LS_KEY_OUTFITTING_TAB = 'outfittingTab';
const LS_KEY_INSURANCE = 'insurance';
const LS_KEY_SHIP_DISCOUNT = 'shipDiscount';
@@ -86,6 +87,7 @@ export class Persist extends EventEmitter {
let moduleResistances = _get(LS_KEY_MODULE_RESISTANCES);
let matsPerGrade = _get(LS_KEY_ROLLS);
+ let cmdrName = _getString(LS_KEY_CMDR_NAME);
let tips = _get(LS_KEY_TOOLTIPS);
let insurance = _getString(LS_KEY_INSURANCE);
let shipDiscount = _get(LS_KEY_SHIP_DISCOUNT);
@@ -111,6 +113,7 @@ export class Persist extends EventEmitter {
4: 4,
5: 10
};
+ this.cmdrName = cmdrName || '';
this.tooltipsEnabled = tips === null ? true : tips;
this.moduleResistancesEnabled = moduleResistances === null ? true : moduleResistances;
@@ -487,6 +490,14 @@ export class Persist extends EventEmitter {
return this.matsPerGrade;
}
+ /**
+ * Get the saved Mats per grade
+ * @return {Object} # of rolls per grade
+ */
+ getCmdr() {
+ return this.cmdrName;
+ }
+
/**
* Persist selected cost tab
* @param {number} tabName Cost tab name
@@ -496,6 +507,16 @@ export class Persist extends EventEmitter {
_put(LS_KEY_COST_TAB, tabName);
}
+ /**
+ * Persist cmdr name
+ * @param {string} cmdrName Commander name for EDEngineer
+ */
+ setCmdr(cmdrName) {
+ this.cmdrName = cmdrName;
+ _put(LS_KEY_CMDR_NAME, cmdrName);
+ this.emit('cmdr');
+ }
+
/**
* Get the saved discount
* @return {number} val Discount value/amount