From ed24007045f9668ec5e4e1d4110cb807c1a8f9d4 Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Sun, 7 Mar 2021 18:54:51 -0800
Subject: [PATCH] Don't bill the player for piercings in the JS cheat editor.

---
 .../bodyModification/bodyModification.js      | 20 ++++++++++++++++++-
 src/js/modification.js                        |  7 -------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/facilities/bodyModification/bodyModification.js b/src/facilities/bodyModification/bodyModification.js
index afd86c2d5e3..0b0a7979644 100644
--- a/src/facilities/bodyModification/bodyModification.js
+++ b/src/facilities/bodyModification/bodyModification.js
@@ -286,6 +286,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 						for (const location of validPiercingLocations) {
 							if (slave[`${location}Piercing`] !== piercingLevel) {
 								modReaction += App.Medicine.Modification.setPiercing(slave, location, piercingLevel);
+								billPiercing(piercingLevel);
 								if (piercingLevel > 1) {
 									degradation += 1;
 								}
@@ -304,6 +305,7 @@ App.UI.bodyModification = function(slave, cheat = false) {
 							capFirstChar(location),
 							() => {
 								modReaction = App.Medicine.Modification.setPiercing(slave, location, piercingLevel);
+								billPiercing(piercingLevel);
 								if (piercingLevel > 1) {
 									degradation += 1;
 								}
@@ -324,13 +326,15 @@ App.UI.bodyModification = function(slave, cheat = false) {
 							"smart piercing",
 							() => {
 								modReaction = App.Medicine.Modification.setPiercing(slave, "clit", 3);
+								billPiercing(3);
 								slave.clitSetting = "all";
 								degradation += 1;
 								refresh();
 							},
 							[],
 							"",
-							`Costs ${cashFormat(V.SPcost)}, unlocks options to mold sexuality`
+							cheat ? "Unlocks options to mold sexuality" :
+								`Costs ${cashFormat(V.SPcost)}, unlocks options to mold sexuality`
 						)
 					);
 				} else {
@@ -1451,6 +1455,20 @@ App.UI.bodyModification = function(slave, cheat = false) {
 		jQuery("#body-modification").empty().append(createPage());
 	}
 
+	/**
+	 * @param {number} weight
+	 */
+	function billPiercing(weight) {
+		if (!cheat) {
+			if (weight === 3) {
+				// smart piercings cost more
+				cashX(forceNeg(V.SPcost), "slaveMod", slave);
+			} else {
+				cashX(forceNeg(V.modCost), "slaveMod", slave);
+			}
+		}
+	}
+
 	function billMod() {
 		if (!cheat) {
 			cashX(forceNeg(V.modCost), "slaveMod", slave);
diff --git a/src/js/modification.js b/src/js/modification.js
index 13658f94fa6..cb297705c00 100644
--- a/src/js/modification.js
+++ b/src/js/modification.js
@@ -161,13 +161,6 @@ App.Medicine.Modification.addBulkScars = function(slave, location, type, weight)
  * @returns {string} slave reaction
  */
 App.Medicine.Modification.setPiercing = function(slave, location, weight) {
-	if (weight === 3) {
-		// smart piercings cost more
-		cashX(forceNeg(V.SPcost), "slaveMod", slave);
-	} else {
-		cashX(forceNeg(V.modCost), "slaveMod", slave);
-	}
-
 	// reaction
 	const {He, he, His, his, him} = getPronouns(slave);
 	const delta = weight - slave[`${location}Piercing`];
-- 
GitLab