mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-10 07:05:35 +00:00
Modified export to EDOMH/EDEngineer page to be less 'bodged', allow EDOMH button to be clickable without checking for EDEngineer API (If they have EDOMH, they probably don't have EDEngineer...) and added a workaround for Coriolis sending bogus data for bulkheads.
This commit is contained in:
@@ -90,8 +90,10 @@ export default class ModalShoppingList extends TranslatedComponent {
|
|||||||
request
|
request
|
||||||
.get('http://localhost:44405/commanders')
|
.get('http://localhost:44405/commanders')
|
||||||
.end((err, res) => {
|
.end((err, res) => {
|
||||||
|
this.display = 'block';
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
this.display = 'none';
|
||||||
return this.setState({ failed: true });
|
return this.setState({ failed: true });
|
||||||
}
|
}
|
||||||
const cmdrs = JSON.parse(res.text);
|
const cmdrs = JSON.parse(res.text);
|
||||||
@@ -178,8 +180,34 @@ export default class ModalShoppingList extends TranslatedComponent {
|
|||||||
if (g < module.m.blueprint.grade) {
|
if (g < module.m.blueprint.grade) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
let item = "";
|
||||||
|
// If the module blueprint fdname contains "Armour_" it's a bulkhead and we need to pre-populate the item field with the correct name from the ship object
|
||||||
|
if (module.m.blueprint.fdname.includes("Armour_")) {
|
||||||
|
switch (ship.bulkheads.m.name){
|
||||||
|
case "Lightweight Alloy":
|
||||||
|
item = ship.id + "_Armour_Grade1";
|
||||||
|
break;
|
||||||
|
case "Reinforced Alloy":
|
||||||
|
item = ship.id + "_Armour_Grade2";
|
||||||
|
break;
|
||||||
|
case "Military Grade Composite":
|
||||||
|
item = ship.id + "_Armour_Grade3";
|
||||||
|
break;
|
||||||
|
case "Mirrored Surface Composite":
|
||||||
|
item = ship.id + "_Armour_Mirrored";
|
||||||
|
break;
|
||||||
|
case "Reactive Surface Composite":
|
||||||
|
item = ship.id + "_Armour_Reactive";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
console.log(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
item = module.m.symbol;
|
||||||
|
}
|
||||||
|
|
||||||
blueprints.push({
|
blueprints.push({
|
||||||
"item": module.m.symbol,
|
"item": item,
|
||||||
"blueprint": module.m.blueprint.fdname,
|
"blueprint": module.m.blueprint.fdname,
|
||||||
"grade": module.m.blueprint.grade,
|
"grade": module.m.blueprint.grade,
|
||||||
"highestGradePercentage":1.0
|
"highestGradePercentage":1.0
|
||||||
@@ -196,6 +224,7 @@ export default class ModalShoppingList extends TranslatedComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let JSONString = JSON.stringify(baseJson)
|
let JSONString = JSON.stringify(baseJson)
|
||||||
|
console.log(JSONString)
|
||||||
let deflated = zlib.deflateSync(JSONString)
|
let deflated = zlib.deflateSync(JSONString)
|
||||||
|
|
||||||
//actually encode
|
//actually encode
|
||||||
@@ -320,16 +349,22 @@ export default class ModalShoppingList extends TranslatedComponent {
|
|||||||
<div>
|
<div>
|
||||||
<textarea className='cb json' readOnly value={this.state.matsList} />
|
<textarea className='cb json' readOnly value={this.state.matsList} />
|
||||||
</div>
|
</div>
|
||||||
<label hidden={!compatible} className={'l cap'}>{translate('CMDR Name')}</label>
|
<p hidden={compatible} id={'browserbad'} className={'l'}>{translate('PHRASE_FIREFOX_EDENGINEER')}</p>
|
||||||
|
<p hidden={!this.state.failed} id={'failed'} className={'l'}>{translate('PHRASE_FAILED_TO_FIND_EDENGINEER')}</p>
|
||||||
|
<div id='edengineer' display={this.display} hidden={!!this.state.failed && !compatible}>
|
||||||
|
<label hidden={!compatible || !!this.state.failed} className={'l cap'}>{translate('CMDR Name')}</label>
|
||||||
<br/>
|
<br/>
|
||||||
<select hidden={!compatible} className={'cmdr-select l cap'} onChange={this.cmdrChangeHandler} defaultValue={this.state.cmdrName}>
|
<select hidden={!compatible || !!this.state.failed} className={'cmdr-select l cap'} onChange={this.cmdrChangeHandler} defaultValue={this.state.cmdrName}>
|
||||||
{this.state.cmdrs.map(e => <option key={e}>{e}</option>)}
|
{this.state.cmdrs.map(e => <option key={e}>{e}</option>)}
|
||||||
</select>
|
</select>
|
||||||
<br/>
|
<br/>
|
||||||
<p hidden={!this.state.failed} id={'failed'} className={'l'}>{translate('PHRASE_FAIL_EDENGINEER')}</p>
|
<button className={'l cb dismiss cap'} hidden={!this.state.failed} disabled={!!this.state.failed || !compatible} onClick={this.sendToEDEng}>{translate('Send to EDEngineer')}</button>
|
||||||
<p hidden={compatible} id={'browserbad'} className={'l'}>{translate('PHRASE_FIREFOX_EDENGINEER')}</p>
|
</div>
|
||||||
<button className={'l cb dismiss cap'} disabled={!!this.state.failed || !compatible} onClick={this.sendToEDEng}>{translate('Send to EDEngineer')}</button>
|
<div id='edomh'>
|
||||||
<button style={{marginTop: 5}} className={'l cb dismiss cap'} disabled={!!this.state.failed} onClick={this.sendToEDOMH}>{translate('Send to EDOMH')}</button>
|
<p>{translate('PHRASE_ENSURE_EDOMH')}</p>
|
||||||
|
<button style={{marginTop: 5}} className={'l cb dismiss cap'} onClick={this.sendToEDOMH}>{translate('Send to EDOMH')}</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button className={'r dismiss cap'} onClick={this.context.hideModal}>{translate('close')}</button>
|
<button className={'r dismiss cap'} onClick={this.context.hideModal}>{translate('close')}</button>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,9 @@
|
|||||||
"TT_SUMMARY_LADEN_TOTAL_JUMP": "Farthest possible range with full cargo, a full fuel tank, and jumping as far as possible each time",
|
"TT_SUMMARY_LADEN_TOTAL_JUMP": "Farthest possible range with full cargo, a full fuel tank, and jumping as far as possible each time",
|
||||||
"HELP_MODIFICATIONS_MENU": "Click on a number to enter a new value, or drag along the bar for small changes",
|
"HELP_MODIFICATIONS_MENU": "Click on a number to enter a new value, or drag along the bar for small changes",
|
||||||
"PHRASE_FAIL_EDENGINEER": "Failed to send to EDEngineer (Launch EDEngineer and make sure the API is started then refresh the page.)",
|
"PHRASE_FAIL_EDENGINEER": "Failed to send to EDEngineer (Launch EDEngineer and make sure the API is started then refresh the page.)",
|
||||||
|
"PHRASE_ENSURE_EDOMH": "Ensure EDO Material Helper is running, else this button will do nothing!",
|
||||||
"PHRASE_FIREFOX_EDENGINEER": "Sending to EDEngineer is not compatible with Firefox's security settings. Please try again with Chrome.",
|
"PHRASE_FIREFOX_EDENGINEER": "Sending to EDEngineer is not compatible with Firefox's security settings. Please try again with Chrome.",
|
||||||
|
"PHRASE_FAILED_TO_FIND_EDENGINEER": "Failed to find ED Engineer API. Please ensure it is running and try again.",
|
||||||
"MISSING_MODULES": "Missing Modules",
|
"MISSING_MODULES": "Missing Modules",
|
||||||
"am": "Auto Field-Maintenance Unit",
|
"am": "Auto Field-Maintenance Unit",
|
||||||
"bh": "Bulkheads",
|
"bh": "Bulkheads",
|
||||||
|
|||||||
@@ -41,6 +41,15 @@
|
|||||||
h2 {
|
h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
clear: left;
|
||||||
|
padding: 30, 0, 0, 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin: 100px, 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
|
|||||||
Reference in New Issue
Block a user