bug fix for input range values not resetting (armor powder specials)
This commit is contained in:
parent
e24da1c358
commit
0684e5f8bd
2 changed files with 31 additions and 29 deletions
|
@ -507,8 +507,8 @@
|
||||||
Rage (Passive)
|
Rage (Passive)
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type = "range" class = "e_slider" id = "str_boost_armor" name = "str-boost-armor" min = '0' max = '400' value = '0' step = '1' onchange = "updateArmorPowderSpecials('str_boost_armor')">
|
<input type = "range" class = "e_slider" id = "str_boost_armor" name = "str-boost-armor" autocomplete = "off" min = '0' max = '400' value = '0' step = '1' onchange = "updateArmorPowderSpecials('str_boost_armor')">
|
||||||
<input type="text" id="str_boost_armor_prev" value="0" style = "display:none;">
|
<input type="text" id="str_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
||||||
<label id = "str_boost_armor_label" for="str-boost-armor">% Earth Dmg Boost: 0</label>
|
<label id = "str_boost_armor_label" for="str-boost-armor">% Earth Dmg Boost: 0</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -551,8 +551,8 @@
|
||||||
Kill Streak (Passive)
|
Kill Streak (Passive)
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type = "range" class = "t_slider" id = "dex_boost_armor" name = "dex-boost-armor" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('dex_boost_armor')">
|
<input type = "range" class = "t_slider" id = "dex_boost_armor" name = "dex-boost-armor" autocomplete = "off" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('dex_boost_armor')">
|
||||||
<input type="text" id="dex_boost_armor_prev" value="0" style = "display:none;">
|
<input type="text" id="dex_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
||||||
<label id = "dex_boost_armor_label" for="dex-boost-armor">% Thunder Dmg Boost: 0</label>
|
<label id = "dex_boost_armor_label" for="dex-boost-armor">% Thunder Dmg Boost: 0</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -595,8 +595,8 @@
|
||||||
Concentration (Passive)
|
Concentration (Passive)
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type = "range" class = "w_slider" id = "int_boost_armor" name = "dex-boost-armor" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('int_boost_armor')">
|
<input type = "range" class = "w_slider" id = "int_boost_armor" name = "dex-boost-armor" autocomplete = "off" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('int_boost_armor')">
|
||||||
<input type="text" id="int_boost_armor_prev" value="0" style = "display:none;">
|
<input type="text" id="int_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
||||||
<label id = "int_boost_armor_label" for="dex-boost-armor">% Water Dmg Boost: 0</label>
|
<label id = "int_boost_armor_label" for="dex-boost-armor">% Water Dmg Boost: 0</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -639,8 +639,8 @@
|
||||||
Endurance (Passive)
|
Endurance (Passive)
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type = "range" class = "f_slider" id = "def_boost_armor" name = "def-boost-armor" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('def_boost_armor')">
|
<input type = "range" class = "f_slider" id = "def_boost_armor" name = "def-boost-armor" autocomplete = "off" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('def_boost_armor')">
|
||||||
<input type="text" id="def_boost_armor_prev" value="0" style = "display:none;">
|
<input type="text" id="def_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
||||||
<label id = "def_boost_armor_label" for="def-boost-armor">% Fire Dmg Boost: 0</label>
|
<label id = "def_boost_armor_label" for="def-boost-armor">% Fire Dmg Boost: 0</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -683,8 +683,8 @@
|
||||||
Dodge (Passive)
|
Dodge (Passive)
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type = "range" class = "a_slider" id = "agi_boost_armor" name = "agi-boost-armor" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('agi_boost_armor')">
|
<input type = "range" class = "a_slider" id = "agi_boost_armor" name = "agi-boost-armor" autocomplete = "off" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('agi_boost_armor')">
|
||||||
<input type="text" id="agi_boost_armor_prev" value="0" style = "display:none;">
|
<input type="text" id="agi_boost_armor_prev" autocomplete = "off" value="0" style = "display:none;">
|
||||||
<label id = "agi_boost_armor_label" for="agi-boost-armor">% Air Dmg Boost: 0</label>
|
<label id = "agi_boost_armor_label" for="agi-boost-armor">% Air Dmg Boost: 0</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -646,25 +646,27 @@ function updatePowderSpecials(buttonId, recalcStats) {
|
||||||
/* Updates PASSIVE powder special boosts (armors)
|
/* Updates PASSIVE powder special boosts (armors)
|
||||||
*/
|
*/
|
||||||
function updateArmorPowderSpecials(elem_id) {
|
function updateArmorPowderSpecials(elem_id) {
|
||||||
let wynn_elem = elem_id.split("_")[0]; //str, dex, int, def, agi
|
console.log(player_build);
|
||||||
|
//we only update the powder special + external stats if the player has a build
|
||||||
|
if (player_build !== undefined) {
|
||||||
|
let wynn_elem = elem_id.split("_")[0]; //str, dex, int, def, agi
|
||||||
|
|
||||||
//update the label associated w/ the slider
|
//update the label associated w/ the slider
|
||||||
let elem = document.getElementById(elem_id);
|
let elem = document.getElementById(elem_id);
|
||||||
let label = document.getElementById(elem_id + "_label");
|
let label = document.getElementById(elem_id + "_label");
|
||||||
let prev_label = document.getElementById(elem_id + "_prev");
|
let prev_label = document.getElementById(elem_id + "_prev");
|
||||||
|
|
||||||
let value = elem.value;
|
let value = elem.value;
|
||||||
|
|
||||||
//for use in editing build stats
|
//for use in editing build stats
|
||||||
let prev_value = prev_label.value;
|
let prev_value = prev_label.value;
|
||||||
let value_diff = value - prev_value;
|
let value_diff = value - prev_value;
|
||||||
|
|
||||||
//update the "previous" label
|
//update the "previous" label
|
||||||
prev_label.value = value;
|
prev_label.value = value;
|
||||||
|
|
||||||
label.textContent = label.textContent.split(":")[0] + ": " + value;
|
label.textContent = label.textContent.split(":")[0] + ": " + value;
|
||||||
|
|
||||||
if (player_build) {
|
|
||||||
let dmg_id = elem_chars[skp_names.indexOf(wynn_elem)] + "DamPct";
|
let dmg_id = elem_chars[skp_names.indexOf(wynn_elem)] + "DamPct";
|
||||||
let new_dmgboost = player_build.externalStats.get(dmg_id) + value_diff;
|
let new_dmgboost = player_build.externalStats.get(dmg_id) + value_diff;
|
||||||
|
|
||||||
|
@ -675,12 +677,12 @@ function updateArmorPowderSpecials(elem_id) {
|
||||||
//calc build stats and display powder special
|
//calc build stats and display powder special
|
||||||
calculateBuildStats();
|
calculateBuildStats();
|
||||||
// displaysq2PowderSpecials(document.getElementById("powder-special-stats"), powderSpecials, player_build, true);
|
// displaysq2PowderSpecials(document.getElementById("powder-special-stats"), powderSpecials, player_build, true);
|
||||||
|
|
||||||
|
//update the slider's graphics
|
||||||
|
let bg_color = elem_colors[skp_names.indexOf(wynn_elem)];
|
||||||
|
let pct = Math.round(100 * value / powderSpecialStats[skp_names.indexOf(wynn_elem)].cap);
|
||||||
|
elem.style.background = `linear-gradient(to right, ${bg_color}, ${bg_color} ${pct}%, #AAAAAA ${pct}%, #AAAAAA 100%)`;
|
||||||
}
|
}
|
||||||
|
|
||||||
//update the slider's graphics
|
|
||||||
let bg_color = elem_colors[skp_names.indexOf(wynn_elem)];
|
|
||||||
let pct = Math.round(100 * value / powderSpecialStats[skp_names.indexOf(wynn_elem)].cap);
|
|
||||||
elem.style.background = `linear-gradient(to right, ${bg_color}, ${bg_color} ${pct}%, #AAAAAA ${pct}%, #AAAAAA 100%)`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculates all build statistics and updates the entire display.
|
/* Calculates all build statistics and updates the entire display.
|
||||||
|
|
Loading…
Reference in a new issue