|
@@ -281,7 +281,7 @@ function renderProduction(expertiseGroups: Record<string, string[]>, production:
|
|
|
let totalConsumablesCost = 0;
|
|
let totalConsumablesCost = 0;
|
|
|
for (const [expertise, productionBuildings] of Object.entries(expertiseGroups)) {
|
|
for (const [expertise, productionBuildings] of Object.entries(expertiseGroups)) {
|
|
|
section.append(element('h3', {textContent: expertise.toLocaleLowerCase()}));
|
|
section.append(element('h3', {textContent: expertise.toLocaleLowerCase()}));
|
|
|
- const shipTo: Record<string, Record<string, number>> = {};
|
|
|
|
|
|
|
+ const exportTo: Record<string, Record<string, number>> = {};
|
|
|
for (const building of productionBuildings) {
|
|
for (const building of productionBuildings) {
|
|
|
const buildingRow = element('div', {className: 'building-row'});
|
|
const buildingRow = element('div', {className: 'building-row'});
|
|
|
const mats = Object.entries(production[building]);
|
|
const mats = Object.entries(production[building]);
|
|
@@ -289,7 +289,7 @@ function renderProduction(expertiseGroups: Record<string, string[]>, production:
|
|
|
for (const [mat, amount] of mats) {
|
|
for (const [mat, amount] of mats) {
|
|
|
buildingRow.append(document.createTextNode(' '));
|
|
buildingRow.append(document.createTextNode(' '));
|
|
|
buildingRow.append(renderProductionBuildingMat(expertise, mat, amount, storage,
|
|
buildingRow.append(renderProductionBuildingMat(expertise, mat, amount, storage,
|
|
|
- matInputs, matConsumers, shipTo));
|
|
|
|
|
|
|
+ matInputs, matConsumers, exportTo));
|
|
|
|
|
|
|
|
const recipe = recipes[mat];
|
|
const recipe = recipes[mat];
|
|
|
const outputPerRun = recipe.outputs.find((o) => o.material_ticker === mat)!.material_amount;
|
|
const outputPerRun = recipe.outputs.find((o) => o.material_ticker === mat)!.material_amount;
|
|
@@ -303,14 +303,14 @@ function renderProduction(expertiseGroups: Record<string, string[]>, production:
|
|
|
section.append(buildingRow);
|
|
section.append(buildingRow);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const shipToDetails = element('details');
|
|
|
|
|
- shipToDetails.append(element('summary', {textContent: 'ship to'}));
|
|
|
|
|
- for (const [expertise, mats] of Object.entries(shipTo)) {
|
|
|
|
|
- const shipToRow = element('div', {textContent: expertise.toLocaleLowerCase() + ': '});
|
|
|
|
|
- shipToRow.textContent += Object.entries(mats).map(([mat, amount]) => `${amount}x${mat}`).join(' ');
|
|
|
|
|
- shipToDetails.append(shipToRow);
|
|
|
|
|
|
|
+ const exportDetails = element('details');
|
|
|
|
|
+ exportDetails.append(element('summary', {textContent: 'exports'}));
|
|
|
|
|
+ for (const [expertise, mats] of Object.entries(exportTo)) {
|
|
|
|
|
+ const exportToRow = element('div', {textContent: expertise.toLocaleLowerCase() + ': '});
|
|
|
|
|
+ exportToRow.textContent += Object.entries(mats).map(([mat, amount]) => `${amount}x${mat}`).join(' ');
|
|
|
|
|
+ exportDetails.append(exportToRow);
|
|
|
}
|
|
}
|
|
|
- section.append(shipToDetails);
|
|
|
|
|
|
|
+ section.append(exportDetails);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
section.append(element('h4', {textContent: `total consumables cost: ${formatWhole(totalConsumablesCost)}/day,
|
|
section.append(element('h4', {textContent: `total consumables cost: ${formatWhole(totalConsumablesCost)}/day,
|
|
@@ -321,7 +321,7 @@ function renderProduction(expertiseGroups: Record<string, string[]>, production:
|
|
|
function renderProductionBuildingMat(expertise: string, mat: string, amount: number, storage: Record<string, number>,
|
|
function renderProductionBuildingMat(expertise: string, mat: string, amount: number, storage: Record<string, number>,
|
|
|
matInputs: Record<string, {upstreamMat: string, amount: number}[]>,
|
|
matInputs: Record<string, {upstreamMat: string, amount: number}[]>,
|
|
|
matConsumers: Record<string, {downstreamMat: string, expertise: string, amount: number}[]>,
|
|
matConsumers: Record<string, {downstreamMat: string, expertise: string, amount: number}[]>,
|
|
|
- shipTo: Record<string, Record<string, number>>): HTMLElement {
|
|
|
|
|
|
|
+ exportTo: Record<string, Record<string, number>>): HTMLElement {
|
|
|
const inStorage = storage[mat] ?? 0;
|
|
const inStorage = storage[mat] ?? 0;
|
|
|
const wrapper = element('span');
|
|
const wrapper = element('span');
|
|
|
|
|
|
|
@@ -353,9 +353,9 @@ function renderProductionBuildingMat(expertise: string, mat: string, amount: num
|
|
|
for (const consumer of consumers) {
|
|
for (const consumer of consumers) {
|
|
|
if (consumer.expertise == expertise) // we aren't shipping it anywhere
|
|
if (consumer.expertise == expertise) // we aren't shipping it anywhere
|
|
|
continue;
|
|
continue;
|
|
|
- if (!shipTo[consumer.expertise])
|
|
|
|
|
- shipTo[consumer.expertise] = {};
|
|
|
|
|
- shipTo[consumer.expertise][mat] = (shipTo[consumer.expertise][mat] ?? 0) + consumer.amount;
|
|
|
|
|
|
|
+ if (!exportTo[consumer.expertise])
|
|
|
|
|
+ exportTo[consumer.expertise] = {};
|
|
|
|
|
+ exportTo[consumer.expertise][mat] = (exportTo[consumer.expertise][mat] ?? 0) + consumer.amount;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
amountText.dataset.tooltip = tooltip;
|
|
amountText.dataset.tooltip = tooltip;
|