From 98732e3339dc8f0f1604bc9ee2ef55125a454fd7 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Mon, 30 Nov 2020 17:01:08 -0500 Subject: [PATCH] put billing and gates in function --- .../bodyModification/bodyModification.js | 79 ++++++++----------- 1 file changed, 34 insertions(+), 45 deletions(-) diff --git a/src/facilities/bodyModification/bodyModification.js b/src/facilities/bodyModification/bodyModification.js index 8cd507b4c2d..75a1a17c4f7 100644 --- a/src/facilities/bodyModification/bodyModification.js +++ b/src/facilities/bodyModification/bodyModification.js @@ -592,9 +592,7 @@ App.UI.bodyModification = function(slave, cheat = false) { "Remove tattoos", () => { slave.birthsTat = -1; - if (!cheat) { - cashX(forceNeg(V.modCost), "slaveMod", slave); - } + billMod(); refresh(); } ) @@ -654,9 +652,7 @@ App.UI.bodyModification = function(slave, cheat = false) { "Remove tattoos", () => { slave.abortionTat = -1; - if (!cheat) { - cashX(forceNeg(V.modCost), "slaveMod", slave); - } + billMod(); refresh(); } ) @@ -735,9 +731,7 @@ App.UI.bodyModification = function(slave, cheat = false) { slave.custom.tattoo, (v) => { slave.custom.tattoo = v; - if (!cheat) { - cashX(forceNeg(V.modCost), "slaveMod", slave); - } + billMod(); refresh(); } ) @@ -750,9 +744,8 @@ App.UI.bodyModification = function(slave, cheat = false) { "Remove custom Tattoo", () => { slave.custom.tattoo = ""; - if (!cheat) { - cashX(forceNeg(V.modCost), "slaveMod", slave); - } + billMod(); + refresh(); } ) ); @@ -799,10 +792,8 @@ App.UI.bodyModification = function(slave, cheat = false) { () => { scarApplied = 0; delete slave.scar[_scarName]; - if (!cheat) { - cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - degradation -= 10; - } + billSurgery(); + degradation -= 10; refresh(); } ) @@ -964,10 +955,8 @@ App.UI.bodyModification = function(slave, cheat = false) { V.scarTarget.local = _leftTarget; scarApplied = 1; App.Medicine.Modification.addScar(slave, _leftTarget, V.scarDesign.local); - if (!cheat) { - cashX(forceNeg(V.modCost), "slaveMod", slave); - degradation += 10; - } + billMod(); + degradation += 10; refresh(); } ) @@ -988,10 +977,8 @@ App.UI.bodyModification = function(slave, cheat = false) { V.scarTarget.local = _rightTarget; scarApplied = 1; App.Medicine.Modification.addScar(slave, _rightTarget, V.scarDesign.local); - if (!cheat) { - cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - degradation += 10; - } + billSurgery(); + degradation += 10; refresh(); } ) @@ -1044,11 +1031,9 @@ App.UI.bodyModification = function(slave, cheat = false) { degradation += 10; } } - if (!cheat) { - cashX(forceNeg(V.modCost), "slaveMod", slave); - scarApplied = 1; - degradation += 10; - } + billMod(); + scarApplied = 1; + degradation += 10; refresh(); } ) @@ -1086,10 +1071,8 @@ App.UI.bodyModification = function(slave, cheat = false) { () => { brandApplied = false; delete slave.brand[brandPlace]; - if (!cheat) { - cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - degradation -= 10; - } + billSurgery(); + degradation -= 10; refresh(); }, ) @@ -1195,10 +1178,8 @@ App.UI.bodyModification = function(slave, cheat = false) { () => { brandApplied = true; slave.brand[leftTarget] = check(V.brandDesign.local); - if (!cheat) { - cashX(forceNeg(V.modCost), "slaveMod", slave); - degradation += 10; - } + billMod(); + degradation += 10; refresh(); }, ) @@ -1229,10 +1210,8 @@ App.UI.bodyModification = function(slave, cheat = false) { () => { brandApplied = true; slave.brand[rightTarget] = check(V.brandDesign.local); - if (!cheat) { - cashX(forceNeg(V.modCost), "slaveMod", slave); - degradation += 10; - } + billMod(); + degradation += 10; refresh(); }, ) @@ -1266,10 +1245,8 @@ App.UI.bodyModification = function(slave, cheat = false) { () => { brandApplied = true; slave.brand[V.brandTarget.local] = V.brandDesign.local; - if (!cheat) { - cashX(forceNeg(V.modCost), "slaveMod", slave); - degradation += 10; - } + billMod(); + degradation += 10; refresh(); }, ) @@ -1417,4 +1394,16 @@ App.UI.bodyModification = function(slave, cheat = false) { function refresh() { jQuery("#body-modification").empty().append(createPage()); } + + function billMod() { + if (!cheat) { + cashX(forceNeg(V.modCost), "slaveMod", slave); + } + } + + function billSurgery() { + if (!cheat) { + cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); + } + } }; -- GitLab