From 83bff39ba98a323b402a77e7211c9b1d461ab6ed Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sun, 29 Nov 2020 14:39:39 -0500
Subject: [PATCH] progress

---
 js/003-data/playerData.js       |  11 +++
 src/events/intro/pcBodyIntro.js | 121 +++++++++++++++++---------------
 2 files changed, 74 insertions(+), 58 deletions(-)
 create mode 100644 js/003-data/playerData.js

diff --git a/js/003-data/playerData.js b/js/003-data/playerData.js
new file mode 100644
index 00000000000..3f687c94edf
--- /dev/null
+++ b/js/003-data/playerData.js
@@ -0,0 +1,11 @@
+App.Data.player = {
+	refreshmentType: new Map([
+		[0, `Smoked`],
+		[1, `Drank`],
+		[2, `Eaten`],
+		[3, `Snorted`],
+		[4, `Injected`],
+		[5, `Popped`],
+		[6, `Dissolved orally`],
+	])
+};
diff --git a/src/events/intro/pcBodyIntro.js b/src/events/intro/pcBodyIntro.js
index ae69d404948..b8189a36c7e 100644
--- a/src/events/intro/pcBodyIntro.js
+++ b/src/events/intro/pcBodyIntro.js
@@ -10,12 +10,13 @@ App.Intro.PCBodyIntro = function() {
 	r.push(App.UI.DOM.makeElement("span", `what's under your business attire?`, ["intro", "question"]));
 	App.Events.addNode(el, r, "p");
 
-	el.append(PCBody());
-	el.append(PCAge());
+	el.append(body());
+	el.append(age());
+	el.append(nameIndulgence());
 
 	return el;
 
-	function PCBody() {
+	function body() {
 		const el = document.createElement("p");
 		const options = new App.UI.OptionsGroup();
 		let r = [];
@@ -117,7 +118,7 @@ App.Intro.PCBodyIntro = function() {
 		}
 	}
 
-	function PCAge() {
+	function age() {
 		const el = document.createElement("p");
 		const options = new App.UI.OptionsGroup();
 
@@ -141,64 +142,68 @@ App.Intro.PCBodyIntro = function() {
 
 		return el;
 	}
-};
 
-/*
-<p>
-	<div class="intro question">
-		r.push(`What is your name and alternate indulgence?`);
-	</div>
-
-	<div>
-		r.push(`Name your character: `);
-<<textbox "V.PC.slaveName" V.PC.slaveName "PC Body Intro">>
-	r.push(` (surname)`);
+	function nameIndulgence() {
+		const el = document.createElement("p");
+		const options = new App.UI.OptionsGroup();
+		let r = [];
+		let comment;
+
+		App.UI.DOM.appendNewElement("div", el, `What is your name and alternate indulgence?`, ["intro", "question"]);
+
+		options.addOption(`Name your character: `, "slaveName", V.PC).showTextBox().addComment(`As with all text boxes in FC, press the enter key to commit your changes.`);
+		options.addOption(`Surname: `, "slaveSurname", V.PC).showTextBox();
+
 		if (V.PC.slaveSurname) {
-			<<textbox "V.PC.slaveSurname" V.PC.slaveSurname "PC Body Intro">>
-			<<link "Go by a single name">>
-V.PC.slaveSurname = 0, V.PC.birthSurname = "";
-<<goto "PC Body Intro">>
-<</link>>
-		} else {
-			<<textbox "V.PC.slaveSurname" "" "PC Body Intro">>
+			options.addOption("Go by a single name")
+				.customButton(
+					"Apply",
+					() => {
+						V.PC.slaveSurname = 0;
+						V.PC.birthSurname = "";
+					},
+					"PC Body Intro"
+				);
 		}
-	</div>
-	<div class="indent note">
-		r.push(`As with all text boxes in FC, press the enter key to commit your changes.`);
-	</div>
-	<div>
-		r.push(`Preferred refreshment: `);
-<<textbox "V.PC.refreshment" V.PC.refreshment "PC Body Intro">>
-	r.push(` [[Cigars|PC Body Intro][${V.PC.refreshment} = "cigar",V.PC.refreshmentType = 0]] | [[Whiskey|PC Body Intro][V.PC.refreshment = "whiskey",V.PC.refreshmentType = 1]]`);
-	</div>
-	<div>
-		r.push(`Preferred method of consumption:`);
-		<span style="font-weight:Bold">
-if (V.PC.refreshmentType === 0) {
-	r.push(`Smoked`);
-} else if (V.PC.refreshmentType === 1) {
-	r.push(`Drank`);
-} else if (V.PC.refreshmentType === 2) {
-	r.push(`Eaten`);
-} else if (V.PC.refreshmentType === 3) {
-	r.push(`Snorted`);
-} else if (V.PC.refreshmentType === 4) {
-	r.push(`Injected`);
-} else if (V.PC.refreshmentType === 5) {
-	r.push(`Popped`);
-} else if (V.PC.refreshmentType === 6) {
-	r.push(`Dissolved orally`);
-}</span>.
-	</div>
-	[[Smoked|PC Body Intro][V.PC.refreshmentType = 0]] | [[Drank|PC Body Intro][V.PC.refreshmentType = 1]] | [[Eaten|PC Body Intro][V.PC.refreshmentType = 2]] | [[Snorted|PC Body Intro][V.PC.refreshmentType = 3]] | [[Injected|PC Body Intro][V.PC.refreshmentType = 4]] | [[Popped|PC Body Intro][V.PC.refreshmentType = 5]] | [[Orally Dissolved|PC Body Intro][V.PC.refreshmentType = 6]]
-	<div class="indent note">
-		r.push(`Flavor only; no mechanical effect. If entering a custom refreshment, please assign proper usage.`);
-		if (V.PC.refreshmentType === 0) {"Smoke" must fit into the following sentence: "I smoked a V.PC.refreshment" to fit events properly
-		} else if (V.PC.refreshmentType === 5) {"Popped" must fit into the following sentence: "I shook the bottle of V.PC.refreshment" to fit events properly
-		} else if (V.PC.refreshmentType === 6) {"Orally Dissolved" must fit into the following sentence: "I placed a tab of V.PC.refreshment under my tongue" to fit events properly
+		options.addOption(`Preferred refreshment:`, "refreshment", V.PC).showTextBox()
+			.customButton(
+				"Cigars",
+				() => {
+					V.PC.refreshment = "cigar";
+					V.PC.refreshmentType = 0;
+				},
+				"PC Body Intro"
+			)
+			.customButton(
+				"Whiskey",
+				() => {
+					V.PC.refreshment = "whiskey";
+					V.PC.refreshmentType = 1;
+				},
+				"PC Body Intro"
+			);
+
+		options.addOption(`Preferred method of consumption:`, "refreshmentType", V.PC)
+			.addValueList(App.Data.player.refreshmentType)
+			.comment(`Flavor only; no mechanical effect. If entering a custom refreshment, please assign proper usage.`);
+
+
+		el.append(options.render());
+		if (V.PC.refreshmentType === 0) {
+			App.UI.DOM.appendNewElement("div", el, `"Smoke" must fit into the following sentence: "I smoked a ${V.PC.refreshment}" to fit events properly`);
+		} else if (V.PC.refreshmentType === 5) {
+			App.UI.DOM.appendNewElement("div", el, `"Popped" must fit into the following sentence: "I shook the bottle of ${V.PC.refreshment}" to fit events properly`);
+		} else if (V.PC.refreshmentType === 6) {
+			App.UI.DOM.appendNewElement("div", el, `"Orally Dissolved" must fit into the following sentence: "I placed a tab of ${V.PC.refreshment} under my tongue" to fit events properly`);
 		}
-	</div>
-</p>
+
+		return el;
+	}
+};
+
+
+
+/*
 
 <p>
 	if (V.PC.vagina !== -1) {
-- 
GitLab