Mythras v1.3.1, fixing bug in versioning from v1.2.X to v1.3.X resulting in data loss

This commit is contained in:
Matthew Carpenter
2017-11-03 00:18:31 -04:00
parent bf0421948b
commit 6d587e5bea
+16 -10
View File
@@ -1,7 +1,7 @@
<div class="wrapper">
<!-- Header -->
<div class="logo float-right">
<span class="float-right"><span class="bold" data-i18n="sheet-version-u">Sheet Version</span>: <input type="text" class="disabled number-width text-align-center" name="attr_version" value="1.3.0"></span>
<span class="float-right"><span class="bold" data-i18n="sheet-version-u">Sheet Version</span>: <input type="text" class="disabled number-width text-align-center" name="attr_version" value="1.3.1"></span>
<img src="http://i.imgur.com/Sm3ilMW.png">
</div>
@@ -3261,7 +3261,7 @@
function upgrade_1_2_0_to_1_3_0() {
console.log("convert to configable hit locations");
var location1_newattrs = {};
getAttrs(["right_leg_armor_ap", "right_leg_armor_equipped", "right_leg_other_ap", "attr_right_leg_hp", "right_leg_hp_max_base", "right_leg_hp_max_other", "attr_right_leg_details", "attr_right_leg_armor_type", "attr_right_leg_armor_enc"], function(v) {
getAttrs(["right_leg_armor_ap", "right_leg_armor_equipped", "right_leg_other_ap", "right_leg_hp", "right_leg_hp_max_base", "right_leg_hp_max_other", "right_leg_details", "right_leg_armor_type", "right_leg_armor_enc", "location1_armor_ap", "location1_armor_equipped", "location1_other_ap", "location1_hp", "location1_hp_max_base", "location1_hp_max_other", "location1_details", "location1_armor_type", "location1_armor_enc"], function(v) {
if(v["right_leg_armor_ap"]) {
location1_newattrs["location1_armor_ap"] = v.right_leg_armor_ap;
}
@@ -3294,7 +3294,7 @@
});
var location2_newattrs = {};
getAttrs(["left_leg_armor_ap", "left_leg_armor_equipped", "left_leg_other_ap", "attr_left_leg_hp", "left_leg_hp_max_base", "left_leg_hp_max_other", "attr_left_leg_details", "attr_left_leg_armor_type", "attr_left_leg_armor_enc"], function(v) {
getAttrs(["left_leg_armor_ap", "left_leg_armor_equipped", "left_leg_other_ap", "left_leg_hp", "left_leg_hp_max_base", "left_leg_hp_max_other", "left_leg_details", "left_leg_armor_type", "left_leg_armor_enc", "location2_armor_ap", "location2_armor_equipped", "location2_other_ap", "location2_hp", "location2_hp_max_base", "location2_hp_max_other", "location2_details", "location2_armor_type", "location2_armor_enc"], function(v) {
if(v["left_leg_armor_ap"]) {
location2_newattrs["location2_armor_ap"] = v.left_leg_armor_ap;
}
@@ -3327,7 +3327,7 @@
});
var location3_newattrs = {};
getAttrs(["abdomen_armor_ap", "abdomen_armor_equipped", "abdomen_other_ap", "attr_abdomen_hp", "abdomen_hp_max_base", "abdomen_hp_max_other", "attr_abdomen_details", "attr_abdomen_armor_type", "attr_abdomen_armor_enc"], function(v) {
getAttrs(["abdomen_armor_ap", "abdomen_armor_equipped", "abdomen_other_ap", "abdomen_hp", "abdomen_hp_max_base", "abdomen_hp_max_other", "abdomen_details", "abdomen_armor_type", "abdomen_armor_enc", "location3_armor_ap", "location3_armor_equipped", "location3_other_ap", "location3_hp", "location3_hp_max_base", "location3_hp_max_other", "location3_details", "location3_armor_type", "location3_armor_enc"], function(v) {
if(v["abdomen_armor_ap"]) {
location3_newattrs["location3_armor_ap"] = v.abdomen_armor_ap;
}
@@ -3360,7 +3360,7 @@
});
var location4_newattrs = {};
getAttrs(["chest_armor_ap", "chest_armor_equipped", "chest_other_ap", "attr_chest_hp", "chest_hp_max_base", "chest_hp_max_other", "attr_chest_details", "attr_chest_armor_type", "attr_chest_armor_enc"], function(v) {
getAttrs(["chest_armor_ap", "chest_armor_equipped", "chest_other_ap", "chest_hp", "chest_hp_max_base", "chest_hp_max_other", "chest_details", "chest_armor_type", "chest_armor_enc", "location4_armor_ap", "location4_armor_equipped", "location4_other_ap", "location4_hp", "location4_hp_max_base", "location4_hp_max_other", "location4_details", "location4_armor_type", "location4_armor_enc"], function(v) {
if(v["chest_armor_ap"]) {
location4_newattrs["location4_armor_ap"] = v.chest_armor_ap;
}
@@ -3393,7 +3393,7 @@
});
var location5_newattrs = {};
getAttrs(["right_arm_armor_ap", "right_arm_armor_equipped", "right_arm_other_ap", "attr_right_arm_hp", "right_arm_hp_max_base", "right_arm_hp_max_other", "attr_right_arm_details", "attr_right_arm_armor_type", "attr_right_arm_armor_enc"], function(v) {
getAttrs(["right_arm_armor_ap", "right_arm_armor_equipped", "right_arm_other_ap", "right_arm_hp", "right_arm_hp_max_base", "right_arm_hp_max_other", "right_arm_details", "right_arm_armor_type", "right_arm_armor_enc", "location5_armor_ap", "location5_armor_equipped", "location5_other_ap", "location5_hp", "location5_hp_max_base", "location5_hp_max_other", "location5_details", "location5_armor_type", "location5_armor_enc"], function(v) {
if(v["right_arm_armor_ap"]) {
location5_newattrs["location5_armor_ap"] = v.right_arm_armor_ap;
}
@@ -3426,7 +3426,7 @@
});
var location6_newattrs = {};
getAttrs(["left_arm_armor_ap", "left_arm_armor_equipped", "left_arm_other_ap", "attr_left_arm_hp", "left_arm_hp_max_base", "left_arm_hp_max_other", "attr_left_arm_details", "attr_left_arm_armor_type", "attr_left_arm_armor_enc"], function(v) {
getAttrs(["left_arm_armor_ap", "left_arm_armor_equipped", "left_arm_other_ap", "left_arm_hp", "left_arm_hp_max_base", "left_arm_hp_max_other", "left_arm_details", "left_arm_armor_type", "left_arm_armor_enc", "location6_armor_ap", "location6_armor_equipped", "location6_other_ap", "location6_hp", "location6_hp_max_base", "location6_hp_max_other", "location6_details", "location6_armor_type", "location6_armor_enc"], function(v) {
if(v["left_arm_armor_ap"]) {
location6_newattrs["location6_armor_ap"] = v.left_arm_armor_ap;
}
@@ -3459,7 +3459,7 @@
});
var location7_newattrs = {};
getAttrs(["head_armor_ap", "head_armor_equipped", "head_other_ap", "attr_head_hp", "head_hp_max_base", "head_hp_max_other", "attr_head_details", "attr_head_armor_type", "attr_head_armor_enc"], function(v) {
getAttrs(["head_armor_ap", "head_armor_equipped", "head_other_ap", "head_hp", "head_hp_max_base", "head_hp_max_other", "head_details", "head_armor_type", "head_armor_enc", "location7_armor_ap", "location7_armor_equipped", "location7_other_ap", "location7_hp", "location7_hp_max_base", "location7_hp_max_other", "location7_details", "location7_armor_type", "location7_armor_enc"], function(v) {
if(v["head_armor_ap"]) {
location7_newattrs["location7_armor_ap"] = v.head_armor_ap;
}
@@ -3512,9 +3512,15 @@
versioning();
}
else if(v["version"] === "1.2.0") {
console.log("upgrading to v1.3.0");
console.log("upgrading to v1.3.1");
upgrade_1_2_0_to_1_3_0();
setAttrs({version: "1.3.0"});
setAttrs({version: "1.3.1"});
versioning();
}
else if(v["version"] === "1.3.0") {
console.log("upgrading to v1.3.1");
// upgrade_1_2_0_to_1_3_0();
setAttrs({version: "1.3.1"});
versioning();
}
else {