|
@@ -54,8 +54,6 @@ let opexMetric: MetricType = (localStorage.getItem('roi-opex-metric') as MetricT
|
|
|
let revenueMetric: MetricType = (localStorage.getItem('roi-revenue-metric') as MetricType) || 'vwap';
|
|
let revenueMetric: MetricType = (localStorage.getItem('roi-revenue-metric') as MetricType) || 'vwap';
|
|
|
let includeShips: boolean = localStorage.getItem('roi-include-ships') === 'true';
|
|
let includeShips: boolean = localStorage.getItem('roi-include-ships') === 'true';
|
|
|
let workingCapitalDays: number = parseInt(localStorage.getItem('roi-working-capital') || '3', 10);
|
|
let workingCapitalDays: number = parseInt(localStorage.getItem('roi-working-capital') || '3', 10);
|
|
|
-
|
|
|
|
|
-// EXTREME DETAIL: Track the state of the Target Permit. Defaults to 2 (the standard starting permits in PRUN).
|
|
|
|
|
let targetPermit: number = parseInt(localStorage.getItem('roi-target-permit') || '2', 10);
|
|
let targetPermit: number = parseInt(localStorage.getItem('roi-target-permit') || '2', 10);
|
|
|
|
|
|
|
|
async function render() {
|
|
async function render() {
|
|
@@ -70,7 +68,8 @@ async function render() {
|
|
|
if (!metricControlsInitialized) {
|
|
if (!metricControlsInitialized) {
|
|
|
const controls = document.createElement('div');
|
|
const controls = document.createElement('div');
|
|
|
controls.style.marginBottom = '15px';
|
|
controls.style.marginBottom = '15px';
|
|
|
- // EXTREME DETAIL: Injected the new `<input type="number">` for Target Permit.
|
|
|
|
|
|
|
+ // EXTREME DETAIL: Re-arranged the `<label>` blocks so the descriptive text precedes the input boxes,
|
|
|
|
|
+ // and updated "Target Permit" to "Permit Number" per the user's specification.
|
|
|
controls.innerHTML = `
|
|
controls.innerHTML = `
|
|
|
<label style="margin-right: 15px;">CapEx Price:
|
|
<label style="margin-right: 15px;">CapEx Price:
|
|
|
<select id="capex-metric"><option value="vwap">VWAP</option><option value="bid">Bid</option><option value="ask">Ask</option></select>
|
|
<select id="capex-metric"><option value="vwap">VWAP</option><option value="bid">Bid</option><option value="ask">Ask</option></select>
|
|
@@ -85,10 +84,10 @@ async function render() {
|
|
|
<input type="checkbox" id="include-ships"> Include Ship CapEx
|
|
<input type="checkbox" id="include-ships"> Include Ship CapEx
|
|
|
</label>
|
|
</label>
|
|
|
<label style="margin-right: 15px;">
|
|
<label style="margin-right: 15px;">
|
|
|
- <input type="number" id="working-capital" min="0" step="1" style="width: 50px;"> Days OpEx
|
|
|
|
|
|
|
+ Days OpEx: <input type="number" id="working-capital" min="0" step="1" style="width: 50px;">
|
|
|
</label>
|
|
</label>
|
|
|
<label>
|
|
<label>
|
|
|
- <input type="number" id="target-permit" min="1" step="1" style="width: 50px;"> Target Permit
|
|
|
|
|
|
|
+ Permit Number: <input type="number" id="target-permit" min="1" step="1" style="width: 50px;">
|
|
|
</label>
|
|
</label>
|
|
|
`;
|
|
`;
|
|
|
const table = document.querySelector('table');
|
|
const table = document.querySelector('table');
|
|
@@ -214,9 +213,6 @@ async function render() {
|
|
|
|
|
|
|
|
let capex_val = (p.capex[capexMetric] / bases) + (opex_val * workingCapitalDays);
|
|
let capex_val = (p.capex[capexMetric] / bases) + (opex_val * workingCapitalDays);
|
|
|
|
|
|
|
|
- // EXTREME DETAIL: We intercept the HQ permit cost here.
|
|
|
|
|
- // Permits 1 & 2 are free. To unlock permit 3, you must upgrade HQ to Level 2.
|
|
|
|
|
- // We map the user input directly to the JSON string keys retrieved from GitHub.
|
|
|
|
|
let hq_capex = 0;
|
|
let hq_capex = 0;
|
|
|
if (targetPermit >= 3) {
|
|
if (targetPermit >= 3) {
|
|
|
const hqLevelStr = (targetPermit - 1).toString();
|
|
const hqLevelStr = (targetPermit - 1).toString();
|
|
@@ -279,7 +275,6 @@ async function render() {
|
|
|
capexCell.dataset.tooltip = `Base Construction: ${formatSigFig(p.capex[capexMetric] / (p.area / 500))}`;
|
|
capexCell.dataset.tooltip = `Base Construction: ${formatSigFig(p.capex[capexMetric] / (p.area / 500))}`;
|
|
|
capexCell.dataset.tooltip += `\nWorking Capital (${workingCapitalDays} days): ${formatSigFig(p.opex_val * workingCapitalDays)}`;
|
|
capexCell.dataset.tooltip += `\nWorking Capital (${workingCapitalDays} days): ${formatSigFig(p.opex_val * workingCapitalDays)}`;
|
|
|
|
|
|
|
|
- // EXTREME DETAIL: Dynamically inject the HQ cost into the tooltip if the user requested Permit 3 or higher.
|
|
|
|
|
if (p.hq_capex > 0) {
|
|
if (p.hq_capex > 0) {
|
|
|
capexCell.dataset.tooltip += `\nHQ Upgrade (Permit ${targetPermit}): ${formatSigFig(p.hq_capex)}`;
|
|
capexCell.dataset.tooltip += `\nHQ Upgrade (Permit ${targetPermit}): ${formatSigFig(p.hq_capex)}`;
|
|
|
}
|
|
}
|
|
@@ -356,7 +351,7 @@ interface Profit {
|
|
|
average_traded_7d: number
|
|
average_traded_7d: number
|
|
|
market_capacity_base: number
|
|
market_capacity_base: number
|
|
|
ship_capex_per_base: number
|
|
ship_capex_per_base: number
|
|
|
- hq_costs: Record<string, Metrics> // Added typing for the precalculated HQ pricing dictionary
|
|
|
|
|
|
|
+ hq_costs: Record<string, Metrics>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
interface ProfitWithMetrics extends Profit {
|
|
interface ProfitWithMetrics extends Profit {
|
|
@@ -366,7 +361,7 @@ interface ProfitWithMetrics extends Profit {
|
|
|
profit_per_day: number;
|
|
profit_per_day: number;
|
|
|
profit_per_base: number;
|
|
profit_per_base: number;
|
|
|
break_even: number;
|
|
break_even: number;
|
|
|
- hq_capex: number; // Added to interface to pass to the tooltip generator
|
|
|
|
|
|
|
+ hq_capex: number;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
interface MatPrice {
|
|
interface MatPrice {
|