diff --git a/js/003-data/miscData.js b/js/003-data/miscData.js index d0904062f61a6a180fa95297699e1e0607da62c3..31e09d22812e5a63eeba0fb70e8a1a13e6677166 100644 --- a/js/003-data/miscData.js +++ b/js/003-data/miscData.js @@ -2667,7 +2667,7 @@ App.Data.misc = { name: "None", value: "none", updateSlave: { - // choosesOwnChastity: 0, + choosesOwnChastity: 0, chastityAnus: 0, chastityPenis: 0, chastityVagina: 0 @@ -2797,6 +2797,38 @@ App.Data.misc = { } } }, + { + name: "Choose own chastity", + value: "choose own chastity", + updateSlave: { + choosesOwnChastity: 1, + }, + unlock: function(slave) { + if (slave) { + if (slave.choosesOwnChastity !== 1) { + return true; + } + } else { + return true; + } + } + }, + { + name: "Revoke choosing own chastity", + value: "revoke choosing own chastity", + updateSlave: { + choosesOwnChastity: 0, + }, + unlock: function(slave) { + if (slave) { + if (slave.choosesOwnChastity > 0) { + return true; + } + } else { + return true; + } + } + }, ], facilityCareers: ["be confined in the arcade", "be confined in the cellblock", "be the Attendant", "be the DJ", "be the Farmer", "be the Madam", "be the Matron", "be the Milkmaid", "be the Nurse", "be the Schoolteacher", "be the Stewardess", "be the Wardeness", "be your Concubine", "get treatment in the clinic", "learn in the schoolroom", "live with your Head Girl", "rest in the spa", "serve in the club", "serve in the master suite", "work as a farmhand", "work as a nanny", "work as a servant", "work in the brothel", "work in the dairy"], diff --git a/src/js/wardrobeUse.js b/src/js/wardrobeUse.js index 9d8251123cbcbe507ed525cf5a4de9e4a1a9c3f6..6dd22450a5c852607f6bb38db1ad1093083e115b 100644 --- a/src/js/wardrobeUse.js +++ b/src/js/wardrobeUse.js @@ -693,14 +693,11 @@ App.UI.Wardrobe.chastity = function(slave) { App.Data.misc.chastityDevices.forEach(item => { clothingOption = { text: item.name, - updateSlave: { - choosesOwnChastity: item.updateSlave.choosesOwnChastity, - chastityAnus: item.updateSlave.chastityAnus, - chastityPenis: item.updateSlave.chastityPenis, - chastityVagina: item.updateSlave.chastityVagina, - } + updateSlave: {} }; - // TODO: can this work? Object.assign(clothingOption.updateSlave, item.updateSlave); + Object.assign(clothingOption.updateSlave, item.updateSlave); + console.log("option", clothingOption.updateSlave); + console.log("item", item.updateSlave); if (item.fs) { clothingOption.FS = item.fs; } @@ -711,7 +708,7 @@ App.UI.Wardrobe.chastity = function(slave) { }); // Sort - optionsArray = optionsArray.sort((a, b) => (a.text > b.text) ? 1 : -1); + // skip sort for this one too. optionsArray = optionsArray.sort((a, b) => (a.text > b.text) ? 1 : -1); // Options let links = document.createElement('div'); @@ -742,7 +739,7 @@ App.UI.Wardrobe.generateRows = function(array, category, slave, accessCheck = fa // Some items will never be in App.data.misc, especially "none" if it falls in between harsh and nice data sets. Trying to look it up would cause an error, which is what access check works around. let unlocked = false; if (accessCheck === true) { - if (Object.keys(array[i].updateSlave).length > 1) { + if (Object.keys(array[i].updateSlave).length > 1 || category === "chastity") { let text = array[i].text.toLowerCase(); // Yucky. Sometimes for now updateSlave is an object since multiple values need to be set (chastity). Compare using a lowercased name instead. unlocked = isClothingAccessible.entry(text, `${category}`, slave, true); } else { @@ -818,45 +815,3 @@ App.UI.Wardrobe.refreshAll = function(slave) { App.UI.Wardrobe.chastity(slave); return; }; - -/* - if (slave.dick > 0) { - <br>Dick accessory: ''<span id="dickAccessory">slave.dickAccessory</span>.'' - <<link "None">>slave.dickAccessory = "none";App.UI.SlaveInteract.refreshAll(slave);<</link>> - - } - - <br>Chastity device: ''<span id="chastity">if (slave.chastityAnus === 1 && slave.chastityPenis === 1 && slave.chastityVagina === 1) {full chastity} else if (slave.chastityPenis === 1 && slave.chastityVagina === 1) {genital chastity} else if (slave.chastityAnus === 1 && slave.chastityPenis === 1) {combined chastity cage} else if (slave.chastityAnus === 1 && slave.chastityVagina === 1) {combined chastity belt} else if (slave.chastityVagina === 1) {chastity belt} else if (slave.chastityPenis === 1) {chastity cage} else if (slave.chastityAnus === 1) {anal chastity} else if (slave.chastityAnus === 0 && slave.chastityPenis === 0 && slave.chastityVagina === 0) {none} else {THERE HAS BEEN AN ERROR}</span>.'' - <<link "None">>slave.chastityAnus = 0;slave.chastityPenis = 0;slave.chastityVagina = 0;App.UI.SlaveInteract.refreshAll(slave);<</link>> - <<link "Anal chastity">>slave.choosesOwnChastity = 0;slave.chastityAnus = 1;slave.chastityPenis = 0;slave.chastityVagina = 0;<<replace "#chastity">>anal chastityApp.UI.SlaveInteract.refreshAll(slave);<</link>> - if (slave.vagina > -1) { - <<link "Chastity belt">>slave.choosesOwnChastity = 0;slave.chastityAnus = 0;slave.chastityPenis = 0;slave.chastityVagina = 1;<<replace "#chastity">>Chastity beltApp.UI.SlaveInteract.refreshAll(slave);<</link>> - <<link "Combined chastity belt">>slave.choosesOwnChastity = 0;slave.chastityAnus = 1;slave.chastityPenis = 0;slave.chastityVagina = 1;<<replace "#chastity">>Combined chastity beltApp.UI.SlaveInteract.refreshAll(slave);<</link>> - } - if (slave.dick > 0) { - <<link "Chastity cage">>slave.choosesOwnChastity = 0;slave.chastityAnus = 0;slave.chastityPenis = 1;slave.chastityVagina = 0;<<replace "#chastity">>Chastity cageApp.UI.SlaveInteract.refreshAll(slave);<</link>> - <<link "Combined chastity cage">>slave.choosesOwnChastity = 0;slave.chastityAnus = 1;slave.chastityPenis = 1;slave.chastityVagina = 0;<<replace "#chastity">>Combined Chastity cageApp.UI.SlaveInteract.refreshAll(slave);<</link>> - if (slave.vagina > -1) { - <<link "Genital chastity">>slave.choosesOwnChastity = 0;slave.chastityAnus = 0;slave.chastityPenis = 1;slave.chastityVagina = 1;<<replace "#chastity">>Genital chastityApp.UI.SlaveInteract.refreshAll(slave);<</link>> - <<link "Full chastity">>slave.choosesOwnChastity = 0;slave.chastityAnus = 1;slave.chastityPenis = 1;slave.chastityVagina = 1;<<replace "#chastity">>Full chastityApp.UI.SlaveInteract.refreshAll(slave);<</link>> - } - } - - if (V.arcologies[0].FSRestart !== "unset" && slave.devotion > 20 && slave.trust > 0 && slave.choosesOwnClothes === 1) { - <br> - if (slave.choosesOwnChastity === 1) { - r += `V.He is allowed to decide whether V.he to wear chastity devices. `; - [[Withdraw Privilege|Slave Interact][slave.choosesOwnChastity = 0]] - } else { - r += `V.He is not allowed to choose whether to wear chastity devices. `; - [[Allow Choice|Slave Interact][slave.choosesOwnChastity = 1]] - } - } - -} // CLOSES FUCKDOLL CHECK - -} // CLOSES WARDROBE CHECK -}; - -</br> -*/