diff --git a/src/Mods/SecExp/buildings/secBarracks.tw b/src/Mods/SecExp/buildings/secBarracks.tw index 7a4a5b2b715a5bfd3e9a342a2736e9cc68b6ac4a..6d17d6903ad45bf7681209abb1d2e5d9c21bd693 100644 --- a/src/Mods/SecExp/buildings/secBarracks.tw +++ b/src/Mods/SecExp/buildings/secBarracks.tw @@ -229,26 +229,7 @@ Your current maximum number of units is <<print App.SecExp.battle.maxUnits()>> ( <</if>> <<includeDOM App.SecExp.unit.bulkUpgrade($SecExp.units.slaves.squads)>> - <<set _popCap = menialPopCap()>> - <<set _menialPrice = menialSlaveCost()>> - <<set _bulkMax = _popCap.value-$menials-$fuckdolls-$menialBioreactors>> - <<if $cash > _menialPrice>> - <<if _bulkMax > 0>> <br> - [[Buy|secBarracks][$menials+=1,$menialSupplyFactor-=1,cashX(forceNeg(_menialPrice), "menialTransfer")]] - <<if $cash > (menialSlaveCost(10))*10>> - [[(x10)|secBarracks][$menials+=10,$menialSupplyFactor-=10,cashX(forceNeg((menialSlaveCost(10))*10), "menialTransfer")]] - <</if>> - <<if $cash > (menialSlaveCost(100))*100>> - [[(x100)|secBarracks][$menials+=100,$menialSupplyFactor-=100,cashX(forceNeg((menialSlaveCost(100))*100), "menialTransfer")]] - <</if>> - <<if $cash > (_menialPrice+1)*2>> - <<set _menialBulkPremium = Math.trunc(1 + Math.clamp($cash/_menialPrice,0,_bulkMax)/400)>> - [[(max)|secBarracks][$menials+=Math.trunc(Math.clamp($cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)),$menialSupplyFactor-=Math.trunc(Math.clamp($cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)),cashX(forceNeg(Math.trunc(Math.clamp($cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)*(_menialPrice+_menialBulkPremium))), "menialTransfer")]] - <</if>> - //Bulk transactions may require offering a premium.// - <</if>> - <</if>> - <br> + <br> <<includeDOM App.UI.market({menialWorkersOnly: true})>> <<set _sL = $SecExp.units.slaves.squads.length>> <<for _i = 0; _i < _sL; _i++>> <<capture _i>> diff --git a/src/Mods/SecExp/buildings/securityHQ.tw b/src/Mods/SecExp/buildings/securityHQ.tw index 5fc43dfb626dd01fe8da8e579f1ed03eb1dc7993..099ed1f0a64019955a22192677ac99bb820b1461 100644 --- a/src/Mods/SecExp/buildings/securityHQ.tw +++ b/src/Mods/SecExp/buildings/securityHQ.tw @@ -17,30 +17,7 @@ The security headquarters stand in front of you. Innumerable screens flood with <<else>> <br>You have enough slaves to man all security systems. <</if>> -<<set _popCap = menialPopCap()>> -<<set _menialPrice = menialSlaveCost()>> -<<set _bulkMax = _popCap.value-$menials-$fuckdolls-$menialBioreactors>> -<<if $cash > _menialPrice>> - <<if _bulkMax > 0 || $menials+$fuckdolls+$menialBioreactors == 0>> - <br>[[Buy|securityHQ][$menials++,$menialSupplyFactor -= 1, cashX(-_menialPrice, "menialTransfer")]] - <<if $cash > (menialSlaveCost(5))*5>> - [[(x5)|securityHQ][$menials += 5,$menialSupplyFactor -= 5, cashX(-(menialSlaveCost(5)*5), "menialTransfer")]] - <</if>> - <<if $cash > (menialSlaveCost(10))*10>> - [[(x10)|securityHQ][$menials += 10,$menialSupplyFactor -= 10, cashX(-(menialSlaveCost(10)*10), "menialTransfer")]] - <</if>> - <<if $cash > (menialSlaveCost(100))*100>> - [[(x100)|securityHQ][$menials += 100,$menialSupplyFactor -= 100, cashX(-(menialSlaveCost(100)*100), "menialTransfer")]] - <</if>> - <<if $cash > (_menialPrice+1)*2>> - <<set _menialBulkPremium = Math.trunc(1 + Math.clamp($cash/_menialPrice,0,_bulkMax)/400)>> - <<set _maxMenials = Math.clamp($cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)>> - <<set _finalMaxCost = Math.trunc(_maxMenials*(_menialPrice+_menialBulkPremium))>> - [[(max)|securityHQ][$menials += Math.trunc(_maxMenials), $menialSupplyFactor -= Math.trunc(_maxMenials), cashX(-_finalMaxCost, "menialTransfer")]] - <</if>> - //Bulk transactions may require offering a premium. The remaining slaves will be more efficient in dealing with crime.// - <</if>> -<</if>> +<br> <<includeDOM App.UI.market({menialWorkersOnly: true})>> <<set _optionsList = [1, 5, 10, 100, 500, 1000]>> <<if $menials > 0>> diff --git a/src/Mods/SecExp/buildings/weaponsManufacturing.tw b/src/Mods/SecExp/buildings/weaponsManufacturing.tw index f7b69551f60bc78188d964c5b2ceee618b8dba9f..cfccb3ccf3db3783c2f5df5f2ca7a683f55b61d6 100644 --- a/src/Mods/SecExp/buildings/weaponsManufacturing.tw +++ b/src/Mods/SecExp/buildings/weaponsManufacturing.tw @@ -32,26 +32,7 @@ many small old world nations as the advanced technology that Free Cities have av <br><br>There are no assigned menial slaves here. The spaces is manned exclusively by low rank citizens. <</if>> You own <<print num($menials)>> free menial slaves. This manufacturing complex can house 500 at most, with <<print 500 - $SecExp.buildings.weapManu.menials>> free slots. -<br> -<<set _popCap = menialPopCap()>> -<<set _menialPrice = menialSlaveCost()>> -<<set _bulkMax = _popCap.value-$menials-$fuckdolls-$menialBioreactors>> -<<if $cash > _menialPrice>> - <<if _bulkMax > 0 || $menials+$fuckdolls+$menialBioreactors == 0>> - [[Buy|weaponsManufacturing][$menials+=1,$menialSupplyFactor-=1,cashX(forceNeg(_menialPrice), "menialTransfer")]] - <<if $cash > (menialSlaveCost(10))*10>> - [[(x10)|weaponsManufacturing][$menials+=10,$menialSupplyFactor-=10,cashX(forceNeg((menialSlaveCost(10))*10), "menialTransfer")]] - <</if>> - <<if $cash > (menialSlaveCost(100))*100>> - [[(x100)|weaponsManufacturing][$menials+=100,$menialSupplyFactor-=100,cashX(forceNeg((menialSlaveCost(100))*100), "menialTransfer")]] - <</if>> - <<if $cash > (_menialPrice+1)*2>> - <<set _menialBulkPremium = Math.trunc(1 + Math.clamp($cash/_menialPrice,0,_bulkMax)/400)>> - [[(max)|weaponsManufacturing][$menials+=Math.trunc(Math.clamp($cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)),$menialSupplyFactor-=Math.trunc(Math.clamp($cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)),cashX(forceNeg(Math.trunc(Math.clamp($cash/(_menialPrice+_menialBulkPremium),0,_bulkMax)*(_menialPrice+_menialBulkPremium))), "menialTransfer")]] - <</if>> - //Bulk transactions may require offering a premium.// - <</if>> -<</if>> +<br> <<includeDOM App.UI.market({menialWorkersOnly: true})>> <<if $SecExp.buildings.weapManu.menials < 500>> <<if $menials >= 1>> diff --git a/src/markets/theMarket/market.js b/src/markets/theMarket/market.js index d2194982a356d2de735203f8a9e74d58d81f03c9..71f3d30fb1e634e6d8d52d21ff549b8a7142f108 100644 --- a/src/markets/theMarket/market.js +++ b/src/markets/theMarket/market.js @@ -1,18 +1,21 @@ -App.UI.market = function() { +App.UI.market = function(menialWorkersOnly = null) { const span = document.createElement("span"); span.id = "slave-markets"; - - span.append(App.UI.buySlaves()); - span.append(App.UI.sellSlaves()); + if (!menialWorkersOnly) { + span.append(App.UI.buySlaves()); + span.append(App.UI.sellSlaves()); + } const menialSpan = document.createElement("span"); menialSpan.id = "menial-span"; - menialSpan.append(App.UI.tradeMenials()); + menialSpan.append(App.UI.tradeMenials(menialWorkersOnly)); span.append(menialSpan); - const menialTransactionResult = document.createElement("div"); - menialTransactionResult.id = "menial-transaction-result"; - span.append(menialTransactionResult); + if (!menialWorkersOnly) { + const menialTransactionResult = document.createElement("div"); + menialTransactionResult.id = "menial-transaction-result"; + span.append(menialTransactionResult); + } return span; }; diff --git a/src/markets/theMarket/tradeMenials.js b/src/markets/theMarket/tradeMenials.js index ccf08f3929c399876ee8d1970e18acf3fb260632..a3aee91a10f30934c94031fee3748736d138769f 100644 --- a/src/markets/theMarket/tradeMenials.js +++ b/src/markets/theMarket/tradeMenials.js @@ -1,28 +1,33 @@ -App.UI.tradeMenials = function() { +App.UI.tradeMenials = function(menialWorkersOnly) { const el = new DocumentFragment(); const menialPrice = menialSlaveCost(); const popCap = menialPopCap(); let bulkMax; let linkArray; + + if (!menialWorkersOnly) { + App.UI.DOM.appendNewElement("h2", el, "Menial Slaves"); - App.UI.DOM.appendNewElement("h2", el, "Menial Slaves"); + el.append(slaveDemand()); + el.append(slaveSupply()); - el.append(slaveDemand()); - el.append(slaveSupply()); - - App.UI.DOM.appendNewElement("div", el, popCap.text); + App.UI.DOM.appendNewElement("div", el, popCap.text); + } bulkMax = popCap.value - V.menials - V.fuckdolls - V.menialBioreactors; - - App.UI.DOM.appendNewElement("div", el, `The parts of your arcology you own can house a total of ${num(popCap.value)} menial slaves.`); + 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.`); + } el.append(menialTrading()); - if (V.arcologies[0].FSPaternalist === "unset") { - el.append(fuckDollConversion()); - el.append(fuckDollTrading()); - } + if (!menialWorkersOnly) { + if (V.arcologies[0].FSPaternalist === "unset") { + el.append(fuckDollConversion()); + el.append(fuckDollTrading()); + } - el.append(bioreactorTrading()); + el.append(bioreactorTrading()); + } return el; @@ -145,14 +150,16 @@ App.UI.tradeMenials = function() { function menialTrading() { const el = new DocumentFragment(); let div = document.createElement("div"); - if (V.menials > 1) { - el.append(`You own ${num(Math.trunc(V.menials))} menial slaves.`); - } else if (V.menials > 0) { - el.append(`You own one menial slave.`); - } else { - el.append(`You do not own any menial slaves.`); + if (!menialWorkersOnly) { + if (V.menials > 1) { + el.append(`You own ${num(Math.trunc(V.menials))} menial slaves.`); + } else if (V.menials > 0) { + el.append(`You own one menial slave.`); + } else { + el.append(`You do not own any menial slaves.`); + } + el.append(` The market price of menials is ${cashFormat(menialPrice)}.`); } - el.append(` The market price of menials is ${cashFormat(menialPrice)}.`); if (bulkMax > 0 && V.cash > menialPrice) { div = document.createElement("div"); @@ -163,6 +170,9 @@ App.UI.tradeMenials = function() { V.menialSupplyFactor -= number; cashX(value, "menialTransfer"); jQuery("#menial-transaction-result").empty().append(App.UI.DOM.cashFormat(value)); + if (menialWorkersOnly) { + Engine.play(passage()); + } }; linkArray.push( @@ -170,10 +180,13 @@ App.UI.tradeMenials = function() { "Buy", () => { buySomeMenials(1); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); } ) ); + if (V.cash > (menialSlaveCost(5)) * 5) { + makeLink(5, buySomeMenials); + } if (V.cash > (menialSlaveCost(10)) * 10) { makeLink(10, buySomeMenials); } @@ -189,7 +202,7 @@ App.UI.tradeMenials = function() { buySomeMenials( Math.trunc(Math.clamp(V.cash / (menialPrice + _menialBulkPremium), 0, bulkMax)) ); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); }, ) ); @@ -199,7 +212,7 @@ App.UI.tradeMenials = function() { el.append(div); } - if (V.menials > 0) { + if (!menialWorkersOnly && V.menials > 0) { linkArray = []; const sellSomeMenials = function(number = 1) { const value = menialSlaveCost(number) * number; @@ -213,16 +226,19 @@ App.UI.tradeMenials = function() { "Sell", () => { sellSomeMenials(1); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); } ) ); + if (V.menials >= 5) { + makeLink(5, sellSomeMenials); + } if (V.menials >= 10) { makeLink(10, sellSomeMenials); - if (V.menials >= 100) { - makeLink(100, sellSomeMenials); - } + } + if (V.menials >= 100) { + makeLink(100, sellSomeMenials); } linkArray.push( App.UI.DOM.link( @@ -230,7 +246,7 @@ App.UI.tradeMenials = function() { () => { sellSomeMenials(V.menials); V.menials = 0; // Be quite sure. - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); }, ) ); @@ -259,7 +275,7 @@ App.UI.tradeMenials = function() { "Convert to Fuckdoll", () => { convertSomeMenialsToFuckdolls(1); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); } ) ); @@ -276,7 +292,7 @@ App.UI.tradeMenials = function() { () => { convertSomeMenialsToFuckdolls(V.menials); V.menials = 0; // Be really sure - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); }, ) ); @@ -300,7 +316,7 @@ App.UI.tradeMenials = function() { "Convert to Bioreactor", () => { convertSomeMenialsToBioreactors(1); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); } ) ); @@ -317,7 +333,7 @@ App.UI.tradeMenials = function() { () => { convertSomeMenialsToBioreactors(V.menials); V.menials = 0; // Be really sure - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); }, ) ); @@ -359,7 +375,7 @@ App.UI.tradeMenials = function() { "Buy", () => { buySomeFuckdolls(1); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); } ) ); @@ -378,7 +394,7 @@ App.UI.tradeMenials = function() { buySomeFuckdolls( Math.trunc(Math.clamp(V.cash / (menialPrice + _menialBulkPremium), 0, bulkMax)) ); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); }, ) ); @@ -402,7 +418,7 @@ App.UI.tradeMenials = function() { "Sell", () => { sellSomeFuckdolls(1); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); } ) ); @@ -419,7 +435,7 @@ App.UI.tradeMenials = function() { () => { sellSomeFuckdolls(V.fuckdolls); V.fuckdolls = 0; // Be quite sure. - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); }, ) ); @@ -459,7 +475,7 @@ App.UI.tradeMenials = function() { "Buy", () => { buySomeBioreactors(1); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); } ) ); @@ -478,7 +494,7 @@ App.UI.tradeMenials = function() { buySomeBioreactors( Math.trunc(Math.clamp(V.cash / (menialPrice - 99 + _bioreactorBulkPremium), 0, bulkMax)) ); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); }, ) ); @@ -502,7 +518,7 @@ App.UI.tradeMenials = function() { "Sell", () => { sellSomeBioreactors(1); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); } ) ); @@ -519,7 +535,7 @@ App.UI.tradeMenials = function() { () => { sellSomeBioreactors(V.menialBioreactors); V.menialBioreactors = 0; // Be quite sure. - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); }, ) ); @@ -542,7 +558,7 @@ App.UI.tradeMenials = function() { `x${number}`, () => { runMe(number); - jQuery("#menial-span").empty().append(App.UI.tradeMenials()); + jQuery("#menial-span").empty().append(App.UI.tradeMenials(menialWorkersOnly)); } ) );