diff --git a/src/endWeek/economics/corporationDevelopments.js b/src/endWeek/economics/corporationDevelopments.js index 032dc0d1072bbd60d2a4d530c55db75baedf2d1f..7cc9155f77bd05d49c014f2e6a941a758e8f98f5 100644 --- a/src/endWeek/economics/corporationDevelopments.js +++ b/src/endWeek/economics/corporationDevelopments.js @@ -1,6 +1,6 @@ App.EndWeek.corporationDevelopments = function() { const el = document.createElement("p"); - let r = []; + let r; /* Main Corporation Pass*/ if (App.Corporate.cash < 0) { @@ -13,27 +13,32 @@ App.EndWeek.corporationDevelopments = function() { for (const i in _weekLedger.divisionLedgers) { const _d = _weekLedger.divisionLedgers[i]; const _div = _d.division; - const r = []; + let r; /* Reporting on number of slaves being processed or completed processing */ - r.push(`${_div.name}: The division ${_div.message_endWeek_Slaves(_d)}`); + App.Events.addNode(el, [`${_div.name}: The division ${_div.message_endWeek_Slaves(_d)}`], "div"); + + r = []; if (_d.market.originalBuy != null) { if (_d.market.buy === 0) { - r.push(App.UI.DOM.makeElement("div", `It couldn't purchase ${numberWithPlural(_d.market.originalBuy, "slave")} to replenish its stock from the market because it couldn't afford to purchase price.`)); + r.push(`It couldn't purchase ${numberWithPlural(_d.market.originalBuy, "slave")} to replenish its stock from the market because it couldn't afford to purchase price.`); } else { - r.push(App.UI.DOM.makeElement("div", `It needed to replenish its slave stock of ${numberWithPlural(_d.market.originalBuy, "slave")}, but couldn't afford to buy all of them. It bought ${numberWithPlural(_d.market.buy, _div.nounSlaveFromMarket)} for ${cashFormatColor(_d.market.finalPurchase, true)}.`)); + r.push(`It needed to replenish its slave stock of ${numberWithPlural(_d.market.originalBuy, "slave")}, but couldn't afford to buy all of them. It bought ${numberWithPlural(_d.market.buy, _div.nounSlaveFromMarket)} for ${cashFormatColor(_d.market.finalPurchase, true)}.`); } } else if (_d.market.buy > 0) { - r.push(App.UI.DOM.makeElement("div", `It replenished its slave stock and bought ${numberWithPlural(_d.market.buy, _div.nounSlaveFromMarket)} from the market for ${cashFormatColor(_d.market.finalPurchase, true)}.`)); + r.push(`It replenished its slave stock and bought ${numberWithPlural(_d.market.buy, _div.nounSlaveFromMarket)} from the market for ${cashFormatColor(_d.market.finalPurchase, true)}.`); } + App.Events.addNode(el, r, "div"); + if (_d.transfer.total > 0) { for (const i in _d.transfer.divisions) { const _nextDivLedger = _d.transfer.divisions[i]; const _nextDiv = _nextDivLedger.division; const _slavesToNext = _nextDivLedger.fill; - r.push(`It moved ${numberWithPlural(_slavesToNext, "slave")} to the ${_nextDiv.name} Division.`); + App.Events.addNode(el, [`It moved ${numberWithPlural(_slavesToNext, "slave")} to the ${_nextDiv.name} Division.`], "div"); } } if (_div.toMarket) { + r = []; if (_div.heldSlaves === 0) { if (_d.market.sell > 0) { r.push(`It immediately sold ${numberWithPlural(_d.market.sell, _div.nounFinishedSlave)} to the market and made ${cashFormatColor(_d.market.finalSale)}.`); @@ -46,13 +51,12 @@ App.EndWeek.corporationDevelopments = function() { r.push(`week.`); } } + App.Events.addNode(el, r, "div"); } if (_d.revenue.value > 0) { - r.push(`It earned ${cashFormatColor(_d.revenue.value)} in revenue.`); + App.Events.addNode(el, [`It earned ${cashFormatColor(_d.revenue.value)} in revenue.`], "div"); } - App.Events.addNode(el, r, "div"); } - App.Events.addNode(el, r); /* Aggregate Corporation Results*/ el.append(App.Corporate.writeLedger(App.Corporate.ledger.current, V.week));