diff --git a/src/markets/bulkSlave/bulkSlaveIntro.js b/src/markets/bulkSlave/bulkSlaveIntro.js index 8d51643695af150c90c1c8eedf28d89a09404344..3409530dfdeff8b80272c0931922adae0beb2d14 100644 --- a/src/markets/bulkSlave/bulkSlaveIntro.js +++ b/src/markets/bulkSlave/bulkSlaveIntro.js @@ -4,7 +4,6 @@ App.Markets.bulkSlaveIntro = function() { const discount = getDiscount(); let seed; let p; - let spent = 0; if (V.market.newSlaves.length === 0) { bulkSlaveGenerate(); @@ -46,7 +45,7 @@ App.Markets.bulkSlaveIntro = function() { } else { r.push(`With all your discounts factored in you got a <span class="yellowgreen">${(500 - discount) / 5}%</span> discount;`); } - r.push(`You spent <span class="yellowgreen">${cashFormat(spent)}</span> on your new slaves.`); + r.push(`You spent`, App.UI.DOM.cashFormat(V.market.totalCost), `on your new slaves.`); break; case "inStock": r.push(`You clear out ${App.Markets.marketName(V.market.slaveMarket, V.market.numArcology)} of its stock of ${V.market.newSlaves.length} slaves.`); @@ -57,7 +56,7 @@ App.Markets.bulkSlaveIntro = function() { } else { r.push(`With all your discounts factored in you got a <span class="yellowgreen">${(500 - discount) / 5}%</span> discount`); } - r.push(`You spent <span class="yellowgreen">${cashFormat(spent)}</span> on your new slaves.`); + r.push(`You spent`, App.UI.DOM.cashFormat(V.market.totalCost), `on your new slaves.`); break; case "liquidator": r.push(`Your new pair of slaves look frightened and uncertain, but seem encouraged by each other's presence.`); @@ -160,7 +159,7 @@ App.Markets.bulkSlaveIntro = function() { } else { cashX(forceNeg(_slaveCost), "slaveTransfer", slave); V.market.newSlaves.push(slave); - spent += _slaveCost; + V.market.totalCost += _slaveCost; } } diff --git a/src/markets/marketUI.js b/src/markets/marketUI.js index f3c0b1a7e1a7a42948d96910a1fc4720588c15af..62a8a55c97112dfde15aa925e6f3256337e37522 100644 --- a/src/markets/marketUI.js +++ b/src/markets/marketUI.js @@ -81,6 +81,7 @@ App.Markets.purchaseFramework = function(slaveMarket, {sTitleSingular = "slave", title.buyAndKeepShopping, () => { cashX(forceNeg(cost), "slaveTransfer", slave); + V.market.totalCost += cost; V.market.newSlaves.push(slave); V.market.introType = "multi"; student(); @@ -99,6 +100,7 @@ App.Markets.purchaseFramework = function(slaveMarket, {sTitleSingular = "slave", title.buyJustHer, () => { cashX(forceNeg(cost), "slaveTransfer", slave); + V.market.totalCost += cost; V.market.newSlaves.push(slave); V.nextButton = "Continue"; V.returnTo = "Main"; @@ -116,6 +118,7 @@ App.Markets.purchaseFramework = function(slaveMarket, {sTitleSingular = "slave", () => { student(); cashX(forceNeg(cost), "slaveTransfer", slave); + V.market.totalCost += cost; V.market.newSlaves.push(slave); }, [], @@ -157,6 +160,7 @@ App.Markets.purchaseFramework = function(slaveMarket, {sTitleSingular = "slave", * @property {number} newSlavesDone * @property {number} numSlaves * @property {number} numArcology + * @property {number} totalCost */ /** @this {marketGlobal} */ @@ -169,6 +173,7 @@ App.Markets.GlobalVariable = function() { this.newSlavesDone = 0; this.numSlaves = 0; this.numArcology = 0; + this.totalCost = 0; return this; };