mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Tidy-ups for release
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
* Clean up breakpoints for modules in available modules list; stops 7- or 8- module long lines
|
* Clean up breakpoints for modules in available modules list; stops 7- or 8- module long lines
|
||||||
* Add damager/range graphs to damage dealt
|
* Add damager/range graphs to damage dealt
|
||||||
* Reorder panels
|
* Reorder panels
|
||||||
|
* Use coriolis-data 2.2.18:
|
||||||
|
* Correct lower efficiency value to be better, not worse
|
||||||
|
|
||||||
#2.2.17
|
#2.2.17
|
||||||
* Use in-game terminology for shield generator optmul and optmass items
|
* Use in-game terminology for shield generator optmul and optmass items
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "coriolis_shipyard",
|
"name": "coriolis_shipyard",
|
||||||
"version": "2.2.18b",
|
"version": "2.2.18",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/EDCD/coriolis"
|
"url": "https://github.com/EDCD/coriolis"
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param {Object} props React Component properties
|
* @param {Object} props React Component properties
|
||||||
|
* @param {Object} context React Component context
|
||||||
*/
|
*/
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -73,7 +74,7 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
const against = DamageDealt.DEFAULT_AGAINST;
|
const against = DamageDealt.DEFAULT_AGAINST;
|
||||||
const maxRange = this._calcMaxRange(ship);
|
const maxRange = this._calcMaxRange(ship);
|
||||||
const range = 1000 / maxRange;
|
const range = 1000 / maxRange;
|
||||||
const maxDps = this._calcMaxSDps(ship, against)
|
const maxDps = this._calcMaxSDps(ship, against);
|
||||||
const weaponNames = this._weaponNames(ship, context);
|
const weaponNames = this._weaponNames(ship, context);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
@@ -109,7 +110,7 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
const data = this._calcWeaponsDps(nextProps.ship, this.state.against, this.state.range * this.state.maxRange, this.props.hull);
|
const data = this._calcWeaponsDps(nextProps.ship, this.state.against, this.state.range * this.state.maxRange, this.props.hull);
|
||||||
const weaponNames = this._weaponNames(nextProps.ship, nextContext);
|
const weaponNames = this._weaponNames(nextProps.ship, nextContext);
|
||||||
const maxRange = this._calcMaxRange(nextProps.ship);
|
const maxRange = this._calcMaxRange(nextProps.ship);
|
||||||
const maxDps = this._calcMaxSDps(nextProps.ship, this.state.against)
|
const maxDps = this._calcMaxSDps(nextProps.ship, this.state.against);
|
||||||
this.setState({ weapons: data.weapons,
|
this.setState({ weapons: data.weapons,
|
||||||
totals: data.totals,
|
totals: data.totals,
|
||||||
weaponNames,
|
weaponNames,
|
||||||
@@ -129,11 +130,10 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
*/
|
*/
|
||||||
_calcMaxSDps(ship, against) {
|
_calcMaxSDps(ship, against) {
|
||||||
let maxSDps = 0;
|
let maxSDps = 0;
|
||||||
for (let i =0; i < ship.hardpoints.length; i++) {
|
for (let i = 0; i < ship.hardpoints.length; i++) {
|
||||||
if (ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
if (ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
||||||
const m = ship.hardpoints[i].m;
|
const m = ship.hardpoints[i].m;
|
||||||
const thisSDps = m.getClip() ? (m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload()) : m.getDps();
|
const thisSDps = m.getClip() ? (m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload()) : m.getDps();
|
||||||
//const thisDps = m.getDps();// * (m.getPiercing() >= against.properties.hardness ? 1 : m.getPiercing() / against.properties.hardness);
|
|
||||||
if (thisSDps > maxSDps) {
|
if (thisSDps > maxSDps) {
|
||||||
maxSDps = thisSDps;
|
maxSDps = thisSDps;
|
||||||
}
|
}
|
||||||
@@ -144,13 +144,16 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the per-weapon DPS for this ship against another ship at a given range
|
* Calculate the per-weapon DPS for this ship against another ship at a given range
|
||||||
* @param {Object} ship The ship
|
* @param {Object} context The context
|
||||||
* @param {Object} against The target
|
* @param {Object} ship The ship
|
||||||
* @param {Object} range The engagement range
|
* @param {Object} weaponNames The names of the weapons for which to calculate DPS
|
||||||
* @return {array} The array of weapon DPS
|
* @param {Object} against The target
|
||||||
|
* @param {bool} hull true if to calculate against hull, false if to calculate against shields
|
||||||
|
* @param {Object} range The engagement range
|
||||||
|
* @return {array} The array of weapon DPS
|
||||||
*/
|
*/
|
||||||
_calcDps(context, ship, weaponNames, against, hull, range) {
|
_calcDps(context, ship, weaponNames, against, hull, range) {
|
||||||
let results = {}
|
let results = {};
|
||||||
let weaponNum = 0;
|
let weaponNum = 0;
|
||||||
for (let i = 0; i < ship.hardpoints.length; i++) {
|
for (let i = 0; i < ship.hardpoints.length; i++) {
|
||||||
if (ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
if (ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
||||||
@@ -162,16 +165,18 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Calculate the maximum range of a ship's weapons
|
||||||
|
* @param {Object} ship The ship
|
||||||
|
* @returns {int} The maximum range, in metres
|
||||||
*/
|
*/
|
||||||
_calcMaxRange(ship) {
|
_calcMaxRange(ship) {
|
||||||
let maxRange = 1000;
|
let maxRange = 1000;
|
||||||
for (let i =0; i < ship.hardpoints.length; i++) {
|
for (let i = 0; i < ship.hardpoints.length; i++) {
|
||||||
if (ship.hardpoints[i].maxClass > 0 && ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
if (ship.hardpoints[i].maxClass > 0 && ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
||||||
const thisRange = ship.hardpoints[i].m.getRange();
|
const thisRange = ship.hardpoints[i].m.getRange();
|
||||||
if (thisRange > maxRange) {
|
if (thisRange > maxRange) {
|
||||||
maxRange = thisRange;
|
maxRange = thisRange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,14 +185,15 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the weapon names for this ship
|
* Obtain the weapon names for this ship
|
||||||
* @param {Object} ship The ship
|
* @param {Object} ship The ship
|
||||||
* @return {array} The weapon names
|
* @param {Object} context The context
|
||||||
|
* @return {array} The weapon names
|
||||||
*/
|
*/
|
||||||
_weaponNames(ship, context) {
|
_weaponNames(ship, context) {
|
||||||
const translate = context.language.translate
|
const translate = context.language.translate;
|
||||||
let names = [];
|
let names = [];
|
||||||
let num = 1;
|
let num = 1;
|
||||||
for (let i =0; i < ship.hardpoints.length; i++) {
|
for (let i = 0; i < ship.hardpoints.length; i++) {
|
||||||
if (ship.hardpoints[i].maxClass > 0 && ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
if (ship.hardpoints[i].maxClass > 0 && ship.hardpoints[i].m && ship.hardpoints[i].enabled) {
|
||||||
const m = ship.hardpoints[i].m;
|
const m = ship.hardpoints[i].m;
|
||||||
let name = '' + num++ + ': ' + m.class + m.rating + (m.missile ? '/' + m.missile : '') + ' ' + translate(m.name || m.grp);
|
let name = '' + num++ + ': ' + m.class + m.rating + (m.missile ? '/' + m.missile : '') + ' ' + translate(m.name || m.grp);
|
||||||
@@ -201,15 +207,24 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
if (engineering) {
|
if (engineering) {
|
||||||
name = name + ' (' + engineering + ')';
|
name = name + ' (' + engineering + ')';
|
||||||
}
|
}
|
||||||
names.push(name)
|
names.push(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate a specific weapon DPS for this ship against another ship at a given range
|
||||||
|
* @param {Object} context The context
|
||||||
|
* @param {Object} m The weapon
|
||||||
|
* @param {Object} against The target
|
||||||
|
* @param {bool} hull true if to calculate against hull, false if to calculate against shields
|
||||||
|
* @param {Object} range The engagement range
|
||||||
|
* @return {number} The weapon DPS
|
||||||
|
*/
|
||||||
_calcWeaponDps(context, m, against, hull, range) {
|
_calcWeaponDps(context, m, against, hull, range) {
|
||||||
const translate = context.language.translate
|
const translate = context.language.translate;
|
||||||
let dropoff = 1;
|
let dropoff = 1;
|
||||||
if (m.getFalloff()) {
|
if (m.getFalloff()) {
|
||||||
// Calculate the dropoff % due to range
|
// Calculate the dropoff % due to range
|
||||||
@@ -315,7 +330,7 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
const effectiveSDpsShields = (m.getClip() ? (m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload()) * effectivenessShields : effectiveDpsShields);
|
const effectiveSDpsShields = (m.getClip() ? (m.getClip() * m.getDps() / m.getRoF()) / ((m.getClip() / m.getRoF()) + m.getReload()) * effectivenessShields : effectiveDpsShields);
|
||||||
|
|
||||||
// Alter effectiveness as per standard hull
|
// Alter effectiveness as per standard hull
|
||||||
const bulkheads = new Module({template: against.bulkheads});
|
const bulkheads = new Module({ template: against.bulkheads });
|
||||||
let effectivenessHull = 0;
|
let effectivenessHull = 0;
|
||||||
if (m.getDamageDist().E) {
|
if (m.getDamageDist().E) {
|
||||||
effectivenessHull += m.getDamageDist().E * (1 - bulkheads.getExplosiveResistance());
|
effectivenessHull += m.getDamageDist().E * (1 - bulkheads.getExplosiveResistance());
|
||||||
@@ -473,19 +488,19 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
render() {
|
render() {
|
||||||
const { language, onWindowResize, sizeRatio, tooltip, termtip } = this.context;
|
const { language, onWindowResize, sizeRatio, tooltip, termtip } = this.context;
|
||||||
const { formats, translate, units } = language;
|
const { formats, translate, units } = language;
|
||||||
const { expanded, maxRange, range, totals } = this.state;
|
const { against, expanded, maxRange, range, totals } = this.state;
|
||||||
const { ship } = this.props;
|
const { ship } = this.props;
|
||||||
|
|
||||||
const sortOrder = this._sortOrder;
|
const sortOrder = this._sortOrder;
|
||||||
const onCollapseExpand = this._onCollapseExpand;
|
const onCollapseExpand = this._onCollapseExpand;
|
||||||
|
|
||||||
const hStr = ship.getHardpointsString() + '.' + ship.getModificationsString();
|
const code = ship.getHardpointsString() + '.' + ship.getModificationsString() + '.' + against.properties.name;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
<h1>{translate('damage dealt to')} {expanded ? <span onClick={onCollapseExpand}><CollapseSection className='summary'/></span> : <span onClick={onCollapseExpand}><ExpandSection className='summary'/></span>}</h1>
|
<h1>{translate('damage dealt to')} {expanded ? <span onClick={onCollapseExpand}><CollapseSection className='summary'/></span> : <span onClick={onCollapseExpand}><ExpandSection className='summary'/></span>}</h1>
|
||||||
{expanded ? <span>
|
{expanded ? <span>
|
||||||
<ShipSelector initial={this.state.against} currentMenu={this.props.currentMenu} onChange={this._onShipChange} />
|
<ShipSelector initial={against} currentMenu={this.props.currentMenu} onChange={this._onShipChange} />
|
||||||
<table className='summary' style={{ width: '100%' }}>
|
<table className='summary' style={{ width: '100%' }}>
|
||||||
<thead>
|
<thead>
|
||||||
<tr className='main'>
|
<tr className='main'>
|
||||||
@@ -551,7 +566,7 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
colors={DAMAGE_DEALT_COLORS}
|
colors={DAMAGE_DEALT_COLORS}
|
||||||
func={this.state.calcShieldsDpsFunc}
|
func={this.state.calcShieldsDpsFunc}
|
||||||
points={200}
|
points={200}
|
||||||
code={hStr}
|
code={code}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className='group half'>
|
<div className='group half'>
|
||||||
@@ -567,7 +582,7 @@ export default class DamageDealt extends TranslatedComponent {
|
|||||||
colors={DAMAGE_DEALT_COLORS}
|
colors={DAMAGE_DEALT_COLORS}
|
||||||
func={this.state.calcHullDpsFunc}
|
func={this.state.calcHullDpsFunc}
|
||||||
points={200}
|
points={200}
|
||||||
code={hStr}
|
code={code}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</span> : null }
|
</span> : null }
|
||||||
|
|||||||
@@ -43,14 +43,12 @@ export default class LineChart extends TranslatedComponent {
|
|||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this._updateDimensions = this._updateDimensions.bind(this);
|
this._updateDimensions = this._updateDimensions.bind(this);
|
||||||
this._updateSeriesData = this._updateSeriesData.bind(this);
|
|
||||||
this._updateSeries = this._updateSeries.bind(this);
|
this._updateSeries = this._updateSeries.bind(this);
|
||||||
this._tooltip = this._tooltip.bind(this);
|
this._tooltip = this._tooltip.bind(this);
|
||||||
this._showTip = this._showTip.bind(this);
|
this._showTip = this._showTip.bind(this);
|
||||||
this._hideTip = this._hideTip.bind(this);
|
this._hideTip = this._hideTip.bind(this);
|
||||||
this._moveTip = this._moveTip.bind(this);
|
this._moveTip = this._moveTip.bind(this);
|
||||||
|
|
||||||
//const data = _updateSeries(this.props);
|
|
||||||
const series = props.series;
|
const series = props.series;
|
||||||
|
|
||||||
let xScale = d3.scaleLinear();
|
let xScale = d3.scaleLinear();
|
||||||
@@ -64,9 +62,6 @@ export default class LineChart extends TranslatedComponent {
|
|||||||
xScale,
|
xScale,
|
||||||
xAxisScale,
|
xAxisScale,
|
||||||
yScale,
|
yScale,
|
||||||
//seriesLines: data.seriesLines,
|
|
||||||
//detailElems: data.detailElems,
|
|
||||||
//markerElems: data.markerElems,
|
|
||||||
tipHeight: 2 + (1.2 * (series ? series.length : 0.8))
|
tipHeight: 2 + (1.2 * (series ? series.length : 0.8))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -161,7 +156,8 @@ export default class LineChart extends TranslatedComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update series generated from props
|
* Update series generated from props
|
||||||
* @param {Object} props React Component properties
|
* @param {Object} props React Component properties
|
||||||
|
* @param {Object} state React Component state
|
||||||
*/
|
*/
|
||||||
_updateSeries(props, state) {
|
_updateSeries(props, state) {
|
||||||
let { func, xMin, xMax, series, points } = props;
|
let { func, xMin, xMax, series, points } = props;
|
||||||
@@ -192,31 +188,6 @@ export default class LineChart extends TranslatedComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ markerElems, detailElems, seriesLines, seriesData });
|
this.setState({ markerElems, detailElems, seriesLines, seriesData });
|
||||||
return { seriesData };
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update series and data generated from props
|
|
||||||
* @param {Object} props React Component properties
|
|
||||||
*/
|
|
||||||
_updateSeriesData(props) {
|
|
||||||
let { func, xMin, xMax, series, points } = props;
|
|
||||||
let delta = (xMax - xMin) / points;
|
|
||||||
let seriesData = new Array(points);
|
|
||||||
|
|
||||||
if (delta) {
|
|
||||||
seriesData = new Array(points);
|
|
||||||
for (let i = 0, x = xMin; i < points; i++) {
|
|
||||||
seriesData[i] = [x, func(x)];
|
|
||||||
x += delta;
|
|
||||||
}
|
|
||||||
seriesData[points - 1] = [xMax, func(xMax)];
|
|
||||||
} else {
|
|
||||||
let yVal = func(xMin);
|
|
||||||
seriesData = [[0, yVal], [1, yVal]];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({ seriesData });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -243,11 +214,8 @@ export default class LineChart extends TranslatedComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (props.code != nextProps.code) {
|
if (props.code != nextProps.code) {
|
||||||
console.log('Code changed');
|
|
||||||
}
|
|
||||||
// if (domainChanged) {
|
|
||||||
this._updateSeries(nextProps, this.state);
|
this._updateSeries(nextProps, this.state);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export function getLanguage(langCode) {
|
|||||||
let currentTerms = lang.terms;
|
let currentTerms = lang.terms;
|
||||||
let d3Locale = d3.formatLocale(lang.formats);
|
let d3Locale = d3.formatLocale(lang.formats);
|
||||||
let gen = d3Locale.format('');
|
let gen = d3Locale.format('');
|
||||||
const round = function(x, n) { var ten_n = Math.pow(10,n); return Math.round(x * ten_n) / ten_n; }
|
const round = function(x, n) { const ten_n = Math.pow(10,n); return Math.round(x * ten_n) / ten_n; };
|
||||||
|
|
||||||
if(lang === EN) {
|
if(lang === EN) {
|
||||||
translate = (t, x) => { return currentTerms[t + '_' + x] || currentTerms[t] || t; };
|
translate = (t, x) => { return currentTerms[t + '_' + x] || currentTerms[t] || t; };
|
||||||
|
|||||||
Reference in New Issue
Block a user