From c98aa2ca9802e06388c301ca46c8fb13ec019ead Mon Sep 17 00:00:00 2001
From: i107760 <13422-i107760@users.noreply.gitgud.io>
Date: Sat, 21 Mar 2020 19:41:44 +0100
Subject: [PATCH] Rework 'saWorkTheFarm.js' and add new tracked categories to
 'recordTemplates.js'

---
 src/endWeek/saWorkTheFarm.js               | 9 +++++----
 src/interaction/budgets/recordTemplates.js | 1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/endWeek/saWorkTheFarm.js b/src/endWeek/saWorkTheFarm.js
index 31eb4fbf8e3..1ee06488729 100644
--- a/src/endWeek/saWorkTheFarm.js
+++ b/src/endWeek/saWorkTheFarm.js
@@ -504,15 +504,16 @@ window.saWorkTheFarm = function(slave) {
 		t += `<span class="story-label">This week</span> ${vignette.text}`;
 		if (vignette.type === "cash") {
 			let FResultNumber = FResult(slave);
+			const cashVign = Math.trunc(FResultNumber * vignette.effect);
 			if (vignette.effect > 0) {
-				t += ` <span class="yellowgreen">making you an extra ${cashFormat(Math.trunc(FResultNumber * vignette.effect))}.</span> `;
+				t += ` <span class="yellowgreen">making you an extra ${cashFormat(cashVign)}.</span> `;
 			} else if (vignette.effect < 0) {
-				t += ` <span class="red">losing you ${cashFormat(Math.abs(Math.trunc(FResultNumber * vignette.effect)))}.</span> `;
+				t += ` <span class="red">losing you ${cashFormat(Math.abs(cashVign))}.</span> `;
 			} else {
 				t += ` an incident without lasting effect. `;
 			}
-			cashX(Math.trunc(FResultNumber * vignette.effect), "farmyard");
-			incomeStats.income += (Math.trunc(FResultNumber * vignette.effect));
+			cashX(cashVign, "slaveIncomeFarmyardVign", slave);
+			incomeStats.income += cashVign;
 		} else if (vignette.type === "devotion") {
 			if (vignette.effect > 0) {
 				if (slave.devotion > 50) {
diff --git a/src/interaction/budgets/recordTemplates.js b/src/interaction/budgets/recordTemplates.js
index 47cb2e587fc..14ea29dffab 100644
--- a/src/interaction/budgets/recordTemplates.js
+++ b/src/interaction/budgets/recordTemplates.js
@@ -64,6 +64,7 @@ App.Data.Records.LastWeeksCash = function() {
 	this.slaveIncomeDairyVign = 0,
 	this.slaveIncomeFarmer = 0,
 	this.slaveIncomeFarmyard = 0,
+	this.slaveIncomeFarmyardVign = 0,
 	this.slaveIncomeHgtoy = 0,
 	this.slaveIncomeConcubine = 0,
 	this.slaveIncomeMaster_suite = 0,
-- 
GitLab