Fix some encoding errors
This commit is contained in:
parent
21fefa73f0
commit
509ffc29d6
2 changed files with 28 additions and 0 deletions
27
build.js
27
build.js
|
@ -116,6 +116,9 @@ class Build{
|
|||
} else {
|
||||
try {
|
||||
let helmet = getCraftFromHash(equipment[0]);
|
||||
if (helmet.statMap.get("type") !== "helmet") {
|
||||
throw new Error("Not a helmet");
|
||||
}
|
||||
this.powders[0] = this.powders[0].slice(0,helmet.statMap.slots);
|
||||
helmet.statMap.set("powders",this.powders[0].slice());
|
||||
helmet.applyPowders();
|
||||
|
@ -136,6 +139,9 @@ class Build{
|
|||
} else {
|
||||
try {
|
||||
let chestplate = getCraftFromHash(equipment[1]);
|
||||
if (chestplate.statMap.get("type") !== "chestplate") {
|
||||
throw new Error("Not a chestplate");
|
||||
}
|
||||
this.powders[1] = this.powders[1].slice(0,chestplate.statMap.slots);
|
||||
chestplate.statMap.set("powders",this.powders[1].slice());
|
||||
chestplate.applyPowders();
|
||||
|
@ -155,6 +161,9 @@ class Build{
|
|||
} else {
|
||||
try {
|
||||
let leggings = getCraftFromHash(equipment[2]);
|
||||
if (leggings.statMap.get("type") !== "leggings") {
|
||||
throw new Error("Not a leggings");
|
||||
}
|
||||
this.powders[2] = this.powders[2].slice(0,leggings.statMap.slots);
|
||||
leggings.statMap.set("powders",this.powders[2].slice());
|
||||
leggings.applyPowders();
|
||||
|
@ -174,6 +183,9 @@ class Build{
|
|||
} else {
|
||||
try {
|
||||
let boots = getCraftFromHash(equipment[3]);
|
||||
if (boots.statMap.get("type") !== "boots") {
|
||||
throw new Error("Not a boots");
|
||||
}
|
||||
this.powders[3] = this.powders[3].slice(0,boots.statMap.slots);
|
||||
boots.statMap.set("powders",this.powders[3].slice());
|
||||
boots.applyPowders();
|
||||
|
@ -192,6 +204,9 @@ class Build{
|
|||
}else{
|
||||
try {
|
||||
let ring = getCraftFromHash(equipment[4]);
|
||||
if (ring.statMap.get("type") !== "ring") {
|
||||
throw new Error("Not a ring");
|
||||
}
|
||||
this.ring1 = ring.statMap;
|
||||
this.craftedItems.push(ring);
|
||||
} catch (Error) {
|
||||
|
@ -206,6 +221,9 @@ class Build{
|
|||
}else{
|
||||
try {
|
||||
let ring = getCraftFromHash(equipment[5]);
|
||||
if (ring.statMap.get("type") !== "ring") {
|
||||
throw new Error("Not a ring");
|
||||
}
|
||||
this.ring2 = ring.statMap;
|
||||
this.craftedItems.push(ring);
|
||||
} catch (Error) {
|
||||
|
@ -220,6 +238,9 @@ class Build{
|
|||
}else{
|
||||
try {
|
||||
let bracelet = getCraftFromHash(equipment[6]);
|
||||
if (bracelet.statMap.get("type") !== "bracelet") {
|
||||
throw new Error("Not a bracelet");
|
||||
}
|
||||
this.bracelet = bracelet.statMap;
|
||||
this.craftedItems.push(bracelet);
|
||||
} catch (Error) {
|
||||
|
@ -234,6 +255,9 @@ class Build{
|
|||
}else{
|
||||
try {
|
||||
let necklace = getCraftFromHash(equipment[7]);
|
||||
if (necklace.statMap.get("type") !== "necklace") {
|
||||
throw new Error("Not a necklace");
|
||||
}
|
||||
this.necklace = necklace.statMap;
|
||||
this.craftedItems.push(necklace);
|
||||
} catch (Error) {
|
||||
|
@ -254,6 +278,9 @@ class Build{
|
|||
}else{
|
||||
try {
|
||||
let weapon = getCraftFromHash(equipment[8]);
|
||||
if (weapon.statMap.get("category") !== "weapon") {
|
||||
throw new Error("Not a weapon");
|
||||
}
|
||||
this.weapon = weapon.statMap;
|
||||
this.craftedItems.push(weapon);
|
||||
this.powders[4] = this.powders[4].slice(0,this.weapon.slots);
|
||||
|
|
|
@ -326,6 +326,7 @@ function encodeBuild() {
|
|||
for (const item of player_build.items) {
|
||||
if (item.get("crafted")) {
|
||||
build_string += "-"+encodeCraft(player_build.craftedItems[crafted_idx])
|
||||
crafted_idx += 1
|
||||
}
|
||||
else {
|
||||
build_string += Base64.fromIntN(item.get("id"), 3);
|
||||
|
|
Loading…
Reference in a new issue