diff --git a/js/002-config/fc-js-init.js b/js/002-config/fc-js-init.js index 53ea86283e29cf1b9f01181c0552495a63ad0dad..2834aa7d3e76736ecd0aa05b8f2ecffabdcd3f8e 100644 --- a/js/002-config/fc-js-init.js +++ b/js/002-config/fc-js-init.js @@ -22,6 +22,7 @@ App.UI = {}; App.UI.DOM = {}; App.UI.View = {}; App.UI.SlaveInteract = {}; +App.UI.Budget = {}; App.Update = {}; App.Utils = {}; App.Interact = {}; diff --git a/src/uncategorized/costsBudget.js b/src/uncategorized/costsBudget.js new file mode 100644 index 0000000000000000000000000000000000000000..f0b71a9d333c9b45ef8e9028f08978d6511a3b16 --- /dev/null +++ b/src/uncategorized/costsBudget.js @@ -0,0 +1,699 @@ +App.UI.Budget.Cost = function() { + let el = document.createElement('p'); + let table = document.createElement("TABLE"); + let node; + let subNode; + let subSubNode; + let cell; + let array; + let text; + let coloredRow = true; + table.style.textAlign = "right"; + table.style.borderCollapse = "separate"; + table.style.borderStyle = "hidden"; + table.style.width = "90%"; + table.style.borderStyle = "solid"; + table.style.borderWidth = "1px"; + table.style.borderColor = "white"; + table.style.padding = "5px"; + table.style.fontFamily = "monospace"; + + // Set up profits column + for (let i = 0; i < V.lastWeeksCashIncome.length; i++){ + V.lastWeeksCashProfits[i] = (V.lastWeeksCashIncome[i] + V.lastWeeksCashExpenses[i]); + } + + // HEADER / PENTHOUSE + let header = table.createTHead(); + let row = header.insertRow(0); + let th = document.createElement("th"); + let pent = document.createElement("h2"); + pent.textContent = "Penthouse"; + th.appendChild(pent); + row.appendChild(th); + + array = [ + "Income", + "Expense", + "Totals" + ]; + for (let th of array) { + let cell = document.createElement("th"); + cell.textContent = th; + row.appendChild(cell); + } + + let body = document.createElement('tbody'); + table.appendChild(body); + row = body.insertRow(); + // PENTHOUSE + generateRowsFromArray([ + ["whore", "Whores"], + ["rest", "Resting"], + ["houseServant", "House servants"], + ["publicServant", "Public servants"], + ["classes", "Classes"], + ["milked", "Milked"], + ["gloryhole", "Gloryhole"], + ]); + + + // STRUCTURES + createSectionHeader("Structures"); + + // Brothel + structureSetup(V.brothelNameCaps, "brothel", V.brothel, "Brothel", V.BrothiIDs.length); + generateRowsFromArray([ + ["whoreBrothel", "Brothel whores"] + ]); + + if (V.brothel) { + node = new DocumentFragment(); + node.appendChild( + App.UI.DOM.link( + V.brothelNameCaps, + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Brothel Advertisement" + ) + ); + node.append(` also increases the income of whoring slaves in "jobs."`); + } else { + node = document.createTextNode(`${V.brothelNameCaps} (${V.BrothiIDs.length} slaves)`); + } + generateRow("brothelAds", node); + + if (V.brothel) { + generateRow(""); + } + + // Club + structureSetup(V.clubNameCaps, "club", V.club, "Club", V.ClubiIDs.length); + + if (V.club) { + node = new DocumentFragment(); + node.appendChild( + App.UI.DOM.link( + "Club ads", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Club Advertisement" + ) + ); + } else { + node = document.createTextNode(`${V.clubNameCaps} (${V.ClubiIDs.length} slaves)`); + } + generateRow("clubAds", node); + + if (V.club) { + generateRow(""); + } + + // Arcade + structureSetup(V.arcadeNameCaps, "arcade", V.arcade, "Arcade", V.ArcadeiIDs.length); + generateRowsFromArray([ + ["gloryholeArcade", "Arcade slaves"] + ]); + + if (V.arcade) { + generateRow(""); + } + + // Dairy + structureSetup(V.dairyNameCaps, "dairy", V.dairy, "Dairy", V.DairyiIDs.length); + generateRowsFromArray([ + ["milkedDairy", "Dairy cows"] + ]); + + if (V.dairy) { + generateRow(""); + } + + structureSetup("Servants' Quarters", "servantsQuarters", V.servantsQuarters, "Servants' Quarters", V.ServQiIDs.length); + + structureSetup("Master Suite", "masterSuite", V.masterSuite, "Master Suite", V.MastSiIDs.length); + + structureSetup(V.schoolroomNameCaps, "school", V.schoolroom, "Schoolroom", V.SchlRiIDs.length); + + structureSetup(V.spaNameCaps, "spa", V.spa, "Spa", V.SpaiIDs.length); + + structureSetup(V.clinicNameCaps, "clinic", V.clinic, "Clinic", V.CliniciIDs.length); + + structureSetup(V.cellblockNameCaps, "cellblock", V.cellblock, "Cellblock", V.CellBiIDs.length); + + structureSetup("Prosthetic Lab", "lab", V.researchLab.level, "Prosthetic Lab", "maintenance for "); + + structureSetup(V.incubatorNameCaps, "incubator", V.incubator, "Incubator", V.incubatorSlaves); + + structureSetup(V.nurseryNameCaps, "nursery", V.nursery, "Nursery", V.NurseryiIDs.length); + + structureSetup(V.farmyardNameCaps, "farmyard", V.farmyard, "Farmyard", V.FarmyardiIDs.length); + + structureSetup(V.pitNameCaps, "pit", V.pit, "Pit", V.fighterIDs.length); + + + + // Weather + if (V.lastWeeksCashExpenses.weather < 0 && V.weatherCladding === 0) { + node = new DocumentFragment(); + node.append("Weather is causing "); + let span = document.createElement('span'); + span.className = "red"; + span.textContent = "expensive damage. "; + node.append(span); + node.append("Consider a protective "); + node.appendChild( + App.UI.DOM.link( + "upgrade", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Manage Arcology" + ) + ); + } else { + node = document.createTextNode("Weather"); + } + + generateRow("weather", node); + + // SLAVES + createSectionHeader("Slaves"); + + node = App.UI.DOM.link( + "Slave maintenance", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Costs Report Slaves" + ); + generateRow("slaveUpkeep", node); + + generateRowsFromArray([ + ["extraMilk", "Extra milk"], + ["slaveTransfer", "Selling/buying major slaves"], + + ]); + + node = new DocumentFragment(); + node.append("Menials: "); + node.appendChild( + App.UI.DOM.link( + "Assistant's ", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Personal assistant options" + ) + ); + node.appendChild(document.createTextNode("flipping")); + generateRow("menialTransfer", node); + + node = new DocumentFragment(); + node.append("Fuckdolls: "); + node.appendChild( + App.UI.DOM.link( + "Assistant's ", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Personal assistant options" + ) + ); + node.appendChild(document.createTextNode("flipping")); + generateRow("fuckdollsTransfer", node); + + node = new DocumentFragment(); + node.append("Bioreactors: "); + node.appendChild( + App.UI.DOM.link( + "Assistant's ", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Personal assistant options" + ) + ); + node.appendChild(document.createTextNode("flipping")); + generateRow("menialBioreactorsTransfer", node); + + + generateRowsFromArray([ + ["babyTransfer", "Selling/buying babies"], + ]); + + node = App.UI.DOM.link( + "Menials", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Buy Slaves" + ); + node.appendChild(document.createTextNode(": labor")); + generateRow("menialTrades", node); + + generateRowsFromArray([ + ["fuckdolls", "Menials: fuckdolls"], + ["menialBioreactors", "Menials: bioreactors"], + ["porn", "Porn"], + ]); + + node = App.UI.DOM.link( + "Recruiter", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Recruiter Select" + ); + node.appendChild(document.createTextNode(": labor")); + generateRow("recruiter", node); + + generateRowsFromArray([ + ["menialRetirement", "Menials retiring"], + ["slaveMod", "Slave modification"], + ["slaveSurgery", "Slave surgery"], + ["birth", "Slave surgery"], + ]); + + // FINANCE + createSectionHeader("Finance"); + + generateRowsFromArray([ + ["personalBusiness", "Personal business"] + ]); + + node = new DocumentFragment(); + node.append("Your training expenses "); + + switch (V.personalAttention) { + case "trading": + text = "Trading trainer"; + break; + case "warfare": + text = "Warfare trainer"; + break; + case "slaving": + text = "Slaving trainer"; + break; + case "engineering": + text = "Engineering trainer"; + break; + case "medicine": + text = "Medicine trainer"; + break; + case "hacking": + text = "Hacking trainer"; + break; + default: + text = ""; + } + + node.appendChild( + App.UI.DOM.link( + text, + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Personal Attention Select" + ) + ); + if (text !== "") { + node.append(" fees"); + } + + generateRow("PCtraining", node); + + generateRowsFromArray([ + ["PCmedical", "Your medical expenses"], + ["PCskills", "Your skills"] + ]); + + node = new DocumentFragment(); + node.append("Your "); + node.appendChild( + App.UI.DOM.link( + "rents", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Manage Arcology" + ) + ); + if (V.lastWeeksCashExpenses.rents < 0) { + node.append(" and bribes"); + } + generateRow("rents", node); + + generateRowsFromArray([ + ["stocks", `Stock dividends on (${V.personalShares} (${V.publicShares} + ${V.personalShares}) shares).`], + ["stocksTraded", "Stock trading"], + ["fines", "Fines"], + ["event", "Events"], + ["war", "Arcology conflict"], + ["capEx", "Capital expenses"], + ["cheating", "CHEATING"] + ]); + + // POLICIES + createSectionHeader("Policies"); + + node = App.UI.DOM.link( + "Policies", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Policies" + ); + + generateRow("policies", node); + + if (V.secExpEnabled) { + node = App.UI.DOM.link( + "Edicts", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "edicts" + ); + } else { + node = document.createTextNode("Edicts"); + } + generateRow("edicts", node); + + node = App.UI.DOM.link( + "Society shaping", + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Future Society" + ); + + generateRow("futureSocieties", node); + + if (V.TSS.subsidize !== 0) { + text = ["The Slavegirl School", "branch campus influence"]; + } else if (V.GRI.subsidize !== 0) { + text = ["Growth Research Institute", "subsidiary lab influence"]; + } else if (V.SCP.subsidize !== 0) { + text = ["St. Claver Preparatory", "branch campus influence"]; + } else if (V.LDE.subsidize !== 0) { + text = ["L'Encole des Enculees", "branch campus influence"]; + } else if (V.TGA.subsidize !== 0) { + text = ["The Gymnasium-Academy", "branch campus influence"]; + } else if (V.TCR.subsidize !== 0) { + text = ["The Cattle Ranch", "branch campus influence"]; + } else if (V.HA.subsidize !== 0) { + text = ["Hippolyta Academy", "branch campus influence"]; + } else if (V.NUL.subsidize !== 0) { + text = ["Nueva Universidad de Libertad", "branch campus influence"]; + } else if (V.TFS.subsidize !== 0) { + text = ["The Futanari Sisters", "community influence"]; + } else if (V.TSS.schoolPresent === 1) { + text = ["The Slavegirl School", "branch campus upkeep"]; + } else if (V.GRI.schoolPresent === 1) { + text = ["Growth Research Institute", "subsidiary lab upkeep"]; + } else if (V.SCP.schoolPresent === 1) { + text = ["St. Claver Preparatory", "branch campus upkeep"]; + } else if (V.LDE.schoolPresent === 1) { + text = ["L'Encole des Enculees", "branch campus upkeep"]; + } else if (V.TGA.schoolPresent === 1) { + text = ["The Gymnasium-Academy", "branch campus upkeep"]; + } else if (V.TCR.schoolPresent === 1) { + text = ["The Cattle Ranch", "branch campus upkeep"]; + } else if (V.HA.schoolPresent === 1) { + text = ["Hippolyta Academy", "branch campus upkeep"]; + } else if (V.NUL.schoolPresent === 1) { + text = ["Nueva Universidad de Libertad", "branch campus upkeep"]; + } else { + text = ["Unknown school expense", ""]; + } + + node = new DocumentFragment(); + node.appendChild( + App.UI.DOM.link( + text[0], + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Policies" + ) + ); + node.append(" " + text[1]); + + generateRow("schoolBacking", node); + + + generateRowsFromArray([ + ["citizenOrphanage", `Education of ${V.citizenOrphanageTotal} of your slaves' children in citizen schools`], + ["privateOrphanage", `Private tutelage of ${V.privateOrphanageTotal} of your slaves' children`] + ]); + + node = document.createElement('div'); + node.append("Security: "); + if (V.barracks) { + node.appendChild( + App.UI.DOM.link( + V.mercenariesTitle, + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + "Barracks" + ) + ); + } else { + node.append("Mercenaries: "); + subNode = document.createElement('div'); + subNode.className = "red detail"; + subNode.textContent = "Cost increased by the lack of an armory to house them."; + node.appendChild(subNode); + } + + if ((V.PC.skill.warfare >= 100) || (V.PC.career === "arcology owner")) { + subNode = document.createElement('div'); + subNode.append("Cost reduced by your "); + + subSubNode = document.createElement('span'); + subSubNode.className = "springgreen"; + subSubNode.textContent = "mercenary contacts."; + subNode.appendChild(subSubNode); + node.appendChild(subNode); + } + + generateRow("mercenaries", node); + + text = "Peacekeepers"; // set up peacekeepers text a little early so I can fit it into the generateRowsFromArray() call + if (V.peacekeepers.undermining !== 0) { + text += ", including undermining"; + } + generateRowsFromArray([ + ["securityExpansion", "Security expansion"], + ["specialForces", "Special forces"], + ["peacekeepers", text] + ]); + + // BUDGET REPORT + createSectionHeader("Budget Report"); + + row = table.insertRow(); + cell = row.insertCell(); + cell.append("Tracked totals"); + + cell = row.insertCell(); + V.lastWeeksCashIncome.Total = hashSum(V.lastWeeksCashIncome); + cell.append(cashFormatColorDOM(Math.trunc(V.lastWeeksCashIncome.Total))); + + cell = row.insertCell(); + V.lastWeeksCashExpenses.Total = hashSum(V.lastWeeksCashExpenses); + cell.append(cashFormatColorDOM(Math.trunc(V.lastWeeksCashExpenses.Total))); + + cell = row.insertCell(); + + V.lastWeeksCashProfits.Total = (V.lastWeeksCashIncome.Total + V.lastWeeksCashExpenses.Total); + // each "profit" item is calculated on this sheet, and there's two ways to generate a profit total: the difference of the income and expense totals, and adding all the profit items. If they aren't the same, I probably forgot to properly add an item's profit calculation to this sheet. + node = new DocumentFragment(); + let total = hashSum(V.lastWeeksCashProfits) - V.lastWeeksCashProfits.Total; + if (V.lastWeeksCashProfits.Total !== total) { // Profits includes the total number of profits, so we have to subtract it back out + node.append(cashFormatColorDOM(Math.trunc(total))); + subNode = document.createElement('span'); + subNode.className = "red"; + subNode.textContent = "Fix profit calc"; + node.append(subNode); + } + node.append(cashFormatColorDOM(Math.trunc(V.lastWeeksCashProfits.Total))); + cell.append(node); + flipColors(row); + + row = table.insertRow(); + cell = row.insertCell(); + cell.append(`Expenses budget for week ${V.week + 1}`); + cell = row.insertCell(); + cell = row.insertCell(); + cell.append(cashFormatColorDOM(-V.costs)); + flipColors(row); + + row = table.insertRow(); + cell = row.insertCell(); + cell.append(`Last week actuals`); + cell = row.insertCell(); + cell = row.insertCell(); + cell = row.insertCell(); + cell.append(cashFormatColorDOM(V.cash - V.cashLastWeek)); + flipColors(row); + + row = table.insertRow(); + if ((V.cash - V.cashLastWeek) === V.lastWeeksCashProfits.Total) { + cell = row.insertCell(); + node = document.createElement('span'); + node.className = "green"; + node.textContent = `The books are balanced, ${properTitle()}!`; + cell.append(node); + } else { + cell = row.insertCell(); + cell.append("Transaction tracking off by:"); + cell = row.insertCell(); + cell = row.insertCell(); + cell = row.insertCell(); + cell.append(cashFormatColor((V.cash - V.cashLastWeek) - V.lastWeeksCashProfits.Total)); + } + flipColors(row); + + el.appendChild(table); + return jQuery('#costTable').empty().append(el); + + function createSectionHeader(text) { + coloredRow = true; // make sure the following section begins with color. + row = table.insertRow(); + cell = row.insertCell(); + let headline = document.createElement('h2'); + headline.textContent = text; + cell.append(headline); + } + + function generateRow(category, node) { + const income = "lastWeeksCashIncome"; + const expenses = "lastWeeksCashExpenses"; + const profits = "lastWeeksCashProfits"; + let row; + if (category === "") { + row = table.insertRow(); + row.append(document.createElement('br')); + row.insertCell(); + row.insertCell(); + row.insertCell(); + flipColors(row); + return; + } + + if (V[income][category] || V[expenses][category] || V.showAllEntries.costsBudget) { + V[profits][category] = V[income][category] + V[expenses][category]; // TODO: consider removing + + row = table.insertRow(); + let cell = row.insertCell(); + cell.append(node); + cell = row.insertCell(); + cell.append(cashFormatColorDOM(V[income][category])); + cell = row.insertCell(); + cell.append(cashFormatColorDOM(-Math.abs(V[expenses][category]))); + cell = row.insertCell(); + cell.append(cashFormatColorDOM(V[profits][category])); + flipColors(row); + } + return; + } + + function generateRowsFromArray(array) { + for (let line in array) { + let node = document.createTextNode(array[line][1]); + generateRow( + array[line][0], + node + ); + } + } + + /** + * @param {*} title the title displayed to the user, link active or not + * @param {*} category the parameter of the budget we are pulling from + * @param {*} structure the variable to test to determine if the building exists and therefore needs a link + * @param {*} passage the passage to link to if the structure is active + * @param {*} occupancy so we can display how many slaves are in the building + */ + function structureSetup(title, category, structure, passage, occupancy) { + node = new DocumentFragment(); + if (structure) { + node.appendChild( + App.UI.DOM.link( + title, + () => { + V.nextButton = "Back to Budget", + V.nextLink = "Costs Budget"; + }, + [], + passage + ) + ); + node.append(` (${occupancy} slaves)`); + } else { + node = document.createTextNode(`${title} (${occupancy} slaves)`); + } + generateRow(category, node); + } + + function cashFormatColorDOM(s, invert = false) { + if (invert) { + s = -1 * s; + } + let el = document.createElement('span'); + el.textContent = cashFormat(s); + // Display red if the value is negative, unless invert is true + if (s < 0) { + el.className = "red"; + // Yellow for positive + } else if (s > 0) { + el.className = "yellowgreen"; + // White for exactly zero + } + return el; + } + function flipColors(row) { + if (coloredRow === true) { + row.style.backgroundColor = "#001700"; + } + console.log(coloredRow); + coloredRow = !coloredRow; + } +}; diff --git a/src/uncategorized/costsBudget.tw b/src/uncategorized/costsBudget.tw index feedbdd88c77442f8ce6c298fcf887ad1223d740..b7a2fee2f3e2db9eee2ad541ac0fb8d48d5b12ce 100644 --- a/src/uncategorized/costsBudget.tw +++ b/src/uncategorized/costsBudget.tw @@ -82,344 +82,15 @@ <<option 1 "Show Empty Entries">> <</options>> +<p> /* Table of Totals */ <<if ndef $lastWeeksCashIncome>> Financial data currently unavailable. <<else>> - -<<script>> -for (var i = 0; i < State.variables.lastWeeksCashIncome.length; i++){ - State.variables.lastWeeksCashProfits[i] = (State.variables.lastWeeksCashIncome[i] + State.variables.lastWeeksCashExpenses[i]); -} -<</script>> - -<style> - table.finances { - /*table-layout: fixed;*/ - text-align: right; - border-collapse: separate; - border-spacing: 5px; - border-style: hidden; - empty-cells: hide; - width: 75%; - } -</style> - - -<table class="finances" border="1"> - <tr> - <th><h2>Penthouse</h2></th> - <th>Income</th> - <th>Expense</th> - <th>Totals</th> - </tr> - - <<print budgetLine("whore", "Whores")>> - - <<print budgetLine("rest", "Resting")>> - - <<print budgetLine("houseServant", "House servants")>> - - <<print budgetLine("confined", "Confined")>> - - <<print budgetLine("publicServant", "Public servants")>> - - <<print budgetLine("classes", "Classes")>> - - <<print budgetLine("milked", "Milked")>> - - <<print budgetLine("gloryhole", "Gloryhole")>> - - <tr> - <h2>Structures</h2> - </tr> - - <<print budgetLine("brothel", "<<if $brothel>>[[$brothelNameCaps|Brothel][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$brothelNameCaps<</if>> ($BrothiIDs.length slaves)")>> - - <<print budgetLine("whoreBrothel", "Brothel whores")>> - - <<print budgetLine("brothelAds", "<<if $brothel>>[[Brothel ads|Brothel Advertisement][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>Brothel ads<</if>> also increase the income of whoring slaves in \"jobs.\"")>> - - <<if $brothel > 0>> - <br> - <</if>> - - <<print budgetLine("club", "<<if $club>>[[$clubNameCaps|Club][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$clubNameCaps<</if>> ($ClubiIDs.length slaves)")>> - - <<print budgetLine("clubAds", "<<if $club>>[[Club ads|Club Advertisement][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>Club ads<</if>>")>> - - <<if $club > 0>> - <br> - <</if>> - - <<print budgetLine("arcade", "<<if $arcade>>[[$arcadeNameCaps|Arcade][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$arcadeNameCaps<</if>> ($ArcadeiIDs.length slaves)")>> - - <<print budgetLine("gloryholeArcade", "Arcade slaves")>> - - <<if $arcade > 0>> - <br> - <</if>> - - <<print budgetLine("dairy", "<<if $dairy>>[[$dairyNameCaps|Dairy][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$dairyNameCaps<</if>> ($DairyiIDs.length slaves)")>> - - <<print budgetLine("milkedDairy", "Dairy cows")>> - - <<if $dairy > 0>> - <br> - <</if>> - - <<print budgetLine("servantsQuarters", "<<if $servantsQuarters>>[[Servants' Quarters][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>Servants' Quarters<</if>> ($ServQiIDs.length slaves)")>> - - <<print budgetLine("masterSuite", "<<if $masterSuite>>[[Master Suite][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>Master Suite<</if>> ($MastSiIDs.length slaves)")>> - - <<print budgetLine("school", "<<if $schoolroom>>[[$schoolroomNameCaps|Schoolroom][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$schoolroomNameCaps<</if>> ($SchlRiIDs.length slaves)")>> - - <<print budgetLine("spa", "<<if $spa>>[[$spaNameCaps|Spa][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$spaNameCaps<</if>> ($SpaiIDs.length slaves)")>> - - <<print budgetLine("clinic", "<<if $clinic>>[[$clinicNameCaps|Clinic][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$clinicNameCaps<</if>> ($CliniciIDs.length slaves)")>> - - <<print budgetLine("cellblock", "<<if $cellblock>>[[$cellblockNameCaps|Cellblock][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$cellblockNameCaps<</if>> ($CellBiIDs.length slaves)")>> - - <<print budgetLine("lab", "<<if $researchLab.level > 0>>[[Prosthetic Lab][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>Prosthetic Lab<</if>> maintenance")>> - - <<print budgetLine("incubator", "<<if $incubator>>[[$incubatorNameCaps|Incubator][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$incubatorNameCaps<</if>> ($incubatorSlaves slaves)")>> - - <<print budgetLine("nursery", "<<if $nursery>>[[$nurseryNameCaps|Nursery][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$nurseryNameCaps<</if>> ($NurseryiIDs.length slaves)")>> - - <<print budgetLine("farmyard", "<<if $farmyard>>[[$farmyardNameCaps|Farmyard][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$farmyardNameCaps<</if>> ($FarmyardiIDs.length slaves)")>> - - <<print budgetLine("pit", "<<if $pit>>[[$pitNameCaps|Pit][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]<<else>>$pitNameCaps<</if>> ($fighterIDs.length slaves)")>> - - <<print budgetLine("environment", "Environment")>> - - <<print budgetLine("weather", - "<<if $lastWeeksCashExpenses.weather < 0 && $weatherCladding == 0>> - Weather is causing <span class=\"red\">expensive damage.</span> Consider a protective [[upgrade|Manage Arcology][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]. - <<else>> - Weather - <</if>>")>> - - <tr> - <h2>Slaves</h2> - </tr> - - <<print budgetLine("slaveUpkeep", "[[Slave maintenance|Costs Report Slaves][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] ($slaves.length slaves)")>> - - <<print budgetLine("extraMilk", "Extra milk")>> - - <<print budgetLine("slaveTransfer", "Selling/buying major slaves")>> - - <<print budgetLine("menialTransfer", "Menials: [[Assistant's|Personal assistant options][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] flipping")>> - - <<print budgetLine("fuckdollsTransfer", "Fuckdolls: [[Assistant's|Personal assistant options][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] flipping")>> - - <<print budgetLine("menialBioreactorsTransfer", "Bioreactors: [[Assistant's|Personal assistant options][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] flipping")>> - - <<print budgetLine("babyTransfer", "Selling/buying babies")>> - - <<print budgetLine("menialTrades", "[[Menials|Buy Slaves]]: labor")>> - - <<print budgetLine("fuckdolls", "Fuckdolls")>> - - <<print budgetLine("menialBioreactors", "Menials: bioreactors")>> - - <<print budgetLine("porn", "Porn")>> - - <<print budgetLine("recruiter", "[[Recruiter|Recruiter Select]]")>> - - <<print budgetLine("menialRetirement", "Menials retiring")>> - - <<print budgetLine("slaveMod", "Slave modification")>> - - <<print budgetLine("slaveSurgery", "Slave surgery")>> - - <<print budgetLine("birth", "Slave surgery")>> - - <tr> - <h2>Finance</h2> - </tr> - - <<print budgetLine("personalBusiness", "Personal business")>> - - <<print budgetLine("personalLivingExpenses", - "<<if $PC.rules.living == \"luxurious\">> - Since you are accustomed to luxury, your personal living expenses are: - <<elseif $PC.rules.living == \"normal\">> - Since you are used to living well, your personal living expenses are: - <<else>> - Since you are used to a fairly normal life, your personal living expenses are: - <</if>> - ")>> - - <<print budgetLine("PCtraining", " - Your training expenses - <<if ($personalAttention == \"trading\")>> - [[Trading trainer|Personal Attention Select][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] fees - <<elseif ($personalAttention == \"warfare\")>> - [[Warfare trainer|Personal Attention Select][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] fees - <<elseif ($personalAttention == \"slaving\")>> - [[Slaving trainer|Personal Attention Select][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] fees - <<elseif ($personalAttention == \"engineering\")>> - [[Engineering trainer|Personal Attention Select][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] fees - <<elseif ($personalAttention == \"medicine\")>> - [[Medicine trainer|Personal Attention Select][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] fees - <<elseif ($personalAttention == \"hacking\")>> - [[Hacking trainer|Personal Attention Select][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] fees - <</if>> - ")>> - - <<print budgetLine("PCmedical", "Your medical expenses")>> - - <<print budgetLine("PCskills", "Your skills")>> - - <<print budgetLine("rents", - "Your [[rents|Manage Arcology]] - <<if $lastWeeksCashExpenses.rents < 0>> - and bribes - <</if>> - ")>> - - <<print budgetLine("stocks", "Stock dividends on ($personalShares/<<print ($publicShares + $personalShares)>> shares).")>> - - <<print budgetLine("stocksTraded", "Stock trading")>> - - <<print budgetLine("fines", "Fines")>> - - <<print budgetLine("event", "Events")>> - - <<print budgetLine("war", "Arcology conflict")>> - - <<print budgetLine("capEx", "Capital expenses")>> - - <<print budgetLine("cheating", "CHEATING")>> - - <tr> - <h2>Policies</h2> - </tr> - - <<print budgetLine("policies", "[[Policies]]")>> - <<print budgetLine("edicts", "<<if $secExpEnabled>>[[Edicts|edicts]]<<else>>Edicts<</if>>")>> - - <<print budgetLine("futureSocieties", "[[Society shaping|Future Society][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]]")>> - - <<print budgetLine("schoolBacking", - "<<if $TSS.subsidize != 0>>[[The Slavegirl School|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus influence - <<elseif $GRI.subsidize != 0>>[[Growth Research Institute|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] subsidiary lab influence - <<elseif $SCP.subsidize != 0>>[[St. Claver Preparatory|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus influence - <<elseif $LDE.subsidize != 0>>[[L'Encole des Enculees|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus influence - <<elseif $TGA.subsidize != 0>>[[The Gymnasium-Academy|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus influence - <<elseif $TCR.subsidize != 0>>[[The Cattle Ranch|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus influence - <<elseif $HA.subsidize != 0>>[[Hippolyta Academy|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus influence - <<elseif $NUL.subsidize != 0>>[[Nueva Universidad de Libertad|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus influence - <<elseif $TFS.subsidize != 0>>[[The Futanari Sisters|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] community influence - <<elseif $TSS.schoolPresent == 1>>[[The Slavegirl School|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus upkeep - <<elseif $GRI.schoolPresent == 1>>[[Growth Research Institute|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] subsidiary lab upkeep - <<elseif $SCP.schoolPresent == 1>>[[St. Claver Preparatory|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus upkeep - <<elseif $LDE.schoolPresent == 1>>[[L'Encole des Enculees|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus upkeep - <<elseif $TGA.schoolPresent == 1>>[[The Gymnasium-Academy|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus upkeep - <<elseif $TCR.schoolPresent == 1>>[[The Cattle Ranch|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus upkeep - <<elseif $HA.schoolPresent == 1>>[[Hippolyta Academy|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus upkeep - <<elseif $NUL.schoolPresent == 1>>[[Nueva Universidad de Libertad|Policies][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] branch campus upkeep - <<else>> Unknown school expense - <</if>> - ")>> - - <<print budgetLine("citizenOrphanage", "Education of $citizenOrphanageTotal of your slaves\' children in citizen schools")>> - - <<print budgetLine("privateOrphanage", "Private tutelage of $privateOrphanageTotal of your slaves\' children")>> - - <<print budgetLine("mercenaries", - "Security: - <<if $barracks>> - [[$mercenariesTitle|Barracks][$nextButton = \"Back to Budget\", $nextLink = \"Costs Budget\"]] - <<else>> - Mercenaries - <div class=\"red detail\"> - Cost increased by the lack of an armory to house them. - </div> - <</if>> - <<if ($PC.skill.warfare >= 100) || ($PC.career == \"arcology owner\")>> - <div class=\"detail\"> - Cost reduced by your <span class=\"springgreen\">mercenary contacts.</span> - </div> - <</if>> - ")>> - - <<print budgetLine("securityExpansion", "Security expansion")>> - - <<print budgetLine("specialForces", "Special forces")>> - - <<print budgetLine("peacekeepers", "Peacekeepers<<if State.variables.peacekeepers.undermining !== 0>>, including undermining<</if>>")>> - - <tr> - <h2>Budget Report</h2> - </tr> - - <tr><td></td></tr> - <tr> - <td>Tracked totals</td> - <td> - <<set $lastWeeksCashIncome.Total = hashSum($lastWeeksCashIncome)>> - <<print cashFormatColor(Math.trunc($lastWeeksCashIncome.Total))>> - </td> - - <td> - <<set $lastWeeksCashExpenses.Total = hashSum($lastWeeksCashExpenses)>> - <<print cashFormatColor(Math.trunc($lastWeeksCashExpenses.Total))>> - </td> - <td> - <<set $lastWeeksCashProfits.Total = ($lastWeeksCashIncome.Total + $lastWeeksCashExpenses.Total)>> - /* each "profit" item is calculated on this sheet, and there's two ways to generate a profit total: the difference of the income and expense totals, and adding all the profit items. If they aren't the same, I probably forgot to properly add an item's profit calculation to this sheet.*/ - <<if $lastWeeksCashProfits.Total != hashSum($lastWeeksCashProfits) - $lastWeeksCashProfits.Total>>/* Profits includes the total number of profits, so we have to subtract it back out */ - <<print (cashFormat(Math.trunc(hashSum($lastWeeksCashProfits)-$lastWeeksCashProfits.Total)))>> - <div class="red">Fix profit calc</div> - <</if>> - <div> - <<print cashFormatColor(Math.trunc($lastWeeksCashProfits.Total))>> - </div> - </td> - </tr> - - - <tr><td></td></tr> - <tr> - <td>Expenses budget for week <<print ($week+1)>></td> - <td></td> - <td> - <<print cashFormatColor($costs)>> - </td> - <td></td> - </tr> - - <tr><td></td></tr> - <tr> - <td>Last week actuals</td> - <td></td> - <td></td> - <td> - <<print cashFormatColor($cash-$cashLastWeek)>> - </td> - </tr> - - <<if ($cash-$cashLastWeek) == $lastWeeksCashProfits.Total>> - <tr> - <span class="green">The books are balanced, <<= properTitle()>>!</span> - </tr> - <<else>> - <tr> - <td>Transaction tracking off by:</td> - <td></td> - <td>/*<<print ($lastWeeksCashExpenses.Total + $costs)>>*/</td> - <td> - <<print cashFormatColor(($cash-$cashLastWeek) - $lastWeeksCashProfits.Total)>> - </td> - </tr> - <</if>> -</table> - -<br> - + <span id="costTable"></span> + <script>App.UI.Budget.Cost()</script> <</if>> +</p> <<if ndef $lastWeeksCashErrors>> <<set $lastWeeksCashErrors = "Errors: ">>