diff --git a/src/markets/specificMarkets/huskSlave.js b/src/markets/specificMarkets/huskSlave.js new file mode 100644 index 0000000000000000000000000000000000000000..9dcb8f92a915a51a986b330979d4a9630fca58d3 --- /dev/null +++ b/src/markets/specificMarkets/huskSlave.js @@ -0,0 +1,248 @@ +App.Markets["Husk Slave"] = function() { + const el = new DocumentFragment(); + let r = []; + V.encyclopedia = "Kidnapped Slaves"; + + if (V.huskSlaveOrdered === 0) { + r.push(`You lay out a new order for a braindead slave to be put aside for your use.`); + } else { + r.push(`You review your posted husk order.`); + } + r.push(`Your order requests a body with the following characteristics:`); + + App.UI.DOM.appendNewElement("p", el, r.join(" ")); + + setupHusk(); + el.append(age()); + el.append(sex()); + el.append(nationality()); + el.append(race()); + el.append(virginity()); + App.UI.DOM.appendNewElement("h2", el, "Reservations"); + el.append(reserve()); + return el; + + function setupHusk() { + if (V.huskSlave.dick === 0 && V.huskSlave.vagina === -1) { + V.huskSlave.vagina = 0; + } + V.huskSlave.age = Math.clamp(V.huskSlave.age, V.minimumSlaveAge, V.retirementAge - 1); + } + function age() { + const p = document.createElement("p"); + App.UI.DOM.appendNewElement("div", p, "Age:"); + App.UI.DOM.appendNewElement( + "div", + p, + App.UI.DOM.makeTextBox( + V.huskSlave.age, + v => { + V.huskSlave.age = v; + refresh(); + }, + true + ) + ); + return p; + } + function sex() { + const p = document.createElement("p"); + p.append("Sex: "); + if (V.huskSlave.sex === 1) { + p.append(`Female.`); + } else if (V.huskSlave.sex === 2) { + p.append(`Male.`); + } else if (V.huskSlave.sex === 3) { + p.append(`Futanari.`); + } + const choices = { + Female: 1, + Male: 2, + Both: 3 + }; + + const linkArray = []; + for (const choice in choices) { + if (V.huskSlave.sex === choices[choice]) { + linkArray.push( + App.UI.DOM.disabledLink( + choice, + ["current selection"] + ) + ); + } else { + linkArray.push( + App.UI.DOM.link( + choice, + () => { + V.huskSlave.sex = choices[choice]; + refresh(); + } + ) + ); + } + } + App.UI.DOM.appendNewElement("div", p, App.UI.DOM.generateLinksStrip(linkArray)); + return p; + } + + function nationality() { + const p = document.createElement("p"); + App.UI.DOM.appendNewElement("div", p, "Nationality:"); + App.UI.DOM.appendNewElement( + "div", + p, + App.UI.DOM.makeTextBox( + V.huskSlave.nationality, + v => { + V.huskSlave.nationality = v; + refresh(); + }, + ) + ); + return p; + } + + function race() { + const p = document.createElement("p"); + App.UI.DOM.appendNewElement("div", p, "Race: "); + App.UI.DOM.appendNewElement( + "div", + p, + App.UI.DOM.makeTextBox( + V.huskSlave.race, + v => { + V.huskSlave.race = v; + refresh(); + }, + ) + ); + + const linkArray = []; + for (let i = 0; i < App.Data.misc.filterRaces.length; i++) { + if (V.huskSlave.race === App.Data.misc.filterRacesLowercase[i]) { + linkArray.push( + App.UI.DOM.disabledLink( + App.Data.misc.filterRaces[i], + ["current selection"] + ) + ); + } else { + linkArray.push( + App.UI.DOM.link( + App.Data.misc.filterRaces[i], + () => { + V.huskSlave.race = App.Data.misc.filterRacesLowercase[i]; + refresh(); + } + ) + ); + } + } + App.UI.DOM.appendNewElement("div", p, App.UI.DOM.generateLinksStrip(linkArray)); + return p; + } + function virginity() { + const p = document.createElement("p"); + p.append("Virginity: "); + if (V.huskSlave.sex === 1) { + p.append(`Female.`); + } else if (V.huskSlave.sex === 2) { + p.append(`Male.`); + } else if (V.huskSlave.sex === 3) { + p.append(`Futanari.`); + } + const choices = { + Important: 0, + "Not Important": 1, + }; + p.append(links(choices, V.huskSlave.virgin)); + const linkArray = []; + for (const choice in choices) { + if (V.huskSlave.virgin === choices[choice]) { + linkArray.push( + App.UI.DOM.disabledLink( + choice, + ["current selection"] + ) + ); + } else { + linkArray.push( + App.UI.DOM.link( + choice, + () => { + V.huskSlave.virgin = choices[choice]; + refresh(); + } + ) + ); + } + } + App.UI.DOM.appendNewElement("div", p, App.UI.DOM.generateLinksStrip(linkArray)); + return p; + } + + function reserve() { + const p = document.createElement("p"); + App.UI.DOM.appendNewElement("div", p, `Reserving a body will cost ${cashFormat(10000)} up front. Canceling an order will refund your money; however, if a delivered body is rejected, your money will not be refunded. `); + + if (V.huskSlaveOrdered === 1) { + p.append( + App.UI.DOM.link( + `Withdraw body order`, + () => { + V.huskSlaveOrdered = 0; + cashX(10000, "slaveTransfer"); + }, + [], + "Main" + ) + ); + } else if (V.cash < 10000) { + App.UI.DOM.appendNewElement("span", p, `You lack the credits to place a body reservation.`, "note"); + } else { + p.append( + App.UI.DOM.link( + `Post body order`, + () => { + V.huskSlaveOrdered = 1; + cashX(-10000, "slaveTransfer"); + }, + [], + "Main" + ) + ); + } + + return p; + } + + function links(choices, global) { + const linkArray = []; + for (const choice in choices) { + if (global === choices[choice]) { + linkArray.push( + App.UI.DOM.disabledLink( + choice, + ["current selection"] + ) + ); + } else { + linkArray.push( + App.UI.DOM.link( + choice, + () => { + global = choices[choice]; + refresh(); + } + ) + ); + } + } + return App.UI.DOM.makeElement("div", App.UI.DOM.generateLinksStrip(linkArray)); + } + + function refresh() { + jQuery("#slave-markets").empty().append(App.Markets["Husk Slave"]); + } +};