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 {
|
} else {
|
||||||
try {
|
try {
|
||||||
let helmet = getCraftFromHash(equipment[0]);
|
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);
|
this.powders[0] = this.powders[0].slice(0,helmet.statMap.slots);
|
||||||
helmet.statMap.set("powders",this.powders[0].slice());
|
helmet.statMap.set("powders",this.powders[0].slice());
|
||||||
helmet.applyPowders();
|
helmet.applyPowders();
|
||||||
|
@ -136,6 +139,9 @@ class Build{
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
let chestplate = getCraftFromHash(equipment[1]);
|
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);
|
this.powders[1] = this.powders[1].slice(0,chestplate.statMap.slots);
|
||||||
chestplate.statMap.set("powders",this.powders[1].slice());
|
chestplate.statMap.set("powders",this.powders[1].slice());
|
||||||
chestplate.applyPowders();
|
chestplate.applyPowders();
|
||||||
|
@ -155,6 +161,9 @@ class Build{
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
let leggings = getCraftFromHash(equipment[2]);
|
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);
|
this.powders[2] = this.powders[2].slice(0,leggings.statMap.slots);
|
||||||
leggings.statMap.set("powders",this.powders[2].slice());
|
leggings.statMap.set("powders",this.powders[2].slice());
|
||||||
leggings.applyPowders();
|
leggings.applyPowders();
|
||||||
|
@ -174,6 +183,9 @@ class Build{
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
let boots = getCraftFromHash(equipment[3]);
|
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);
|
this.powders[3] = this.powders[3].slice(0,boots.statMap.slots);
|
||||||
boots.statMap.set("powders",this.powders[3].slice());
|
boots.statMap.set("powders",this.powders[3].slice());
|
||||||
boots.applyPowders();
|
boots.applyPowders();
|
||||||
|
@ -192,6 +204,9 @@ class Build{
|
||||||
}else{
|
}else{
|
||||||
try {
|
try {
|
||||||
let ring = getCraftFromHash(equipment[4]);
|
let ring = getCraftFromHash(equipment[4]);
|
||||||
|
if (ring.statMap.get("type") !== "ring") {
|
||||||
|
throw new Error("Not a ring");
|
||||||
|
}
|
||||||
this.ring1 = ring.statMap;
|
this.ring1 = ring.statMap;
|
||||||
this.craftedItems.push(ring);
|
this.craftedItems.push(ring);
|
||||||
} catch (Error) {
|
} catch (Error) {
|
||||||
|
@ -206,6 +221,9 @@ class Build{
|
||||||
}else{
|
}else{
|
||||||
try {
|
try {
|
||||||
let ring = getCraftFromHash(equipment[5]);
|
let ring = getCraftFromHash(equipment[5]);
|
||||||
|
if (ring.statMap.get("type") !== "ring") {
|
||||||
|
throw new Error("Not a ring");
|
||||||
|
}
|
||||||
this.ring2 = ring.statMap;
|
this.ring2 = ring.statMap;
|
||||||
this.craftedItems.push(ring);
|
this.craftedItems.push(ring);
|
||||||
} catch (Error) {
|
} catch (Error) {
|
||||||
|
@ -220,6 +238,9 @@ class Build{
|
||||||
}else{
|
}else{
|
||||||
try {
|
try {
|
||||||
let bracelet = getCraftFromHash(equipment[6]);
|
let bracelet = getCraftFromHash(equipment[6]);
|
||||||
|
if (bracelet.statMap.get("type") !== "bracelet") {
|
||||||
|
throw new Error("Not a bracelet");
|
||||||
|
}
|
||||||
this.bracelet = bracelet.statMap;
|
this.bracelet = bracelet.statMap;
|
||||||
this.craftedItems.push(bracelet);
|
this.craftedItems.push(bracelet);
|
||||||
} catch (Error) {
|
} catch (Error) {
|
||||||
|
@ -234,6 +255,9 @@ class Build{
|
||||||
}else{
|
}else{
|
||||||
try {
|
try {
|
||||||
let necklace = getCraftFromHash(equipment[7]);
|
let necklace = getCraftFromHash(equipment[7]);
|
||||||
|
if (necklace.statMap.get("type") !== "necklace") {
|
||||||
|
throw new Error("Not a necklace");
|
||||||
|
}
|
||||||
this.necklace = necklace.statMap;
|
this.necklace = necklace.statMap;
|
||||||
this.craftedItems.push(necklace);
|
this.craftedItems.push(necklace);
|
||||||
} catch (Error) {
|
} catch (Error) {
|
||||||
|
@ -254,6 +278,9 @@ class Build{
|
||||||
}else{
|
}else{
|
||||||
try {
|
try {
|
||||||
let weapon = getCraftFromHash(equipment[8]);
|
let weapon = getCraftFromHash(equipment[8]);
|
||||||
|
if (weapon.statMap.get("category") !== "weapon") {
|
||||||
|
throw new Error("Not a weapon");
|
||||||
|
}
|
||||||
this.weapon = weapon.statMap;
|
this.weapon = weapon.statMap;
|
||||||
this.craftedItems.push(weapon);
|
this.craftedItems.push(weapon);
|
||||||
this.powders[4] = this.powders[4].slice(0,this.weapon.slots);
|
this.powders[4] = this.powders[4].slice(0,this.weapon.slots);
|
||||||
|
|
|
@ -326,6 +326,7 @@ function encodeBuild() {
|
||||||
for (const item of player_build.items) {
|
for (const item of player_build.items) {
|
||||||
if (item.get("crafted")) {
|
if (item.get("crafted")) {
|
||||||
build_string += "-"+encodeCraft(player_build.craftedItems[crafted_idx])
|
build_string += "-"+encodeCraft(player_build.craftedItems[crafted_idx])
|
||||||
|
crafted_idx += 1
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
build_string += Base64.fromIntN(item.get("id"), 3);
|
build_string += Base64.fromIntN(item.get("id"), 3);
|
||||||
|
|
Loading…
Reference in a new issue