diff --git a/builder/index.html b/builder/index.html index 9602c27..af9cc45 100644 --- a/builder/index.html +++ b/builder/index.html @@ -412,7 +412,355 @@
-
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+
Active boosts @@ -448,7 +796,7 @@
-
+
@@ -695,7 +1043,7 @@
-
+
@@ -715,7 +1063,7 @@
-
+
melee
@@ -836,402 +1184,7 @@
- + diff --git a/builder/temp.html b/builder/temp.html new file mode 100644 index 0000000..e6735b5 --- /dev/null +++ b/builder/temp.html @@ -0,0 +1,396 @@ + \ No newline at end of file diff --git a/crafter/index.html b/crafter/index.html index 969a57d..31725fa 100644 --- a/crafter/index.html +++ b/crafter/index.html @@ -310,6 +310,6 @@ - + diff --git a/css/sq2bs.css b/css/sq2bs.css index 9122ddf..87c7514 100644 --- a/css/sq2bs.css +++ b/css/sq2bs.css @@ -400,3 +400,11 @@ a:hover { .border-semi-light { border-color: #aaa; } + +/* supposed to work in firefox but doesn't */ +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} \ No newline at end of file diff --git a/js/builder.js b/js/builder.js index 811245f..a91ef19 100644 --- a/js/builder.js +++ b/js/builder.js @@ -21,9 +21,7 @@ setTitle(); let player_build; -// THIS IS SUPER DANGEROUS, WE SHOULD NOT BE KEEPING THIS IN SO MANY PLACES let editable_item_fields = [ "sdPct", "sdRaw", "mdPct", "mdRaw", "poison", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "hprRaw", "hprPct", "hpBonus", "atkTier", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4" ]; - let editable_elems = []; for (let i of editable_item_fields) { diff --git a/js/sq2bs.js b/js/sq2bs.js index 9a21bd1..a99aef2 100644 --- a/js/sq2bs.js +++ b/js/sq2bs.js @@ -25,7 +25,7 @@ document.addEventListener('DOMContentLoaded', function() { document.querySelector("#level-choice").setAttribute("oninput", "calcBuildSchedule()") document.querySelector("#weapon-choice").setAttribute("oninput", document.querySelector("#weapon-choice").getAttribute("oninput") + "resetArmorPowderSpecials();"); - + // document.querySelector("#edit-IDs-button").setAttribute("onclick", "toggle_edit_id_tab()"); let skp_fields = document.getElementsByClassName("skp-update"); @@ -80,6 +80,7 @@ function calcBuildSchedule(){ } calcBuildTask = setTimeout(function(){ calcBuildTask = null; + resetEditableIDs(); calculateBuild(); }, 500); } diff --git a/js/sq2builder.js b/js/sq2builder.js index 88a50e8..0439da7 100644 --- a/js/sq2builder.js +++ b/js/sq2builder.js @@ -27,14 +27,13 @@ let editable_item_fields = [ "sdPct", "sdRaw", "mdPct", "mdRaw", "poison", "fDam let editable_elems = []; -/* for (let i of editable_item_fields) { let elem = document.getElementById(i); elem.addEventListener("change", (event) => { elem.classList.add("highlight"); }); editable_elems.push(elem); -}*/ +} for (let i of skp_order) { let elem = document.getElementById(i+"-skp"); @@ -211,6 +210,7 @@ function decodeBuild(url_tag) { setValue(equipmentInputs[i], equipment[i]); } calculateBuild(save_skp, skillpoints); + updateEditableIDs(); } } @@ -400,7 +400,6 @@ function calculateBuild(save_skp, skp){ calculateBuildStats(); if (player_build.errored) throw new ListError(player_build.errors); - } catch (error) { console.log(error); @@ -503,11 +502,56 @@ function updateStats() { updatePowderSpecials("skip", false); updateArmorPowderSpecials("skip", false); updateBoosts("skip", false); + for (let id of editable_item_fields) { + player_build.statMap.set(id, parseInt(getValue(id))); + } } player_build.aggregateStats(); console.log(player_build.statMap); calculateBuildStats(); } + + +/* Updates all IDs in the edit IDs section. Resets each input and original value text to the correct text according to the current build. +*/ +function updateEditableIDs() { + if (player_build) { + for (const id of editable_item_fields) { + let edit_input = document.getElementById(id); + let val = player_build.statMap.get(id); + edit_input.value = val; + edit_input.placeholder = val; + + let value_label = document.getElementById(id + "-base"); + value_label.textContent = "Original Value: " + val; + //a hack to make resetting easier + value_label.value = val; + } + } +} + +/* Resets all IDs in the edit IDs section to their "original" values. +*/ +function resetEditableIDs() { + if (player_build) { + for (const id of editable_item_fields) { + let edit_input = document.getElementById(id); + let value_label = document.getElementById(id + "-base"); + + edit_input.value = value_label.value; + edit_input.placeholder = value_label.value; + } + } else { + //no player build, reset to 0 + for (const id of editable_item_fields) { + let edit_input = document.getElementById(id); + + edit_input.value = 0; + edit_input.placeholder = 0; + } + } +} + /* Updates all spell boosts */ function updateBoosts(buttonId, recalcStats) { @@ -936,6 +980,17 @@ function toggleID() { } } +function toggleButton(button_id) { + let button = document.getElementById(button_id); + if (button) { + if (button.classList.contains("toggleOn")) { + button.classList.remove("toggleOn"); + } else { + button.classList.add("toggleOn"); + } + } +} + function optimizeStrDex() { const remaining = levelToSkillPoints(player_build.level) - player_build.assigned_skillpoints; const base_skillpoints = player_build.base_skillpoints;