From bcc904eb0d9f4b07233e0a29c1edc2e7c01ff43d Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Mon, 23 Dec 2019 16:28:55 -0800 Subject: [PATCH] implement release rules migration for BC --- src/js/datatypeCleanupJS.js | 55 +++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js index 78999d56e79..3144aaceef9 100644 --- a/src/js/datatypeCleanupJS.js +++ b/src/js/datatypeCleanupJS.js @@ -14,6 +14,7 @@ App.Entity.Utils.SlaveDataSchemeCleanup = (function() { */ function SlaveDataSchemeCleanup(slave) { migrateRules(slave); + migrateReleaseRules(slave.rules); migratePorn(slave); migrateSkills(slave); migrateCounters(slave); @@ -50,6 +51,57 @@ App.Entity.Utils.SlaveDataSchemeCleanup = (function() { } } + /** + * Must be run AFTER migrateRules + * @param {App.Entity.RuleState} rules + */ + function migrateReleaseRules(rulestate) + { + if (typeof rulestate.release === "string") { + let newRule = new App.Entity.ReleaseRulesState(); + switch (rulestate.release) { + case "chastity": + newRule.masturbation = 0; + newRule.partner = 0; + newRule.family = 0; + newRule.slaves = 0; + newRule.master = 0; + break; + case "restrictive": + newRule.masturbation = 0; + newRule.partner = 1; + newRule.family = 0; + newRule.slaves = 0; + newRule.master = 1; + break; + case "masturbation": + newRule.masturbation = 1; + newRule.partner = 0; + newRule.family = 0; + newRule.slaves = 0; + newRule.master = 1; + break; + case "sapphic": + newRule.masturbation = 0; + newRule.partner = 1; + newRule.family = 1; + newRule.slaves = 1; + newRule.master = 1; + break; + case "permissive": + newRule.masturbation = 1; + newRule.partner = 1; + newRule.family = 1; + newRule.slaves = 1; + newRule.master = 1; + break; + } + rulestate.release = newRule; + } else if (typeof rulestate.release !== "object" || rulestate.release === null) { + rulestate.release = new App.Entity.ReleaseRulesState(); + } + } + /** * @param {App.Entity.SlaveState} slave */ @@ -2152,8 +2204,7 @@ App.Entity.Utils.GenePoolRecordCleanup = (function() { "preg", "pregSource", "pregType", "pregAdaptation", "labor", "bellyAccessory", "clitSetting", - "rules.living", "rules.speech", "rules.release", "rules.relationship", "rules.lactation", - "rules.punishment", "rules.reward", + "rules", "useRulesAssistant", "diet", "dietCum", "dietMilk", "tired", -- GitLab