diff --git a/src/markets/specificMarkets/prestigiousSlave.js b/src/markets/specificMarkets/prestigiousSlave.js index 32faab46d332f3a8bb45965688e816a7c7a57332..1cc36d988025870fe9d772bf524a7c45266d43d6 100644 --- a/src/markets/specificMarkets/prestigiousSlave.js +++ b/src/markets/specificMarkets/prestigiousSlave.js @@ -1,46 +1,70 @@ App.Markets["Prestigious Slave"] = function() { - const el = new DocumentFragment(); + let slave; + let seed; + const el = document.createElement("span"); + let options = [ + "porn star", + "trophy wife", + "sports star", + "young model", + "albino", + "old-timer", + "b-list actress", + "politician", + "princess", + "arcology", + "streamer", + ]; + const dickOptions = [ + "d herm", + "d young herm", + "d pornstar", + "d trophy husband", + "d sports star", + "d young model", + "d albino", + "d old-timer", + "d b-list actress", + "d politician", + "d princess", + "d arcology", + "d streamer", + ]; App.UI.DOM.appendNewElement("p", el, `You check to see if any especially prestigious slaves are on auction.`); if (V.prestigeAuctioned === 1) { App.UI.DOM.appendNewElement("span", el, ` There are none available right now, but there probably will be next week.`); } else { V.prestigeAuctioned = 1; + seed = jsEither(Math.random() * 100 < V.seeDicks ? dickOptions : options); + el.append(passage()); + } + return el; - const options = [ - "porn star", - "trophy wife", - "sports star", - "young model", - "albino", - "old-timer", - "b-list actress", - "politician", - "princess", - "arcology", - "streamer", - ]; - const dickOptions = [ - "d herm", - "d young herm", - "d pornstar", - "d trophy husband", - "d sports star", - "d young model", - "d albino", - "d old-timer", - "d b-list actress", - "d politician", - "d princess", - "d arcology", - "d streamer", - ]; - const slave = makeSlave(jsEither(Math.random() * 100 < V.seeDicks ? dickOptions : options)); - + function passage() { + const el = document.createElement("span"); + if (V.cheatMode || V.debugMode) { + if (V.seeDicks > 0) { + options = options.concat(...dickOptions); + } + const slaveDropdown = App.UI.DOM.appendNewElement("select", el); + for (const o of options) { + const choice = App.UI.DOM.appendNewElement("option", slaveDropdown, o); + choice.value = o; + if (seed === o) { + choice.selected = true; + } + } + slaveDropdown.onchange = () => { + const O = slaveDropdown.options[slaveDropdown.selectedIndex]; + seed = O.value; + $(el).empty(); + passage(); + }; + } + slave = makeSlave(seed); const cost = slaveCost(slave); - App.UI.DOM.appendNewElement("p", el, `It will take ${cashFormat(cost)} to win the auction.`); - if (V.cash >= cost) { App.UI.DOM.appendNewElement( "p", @@ -58,8 +82,9 @@ App.Markets["Prestigious Slave"] = function() { } el.append(App.Desc.longSlave(slave, {market: "generic"})); + return el; } - return el; + function makeSlave(choice) { let slave;