HOTFIX: patch custom parsing/saving

renamed types -> all_types
This commit is contained in:
hppeng 2022-07-23 23:10:19 -07:00
parent 8efe671fae
commit 6b4c954010

View file

@ -65,7 +65,7 @@ function encodeCustom(custom, verbose) {
if (typeof (val) === "string" && val !== "") { if (typeof (val) === "string" && val !== "") {
if ((damages.includes(id) && val === "0-0") || (!verbose && ["lore", "majorIds", "quest", "materials", "drop", "set"].includes(id))) { continue; } if ((damages.includes(id) && val === "0-0") || (!verbose && ["lore", "majorIds", "quest", "materials", "drop", "set"].includes(id))) { continue; }
if (id === "type") { if (id === "type") {
hash += Base64.fromIntN(i, 2) + Base64.fromIntN(types.indexOf(val.substring(0, 1).toUpperCase() + val.slice(1)), 1); hash += Base64.fromIntN(i, 2) + Base64.fromIntN(all_types.indexOf(val.substring(0, 1).toUpperCase() + val.slice(1)), 1);
} else if (id === "tier") { } else if (id === "tier") {
hash += Base64.fromIntN(i, 2) + Base64.fromIntN(tiers.indexOf(val), 1); hash += Base64.fromIntN(i, 2) + Base64.fromIntN(tiers.indexOf(val), 1);
} else if (id === "atkSpd") { } else if (id === "atkSpd") {
@ -147,7 +147,7 @@ function getCustomFromHash(hash) {
val = tiers[Base64.toInt(tag.charAt(2))]; val = tiers[Base64.toInt(tag.charAt(2))];
len = -1; len = -1;
} else if (id === "type") { } else if (id === "type") {
val = types[Base64.toInt(tag.charAt(2))]; val = all_types[Base64.toInt(tag.charAt(2))];
len = -1; len = -1;
} else if (id === "atkSpd") { } else if (id === "atkSpd") {
val = attackSpeeds[Base64.toInt(tag.charAt(2))]; val = attackSpeeds[Base64.toInt(tag.charAt(2))];
@ -179,7 +179,8 @@ function getCustomFromHash(hash) {
return new Custom(statMap); return new Custom(statMap);
} }
} catch (error) { } catch (error) {
//console.log(statMap); console.log(error);
console.log(statMap);
return undefined; return undefined;
} }