From c4fc54e44670009964ac9308151cc44f736f65b5 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Thu, 18 Feb 2021 19:13:43 -0500 Subject: [PATCH 1/2] Revert "Merge branch 'fix-oldTrust-and-oldDevotion-on-start-and-cheat' into 'pregmod-master'" This reverts commit baccc7cf15aa34d50f4571caf8fbe07971c423fe, reversing changes made to 4961bd3adfed52315497629ef9e2e28cca2ced0e. --- src/cheats/cheatEditSlave.js | 82 +++++++++++++++++- src/js/utilsSlave.js | 85 ------------------- src/npc/startingGirls/commitStartingGirl.tw | 1 - src/npc/startingGirls/startingGirls.js | 80 ++++++++++++++++- src/npc/startingGirls/startingGirlsPassage.js | 2 +- 5 files changed, 160 insertions(+), 90 deletions(-) diff --git a/src/cheats/cheatEditSlave.js b/src/cheats/cheatEditSlave.js index 8fdb6eab380..ba996646df7 100644 --- a/src/cheats/cheatEditSlave.js +++ b/src/cheats/cheatEditSlave.js @@ -56,11 +56,91 @@ App.UI.SlaveInteract.cheatEditSlave = function(slave) { return el; + /** Make sure user-entered values aren't crazy for starting girls + * @param {App.Entity.SlaveState} slave + */ + function cleanup(slave) { + slave.actualAge = Math.clamp(slave.actualAge, V.minimumSlaveAge, V.retirementAge - 1) || 18; + slave.physicalAge = slave.actualAge; + slave.visualAge = slave.actualAge; + slave.ovaryAge = slave.actualAge; + slave.birthWeek = Math.clamp(slave.birthWeek, 0, 51) || 0; + + slave.devotion = Math.clamp(slave.devotion, -100, 100) || 0; + slave.trust = Math.clamp(slave.trust, -100, 100) || 0; + if (slave.indenture >= 0) { + slave.indenture = Math.clamp(slave.indenture, 26, 208) || 26; + } + + slave.height = Math.clamp(slave.height, 85, 274) || 140; + slave.boobs = Math.clamp(Math.trunc(slave.boobs / 50) * 50, 0, 50000) || 200; + slave.hLength = Math.clamp(slave.hLength, 0, 500) || 40; + + resetEyeColor(slave, "both"); + slave.origRace = slave.race; + + if (slave.balls === 0) { + slave.scrotum = 0; + } + if (slave.vagina === -1) { + slave.vaginaLube = 0; + } + if (slave.preg > 0) { + if (slave.pregSource !== -1) { + slave.pregSource = 0; + } + } + if (slave.ovaries === 0) { + slave.preg = 0; + slave.pregType = 0; + slave.pregSource = 0; + slave.pregWeek = 0; + slave.pregKnown = 0; + slave.belly = 0; + slave.bellyPreg = 0; + } + if (slave.analArea < slave.anus) { + slave.analArea = slave.anus; + } + + slave.father = Number(slave.father) || 0; + slave.mother = Number(slave.mother) || 0; + + if (slave.counter.birthsTotal > 0) { + if (slave.pubertyXX < 1) { + slave.counter.birthsTotal = 0; + } + slave.counter.birthsTotal = Math.clamp(slave.counter.birthsTotal, 0, ((slave.actualAge - slave.pubertyAgeXX) * 50)); + } + if (slave.slaveName === "") { + slave.slaveName = "Nameless"; + } + if (slave.slaveSurname === "") { + slave.slaveSurname = 0; + } + + if ((slave.anus > 2 && slave.skill.anal <= 10) || (slave.anus === 0 && slave.skill.anal > 30)) { + slave.skill.anal = 15; + } + if (slave.vagina < 0) { + slave.skill.vaginal = 0; + } else if ((slave.vagina > 2 && slave.skill.vaginal <= 10) || (slave.vagina === 0 && slave.skill.vaginal > 30)) { + slave.skill.vaginal = 15; + } + + slave.prestige = Math.clamp(slave.prestige, 0, 3) || 0; + if (slave.prestige === 0) { + slave.prestigeDesc = 0; + } else if (slave.prestigeDesc === 0) { + slave.prestigeDesc = ""; + } + } + function finalize() { return App.UI.DOM.makeElement("div", App.UI.DOM.link( "Apply cheat edits", () => { - App.Utils.cleanupSlave(tempSlave); + cleanup(tempSlave); V.slaves[V.slaveIndices[slave.ID]] = tempSlave; }, [], diff --git a/src/js/utilsSlave.js b/src/js/utilsSlave.js index 21445b59ddb..205a7fd8801 100644 --- a/src/js/utilsSlave.js +++ b/src/js/utilsSlave.js @@ -3534,88 +3534,3 @@ globalThis.addPartner = function(slave, partner) { throw `Partner is not a number. Type of partner is ${typeof partner}, value is "${partner}"`; } }; - -/** Make sure user-entered values aren't crazy for starting or cheat girls - * @param {App.Entity.SlaveState} slave - */ -App.Utils.cleanupSlave = function(slave) { - slave.actualAge = Math.clamp(slave.actualAge, V.minimumSlaveAge, V.retirementAge - 1) || 18; - slave.physicalAge = slave.actualAge; - slave.visualAge = slave.actualAge; - slave.ovaryAge = slave.actualAge; - if (slave.birthWeek > 51) { - slave.birthWeek = slave.birthWeek % 52; - } - slave.birthWeek = Math.clamp(slave.birthWeek, 0, 51) || 0; - - slave.devotion = Math.clamp(slave.devotion, -100, 100) || 0; - slave.trust = Math.clamp(slave.trust, -100, 100) || 0; - slave.oldDevotion = slave.devotion; - slave.oldTrust = slave.trust; - if (slave.indenture >= 0) { - slave.indenture = Math.clamp(slave.indenture, 26, 208) || 26; - } - - slave.height = Math.clamp(slave.height, 85, 274) || 140; - slave.boobs = Math.clamp(Math.trunc(slave.boobs / 50) * 50, 0, 50000) || 200; - slave.hLength = Math.clamp(slave.hLength, 0, 500) || 40; - - resetEyeColor(slave, "both"); - slave.origRace = slave.race; - - if (slave.balls === 0) { - slave.scrotum = 0; - } - if (slave.vagina === -1) { - slave.vaginaLube = 0; - } - if (slave.preg > 0) { - if (slave.pregSource !== -1) { - slave.pregSource = 0; - } - } - if (slave.ovaries === 0) { - slave.preg = 0; - slave.pregType = 0; - slave.pregSource = 0; - slave.pregWeek = 0; - slave.pregKnown = 0; - slave.belly = 0; - slave.bellyPreg = 0; - } - if (slave.analArea < slave.anus) { - slave.analArea = slave.anus; - } - - slave.father = Number(slave.father) || 0; - slave.mother = Number(slave.mother) || 0; - - if (slave.counter.birthsTotal > 0) { - if (slave.pubertyXX < 1) { - slave.counter.birthsTotal = 0; - } - slave.counter.birthsTotal = Math.clamp(slave.counter.birthsTotal, 0, ((slave.actualAge - slave.pubertyAgeXX) * 50)); - } - if (slave.slaveName === "") { - slave.slaveName = "Nameless"; - } - if (slave.slaveSurname === "") { - slave.slaveSurname = 0; - } - - if ((slave.anus > 2 && slave.skill.anal <= 10) || (slave.anus === 0 && slave.skill.anal > 30)) { - slave.skill.anal = 15; - } - if (slave.vagina < 0) { - slave.skill.vaginal = 0; - } else if ((slave.vagina > 2 && slave.skill.vaginal <= 10) || (slave.vagina === 0 && slave.skill.vaginal > 30)) { - slave.skill.vaginal = 15; - } - - slave.prestige = Math.clamp(slave.prestige, 0, 3) || 0; - if (slave.prestige === 0) { - slave.prestigeDesc = 0; - } else if (slave.prestigeDesc === 0) { - slave.prestigeDesc = ""; - } -}; diff --git a/src/npc/startingGirls/commitStartingGirl.tw b/src/npc/startingGirls/commitStartingGirl.tw index 687827df205..8ce20e177e3 100644 --- a/src/npc/startingGirls/commitStartingGirl.tw +++ b/src/npc/startingGirls/commitStartingGirl.tw @@ -1,6 +1,5 @@ :: Commit Starting Girl [nobr] -<<run App.Utils.cleanupSlave($activeSlave)>> <<run App.StartingGirls.cleanup($activeSlave)>> <<set _beforeCareerBonus = clone($activeSlave)>> <<set _srcID = $activeSlave.ID>> diff --git a/src/npc/startingGirls/startingGirls.js b/src/npc/startingGirls/startingGirls.js index be4f2aea814..af72aade6f0 100644 --- a/src/npc/startingGirls/startingGirls.js +++ b/src/npc/startingGirls/startingGirls.js @@ -50,11 +50,87 @@ App.StartingGirls.generate = function(params) { return slave; }; -/** Make sure user-entered values aren't crazy for starting girls. If the cleanup should also apply to cheat editted slaves, use App.Utils.cleanupSlave(). +/** Make sure user-entered values aren't crazy for starting girls * @param {App.Entity.SlaveState} slave */ App.StartingGirls.cleanup = function(slave) { - // Empty for now. + slave.actualAge = Math.clamp(slave.actualAge, V.minimumSlaveAge, V.retirementAge - 1) || 18; + slave.physicalAge = slave.actualAge; + slave.visualAge = slave.actualAge; + slave.ovaryAge = slave.actualAge; + if (slave.birthWeek > 51) { + slave.birthWeek = slave.birthWeek % 52; + } + slave.birthWeek = Math.clamp(slave.birthWeek, 0, 51) || 0; + + slave.devotion = Math.clamp(slave.devotion, -100, 100) || 0; + slave.trust = Math.clamp(slave.trust, -100, 100) || 0; + if (slave.indenture >= 0) { + slave.indenture = Math.clamp(slave.indenture, 26, 208) || 26; + } + + slave.height = Math.clamp(slave.height, 85, 274) || 140; + slave.boobs = Math.clamp(Math.trunc(slave.boobs / 50) * 50, 0, 50000) || 200; + slave.hLength = Math.clamp(slave.hLength, 0, 500) || 40; + + resetEyeColor(slave, "both"); + slave.origRace = slave.race; + + if (slave.balls === 0) { + slave.scrotum = 0; + } + if (slave.vagina === -1) { + slave.vaginaLube = 0; + } + if (slave.preg > 0) { + if (slave.pregSource !== -1) { + slave.pregSource = 0; + } + } + if (slave.ovaries === 0) { + slave.preg = 0; + slave.pregType = 0; + slave.pregSource = 0; + slave.pregWeek = 0; + slave.pregKnown = 0; + slave.belly = 0; + slave.bellyPreg = 0; + } + if (slave.analArea < slave.anus) { + slave.analArea = slave.anus; + } + + slave.father = Number(slave.father) || 0; + slave.mother = Number(slave.mother) || 0; + + if (slave.counter.birthsTotal > 0) { + if (slave.pubertyXX < 1) { + slave.counter.birthsTotal = 0; + } + slave.counter.birthsTotal = Math.clamp(slave.counter.birthsTotal, 0, ((slave.actualAge - slave.pubertyAgeXX) * 50)); + } + if (slave.slaveName === "") { + slave.slaveName = "Nameless"; + } + if (slave.slaveSurname === "") { + slave.slaveSurname = 0; + } + + if ((slave.anus > 2 && slave.skill.anal <= 10) || (slave.anus === 0 && slave.skill.anal > 30)) { + slave.skill.anal = 15; + } + if (slave.vagina < 0) { + slave.skill.vaginal = 0; + } else if ((slave.vagina > 2 && slave.skill.vaginal <= 10) || (slave.vagina === 0 && slave.skill.vaginal > 30)) { + slave.skill.vaginal = 15; + } + + slave.prestige = Math.clamp(slave.prestige, 0, 3) || 0; + if (slave.prestige === 0) { + slave.prestigeDesc = 0; + } else if (slave.prestigeDesc === 0) { + slave.prestigeDesc = ""; + } }; /** Apply starting girl PC career bonus diff --git a/src/npc/startingGirls/startingGirlsPassage.js b/src/npc/startingGirls/startingGirlsPassage.js index f28d068ea16..f7116d7c87e 100644 --- a/src/npc/startingGirls/startingGirlsPassage.js +++ b/src/npc/startingGirls/startingGirlsPassage.js @@ -238,7 +238,7 @@ App.StartingGirls.passage = function() { App.UI.DOM.appendNewElement("hr", el); App.UI.tabBar.handlePreSelectedTab(V.tabChoice.StartingGirls); - App.Utils.cleanupSlave(V.activeSlave); + App.StartingGirls.cleanup(V.activeSlave); if (V.activeSlave.father === -1) { -- GitLab From 1b63d3cd07e68fecedbf5407ac5a076b04ed8453 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Thu, 18 Feb 2021 19:16:05 -0500 Subject: [PATCH 2/2] fix oldTrust and oldDev for cheat and starting girls --- src/cheats/cheatEditSlave.js | 82 +------------------------- src/npc/startingGirls/startingGirls.js | 2 + 2 files changed, 3 insertions(+), 81 deletions(-) diff --git a/src/cheats/cheatEditSlave.js b/src/cheats/cheatEditSlave.js index ba996646df7..65cd543a388 100644 --- a/src/cheats/cheatEditSlave.js +++ b/src/cheats/cheatEditSlave.js @@ -56,91 +56,11 @@ App.UI.SlaveInteract.cheatEditSlave = function(slave) { return el; - /** Make sure user-entered values aren't crazy for starting girls - * @param {App.Entity.SlaveState} slave - */ - function cleanup(slave) { - slave.actualAge = Math.clamp(slave.actualAge, V.minimumSlaveAge, V.retirementAge - 1) || 18; - slave.physicalAge = slave.actualAge; - slave.visualAge = slave.actualAge; - slave.ovaryAge = slave.actualAge; - slave.birthWeek = Math.clamp(slave.birthWeek, 0, 51) || 0; - - slave.devotion = Math.clamp(slave.devotion, -100, 100) || 0; - slave.trust = Math.clamp(slave.trust, -100, 100) || 0; - if (slave.indenture >= 0) { - slave.indenture = Math.clamp(slave.indenture, 26, 208) || 26; - } - - slave.height = Math.clamp(slave.height, 85, 274) || 140; - slave.boobs = Math.clamp(Math.trunc(slave.boobs / 50) * 50, 0, 50000) || 200; - slave.hLength = Math.clamp(slave.hLength, 0, 500) || 40; - - resetEyeColor(slave, "both"); - slave.origRace = slave.race; - - if (slave.balls === 0) { - slave.scrotum = 0; - } - if (slave.vagina === -1) { - slave.vaginaLube = 0; - } - if (slave.preg > 0) { - if (slave.pregSource !== -1) { - slave.pregSource = 0; - } - } - if (slave.ovaries === 0) { - slave.preg = 0; - slave.pregType = 0; - slave.pregSource = 0; - slave.pregWeek = 0; - slave.pregKnown = 0; - slave.belly = 0; - slave.bellyPreg = 0; - } - if (slave.analArea < slave.anus) { - slave.analArea = slave.anus; - } - - slave.father = Number(slave.father) || 0; - slave.mother = Number(slave.mother) || 0; - - if (slave.counter.birthsTotal > 0) { - if (slave.pubertyXX < 1) { - slave.counter.birthsTotal = 0; - } - slave.counter.birthsTotal = Math.clamp(slave.counter.birthsTotal, 0, ((slave.actualAge - slave.pubertyAgeXX) * 50)); - } - if (slave.slaveName === "") { - slave.slaveName = "Nameless"; - } - if (slave.slaveSurname === "") { - slave.slaveSurname = 0; - } - - if ((slave.anus > 2 && slave.skill.anal <= 10) || (slave.anus === 0 && slave.skill.anal > 30)) { - slave.skill.anal = 15; - } - if (slave.vagina < 0) { - slave.skill.vaginal = 0; - } else if ((slave.vagina > 2 && slave.skill.vaginal <= 10) || (slave.vagina === 0 && slave.skill.vaginal > 30)) { - slave.skill.vaginal = 15; - } - - slave.prestige = Math.clamp(slave.prestige, 0, 3) || 0; - if (slave.prestige === 0) { - slave.prestigeDesc = 0; - } else if (slave.prestigeDesc === 0) { - slave.prestigeDesc = ""; - } - } - function finalize() { return App.UI.DOM.makeElement("div", App.UI.DOM.link( "Apply cheat edits", () => { - cleanup(tempSlave); + App.StartingGirls.cleanup(tempSlave); V.slaves[V.slaveIndices[slave.ID]] = tempSlave; }, [], diff --git a/src/npc/startingGirls/startingGirls.js b/src/npc/startingGirls/startingGirls.js index af72aade6f0..03d7e780439 100644 --- a/src/npc/startingGirls/startingGirls.js +++ b/src/npc/startingGirls/startingGirls.js @@ -65,6 +65,8 @@ App.StartingGirls.cleanup = function(slave) { slave.devotion = Math.clamp(slave.devotion, -100, 100) || 0; slave.trust = Math.clamp(slave.trust, -100, 100) || 0; + slave.oldDevotion = slave.devotion; + slave.oldTrust = slave.trust; if (slave.indenture >= 0) { slave.indenture = Math.clamp(slave.indenture, 26, 208) || 26; } -- GitLab