From 73bcec77dad7ca2a453b114748197dfff83ca242 Mon Sep 17 00:00:00 2001 From: lowercase-donkey <lowercasedonkey@gmail.com> Date: Mon, 27 May 2019 16:07:38 -0400 Subject: [PATCH] early work --- src/js/SlaveState.js | 26 +++++++++++++++++++++++ src/js/datatypeCleanupJS.js | 42 +++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/src/js/SlaveState.js b/src/js/SlaveState.js index b920ae803e6..c16046c6b41 100644 --- a/src/js/SlaveState.js +++ b/src/js/SlaveState.js @@ -254,6 +254,32 @@ App.Entity.SlaveActionsCountersState = class { } }; +App.Entity.SlaveBrandState = class { + constructor() { + this["ear"] = 0; + this["cheek"] = 0; + this["shoulder"] = 0; + this["breast"] = 0; + this["upper arm"] = 0; + this["lower arm"] = 0; + this["wrist"] = 0; + this["hand"] = 0; + this["buttock"] = 0; + this["thigh"] = 0; + this["calve"] = 0; + this["ankle"] = 0; + this["foot"] = 0; + this["neck"] = 0; + this["chest"] = 0; + this["belly"] = 0; + this["pubic mound"] = 0; + this["penis"] = 0; + this["testicle"] = 0; + this["back"] = 0; + this["lower back"] = 0; + } +}; + /** * Encapsulates various custom properties, set by users */ diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js index 910e581b397..edf6576b517 100644 --- a/src/js/datatypeCleanupJS.js +++ b/src/js/datatypeCleanupJS.js @@ -17,6 +17,7 @@ App.Entity.Utils.SlaveDataSchemeCleanup = (function() { migrateSkills(slave); migrateCounters(slave); migrateCustomProperties(slave); + migrateBrand(slave); } /** @@ -165,6 +166,47 @@ App.Entity.Utils.SlaveDataSchemeCleanup = (function() { } } } + + /** + * @param {App.Entity.SlaveState} slave + */ + function migrateBrand(slave) { + if (!slave.hasOwnProperty("brand")) { + const V = State.variables; + slave.brand = new App.Entity.SlaveBrandState(); + let c = slave.brand; + const nameMap = { // old => new + brandlocation: c, + ["ear"]: + ["cheek"]: + ["shoulder"]: + ["breast"]: + ["upper arm"]: + ["lower arm"]: + ["wrist"]: + ["hand"]: + ["buttock"]: + ["thigh"]: + ["calve"]: + ["ankle"]: + ["foot"]: + ["neck"]: + ["chest"]: + ["belly"]: + ["pubic mound"]: + ["penis"]: + ["testicle"]: + ["back"]: + ["lower back"]: + }; + for (let prop in slave) { + if (nameMap.hasOwnProperty(prop)) { + c[nameMap[prop]] = slave[prop]; + delete slave[prop]; + } + } + } + } })(); /* -- GitLab