From e073159c0acf4777370c6fdc51f3408da0467473 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sun, 9 Aug 2020 01:14:15 -0400
Subject: [PATCH] begin to add avail checks to wd

---
 src/interaction/wardrobeUse.js | 39 ++++++++++++++++++++--------------
 src/js/itemAvailability.js     |  2 +-
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/src/interaction/wardrobeUse.js b/src/interaction/wardrobeUse.js
index 2203e7df071..0b6fbfe83e1 100644
--- a/src/interaction/wardrobeUse.js
+++ b/src/interaction/wardrobeUse.js
@@ -34,26 +34,33 @@ App.UI.Wardrobe.clothes = function(slave) {
 		let clothingOption;
 		// Nice clothes
 		App.Data.misc.niceClothes.forEach(item => {
-			clothingOption = {
-				text: item.name,
-				updateSlave: {clothes: item.value, choosesOwnClothes: 0}
-			};
-			if (item.fs) {
-				clothingOption.FS = item.fs;
+			console.log("results: ", isItemAccessible.entry(item.value, "clothing", slave), item);
+			if (isItemAccessible.entry(item.value, "clothing", slave) === true) {
+				clothingOption = {
+					text: item.name,
+					updateSlave: {clothes: item.value, choosesOwnClothes: 0}
+				};
+				if (item.fs) {
+					clothingOption.FS = item.fs;
+				}
+				niceOptionsArray.push(clothingOption);
+			} else {
+				console.log("failed", item);
 			}
-			niceOptionsArray.push(clothingOption);
 		});
 		// Harsh clothes
 		App.Data.misc.harshClothes.forEach(item => {
-			clothingOption = {
-				text: item.name,
-				updateSlave: {clothes: item.value, choosesOwnClothes: 0}
-			};
-			if (item.fs) {
-				clothingOption.FS = item.fs;
-			}
-			if (item.value !== "choosing her own clothes") {
-				harshOptionsArray.push(clothingOption);
+			if (isItemAccessible.entry(item.value, "clothing", slave) === true) {
+				clothingOption = {
+					text: item.name,
+					updateSlave: {clothes: item.value, choosesOwnClothes: 0}
+				};
+				if (item.fs) {
+					clothingOption.FS = item.fs;
+				}
+				if (item.value !== "choosing her own clothes") {
+					harshOptionsArray.push(clothingOption);
+				}
 			}
 		});
 
diff --git a/src/js/itemAvailability.js b/src/js/itemAvailability.js
index 044139009a3..c8bdc983e40 100644
--- a/src/js/itemAvailability.js
+++ b/src/js/itemAvailability.js
@@ -104,7 +104,7 @@ globalThis.isItemAccessible = (function() {
 			return true;
 		}
 		if (item.hasOwnProperty("rs")) {
-			if (item.rs) {
+			if (item.rs === true) {
 				return true;
 			}
 		}
-- 
GitLab