From 21cbf40f678e4d08446bb49d739c93a9fbc99e9e Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Fri, 18 Dec 2020 11:32:06 -0500
Subject: [PATCH] profile

---
 src/npc/startingGirls/startingGirls.js | 134 +++++++++++++++++++++++++
 src/npc/startingGirls/startingGirls.tw | 125 +----------------------
 2 files changed, 135 insertions(+), 124 deletions(-)

diff --git a/src/npc/startingGirls/startingGirls.js b/src/npc/startingGirls/startingGirls.js
index 388070a5aa4..0a9c93f3569 100644
--- a/src/npc/startingGirls/startingGirls.js
+++ b/src/npc/startingGirls/startingGirls.js
@@ -1119,3 +1119,137 @@ App.StartingGirls.physical = function(slave) {
 	el.append(options.render());
 	return el;
 };
+
+App.StartingGirls.profile = function(slave) {
+	const el = new DocumentFragment();
+	const options = new App.UI.OptionsGroup();
+	let r;
+	const {His} = getPronouns(slave);
+
+	let option = options.addOption("Devotion", "devotion", slave).showTextBox()
+		.addRange(-100, -95, "<", "Utterly hateful")
+		.addRange(-70, -50, "<", "Hateful")
+		.addRange(-35, -20, "<", "Resistant")
+		.addRange(0, 20, "<", "Ambivalent")
+		.addRange(35, 50, "<", "Accepting")
+		.addRange(70, 95, "<", "Devoted")
+		.addRange(100, 95, ">=", "Worshipful");
+	if (slave.devotion > 20) {
+		r = [];
+		r.push("Starting slaves incur");
+		if (slave.devotion > 50) {
+			r.push("severe cost penalty at very high");
+		} else {
+			r.push("an additional cost penalty at high");
+		}
+		r.push("levels of devotion. This slave's");
+		if (slave.actualAge >= 25) {
+			if (slave.actualAge > 35) {
+				r.push("advanced");
+			}
+			r.push("age decreases the penalty.");
+		} else {
+			r.push("young age requires paying the full penalty.");
+		}
+		option.addComment(`<span class=warning>${r.join(" ")}</span>`);
+	}
+
+	options.addOption("Trust", "trust", slave).showTextBox()
+		.addRange(-100, -95, "<", "Abjectly terrified")
+		.addRange(-70, -50, "<", "Terrified")
+		.addRange(-35, -20, "<", "Frightened")
+		.addRange(0, 20, "<", "Fearful")
+		.addRange(35, 50, "<", "Careful")
+		.addRange(70, 95, "<", "Trusting")
+		.addRange(100, 95, ">=", "Absolute trust");
+
+	options.addOption("Legal status", "indenture", slave)
+		.addValue("Slave", -1, () => slave.indentureRestrictions = 0)
+		.addRange(52, 0, ">=", "Indentured Servant");
+	if (slave.indenture > -1) {
+		options.addOption("Remaining weeks", "indenture", slave).showTextBox();
+
+		options.addOption("Indenture restrictions", "indentureRestrictions", slave)
+			.addValueList([["None", 0], ["Protective", 1], ["Restrictive", 2]]);
+	}
+
+	options.addOption("Age", "actualAge", slave).showTextBox()
+		.customButton("Resync characteristics to age", () => resyncSlaveToAge(slave), "")
+		.customButton("Resync only height to age", () => slave.height = Height.random(slave), "")
+		.addComment("It is recommended to resync if you change age significantly");
+
+	options.addOption("Birth week", "birthWeek", slave).showTextBox();
+
+	options.addOption("Genes", "genes", slave)
+		.addValue("XX (Female)", "XX", () => {
+			slave.dick = 0;
+			slave.balls = 0;
+			slave.clit = 0;
+			slave.pubertyXY = 0;
+			slave.pubertyAgeXY = V.potencyAge;
+			slave.pubertyXX = (slave.pubertyAgeXX < slave.actualAge ? 1 : 0);
+			slave.vagina = Math.max(0, slave.vagina);
+			slave.boobs = Math.max(500, slave.boobs);
+			slave.balls = 0;
+			slave.scrotum = 0;
+			slave.prostate = 0;
+			slave.shoulders = either(-2, -1, 0);
+			slave.hips = either(-2, -1, 0);
+		}).addValue("XY (Male)", "XY", () => {
+			slave.dick = 3;
+			slave.vagina = -1;
+			WombFlush(slave);
+			slave.belly = 0;
+			slave.bellyPreg = 0;
+			slave.pubertyXY = (slave.pubertyAgeXY < slave.actualAge ? 1 : 0);
+			slave.pubertyXX = 0;
+			slave.pubertyAgeXX = V.fertilityAge;
+			slave.ovaries = 0;
+			slave.boobs = 0;
+			slave.balls = 3;
+			slave.scrotum = 3;
+			slave.prostate = 1;
+			slave.shoulders = either(0, 1, 2);
+			slave.hips = either(0, 1, 2);
+		});
+
+	options.addOption("Condition", "condition", slave.health)
+		.addValueList([["Unhealthy", -40], ["Healthy", 0], ["Very healthy", 40], ["Extremely healthy", 80]]);
+
+	 option = options.addOption("Prestige", "prestige", slave)
+		.addValueList([["None", 0], ["Locally known", 1], ["Regionally famous", 2], ["World renowned", 3]]);
+	if (slave.prestige > 0) {
+		r = [];
+		r.push("Starting slaves incur an extreme cost penalty for prestige. This slave's");
+		if (slave.actualAge >= 25) {
+			if (slave.actualAge > 35) {
+				r.push(" advanced");
+			}
+			r.push(" age decreases the penalty.");
+		} else {
+			r.push(" young age requires paying the full penalty.");
+		}
+		option.addComment(`<span class=warning>${r.join(" ")}</span>`);
+	}
+
+	options.addOption(`${His} nationality is`, "nationality", slave).showTextBox()
+		.addValueList(Object.keys(App.Data.SlaveSummary.short.nationality))
+		.pulldown();
+
+
+	if (V.seeRace === 1) {
+		options.addOption(`${His} ethnicity is`, "race", slave).showTextBox().pulldown()
+			.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("Intelligence", "intelligence", slave)
+		.addValueList([["Moronic", -100], ["Very stupid", -60], ["Stupid", -30], ["Average", 0], ["Smart", 30], ["Very smart", 60], ["Brilliant", 100]]);
+
+	options.addOption("Education", "intelligenceImplant", slave)
+		.addValueList([["Uneducated", 0], ["Educated", 15], ["Well educated", 30]]);
+
+	el.append(options.render());
+	return el;
+};
diff --git a/src/npc/startingGirls/startingGirls.tw b/src/npc/startingGirls/startingGirls.tw
index 81527ab4386..d6dcd5f3c3a 100644
--- a/src/npc/startingGirls/startingGirls.tw
+++ b/src/npc/startingGirls/startingGirls.tw
@@ -219,130 +219,7 @@
 
 <div id="Overview" class="tab-content">
 	<div class="content">
-
-	<<set _options = new App.UI.OptionsGroup()>>
-
-	<<set _option = _options.addOption("Devotion", "devotion", $activeSlave).showTextBox()
-	.addRange(-100, -95, "<", "Utterly hateful")
-	.addRange(-70, -50, "<", "Hateful")
-	.addRange(-35, -20, "<", "Resistant")
-	.addRange(0, 20, "<", "Ambivalent")
-	.addRange(35, 50, "<", "Accepting")
-	.addRange(70, 95, "<", "Devoted")
-	.addRange(100, 95, ">=", "Worshipful")>>
-	<<if $activeSlave.devotion > 20>>
-		<<set _comment = "Starting slaves incur">>
-		<<if $activeSlave.devotion > 50>>
-			<<run _comment += " severe cost penalty at very high">>
-		<<else>>
-			<<run _comment += " an additional cost penalty at high">>
-		<</if>>
-		<<run _comment += " levels of devotion. This slave's">>
-		<<if $activeSlave.actualAge >= 25>>
-			<<if $activeSlave.actualAge > 35>>advanced	<</if>>
-			<<run _comment += " age decreases the penalty.">>
-		<<else>>
-			<<run _comment += " young age requires paying the full penalty.">>
-		<</if>>
-		<<run _option.addComment(`<span class=warning>${_comment}</span>`)>>
-	<</if>>
-
-	<<run _options.addOption("Trust", "trust", $activeSlave).showTextBox()
-	.addRange(-100, -95, "<", "Abjectly terrified")
-	.addRange(-70, -50, "<", "Terrified")
-	.addRange(-35, -20, "<", "Frightened")
-	.addRange(0, 20, "<", "Fearful")
-	.addRange(35, 50, "<", "Careful")
-	.addRange(70, 95, "<", "Trusting")
-	.addRange(100, 95, ">=", "Absolute trust")>>
-
-	<<run _options.addOption("Legal status", "indenture", $activeSlave)
-	.addValue("Slave", -1, () => V.activeSlave.indentureRestrictions = 0)
-	.addRange(52, 0, ">=", "Indentured Servant")>>
-	<<if $activeSlave.indenture > -1>>
-		<<run _options.addOption("Remaining weeks", "indenture", $activeSlave).showTextBox()>>
-
-		<<run _options.addOption("Indenture restrictions", "indentureRestrictions", $activeSlave)
-		.addValueList([["None", 0], ["Protective", 1], ["Restrictive", 2]])>>
-	<</if>>
-
-	<<run _options.addOption("Age", "actualAge", $activeSlave).showTextBox()
-	.customButton("Resync characteristics to age", () => resyncSlaveToAge(V.activeSlave))
-	.customButton("Resync only height to age", () => V.activeSlave.height = Height.random(V.activeSlave))
-	.addComment("It is recommended to resync if you change age significantly")>>
-
-	<<run _options.addOption("Birth week", "birthWeek", $activeSlave).showTextBox()>>
-
-	<<run _options.addOption("Genes", "genes", $activeSlave)
-	.addValue("XX (Female)", "XX", () => {
-		V.activeSlave.dick = 0;
-		V.activeSlave.balls = 0;
-		V.activeSlave.clit = 0;
-		V.activeSlave.pubertyXY = 0;
-		V.activeSlave.pubertyAgeXY = V.potencyAge;
-		V.activeSlave.pubertyXX = (V.activeSlave.pubertyAgeXX < V.activeSlave.actualAge ? 1 : 0);
-		V.activeSlave.vagina = Math.max(0, V.activeSlave.vagina);
-		V.activeSlave.boobs = Math.max(500, V.activeSlave.boobs);
-		V.activeSlave.balls = 0;
-		V.activeSlave.scrotum = 0;
-		V.activeSlave.prostate = 0;
-		V.activeSlave.shoulders = either(-2,-1,0);
-		V.activeSlave.hips = either(-2,-1,0);
-	}).addValue("XY (Male)", "XY", () => {
-		V.activeSlave.dick = 3;
-		V.activeSlave.vagina = -1;
-		WombFlush(V.activeSlave);
-		V.activeSlave.belly = 0;
-		V.activeSlave.bellyPreg = 0;
-		V.activeSlave.pubertyXY = (V.activeSlave.pubertyAgeXY < V.activeSlave.actualAge ? 1 : 0);
-		V.activeSlave.pubertyXX = 0;
-		V.activeSlave.pubertyAgeXX = V.fertilityAge;
-		V.activeSlave.ovaries = 0;
-		V.activeSlave.boobs = 0;
-		V.activeSlave.balls = 3;
-		V.activeSlave.scrotum = 3;
-		V.activeSlave.prostate = 1;
-		V.activeSlave.shoulders = either(0,1,2);
-		V.activeSlave.hips = either(0,1,2);
-	})>>
-
-	<<run _options.addOption("Condition", "condition", $activeSlave.health)
-	.addValueList([["Unhealthy", -40], ["Healthy", 0], ["Very healthy", 40], ["Extremely healthy", 80]])>>
-
-	<<set _option = _options.addOption("Prestige", "prestige", $activeSlave)
-	.addValueList([["None", 0], ["Locally known", 1], ["Regionally famous", 2], ["World renowned", 3]])>>
-	<<if $activeSlave.prestige > 0>>
-		<<set _comment = "Starting slaves incur an extreme cost penalty for prestige. This slave's">>
-		<<if $activeSlave.actualAge >= 25>>
-			<<if $activeSlave.actualAge > 35>>
-				<<set _comment += " advanced">>
-			<</if>>
-			<<set _comment += " age decreases the penalty.">>
-		<<else>>
-			<<set _comment += " young age requires paying the full penalty.">>
-		<</if>>
-		<<run _option.addComment(`<span class=warning>${_comment}</span>`)>>
-	<</if>>
-
-	<<run _options.addOption("$His nationality is", "nationality", $activeSlave).showTextBox()
-	.addValueList(Object.keys(App.Data.SlaveSummary.short.nationality))
-	.pulldown()
-	>>
-
-	<<if $seeRace == 1>>
-		<<run _options.addOption("$His ethnicity is", "race", $activeSlave).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"]])>>
-	<</if>>
-
-	<<run _options.addOption("Intelligence", "intelligence", $activeSlave)
-	.addValueList([["Moronic", -100], ["Very stupid", -60], ["Stupid", -30], ["Average", 0], ["Smart", 30], ["Very smart", 60], ["Brilliant", 100]])>>
-
-	<<run _options.addOption("Education", "intelligenceImplant", $activeSlave)
-	.addValueList([["Uneducated", 0], ["Educated", 15], ["Well educated", 30]])>>
-
-	<<includeDOM _options.render()>>
+		<<includeDOM App.StartingGirls.profile($activeSlave)>>
 	</div>
 </div>
 
-- 
GitLab