From 5ece686cfb0813d42b6f70f21b046b245b5bb5c7 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 10 Apr 2021 22:47:14 -0400
Subject: [PATCH] name

---
 src/events/nonRandomEvent.js              |  6 +-
 src/events/scheduled/arcologyNaming.js    | 90 +++++++++++++++++++++++
 src/events/scheduled/genericPlotEvents.js | 66 -----------------
 3 files changed, 92 insertions(+), 70 deletions(-)
 create mode 100644 src/events/scheduled/arcologyNaming.js

diff --git a/src/events/nonRandomEvent.js b/src/events/nonRandomEvent.js
index 5c3c38a49d1..1d1a3fcdd94 100644
--- a/src/events/nonRandomEvent.js
+++ b/src/events/nonRandomEvent.js
@@ -60,6 +60,7 @@ App.Events.getNonrandomEvents = function() {
 		new App.Events.SEMilitia(),
 		new App.Events.SEShootInvitation(),
 		new App.Events.SEShootResult(),
+		new App.Events.SEArcologyNaming(),
 		new App.Events.TwineEvent().wrapPassage([
 			() => V.RecruiterID !== 0,
 			() => V.recruiterProgress >= (13 + (V.recruiterEugenics === 1 ? policies.countEugenicsSMRs() * 6 : 0))
@@ -186,10 +187,7 @@ globalThis.nonRandomEvent = function() {
 	V.eventSlave = 0;
 	const effectiveWeek = App.Events.effectiveWeek();
 	if (V.plot) {
-		if (effectiveWeek === 4 && V.arcologies[0].name.indexOf("Arcology ") !== -1) {
-			V.Event = "arcology naming";
-			setTimeout(() => Engine.play("Generic Plot Events"), Engine.minDomActionDelay);
-		} else if (effectiveWeek >= 5 && V.FCTV.receiver === -1) {
+		if (effectiveWeek >= 5 && V.FCTV.receiver === -1) {
 			setTimeout(() => Engine.play("SE FCTV Install"), Engine.minDomActionDelay);
 		} else if (V.projectN.status === 1) {
 			V.projectN.status = 2;
diff --git a/src/events/scheduled/arcologyNaming.js b/src/events/scheduled/arcologyNaming.js
new file mode 100644
index 00000000000..885a8ff0971
--- /dev/null
+++ b/src/events/scheduled/arcologyNaming.js
@@ -0,0 +1,90 @@
+App.Events.SEArcologyNaming = class SEArcologyNaming extends App.Events.BaseEvent {
+	constructor(actors, params) {
+		super(actors, params);
+	}
+
+	eventPrerequisites() {
+		return [
+			() => App.Events.effectiveWeek() === 4,
+			() => V.arcologies[0].name.indexOf("Arcology ") !== -1
+		];
+	}
+
+	get eventName() {
+		return "Strip Club Closing";
+	}
+
+	execute(node) {
+		let r = [];
+
+		r.push(`As a society free of the encumbrance of governmental oversight, the arcologies of the Free Cities are places where societal evolution and corporate expansion can occur rapidly.`);
+		r.push(`Even so, the incredible speed with which the arcology has improved under your tenure as compared to that of your predecessor, after you obtained ownership through`);
+		if (V.PC.rumor === "wealth") {
+			r.push(`a leveraged buyout,`);
+		} else if (V.PC.rumor === "diligence") {
+			r.push(`hard work and competence,`);
+		} else if (V.PC.rumor === "force") {
+			r.push(`some episodes of violence,`);
+		} else if (V.PC.rumor === "social engineering") {
+			r.push(`the creative use of psychology,`);
+		} else if (V.PC.rumor === "luck") {
+			r.push(`an incredible opportunity,`);
+		}
+		r.push(`is nothing short of astonishing. Other arcologies have taken many years to develop along anything but strictly conservative lines, and you are not the only arcology owner with a background`);
+		if (V.PC.career === "wealth" || V.PC.career === "trust fund" || V.PC.career === "rich kid") {
+			r.push(`of substantial wealth.`);
+		} else if (V.PC.career === "capitalist" || V.PC.career === "entrepreneur" || V.PC.career === "business kid") {
+			r.push(`in business.`);
+		} else if (V.PC.career === "mercenary") {
+			r.push(`in the world of private contracting.`);
+		} else if (V.PC.career === "recruit" || V.PC.career === "child soldier") {
+			r.push(`in the military.`);
+		} else if (V.PC.career === "slaver") {
+			r.push(`as a slavebreaker.`);
+		} else if (V.PC.career === "slave overseer") {
+			r.push(`as a slave trainer.`);
+		} else if (V.PC.career === "slave tender") {
+			r.push(`as a slave tamer.`);
+		} else if (V.PC.career === "engineer") {
+			r.push(`in arcology engineering.`);
+		} else if (V.PC.career === "construction" || V.PC.career === "worksite helper") {
+			r.push(`in construction.`);
+		} else if (V.PC.career === "medicine" || V.PC.career === "medical assistant") {
+			r.push(`in medicine and surgery.`);
+		} else if (V.PC.career === "nurse") {
+			r.push(`in medicine.`);
+		} else if (V.PC.career === "celebrity" || V.PC.career === "rising star" || V.PC.career === "child star") {
+			r.push(`in the public sphere.`);
+		} else if (V.PC.career === "escort" || V.PC.career === "prostitute" || V.PC.career === "child prostitute") {
+			r.push(`involving many personal contacts.`);
+		} else if (V.PC.career === "servant" || V.PC.career === "handmaiden" || V.PC.career === "child servant") {
+			r.push(`involving the rich and powerful.`);
+		} else if (V.PC.career === "gang" || V.PC.career === "hoodlum" || V.PC.career === "street urchin") {
+			r.push(`involving gangs.`);
+		} else if (V.PC.career === "BlackHat" || V.PC.career === "hacker" || V.PC.career === "script kiddy") {
+			r.push(`involving mysterious data breaches.`);
+		} else {
+			r.push(`in the Free Cities.`);
+		}
+		r.push(`It occurs to you that the arcology's growing role as a place where those with the means to do so can live in the society you have created, enjoying themselves and their lives to the fullest while subjugating others, should be commemorated.`);
+		App.Events.addParagraph(node, r);
+		r = [];
+		r.push(`As any slaveowner with half a mind in the Free Cities knows, there is power in words, and in what they represent. Master. Slave. These two words alone, more than any others, define the arcologies that have taken up the mantle of leading the world forward in these dark times. The time has come to add a new term to the lexicon of the Free Cities — a name. No longer will your arcology be known only as ${V.arcologies[0].name}, a bland and uninspiring name if ever there was one.`);
+		App.Events.addParagraph(node, r);
+		r = [];
+		r.push(`From this day forward, the arcology shall be known as: `);
+		App.Events.addParagraph(node, r);
+		App.UI.DOM.appendNewElement("div", node, App.UI.DOM.makeTextBox(V.arcologies[0].name, (v) => V.arcologies[0].name = v));
+
+		const responses = [];
+		responses.push(new App.Events.Result(`Hurrah!`, hurrah, `Click to confirm your arcology's name, for now and ever! Or until you decide to change it again while managing your arcology.`));
+
+		App.Events.addResponses(node, responses);
+
+		function hurrah() {
+			V.nextButton = "Continue";
+			App.Utils.scheduleSidebarRefresh();
+			return `Your citizens enthusiastically respond to your naming of the arcology as ${V.arcologies[0].name}. They are proud to finally have a real name for their home. Other Free Cities take note, and some take up their own names as well, another indication of the Cities' collective ascension over the old world.`;
+		}
+	}
+};
diff --git a/src/events/scheduled/genericPlotEvents.js b/src/events/scheduled/genericPlotEvents.js
index 3b5a646da50..3ff76d5a907 100644
--- a/src/events/scheduled/genericPlotEvents.js
+++ b/src/events/scheduled/genericPlotEvents.js
@@ -19,63 +19,6 @@ globalThis.genericPlotEventsTemp = function() {
 		heA, hisA, himA, girlA, himselfA, womanA
 	} = getPronouns(assistant.pronouns().main).appendSuffix("A");
 	switch (V.Event) {
-		case "arcology naming":
-			r.push(`As a society free of the encumbrance of governmental oversight, the arcologies of the Free Cities are places where societal evolution and corporate expansion can occur rapidly.`);
-			r.push(`Even so, the incredible speed with which the arcology has improved under your tenure as compared to that of your predecessor, after you obtained ownership through`);
-			if (V.PC.rumor === "wealth") {
-				r.push(`a leveraged buyout,`);
-			} else if (V.PC.rumor === "diligence") {
-				r.push(`hard work and competence,`);
-			} else if (V.PC.rumor === "force") {
-				r.push(`some episodes of violence,`);
-			} else if (V.PC.rumor === "social engineering") {
-				r.push(`the creative use of psychology,`);
-			} else if (V.PC.rumor === "luck") {
-				r.push(`an incredible opportunity,`);
-			}
-			r.push(`is nothing short of astonishing. Other arcologies have taken many years to develop along anything but strictly conservative lines, and you are not the only arcology owner with a background`);
-			if (V.PC.career === "wealth" || V.PC.career === "trust fund" || V.PC.career === "rich kid") {
-				r.push(`of substantial wealth.`);
-			} else if (V.PC.career === "capitalist" || V.PC.career === "entrepreneur" || V.PC.career === "business kid") {
-				r.push(`in business.`);
-			} else if (V.PC.career === "mercenary") {
-				r.push(`in the world of private contracting.`);
-			} else if (V.PC.career === "recruit" || V.PC.career === "child soldier") {
-				r.push(`in the military.`);
-			} else if (V.PC.career === "slaver") {
-				r.push(`as a slavebreaker.`);
-			} else if (V.PC.career === "slave overseer") {
-				r.push(`as a slave trainer.`);
-			} else if (V.PC.career === "slave tender") {
-				r.push(`as a slave tamer.`);
-			} else if (V.PC.career === "engineer") {
-				r.push(`in arcology engineering.`);
-			} else if (V.PC.career === "construction" || V.PC.career === "worksite helper") {
-				r.push(`in construction.`);
-			} else if (V.PC.career === "medicine" || V.PC.career === "medical assistant") {
-				r.push(`in medicine and surgery.`);
-			} else if (V.PC.career === "nurse") {
-				r.push(`in medicine.`);
-			} else if (V.PC.career === "celebrity" || V.PC.career === "rising star" || V.PC.career === "child star") {
-				r.push(`in the public sphere.`);
-			} else if (V.PC.career === "escort" || V.PC.career === "prostitute" || V.PC.career === "child prostitute") {
-				r.push(`involving many personal contacts.`);
-			} else if (V.PC.career === "servant" || V.PC.career === "handmaiden" || V.PC.career === "child servant") {
-				r.push(`involving the rich and powerful.`);
-			} else if (V.PC.career === "gang" || V.PC.career === "hoodlum" || V.PC.career === "street urchin") {
-				r.push(`involving gangs.`);
-			} else if (V.PC.career === "BlackHat" || V.PC.career === "hacker" || V.PC.career === "script kiddy") {
-				r.push(`involving mysterious data breaches.`);
-			} else {
-				r.push(`in the Free Cities.`);
-			}
-			r.push(`It occurs to you that the arcology's growing role as a place where those with the means to do so can live in the society you have created, enjoying themselves and their lives to the fullest while subjugating others, should be commemorated.`);
-			// <br><br>
-			r.push(`As any slaveowner with half a mind in the Free Cities knows, there is power in words, and in what they represent. Master. Slave. These two words alone, more than any others, define the arcologies that have taken up the mantle of leading the world forward in these dark times. The time has come to add a new term to the lexicon of the Free Cities — a name. No longer will your arcology be known only as ${V.arcologies[0].name}, a bland and uninspiring name if ever there was one.`);
-			// <br><br>
-			r.push(`From this day forward, the arcology shall be known as: `);
-			// <<textbox "V.arcologies[0].name" V.arcologies[0].name>>
-			break;
 		case "slave food":
 			r.push(`A screen opposite your desk springs to life, `);
 			if (V.assistant.personality <= 0) {
@@ -157,15 +100,6 @@ globalThis.genericPlotEventsTemp = function() {
 	// <br><br>
 	// <span id="result">
 	switch (V.Event) {
-		case "arcology naming":
-			// <<link "Hurrah!">>
-			// <<replace "#result">>
-			r.push(`Your citizens enthusiastically respond to your naming of the arcology as ${V.arcologies[0].name}. They are proud to finally have a real name for their home. Other Free Cities take note, and some take up their own names as well, another indication of the Cities' collective ascension over the old world.`);
-			V.nextButton = "Continue";
-			// <</replace>>
-			// <</link>>
-			r.push(` // Click to confirm your arcology's name, for now and ever! Or until you decide to change it again while managing your arcology.//`);
-			break;
 		case "slave food":
 			V.revealFoodEffects = 0;
 			// <<link "Conceal the effects from your slaves">>
-- 
GitLab