From 229a337d039e92c7102eaa464c97458e7197eb88 Mon Sep 17 00:00:00 2001 From: b Date: Fri, 19 Mar 2021 03:00:01 -0700 Subject: [PATCH 1/3] Hide bcats --- builder.js | 12 ++++++++++++ query.js | 3 +++ skillpoints.js | 16 ++++++++++------ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/builder.js b/builder.js index 9092295..62f1a8c 100644 --- a/builder.js +++ b/builder.js @@ -91,6 +91,10 @@ let powderInputs = [ function populateItemList(type) { let item_list = document.getElementById(type+"-items"); for (const item of itemLists.get(type)) { + let item_obj = itemMap.get(item); + if (item_obj["restrict"] && item_obj["restrict"] === "DEPRECATED") { + continue; + } let el = document.createElement("option"); el.value = item; item_list.appendChild(el); @@ -132,6 +136,10 @@ function init() { let ring1_list = document.getElementById("ring1-items"); let ring2_list = document.getElementById("ring2-items"); for (const ring of itemLists.get("ring")) { + let item_obj = itemMap.get(ring); + if (item_obj["restrict"] && item_obj["restrict"] === "DEPRECATED") { + continue; + } let el1 = document.createElement("option"); let el2 = document.createElement("option"); el1.value = ring; @@ -146,6 +154,10 @@ function init() { let weapon_list = document.getElementById("weapon-items"); for (const weaponType of weaponTypes) { for (const weapon of itemLists.get(weaponType)) { + let item_obj = itemMap.get(weapon); + if (item_obj["restrict"] && item_obj["restrict"] === "DEPRECATED") { + continue; + } let el = document.createElement("option"); el.value = weapon; weapon_list.appendChild(el); diff --git a/query.js b/query.js index 133ee22..3519853 100644 --- a/query.js +++ b/query.js @@ -4,6 +4,9 @@ class NameQuery { constructor(string) { this.queryString = string.toLowerCase(); } filter(item) { + if (item.get("restrict") && item.get("restrict") === "DEPRECATED") { + return false; + } return (item.get("displayName").toLowerCase().includes(this.queryString)); } diff --git a/skillpoints.js b/skillpoints.js index 29f1e75..1daa896 100644 --- a/skillpoints.js +++ b/skillpoints.js @@ -52,8 +52,8 @@ function calculate_skillpoints(equipment, weapon) { let total = 0; for (let i = 0; i < 5; i++) { if (item.get("skillpoints")[i] < 0 && skillpoint_min[i]) { - unadjusted = skillpoints[i] + item.get("skillpoints")[i]; - delta = skillpoint_min[i] - unadjusted; + const unadjusted = skillpoints[i] + item.get("skillpoints")[i]; + const delta = skillpoint_min[i] - unadjusted; if (delta > 0) { applied[i] += delta; total += delta; @@ -78,10 +78,14 @@ function calculate_skillpoints(equipment, weapon) { const new_bonus = sets[setName].bonuses[setCount]; //let skp_order = ["str","dex","int","def","agi"]; for (const i in skp_order) { - const delta = (new_bonus[skp_order[i]] || 0) - (old_bonus[skp_order[i]] || 0); - if (delta < 0 && skillpoint_min[i]) { - applied[i] -= delta; - total -= delta; + const set_delta = (new_bonus[skp_order[i]] || 0) - (old_bonus[skp_order[i]] || 0); + if (set_delta < 0 && skillpoint_min[i]) { + const unadjusted = skillpoints[i] + set_delta; + const delta = skillpoint_min[i] - unadjusted; + if (delta > 0) { + applied[i] += delta; + total += delta; + } } } } From d717781d2f2ca289c367d3441c8391113a10c023 Mon Sep 17 00:00:00 2001 From: b Date: Sat, 20 Mar 2021 21:00:34 -0700 Subject: [PATCH 2/3] Sp behavior fix --- skillpoints.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/skillpoints.js b/skillpoints.js index 1daa896..a17d710 100644 --- a/skillpoints.js +++ b/skillpoints.js @@ -10,7 +10,8 @@ function calculate_skillpoints(equipment, weapon) { if (item.get("crafted")) { crafted.push(item); } - else if (item.get("reqs").every(x => x === 0)) { + else if (item.get("reqs").every(x => x === 0) && item.get("skillpoints").every(x => x >= 0)) { + // All reqless item without -skillpoints. fixed.push(item); } // TODO hack: We will treat ALL set items as unsafe :( @@ -60,7 +61,7 @@ function calculate_skillpoints(equipment, weapon) { } } if (item.get("reqs")[i] == 0) continue; - skillpoint_min[i] = Math.max(skillpoint_min[i], item.get("reqs")[i] + item.get("skillpoints")[i]); + skillpoint_min[i] = Math.max(skillpoint_min[i], item.get("reqs")[i]);// + item.get("skillpoints")[i]); const req = item.get("reqs")[i]; const cur = skillpoints[i]; if (req > cur) { From a0746a7ad9dca6b03ef75b29674644d346b4a55f Mon Sep 17 00:00:00 2001 From: b Date: Sat, 20 Mar 2021 22:31:56 -0700 Subject: [PATCH 3/3] Fix powder slot bug for crafted and CI --- build.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.js b/build.js index 7aab5eb..27e3532 100644 --- a/build.js +++ b/build.js @@ -120,7 +120,7 @@ class Build{ 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.get("slots")); helmet.statMap.set("powders",this.powders[0].slice()); helmet.applyPowders(); this.helmet = helmet.statMap; @@ -148,7 +148,7 @@ class Build{ 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.get("slots")); chestplate.statMap.set("powders",this.powders[1].slice()); chestplate.applyPowders(); this.chestplate = chestplate.statMap; @@ -174,7 +174,7 @@ class Build{ 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.get("slots")); leggings.statMap.set("powders",this.powders[2].slice()); leggings.applyPowders(); this.leggings = leggings.statMap; @@ -200,7 +200,7 @@ class Build{ 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.get("slots")); boots.statMap.set("powders",this.powders[3].slice()); boots.applyPowders(); this.boots = boots.statMap; @@ -322,7 +322,7 @@ class Build{ } else if (this.weapon.get("crafted")) { //customs can also be crafted, but custom takes priority. 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.get("slots")); this.weapon.set("powders",this.powders[4].slice()); document.getElementsByClassName("powder-specials")[0].style.display = "grid"; } catch (Error) {