From b3f6a3e7dd196484b5345e44730a2b8228c163b3 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Fri, 5 Jun 2020 20:33:56 -0400
Subject: [PATCH] start collar

---
 src/npc/descriptions/style/collar.js   | 157 +++++++++++++++++++++++++
 src/utility/descriptionWidgetsStyle.tw | 107 +----------------
 2 files changed, 158 insertions(+), 106 deletions(-)
 create mode 100644 src/npc/descriptions/style/collar.js

diff --git a/src/npc/descriptions/style/collar.js b/src/npc/descriptions/style/collar.js
new file mode 100644
index 00000000000..4dd8d63f704
--- /dev/null
+++ b/src/npc/descriptions/style/collar.js
@@ -0,0 +1,157 @@
+/**
+ * @param {App.Entity.SlaveState} slave
+ * @returns {string}
+ */
+App.Desc.clothing = function(slave) {
+	const r = [];
+	let daddy;
+	const pregCollar = either(1, 2, 3);
+	const {
+		he, him, his, He
+	} = getPronouns(slave);
+	switch (slave.collar) {
+		case "uncomfortable leather":
+			r.push(`${He} is wearing an uncomfortable leather collar with a useful steel ring in front.`);
+			break;
+		case "preg biometrics":
+			if (slave.pregSource > 0) {
+				daddy = findFather(slave.pregSource).slaveName;
+			}
+			r.push(`${He} is wearing a heavy metal collar with a digital display; it currently reads:`);
+			if (slave.preg > 0 && slave.pregKnown === 0) {
+				r.push(`"I might be preggers! Rub my belly for luck!"`);
+			} else {
+				if (pregCollar === 1) {
+					if (slave.pregWeek < 0) {
+						r.push(`"I'm a mommy now!"`);
+					} else if (slave.pregKnown === 0) {
+						r.push(`"Knock me up!"`);
+					} else if (slave.pregKnown === 1) {
+						if (slave.pregType === 0) {
+							r.push(`"1`);
+						} else {
+							r.push(`${slave.pregType}`);
+						}
+						if (slave.pregType > 1) {
+							r.push(`babies`);
+						} else {
+							r.push(`baby`);
+						}
+						r.push(`on board!"`);
+					} else {
+						r.push(`"I'm infertile!"`);
+					}
+				} else if (pregCollar === 2) {
+					if (slave.pregWeek < 0) {
+						r.push(`"${num(slave.pregWeek * -1)}`);
+						if (slave.pregWeek !== -1) {
+							r.push(`weeks`);
+						} else {
+							r.push(`weeks`);
+						}
+						r.push(`until I can get preggers again!"`);
+					} else if (slave.pregKnown === 1) {
+						if (slave.broodmother === 2) {
+							if (slave.preg > 37) {
+								r.push(`"I'm crowning as you read this!"`);
+							} else {
+								r.push(`"${38 - Math.ceil(slave.preg)} weeks till I pop!"`);
+							}
+						} else if (slave.broodmother === 1) {
+							r.push(`"${38 - Math.ceil(slave.preg)} weeks till I pop!"`);
+						} else {
+							r.push(`"${40 - slave.preg} weeks till I pop!"`);
+						}
+					} else {
+						r.push(`"My womb needs filling!"`);
+					}
+				} else {
+					if (slave.pregWeek < 0) {
+						r.push(`"I can't wait for my belly to swell with life again!"`);
+					} else if (slave.pregKnown === 0) {
+						r.push(`"Put a baby in me today!"`);
+					} else if (slave.pregSource === -1) {
+						r.push(`"Womb claimed by my ${WrittenMaster(slave)}!"`);
+					} else if ((slave.pregSource === 0 || slave.pregSource === -2 || slave.pregSource === -5)) {
+						r.push(`"Baby made by slutting around!"`);
+					} else if (slave.pregSource === -7) {
+						r.push(`"My baby was made with science!"`);
+					} else if (slave.pregSource === -9) {
+						r.push(`"Futanari Sisters, now two for the price of one!"`);
+					} else if (slave.pregSource > 0) {
+						r.push(`"Womb claimed by ${daddy}!"`);
+					} else {
+						r.push(`"Put a baby in me today!"`);
+					}
+				}
+			}
+			break;
+		case "silk ribbon":
+			r.push(`${He} is wearing a tight silk ribbon fitted to ${his} neck, it is oddly elegant.`);
+			break;
+		case "tight steel":
+			r.push(`${He} is wearing a tight steel collar whose restricting metal touch ${he} cannot escape.`);
+			break;
+		case "shock punishment":
+			r.push(`${He} is wearing a utilitarian collar with a punishment device at ${his} throat to administer agonizing shocks.`);
+			break;
+		case "neck corset":
+			r.push(`${He} is wearing a fitted leather neck corset that constricts ${his} breathing and holds ${his} head rigidly upright.`);
+			break;
+		case "stylish leather":
+			r.push(`${He} is wearing a stylish leather collar buckled in the front, a classic accessory for the well behaved slave.`);
+			break;
+		case "satin choker":
+			r.push(`${He} is wearing a steel reinforced black satin choker that is at once elegant and functional.`);
+			break;
+		case "heavy gold":
+			r.push(`${He} is wearing a heavy gold collar, an outstanding bit of ostentation.`);
+			break;
+		case "pretty jewelry":
+			r.push(`${He} is wearing a pretty slave collar that can almost be mistaken for jewelry.`);
+			break;
+		case "bell collar":
+			r.push(`${He} is wearing a comfortable leather collar with a small brass bell at ${his} throat.`);
+			break;
+		case "leather with cowbell":
+			r.push(`${He} is wearing a comfortable leather collar with a small steel cowbell at ${his} throat.`);
+			break;
+		case "bowtie":
+			r.push(`${He} is wearing the collar from a white formal shirt, and a black bowtie, though these conceal an actual collar that works perfectly well for restraint.`);
+			break;
+		case "neck tie":
+			r.push(`${He} is wearing a neck tie, though it conceals an actual collar that works perfectly well for restraint.`);
+			break;
+		case "ancient Egyptian":
+			r.push(`${He} is wearing a beautiful golden wesekh, a collar that spreads from ${his} neck out onto both shoulders and down ${his} front.`);
+			break;
+		case "cruel retirement counter":
+		case "nice retirement counter":
+			r.push(`${He} is wearing a`);
+			if (slave.collar === "cruel retirement counter") {
+				r.push(`heavy metal collar`);
+			} else {
+				r.push(`nice collar, almost a necklace, `);
+			}
+			r.push(` with a small numerical display reading`);
+			if (slave.indenture > -1) {
+				r.push(`${slave.indenture}, the number of weeks left in ${his} indenture.`);
+			} else if (V.policies.retirement.sex > 0) {
+				r.push(`${V.policies.retirement.sex - (slave.counter.oral + slave.counter.anal + slave.counter.vaginal + slave.counter.penetrative + slave.counter.mammary)}, for the number of cocks between ${him} and ${his} freedom.`);
+			} else if (V.policies.retirement.milk > 0) {
+				r.push(`${V.policies.retirement.milk - slave.counter.milk}, for the amount of milk ${he} has yet to give.`);
+			} else if (V.policies.retirement.cum > 0) {
+				r.push(`${V.policies.retirement.cum - slave.counter.cum}, for the amount of cum ${he} has yet to give.`);
+			} else if (V.policies.retirement.births > 0) {
+				r.push(`${V.policies.retirement.births - slave.counter.births}, for the number of pregnancies still between ${him} and freedom.`);
+			} else if (V.policies.retirement.kills > 0) {
+				r.push(`${V.policies.retirement.kills - slave.counter.pitKills}, for the number of lives still between ${him} and freedom.`);
+			} else if (V.policies.retirement.physicalAgePolicy === 0) {
+				r.push(`${(365 * (V.retirementAge - slave.actualAge)) + (7 * (52 - slave.birthWeek))}, the number of days of sexual slavery ahead of ${him}.`);
+			} else {
+				r.push(`${(365 * (V.retirementAge - slave.physicalAge)) + (7 * (52 - slave.birthWeek))}, the number of days of sexual slavery ahead of ${him}.`);
+			}
+	}
+
+	return r.join(" ");
+};
diff --git a/src/utility/descriptionWidgetsStyle.tw b/src/utility/descriptionWidgetsStyle.tw
index 5cedd98137f..4053c32719b 100644
--- a/src/utility/descriptionWidgetsStyle.tw
+++ b/src/utility/descriptionWidgetsStyle.tw
@@ -1,112 +1,7 @@
 :: clothing description widgets [widget nobr]
 
 <<widget "collarDescription">>
-	<<switch $activeSlave.collar>>
-	<<case "uncomfortable leather">>
-		$He is wearing an uncomfortable leather collar with a useful steel ring in front.
-	<<case "preg biometrics">>
-		<<if $activeSlave.pregSource > 0>>
-			<<set _daddy = findFather($activeSlave.pregSource), _daddy = _daddy.slaveName>>
-		<</if>>
-		<<set _pregCollar = either(1, 2, 3)>>
-		$He is wearing a heavy metal collar with a digital display; it currently reads:
-		<<if $activeSlave.preg > 0 && $activeSlave.pregKnown == 0>>
-			"I might be preggers! Rub my belly for luck!"
-		<<else>>
-			<<if _pregCollar == 1>>
-				<<if $activeSlave.pregWeek < 0>>
-					"I'm a mommy now!"
-				<<elseif $activeSlave.pregKnown == 0>>
-					"Knock me up!"
-				<<elseif $activeSlave.pregKnown == 1>>
-					"<<if $activeSlave.pregType == 0>>1<<else>>$activeSlave.pregType<</if>> bab<<if $activeSlave.pregType > 1>>ies<<else>>y<</if>> on board!"
-				<<else>>
-					"I'm infertile!"
-				<</if>>
-			<<elseif _pregCollar == 2>>
-				<<if $activeSlave.pregWeek < 0>>
-					"<<= num($activeSlave.pregWeek*-1)>> week<<if $activeSlave.pregWeek != -1>>s<</if>> until I can get preggers again!"
-				<<elseif $activeSlave.pregKnown == 1>>
-					<<if $activeSlave.broodmother == 2>>
-						<<if $activeSlave.preg > 37>>
-							"I'm crowning as you read this!"
-						<<else>>
-							"<<print 38-Math.ceil($activeSlave.preg)>> weeks till I pop!"
-						<</if>>
-					<<elseif $activeSlave.broodmother == 1>>
-						"<<print 38-Math.ceil($activeSlave.preg)>> weeks till I pop!"
-					<<else>>
-						"<<print 40-$activeSlave.preg>> weeks till I pop!"
-					<</if>>
-				<<else>>
-					"My womb needs filling!"
-				<</if>>
-			<<else>>
-				<<if $activeSlave.pregWeek < 0>>
-					"I can't wait for my belly to swell with life again!"
-				<<elseif $activeSlave.pregKnown == 0>>
-					"Put a baby in me today!"
-				<<elseif $activeSlave.pregSource == -1>>
-					"Womb claimed by my <<= WrittenMaster($activeSlave)>>!"
-				<<elseif ($activeSlave.pregSource == 0 || $activeSlave.pregSource == -2 || $activeSlave.pregSource == -5)>>
-					"Baby made by slutting around!"
-				<<elseif $activeSlave.pregSource == -7>>
-					"My baby was made with science!"
-				<<elseif $activeSlave.pregSource == -9>>
-					"Futanari Sisters, now two for the price of one!"
-				<<elseif $activeSlave.pregSource > 0>>
-					"Womb claimed by _daddy!"
-				<<else>>
-					"Put a baby in me today!"
-				<</if>>
-			<</if>>
-		<</if>>
-	<<case "silk ribbon">>
-		$He is wearing a tight silk ribbon fitted to $his neck, it is oddly elegant.
-	<<case "tight steel">>
-		$He is wearing a tight steel collar whose restricting metal touch $he cannot escape.
-	<<case "shock punishment">>
-		$He is wearing a utilitarian collar with a punishment device at $his throat to administer agonizing shocks.
-	<<case "neck corset">>
-		$He is wearing a fitted leather neck corset that constricts $his breathing and holds $his head rigidly upright.
-	<<case "stylish leather">>
-		$He is wearing a stylish leather collar buckled in the front, a classic accessory for the well behaved slave.
-	<<case "satin choker">>
-		$He is wearing a steel reinforced black satin choker that is at once elegant and functional.
-	<<case "heavy gold">>
-		$He is wearing a heavy gold collar, an outstanding bit of ostentation.
-	<<case "pretty jewelry">>
-		$He is wearing a pretty slave collar that can almost be mistaken for jewelry.
-	<<case "bell collar">>
-		$He is wearing a comfortable leather collar with a small brass bell at $his throat.
-	<<case "leather with cowbell">>
-		$He is wearing a comfortable leather collar with a small steel cowbell at $his throat.
-	<<case "bowtie">>
-		$He is wearing the collar from a white formal shirt, and a black bowtie, though these conceal an actual collar that works perfectly well for restraint.
-	<<case "neck tie">>
-		$He is wearing a neck tie, though it conceals an actual collar that works perfectly well for restraint.
-	<<case "ancient Egyptian">>
-		$He is wearing a beautiful golden wesekh, a collar that spreads from $his neck out onto both shoulders and down $his front.
-	<<case "cruel retirement counter" "nice retirement counter">>
-		$He is wearing a <<if $activeSlave.collar == "cruel retirement counter">>heavy metal collar<<else>>nice collar, almost a necklace,<</if>> with a small numerical display reading
-		<<if $activeSlave.indenture > -1>>
-			$activeSlave.indenture, the number of weeks left in $his indenture.
-		<<elseif $policies.retirement.sex > 0>>
-			<<print $policies.retirement.sex - ($activeSlave.counter.oral + $activeSlave.counter.anal + $activeSlave.counter.vaginal + $activeSlave.counter.penetrative + $activeSlave.counter.mammary)>>, for the number of cocks between $him and $his freedom.
-		<<elseif $policies.retirement.milk > 0>>
-			<<print $policies.retirement.milk - $activeSlave.counter.milk>>, for the amount of milk $he has yet to give.
-		<<elseif $policies.retirement.cum > 0>>
-			<<print $policies.retirement.cum - $activeSlave.counter.cum>>, for the amount of cum $he has yet to give.
-		<<elseif $policies.retirement.births > 0>>
-			<<print $policies.retirement.births - $activeSlave.counter.births>>, for the number of pregnancies still between $him and freedom.
-		<<elseif $policies.retirement.kills > 0>>
-			<<print $policies.retirement.kills - $activeSlave.counter.pitKills>>, for the number of lives still between $him and freedom.
-		<<elseif $policies.retirement.physicalAgePolicy == 0>>
-			<<print (365*($retirementAge-$activeSlave.actualAge))+(7*(52-$activeSlave.birthWeek))>>, the number of days of sexual slavery ahead of $him.
-		<<else>>
-			<<print (365*($retirementAge-$activeSlave.physicalAge))+(7*(52-$activeSlave.birthWeek))>>, the number of days of sexual slavery ahead of $him.
-		<</if>>
-	<</switch>>
+
 <</widget>>
 
 <<widget "armwearDescription">>
-- 
GitLab