From af8cd8c9965d140892a0104d8c4d2d0fd7cdd213 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Tue, 18 Feb 2020 10:59:43 -0500 Subject: [PATCH] bellyAccessory --- src/js/itemAvailability.js | 2 + src/js/wardrobeUse.js | 59 ++++++++++++++++++++++++++++++ src/uncategorized/slaveInteract.tw | 3 ++ 3 files changed, 64 insertions(+) diff --git a/src/js/itemAvailability.js b/src/js/itemAvailability.js index c50d1231077..6444c19b343 100644 --- a/src/js/itemAvailability.js +++ b/src/js/itemAvailability.js @@ -223,6 +223,8 @@ window.isClothingAccessible = (function() { } else if (category === "collar") { niceDB = App.Data.misc.niceCollars; harshDB = App.Data.misc.harshCollars; + } else if (category === "bellyAccessory") { + niceDB = App.Data.misc.bellyAccessories; } else { niceDB = App.Data.misc[category]; } diff --git a/src/js/wardrobeUse.js b/src/js/wardrobeUse.js index 3546b264114..f50c22fb443 100644 --- a/src/js/wardrobeUse.js +++ b/src/js/wardrobeUse.js @@ -288,6 +288,65 @@ App.UI.Wardrobe.legAccessory = function(slave) { return jQuery('#legAccessory').empty().append(el); }; +App.UI.Wardrobe.bellyAccessory = function(slave) { + if (slave.fuckdoll !== 0) { + return; + } + + const + { + // eslint-disable-next-line no-unused-vars + he, him, his, hers, himself, boy, He, His + } = getPronouns(slave); + + let choiceOptionsArray= []; + choiceOptionsArray.push({text: `None`, updateSlave: {bellyAccessory: `none`}}); + + let optionsArray= []; + + let clothingOption; + App.Data.misc.bellyAccessories.forEach(item => { + clothingOption = { + text: item.name, + updateSlave: {bellyAccessory: item.value} + }; + if (item.fs) { + clothingOption.FS = item.fs; + } + if (item.value !== "none") { + optionsArray.push(clothingOption); + } + }); + + // Sort + optionsArray = optionsArray.sort((a, b) => (a.text > b.text) ? 1 : -1); + + let el = document.createElement('div'); + + let label = document.createElement('div'); + label.append(`Belly accessory: `); + + let choice = document.createElement('span'); + choice.style.fontWeight = "bold"; + choice.textContent = (`${slave.bellyAccessory} `); + label.appendChild(choice); + + // Choose her own + if (slave.bellyAccessory !== `none`) { + label.appendChild(App.UI.Wardrobe.generateRows(choiceOptionsArray, "bellyAccessory", slave, true)); + } + + el.appendChild(label); + + // Options + let links = document.createElement('div'); + links.className = "choices"; + links.appendChild(App.UI.Wardrobe.generateRows(optionsArray, "bellyAccessory", slave)); + el.appendChild(links); + + return jQuery('#bellyAccessory').empty().append(el); +}; + App.UI.Wardrobe.generateRows = function(array, category, slave, ignoreAccessCheck="false") { // category should be in the form of slave.category, the thing we want to update. let row = document.createElement('span'); for (let i = 0; i < array.length; i++) { diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw index 307d47c23b0..c9ffd3dc387 100644 --- a/src/uncategorized/slaveInteract.tw +++ b/src/uncategorized/slaveInteract.tw @@ -213,6 +213,9 @@ <script>App.UI.Wardrobe.legAccessory(V.activeSlave)</script> <</if>> + <span id="bellyAccessory"></span> + <script>App.UI.Wardrobe.bellyAccessory(V.activeSlave)</script> + <br>Torso accessory: ''<span id="bellyAccessory">$activeSlave.bellyAccessory</span>.'' <<link "None">><<set $activeSlave.bellyAccessory = "none">><<replace "#bellyAccessory">>$activeSlave.bellyAccessory<</replace>><</link>> | <<link "Tight corset">><<set $activeSlave.bellyAccessory = "a corset">><<replace "#bellyAccessory">>$activeSlave.bellyAccessory<</replace>><</link>> -- GitLab