From 3e3d473d82ac93b0dab78678440c9f148c13bf92 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Mon, 27 Jul 2020 19:30:54 -0400
Subject: [PATCH] remove renameChild

---
 src/facilities/nursery/customizeChild.tw |  30 ++---
 src/interaction/rename.js                | 163 +----------------------
 src/interaction/slaveInteract.js         |   2 +-
 3 files changed, 17 insertions(+), 178 deletions(-)

diff --git a/src/facilities/nursery/customizeChild.tw b/src/facilities/nursery/customizeChild.tw
index d0259cf2305..243dec68295 100644
--- a/src/facilities/nursery/customizeChild.tw
+++ b/src/facilities/nursery/customizeChild.tw
@@ -68,26 +68,26 @@ You may enter custom descriptors for the child's hair color, hair style, tattoos
 			$activeChild.slaveName,
 			v => {
 				$activeChild.slaveName = v;
-				App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname});
+				App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname});
 			},
 			false
 		)>>
 	<<link "Restore $his birth name">>
 		<<set $activeChild.slaveName = $activeChild.birthName>>
-		<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+		<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 	<</link>>
 	<<if $arcologies[0].FSPastoralist != "unset">>
 		<<if $activeChild.lactation > 0>>
 			| <<link "Give $him a random cow given name">>
 				<<set $activeChild.slaveName = setup.cowSlaveNames.random()>>
-				<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+				<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 			<</link>>
 		<</if>>
 	<</if>>
 	<<if $arcologies[0].FSChattelReligionist != "unset">>
 		| <<link "Give $him a random devotional given name">>
 			<<set $activeChild.slaveName = setup.chattelReligionistSlaveNames.random()>>
-			<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+			<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 		<</link>>
 	<</if>>
 	<br><br>
@@ -97,7 +97,7 @@ You may enter custom descriptors for the child's hair color, hair style, tattoos
 			$activeChild.slaveSurname,
 			v => {
 				$activeChild.slaveSurname = v;
-				App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname});
+				App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname});
 			},
 			false
 		)>>
@@ -106,19 +106,19 @@ You may enter custom descriptors for the child's hair color, hair style, tattoos
 			"",
 			v => {
 				$activeChild.slaveSurname = v;
-				App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname});
+				App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname});
 			},
 			false
 		)>>
 	<</if>>
 	<<link "Restore $his birth surname">>
 		<<set $activeChild.slaveSurname = $activeChild.birthSurname>>
-		<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+		<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 	<</link>>
 	<<if $activeChild.slaveSurname>>
 		| <<link "Take $his surname away">>
 			<<set $activeChild.slaveSurname = 0>>
-			<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+			<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 		<</link>>
 	<</if>>
 	<<if $activeChild.relationship >= 5>>
@@ -128,7 +128,7 @@ You may enter custom descriptors for the child's hair color, hair style, tattoos
 					<<if $activeChild.slaveSurname != $slaves[_i].slaveSurname>>
 						| <<link "Give $him $his wife's surname">>
 							<<set $activeChild.slaveSurname = $slaves[_i].slaveSurname>>
-							<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+							<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 						<</link>>
 						<<break>>
 					<</if>>
@@ -141,7 +141,7 @@ You may enter custom descriptors for the child's hair color, hair style, tattoos
 			<<if $activeChild.slaveSurname != $PC.slaveSurname>>
 				| <<link "Give $him your surname">>
 					<<set $activeChild.slaveSurname = $PC.slaveSurname>>
-					<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+					<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 				<</link>>
 			<</if>>
 		<</if>>
@@ -150,31 +150,31 @@ You may enter custom descriptors for the child's hair color, hair style, tattoos
 		| <<link "Give $him a random full Roman name">>
 			<<set $activeChild.slaveName = setup.romanSlaveNames.random()>>
 			<<set $activeChild.slaveSurname = setup.romanSlaveSurnames.random()>>
-			<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+			<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 		<</link>>
 	<<elseif $arcologies[0].FSAztecRevivalist != "unset">>
 		| <<link "Give $him a random full Aztec name">>
 			<<set $activeChild.slaveName = setup.aztecSlaveNames.random()>>
 			<<set $activeChild.slaveSurname = 0>>
-			<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+			<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 		<</link>>
 	<<elseif $arcologies[0].FSEgyptianRevivalist != "unset">>
 		| <<link "Give $him a random full ancient Egyptian name">>
 			<<set $activeChild.slaveName = setup.ancientEgyptianSlaveNames.random()>>
 			<<set $activeChild.slaveSurname = 0>>
-			<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+			<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 		<</link>>
 	<<elseif $arcologies[0].FSEdoRevivalist != "unset">>
 		| <<link "Give $him a random full feudal Japanese name">>
 			<<set $activeChild.slaveName = setup.edoSlaveNames.random()>>
 			<<set $activeChild.slaveSurname = setup.edoSlaveSurnames.random()>>
-			<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+			<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 		<</link>>
 	<</if>>
 	<<if $arcologies[0].FSDegradationist > -1>>
 		| <<link "Give $him a degrading full name">>
 			<<run DegradingName($activeChild)>>
-			<<run App.UI.SlaveInteract.renameChild($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
+			<<run App.UI.SlaveInteract.rename($activeChild, {oldName:_oldName, oldSurname:_oldSurname})>>
 		<</link>>
 	<</if>>
 <<else>>
diff --git a/src/interaction/rename.js b/src/interaction/rename.js
index ffa2647abae..972b9c7e664 100644
--- a/src/interaction/rename.js
+++ b/src/interaction/rename.js
@@ -4,7 +4,7 @@
  * @param {string} [params.oldName] Their name before you renamed them by calling this function
  * @param {string} [params.oldSurname] Their surname before you renamed them by calling this function
  */
-App.UI.SlaveInteract.renameAdult = function(slave, {oldName = "", oldSurname = ""} = {}) {
+App.UI.SlaveInteract.rename = function(slave, {oldName = "", oldSurname = ""} = {}) {
 	const r = [];
 	const {He, he, His, his, him, girl} = getPronouns(slave);
 	if (slave.slaveName === oldName && slave.slaveSurname === oldSurname) {
@@ -158,164 +158,3 @@ App.UI.SlaveInteract.renameAdult = function(slave, {oldName = "", oldSurname = "
 	}
 	return jQuery("#rename").empty().append(r.join(" "));
 };
-
-/**
- * @param {App.Entity.SlaveState} slave
- * @param {*} params
- * @param {string} [params.oldName] Their name before you renamed them by calling this function
- * @param {string} [params.oldSurname] Their surname before you renamed them by calling this function
- */
-App.UI.SlaveInteract.renameChild = function(slave, {oldName = "", oldSurname = ""} = {}) {
-	const r = [];
-	const {He, he, His, his, him, girl} = getPronouns(slave);
-	if (slave.slaveName === oldName && slave.slaveSurname === oldSurname) {
-		return;
-	} else {
-		// First time renaming reaction
-		if (slave.slaveName === "" || !(slave.hasOwnProperty("slaveName"))) {
-			r.push(`${oldName} needs to be called something on the records, so ${oldName} ${he} stays.`);
-			slave.slaveName = oldName;
-		} else if (slave.fetish === "mindbroken") {
-			r.push(`${slave.slaveName} doesn't even recognize that ${he}'s been renamed. It simply does not register.`);
-		} else if ((oldName !== slave.birthName && oldSurname !== slave.birthSurname) && (slave.slaveName === slave.birthName || slave.slaveSurname === slave.birthSurname)) {
-			r.push(`${slave.slaveName}`);
-			if (slave.devotion > 50) {
-				r.push(`cheerfully accepts ${his} old name back.`);
-			} else if (slave.devotion >= -20) {
-				r.push(`obediently accepts ${his} old name back.`);
-			} else if (slave.devotion >= -50) {
-				r.push(`happily accepts ${his} original name.`);
-			} else if (slave.trust > 20) {
-				r.push(`scoffs at the notion that ${he} was ever anything other than ${SlaveFullBirthName(slave)}, <span class="orangered">weakening your control over ${him}.</span>`);
-				slave.trust += 5;
-			} else {
-				r.push(`cautiously accepts the return of ${his} name.`);
-			}
-		} else if (oldName === slave.birthName || oldSurname === slave.birthSurname) {
-			r.push(`${slave.slaveName}`);
-			if (slave.devotion > 50) {
-				r.push(`accepts ${his} new name cheerfully.This attachment to you <span class="hotpink"> increases ${his} devotion.</span>`);
-				slave.devotion += 4;
-			} else if (slave.devotion >= -20) {
-				r.push(`obediently accepts ${his} new name.This surrender to you <span class="hotpink"> increases ${his} obedience.</span>`);
-				slave.devotion += 4;
-			} else if (slave.devotion >= -50) {
-				r.push(`reluctantly accepts ${his} new name.`);
-			} else {
-				r.push(`angrily tries to resist ${his} new name, insisting that ${his} name is ${SlaveFullBirthName(slave)}. This resistance <span class="mediumorchid"> increases ${his} rebelliousness.</span>`);
-				slave.devotion -= 5;
-			}
-		} else {
-			r.push(`Since ${slave.slaveName} has already had a new name`);
-			if (slave.devotion > 20) {
-				r.push(`given to`);
-			} else {
-				r.push(`forced on`);
-			}
-			r.push(`${him} before, the mere fact of having it changed again doesn't really affect ${him}.`);
-		}
-
-		let _insultingName = 0;
-		if (oldName !== slave.slaveName && typeof slave.slaveName === "string") {
-			let _toSearch = slave.slaveName.toLowerCase();
-			for (let i = 0; i < setup.badWords.length; i++) {
-				if (_toSearch.indexOf(setup.badWords[i]) !== -1) {
-					_insultingName = 1;
-					break;
-				}
-			}
-		}
-		if (!_insultingName) {
-			if (oldSurname !== slave.slaveSurname && typeof slave.slaveSurname === "string") {
-				let _toSearch = slave.slaveSurname.toLowerCase();
-				for (let i = 0; i < setup.badWords.length; i++) {
-					if (_toSearch.indexOf(setup.badWords[i]) !== -1) {
-						_insultingName = 1;
-						break;
-					}
-				}
-			}
-		}
-		if (_insultingName === 1) {
-			if (slave.fetish === "mindbroken") {
-				r.push(`${His} new name would be insulting to a normal ${girl}, but ${he} dully accepts that it is an accurate description and goes about ${his} duties.`);
-			} else if (slave.devotion < -50) {
-				r.push(`Being given such a degrading name <span class="mediumorchid">further increases ${his} hatred</span> of you.`);
-				slave.devotion -= 5;
-			} else if (slave.devotion <= 50) {
-				r.push(`Being given such a degrading name <span class="gold">terrifies ${him},</span> since ${he} thinks it's fair warning for what ${he}'ll suffer in the future.`);
-				slave.trust -= 5;
-			}
-		}
-
-		/* Wife's surname reaction */
-		if (oldSurname !== slave.slaveSurname) {
-			if (slave.relationship >= 5) {
-				let _i = V.slaveIndices[slave.relationshipTarget];
-				if (!_i) {
-					r.push(`<span class="red">Error, relationshipTarget not found.</span>`);
-				}
-				if (V.slaves[_i].slaveSurname) {
-					if (slave.slaveSurname === V.slaves[_i].slaveSurname) {
-						r.push(`${He}'s touched that ${he} now shares a surname with ${his} wife ${V.slaves[_i].slaveName} ${V.slaves[_i].slaveSurname}, and is <span class="mediumaquamarine">more confident than ever</span> that you intend to keep them together in marital bliss.`);
-						slave.trust += 5;
-					} else if (oldSurname === V.slaves[_i].slaveSurname) {
-						r.push(`${He}'s concerned that ${he} no longer shares a surname with ${his} wife ${V.slaves[_i].slaveName} ${V.slaves[_i].slaveSurname}, and is <span class="gold">very worried</span> that you might be considering splitting them up.`);
-						slave.trust -= 5;
-					}
-				}
-			}
-		}
-
-		/* PC's surname reaction */
-		if (oldSurname !== slave.slaveSurname) {
-			if (slave.relationship === -3) {
-				if (V.PC.slaveSurname) {
-					if (slave.fetish === "mindbroken") {
-						r.push(`Names are meaningless to ${him} and it is unlikely ${he}'ll remember it.`);
-					} else if (slave.devotion + slave.trust >= 175) {
-						if (slave.slaveSurname === V.PC.slaveSurname) {
-							if (hasAnyArms(slave)) {
-								r.push(`When you tell ${him} that ${he}'s to be known as ${slave.slaveName} slave.slaveSurname now, ${he} starts to cry. ${He} tries to get ${himself} under control and thank you as best ${he} can, wiping at the tears running down ${his} slave.skin cheeks, but ${he} can't seem to stop weeping as ${he} thanks you over and over. ${He}'s a sex slave, your property, and it's understandable that some doubts about the permanence of ${his} place as your slave wife. This has <span class="mediumaquamarine">helped reassure ${him},</span> and explains the strength of ${his} emotional reaction. The next time you make love to ${him}, ${he} <span class="hotpink">presses ${himself} as close to you as ${he} can,</span> eager to drink in as much of your presence as ${he} can get.`);
-							} else {
-								r.push(`${He}'s <span class="hotpink">deeply touched</span> that ${he} now shares a surname with you, and has <span class="mediumaquamarine">an additional source of confidence</span> that ${he}'ll remain your amputee slave wife.`);
-							}
-							slave.devotion += 5;
-							slave.trust += 5;
-						} else if (oldSurname === V.PC.slaveSurname) {
-							r.push(`${He}'s devastated that you'd rename ${him} something other than your name. ${He}'s <span class="gold">terrified</span> that you intend to discard ${him} as your slave wife, and <span class="mediumorchid">saddened</span> that you would take away something that was precious to ${him}.`);
-							slave.devotion -= 5;
-							slave.trust -= 5;
-						}
-					} else if (slave.devotion < -20 && slave.trust > 20) {
-						if (slave.slaveSurname === V.PC.slaveSurname) {
-							r.push(`When you tell ${him} that ${he}'s to be known as ${slave.slaveName} slave.slaveSurname now, ${he} shows no reaction. You already took everything from ${him}, what's a name at this point?`);
-						} else if (oldSurname === V.PC.slaveSurname) {
-							r.push(`${He} doesn't care about losing your surname at first, but it quickly sets in that ${he} may have <span class="gold">pushed ${his} position too far.</span>`);
-							slave.trust -= 20;
-						}
-					} else if (slave.devotion < -20) {
-						if (slave.slaveSurname === V.PC.slaveSurname) {
-							r.push(`When you tell ${him} that ${he}'s to be known as ${slave.slaveName} slave.slaveSurname now, ${he} pleads with you not to steal ${his} name. It matters little to you, and ${he} is forced to <span class="hotpink">accept your will.</span>`);
-							slave.devotion += 5;
-						} else if (oldSurname === V.PC.slaveSurname) {
-							r.push(`${He}'s <span class="mediumorchid">happy</span> to no longer have to share a name with ${his} tormentor, but the bliss doesn't last long as <span class="gold">dread</span> quickly sets in about what this may mean.`);
-							slave.devotion += 5;
-							slave.trust -= 10;
-						}
-					} else {
-						if (slave.slaveSurname === V.PC.slaveSurname) {
-							r.push(`When you tell ${him} that ${he}'s to be known as ${slave.slaveName} slave.slaveSurname now, ${he} nods with approval feeling <span class="mediumaquamarine">that ${he} may hold at least some value in your eyes.</span>`);
-							slave.trust += 5;
-						} else if (oldSurname === V.PC.slaveSurname) {
-							r.push(`${He} accepts that you'd rename ${him} something other than your name. ${He}'s <span class="gold">a little scared</span> that you intend to discard ${him} as your slave wife, or worse, but realizes this was not only a possibility, but likely.`);
-							slave.trust -= 5;
-						}
-					}
-				}
-			}
-		}
-	}
-
-	return jQuery("#rename").empty().append(r.join(" "));
-};
diff --git a/src/interaction/slaveInteract.js b/src/interaction/slaveInteract.js
index bacd0c36778..8d7ed15a39a 100644
--- a/src/interaction/slaveInteract.js
+++ b/src/interaction/slaveInteract.js
@@ -2839,7 +2839,7 @@ App.UI.SlaveInteract.custom = (function() {
 		}
 		function updateName(slave, {oldName:oldName, oldSurname:oldSurname}) {
 			App.UI.SlaveInteract.custom(slave);
-			App.UI.SlaveInteract.renameAdult(slave, {oldName:oldName, oldSurname:oldSurname});
+			App.UI.SlaveInteract.rename(slave, {oldName:oldName, oldSurname:oldSurname});
 		}
 	}
 
-- 
GitLab