From 2e43233e653f44fcc43d9bccfdd4267435f339a9 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Fri, 13 Nov 2020 22:48:57 -0500
Subject: [PATCH] dedupe player customization

---
 src/events/intro/introSummary.tw      |  23 +--
 src/events/intro/pcAppearance.js      |  24 +++
 src/events/intro/pcAppearanceIntro.tw | 272 +-------------------------
 src/pregmod/widgets/pregmodWidgets.tw |  24 ---
 4 files changed, 28 insertions(+), 315 deletions(-)
 create mode 100644 src/events/intro/pcAppearance.js

diff --git a/src/events/intro/introSummary.tw b/src/events/intro/introSummary.tw
index bde3a0f223b..3082ebac9ea 100644
--- a/src/events/intro/introSummary.tw
+++ b/src/events/intro/introSummary.tw
@@ -491,28 +491,7 @@ You may review your settings before clicking "Continue" to begin.<br>
 			.addValue("Set custom title", "Master", () => $PC.customTitleLisp = 'Mather')>>
 		<</if>>
 
-		<<run _options.addOption("Your nationality is", "nationality", $PC).showTextBox()
-		.addComment("For best result capitalize it.")>>
-
-		<<run _options.addOption("Your race is", "race", $PC).showTextBox()
-		.addValueList([["White", "white"], ["Asian", "asian"], ["Latina", "latina"], ["Middle Eastern", "middle eastern"],
-			["Black", "black"], ["Semitic", "semitic"], ["Southern European", "southern european"], ["Indo-Aryan", "indo-aryan"],
-			["Amerindian", "amerindian"], ["Pacific Islander", "pacific islander"], ["Malay", "malay"], ["Mixed Race", "mixed race"]])>>
-
-		<<run _options.addOption("Your skin tone is", "skin", $PC).showTextBox()
-		.addValueList([["Pure White", "pure white"], ["Ivory", "ivory"], ["White", "white"], ["Extremely Pale", "extremely pale"],
-			["Very Pale", "very pale"], ["Pale", "pale"], ["Extremely Fair", "extremely fair"], ["Very Fair", "very fair"],
-			["Fair", "fair"], ["Light", "light"], ["Light Olive", "light olive"], ["Tan", "tan"], ["Olive", "olive"], ["Bronze", "bronze"],
-			["Dark Olive", "dark olive"], ["Dark", "dark"], ["Light Beige", "light beige"], ["Beige", "beige"],
-			["Dark Beige", "dark beige"], ["Light Brown", "light brown"], ["Brown", "brown"], ["Dark Brown", "dark brown"],
-			["Black", "black"], ["Ebony", "ebony"], ["Pure Black", "pure black"]])>>
-
-		<<run _options.addOption("Your body", "markings", $PC)
-		.addValueList([["Is clear of blemishes", "none"], ["Has light freckling", "freckles"], ["Has heavy freckling", "heavily freckled"]])>>
-
-		<<run _options.addOption("Your eyes are", "origColor", $PC.eye).showTextBox()>>
-
-		<<run _options.addOption("Your hair is", "hColor", $PC).showTextBox()>>
+		<<run App.Intro.pcAppearance(_options)>>
 
 		<<run _options.addOption("Your face is", "faceShape", $PC)
 		.addValueList([["Normal", "normal"], ["Androgynous", "androgynous"], ["Masculine", "masculine"], ["Cute", "cute"], ["Sensual", "sensual"], ["Exotic", "exotic"]])>>
diff --git a/src/events/intro/pcAppearance.js b/src/events/intro/pcAppearance.js
new file mode 100644
index 00000000000..56757f2f7b2
--- /dev/null
+++ b/src/events/intro/pcAppearance.js
@@ -0,0 +1,24 @@
+App.Intro.pcAppearance = function(options) {
+	options.addOption("Your nationality is", "nationality", V.PC).showTextBox()
+		.addComment("For best result capitalize it.");
+
+	options.addOption("Your race is", "race", V.PC).showTextBox()
+		.addValueList([["White", "white"], ["Asian", "asian"], ["Latina", "latina"], ["Middle Eastern", "middle eastern"],
+			["Black", "black"], ["Semitic", "semitic"], ["Southern European", "southern european"], ["Indo-Aryan", "indo-aryan"],
+			["Amerindian", "amerindian"], ["Pacific Islander", "pacific islander"], ["Malay", "malay"], ["Mixed Race", "mixed race"]]);
+
+	options.addOption("Your skin tone is", "skin", V.PC).showTextBox()
+		.addValueList([["Pure White", "pure white"], ["Ivory", "ivory"], ["White", "white"], ["Extremely Pale", "extremely pale"],
+			["Very Pale", "very pale"], ["Pale", "pale"], ["Extremely Fair", "extremely fair"], ["Very Fair", "very fair"],
+			["Fair", "fair"], ["Light", "light"], ["Light Olive", "light olive"], ["Tan", "tan"], ["Olive", "olive"], ["Bronze", "bronze"],
+			["Dark Olive", "dark olive"], ["Dark", "dark"], ["Light Beige", "light beige"], ["Beige", "beige"],
+			["Dark Beige", "dark beige"], ["Light Brown", "light brown"], ["Brown", "brown"], ["Dark Brown", "dark brown"],
+			["Black", "black"], ["Ebony", "ebony"], ["Pure Black", "pure black"]]);
+
+	options.addOption("Your body", "markings", V.PC)
+		.addValueList([["Is clear of blemishes", "none"], ["Has light freckling", "freckles"], ["Has heavy freckling", "heavily freckled"]]);
+
+	options.addOption("Your eyes are", "origColor", V.PC.eye).showTextBox();
+
+	options.addOption("Your hair is", "hColor", V.PC).showTextBox();
+};
diff --git a/src/events/intro/pcAppearanceIntro.tw b/src/events/intro/pcAppearanceIntro.tw
index d61a263a080..3c9e22e1a7c 100644
--- a/src/events/intro/pcAppearanceIntro.tw
+++ b/src/events/intro/pcAppearanceIntro.tw
@@ -6,275 +6,9 @@
 		Appearance only, no effect on gameplay (unless you make a big deal out of it).
 	</div>
 </p>
-
-<p>
-	<div class="intro question">
-		What nationality are you?
-	</div>
-	<div>
-		You are $PC.nationality.
-	</div>
-	<div>
-		<<textbox "$PC.nationality" $PC.nationality "PC Appearance Intro">>
-		<span class="note">
-			Capitalize it
-		</span>
-	</div>
-</p>
-
-<p>
-	<div class="intro question">
-		What race are you?
-	</div>
-	<div id = "ethnicity">
-		You're $PC.race.
-	</div>
-	<<link "White">>
-		<<set $PC.race = "white">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Asian">>
-		<<set $PC.race = "asian">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Latina">>
-		<<set $PC.race = "latina">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Middle Eastern">>
-		<<set $PC.race = "middle eastern">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Black">>
-		<<set $PC.race = "black">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Semitic">>
-		<<set $PC.race = "semitic">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Southern European">>
-		<<set $PC.race = "southern european">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Indo-Aryan">>
-		<<set $PC.race = "indo-aryan">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Amerindian">>
-		<<set $PC.race = "amerindian">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Pacific Islander">>
-		<<set $PC.race = "pacific islander">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Malay">>
-		<<set $PC.race = "malay">>
-		<<PlayerRace>>
-	<</link>>
-	|
-	<<link "Mixed Race">>
-		<<set $PC.race = "mixed race">>
-		<<PlayerRace>>
-	<</link>>
-</p>
-
-<p>
-	<div class="intro question">
-		What is your skin tone?
-	</div>
-	<div id = "skin">
-		You have $PC.skin skin.
-	</div>
-	<<link "Pure White">>
-		<<set $PC.skin = "pure white">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Ivory">>
-		<<set $PC.skin = "ivory">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "White">>
-		<<set $PC.skin = "white">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Extremely Pale">>
-		<<set $PC.skin = "extremely pale">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Very Pale">>
-		<<set $PC.skin = "very pale">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Pale">>
-		<<set $PC.skin = "pale">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Extremely Fair">>
-		<<set $PC.skin = "extremely fair">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Very Fair">>
-		<<set $PC.skin = "very fair">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Fair">>
-		<<set $PC.skin = "fair">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Light">>
-		<<set $PC.skin = "light">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Light Olive">>
-		<<set $PC.skin = "light olive">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Tan">>
-		<<set $PC.skin = "tan">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Olive">>
-		<<set $PC.skin = "olive">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Bronze">>
-		<<set $PC.skin = "bronze">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Dark Olive">>
-		<<set $PC.skin = "dark olive">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Dark">>
-		<<set $PC.skin = "dark">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Light Beige">>
-		<<set $PC.skin = "light beige">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Beige">>
-		<<set $PC.skin = "beige">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Dark Beige">>
-		<<set $PC.skin = "dark beige">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Light Brown">>
-		<<set $PC.skin = "light brown">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Brown">>
-		<<set $PC.skin = "brown">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Dark Brown">>
-		<<set $PC.skin = "dark brown">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Black">>
-		<<set $PC.skin = "black">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Ebony">>
-		<<set $PC.skin = "ebony">>
-		<<PlayerSkin>>
-	<</link>>
-	|
-	<<link "Pure Black">>
-		<<set $PC.skin = "pure black">>
-		<<PlayerSkin>>
-	<</link>>
-</p>
-
-<p>
-	<div class="intro question">
-		Some people have freckles.
-	</div>
-	<div id = "markings">
-		<<if $PC.markings == "none">>
-			Your skin is pure and clear of any freckles.
-		<<elseif $PC.markings == "freckles">>
-			You have some freckles on your cheeks and elsewhere.
-		<<elseif $PC.markings == "heavily freckled">>
-			You have dense freckles on your cheeks and elsewhere.
-		<</if>>
-	</div>
-	<<link "No Freckles">>
-		<<set $PC.markings = "none">>
-		<<PlayerMarkings>>
-	<</link>>
-	|
-	<<link "Light Freckles">>
-		<<set $PC.markings = "freckles">>
-		<<PlayerMarkings>>
-	<</link>>
-	|
-	<<link "Heavy Freckles">>
-		<<set $PC.markings = "heavily freckled">>
-		<<PlayerMarkings>>
-	<</link>>
-</p>
-
-<p>
-	<div class="intro question">
-		What color are your eyes?
-	</div>
-	<div>
-		You have $PC.eye.origColor eyes.
-	</div>
-	<div>
-		<<textbox "$PC.eye.origColor" $PC.eye.origColor "PC Appearance Intro">>
-	</div>
-</p>
-
-<p>
-	<div class="intro question">
-		What color is your hair?
-	</div>
-	<div>
-		You have $PC.hColor hair.
-	</div>
-	<div>
-		<<textbox "$PC.hColor" $PC.hColor "PC Appearance Intro">>
-	</div>
-</p>
+<<set _options = new App.UI.OptionsGroup()>>
+<<run App.Intro.pcAppearance(_options)>>
+<<includeDOM _options.render()>>
 
 <p>
 	[[Finish player character customization|PC Experience Intro][resetEyeColor($PC)]]
diff --git a/src/pregmod/widgets/pregmodWidgets.tw b/src/pregmod/widgets/pregmodWidgets.tw
index 54f8aa76a4a..2fba417568b 100644
--- a/src/pregmod/widgets/pregmodWidgets.tw
+++ b/src/pregmod/widgets/pregmodWidgets.tw
@@ -146,30 +146,6 @@
 	<<set _WivesALisp = lispReplace(_WivesA)>>
 <</widget>>
 
-<<widget "PlayerRace">>
-	<<replace #ethnicity>>
-		You're $PC.race.
-	<</replace>>
-<</widget>>
-
-<<widget "PlayerSkin">>
-	<<replace #skin>>
-		You have $PC.skin skin.
-	<</replace>>
-<</widget>>
-
-<<widget "PlayerMarkings">>
-	<<replace #markings>>
-		<<if $PC.markings == "none">>
-			Your skin is pure and clear of any freckles.
-		<<elseif $PC.markings == "freckles">>
-			You have some freckles on your cheeks and elsewhere.
-		<<elseif $PC.markings == "heavily freckled">>
-			You have dense freckles on your cheeks and elsewhere.
-		<</if>>
-	<</replace>>
-<</widget>>
-
 <<widget "AgePCEffects">>
 <<switch $PC.actualAge>>
 <<case 3>>
-- 
GitLab