From eb66202427beaee652d80e743b0ffe54cf3de5f2 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Mon, 24 Aug 2020 21:17:49 -0400 Subject: [PATCH] basic function for a store and data format --- src/markets/buySlaves.js | 704 +++++++++++++++++++++++++++++++++ src/markets/marketData.js | 38 ++ src/markets/marketUI.js | 2 +- src/uncategorized/buySlaves.tw | 5 + 4 files changed, 748 insertions(+), 1 deletion(-) create mode 100644 src/markets/buySlaves.js create mode 100644 src/markets/marketData.js diff --git a/src/markets/buySlaves.js b/src/markets/buySlaves.js new file mode 100644 index 00000000000..9f9268a356b --- /dev/null +++ b/src/markets/buySlaves.js @@ -0,0 +1,704 @@ +/** + * Displays the Market, where you can select individual slave markets to shop at. + * @returns {Node} + */ + +App.UI.buySlaves = function() { + const el = new DocumentFragment(); + let div; + let linkArray; + + let _minimumFive = minimumSlaveCost() * 5; + let _minimumTen = minimumSlaveCost() * 10; + + App.UI.DOM.appendNewElement("h2", el, "The Market"); + App.UI.DOM.appendNewElement("p", el, `There are many different organizations to purchase slaves from, but many of them are selective about their customers and will only sell to you if you are reputable.`, `note`); + + App.UI.DOM.appendNewElement("h3", el, "Market status"); + if (V.slaveCostFactor > 1.1) { + App.UI.DOM.appendNewElement("div", el, `There is a bull market for slaves; the price of slaves is very high.`, "yellow"); + } else if (V.slaveCostFactor > 1) { + App.UI.DOM.appendNewElement("div", el, `The slave market is bullish; the price of slaves is high.`, "yellow"); + } else if (V.slaveCostFactor < 0.9) { + App.UI.DOM.appendNewElement("div", el, `There is a bear market for slaves; the price of slaves is very low.`, "yellow"); + } else if (V.slaveCostFactor < 1) { + App.UI.DOM.appendNewElement("div", el, `The slave market is bearish; the price of slaves is low.`, "yellow"); + } else { + App.UI.DOM.appendNewElement("div", el, `The slave market is stable; the price of slaves is average.`); + } + + App.UI.DOM.appendNewElement("h2", el, "Sex Slave Purchase Options"); + + App.UI.DOM.appendNewElement("div", el, storeFront(App.Data.Markets.starter[0])); + + return el; + + /** * + * @returns {Node} + */ + function storeFront(/** @type {market}*/store) { + const el = new DocumentFragment(); + linkArray = []; + linkArray.push( + App.UI.DOM.link( + store.title, + () => V.slavesSeen += 1, + [], + store.passage + ) + ); + if (V.cash > _minimumFive) { + linkArray.push( + App.UI.DOM.link( + `(x5)`, + () => { + V.slaveMarket = store.marketType; + V.introType = "bulk"; + V.numSlaves = 5; + }, + [], + `Bulk Slave Generate` + ) + ); + } + if (V.cash > _minimumTen) { + linkArray.push( + App.UI.DOM.link( + `(x10)`, + () => { + V.slaveMarket = store.marketType; + V.introType = "bulk"; + V.numSlaves = 10; + }, + [], + `Bulk Slave Generate` + ) + ); + } + el.append(App.UI.DOM.generateLinksStrip(linkArray)); + return el; + } +} +/* + + <div> + [[The Flesh Heap|Slave Markets][V.slaveMarket = "heap", V.slavesSeen += 1]] | //Broken and discarded slaves. Near useless, but cheap. No longer does bulk orders after complaints.// + </div> + + <div> + if (V.bodyswapAnnounced === 1) { + [[Order a custom husk slave from the Flesh Heap | Husk Slave]] | //Will need to be used on arrival.// + } + </div> + + <div> + if (V.rep > 500) { + [[Kidnappers' Market|Slave Markets][V.slaveMarket = "kidnappers", V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "kidnappers", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "kidnappers", V.introType = "bulk", V.numSlaves = 10]] | + } + //Slaves will tend to be low quality and resistant.// + } + </div> + + <div> + r.push(`''Neighboring Arcologies:'' //The arcology's prosperity and culture will affect slaves who have lived there.//`); + </div> + <<for _i = 0; _i < V.arcologies.length; _i++ >> + if (V.arcologies[_i].direction !== 0) { + <div class="indent"> + <<capture _i>>[[Slaves from|Slave Markets][V.slaveMarket = "neighbor", V.numArcology = _i]] + <</capture>> + r.push(`'' ${V.arcologies[_i].name}''`); + if (V.cash > _minimumFive) { + | << capture _i>>[[(x5)|Bulk Slave Generate][V.slaveMarket = "neighbor", V.introType = "bulk", V.numSlaves = 5, V.numArcology = _i]] + <</capture>> + } + if (V.cash > _minimumTen) { + | << capture _i>>[[(x10)|Bulk Slave Generate][V.slaveMarket = "neighbor", V.introType = "bulk", V.numSlaves = 10, V.numArcology = _i]] + <</capture>> + } + </div> + } + <</for>> + + <div> + if (V.rep > 1000) { + [[Runaway Hunters' Market|Slave Markets][V.slaveMarket = "hunters", V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "hunters", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "hunters", V.introType = "bulk", V.numSlaves = 10]] | + } + //Slaves will tend to be skilled but rebellious.// + } + </div> + + <div> + if (V.rep > 1500) { + [[Indentures Market | Slave Markets][V.slaveMarket = "indentures", V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "indentures", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "indentures", V.introType = "bulk", V.numSlaves = 10]] | + } + //Temporary enslavement and restrictions on treatment.// + } + </div> + + <div> + if (V.rep > 2000) { + [[Raiders' Market|Slave Markets][V.slaveMarket = "raiders", V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "raiders", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "raiders", V.introType = "bulk", V.numSlaves = 10]] | + } + //Slaves will always be sold immediately upon reaching majority.// + } + </div> + + <div> + if (V.pedo_mode === 1 || (V.minimumSlaveAge <= 13 && V.minimumSlaveAge <= V.fertilityAge)) && (V.rep > 3000) { + [[Raiders' Black Market|Slave Markets][V.slaveMarket = "underage raiders", V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "underage raiders", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "underage raiders", V.introType = "bulk", V.numSlaves = 10]] | + } + //Very young slaves.// + } + </div> + + if (V.rep > 4000) { + <div> + [[Trainers' Market|Slave Markets][V.slaveMarket = "trainers", V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "trainers", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "trainers", V.introType = "bulk", V.numSlaves = 10]] | + } + //Slaves will tend to be good quality and obedient.// + </div> + + <div> + if (V.arcologies[0].FSPaternalist === "unset") { + [[Wetware CPUs | Slave Markets][V.slaveMarket = "wetware", V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "wetware", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "wetware", V.introType = "bulk", V.numSlaves = 10]] | + } + //Ruined bodies but keen minds. Requires some TLC, but offers outstanding training at a discount.// + } else { + //The paternalistic nature of your society blocks the abusive Wetware CPU manufactures from operating within your arcology.// + } + </div> + } + + <div> + if (V.rep > 5000) { + V.weeklyMarket = V.prisonCircuit[V.prisonCircuitIndex]; + [[Prisoner Sale|Criminal Market][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = V.weeklyMarket, V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = V.weeklyMarket, V.introType = "bulk", V.numSlaves = 10]] | + } + r.push(`This week`); + switch (V.weeklyMarket) { + case "low tier criminals": + r.push(`a minor prison is selling inmates.`); + //Slaves will tend to be low to mid quality with few redeeming factors.// + case "gangs and smugglers": + r.push(`a major prison is selling hardened criminals.`); + //Slaves will tend to be low quality and difficult but may prove useful once broken.// + case "white collar": + r.push(`a white collar prison is selling inmates.`); + //Slaves will tend to be medium to high quality with a variety of useful backgrounds.// + case "military prison": + r.push(`a military prison is selling inmates.`); + //Slaves will tend to be high quality but defiant.// + } + } + </div> + + if (V.rep > 6000) { + <div> + r.push(`''Slave Schools:'' //High prices; will be young and healthy.//`); + </div> + if (V.seeDicks !== 100) { + <div class="indent"> + [[The Slavegirl School][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "TSS", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "TSS", V.introType = "bulk", V.numSlaves = 10]] | + } + //Straightforward slaves with good training.// + if (V.TSS.schoolSale === 1) { + r.push(` //<span class="yellow">Offering your first purchase at half price this week.</span>//`); + } + </div> + + <div class="indent"> + [[The Utopian Orphanage][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "TUO", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "TUO", V.introType = "bulk", V.numSlaves = 10]] | + } + //Intelligent, unspoiled slaves just past their majority.// + if (V.TUO.schoolSale === 1) { + r.push(` //<span class="yellow">Offering your first purchase at half price this week.</span>//`); + } + </div> + + <div class="indent"> + [[Growth Research Institute][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "GRI", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "GRI", V.introType = "bulk", V.numSlaves = 10]] | + } + //Poorly trained slaves with huge assets.// + if (V.GRI.schoolSale === 1) { + r.push(` //<span class="yellow">Offering your first purchase at half price this week.</span>//`); + } + </div> + + <div class="indent"> + [[St. Claver Preparatory][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "SCP", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "SCP", V.introType = "bulk", V.numSlaves = 10]] | + } + //Slaves with basic training and solid implants.// + if (V.SCP.schoolSale === 1) { + r.push(` //<span class="yellow">Offering your first purchase at half price this week.</span>//`); + } + </div> + + <div class="indent"> + [[The Cattle Ranch][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "TCR", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "TCR", V.introType = "bulk", V.numSlaves = 10]] | + } + //Mentally conditioned free-range cowgirls.// + if (V.TCR.schoolSale === 1) { + r.push(` //<span class="yellow">Offering your first purchase at half price this week.</span>//`); + } + </div> + + <div class="indent"> + [[The Hippolyta Academy][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "HA", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "HA", V.introType = "bulk", V.numSlaves = 10]] | + } + //High quality slaves of powerful physique and refined skills.// + if (V.HA.schoolSale === 1) { + r.push(` //<span class="yellow">Offering your first purchase at half price this week.</span>//`); + } + </div> + } + if (V.seeDicks !== 0) { + <div class="indent"> + [[L'École des Enculées][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "LDE", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "LDE", V.introType = "bulk", V.numSlaves = 10]] | + } + //Slaves optimized and trained for anal.// + if (V.LDE.schoolSale === 1) { + r.push(` //<span class="yellow">Offering your first purchase at half price this week.</span>//`); + } + </div> + + <div class="indent"> + [[The Gymnasium-Academy][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "TGA", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "TGA", V.introType = "bulk", V.numSlaves = 10]] | + } + //Well trained slaves with dicks.// + if (V.TGA.schoolSale === 1) { + r.push(` //<span class="yellow">Offering your first purchase at half price this week.</span>//`); + } + </div> + + <div class="indent"> + [[The Futanari Sisters][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "TFS", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "TFS", V.introType = "bulk", V.numSlaves = 10]] | + } + //Highly skilled, highly feminine hermaphrodites.// + if (V.TFS.schoolSale === 1) { + r.push(` //<span class="yellow">Offering your first purchase at half price this week.</span>//`); + } + </div> + } + <div class="indent"> + [[Nueva Universidad de Libertad][V.slavesSeen += 1]] | + if (V.cash > _minimumFive) { + [[(x5) | Bulk Slave Generate][V.slaveMarket = "NUL", V.introType = "bulk", V.numSlaves = 5]] | + } + if (V.cash > _minimumTen) { + [[(x10) | Bulk Slave Generate][V.slaveMarket = "NUL", V.introType = "bulk", V.numSlaves = 10]] | + } + //Androgynous slaves lacking genitalia.// + if (V.NUL.schoolSale === 1) { + r.push(` //<span class="yellow">Offering your first purchase at half price this week.</span>//`); + } + </div> + } + + <div> + if (V.arcologies[0].FSDegradationist !== "unset") { + //The Slave Shelter does not place slaves into Degradationist arcologies.// + } else if ((V.shelterAbuse > 10)) { + //The Slave Shelter has banned you due to dark rumors about you.// + } else if ((V.shelterAbuse > 5)) { + //The Slave Shelter has banned you due to rumors that you resell its slaves.// + } else if ((V.shelterSlaveBought === 1)) { + >//The Slave Shelter will not offer another slave for placement until next week.// + } else if ((V.rep > 7000)) { + [[Take in a shelter slave | Slave Shelter]] | //Presents charity cases for a nominal fee.// + } + </div> + + <div> + if (V.rep > 8000) { + [[Consult the household liquidator | Household Liquidator][V.slavesSeen += 2]] | //Offers slaves close to one another at a very high price.// + } + </div> + + if (V.rep > 10000) { + <div>[[Place a special order|Custom Slave]] | //Customizable but very expensive.//</div> + <div>[[Place a fulfillment order|JobFulfillmentCenterOrder]] | //Fills leaderships roles for a price.//</div> + } + + if (V.rep > 12000) { + <div>[[Attend an auction of a prestigious slave|Prestigious Slave]] | //Variable and expensive.//</div> + } + + if (V.propOutcome === 1) { + <div>[[Attend an auction of other Elite's stock|Elite Slave]] | //Limited and very expensive.//</div> + } + + if (V.rep > 14000) { + <div>[[Acquire other slaveowners' stock|Special Slave]] | //Variable and expensive.//</div> + } + + <div> + if (V.rep <= 500) { + //You are not reputable enough to buy kidnapped slaves.// + } else if ((V.rep <= 1000)) { + //You are not reputable enough to buy recaptured slaves.// + } else if ((V.rep <= 1500)) { + //You are not reputable enough to buy indentured servants.// + } else if ((V.rep <= 2000)) { + //You are not reputable enough to buy teenaged slaves.// + } else if ((V.pedo_mode === 1 || (V.minimumSlaveAge <= 13 && V.minimumSlaveAge <= V.fertilityAge)) && (V.rep <= 3000)) { + //You are not reputable enough to buy underaged slaves.// + } else if ((V.rep <= 4000)) { + //You are not reputable enough to buy trained slaves.// + } else if ((V.rep <= 5000)) { + //You are not reputable enough to buy prison slaves.// + } else if ((V.rep <= 6000)) { + //You are not reputable enough to acquire fresh school slaves.// + } else if ((V.rep <= 7000)) { + //You are not reputable enough to take in Shelter slaves.// + } else if ((V.rep <= 8000)) { + //You are not reputable enough to consult the household liquidator.// + } else if ((V.rep <= 1000)) { + //You are not reputable enough to order custom slaves.// + } else if ((V.rep <= 12000)) { + //You are not reputable enough to bid on prestigious slaves.// + } else if ((V.rep <= 14000)) { + //You are not reputable enough to acquire other slaveowners' stock.// + } else { + r.push(`You are so reputable that you can access all of the Free Cities' slaving markets.`); + } + </div> + + + <h2>Selling slaves</h2> + <div> + r.push(`While you are at the market, you may want to [[look at your own underperforming slaves|Underperforming Slaves]].`); + </div> + + <h2>Menial Slaves</h2> + + <div> + r.push(`Slave demand is`); + if (V.menialDemandFactor <= -35000) { + r.push(`<span class="red">''extremely low''</span>`); + } else if (V.menialDemandFactor <= -20000) { + r.push(`<span class="red">''very low''</span>`); + } else if (V.menialDemandFactor <= 0) { + r.push(`<span class="yellow">''weak''</span>`); + } else if (V.menialDemandFactor >= 35000) { + r.push(`<span class="green">''extremely high''</span>`); + } else if (V.menialDemandFactor >= 20000) { + r.push(`<span class="green">''very high''</span>`); + } else { + r.push(`<span class="yellow">''strong''</span>`); + } + if (V.deltaDemand > 0) { + r.push(`and <span class="green">''improving''</span>`); + } else if (V.deltaDemand < 0) { + r.push(`and <span class="red">''decreasing''</span>`); + } + if (V.deltaDemand !== 0) { + if (V.demandTimer - V.elapsedDemandTimer < 3) { + r.push(`but it might change soon`); + } + } + if (V.cheatMode) && (V.cheatModeM) { + <span id="menialDemandFactor"> + r.push(`<span class="yellowgreen">Slave Demand</span>`); + | ${V.menialDemandFactor} + </span> + let _tMenialDemandFactor = V.menialDemandFactor; + <<textbox "_tMenialDemandFactor" _tMenialDemandFactor>> + <<link "Apply">> + V.menialDemandFactor = Math.clamp(Math.trunc(Number(_tMenialDemandFactor)),-50000,50000) || V.menialDemandFactor, V.cheater = 1; + <<replace "#menialDemandFactor">> + r.push(`<span class="yellowgreen"> Slave Demand</span>`); + | ${V.menialDemandFactor} + <</replace>> + <</link>> + } + </div> + + <div> + r.push(`Slave supply is`); + if (V.menialSupplyFactor <= -35000) { + r.push(`<span class="green">''extremely low''</span>`); + } else if (V.menialSupplyFactor <= -20000) { + r.push(`<span class="green">''very low''</span>`); + } else if (V.menialSupplyFactor <= 0) { + r.push(`<span class="yellow">''weak''</span>`); + } else if (V.menialSupplyFactor >= 35000) { + r.push(`<span class="red">''extremely high''</span>`); + } else if (V.menialSupplyFactor >= 20000) { + r.push(`<span class="red">''very high''</span>`); + } else { + r.push(`<span class="yellow">''strong''</span>`); + } + if (V.deltaSupply > 0) { + r.push(`and <span class="red">''improving''</span>`); + } else if (V.deltaSupply < 0) { + r.push(`and <span class="green">''decreasing''</span>`); + } + if (V.deltaSupply !== 0) { + if (V.supplyTimer - V.elapsedDemandTimer < 3) { + r.push(`but it might change soon`); + } + } + if (V.cheatMode) && (V.cheatModeM) { + <span id="menialSupplyFactor"> + r.push(`<span class="yellowgreen">Slave Supply</span>`); + | ${V.menialSupplyFactor} + </span> + let _tMenialSupplyFactor = V.menialSupplyFactor; + <<textbox "_tMenialSupplyFactor" _tMenialSupplyFactor>> + <<link "Apply">> + V.menialSupplyFactor = Math.clamp(Math.trunc(Number(_tMenialSupplyFactor)),-50000,50000) || V.menialSupplyFactor, V.cheater = 1; + <<replace "#menialSupplyFactor">> + r.push(`<span class="yellowgreen"> Slave Supply</span>`); + | ${V.menialSupplyFactor} + <</replace>> + <</link>> + } + </div> + + <div> + ${MenialPopCap()} + r.push(`The parts of your arcology you own can house a total of ${num(${ V.PopCap)}} menial slaves.`); + </div> + + let _menialPrice = menialSlaveCost(); + let _bulkMax = V.PopCap-V.menials-V.fuckdolls-V.menialBioreactors; + + <div> + if (V.menials > 1) { + r.push(`You own ${num(Math.trunc(${ V.menials))}} menial slaves.`); + } else if (V.menials > 0) { + r.push(`You own one menial ${slave.`); + }} else { + r.push(`You do not own any menial slaves.`); + } + r.push(`The market price of menials is ${cashFormat(_menialPrice)}.`); + let _optionsBreak = 0; + if (_bulkMax > 0 && V.cash > _menialPrice) { + [[Buy | Buy Slaves][V.menials += 1, V.menialSupplyFactor -= 1, cashX(forceNeg(_menialPrice), "menialTransfer")]] + if (V.cash > (menialSlaveCost(10))*10) { + [[(x10) | Buy Slaves][V.menials += 10, V.menialSupplyFactor -= 10, cashX(forceNeg((menialSlaveCost(10)) * 10), "menialTransfer")]] + } + if (V.cash > (menialSlaveCost(100))*100) { + [[(x100) | Buy Slaves][V.menials += 100, V.menialSupplyFactor -= 100, cashX(forceNeg((menialSlaveCost(100)) * 100), "menialTransfer")]] + } + if (V.cash > (_menialPrice+1)*2) { + let _menialBulkPremium = Math.trunc(1 + Math.clamp(V.cash/_menialPrice,0,_bulkMax)/400); + [[(max)|Buy Slaves][V.menials+=Math.trunc(Math.clamp(V.cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)),V.menialSupplyFactor-=Math.trunc(Math.clamp(V.cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)),cashX(forceNeg(Math.trunc(Math.clamp(V.cash/(_menialPrice+_menialBulkPremium),0,_bulkMax))*(_menialPrice+_menialBulkPremium)), "menialTransfer")]] + } + //Bulk transactions may require offering a premium.// + let _optionsBreak = 1; + } + if (V.menials >= 1) { + if (_optionsBreak) {| + } + [[Sell|Buy Slaves][V.menials-=1,V.menialDemandFactor-=1,cashX(_menialPrice, "menialTransfer")]] + if (V.menials >= 10) { + [[(x10) | Buy Slaves][V.menials -= 10, V.menialDemandFactor -= 10, cashX(((menialSlaveCost(-10)) * 10), "menialTransfer")]] + if (V.menials >= 100) { + [[(x100) | Buy Slaves][V.menials -= 100, V.menialDemandFactor -= 100, cashX(((menialSlaveCost(-100)) * 100), "menialTransfer")]] + } + } + [[(all)|Buy Slaves][cashX((V.menials*(menialSlaveCost(-V.menials))), "menialTransfer"),V.menialDemandFactor-=V.menials,V.menials = 0]] + if (V.arcologies[0].FSPaternalist === "unset") { + if (V.arcadeUpgradeFuckdolls > 0) { + let _fConvertCost = 100; + <div class="indent"> + [[Convert to Fuckdoll|Buy Slaves][V.menials-=1,V.fuckdolls+=1,cashX(forceNeg(_fConvertCost), "menialTransfer")]] + if (V.menials >= 10) { + [[(x10) | Buy Slaves][V.menials -= 10, V.fuckdolls += 10, cashX(forceNeg(10 * (_fConvertCost)), "menialTransfer")]] + if (V.menials >= 100) { + [[(x100) | Buy Slaves][V.menials -= 100, V.fuckdolls += 100, cashX(forceNeg(100 * (_fConvertCost)), "menialTransfer")]] + } + } + [[(all)|Buy Slaves][V.fuckdolls+=V.menials,cashX(forceNeg((_fConvertCost)*(V.menials)), "menialTransfer"),V.menials=0]] + //Conversion costs ${cashFormat(_fConvertCost)} each// + </div> + } + if (V.dairyFeedersUpgrade > 0) { + <div class="indent"> + [[Convert to Bioreactor|Buy Slaves][V.menials-=1,V.menialBioreactors+=1,cashX(-100, "menialTransfer")]] + if (V.menials >= 10) { + [[(x10) | Buy Slaves][V.menials -= 10, V.menialBioreactors += 10, cashX(-1000, "menialTransfer")]] + if (V.menials >= 100) { + [[(x100) | Buy Slaves][V.menials -= 100, V.menialBioreactors += 100, cashX(-10000, "menialTransfer")]] + } + } + [[(all)|Buy Slaves][V.menialBioreactors+=V.menials,cashX(forceNeg(500*V.menials), "menialTransfer"),V.menials=0]] + //Conversion costs ${cashFormat(500)} each// + </div> + } + } + } + </div> + + <div> + if (V.fuckdolls > 1) { + r.push(`You own ${num(Math.trunc(${ V.fuckdolls))}} standard Fuckdolls.`); + } else if (V.fuckdolls > 0) { + r.push(`You own one standard Fuckdoll.`); + } else if (V.arcologies[0].FSPaternalist === "unset") { + r.push(`You do not own any standard Fuckdolls.`); + } + if (V.fuckdolls > 0) || (V.arcologies[0].FSPaternalist === "unset") { + r.push(`The market price of standard Fuckdolls is ${cashFormat(_menialPrice)}.`); + let _optionsBreak = 0; + if (_bulkMax > 0) { + if (V.arcologies[0].FSPaternalist === "unset" && V.cash > _menialPrice) { + [[Buy | Buy Slaves][V.fuckdolls += 1, V.menialSupplyFactor -= 1, cashX(forceNeg(_menialPrice), "fuckdollsTransfer")]] + if (V.cash > menialSlaveCost(10)*10) { + [[(x10) | Buy Slaves][V.fuckdolls += 10, V.menialSupplyFactor -= 10, cashX(forceNeg(menialSlaveCost(10) * 10), "fuckdollsTransfer")]] + } + if (V.cash > menialSlaveCost(100)*100) { + [[(x100) | Buy Slaves][V.fuckdolls += 100, V.menialSupplyFactor -= 100, cashX(forceNeg(menialSlaveCost(100) * 100), "fuckdollsTransfer")]] + } + if (V.cash > ((_menialPrice+1)*2)) { + [[(max) | Buy Slaves][V.fuckdolls += Math.trunc(Math.clamp(V.cash / _menialPrice, 0, _bulkMax)), V.menialSupplyFactor -= Math.trunc(Math.clamp(V.cash / _menialPrice, 0, _bulkMax)), cashX(forceNeg(Math.trunc(Math.clamp(V.cash / _menialPrice, 0, _bulkMax)) * _menialPrice), "fuckdollsTransfer")]] + } + //Bulk transactions may require offering a premium.// + let _optionsBreak = 1; + } + } + if (V.fuckdolls >= 1) { + if (_optionsBreak) {| + } + [[Sell|Buy Slaves][V.fuckdolls-=1,V.menialDemandFactor-=1,cashX(_menialPrice, "fuckdollsTransfer")]] + if (V.fuckdolls >= 10) { + [[(x10) | Buy Slaves][V.fuckdolls -= 10, V.menialDemandFactor -= 10, cashX((menialSlaveCost(-10) * 10), "fuckdollsTransfer")]] + if (V.fuckdolls >= 100) { + [[(x100) | Buy Slaves][V.fuckdolls -= 100, V.menialDemandFactor -= 100, cashX((menialSlaveCost(-100) * 100), "fuckdollsTransfer")]] + } + } + [[(all)|Buy Slaves][cashX(V.fuckdolls*(menialSlaveCost(-V.fuckdolls)), "fuckdollsTransfer"),V.menialDemandFactor-=V.fuckdolls,V.fuckdolls = 0]] + } + } + </div> + + <div> + if (V.menialBioreactors > 1) { + r.push(`You own ${num(Math.trunc(${ V.menialBioreactors))}} standard bioreactors.`); + } else if (V.menialBioreactors > 0) { + r.push(`You own one standard bioreactor.`); + } else if (V.arcologies[0].FSPaternalist === "unset") { + r.push(`You do not own any standard bioreactors.`); + } + if (V.menialBioreactors > 0) || (V.arcologies[0].FSPaternalist === "unset") { + r.push(`The market price of standard bioreactors is ${cashFormat(_menialPrice - 100)}.`); + let _optionsBreak = 0; + if (_bulkMax > 0) { + if (V.arcologies[0].FSPaternalist === "unset" && V.cash > _menialPrice+100) { + [[Buy | Buy Slaves][V.menialBioreactors += 1, V.menialSupplyFactor -= 1, cashX(forceNeg(_menialPrice + 100), "menialBioreactors")]] + if (V.cash > (menialSlaveCost(10)-100)*10) { + [[(x10) | Buy Slaves][V.menialBioreactors += 10, V.menialSupplyFactor -= 10, cashX(forceNeg((menialSlaveCost(10) - 100) * 10), "menialBioreactors")]] + } + if (V.cash > (menialSlaveCost(100)-100)*100) { + [[(x100) | Buy Slaves][V.menialBioreactors += 100, V.menialSupplyFactor -= 100, cashX(forceNeg((menialSlaveCost(100) - 100) * 100), "menialBioreactors")]] + } + if (V.cash > (_menialPrice-99)*2) { + let _bioreactorBulkPremium = Math.trunc(1+ Math.clamp(V.cash/(_menialPrice-99),0,_bulkMax)/400); + [[(max)|Buy Slaves][V.menialBioreactors+=Math.trunc(Math.clamp(V.cash/(_menialPrice-99+_bioreactorBulkPremium),0,_bulkMax)),V.menialSupplyFactor-=Math.trunc(Math.clamp(V.cash/(_menialPrice-99+_bioreactorBulkPremium),0,_bulkMax)),cashX(forceNeg(Math.trunc(Math.clamp(V.cash/(_menialPrice-99+_bioreactorBulkPremium),0,_bulkMax))*(_menialPrice-99+_bioreactorBulkPremium)), "menialBioreactors")]] + } + //Bulk transactions may require offering a premium.// + let _optionsBreak = 1; + } + } + if (V.menialBioreactors >= 1) { + if (_optionsBreak) {| + } + [[Sell|Buy Slaves][V.menialBioreactors-=1,V.menialDemandFactor-=1,cashX((_menialPrice-100), "menialBioreactors")]] + if (V.menialBioreactors >= 10) { + [[(x10) | Buy Slaves][V.menialBioreactors -= 10, V.menialDemandFactor -= 10, cashX(((menialSlaveCost(-10) - 100) * 10), "menialBioreactors")]] + if (V.menialBioreactors >= 100) { + [[(x100) | Buy Slaves][V.menialBioreactors -= 100, V.menialDemandFactor -= 100, cashX(((menialSlaveCost(-100) - 100) * 100), "menialBioreactors")]] + } + } + [[(all)|Buy Slaves][cashX((V.menialBioreactors*(menialSlaveCost(-V.menialBioreactors)-100)), "menialBioreactors"),V.menialDemandFactor-=V.menialBioreactors,V.menialBioreactors = 0]] + } + } + </div>*/ + diff --git a/src/markets/marketData.js b/src/markets/marketData.js new file mode 100644 index 00000000000..8a254bd790c --- /dev/null +++ b/src/markets/marketData.js @@ -0,0 +1,38 @@ +/** + * @typedef {object} market + * @property {string} title + * @property {string} passage + * @property {string} marketType + * @property {string} [note] + * @property {string} [sale] + * @property {boolean} bulkAvailable=true + * @property {boolean} requirements + */ + + +App.Data.Markets = { + /** @type {Array.<market>} */ + starter: [ + { + title: "Corporate Market", + passage: `Corporate Market`, + marketType: "corporate", + get note() { return V.corp.Market === 1 ? `Slaves from your corporation purchased at a discounted rate.` : `Slaves from your corporation`; }, + sale: "", + bulkAvailable: true, + get requirements() { return (V.corp.Incorporated === 1); } + } + ], + neighbors: { + + }, + intermediate: { + + }, + schools: { + + }, + advanced: { + + } +}; diff --git a/src/markets/marketUI.js b/src/markets/marketUI.js index bb31c710d37..734ef4abc82 100644 --- a/src/markets/marketUI.js +++ b/src/markets/marketUI.js @@ -53,7 +53,7 @@ App.UI.buyingFromMarketControls = function(slave, slaveCost) { App.UI.DOM.link( `Buy ${him} and finish your order of slaves`, () => { - cashX(forceNeg(_slaveCost), "slaveTransfer", slave); + cashX(forceNeg(slaveCost), "slaveTransfer", slave); V.newSlaves.push(slave); }, [], diff --git a/src/uncategorized/buySlaves.tw b/src/uncategorized/buySlaves.tw index 0a97145b79b..2d8ac6c562d 100644 --- a/src/uncategorized/buySlaves.tw +++ b/src/uncategorized/buySlaves.tw @@ -2,6 +2,11 @@ <<set $nextButton = "Back">> <<set $nextLink = "Main">> +<h1>DOM</h1> + +<<includeDOM App.UI.buySlaves()>> + +<h1>SC</h1> <<set _minimumFive = minimumSlaveCost() * 5>> <<set _minimumTen = minimumSlaveCost() * 10>> -- GitLab