diff --git a/src/markets/marketUI.js b/src/markets/marketUI.js index 2b1d8ed8444041036f5c90eea68180675882984d..8c7789f97ec7f78889b051b4bf2714c7bbfe5b27 100644 --- a/src/markets/marketUI.js +++ b/src/markets/marketUI.js @@ -84,13 +84,32 @@ App.UI.buyingFromMarketControls = function(slave, slaveCost) { /** * * @param {string} school Three letter version of school name, as used in the variable: "V.GRI" would be "GRI" - * @param {App.Entity.SlaveState} slave - * @param {number} cost * @param {string} [sTitleSingular] name for a single slave ("slave", "cow", etc.) * @param {string} [sTitlePlural] name for a bunch of them ("slaves", "cattle", etc.) */ -App.UI.buyingFromSchoolControls = function(school, slave, cost, sTitleSingular = "slave", sTitlePlural = "slaves") { +App.UI.buyingFromSchoolControls = function(school, sTitleSingular = "slave", sTitlePlural = "slaves") { const el = document.createElement("p"); + let r = []; + const marketResult = generateMarketSlave(school); + const slave = marketResult.slave; + + r.push(marketResult.text); + let cost = slaveCost(slave); + if (V[school].schoolSale !== 0) { + cost = Math.trunc(cost * 0.5); + } else if (V[school].schoolUpgrade !== 0) { + cost = Math.trunc(cost * 0.8); + } + if (V.slavesSeen > V.slaveMarketLimit) { + cost += Math.trunc(cost * ((V.slavesSeen - V.slaveMarketLimit) * 0.1)); + } + + r = []; + r.push(`The price is ${cashFormat(cost)}.`); + if (V.slavesSeen > V.slaveMarketLimit) { + r.push(`You have cast such a wide net for slaves this week that it is becoming more expensive to find more for sale. Your reputation helps determine your reach within the slave market.`); + } + const {him, his} = getPronouns(slave); App.UI.DOM.appendNewElement( "div", diff --git a/src/markets/schools/schools.js b/src/markets/schools/schools.js index e40fe4c38e07ab5f5ab5d8a75de10b87705cb88a..00216a507c481e620b17b1cda4c6f3ff10b7adf0 100644 --- a/src/markets/schools/schools.js +++ b/src/markets/schools/schools.js @@ -29,30 +29,10 @@ App.Markets.GRI = function() { r = []; r.push(`GRI offers a fresh graduate for inspection via video call. The interview takes place in the graduate's bare-metal holding cell. Disturbingly, it is strongly reminiscent of an enclosure for a lab animal, only scaled up to contain a lab animal of human dimensions.`); - - let _marketResult = generateMarketSlave("GRI"); - let slave = _marketResult.slave; - r.push(_marketResult.text); - let cost = slaveCost(slave); - if (V.GRI.schoolSale !== 0) { - cost = Math.trunc(cost * 0.5); - } else if (V.GRI.schoolUpgrade !== 0) { - cost = Math.trunc(cost * 0.8); - } - if (V.slavesSeen > V.slaveMarketLimit) { - cost += Math.trunc(cost * ((V.slavesSeen - V.slaveMarketLimit) * 0.1)); - } - App.UI.DOM.appendNewElement("p", el, r.join(" "), "scene-intro"); - - r = []; - r.push(`The price is ${cashFormat(cost)}.`); - if (V.slavesSeen > V.slaveMarketLimit) { - r.push(`You have cast such a wide net for slaves this week that it is becoming more expensive to find more for sale. Your reputation helps determine your reach within the slave market.`); - } App.UI.DOM.appendNewElement("p", el, r.join(" "), "scene-intro"); el.append( - App.UI.buyingFromSchoolControls("GRI", slave, cost) + App.UI.buyingFromSchoolControls("GRI") ); return el;