From f04f31b4856659594507f34a9ad70562eef62db8 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Mon, 17 Feb 2020 17:07:35 -0500 Subject: [PATCH] split arrays into harsh and nice --- js/003-data/miscData.js | 6 ++---- src/js/itemAvailability.js | 5 ++++- src/js/wardrobeUse.js | 18 +++++++++++++----- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/js/003-data/miscData.js b/js/003-data/miscData.js index 36686cddd7c..7d67e4c5049 100644 --- a/js/003-data/miscData.js +++ b/js/003-data/miscData.js @@ -582,10 +582,8 @@ App.Data.misc = { {name: "Penitent nun", value: "a penitent nuns habit"}, {name: "Restrictive latex", value: "restrictive latex"}, {name: "Shibari ropes", value: "shibari ropes"}, - {name: "Uncomfortable straps", value: "uncomfortable straps"}, - ] - - + {name: "Uncomfortable straps", value: "uncomfortable straps"} + ], /* // Collars diff --git a/src/js/itemAvailability.js b/src/js/itemAvailability.js index 09baa0dcc78..c2b51f0b235 100644 --- a/src/js/itemAvailability.js +++ b/src/js/itemAvailability.js @@ -205,7 +205,10 @@ window.isClothingAccessible = function(string) { return true; } - const item = App.Data.misc.clothes.find((i) => i.value === string); + let item = App.Data.misc.niceClothes.find((i) => i.value === string); + if (!item) { + item = App.Data.misc.harshClothes.find((i) => i.value === string); + } if (!item) { console.log(`${string} is not a registered piece of clothing! Check App.Data.Misc.`); return false; /* couldn't be found */ diff --git a/src/js/wardrobeUse.js b/src/js/wardrobeUse.js index 8613d38bee1..b11bd188ac3 100644 --- a/src/js/wardrobeUse.js +++ b/src/js/wardrobeUse.js @@ -18,7 +18,8 @@ App.UI.Wardrobe.clothes = function(slave) { let harshOptionsArray= []; let clothingOption; - App.Data.misc.clothes.forEach(item => { + // Nice clothes + App.Data.misc.niceClothes.forEach(item => { clothingOption = { text: item.name, updateSlave: {clothes: item.value} @@ -26,11 +27,18 @@ App.UI.Wardrobe.clothes = function(slave) { if (item.fs) { clothingOption.FS = item.fs; } - if (item.comfort === "nice") { - niceOptionsArray.push(clothingOption); - } else if (item.comfort === "harsh") { - harshOptionsArray.push(clothingOption); + niceOptionsArray.push(clothingOption); + }); + // Harsh clothes + App.Data.misc.harshClothes.forEach(item => { + clothingOption = { + text: item.name, + updateSlave: {clothes: item.value} + }; + if (item.fs) { + clothingOption.FS = item.fs; } + harshOptionsArray.push(clothingOption); }); // Sort -- GitLab