From de75f617ef06b409c64bdd1ec08d1683c1e08d32 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Mon, 31 Aug 2020 00:17:51 -0400 Subject: [PATCH] dropping school unique js --- js/003-data/miscData.js | 2 + src/endWeek/endWeek.js | 2 +- src/markets/marketUI.js | 61 +++++++++++++++++-- src/markets/specificMarkets/schoolFutanari.js | 9 ++- src/markets/specificMarkets/schools.js | 18 +++--- src/markets/specificMarkets/slaveMarkets.js | 38 ------------ src/markets/theMarket/buySlaves.js | 2 +- 7 files changed, 76 insertions(+), 56 deletions(-) diff --git a/js/003-data/miscData.js b/js/003-data/miscData.js index 13ad5198603..11316f3222c 100644 --- a/js/003-data/miscData.js +++ b/js/003-data/miscData.js @@ -1982,6 +1982,8 @@ App.Data.misc.lawlessMarkets = [ "LDE" ]; +App.Data.misc.schools = ["GRI", "HA", "NUL", "SCP", "TCR", "TFS", "TGA", "TSS", "LDE", "TUO"]; + App.Data.weather = { nice: [ {name: "Sunny", severity: 1}, diff --git a/src/endWeek/endWeek.js b/src/endWeek/endWeek.js index 6e8ad55b18e..c8021aa9b33 100644 --- a/src/endWeek/endWeek.js +++ b/src/endWeek/endWeek.js @@ -31,7 +31,7 @@ globalThis.endWeek = (function() { function resetSlaveMarkets() { V.gingering = 0; delete V.slaveMarket; - for (const school of ["TSS", "GRI", "SCP", "LDE", "TGA", "HA", "TFS", "TCR", "NUL"]) { + for (const school of [App.Data.misc.schools]) { V[school].schoolSale = 0; } } diff --git a/src/markets/marketUI.js b/src/markets/marketUI.js index 780d3f0f249..d09b53a9c11 100644 --- a/src/markets/marketUI.js +++ b/src/markets/marketUI.js @@ -1,5 +1,5 @@ App.UI.buyingFromMarketControls = function(slave, slaveCost, market, sTitleSingular = "slave", sTitlePlural = "slaves") { - const {him, his} = getPronouns(slave); + const { him, his } = getPronouns(slave); const el = document.createElement("p"); let title = {}; if (sTitleSingular === "prisoner") { @@ -42,6 +42,7 @@ App.UI.buyingFromMarketControls = function(slave, slaveCost, market, sTitleSingu V.newSlaves.push(slave); V.introType = "multi"; V.slavesSeen += 1; + student(); jQuery("#slave-markets").empty().append(App.Markets[market]); }, ) @@ -56,8 +57,8 @@ App.UI.buyingFromMarketControls = function(slave, slaveCost, market, sTitleSingu cashX(forceNeg(slaveCost), "slaveTransfer", slave); V.newSlaves.push(slave); V.nextButton = "Continue"; - V.nextLink = "AS Dump"; V.returnTo = "Main"; + student(); newSlave(slave); jQuery("#slave-markets").empty().append(App.UI.newSlaveIntro(slave)); }, @@ -70,6 +71,7 @@ App.UI.buyingFromMarketControls = function(slave, slaveCost, market, sTitleSingu App.UI.DOM.link( title.buyHerAndFinish, () => { + student(); cashX(forceNeg(slaveCost), "slaveTransfer", slave); V.newSlaves.push(slave); }, @@ -94,8 +96,15 @@ App.UI.buyingFromMarketControls = function(slave, slaveCost, market, sTitleSingu ); } - el.append(App.Desc.longSlave(slave, {market: V.slaveMarket})); + el.append(App.Desc.longSlave(slave, { market: market })); return el; + + function student() { + if ([App.Data.misc.schools].includes(market)) { + V[market].schoolSale = 0; + V[market].studentsBought += 1; + } + } }; /** @@ -125,7 +134,7 @@ App.UI.buyingFromSchoolControls = function(school, costMod = 1, sTitleSingular = 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); + const { him, his } = getPronouns(slave); App.UI.DOM.appendNewElement( "div", el, @@ -203,7 +212,7 @@ App.UI.buyingFromSchoolControls = function(school, costMod = 1, sTitleSingular = App.UI.DOM.appendNewElement( "p", el, - App.Desc.longSlave(slave, {market: "generic"}) + App.Desc.longSlave(slave, { market: "generic" }) ); return el; @@ -219,3 +228,45 @@ App.UI.buyingFromSchoolControls = function(school, costMod = 1, sTitleSingular = } } }; + +/** + * + * @param {*} slaveMarket + * @param {object} [param1] + * @param {string} [param1.numArcology] + * @param {string} [param1.sTitleSingular] + * @param {string} [param1.sTitlePlural] + */ +App.Markets.generic = function(slaveMarket, {numArcology, sTitleSingular = "slave", sTitlePlural = "slaves", costMod = 1} = {}) { + const el = new DocumentFragment(); + const marketResult = generateMarketSlave(slaveMarket, (numArcology || 1)); + const slave = marketResult.slave; + el.append(marketResult.text); + + let _slaveCost = (slaveCost(slave, false, !App.Data.misc.lawlessMarkets.includes(slaveMarket)) * costMod); + if (V.slavesSeen > V.slaveMarketLimit) { + _slaveCost += Math.trunc(_slaveCost * ((V.slavesSeen - V.slaveMarketLimit) * 0.1)); + } + if (V.slavesSeen > V.slaveMarketLimit) { + _slaveCost += _slaveCost * ((V.slavesSeen - V.slaveMarketLimit) * 0.1); + } + + // Tweak for neighbor + if (slaveMarket === "neighbor") { + let _opinion = App.Neighbor.opinion(0, numArcology); + if (_opinion !== 0) { + _slaveCost -= Math.trunc(_slaveCost * _opinion * 0.05); + } + } + + _slaveCost = 500 * Math.trunc(_slaveCost / 500); + App.UI.DOM.appendNewElement("p", + el, + `The offered price is ${cashFormat(_slaveCost)}. ${(V.slavesSeen > V.slaveMarketLimit) ? `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.` : ``}` + ); + + el.append( + App.UI.buyingFromMarketControls(slave, _slaveCost, slaveMarket, sTitleSingular, sTitlePlural) + ); + return el; +}; \ No newline at end of file diff --git a/src/markets/specificMarkets/schoolFutanari.js b/src/markets/specificMarkets/schoolFutanari.js index 4043a1f0320..c91d432c9a2 100644 --- a/src/markets/specificMarkets/schoolFutanari.js +++ b/src/markets/specificMarkets/schoolFutanari.js @@ -160,9 +160,14 @@ App.Markets.TFS = function() { App.UI.DOM.appendNewElement("p", el, r.join(" "), "scene-intro"); App.UI.DOM.appendNewElement("p", el, `The Sisters offer a member selected for sale into slavery for inspection via video call. The feed is of an exhausted futa, fast asleep. Whatever ceremonies the Sisters perform before releasing a member into slavery, they seem to have tired her out. There are indistinct but obviously sexual sounds audible in the background; it sounds like an orgy with a very large number of participants is going on nearby.`); } - + let costMod = 1; + if (V.HA.schoolSale !== 0) { + costMod = 0.6; + } else if (V.HA.schoolUpgrade !== 0) { + costMod = 1.2; + } el.append( - App.UI.buyingFromSchoolControls("TFS") + App.UI.generic("TFS", {costMod:costMod}) ); return el; diff --git a/src/markets/specificMarkets/schools.js b/src/markets/specificMarkets/schools.js index 0d56fb6a144..bc03e7e627d 100644 --- a/src/markets/specificMarkets/schools.js +++ b/src/markets/specificMarkets/schools.js @@ -25,7 +25,7 @@ App.Markets.GRI = function() { costMod = 0.8; } el.append( - App.UI.buyingFromSchoolControls("GRI", costMod) + App.UI.generic("GRI", {costMod:costMod}) ); return el; @@ -62,7 +62,7 @@ App.Markets.LDE = function() { costMod = 0.8; } el.append( - App.UI.buyingFromSchoolControls("LDE", costMod) + App.UI.generic("LDE", {costMod:costMod}) ); return el; @@ -93,7 +93,7 @@ App.Markets.NUL = function() { costMod = 0.8; } el.append( - App.UI.buyingFromSchoolControls("NUL", costMod) + App.UI.generic("NUL", {costMod:costMod}) ); return el; @@ -130,7 +130,7 @@ App.Markets.SCP = function() { costMod = 0.8; } el.append( - App.UI.buyingFromSchoolControls("SCP", costMod) + App.UI.generic("SCP", {costMod:costMod}) ); return el; @@ -170,7 +170,7 @@ App.Markets.TCR = function() { costMod = 0.8; } el.append( - App.UI.buyingFromSchoolControls("TCR", costMod, "cow", "cattle") + App.UI.generic("TCR", {costMod:costMod}, "cow", "cattle") ); return el; @@ -206,7 +206,7 @@ App.Markets.TGA = function() { costMod = 0.8; } el.append( - App.UI.buyingFromSchoolControls("TGA", costMod) + App.UI.generic("TGA", {costMod:costMod}) ); return el; @@ -234,7 +234,7 @@ App.Markets.HA = function() { costMod = 1.2; } el.append( - App.UI.buyingFromSchoolControls("HA", costMod) + App.UI.generic("HA", {costMod:costMod}) ); return el; @@ -270,7 +270,7 @@ App.Markets.TSS = function() { costMod = 0.8; } el.append( - App.UI.buyingFromSchoolControls("TSS", costMod) + App.UI.generic("TSS", {costMod:costMod}) ); return el; @@ -288,7 +288,7 @@ App.Markets.TUO = function() { costMod = 1.2; } el.append( - App.UI.buyingFromSchoolControls("TUO", costMod) + App.UI.generic("TUO", {costMod:costMod}) ); return el; diff --git a/src/markets/specificMarkets/slaveMarkets.js b/src/markets/specificMarkets/slaveMarkets.js index a56152f5cd6..bee3f5054b4 100644 --- a/src/markets/specificMarkets/slaveMarkets.js +++ b/src/markets/specificMarkets/slaveMarkets.js @@ -250,41 +250,3 @@ App.Markets.wetware = function() { return el; }; -/** - * - * @param {*} slaveMarket - * @param {object} [param1] - * @param {string} [param1.numArcology] - * @param {string} [param1.sTitleSingular] - * @param {string} [param1.sTitlePlural] - */ -App.Markets.generic = function(slaveMarket, {numArcology, sTitleSingular = "slave", sTitlePlural = "slaves"} = {}) { - const el = new DocumentFragment(); - const marketResult = generateMarketSlave(slaveMarket, (numArcology || 1)); - const slave = marketResult.slave; - el.append(marketResult.text); - - let _slaveCost = slaveCost(slave, false, !App.Data.misc.lawlessMarkets.includes(slaveMarket)); - if (V.slavesSeen > V.slaveMarketLimit) { - _slaveCost += _slaveCost * ((V.slavesSeen - V.slaveMarketLimit) * 0.1); - } - - // Tweak for neighbor - if (slaveMarket === "neighbor") { - let _opinion = App.Neighbor.opinion(0, numArcology); - if (_opinion !== 0) { - _slaveCost -= Math.trunc(_slaveCost * _opinion * 0.05); - } - } - - _slaveCost = 500 * Math.trunc(_slaveCost / 500); - App.UI.DOM.appendNewElement("p", - el, - `The offered price is ${cashFormat(_slaveCost)}. ${(V.slavesSeen > V.slaveMarketLimit) ? `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.` : ``}` - ); - - el.append( - App.UI.buyingFromMarketControls(slave, _slaveCost, slaveMarket, sTitleSingular, sTitlePlural) - ); - return el; -}; diff --git a/src/markets/theMarket/buySlaves.js b/src/markets/theMarket/buySlaves.js index ee31f803168..3ae47336396 100644 --- a/src/markets/theMarket/buySlaves.js +++ b/src/markets/theMarket/buySlaves.js @@ -203,7 +203,7 @@ App.UI.buySlaves = function() { if (store.note) { App.UI.DOM.appendNewElement("span", el, ` ${store.note}`, "note"); } - if (["GRI", "HA", "NUL", "SCP", "TCR", "TFS", "TGA", "TSS", "LDE", "TUO"].includes(store.marketType)) { + if ([].includes(store.marketType)) { if (V[store.marketType].schoolSale === 1) { App.UI.DOM.appendNewElement("span", el, `Offering your first purchase at half price this week. `, "yellow"); } -- GitLab