Jelajahi Sumber

Hybrid API Automated Update

Thomas Knott 2 minggu lalu
induk
melakukan
a1aa1e2c06
1 mengubah file dengan 6 tambahan dan 11 penghapusan
  1. 6 11
      ts/roi.ts

+ 6 - 11
ts/roi.ts

@@ -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 includeShips: boolean = localStorage.getItem('roi-include-ships') === 'true';
 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);
 
 async function render() {
@@ -70,7 +68,8 @@ async function render() {
 	if (!metricControlsInitialized) {
 		const controls = document.createElement('div');
 		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 = `
 			<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>
@@ -85,10 +84,10 @@ async function render() {
 				<input type="checkbox" id="include-ships"> Include Ship CapEx
 			</label>
 			<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>
-				<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>
 		`;
 		const table = document.querySelector('table');
@@ -214,9 +213,6 @@ async function render() {
 		
 		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;
 		if (targetPermit >= 3) {
 			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 += `\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) {
 			capexCell.dataset.tooltip += `\nHQ Upgrade (Permit ${targetPermit}): ${formatSigFig(p.hq_capex)}`;
 		}
@@ -356,7 +351,7 @@ interface Profit {
 	average_traded_7d: number
 	market_capacity_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 {
@@ -366,7 +361,7 @@ interface ProfitWithMetrics extends Profit {
 	profit_per_day: number;
 	profit_per_base: number;
 	break_even: number;
-	hq_capex: number; // Added to interface to pass to the tooltip generator
+	hq_capex: number;
 }
 
 interface MatPrice {