From fbf59219d0f30982a6562291a777423c3243bec4 Mon Sep 17 00:00:00 2001 From: felixlinker Date: Sat, 17 Nov 2018 01:56:58 +0000 Subject: [PATCH 1/5] Apply diminishing returns for hull resistance modding to all modules --- src/app/shipyard/Module.js | 33 ++++++++------------------------- src/app/shipyard/Ship.js | 5 +++++ 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/app/shipyard/Module.js b/src/app/shipyard/Module.js index d03202a4..83d5de58 100755 --- a/src/app/shipyard/Module.js +++ b/src/app/shipyard/Module.js @@ -41,6 +41,7 @@ export default class Module { * @return {object} The value of the modification. If it is a numeric value then it is returned as an integer value scaled so that 1.23% == 123 */ getModValue(name, raw) { + let baseVal = this[name]; let result = this.mods && this.mods[name] ? this.mods[name] : null; if ((!raw) && this.blueprint && this.blueprint.special) { @@ -51,13 +52,8 @@ export default class Module { const modification = Modifications.modifications[name]; const multiplier = modification.type === 'percentage' ? 10000 : 100; if (name === 'explres' || name === 'kinres' || name === 'thermres' || name === 'causres') { - // Resistance modifications in itself are additive, however their - // special effects are multiplicative. They affect the overall result - // by (special effect resistance) * (damage mult after modification), - // i. e. we need to apply the special effect as a multiplier to the - // overall result and then calculate the difference. - let baseMult = this[name] ? 1 - this[name] : 1; - result = (baseMult - (baseMult - result / multiplier) * (1 - modifierActions[name] / 100)) * multiplier; + // Apply resistance modding mechanisms to special effects subsequently + result = result + modifierActions[name] * (1 - (this[name] + result / multiplier)) * 100; } else if (modification.method === 'additive') { result = result + modifierActions[name] * 100; } else if (modification.method === 'overwrite') { @@ -75,15 +71,6 @@ export default class Module { } } - // Resistance modding for hull reinforcement packages has additional - // diminishing returns implemented. The mod value gets lowered by - // the amount of base resistance the hrp has. - if (!isNaN(result) && this.grp === 'hr' && - (name === 'kinres' || name === 'thermres' || name === 'explres')) { - let baseRes = this[name]; - result = result * (1 - baseRes); - } - // Sanitise the resultant value to 4dp equivalent return isNaN(result) ? result : Math.round(result); } @@ -108,11 +95,11 @@ export default class Module { // This special effect modifies the value being set, so we need to revert it prior to storing the value const modification = Modifications.modifications[name]; if (name === 'explres' || name === 'kinres' || name === 'thermres' || name === 'causres') { - // Resistance modifications in itself are additive but their - // experimentals are applied multiplicatively therefor we must handle - // them differently here (cf. documentation in getModValue). - let baseMult = (this[name] ? 1 - this[name] : 1); - value = ((baseMult - value / 10000) / (1 - modifierActions[name] / 100) - baseMult) * -10000; + let res = (this[name] ? this[name] : 0) + value / 10000; + let experimental = modifierActions[name] / 100; + value = (experimental - res) / (experimental - 1) - this[name]; + value *= 10000; + // value = ((baseMult - value / 10000) / (1 - modifierActions[name] / 100) - baseMult) * -10000; } else if (modification.method === 'additive') { value = value - modifierActions[name]; } else if (modification.method === 'overwrite') { @@ -177,10 +164,6 @@ export default class Module { baseValue = 0; } modValue = value - baseValue; - if (this.grp === 'hr' && - (name === 'kinres' || name === 'thermres' || name === 'explres')) { - modValue = modValue / (1 - baseValue); - } } else if (name === 'shieldboost' || name === 'hullboost') { modValue = (1 + value) / (1 + baseValue) - 1; } else { // multiplicative diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js index b6db1b53..f79cdf1e 100755 --- a/src/app/shipyard/Ship.js +++ b/src/app/shipyard/Ship.js @@ -505,6 +505,11 @@ export default class Ship { if (isAbsolute) { m.setPretty(name, value, sentfromui); } else { + // Resistance modifiers scale with the base value + if (name == 'kinres' || name == 'thermres' || name == 'causres' || name == 'explres') { + let baseValue = m.get(name, false); + value = (1 - baseValue) * value; + } m.setModValue(name, value, sentfromui); } From 934de01803fd72ad08440d2ad540b5c0c4587ce7 Mon Sep 17 00:00:00 2001 From: Willyb321 Date: Wed, 21 Nov 2018 08:50:53 +1100 Subject: [PATCH 2/5] add announcements to actual page --- src/app/Coriolis.jsx | 2 ++ src/app/components/Announcement.jsx | 2 +- src/less/app.less | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/app/Coriolis.jsx b/src/app/Coriolis.jsx index 8041ccff..0595b41c 100644 --- a/src/app/Coriolis.jsx +++ b/src/app/Coriolis.jsx @@ -6,6 +6,7 @@ import { EventEmitter } from 'fbemitter'; import { getLanguage } from './i18n/Language'; import Persist from './stores/Persist'; +import Announcement from './components/Announcement'; import Header from './components/Header'; import Tooltip from './components/Tooltip'; import ModalExport from './components/ModalExport'; @@ -395,6 +396,7 @@ export default class Coriolis extends React.Component { return
+
{this.state.announcements.map(a => )}
{this.state.error ? this.state.error : this.state.page ? React.createElement(this.state.page, { currentMenu }) : } {this.state.modal} diff --git a/src/app/components/Announcement.jsx b/src/app/components/Announcement.jsx index 76a3bdb5..1c2df735 100644 --- a/src/app/components/Announcement.jsx +++ b/src/app/components/Announcement.jsx @@ -25,7 +25,7 @@ export default class Announcement extends React.Component { * @return {React.Component} A href element */ render() { - return

{this.props.text}

; + return
{this.props.text}
; } } diff --git a/src/less/app.less b/src/less/app.less index 69c72d71..566a9825 100755 --- a/src/less/app.less +++ b/src/less/app.less @@ -171,3 +171,16 @@ footer { text-align: right; } } + +.announcement-container { + display: flex; + align-items: center; + padding-top: 10px; + justify-content: center; + flex-flow: row wrap; +} + +.announcement { + border: 1px @secondary solid; + padding: 10px; +} From b3be0bd63980b83f00ccdc03d02db2530ddc4a4f Mon Sep 17 00:00:00 2001 From: Willyb321 Date: Wed, 21 Nov 2018 09:00:50 +1100 Subject: [PATCH 3/5] remove logs --- src/app/shipyard/Ship.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js index 6fd05249..92aab6e7 100755 --- a/src/app/shipyard/Ship.js +++ b/src/app/shipyard/Ship.js @@ -1507,7 +1507,7 @@ export default class Ship { buffer.writeInt32LE(slotMod.value, curpos); } const modification = _.find(Modifications.modifications, function(o) { return o.id === slotMod.id; }); - console.log('ENCODE Slot ' + i + ': ' + modification.name + ' = ' + slotMod.value); + // console.log('ENCODE Slot ' + i + ': ' + modification.name + ' = ' + slotMod.value); curpos += 4; } buffer.writeInt8(MODIFICATION_ID_DONE, curpos++); @@ -1519,7 +1519,7 @@ export default class Ship { } this.serialized.modifications = zlib.gzipSync(buffer).toString('base64'); - console.log(this.serialized.modifications) + // console.log(this.serialized.modifications) } else { this.serialized.modifications = null; } @@ -1562,7 +1562,7 @@ export default class Ship { blueprint.special = _.find(Modifications.specials, function(o) { return o.id === modificationValue; }); } else { const modification = _.find(Modifications.modifications, function(o) { return o.id === modificationId; }); - console.log('DECODE Slot ' + slot + ': ' + modification.name + ' = ' + modificationValue); + // console.log('DECODE Slot ' + slot + ': ' + modification.name + ' = ' + modificationValue); modifications[modification.name] = modificationValue; } modificationId = buffer.readInt8(curpos++); From ec0d05e0815a9c64d718cbba38d8a8e8625f77c4 Mon Sep 17 00:00:00 2001 From: willyb321 Date: Thu, 22 Nov 2018 07:31:45 +1100 Subject: [PATCH 4/5] add beta resting heat --- src/app/components/ShipSummaryTable.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/components/ShipSummaryTable.jsx b/src/app/components/ShipSummaryTable.jsx index 134d8e41..176fc12e 100644 --- a/src/app/components/ShipSummaryTable.jsx +++ b/src/app/components/ShipSummaryTable.jsx @@ -52,6 +52,7 @@ export default class ShipSummaryTable extends TranslatedComponent { const boostTooltip = canBoost ? 'TT_SUMMARY_BOOST' : canThrust ? 'TT_SUMMARY_BOOST_NONFUNCTIONAL' : 'TT_SUMMARY_SPEED_NONFUNCTIONAL'; const sgMetrics = Calc.shieldMetrics(ship, pips.sys); const shipBoost = canBoost ? Calc.calcBoost(ship) : 'No Boost'; + const restingHeat = Math.sqrt(((ship.standard[0].m.pgen * ship.standard[0].m.eff) / ship.heatCapacity) / 0.2); const armourMetrics = Calc.armourMetrics(ship); let shieldColour = 'blue'; if (shieldGenerator && shieldGenerator.m.grp === 'psg') { @@ -85,6 +86,7 @@ export default class ShipSummaryTable extends TranslatedComponent { {translate('crew')} {translate('MLF')} {translate('boost time')} + {translate('resting heat (Beta)')} {translate('max')} @@ -122,6 +124,7 @@ export default class ShipSummaryTable extends TranslatedComponent { {ship.crew} {ship.masslock} {shipBoost !== 'No Boost' ? formats.time(shipBoost) : 'No Boost'} + {formats.pct(restingHeat)} From 222173b38834485ac52a7dd39d3d9f892a1ee9e7 Mon Sep 17 00:00:00 2001 From: willyb321 Date: Sun, 25 Nov 2018 07:54:16 +1100 Subject: [PATCH 5/5] add category select to orbis modal --- src/app/components/ModalOrbis.jsx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/app/components/ModalOrbis.jsx b/src/app/components/ModalOrbis.jsx index 56896fd4..9580fdfb 100644 --- a/src/app/components/ModalOrbis.jsx +++ b/src/app/components/ModalOrbis.jsx @@ -23,8 +23,10 @@ export default class ModalOrbis extends TranslatedComponent { this.state = { orbisCreds: Persist.getOrbisCreds(), orbisUrl: '...', + ship: this.props.ship, authenticatedStatus: 'Checking...' }; + this.orbisCategory = this.orbisCategory.bind(this); } /** @@ -88,6 +90,17 @@ export default class ModalOrbis extends TranslatedComponent { }); } + /** + * Handler for changing category + * @param {SyntheticEvent} e React Event + */ + orbisCategory(e) { + let ship = this.state.ship; + let cat = e.target.value; + ship.category = cat; + this.setState({ship}); + } + /** * Render the modal * @return {React.Component} Modal Content @@ -106,6 +119,17 @@ export default class ModalOrbis extends TranslatedComponent {

Log in / signup to Orbis

+

Category

+ +

{translate('Orbis link')}

e.target.select() }/>