mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +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
|
||||
.get('http://localhost:44405/commanders')
|
||||
.end((err, res) => {
|
||||
this.display = 'block';
|
||||
if (err) {
|
||||
console.log(err);
|
||||
this.display = 'none';
|
||||
return this.setState({ failed: true });
|
||||
}
|
||||
const cmdrs = JSON.parse(res.text);
|
||||
@@ -178,8 +180,34 @@ export default class ModalShoppingList extends TranslatedComponent {
|
||||
if (g < module.m.blueprint.grade) {
|
||||
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({
|
||||
"item": module.m.symbol,
|
||||
"item": item,
|
||||
"blueprint": module.m.blueprint.fdname,
|
||||
"grade": module.m.blueprint.grade,
|
||||
"highestGradePercentage":1.0
|
||||
@@ -193,11 +221,12 @@ export default class ModalShoppingList extends TranslatedComponent {
|
||||
"version":1,
|
||||
"name":ship.name, // TO-DO: Import build name and put that here correctly
|
||||
"items": blueprints
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let JSONString = JSON.stringify(baseJson)
|
||||
console.log(JSONString)
|
||||
let deflated = zlib.deflateSync(JSONString)
|
||||
|
||||
|
||||
//actually encode
|
||||
let link = base64url.encode(deflated)
|
||||
link = "edomh://coriolis/?" + link;
|
||||
@@ -320,16 +349,22 @@ export default class ModalShoppingList extends TranslatedComponent {
|
||||
<div>
|
||||
<textarea className='cb json' readOnly value={this.state.matsList} />
|
||||
</div>
|
||||
<label hidden={!compatible} className={'l cap'}>{translate('CMDR Name')}</label>
|
||||
<br/>
|
||||
<select hidden={!compatible} className={'cmdr-select l cap'} onChange={this.cmdrChangeHandler} defaultValue={this.state.cmdrName}>
|
||||
{this.state.cmdrs.map(e => <option key={e}>{e}</option>)}
|
||||
</select>
|
||||
<br/>
|
||||
<p hidden={!this.state.failed} id={'failed'} className={'l'}>{translate('PHRASE_FAIL_EDENGINEER')}</p>
|
||||
<p hidden={compatible} id={'browserbad'} className={'l'}>{translate('PHRASE_FIREFOX_EDENGINEER')}</p>
|
||||
<button className={'l cb dismiss cap'} disabled={!!this.state.failed || !compatible} onClick={this.sendToEDEng}>{translate('Send to EDEngineer')}</button>
|
||||
<button style={{marginTop: 5}} className={'l cb dismiss cap'} disabled={!!this.state.failed} onClick={this.sendToEDOMH}>{translate('Send to EDOMH')}</button>
|
||||
<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/>
|
||||
<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>)}
|
||||
</select>
|
||||
<br/>
|
||||
<button className={'l cb dismiss cap'} hidden={!this.state.failed} disabled={!!this.state.failed || !compatible} onClick={this.sendToEDEng}>{translate('Send to EDEngineer')}</button>
|
||||
</div>
|
||||
<div id='edomh'>
|
||||
<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>
|
||||
</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",
|
||||
"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_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_FAILED_TO_FIND_EDENGINEER": "Failed to find ED Engineer API. Please ensure it is running and try again.",
|
||||
"MISSING_MODULES": "Missing Modules",
|
||||
"am": "Auto Field-Maintenance Unit",
|
||||
"bh": "Bulkheads",
|
||||
|
||||
@@ -183,4 +183,4 @@ footer {
|
||||
.announcement {
|
||||
border: 1px @secondary solid;
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,15 @@
|
||||
h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
clear: left;
|
||||
padding: 30, 0, 0, 0;
|
||||
}
|
||||
|
||||
button {
|
||||
margin: 100px, 0;
|
||||
}
|
||||
}
|
||||
|
||||
textarea {
|
||||
|
||||
Reference in New Issue
Block a user