From 720ee80decfd242ebede9d3144df95bdc28def11 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Sun, 16 Feb 2020 12:45:18 -0500 Subject: [PATCH] set up slaveInteract basic --- src/js/slaveInteract.js | 271 +++++++++++++++++++++++++++++ src/uncategorized/slaveInteract.tw | 191 +------------------- 2 files changed, 273 insertions(+), 189 deletions(-) create mode 100644 src/js/slaveInteract.js diff --git a/src/js/slaveInteract.js b/src/js/slaveInteract.js new file mode 100644 index 00000000000..d4007185155 --- /dev/null +++ b/src/js/slaveInteract.js @@ -0,0 +1,271 @@ +App.UI.SlaveInteract = {}; + +App.UI.SlaveInteract.drugs = function(slave) { + let el = document.createElement('div'); + + const + { + // eslint-disable-next-line no-unused-vars + he, him, his, hers, himself, boy, He, His + } = getPronouns(slave); + const drugOptions = []; + + // <br>Drugs: <strong>slave.drugs</strong>. +// <<link "None">>slave.drugs = "no drugs";<</link>> + if (slave.indentureRestrictions < 2) { + if ( + slave.drugs === "intensive breast injections" || + slave.drugs === "intensive butt injections" || + slave.drugs === "intensive penis enhancement" || + slave.drugs === "intensive testicle enhancement" + ) { + switch (slave.drugs) { + case "intensive breast injections": + drugOptions.push({text: `Moderate`, drug: `breast injections`}); + break; + case "intensive butt injections": + drugOptions.push({text: `Moderate`, drug: `butt injections`}); + break; + case "intensive penis enhancement": + drugOptions.push({text: `Moderate`, drug: `penis enhancement`}); + break; + case "intensive testicle enhancement": + drugOptions.push({text: `Moderate`, drug: `testicle enhancement`}); + break; + } + } else if (slave.drugs === "breast injections" || slave.drugs === "butt injections" || slave.drugs === "penis enhancement" || slave.drugs === "testicle enhancement") { + drugOptions.push({text: `Moderate`, drug: "intensive " + slave.drugs}); + } + if (slave.intelligence > -100 && slave.indentureRestrictions < 1) { + drugOptions.push({text: `Psychosuppressants`, drug: `psychosuppressants`}); + } else { + drugOptions.push({text: `Psychosuppressants`}); + } + if (V.arcologies[0].FSSlaveProfessionalismResearch === 1) { + if (canImproveIntelligence(slave)) { + drugOptions.push({text: `Psychostimulants`, drug: `psychostimulants`}); + } else { + drugOptions.push({text: `Psychostimulants`, drug: ``}); + } + } + if ((slave.boobs < 48000)) { + drugOptions.push({text: `Breasts`, drug: `breast injections`}); + } else { + drugOptions.push({text: `Breasts`, drug: ``}); + } + if (V.arcologies[0].FSAssetExpansionistResearch === 1) { + if ((slave.boobs < 25000)) { + drugOptions.push({text: `Hyper-Breasts`, drug: `hyper breast injections`}); + } else { + drugOptions.push({text: `Hyper Breasts`, drug: ``}); + } + } + if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) { + if ((slave.boobs-slave.boobsImplant-slave.boobsMilk > 100)) { + drugOptions.push({text: `Breast reducers`, drug: `breast redistributors`}); + } else { + drugOptions.push({text: `Breast reducers`, drug: ``}); + } + if ((slave.nipples === "huge" || slave.nipples === "puffy" || slave.nipples === "cute")) { + drugOptions.push({text: `Nipple reducers`, drug: `nipple atrophiers`}); + } else { + drugOptions.push({text: `Nipple reducers`, drug: ``}); + } + } + if ((slave.butt < 9)) { + drugOptions.push({text: `Buttocks`, drug: `butt injections`}); + } else { + drugOptions.push({text: `Buttocks`, drug: ``}); + } + if (V.arcologies[0].FSAssetExpansionistResearch === 1) { + if ((slave.butt < 20)) { + drugOptions.push({text: `Hyper-Buttocks`, drug: `hyper butt injections`}); + } else { + drugOptions.push({text: `Hyper Buttocks`, drug: ``}); + } + } + if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) { + if ((slave.butt-slave.buttImplant > 0)) { + drugOptions.push({text: `Butt reducers`, drug: `butt redistributors`}); + } else { + drugOptions.push({text: `Butt reducers`, drug: ``}); + } + } + if ((slave.lips <= 95) || ((slave.lips <= 85) && (V.seeExtreme !== 1))) { + drugOptions.push({text: `Lips`, drug: `lip injections`}); + } else { + drugOptions.push({text: `Lips`, drug: ``}); + } + if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) { + if (slave.lips-slave.lipsImplant > 0) { + drugOptions.push({text: `Lip reducers`, drug: `lip atrophiers`}); + } else { + drugOptions.push({text: `Lip reducers`, drug: ``}); + } + } + if (V.growthStim === 1) { + if (canImproveHeight(slave)) { + drugOptions.push({text: `Growth Stimulants`, drug: `growth stimulants`}); + } else { + drugOptions.push({text: `Growth Stimulants`, drug: ``}); + } + } + drugOptions.push({text: `Fertility`, drug: `fertility drugs`}); + if ((V.seeHyperPreg === 1) && (slave.indentureRestrictions < 1) && (V.superFertilityDrugs === 1) && (slave.breedingMark !== 1 || V.propOutcome === 0 || V.eugenicsFullControl === 1 || V.arcologies[0].FSRestart === "unset")) { + drugOptions.push({text: `Fertility+`, drug: `super fertility drugs`}); + } + if ((slave.dick > 0)) { + if ((slave.dick < 10)) { + drugOptions.push({text: `Penis enhancement`, drug: `penis enhancement`}); + } else { + drugOptions.push({text: `Penis enhancement`, drug: ``}); + } + } else { + if (slave.clit < 5) { + drugOptions.push({text: `Clitoris enhancement`, drug: `penis enhancement`}); + } else { + drugOptions.push({text: `Clitoris enhancement`, drug: ``}); + } + } + if (V.arcologies[0].FSAssetExpansionistResearch === 1) { + if (slave.dick > 0) { + if (slave.dick < 31) { + drugOptions.push({text: `Hyper penis enhancement`, drug: `hyper penis enhancement`}); + } else { + drugOptions.push({text: `Hyper penis enhancement`, drug: ``}); + } + } else { + if (slave.clit < 5) { + drugOptions.push({text: `Hyper clitoris enhancement`, drug: `penis enhancement`}); + } else { + drugOptions.push({text: `Hyper clitoris enhancement`, drug: ``}); + } + } + } + if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) { + if ((slave.dick > 1)) { + drugOptions.push({text: `Penis reducers`, drug: `penis atrophiers`}); + } else if (slave.dick === 1) { + drugOptions.push({text: `Penis reducers`, drug: ``}); + } + } + if (slave.dick > 0 && slave.dick < 11 && !canAchieveErection(slave) && slave.chastityPenis !== 1) { + drugOptions.push({text: `Erectile dysfunction circumvention`, drug: `priapism agents`}); + } + if ((slave.balls > 0)) { + drugOptions.push({text: `Testicle enhancement`, drug: `testicle enhancement`}); + if (V.arcologies[0].FSAssetExpansionistResearch === 1) { + drugOptions.push({text: `Hyper testicle enhancement`, drug: `hyper testicle enhancement`}); + } + } + if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) { + if ((slave.balls > 1)) { + drugOptions.push({text: `Testicle reducers`, drug: `testicle atrophiers`}); + } else if (slave.balls === 1) { + drugOptions.push({text: `Testicle reducers`, drug: ``}); + } + if ((slave.clit > 0)) { + drugOptions.push({text: `Clitoris reducers`, drug: `clitoris atrophiers`}); + } + if ((slave.labia > 0)) { + drugOptions.push({text: `Labia reducers`, drug: `labia atrophiers`}); + } + } + if (V.arcologies[0].FSYouthPreferentialistResearch === 1) { + if ((slave.visualAge > 18)) { + drugOptions.push({text: `Anti-aging cream`, drug: `anti-aging cream`}); + } else { + drugOptions.push({text: `Anti-aging cream`, drug: ``}); + } + } + drugOptions.push({text: `Steroids`, drug: `steroids`}); + if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) { + if ((slave.weight > -95)) { + drugOptions.push({text: `Weight loss pills`, drug: `appetite suppressors`}); + } else { + drugOptions.push({text: `Weight loss pills`}); + } + } + if (V.precociousPuberty === 1 && V.pubertyHormones === 1 && (slave.breedingMark !== 1 || V.propOutcome === 0 || V.eugenicsFullControl === 1 || V.arcologies[0].FSRestart === "unset")) { + if ((slave.ovaries === 1 || slave.mpreg === 1) && slave.pubertyXX === 0) { + drugOptions.push({text: `Female hormone injections`, drug: `female hormone injections`}); + } + if (slave.balls > 0 && slave.pubertyXY === 0) { + drugOptions.push({text: `Male hormone injections`, drug: `male hormone injections`}); + } + } + drugOptions.push({text: `Hormone enhancers`, drug: `hormone enhancers`}); + drugOptions.push({text: `Hormone blockers`, drug: `hormone blockers`}); + if (slave.boobs > 250 && slave.boobShape !== "saggy" && V.purchasedSagBGone === 1) { + drugOptions.push({text: `Sag-B-Gone breast lifting cream`, drug: `sag-B-gone`}); + } + } + function generateRow(drugArray) { + let row = document.createElement('span'); + for (let i = 0; i < drugArray.length; i++) { + let link; + const separator = document.createTextNode(` | `); + const keys = Object.keys(drugArray[i]); + + // Test to see if there was a problem with the key + for (let j = 0; j < keys.length; j++) { + if (["text", "scene", "goto", "updateSlave", "update", "note"].includes(keys[j])) { + continue; + } else { + drugArray[i].text += " ERROR, THIS SCENE WAS NOT ENTERED CORRECTLY"; + console.log("Trash found while generateRow() was running: " + keys[j] + ": " + drugArray[i][keys[j]]); + break; + } + } + // is it just text? + if (keys.length === 1) { + if (drugArray[i].text) { + link = document.createTextNode(drugArray[i].text); + } else { + console.log(`expected 'text' only, got: ${drugArray[i]}`); + link = document.createTextNode("error, text not found"); + } + } else { + // if slave is already on drug whitetext + let passage = ""; + if (drugArray[i].goto) { + passage = drugArray[i].goto; + } + + // Set up the link + link = App.UI.DOM.link( + drugArray[i].text, + () => { click(drugArray[i]); }, + [], + passage + ); + + // add a note node if required + if (drugArray[i].note) { + let note = document.createTextNode(drugArray[i].note); + note.className = "note"; + link.appendChild(note); + } + } + row.appendChild(link); + if (i < drugArray.length-1) { + row.appendChild(separator); + } + } + + return row; + + function click(drugOption) { + if (drugOption.updateSlave) { + Object.assign(slave, drugOption.updateSlave); + } + if (drugOption.update) { + Object.assign(V, drugOption.update); + } + + SlaveInteractRefreshAll(slave); + return; + } + } + return jQuery('#drugs').empty().append(el); +}; diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw index 00de0b3bc90..b5c779d17f7 100644 --- a/src/uncategorized/slaveInteract.tw +++ b/src/uncategorized/slaveInteract.tw @@ -701,195 +701,8 @@ <</if>> /* CLOSES WARDROBE CHECK */ <br><br>__Physical Regimen:__ -<span id="drugs"> - <br>Drugs: <strong>$activeSlave.drugs</strong>. - <<link "None">><<set $activeSlave.drugs = "no drugs">><<SlaveInteractDrugs>><</link>> - <<if $activeSlave.indentureRestrictions < 2>> - <<if $activeSlave.drugs == "intensive breast injections" || $activeSlave.drugs == "intensive butt injections" || $activeSlave.drugs == "intensive penis enhancement" || $activeSlave.drugs == "intensive testicle enhancement">> - | <<link "Moderate">> - <<switch $activeSlave.drugs>> - <<case "intensive breast injections">> - <<set $activeSlave.drugs = "breast injections">> - <<case "intensive butt injections">> - <<set $activeSlave.drugs = "butt injections">> - <<case "intensive penis enhancement">> - <<set $activeSlave.drugs = "penis enhancement">> - <<case "intensive testicle enhancement">> - <<set $activeSlave.drugs = "testicle enhancement">> - <</switch>> - <<SlaveInteractDrugs>> - <</link>> - <<elseif $activeSlave.drugs == "breast injections" || $activeSlave.drugs == "butt injections" || $activeSlave.drugs == "penis enhancement" || $activeSlave.drugs == "testicle enhancement">> - | <<link "Intensify">> - <<set $activeSlave.drugs = "intensive " + $activeSlave.drugs>> - <<SlaveInteractDrugs>> - <</link>> - <</if>> - <<if ($activeSlave.intelligence > -100) && $activeSlave.indentureRestrictions < 1>> - | <<link "Psychosuppressants">><<set $activeSlave.drugs = "psychosuppressants">><<SlaveInteractDrugs>><</link>> - <<else>> - | Psychosuppressants - <</if>> - <<if $arcologies[0].FSSlaveProfessionalismResearch == 1>> - <<if canImproveIntelligence($activeSlave)>> - | <<link "Psychostimulants">><<set $activeSlave.drugs = "psychostimulants">><<SlaveInteractDrugs>><</link>> - <<else>> - | Psychostimulants - <</if>> - <</if>> - <<if ($activeSlave.boobs < 48000)>> - | <<link "Breasts">><<set $activeSlave.drugs = "breast injections">><<SlaveInteractDrugs>><</link>> - <<else>> - | Breasts - <</if>> - <<if $arcologies[0].FSAssetExpansionistResearch == 1>> - <<if ($activeSlave.boobs < 48000)>> - | <<link "Hyper-Breasts">><<set $activeSlave.drugs = "hyper breast injections">><<SlaveInteractDrugs>><</link>> - <<else>> - | Hyper Breasts - <</if>> - <</if>> - <<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>> - <<if ($activeSlave.boobs-$activeSlave.boobsImplant-$activeSlave.boobsMilk > 100)>> - | <<link "Breast reducers">><<set $activeSlave.drugs = "breast redistributors">><<SlaveInteractDrugs>><</link>> - <<else>> - | Breast reducers - <</if>> - <<if ($activeSlave.nipples == "huge" || $activeSlave.nipples == "puffy" || $activeSlave.nipples == "cute")>> - | <<link "Nipple reducers">><<set $activeSlave.drugs = "nipple atrophiers">><<SlaveInteractDrugs>><</link>> - <<else>> - | Nipple reducers - <</if>> - <</if>> - <<if ($activeSlave.butt < 9)>> - | <<link "Buttocks">><<set $activeSlave.drugs = "butt injections">><<SlaveInteractDrugs>><</link>> - <<else>> - | Buttocks - <</if>> - <<if $arcologies[0].FSAssetExpansionistResearch == 1>> - <<if ($activeSlave.butt < 20)>> - | <<link "Hyper-Buttocks">><<set $activeSlave.drugs = "hyper butt injections">><<SlaveInteractDrugs>><</link>> - <<else>> - | Hyper Buttocks - <</if>> - <</if>> - <<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>> - <<if ($activeSlave.butt-$activeSlave.buttImplant > 0)>> - | <<link "Butt reducers">><<set $activeSlave.drugs = "butt redistributors">><<SlaveInteractDrugs>><</link>> - <<else>> - | Butt reducers - <</if>> - <</if>> - <<if ($activeSlave.lips <= 95) || (($activeSlave.lips <= 85) && ($seeExtreme != 1))>> - | <<link "Lips">><<set $activeSlave.drugs = "lip injections">><<SlaveInteractDrugs>><</link>> - <<else>> - | Lips - <</if>> - <<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>> - <<if ($activeSlave.lips-$activeSlave.lipsImplant > 0)>> - | <<link "Lip reducers">><<set $activeSlave.drugs = "lip atrophiers">><<SlaveInteractDrugs>><</link>> - <<else>> - | Lip reducers - <</if>> - <</if>> - <<if $growthStim == 1>> - <<if canImproveHeight($activeSlave)>> - | <<link "Growth stimulants">><<set $activeSlave.drugs = "growth stimulants">><<SlaveInteractDrugs>><</link>> - <<else>> - | Growth stimulants - <</if>> - <</if>> - | <<link "Fertility">><<set $activeSlave.drugs = "fertility drugs">><<SlaveInteractDrugs>><</link>> - <<if ($seeHyperPreg == 1) && ($activeSlave.indentureRestrictions < 1) && ($superFertilityDrugs == 1) && ($activeSlave.breedingMark != 1 || $propOutcome == 0 || $eugenicsFullControl == 1 || $arcologies[0].FSRestart == "unset")>> - | <<link "Fertility+">><<set $activeSlave.drugs = "super fertility drugs">><<SlaveInteractDrugs>><</link>> - <</if>> - <<if ($activeSlave.dick > 0)>> - <<if ($activeSlave.dick < 10)>> - | <<link "Penis enhancement">><<set $activeSlave.drugs = "penis enhancement">><<SlaveInteractDrugs>><</link>> - <<else>> - | Penis enhancement - <</if>> - <<else>> - <<if ($activeSlave.clit < 5)>> - | <<link "Clitoris enhancement">><<set $activeSlave.drugs = "penis enhancement">><<SlaveInteractDrugs>><</link>> - <<else>> - | Clitoris enhancement - <</if>> - <</if>> - <<if $arcologies[0].FSAssetExpansionistResearch == 1>> - <<if ($activeSlave.dick > 0)>> - <<if ($activeSlave.dick < 31)>> - | <<link "Hyper penis enhancement">><<set $activeSlave.drugs = "hyper penis enhancement">><<SlaveInteractDrugs>><</link>> - <<else>> - | Hyper penis enhancement - <</if>> - <<else>> - <<if ($activeSlave.clit < 5)>> - | <<link "Hyper clitoris enhancement">><<set $activeSlave.drugs = "penis enhancement">><<SlaveInteractDrugs>><</link>> - <<else>> - | Hyper clitoris enhancement - <</if>> - <</if>> - <</if>> - <<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>> - <<if ($activeSlave.dick > 1)>> - | <<link "Penis reducers">><<set $activeSlave.drugs = "penis atrophiers">><<SlaveInteractDrugs>><</link>> - <<elseif $activeSlave.dick == 1>> - | Penis reducers - <</if>> - <</if>> - <<if $activeSlave.dick > 0 && $activeSlave.dick < 11 && !canAchieveErection($activeSlave) && $activeSlave.chastityPenis != 1>> - | <<link "Erectile dysfunction circumvention">><<set $activeSlave.drugs = "priapism agents">><<SlaveInteractDrugs>><</link>> - <</if>> - <<if ($activeSlave.balls > 0)>> - | <<link "Testicle enhancement">><<set $activeSlave.drugs = "testicle enhancement">><<SlaveInteractDrugs>><</link>> - <<if $arcologies[0].FSAssetExpansionistResearch == 1>> - | <<link "Hyper testicle enhancement">><<set $activeSlave.drugs = "hyper testicle enhancement">><<SlaveInteractDrugs>><</link>> - <</if>> - <</if>> - <<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>> - <<if ($activeSlave.balls > 1)>> - | <<link "Testicle reducers">><<set $activeSlave.drugs = "testicle atrophiers">><<SlaveInteractDrugs>><</link>> - <<elseif $activeSlave.balls == 1>> - | Testicle reducers - <</if>> - <<if ($activeSlave.clit > 0)>> - | <<link "Clitoris reducers">><<set $activeSlave.drugs = "clitoris atrophiers">><<SlaveInteractDrugs>><</link>> - <</if>> - <<if $activeSlave.labia > 0 && $activeSlave.vagina > -1>> - | <<link "Labia reducers">><<set $activeSlave.drugs = "labia atrophiers">><<SlaveInteractDrugs>><</link>> - <</if>> - <</if>> - <<if $arcologies[0].FSYouthPreferentialistResearch == 1>> - <<if ($activeSlave.visualAge > 18)>> - | <<link "Anti-aging cream">><<set $activeSlave.drugs = "anti-aging cream">><<SlaveInteractDrugs>><</link>> - <<else>> - | Anti-aging cream - <</if>> - <</if>> - | <<link "Steroids">><<set $activeSlave.drugs = "steroids">><<SlaveInteractDrugs>><</link>> - <<if $arcologies[0].FSSlimnessEnthusiastResearch == 1>> - <<if ($activeSlave.weight > -95)>> - | <<link "Weight loss pills">><<set $activeSlave.drugs = "appetite suppressors">><<SlaveInteractDrugs>><</link>> - <<else>> - | Weight loss pills - <</if>> - <</if>> - <<if $precociousPuberty == 1 && $pubertyHormones == 1 && ($activeSlave.breedingMark != 1 || $propOutcome == 0 || $eugenicsFullControl == 1 || $arcologies[0].FSRestart == "unset")>> - <<if ($activeSlave.ovaries == 1 || $activeSlave.mpreg == 1) && $activeSlave.pubertyXX == 0>> - | <<link "Female hormone injections">><<set $activeSlave.drugs = "female hormone injections">><<SlaveInteractDrugs>><</link>> - <</if>> - <<if $activeSlave.balls > 0 && $activeSlave.pubertyXY == 0>> - | <<link "Male hormone injections">><<set $activeSlave.drugs = "male hormone injections">><<SlaveInteractDrugs>><</link>> - <</if>> - <</if>> - | <<link "Hormone enhancers">><<set $activeSlave.drugs = "hormone enhancers">><<SlaveInteractDrugs>><</link>> - | <<link "Hormone blockers">><<set $activeSlave.drugs = "hormone blockers">><<SlaveInteractDrugs>><</link>> - <<if $activeSlave.boobs > 250 && $activeSlave.boobShape != "saggy" && $purchasedSagBGone == 1>> - | <<link "Sag-B-Gone breast lifting cream">><<set $activeSlave.drugs = "sag-B-gone">><<SlaveInteractDrugs>><</link>> - <</if>> - <</if>> -</span> +<span id="drugs"></span> +<script>App.UI.SlaveInteract.Drugs(V.activeSlave)</script> <br> -- GitLab