From 1dacf47a1ebac85fde365f3dd6cc20c91835904a Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 26 Dec 2020 19:04:08 -0500
Subject: [PATCH] work

---
 js/003-data/gameVariableData.js        |   4 +
 src/005-passages/facilitiesPassages.js |   2 +-
 src/facilities/toyShop/toyShop.js      | 221 ++++++++++++++++++-------
 3 files changed, 164 insertions(+), 63 deletions(-)

diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js
index 7b45451a8bb..b179ebe014f 100644
--- a/js/003-data/gameVariableData.js
+++ b/js/003-data/gameVariableData.js
@@ -782,6 +782,10 @@ App.Data.resetOnNGPlus = {
 			smartVaginalAttachments: 0,
 		},
 	},
+	customItem: {
+		buttPlugs: new Map([]),
+		dildos: new Map([]),
+	},
 	dairyPiping: 0,
 	milkPipeline: 0,
 	cumPipeline: 0,
diff --git a/src/005-passages/facilitiesPassages.js b/src/005-passages/facilitiesPassages.js
index 0b437d54950..0fcb73572a5 100644
--- a/src/005-passages/facilitiesPassages.js
+++ b/src/005-passages/facilitiesPassages.js
@@ -75,5 +75,5 @@ new App.DomPassage("Toy Shop",
 		V.nextLink = "Manage Penthouse";
 
 		return App.UI.toyShop();
-	},
+	}, ["jump-to-safe", "jump-from-safe"]
 );
diff --git a/src/facilities/toyShop/toyShop.js b/src/facilities/toyShop/toyShop.js
index dcd1aa054d5..fed9a8adafc 100644
--- a/src/facilities/toyShop/toyShop.js
+++ b/src/facilities/toyShop/toyShop.js
@@ -3,12 +3,10 @@
  */
 App.UI.toyShop = function() {
 	const container = document.createElement("span");
-	let buttPlugName = "";
-	let buttPlugData = {
-		name: "",
-		width: 0,
-		length: 0
-	};
+	let buttPlugName;
+	let buttPlugData;
+	let selectedPlug;
+	init();
 
 	container.append(createPage());
 	return container;
@@ -20,6 +18,15 @@ App.UI.toyShop = function() {
 		return el;
 	}
 
+	function init() {
+		buttPlugName = "spade-shaped plug";
+		buttPlugData = {
+			name: "Spade-shaped plug",
+			width: 1,
+			length: 1
+		};
+	}
+
 	function intro() {
 		const el = new DocumentFragment();
 		App.UI.DOM.appendNewElement("h1", el, "Toy Shop");
@@ -32,74 +39,164 @@ App.UI.toyShop = function() {
 		const el = new DocumentFragment();
 		let linkArray;
 		App.UI.DOM.appendNewElement("h2", el, "Buttplugs");
+		el.append(create());
+		if (V.customItem.buttPlugs.size > 0) {
+			//el.append(reviewDesigns());
+		}
+		return el;
 
-		const value = App.UI.DOM.appendNewElement("div", el, `enter value here, "a butt plug"`);
-		value.append(App.UI.DOM.makeTextBox(
-			buttPlugName,
-			v => {
-				buttPlugName = v;
-				refresh();
+		function create() {
+			const el = new DocumentFragment();
+			el.append(
+				desc(),
+				title(),
+				width(),
+				length(),
+				apply(),
+			);
+			return el;
+		}
+		function reviewDesigns() {
+			const el = new DocumentFragment();
+			const choice = App.UI.DOM.appendNewElement("div", el, ` Choose an existing design to edit `);
+			const select = App.UI.DOM.appendNewElement("select", choice);
+			for (const [key, values] of V.customItem.buttPlugs) {
+				const option = App.UI.DOM.appendNewElement("option", select, values.name);
+				option.value = key;
 			}
-		));
-
-		const title = App.UI.DOM.appendNewElement("div", el, `enter value here, "Butt plug"`);
-		title.append(App.UI.DOM.makeTextBox(
-			buttPlugData.name,
-			v => {
-				buttPlugData.name = capFirstChar(v);
+			select.onchange = () => {
+				const O = select.options[select.selectedIndex];
+				selectedPlug = O.value;
 				refresh();
-			}
-		));
-
-
-		const widthOptions = new Map([
-			["standard", 1],
-			["large", 2],
-			["huge", 3],
-		]);
-		const width = App.UI.DOM.appendNewElement("div", el, `Select width`);
-		linkArray = [];
-		for (const [key, value] of widthOptions) {
-			linkArray.push(
-				App.UI.DOM.link(
-					key,
-					() => {
-						buttPlugData.width = value;
-						refresh();
-					}
-				)
+			};
+
+			buttPlugName = selectedPlug;
+			buttPlugData = V.customItem.buttPlugs.get(selectedPlug);
+			el.append(
+				desc(),
+				titleLocked(),
+				width(),
+				length(),
+				apply(),
 			);
+			return el;
+
+			function titleLocked() {
+				// Title
+				return  App.UI.DOM.makeElement("div", `Title has already been selected for this model`);
+			}
 		}
-		width.append(App.UI.DOM.generateLinksStrip(linkArray));
-
-		// width
-
-		// length
-		const lengthOptions = new Map([
-			["standard", 1],
-			["long", 2],
-		]);
-		const length = App.UI.DOM.appendNewElement("div", el, `Select width`);
-		linkArray = [];
-		for (const [key, value] of lengthOptions) {
-			linkArray.push(
-				App.UI.DOM.link(
-					key,
-					() => {
-						buttPlugData.length = value;
-						refresh();
-					}
-				)
-			);
+
+		function desc() {
+			// Describe
+			const value = App.UI.DOM.makeElement("div", `Enter value here as it will appear in descriptions, "a butt plug" `);
+			value.append(App.UI.DOM.makeTextBox(
+				buttPlugName,
+				v => {
+					buttPlugName = v;
+					refresh();
+				}
+			));
+			App.UI.DOM.appendNewElement("span", value, ` Your slave has a ${buttPlugName} wedged firmly in their asshole.`, "note");
+			return value;
 		}
-		length.append(App.UI.DOM.generateLinksStrip(linkArray));
 
-		return el;
+		function title() {
+			// Title
+			const title = App.UI.DOM.makeElement("div", `Enter title as it will appear in lists of choices; "Butt plug" `);
+			title.append(App.UI.DOM.makeTextBox(
+				buttPlugData.name,
+				v => {
+					buttPlugData.name = capFirstChar(v);
+					refresh();
+				}
+			));
+			return title;
+		}
+
+		function width() {
+			// Width
+			const widthOptions = new Map([
+				["standard", 1],
+				["large", 2],
+				["huge", 3],
+			]);
+			const width = App.UI.DOM.makeElement("div", `Select width `);
+			linkArray = [];
+			for (const [key, value] of widthOptions) {
+				if (buttPlugData.width === value) {
+					linkArray.push(
+						App.UI.DOM.disabledLink(
+							key,
+							["Currently selected"]
+						)
+					);
+				} else {
+					linkArray.push(
+						App.UI.DOM.link(
+							key,
+							() => {
+								buttPlugData.width = value;
+								refresh();
+							}
+						)
+					);
+				}
+			}
+			width.append(App.UI.DOM.generateLinksStrip(linkArray));
+			return width;
+		}
+
+		function length() {
+			// Length
+			const lengthOptions = new Map([
+				["standard", 1],
+				["long", 2],
+			]);
+			const length = App.UI.DOM.makeElement("div", `Select length `);
+			linkArray = [];
+			for (const [key, value] of lengthOptions) {
+				if (buttPlugData.length === value) {
+					linkArray.push(
+						App.UI.DOM.disabledLink(
+							key,
+							["Currently selected"]
+						)
+					);
+				} else {
+					linkArray.push(
+						App.UI.DOM.link(
+							key,
+							() => {
+								buttPlugData.length = value;
+								refresh();
+							}
+						)
+					);
+				}
+			}
+			length.append(App.UI.DOM.generateLinksStrip(linkArray));
+			return length;
+		}
 
 		function buildPlug() {
+			V.customItem.buttPlugs.set(buttPlugName, buttPlugData);
+			init();
+			refresh();
+		}
 
+		function apply() {
+			const build = App.UI.DOM.appendNewElement("div", el, `Send design to production and make available for all slaves `);
+			build.append(
+				App.UI.DOM.link(
+					"Start the mold",
+					() => { buildPlug(); }
+				)
+			);
+			return build;
 		}
 
+
 		function deletePlug() {
 
 		}
-- 
GitLab