From 1578f2c2ca88b8dfedd2588c04e2437900f8b00b Mon Sep 17 00:00:00 2001
From: ezsh <ezsh.junk@gmail.com>
Date: Fri, 7 Aug 2020 12:00:08 +0200
Subject: [PATCH] Remove RA-specific code from the facilities

---
 src/004-base/facility.js                      |  7 +++++
 src/facilities/arcade/arcadeFramework.js      |  7 +----
 src/facilities/brothel/brothelFramework.js    |  7 +----
 .../cellblock/cellblockFramework.js           |  7 +----
 src/facilities/clinic/clinicFramework.js      |  7 +----
 src/facilities/club/clubFramework.js          |  7 +----
 src/facilities/dairy/dairyFramework.js        | 11 ++++----
 src/facilities/farmyard/farmyardFramework.js  | 20 +++++++++-----
 .../headGirlSuite/headGirlSuiteFramework.js   |  7 +----
 .../masterSuite/masterSuiteFramework.js       | 12 ++++-----
 src/facilities/nursery/nurseryFramework.js    | 14 +++++-----
 .../penthouse/penthouseFramework.js           |  8 +-----
 .../schoolroom/schoolroomFramework.js         | 14 +++++-----
 .../servantsQuartersFramework.js              | 14 +++++-----
 src/facilities/spa/spaFramework.js            |  7 +----
 src/js/DefaultRules.js                        | 26 ++++++++-----------
 16 files changed, 74 insertions(+), 101 deletions(-)

diff --git a/src/004-base/facility.js b/src/004-base/facility.js
index 719fdf7781f..6e4b59140ce 100644
--- a/src/004-base/facility.js
+++ b/src/004-base/facility.js
@@ -118,6 +118,13 @@ App.Entity.Facilities.Job = class {
 		return V.JobIDMap[this.desc.assignment];
 	}
 
+	/**
+	 * assignment string but the generic facility name replaced with its in-game name
+	 */
+	get assignment() {
+		return this.desc.assignment.replace("the " + this.facility.desc.baseName, this.facility.name);
+	}
+
 	/**
 	 * Tests if slave is broken enough
 	 * @protected
diff --git a/src/facilities/arcade/arcadeFramework.js b/src/facilities/arcade/arcadeFramework.js
index 58f5d63338c..1aefdf6abbc 100644
--- a/src/facilities/arcade/arcadeFramework.js
+++ b/src/facilities/arcade/arcadeFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.arcade = {
 			position: "inmate",
 			assignment: Job.ARCADE,
 			publicSexUse: true,
-			fuckdollAccepted: true,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `be confined in ${V.arcadeName}`
-				}
-			}
+			fuckdollAccepted: true
 		},
 	},
 	defaultJob: "assignee",
diff --git a/src/facilities/brothel/brothelFramework.js b/src/facilities/brothel/brothelFramework.js
index cfca519f4a5..c295f6c7d03 100644
--- a/src/facilities/brothel/brothelFramework.js
+++ b/src/facilities/brothel/brothelFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.brothel = {
 			position: "whore",
 			assignment: Job.BROTHEL,
 			publicSexUse: true,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `work in ${V.brothelName}`
-				}
-			}
+			fuckdollAccepted: false
 		},
 	},
 	defaultJob: "assignee",
diff --git a/src/facilities/cellblock/cellblockFramework.js b/src/facilities/cellblock/cellblockFramework.js
index c3f9c8b1a66..6e44aa9628b 100644
--- a/src/facilities/cellblock/cellblockFramework.js
+++ b/src/facilities/cellblock/cellblockFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.cellblock = {
 			position: "confinee",
 			assignment: Job.CELLBLOCK,
 			publicSexUse: false,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `be confined in ${V.cellblockName}`
-				}
-			}
+			fuckdollAccepted: false
 		},
 	},
 	defaultJob: "assignee",
diff --git a/src/facilities/clinic/clinicFramework.js b/src/facilities/clinic/clinicFramework.js
index 92bb159aab8..c351774e0b3 100644
--- a/src/facilities/clinic/clinicFramework.js
+++ b/src/facilities/clinic/clinicFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.clinic = {
 			position: "patient",
 			assignment: Job.CLINIC,
 			publicSexUse: false,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `get treatment in ${V.clinicName}`
-				}
-			}
+			fuckdollAccepted: false
 		}
 	},
 	defaultJob: "patient",
diff --git a/src/facilities/club/clubFramework.js b/src/facilities/club/clubFramework.js
index 3d25fd0af3b..efe1827dadb 100644
--- a/src/facilities/club/clubFramework.js
+++ b/src/facilities/club/clubFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.club = {
 			position: "slut",
 			assignment: Job.CLUB,
 			publicSexUse: true,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `serve in ${V.clubName}`
-				}
-			}
+			fuckdollAccepted: false
 		},
 	},
 	defaultJob: "slut",
diff --git a/src/facilities/dairy/dairyFramework.js b/src/facilities/dairy/dairyFramework.js
index b30c40cbca0..a6cb48cbaba 100644
--- a/src/facilities/dairy/dairyFramework.js
+++ b/src/facilities/dairy/dairyFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.dairy = {
 			position: "cow",
 			assignment: Job.DAIRY,
 			publicSexUse: false,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `be milked in ${V.dairyName}`
-				}
-			}
+			fuckdollAccepted: false
 		}
 	},
 	defaultJob: "cow",
@@ -77,6 +72,10 @@ App.Entity.Facilities.DairyCowJob = class extends App.Entity.Facilities.Facility
 
 		return r;
 	}
+
+	get assignment() {
+		return `be milked in ${this.facility.name}`;
+	}
 };
 
 App.Entity.Facilities.Dairy = class extends App.Entity.Facilities.SingleJobFacility {
diff --git a/src/facilities/farmyard/farmyardFramework.js b/src/facilities/farmyard/farmyardFramework.js
index 74048a4eef6..f4f6630cc53 100644
--- a/src/facilities/farmyard/farmyardFramework.js
+++ b/src/facilities/farmyard/farmyardFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.farmyard = {
 			position: "farmhand",
 			assignment: Job.FARMYARD,
 			publicSexUse: false,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `work in ${V.farmyardName}`
-				}
-			}
+			fuckdollAccepted: false
 		}
 	},
 	defaultJob: "farmhand",
@@ -33,6 +28,17 @@ App.Data.Facilities.farmyard = {
 	}
 };
 
+App.Entity.Facilities.FarmHandJob = class extends App.Entity.Facilities.FacilitySingleJob {
+	/**
+	 * @override
+	 */
+	get assignment() {
+		return `work in ${this.facility.name}`;
+	}
+};
+
 App.Entity.facilities.farmyard = new App.Entity.Facilities.SingleJobFacility(
-	App.Data.Facilities.farmyard
+	App.Data.Facilities.farmyard, {
+		farmhand: new App.Entity.Facilities.FarmHandJob()
+	}
 );
diff --git a/src/facilities/headGirlSuite/headGirlSuiteFramework.js b/src/facilities/headGirlSuite/headGirlSuiteFramework.js
index 6a059b0541c..66d1ad168c5 100644
--- a/src/facilities/headGirlSuite/headGirlSuiteFramework.js
+++ b/src/facilities/headGirlSuite/headGirlSuiteFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.headGirlSuite = {
 			position: "Head Girl's toy",
 			assignment: Job.HEADGIRLSUITE,
 			publicSexUse: true,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `live in your Head Girl's private suite`
-				}
-			}
+			fuckdollAccepted: false
 		}
 	},
 	defaultJob: "HGToy",
diff --git a/src/facilities/masterSuite/masterSuiteFramework.js b/src/facilities/masterSuite/masterSuiteFramework.js
index be55b6008cd..73aa85d2931 100644
--- a/src/facilities/masterSuite/masterSuiteFramework.js
+++ b/src/facilities/masterSuite/masterSuiteFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.masterSuite = {
 			position: "fucktoy",
 			assignment: Job.MASTERSUITE,
 			publicSexUse: false,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `${V.masterSuiteName}`
-				}
-			}
+			fuckdollAccepted: false
 		}
 	},
 	defaultJob: "fucktoy",
@@ -47,6 +42,11 @@ App.Entity.Facilities.MasterSuiteFuckToyJob = class extends App.Entity.Facilitie
 
 		return r;
 	}
+
+	/** @override */
+	get assignment() {
+		return this.facility.name;
+	}
 };
 
 App.Entity.Facilities.ConcubineJob = class extends App.Entity.Facilities.ManagingJob {
diff --git a/src/facilities/nursery/nurseryFramework.js b/src/facilities/nursery/nurseryFramework.js
index 394def23fd3..54591cd222a 100644
--- a/src/facilities/nursery/nurseryFramework.js
+++ b/src/facilities/nursery/nurseryFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.nursery = {
 			position: "nanny",
 			assignment: Job.NURSERY,
 			publicSexUse: false,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `work in ${V.nurseryName}`
-				}
-			}
+			fuckdollAccepted: false
 		}
 	},
 	defaultJob: "nanny",
@@ -47,6 +42,13 @@ App.Entity.Facilities.NurseryNannyJob = class extends App.Entity.Facilities.Faci
 
 		return r;
 	}
+
+	/**
+	 * @override
+	 */
+	get assignment() {
+		return `work in ${this.facility.name}`;
+	}
 };
 
 App.Entity.Facilities.Nursery = class extends App.Entity.Facilities.SingleJobFacility {
diff --git a/src/facilities/penthouse/penthouseFramework.js b/src/facilities/penthouse/penthouseFramework.js
index 5531c55fcd9..8ba020d9524 100644
--- a/src/facilities/penthouse/penthouseFramework.js
+++ b/src/facilities/penthouse/penthouseFramework.js
@@ -13,13 +13,7 @@ App.Data.Facilities.penthouse = {
 			position: "Choose own",
 			assignment: Job.CHOICE,
 			publicSexUse: false,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:({pronouns:{his}})=>`select ${his} own assignments`,
-					assignedType: "allowed"
-				}
-			}
+			fuckdollAccepted: false
 		},
 		fucktoy: {
 			position: "Fucktoy",
diff --git a/src/facilities/schoolroom/schoolroomFramework.js b/src/facilities/schoolroom/schoolroomFramework.js
index e743bbcefd2..31059cd5e28 100644
--- a/src/facilities/schoolroom/schoolroomFramework.js
+++ b/src/facilities/schoolroom/schoolroomFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.schoolroom = {
 			position: "student",
 			assignment: Job.SCHOOL,
 			publicSexUse: false,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `study in ${V.schoolroomName}`
-				}
-			}
+			fuckdollAccepted: false
 		}
 	},
 	defaultJob: "student",
@@ -60,6 +55,13 @@ App.Entity.Facilities.SchoolroomStudentJob = class extends App.Entity.Facilities
 
 		return r;
 	}
+
+	/**
+	 * @override
+	 */
+	get assignment() {
+		return `study in ${this.facility.name}`;
+	}
 };
 
 App.Entity.facilities.schoolroom = new App.Entity.Facilities.SingleJobFacility(
diff --git a/src/facilities/servantsQuarters/servantsQuartersFramework.js b/src/facilities/servantsQuarters/servantsQuartersFramework.js
index b07dd100fc9..24e00796f48 100644
--- a/src/facilities/servantsQuarters/servantsQuartersFramework.js
+++ b/src/facilities/servantsQuarters/servantsQuartersFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.servantsQuarters = {
 			position: "servant",
 			assignment: Job.QUARTER,
 			publicSexUse: false,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `work in ${V.servantsQuartersName}`
-				}
-			}
+			fuckdollAccepted: false
 		}
 	},
 	defaultJob: "servant",
@@ -52,6 +47,13 @@ App.Entity.Facilities.ServantsQuartersServantJob = class extends App.Entity.Faci
 		}
 		return r;
 	}
+
+	/**
+	 * @override
+	 */
+	get assignment() {
+		return `work in ${this.facility.name}`;
+	}
 };
 
 App.Entity.Facilities.ServantsQuartersStewardessJob = class extends App.Entity.Facilities.ManagingJob {
diff --git a/src/facilities/spa/spaFramework.js b/src/facilities/spa/spaFramework.js
index bd5443a3495..95d8bd88f82 100644
--- a/src/facilities/spa/spaFramework.js
+++ b/src/facilities/spa/spaFramework.js
@@ -6,12 +6,7 @@ App.Data.Facilities.spa = {
 			position: "bather",
 			assignment: Job.SPA,
 			publicSexUse: false,
-			fuckdollAccepted: false,
-			description: {
-				rulesAssistant: {
-					assigned:()=> `rest in ${V.spaName}`
-				}
-			}
+			fuckdollAccepted: false
 		}
 	},
 	defaultJob: "assignee",
diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js
index 8f78e503baa..fe70f5f5503 100644
--- a/src/js/DefaultRules.js
+++ b/src/js/DefaultRules.js
@@ -7,22 +7,18 @@ globalThis.DefaultRules = (function() {
 		"allowed": {success: "is allowed", unable: "could not be allowed"},
 	};
 	const getAssignmentDescription = function({rule, slave, assignmentResult, append = null}) {
-		const job = App.Utils.jobForAssignment(rule.setAssignment).desc;
-		let work = job.assignment;
-		let descriptionType = "auto";
-		const assignmentInfo = (job.description || {}).rulesAssistant;
-		if (assignmentInfo != null) {
-			if (assignmentInfo.assigned != null) {
-				work = assignmentInfo.assigned({slave, pronouns, rule});
-			}
-			if (assignmentInfo.assignedType != null) {
-				descriptionType = assignmentInfo.assignedType;
-			}
-		}
-		const assignedTypeInfo = assignedTypes[descriptionType];
-		if (assignedTypeInfo == null) { throw Error(`Unknown description type ${JSON.stringify(descriptionType)} in ${JSON.stringify(rule.setAssignment)}`); }
+		const assignment = rule.setAssignment === Job.CHOICE ?
+			{
+				descriptionType: "allowed",
+				work: `select ${pronouns.his} own assignments`
+			} : {
+				descriptionType: "auto",
+				work: App.Utils.jobForAssignment(rule.setAssignment).assignment
+			};
+
+		const assignedTypeInfo = assignedTypes[assignment.descriptionType];
 		const hasBeenAssigned = assignedTypeInfo[assignmentResult];
-		return `<br>${slave.slaveName} ${hasBeenAssigned} to ${work}${append || ''}.`;
+		return `<br>${slave.slaveName} ${hasBeenAssigned} to ${assignment.work}${append || ''}.`;
 	};
 
 	/** @type {string} */
-- 
GitLab