diff --git a/src/budget/budget.js b/src/budget/budget.js index d6a1c43d2383654f477a4edf00032b849ce09402..0439e8e0cc63bb811344b19943fa70a3fde2d94f 100644 --- a/src/budget/budget.js +++ b/src/budget/budget.js @@ -8,6 +8,12 @@ App.Budget.table = function(budgetType) { const income = (budgetType === "cash") ? "lastWeeksCashIncome" : "lastWeeksRepIncome"; const expenses = (budgetType === "cash") ? "lastWeeksCashExpenses" : "lastWeeksRepExpenses"; + // Make the total 0 first, otherwise it gets counted as part of the new total + V[income].Total = 0; + V[income].Total = hashSum(V[income]); + V[expenses].Total = 0; + V[expenses].Total = hashSum(V[expenses]); + const tableDiv = document.createElement("div"); tableDiv.classList.add("budget"); @@ -382,21 +388,17 @@ App.Budget.table = function(budgetType) { App.UI.DOM.appendNewElement("div", tableDiv, "Tracked totals"); - // Make the total 0 first, otherwise it gets counted as part of the new total - V[income].Total = 0; - V[income].Total = hashSum(V[income]); - App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(Math.trunc(V[income].Total)), ["number", "final-result"]); - V[expenses].Total = 0; - V[expenses].Total = hashSum(V[expenses]); - App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(Math.trunc(V[expenses].Total)), + App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(Math.trunc(V[income].Total)), ["number", + "final-result"]); + App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(Math.trunc(V[expenses].Total)), ["number", "final-result"]); - App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(Math.trunc(V[income].Total + V[expenses].Total)), + App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(Math.trunc(V[income].Total + V[expenses].Total)), ["number", "final-result"]); if (budgetType === "cash") { App.UI.DOM.appendNewElement("div", tableDiv, `Expenses budget for week ${V.week + 1}`); tableDiv.append(document.createElement("div")); - App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(-V.costs), ["number"]); + App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(-V.costs), ["number"]); tableDiv.append(document.createElement("div")); } @@ -404,16 +406,17 @@ App.Budget.table = function(budgetType) { tableDiv.append(document.createElement("div")); tableDiv.append(document.createElement("div")); if (budgetType === "cash") { - App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(V.cash - V.cashLastWeek), ["number"]); + App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(V.cash - V.cashLastWeek), ["number"]); } else { - App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(V.rep - V.repLastWeek), ["number"]); + App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(V.rep - V.repLastWeek), ["number"]); } if ( (budgetType === "cash" && (V.cash - V.cashLastWeek) === (V.lastWeeksCashIncome.Total + V.lastWeeksCashExpenses.Total)) || (budgetType === "rep" && (V.rep - V.repLastWeek) === (V.lastWeeksRepIncome.Total + V.lastWeeksRepExpenses.Total)) ) { - App.UI.DOM.appendNewElement("div", tableDiv, `The books are balanced, ${properTitle()}!`, ["green", "last-row"]); + App.UI.DOM.appendNewElement("div", tableDiv, `The books are balanced, ${properTitle()}!`, ["green", + "last-row"]); tableDiv.append(document.createElement("div")); tableDiv.append(document.createElement("div")); tableDiv.append(document.createElement("div")); @@ -422,11 +425,11 @@ App.Budget.table = function(budgetType) { tableDiv.append(document.createElement("div")); tableDiv.append(document.createElement("div")); if (budgetType === "cash") { - App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM( + App.UI.DOM.appendNewElement("div", tableDiv, formatNumber( (V.cash - V.cashLastWeek) - (V.lastWeeksCashIncome.Total + V.lastWeeksCashExpenses.Total) ), ["number"]); } else { - App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM( + App.UI.DOM.appendNewElement("div", tableDiv, formatNumber( (V.rep - V.repLastWeek) - (V.lastWeeksRepIncome.Total + V.lastWeeksRepExpenses.Total) ), ["number"]); } @@ -444,11 +447,11 @@ App.Budget.table = function(budgetType) { const r = []; if (V[income][category] || V[expenses][category] || V.showAllEntries[budgetType === "cash" ? "costsBudget" : "repBudget"]) { r.push(App.UI.DOM.appendNewElement("div", tableDiv, node, ["entry"])); - r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(V[income][category]), + r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(V[income][category]), ["number", "entry"])); - r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(-Math.abs(V[expenses][category])), + r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(-Math.abs(V[expenses][category])), ["number", "entry"])); - r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(V[income][category] + V[expenses][category]), + r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(V[income][category] + V[expenses][category]), ["number", "entry"])); } return r; @@ -463,9 +466,9 @@ App.Budget.table = function(budgetType) { const r = []; if (groupIn || groupEx || V.showAllEntries[budgetType === "cash" ? "costsBudget" : "repBudget"]) { r.push(App.UI.DOM.appendNewElement("div", tableDiv, title, ["group"])); - r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(groupIn), ["group", "number"])); - r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(groupEx), ["group", "number"])); - r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatColorDOM(groupIn + groupEx), + r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(groupIn), ["group", "number"])); + r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(groupEx), ["group", "number"])); + r.push(App.UI.DOM.appendNewElement("div", tableDiv, formatNumber(groupIn + groupEx), ["group", "number"])); } return r; @@ -504,12 +507,12 @@ App.Budget.table = function(budgetType) { } } - function formatColorDOM(num, invert = false) { + function formatNumber(num, invert = false) { if (invert) { num = -1 * num; } let span = document.createElement('span'); - span.textContent = (budgetType === "cash") ? cashFormat(num) : num; + span.append(budgetType === "cash" ? cashFormat(num) : repFormat(num, V.assistant.power < 3)); if (num === 0) { // num overwrites gray, so we don't use it here. span.classList.add("gray"); diff --git a/src/budget/repBudget.js b/src/budget/repBudget.js index f3a1be735b4c0eee337340735e5f31cb08134efb..1e1c0a01f2cbbf9e94f5b52e8ceea86668fbe33d 100644 --- a/src/budget/repBudget.js +++ b/src/budget/repBudget.js @@ -23,7 +23,13 @@ App.Budget.rep = function() { * @returns {HTMLParagraphElement} */ function intro() { - return App.UI.DOM.makeElement("p", `Reputation is a difficult thing to quantify, ${properTitle()}. Here you see an overview of topics that interest people in the arcology, and in turn, reflect on your own reputation. Much like a finance report, you can see here how your choices last week moved you closer to or further from your goals, and head any issues off before they get worse.`, "scene-intro"); + const p = document.createElement("p"); + p.classList.add("scene-intro"); + p.append(`Reputation is a difficult thing to quantify, ${properTitle()}. Here you see an overview of topics that interest people in the arcology, and in turn, reflect on your own reputation. Much like a finance report, you can see here how your choices last week moved you closer to or further from your goals, and head any issues off before they get worse.`); + if (V.assistant.power >= 3) { + p.append(" Thanks to my powerful power computer system I can track reputation changes to an unprecedented degree."); + } + return p; } /** diff --git a/src/gui/options/options.js b/src/gui/options/options.js index 690127b3c038e17a45ce4b42f6a1034a58340f66..257294540645582a22da9bd1811edc601d6ebd87 100644 --- a/src/gui/options/options.js +++ b/src/gui/options/options.js @@ -4,9 +4,6 @@ App.UI.optionsPassage = function() { V.passageSwitchHandler = App.EventHandlers.optionsChanged; el.append(intro()); - // Results - const results = App.UI.DOM.appendNewElement("div", el); - try { const tabBar = new App.UI.Tabs.TabBar("Options"); tabBar.addTab("Display", "display", App.Intro.display(false)); @@ -17,6 +14,7 @@ App.UI.optionsPassage = function() { tabBar.addTab("Cheats", "cheat", cheat()); tabBar.addTab("Cheat edit schools", "cheat-school", cheatSchools()); } + tabBar.addTab("New Game Plus", "new-game-plus", newGamePlus()); tabBar.addTab("Experimental", "experimental", experimental()); el.append(tabBar.render()); } catch (e) { @@ -28,22 +26,19 @@ App.UI.optionsPassage = function() { return el; function intro() { - let links; - let options; const el = new DocumentFragment(); - options = new App.UI.OptionsGroup(); + const options = new App.UI.OptionsGroup(); options.addOption("End of week autosaving is currently", "autosave") .addValue("Enabled", 1).on().addValue("Disabled", 0).off(); el.append(options.render()); const table = App.UI.DOM.appendNewElement("table", el); - let row; fillRow([ `You are currently playing:`, `FC version: ${App.Version.base},`, `mod version: ${App.Version.pmod},`, - `build: ${App.Version.release}${App.Version.commitHash ? `, commit: ${App.Version.commitHash}` : ``}` + `build: ${App.Version.release}${App.Version.commitHash ? `, commit: ${App.Version.commitHash}` : ``}.` ]); fillRow([ `This save was created using:`, @@ -53,13 +48,13 @@ App.UI.optionsPassage = function() { ]); function fillRow(contents) { - row = App.UI.DOM.appendNewElement("tr", table); + const row = App.UI.DOM.appendNewElement("tr", table); for (const content of contents) { App.UI.DOM.appendNewElement("td", row, content); } } - links = []; + const links = []; links.push(App.UI.DOM.passageLink("Apply Backwards Compatibility Update", "Backwards Compatibility")); links.push( @@ -107,23 +102,10 @@ App.UI.optionsPassage = function() { ); } - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(links)); + const div = App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(links), ["margin-bottom"]); + // Results + const results = App.UI.DOM.appendNewElement("div", div); - if ((V.releaseID >= 1000) || V.ver.startsWith("0.9") || V.ver.startsWith("0.8") || V.ver.startsWith("0.7") || V.ver.startsWith("0.6")) { - App.UI.DOM.appendNewElement("h3", el, `NEW GAME PLUS`); - App.UI.DOM.appendNewElement("div", el, `You can begin a new game with up to five (or more) of your current slaves, although starting resources other than these slaves will be reduced.`); - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link( - "Activate New Game Plus", - () => { - V.ui = "start"; - }, - [], - "New Game Plus" - ), ["indent"]); - App.UI.DOM.appendNewElement("div", el, App.Arcology.purchase()); - } else { - App.UI.DOM.appendNewElement("div", el, `New Game Plus is not available because this game was not started with a compatible version.`, ["note"]); - } return el; } @@ -708,7 +690,7 @@ App.UI.optionsPassage = function() { } App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(links), "scLink2"); } - return (el); + return el; } function experimental() { @@ -764,6 +746,25 @@ App.UI.optionsPassage = function() { el.append(App.UI.playerMods()); return el; } + + function newGamePlus() { + const f = new DocumentFragment(); + if ((V.releaseID >= 1000) || V.ver.startsWith("0.9") || V.ver.startsWith("0.8") || V.ver.startsWith("0.7") || V.ver.startsWith("0.6")) { + App.UI.DOM.appendNewElement("div", f, `You can begin a new game with up to five (or more) of your current slaves, although starting resources other than these slaves will be reduced.`); + App.UI.DOM.appendNewElement("div", f, App.UI.DOM.link( + "Activate New Game Plus", + () => { + V.ui = "start"; + }, + [], + "New Game Plus" + ), ["indent"]); + App.UI.DOM.appendNewElement("div", f, App.Arcology.purchase()); + } else { + App.UI.DOM.appendNewElement("div", f, `New Game Plus is not available because this game was not started with a compatible version.`, ["note"]); + } + return f; + } }; /** * diff --git a/src/js/economyJS.js b/src/js/economyJS.js index 9b1982a60a768b2e01dd7a7ab9ecae79b9571fcd..92696294a4f7039c9f27f9757424b3fc05f8decc 100644 --- a/src/js/economyJS.js +++ b/src/js/economyJS.js @@ -2597,7 +2597,7 @@ globalThis.cashX = function(cost, what, who) { */ globalThis.repX = function(rep, what, who) { if (!Number.isFinite(rep)) { - V.lastWeeksRepErrors.push(`Expected a finite number for ${what}, but got ${repFormat(rep)}`); + V.lastWeeksRepErrors.push(`Expected a finite number for ${what}, but got ${rep}`); return 0; } @@ -2627,14 +2627,14 @@ globalThis.repX = function(rep, what, who) { // switch over to the net amount gained for the rest of the logic rep = curvedRep; } else { - V.lastWeeksRepErrors.push(`Unknown place "${what}" gained you ${repFormat(rep)}`); + V.lastWeeksRepErrors.push(`Unknown place "${what}" gained you ${rep}`); } } else if (rep < 0) { // EXPENSES // record the action if (typeof V.lastWeeksRepExpenses[what] !== 'undefined') { V.lastWeeksRepExpenses[what] += rep; } else { - V.lastWeeksRepErrors.push(`Unknown place "${what}" cost you ${repFormat(rep)}`); + V.lastWeeksRepErrors.push(`Unknown place "${what}" cost you ${rep}`); } // record the slave, if available diff --git a/src/js/utilsUnits.js b/src/js/utilsUnits.js index 1082f861a7e56c94d194171c5aa938e09d57db5c..76e56352048feafb3d5e592f6020d62b3bd5767b 100644 --- a/src/js/utilsUnits.js +++ b/src/js/utilsUnits.js @@ -355,45 +355,50 @@ globalThis.cashFormatColor = function(s = 0, invert = false) { /** * Formats the given number as reputation. * - * Positive values returns in green, negative values return in red. * @param {number} s The number to format. - * @returns {string} Returns a given number of reputation as a string. + * @param {boolean} [fuzzy] Only show an approximate value. + * @returns {string} Returns a string of the number formatted as a currency. */ -globalThis.repFormat = function(s = 0) { - if (V.cheatMode === 1 || V.debugMode === 1) { - if (s > 0) { - return `<span class="green">${commaNum(Math.round(s * 100) / 100)} rep</span>`; - } else if (s < 0) { - return `<span class="red">${commaNum(Math.round(s * 100) / 100)} rep</span>`; - } else { - return `${commaNum(Math.round(s * 100) / 100)} rep`; - } +globalThis.repFormat = function(s, fuzzy = true) { + if (!fuzzy || V.cheatMode === 1 || V.debugMode === 1) { + return `${commaNum(Math.round(s * 100) / 100)}`; } else { - /* In order to calculate just how much any one category matters so we can show a "fuzzy" symbolic value to the player, we need to know how "busy" reputation was this week. To calculate this, I ADD income to expenses. Why? 100 - 100 and 10000 - 10000 BOTH are 0, but a +50 event matters a lot more in the first case than the second. I exclude overflow and curving from the calculation because it's not a "real" expense for our purposes, and divide by half just to make percentages a bit easier. */ - let weight = s / (((V.lastWeeksRepIncome.Total - V.lastWeeksRepExpenses.Total) + (V.lastWeeksRepExpenses.overflow + V.lastWeeksRepExpenses.curve)) / 2); + // In order to calculate just how much any one category matters, so we can show a "fuzzy" symbolic value to the + // player, we need to know how "busy" reputation was this week. To calculate this, I ADD income to expenses. + // Why? 100 - 100 and 10000 - 10000 BOTH are 0, but a +50 event matters a lot more in the first case than the + // second. I exclude overflow and curving from the calculation because it's not a "real" expense for our + // purposes, and divide by half just to make percentages a bit easier. + // Curving is recorded on the income to keep the numbers correct. + const cleanGain = V.lastWeeksRepIncome.Total + V.lastWeeksRepIncome.curve; + const cleanLoss = V.lastWeeksRepExpenses.Total + V.lastWeeksRepExpenses.overflow; + const movement = cleanGain - cleanLoss; + const weight = s / Math.abs(movement / 2); + // \u2212 = Mathematical minus sign + let r; if (weight > 0.60) { - return `<span class="green">+++++ rep</span>`; + r = `+++++`; } else if (weight > 0.45) { - return `<span class="green">++++ rep</span>`; + r = `++++`; } else if (weight > 0.30) { - return `<span class="green">+++ rep</span>`; + r = `+++`; } else if (weight > 0.15) { - return `<span class="green">++ rep</span>`; + r = `++`; } else if (weight > 0.0) { - return `<span class="green">+ rep</span>`; + r = `+`; } else if (weight === 0) { - return "0 rep"; + r = "0"; } else if (weight < -0.60) { - return `<span class="red">−−−−− rep</span>`; + r = "\u2212\u2212\u2212\u2212\u2212"; } else if (weight < -0.45) { - return `<span class="red">−−−− rep</span>`; + r = `\u2212\u2212\u2212\u2212`; } else if (weight < -0.30) { - return `<span class="red">−−− rep</span>`; + r = `\u2212\u2212\u2212`; } else if (weight < -0.15) { - return `<span class="red">−− rep</span>`; + r = `\u2212\u2212`; } else if (weight < 0) { - return `<span class="red">− rep</span>`; + r = `\u2212`; } + return r; } }; diff --git a/src/markets/theMarket/tradeMenials.js b/src/markets/theMarket/tradeMenials.js index f29ed0017c2359338a57e34000f5591b4a1d0ef2..38b8b481abe9ab917a9d0f09ded56040303632cf 100644 --- a/src/markets/theMarket/tradeMenials.js +++ b/src/markets/theMarket/tradeMenials.js @@ -2,7 +2,7 @@ App.UI.tradeMenials = function(menialWorkersOnly) { const el = new DocumentFragment(); const menialPrice = menialSlaveCost(); const popCap = menialPopCap(); - let bulkMax; + const bulkMax = popCap.value - V.menials - V.fuckdolls - V.menialBioreactors; let linkArray; if (!menialWorkersOnly) { @@ -12,9 +12,6 @@ App.UI.tradeMenials = function(menialWorkersOnly) { el.append(slaveSupply()); App.UI.DOM.appendNewElement("div", el, popCap.text); - } - bulkMax = popCap.value - V.menials - V.fuckdolls - V.menialBioreactors; - if (!menialWorkersOnly) { App.UI.DOM.appendNewElement("div", el, `The parts of your arcology you own can house a total of ${num(popCap.value)} menial slaves.`); } @@ -34,8 +31,7 @@ App.UI.tradeMenials = function(menialWorkersOnly) { function slaveDemand() { const el = new DocumentFragment(); - let div = document.createElement("div"); - let span; + const div = document.createElement("div"); div.append(`Slave demand is `); if (V.menialDemandFactor <= -35000) { App.UI.DOM.appendNewElement("span", div, `extremely low`, ["red", "bold"]); @@ -65,13 +61,13 @@ App.UI.tradeMenials = function(menialWorkersOnly) { if (V.cheatMode && V.cheatModeM) { const menDemand = function() { const el = new DocumentFragment(); + el.append(" "); App.UI.DOM.appendNewElement("span", el, `Slave Demand`, ["yellowgreen"]); - el.append(`| ${V.menialDemandFactor}`); + el.append(` | ${V.menialDemandFactor}`); return el; }; - span = document.createElement("span"); - span.id = "menial-demand-factor"; + const span = document.createElement("span"); span.append(menDemand()); App.UI.DOM.makeTextBox( @@ -79,7 +75,7 @@ App.UI.tradeMenials = function(menialWorkersOnly) { v => { V.menialDemandFactor = Math.clamp(Math.trunc(Number(v)), -50000, 50000) || V.menialDemandFactor; V.cheater = 1; - jQuery("#menial-demand-factor").empty().append(menDemand()); + $(span).empty().append(menDemand()); } ); div.append(span); @@ -90,8 +86,7 @@ App.UI.tradeMenials = function(menialWorkersOnly) { function slaveSupply() { const el = new DocumentFragment(); - let span; - let div = document.createElement("div"); + const div = document.createElement("div"); div.append(`Slave supply is `); if (V.menialSupplyFactor <= -35000) { @@ -123,13 +118,13 @@ App.UI.tradeMenials = function(menialWorkersOnly) { if (V.cheatMode && V.cheatModeM) { const menSupply = function() { const el = new DocumentFragment(); + el.append(" "); App.UI.DOM.appendNewElement("span", el, `Slave Supply`, `yellowgreen`); - el.append(`| ${V.menialSupplyFactor}`); + el.append(` | ${V.menialSupplyFactor}`); return el; }; - span = document.createElement("span"); - span.id = "menial-supply-factor"; + const span = document.createElement("span"); span.append(menSupply()); App.UI.DOM.makeTextBox( @@ -137,7 +132,7 @@ App.UI.tradeMenials = function(menialWorkersOnly) { v => { V.menialSupplyFactor = Math.clamp(Math.trunc(Number(v)), -50000, 50000) || V.menialSupplyFactor; V.cheater = 1; - jQuery("#menial-supply-factor").empty().append(menSupply()); + $(span).empty().append(menSupply()); } ); div.append(span); @@ -149,29 +144,30 @@ App.UI.tradeMenials = function(menialWorkersOnly) { function menialTrading() { const el = document.createElement("div"); - let div = document.createElement("div"); if (!menialWorkersOnly) { + const r = []; if (V.menials > 1) { - el.append(`You own ${num(Math.trunc(V.menials))} menial slaves.`); + r.push(`You own ${num(Math.trunc(V.menials))} menial slaves.`); } else if (V.menials > 0) { - el.append(`You own one menial slave.`); + r.push(`You own one menial slave.`); } else { - el.append(`You do not own any menial slaves.`); + r.push(`You do not own any menial slaves.`); } - el.append(` The market price of menials is ${cashFormat(menialPrice)}.`); + r.push(`The market price of menials is <span class='cash'>${cashFormat(menialPrice)}.</span>`); + App.Events.addNode(el, r); } if (bulkMax > 0 && V.cash > menialPrice) { - div = document.createElement("div"); linkArray = []; const buySomeMenials = function(number = 1) { const value = forceNeg(menialSlaveCost(number) * number); V.menials += number; V.menialSupplyFactor -= number; cashX(value, "menialTransfer"); - jQuery("#menial-transaction-result").empty().append(App.UI.DOM.cashFormat(value)); if (menialWorkersOnly) { Engine.play(passage()); + } else { + jQuery("#menial-transaction-result").empty().append(App.UI.DOM.cashFormat(value)); } }; @@ -194,7 +190,7 @@ App.UI.tradeMenials = function(menialWorkersOnly) { makeLink(100, buySomeMenials); } if (V.cash > (menialPrice + 1) * 2) { - let menialBulkPremium = Math.trunc(1 + Math.clamp(V.cash / menialPrice, 0, bulkMax) / 400); + const menialBulkPremium = Math.trunc(1 + Math.clamp(V.cash / menialPrice, 0, bulkMax) / 400); linkArray.push( App.UI.DOM.link( "max", @@ -207,6 +203,8 @@ App.UI.tradeMenials = function(menialWorkersOnly) { ) ); } + const div = document.createElement("div"); + div.classList.add("indent"); div.append(App.UI.DOM.generateLinksStrip(linkArray)); App.UI.DOM.appendNewElement("span", div, " Bulk transactions may require offering a premium.", "note"); el.append(div); @@ -250,18 +248,17 @@ App.UI.tradeMenials = function(menialWorkersOnly) { }, ) ); - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray)); + App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), ["indent"]); } return el; } function fuckDollConversion() { const el = document.createElement("div"); - let div = document.createElement("div"); - let convertCost; + const div = document.createElement("div"); if (V.menials > 0) { if (V.arcadeUpgradeFuckdolls > 0) { - convertCost = 100; + const convertCost = 100; const convertSomeMenialsToFuckdolls = function(number) { const value = forceNeg(number * convertCost); V.menials -= number; @@ -298,11 +295,11 @@ App.UI.tradeMenials = function(menialWorkersOnly) { ); div.append(App.UI.DOM.generateLinksStrip(linkArray)); - App.UI.DOM.appendNewElement("span", div, `Conversion costs ${cashFormat(convertCost)} each`, "note"); + App.Events.addNode(div, [`Conversion costs ${cashFormatColor(convertCost)} each`], "span", "note"); el.append(div); } if (V.dairyFeedersUpgrade > 0) { - convertCost = 500; + const convertCost = 500; const convertSomeMenialsToBioreactors = function(number) { const value = forceNeg(number * convertCost); V.menials -= number; @@ -337,9 +334,9 @@ App.UI.tradeMenials = function(menialWorkersOnly) { }, ) ); - div = document.createElement("div"); + const div = document.createElement("div"); div.append(App.UI.DOM.generateLinksStrip(linkArray)); - App.UI.DOM.appendNewElement("span", div, `Conversion costs ${cashFormat(convertCost)} each`, "note"); + App.Events.addNode(div, [`Conversion costs ${cashFormatColor(convertCost)} each`], "span", "note"); el.append(div); } } @@ -348,7 +345,6 @@ App.UI.tradeMenials = function(menialWorkersOnly) { function fuckDollTrading() { const el = document.createElement("div"); - let div = document.createElement("div"); if (V.fuckdolls > 1) { el.append(`You own ${num(Math.trunc(V.fuckdolls))} standard Fuckdolls. `); } else if (V.fuckdolls > 0) { @@ -356,12 +352,10 @@ App.UI.tradeMenials = function(menialWorkersOnly) { } else if (V.arcologies[0].FSPaternalist === "unset") { el.append(`You do not own any standard Fuckdolls. `); } - el.append(div); if ((V.fuckdolls > 0) || (V.arcologies[0].FSPaternalist === "unset")) { - el.append(`The market price of standard Fuckdolls is ${cashFormat(menialPrice)}.`); + App.Events.addNode(el, [`The market price of standard Fuckdolls is <span class="cash">${cashFormat(menialPrice)}.</span>`]); if (bulkMax > 0) { if (V.arcologies[0].FSPaternalist === "unset" && V.cash > menialPrice) { - div = document.createElement("div"); linkArray = []; const buySomeFuckdolls = function(number = 1) { const value = forceNeg(menialSlaveCost(number) * number); @@ -387,7 +381,7 @@ App.UI.tradeMenials = function(menialWorkersOnly) { makeLink(100, buySomeFuckdolls); } if (V.cash > (menialPrice + 1) * 2) { - let menialBulkPremium = Math.trunc(1 + Math.clamp(V.cash / menialPrice, 0, bulkMax) / 400); + const menialBulkPremium = Math.trunc(1 + Math.clamp(V.cash / menialPrice, 0, bulkMax) / 400); linkArray.push( App.UI.DOM.link( "max", @@ -400,6 +394,8 @@ App.UI.tradeMenials = function(menialWorkersOnly) { ) ); } + const div = document.createElement("div"); + div.classList.add("indent"); div.append(App.UI.DOM.generateLinksStrip(linkArray)); App.UI.DOM.appendNewElement("span", div, " Bulk transactions may require offering a premium.", "note"); el.append(div); @@ -440,7 +436,7 @@ App.UI.tradeMenials = function(menialWorkersOnly) { }, ) ); - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray)); + App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), ["indent"]); } } @@ -449,7 +445,6 @@ App.UI.tradeMenials = function(menialWorkersOnly) { function bioreactorTrading() { const el = document.createElement("div"); - let div = document.createElement("div"); if (V.menialBioreactors > 1) { el.append(`You own ${num(Math.trunc(V.menialBioreactors))} standard bioreactors. `); } else if (V.menialBioreactors > 0) { @@ -458,10 +453,9 @@ App.UI.tradeMenials = function(menialWorkersOnly) { el.append(`You do not own any standard bioreactors. `); } if ((V.menialBioreactors > 0) || (V.arcologies[0].FSPaternalist === "unset")) { - el.append(`The market price of standard bioreactors is ${cashFormat(menialPrice - 100)}.`); + App.Events.addNode(el, [`The market price of standard bioreactors is <span class='cash'>${cashFormat(menialPrice - 100)}.</span>`]); if (bulkMax > 0) { if (V.arcologies[0].FSPaternalist === "unset" && V.cash > menialPrice) { - div = document.createElement("div"); linkArray = []; const buySomeBioreactors = function(number = 1) { const value = forceNeg(menialSlaveCost(number - 100) * number); @@ -487,7 +481,7 @@ App.UI.tradeMenials = function(menialWorkersOnly) { makeLink(100, buySomeBioreactors); } if (V.cash > (menialPrice - 99) * 2) { - let bioreactorBulkPremium = Math.trunc(1 + Math.clamp(V.cash / (menialPrice - 99), 0, bulkMax) / 400); + const bioreactorBulkPremium = Math.trunc(1 + Math.clamp(V.cash / (menialPrice - 99), 0, bulkMax) / 400); linkArray.push( App.UI.DOM.link( "max", @@ -500,6 +494,8 @@ App.UI.tradeMenials = function(menialWorkersOnly) { ) ); } + const div = document.createElement("div"); + div.classList.add("indent"); div.append(App.UI.DOM.generateLinksStrip(linkArray)); App.UI.DOM.appendNewElement("span", div, " Bulk transactions may require offering a premium.", "note"); el.append(div); @@ -540,7 +536,8 @@ App.UI.tradeMenials = function(menialWorkersOnly) { }, ) ); - div = document.createElement("div"); + const div = document.createElement("div"); + div.classList.add("indent"); div.append(App.UI.DOM.generateLinksStrip(linkArray)); el.append(div); }