|
@@ -81,7 +81,7 @@ async function render() {
|
|
|
main.append(
|
|
main.append(
|
|
|
renderAnalysis(analysisNodes),
|
|
renderAnalysis(analysisNodes),
|
|
|
element('p', {textContent: `total cost: ${formatWhole(cost)}`}),
|
|
element('p', {textContent: `total cost: ${formatWhole(cost)}`}),
|
|
|
- renderProduction(expertiseGroups, production, prices),
|
|
|
|
|
|
|
+ renderProduction(expertiseGroups, production, prices, recipes),
|
|
|
renderBuyMaterials(buy),
|
|
renderBuyMaterials(buy),
|
|
|
renderShipbuilders(requiredMats, knownCompanies, companyProductionById),
|
|
renderShipbuilders(requiredMats, knownCompanies, companyProductionById),
|
|
|
);
|
|
);
|
|
@@ -234,16 +234,16 @@ function renderAnalysisNode(node: AnalysisNode, level = 0): HTMLElement {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function renderProduction(expertiseGroups: Record<string, string[]>, production: Production,
|
|
function renderProduction(expertiseGroups: Record<string, string[]>, production: Production,
|
|
|
- prices: Record<string, RawPrice>): HTMLElement {
|
|
|
|
|
|
|
+ prices: Record<string, RawPrice>, recipes: Record<string, Recipe>): HTMLElement {
|
|
|
const section = element('section');
|
|
const section = element('section');
|
|
|
section.append(element('h2', {textContent: 'production'}));
|
|
section.append(element('h2', {textContent: 'production'}));
|
|
|
|
|
|
|
|
for (const [expertise, buildings] of Object.entries(expertiseGroups)) {
|
|
for (const [expertise, buildings] of Object.entries(expertiseGroups)) {
|
|
|
section.append(element('h3', {textContent: expertise}));
|
|
section.append(element('h3', {textContent: expertise}));
|
|
|
for (const building of buildings) {
|
|
for (const building of buildings) {
|
|
|
- const buildingRow = element('div', {className: 'building-row', textContent: building});
|
|
|
|
|
const buildingMats = element('div');
|
|
const buildingMats = element('div');
|
|
|
const mats = Object.entries(production[building]);
|
|
const mats = Object.entries(production[building]);
|
|
|
|
|
+ let buildingMins = 0;
|
|
|
for (const [index, [mat, amount]] of mats.entries()) {
|
|
for (const [index, [mat, amount]] of mats.entries()) {
|
|
|
const traded = prices[mat]?.AverageTraded30D ?? 0;
|
|
const traded = prices[mat]?.AverageTraded30D ?? 0;
|
|
|
const span = element('span', {
|
|
const span = element('span', {
|
|
@@ -253,7 +253,13 @@ function renderProduction(expertiseGroups: Record<string, string[]>, production:
|
|
|
buildingMats.append(span);
|
|
buildingMats.append(span);
|
|
|
if (index < mats.length - 1)
|
|
if (index < mats.length - 1)
|
|
|
buildingMats.append(document.createTextNode(' '));
|
|
buildingMats.append(document.createTextNode(' '));
|
|
|
|
|
+
|
|
|
|
|
+ const recipe = recipes[mat];
|
|
|
|
|
+ const outputPerRun = recipe.outputs.find((o) => o.material_ticker === mat)!.material_amount;
|
|
|
|
|
+ buildingMins += amount / outputPerRun * (recipe.time_ms / 1000 / 60);
|
|
|
}
|
|
}
|
|
|
|
|
+ const numBuildings = buildingMins / (24*60) / 5 / 1.605; // one ship every 5 days, 160.5% efficiency
|
|
|
|
|
+ const buildingRow = element('div', {className: 'building-row', textContent: `${formatFixed(numBuildings, 1)}x${building}`});
|
|
|
buildingRow.append(buildingMats);
|
|
buildingRow.append(buildingMats);
|
|
|
section.append(buildingRow);
|
|
section.append(buildingRow);
|
|
|
}
|
|
}
|