From e6d603835131a060b97ad4a832099f1c1e49af70 Mon Sep 17 00:00:00 2001
From: i107760 <13422-i107760@users.noreply.gitgud.io>
Date: Sat, 21 Mar 2020 21:13:25 +0100
Subject: [PATCH] Rework the various 'saAssignment.js' to track vignette upkeep
 per assignment and add new categories to 'recordTemplates.js'

---
 src/endWeek/saGetMilked.js                 | 12 ++++++++++--
 src/endWeek/saNanny.js                     |  3 ++-
 src/endWeek/saRest.js                      |  3 ++-
 src/endWeek/saWhore.js                     | 18 +++++++++++++++---
 src/endWeek/saWorkTheFarm.js               |  3 ++-
 src/interaction/budgets/recordTemplates.js |  8 ++++++++
 6 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/src/endWeek/saGetMilked.js b/src/endWeek/saGetMilked.js
index ad7e667b882..64f0666e71d 100644
--- a/src/endWeek/saGetMilked.js
+++ b/src/endWeek/saGetMilked.js
@@ -816,9 +816,17 @@ window.saGetMilked = (function saGetMilked() {
 				r += `an incident without lasting effect.`;
 			}
 			if (slave.assignment === window.Job.MILKED) {
-				cashX(cashVign, "slaveIncomeMilkedVign", slave);
+				if (vignette.effect > 0) {
+					cashX(cashVign, "slaveIncomeMilkedVign", slave);
+				} else if (vignette.effect < 0) {
+					cashX(cashVign, "slaveUpkeepMilkedVign", slave);
+				}
 			} else if (slave.assignment === window.Job.DAIRY) {
-				cashX(cashVign, "slaveIncomeDairyVign", slave);
+				if (vignette.effect > 0) {
+					cashX(cashVign, "slaveIncomeDairyVign", slave);
+				} else if (vignette.effect < 0) {
+					cashX(cashVign, "slaveUpkeepDairyVign", slave);
+				}
 			} else {
 				cashX(cashVign, "slaveIncomeExtraMilkVign", slave);
 			}
diff --git a/src/endWeek/saNanny.js b/src/endWeek/saNanny.js
index 2a4ed5883b7..d5c5d3f22a5 100644
--- a/src/endWeek/saNanny.js
+++ b/src/endWeek/saNanny.js
@@ -136,12 +136,13 @@ window.saNanny = function saNanny(slave) {
 			let modifier = FResult(slave);
 			if (vignette.effect > 0) {
 				t += `<span class="cash inc">making you an extra ${cashFormat(Math.trunc(modifier * vignette.effect))}.</span>`;
+				cashX(Math.trunc(modifier * vignette.effect), "slaveIncomeNannyVign", slave);
 			} else if (vignette.effect < 0) {
 				t += `<span class="cash dec">losing you ${cashFormat(Math.abs(Math.trunc(modifier * vignette.effect)))}.</span>`;
+				cashX(Math.trunc(modifier * vignette.effect), "slaveUpkeepNannyVign", slave);
 			} else {
 				t += `an incident without lasting effect.`;
 			}
-			cashX(Math.trunc(modifier * vignette.effect), "slaveIncomeNannyVign", slave);
 		}
 
 		return t;
diff --git a/src/endWeek/saRest.js b/src/endWeek/saRest.js
index 910e2e0546d..eb4ec18293a 100644
--- a/src/endWeek/saRest.js
+++ b/src/endWeek/saRest.js
@@ -99,12 +99,13 @@ window.saRest = function saRest(slave) {
 		if (_vignette.type === "cash") {
 			if (_vignette.effect > 0) {
 				t += `<span class="cash inc">making you an extra ${cashFormat(Math.trunc(FResultNumber * _vignette.effect))}.</span>`;
+				cashX(Math.trunc(FResultNumber * _vignette.effect), "slaveIncomeRestVign", slave);
 			} else if (_vignette.effect < 0) {
 				t += `<span class="cash dec">losing you ${cashFormat(Math.abs(Math.trunc(FResultNumber * _vignette.effect)))}.</span>`;
+				cashX(Math.trunc(FResultNumber * _vignette.effect), "slaveUpkeepRestVign", slave);
 			} else {
 				t += `an incident without lasting effect.`;
 			}
-			cashX(Math.trunc(FResultNumber * _vignette.effect), "slaveIncomeRestVign", slave);
 		} else if (_vignette.type === "devotion") {
 			if (_vignette.effect > 0) {
 				if (slave.devotion > 50) {
diff --git a/src/endWeek/saWhore.js b/src/endWeek/saWhore.js
index 20b0bd4ab79..bd605fa53cf 100644
--- a/src/endWeek/saWhore.js
+++ b/src/endWeek/saWhore.js
@@ -1589,11 +1589,23 @@ window.saWhore = (function saWhore() {
 				r += `an incident without lasting effect.`;
 			}
 			if (slave.assignment === window.Job.WHORE) {
-				cashX(cashVign, "slaveIncomeWhoreVign", slave);
+				if (vignette.effect > 0) {
+					cashX(cashVign, "slaveIncomeWhoreVign", slave);
+				} else if (vignette.effect < 0) {
+					cashX(cashVign, "slaveUpkeepWhoreVign", slave);
+				}
 			} else if (slave.assignment === window.Job.MADAM) {
-				cashX(cashVign, "slaveIncomeMadamVign", slave);
+				if (vignette.effect > 0) {
+					cashX(cashVign, "slaveIncomeMadamVign", slave);
+				} else if (vignette.effect < 0) {
+					cashX(cashVign, "slaveUpkeepMadamVign", slave);
+				}
 			} else if (slave.assignment === window.Job.BROTHEL) {
-				cashX(cashVign, "slaveIncomeBrothelVign", slave);
+				if (vignette.effect > 0) {
+					cashX(cashVign, "slaveIncomeBrothelVign", slave);
+				} else if (vignette.effect < 0) {
+					cashX(cashVign, "slaveUpkeepBrothelVign", slave);
+				}
 			} else {
 				cashX(cashVign, "vignette whoring income in an unregistered building", slave);
 			}
diff --git a/src/endWeek/saWorkTheFarm.js b/src/endWeek/saWorkTheFarm.js
index 1ee06488729..18381fa19eb 100644
--- a/src/endWeek/saWorkTheFarm.js
+++ b/src/endWeek/saWorkTheFarm.js
@@ -507,12 +507,13 @@ window.saWorkTheFarm = function(slave) {
 			const cashVign = Math.trunc(FResultNumber * vignette.effect);
 			if (vignette.effect > 0) {
 				t += ` <span class="yellowgreen">making you an extra ${cashFormat(cashVign)}.</span> `;
+				cashX(cashVign, "slaveIncomeFarmyardVign", slave);
 			} else if (vignette.effect < 0) {
 				t += ` <span class="red">losing you ${cashFormat(Math.abs(cashVign))}.</span> `;
+				cashX(cashVign, "slaveUpkeepFarmyardVign", slave);
 			} else {
 				t += ` an incident without lasting effect. `;
 			}
-			cashX(cashVign, "slaveIncomeFarmyardVign", slave);
 			incomeStats.income += cashVign;
 		} else if (vignette.type === "devotion") {
 			if (vignette.effect > 0) {
diff --git a/src/interaction/budgets/recordTemplates.js b/src/interaction/budgets/recordTemplates.js
index 406c1585b43..03961023afc 100644
--- a/src/interaction/budgets/recordTemplates.js
+++ b/src/interaction/budgets/recordTemplates.js
@@ -86,13 +86,16 @@ App.Data.Records.LastWeeksCash = function() {
 	this.slaveIncomeUndefined = 0,
 	// Slave upkeep per assignment
 	this.slaveUpkeepRest = 0,
+	this.slaveUpkeepRestVign = 0,
 	this.slaveUpkeepFucktoy = 0,
 	this.slaveUpkeepClasses = 0,
 	this.slaveUpkeepServer = 0,
 	this.slaveUpkeepWhore = 0,
+	this.slaveUpkeepWhoreVign = 0,
 	this.slaveUpkeepPublic = 0,
 	this.slaveUpkeepSubordinate = 0,
 	this.slaveUpkeepMilked = 0,
+	this.slaveUpkeepMilkedVign = 0,
 	this.slaveUpkeepGloryhole = 0,
 	this.slaveUpkeepConfinement = 0,
 	this.slaveUpkeepBodyguard = 0,
@@ -100,7 +103,9 @@ App.Data.Records.LastWeeksCash = function() {
 	this.slaveUpkeepRecruiter = 0,
 	this.slaveUpkeepArcade = 0,
 	this.slaveUpkeepMadam = 0,
+	this.slaveUpkeepMadamVign = 0,
 	this.slaveUpkeepBrothel = 0,
+	this.slaveUpkeepBrothelVign = 0,
 	this.slaveUpkeepWarden = 0,
 	this.slaveUpkeepJail = 0,
 	this.slaveUpkeepDj = 0,
@@ -109,13 +114,16 @@ App.Data.Records.LastWeeksCash = function() {
 	this.slaveUpkeepClinic = 0,
 	this.slaveUpkeepMilkmaid = 0,
 	this.slaveUpkeepDairy = 0,
+	this.slaveUpkeepDairyVign = 0,
 	this.slaveUpkeepFarmer = 0,
 	this.slaveUpkeepFarmyard = 0,
+	this.slaveUpkeepFarmyardVign = 0,
 	this.slaveUpkeepHgtoy = 0,
 	this.slaveUpkeepConcubine = 0,
 	this.slaveUpkeepMaster_suite = 0,
 	this.slaveUpkeepMatron = 0,
 	this.slaveUpkeepNanny = 0,
+	this.slaveUpkeepNannyVign = 0,
 	this.slaveUpkeepTeacher = 0,
 	this.slaveUpkeepSchool = 0,
 	this.slaveUpkeepSteward = 0,
-- 
GitLab