From f399af04163dfb470e51da8713034b0f6301bb91 Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Wed, 8 Jan 2020 11:42:20 -0800 Subject: [PATCH] Move customSlave/huskSlave backcompat into updateCustomSlaveOrder.js, where it's clearly distinct from updating a slave object in updateSlaveObject.js. --- .../updateCustomSlaveOrder.js | 43 +++++++++++++++++++ src/uncategorized/BackwardsCompatibility.tw | 42 ++---------------- 2 files changed, 46 insertions(+), 39 deletions(-) create mode 100644 src/data/backwardsCompatibility/updateCustomSlaveOrder.js diff --git a/src/data/backwardsCompatibility/updateCustomSlaveOrder.js b/src/data/backwardsCompatibility/updateCustomSlaveOrder.js new file mode 100644 index 00000000000..b5f5baa500e --- /dev/null +++ b/src/data/backwardsCompatibility/updateCustomSlaveOrder.js @@ -0,0 +1,43 @@ +/** Update custom slave orders (customSlave/huskSlave). + * @param {App.Entity.CustomSlaveOrder} customSlaveOrder + */ +App.Update.CustomSlaveOrder = function(customSlaveOrder) { + if (!customSlaveOrder.hasOwnProperty("leg")) { + if (jsDef(customSlaveOrder.amp) && customSlaveOrder.amp === 1) { + customSlaveOrder.leg = {left: null, right: null}; + } else { + customSlaveOrder.leg = {left: new App.Entity.LimbState(), right: new App.Entity.LimbState()} + } + } + + if (!customSlaveOrder.hasOwnProperty("arm")) { + if (jsDef(customSlaveOrder.amp) && customSlaveOrder.amp === 1) { + customSlaveOrder.arm = {left: null, right: null}; + } else { + customSlaveOrder.arm = {left: new App.Entity.LimbState(), right: new App.Entity.LimbState()} + } + } + + if (customSlaveOrder.hasOwnProperty("amp")) { + delete customSlaveOrder.amp; + } + + if (!customSlaveOrder.hasOwnProperty("skill")) { + customSlaveOrder.skill = {whore: 15, combat: 0}; + } + + if (customSlaveOrder.hasOwnProperty("whoreSkills")) { + customSlaveOrder.skill.whore = customSlaveOrder.whoreSkills; + delete customSlaveOrder.whoreSkills; + } + + if (customSlaveOrder.hasOwnProperty("combatSkills")) { + customSlaveOrder.skill.combat = customSlaveOrder.combatSkills; + delete customSlaveOrder.combatSkills; + } + + if (V.releaseID < 1059) { + customSlaveOrder.eye = new App.Entity.EyeState(); + delete customSlaveOrder.eyes; + } +}; diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index 23354d1442f..2efb59b9f0b 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -113,45 +113,6 @@ <<set $scarDesign = {primary: "generic", local: "generic"}>> <</if>> -<<if !$customSlave.hasOwnProperty("leg")>> - <<if (def $customSlave.amp) && ($customSlave.amp === 1)>> - <<set $customSlave.leg = {left: null, right: null}>> - <<else>> - <<set $customSlave.leg = {left: new App.Entity.LimbState(), right: new App.Entity.LimbState()}>> - <</if>> -<</if>> - -<<if !$customSlave.hasOwnProperty("arm")>> - <<if (def $customSlave.amp) && ($customSlave.amp === 1)>> - <<set $customSlave.arm = {left: null, right: null}>> - <<else>> - <<set $customSlave.arm = {left: new App.Entity.LimbState(), right: new App.Entity.LimbState()}>> - <</if>> -<</if>> - -<<if $customSlave.hasOwnProperty("amp")>> - <<run delete $customSlave.amp>> -<</if>> - -<<if !$customSlave.hasOwnProperty("skill")>> - <<set $customSlave.skill = {whore: 15, combat: 0}>> -<</if>> - -<<if $customSlave.hasOwnProperty("whoreSkills")>> - <<set $customSlave.skill.whore = $customSlave.whoreSkills>> - <<run delete $customSlave.whoreSkills>> -<</if>> - -<<if $customSlave.hasOwnProperty("combatSkills")>> - <<set $customSlave.skill.combat = $customSlave.combatSkills>> - <<run delete $customSlave.combatSkills>> -<</if>> - -<<if $releaseID < 1059>> - <<set $customSlave.eye = new App.Entity.EyeState()>> - <<run delete $customSlave.eyes>> -<</if>> - <<if def $servantMilkersJobs>> <<unset $servantMilkersJobs>> <</if>> @@ -1366,6 +1327,9 @@ <<if ndef $huskSlave>> <<set $huskSlave = new App.Entity.CustomSlaveOrder()>> <</if>> +<<run App.Update.CustomSlaveOrder($huskSlave)>> +<<run App.Update.CustomSlaveOrder($customSlave)>> + <<if ndef $pedo_mode>> <<set $pedo_mode = 0>> <</if>> -- GitLab