From b24d2c652097c2c2bacf26f6ede292c327b744a5 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Wed, 19 Aug 2020 16:55:00 -0400
Subject: [PATCH] start

---
 .../wardrobe}/wardrobe.tw                     |  2 +
 src/facilities/wardrobe/wardrobeShopping.css  |  5 ++
 src/facilities/wardrobe/wardrobeShopping.js   | 67 +++++++++++++++++++
 .../wardrobe/wardrobeShoppingData.js          | 28 ++++++++
 4 files changed, 102 insertions(+)
 rename src/{uncategorized => facilities/wardrobe}/wardrobe.tw (99%)
 create mode 100644 src/facilities/wardrobe/wardrobeShopping.css
 create mode 100644 src/facilities/wardrobe/wardrobeShopping.js
 create mode 100644 src/facilities/wardrobe/wardrobeShoppingData.js

diff --git a/src/uncategorized/wardrobe.tw b/src/facilities/wardrobe/wardrobe.tw
similarity index 99%
rename from src/uncategorized/wardrobe.tw
rename to src/facilities/wardrobe/wardrobe.tw
index e39959f2083..bf59ef8da5c 100644
--- a/src/uncategorized/wardrobe.tw
+++ b/src/facilities/wardrobe/wardrobe.tw
@@ -10,6 +10,8 @@
 
 <h1>Slave Wardrobe</h1>
 
+<<includeDOM App.UI.WardrobeShopping("FS")>>
+
 <p class="scene-intro">
 The room containing all the clothes and accessories you have available to dress your slaves in, as well as the supplies and tools your tailor needs to resize them to better fit your slaves. Several mirrors are set up for a slave to try on outfits should they be allowed to dress themselves. The selection includes
 <<set _ownItAll = (
diff --git a/src/facilities/wardrobe/wardrobeShopping.css b/src/facilities/wardrobe/wardrobeShopping.css
new file mode 100644
index 00000000000..5dbc9333b3a
--- /dev/null
+++ b/src/facilities/wardrobe/wardrobeShopping.css
@@ -0,0 +1,5 @@
+.wardrobe-shopping-cell {
+    display: inline-block;
+    width: "450px";
+	border: 1px solid white;
+}
\ No newline at end of file
diff --git a/src/facilities/wardrobe/wardrobeShopping.js b/src/facilities/wardrobe/wardrobeShopping.js
new file mode 100644
index 00000000000..1a2b73300b3
--- /dev/null
+++ b/src/facilities/wardrobe/wardrobeShopping.js
@@ -0,0 +1,67 @@
+
+/**
+ * 
+ * @param {*} category FS, FSrevivalist, or "other"
+ */
+
+App.UI.WardrobeShopping = function(category) {
+	const data = App.Data.WardrobeShopping[category];
+	const model = (V.seeDicks === 100) ? GenerateNewSlave("XY") : GenerateNewSlave("XX");
+
+	const el = document.createElement("p");
+	el.id = `id${category}`;
+	Object.keys(data).forEach((clothing) => el.append(createCell(clothing)));
+	return el;
+
+	/**
+	 * 
+	 * @param {string} clothing
+	 */
+	function createCell(clothing) {
+		const el = document.createElement("div");
+		el.classList.add("wardrobe-shopping-cell");
+		/** @type {wardrobeItem} */
+		const clothingObj = App.Data.WardrobeShopping[category][clothing];
+		const cost = Math.trunc(clothingObj.cost * V.upgradeMultiplierTrade);
+
+		if (V.seeImages === 1) {
+			// Get a randomly chosen piece of clothing from the set to display:
+			model.clothes = clothingObj.contains[Math.floor(Math.random() * clothingObj.contains.length)];
+			App.UI.DOM.appendNewElement("div", el, App.Art.SlaveArtElement(model, 1, 0), ["imageRef", "tinyImg"]);
+		}
+		if (!V.boughtItem.clothing[clothing]) {
+			if (cost > V.cash) {
+				App.UI.DOM.appendNewElement(
+					"div",
+					el,
+					App.UI.DOM.link(
+						`Order ${clothingObj.title}`,
+						() => {
+							cashX(forceNeg(cost), "capEx");
+							V.boughtItem.clothing[clothing] = 1;
+							refresh();
+						}
+					)
+				);
+				App.UI.DOM.appendNewElement("div", el, `Costs ¤${cost}`, "detail");
+			} else {
+				App.UI.DOM.appendNewElement(
+					"div",
+					el,
+					App.UI.DOM.disabledLink(
+						`Order ${clothingObj.title}`,
+						[`Cannot afford ¤${cost}`]
+					)
+				);
+				App.UI.DOM.appendNewElement("div", el, `Costs ¤${cost}`, ["red", "detail"]);
+			}
+		} else {
+			el.append(clothingObj.owned);
+		}
+
+		return el;
+	}
+	function refresh() {
+		jQuery(`#id${category}`).empty().append(App.UI.WardrobeShopping(category));
+	}
+};
diff --git a/src/facilities/wardrobe/wardrobeShoppingData.js b/src/facilities/wardrobe/wardrobeShoppingData.js
new file mode 100644
index 00000000000..ed84b6e134b
--- /dev/null
+++ b/src/facilities/wardrobe/wardrobeShoppingData.js
@@ -0,0 +1,28 @@
+
+App.Data.WardrobeShopping = {
+	/**
+	 * @typedef {object} wardrobeItem
+	 * @property {string} title
+	 * @property {Number} cost
+	 * @property {string[]} contains
+	 * @property {string} owned
+	 */
+
+	/**
+	 *  @type {Object.<string, wardrobeItem>} String will be the property checked to see if the item is owned.  So for "bunny", it will check V.boughtItem.clothing["bunny"].
+	 */
+	FS: {
+		"bunny": {
+			title: "a shipment of bunny suits",
+			cost: 7500,
+			contains: ["a bunny outfit"],
+			owned: "You are well stocked with classic bunny suits and bowties.",
+		}
+	},
+	FSrevivalist: {
+
+	},
+	other: {
+
+	}
+}
\ No newline at end of file
-- 
GitLab