armor powder specials (bugged)

This commit is contained in:
ferricles 2022-01-08 22:36:24 -05:00
parent de7013b099
commit 3ed14763bf
7 changed files with 110 additions and 14 deletions

View file

@ -55,7 +55,7 @@ class PowderSpecial{
function _ps(a,b,c,d,e) { return new PowderSpecial(a,b,c,d,e); } //bruh moment function _ps(a,b,c,d,e) { return new PowderSpecial(a,b,c,d,e); } //bruh moment
let powderSpecialStats = [ let powderSpecialStats = [
_ps("Quake",new Map([["Radius",[4.4,4.9,5.4,5.9,6.4]], ["Damage",[155,220,285,350,415]] ]),"Rage",new Map([ ["Damage", [0.3,0.4,0.5,0.7,1.0]],["Description", "% " + "\u2764" + " Missing"] ]),400), //e _ps("Quake",new Map([["Radius",[4.4,4.9,5.4,5.9,6.4]], ["Damage",[155,220,285,350,415]] ]),"Rage",new Map([ ["Damage", [0.3,0.4,0.5,0.7,1.0]],["Description", "% " + "\u2764" + " Missing"] ]), 396), //e
_ps("Chain Lightning",new Map([ ["Chains", [5,6,7,8,9]], ["Damage", [200,225,250,275,300]] ]),"Kill Streak",new Map([ ["Damage", [3,4.5,6,7.5,9]],["Duration", [5,5,5,5,5]],["Description", "Mob Killed"] ]),200), //t _ps("Chain Lightning",new Map([ ["Chains", [5,6,7,8,9]], ["Damage", [200,225,250,275,300]] ]),"Kill Streak",new Map([ ["Damage", [3,4.5,6,7.5,9]],["Duration", [5,5,5,5,5]],["Description", "Mob Killed"] ]),200), //t
_ps("Curse",new Map([ ["Duration", [7,7.5,8,8.5,9]],["Damage Boost", [90,120,150,180,210]] ]),"Concentration",new Map([ ["Damage", [1,2,3,4,5]],["Duration",[1,1,1,1,1]],["Description", "Mana Used"] ]),150), //w _ps("Curse",new Map([ ["Duration", [7,7.5,8,8.5,9]],["Damage Boost", [90,120,150,180,210]] ]),"Concentration",new Map([ ["Damage", [1,2,3,4,5]],["Duration",[1,1,1,1,1]],["Description", "Mana Used"] ]),150), //w
_ps("Courage",new Map([ ["Duration", [6,6.5,7,7.5,8]],["Damage", [75,87.5,100,112.5,125]],["Damage Boost", [70,90,110,130,150]] ]),"Endurance",new Map([ ["Damage", [2,3,4,5,6]],["Duration", [8,8,8,8,8]],["Description", "Hit Taken"] ]),200), //f _ps("Courage",new Map([ ["Duration", [6,6.5,7,7.5,8]],["Damage", [75,87.5,100,112.5,125]],["Damage Boost", [70,90,110,130,150]] ]),"Endurance",new Map([ ["Damage", [2,3,4,5,6]],["Duration", [8,8,8,8,8]],["Description", "Hit Taken"] ]),200), //f

View file

@ -21,8 +21,14 @@
<!-- main --> <!-- main -->
<div id="main-sidebar" class="sidebar dark-7 dark-shadow"> <div id="main-sidebar" class="sidebar dark-7 dark-shadow">
<a href=""><img src="media/icons/new/atlas64.png" alt="place" title="WynnBuilder"><b>WynnBuilder</b></a> <a href=""><img src="media/icons/new/builder.png" alt = "WynnBuilder" title = "WynnBuilder"><b>WynnBuilder</b></a>
<a onclick="document.querySelector('#search-container').style.display = '';"><img src="media/icons/new/searcher.png" alt="" title="Item Search"><b>WynnAtlas Mini</b></a> <a href = "/crafter.html"><img src = "media/icons/new/crafter.png" alt = "WynnCrafter" title = "WynnCrafter"><b>WynnCrafter</b></a>
<a href = "/items.html"><img src = "media/icons/new/searcher.png" alt = "WynnAtlas" title = "WynnAtlas"><b>WynnAtlas</b></a>
<a href = "/customizer.html"><img src = "media/icons/new/custom.png" alt = "WynnCustom" title = "WynnCustom"><b>WynnCustom</b></a>
<a href = "/map.html"><img src = "media/icons/new/compass.png" alt = "WynnGPS" title = "WynnGPS"><b>WynnGPS</b></a>
<a href = "/wynnfo/index.html"><img src = "media/icons/new/book.png" alt = "Wynnfo" title = "WynnCrafter"><b>WynnCrafter</b></a>
<a onclick = "document.querySelector('#search-container').style.display = '';"><img src="media/icons/new/searcher.png" alt="" title="Item Search"><b>WynnAtlas Mini</b></a>
<a onclick = "toggleIcons()"><img src = "media/icons/new/reload.png" alt = "" title = "Swap items on page"><b>Swap Icon Style</b></a>
<hr/> <hr/>
</div> </div>
<div class="container py-5 vh-100 mx-0 mx-lg-auto"> <div class="container py-5 vh-100 mx-0 mx-lg-auto">
@ -485,7 +491,8 @@
Rage (Passive) Rage (Passive)
</div> </div>
<div class="col"> <div class="col">
placeholder <input type = "range" id = "str_boost_armor" name = "str-boost-armor" min = '0' max = '396' value = '0' step = '1' onchange = "updateArmorPowderSpecials('dex_boost_armor')">
<label id = "str_boost_armor_label" for="str-boost-armor">% Earth Dmg Boost: 0</label>
</div> </div>
</div> </div>
</div> </div>
@ -527,7 +534,8 @@
Kill Streak (Passive) Kill Streak (Passive)
</div> </div>
<div class="col"> <div class="col">
placeholder <input type = "range" id = "dex_boost_armor" name = "dex-boost-armor" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('dex_boost_armor')">
<label id = "dex_boost_armor_label" for="dex-boost-armor">% Thunder Dmg Boost: 0</label>
</div> </div>
</div> </div>
</div> </div>
@ -569,7 +577,8 @@
Concentration (Passive) Concentration (Passive)
</div> </div>
<div class="col"> <div class="col">
placeholder <input type = "range" id = "int_boost_armor" name = "dex-boost-armor" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('int_boost_armor')">
<label id = "int_boost_armor_label" for="dex-boost-armor">% Water Dmg Boost: 0</label>
</div> </div>
</div> </div>
</div> </div>
@ -611,7 +620,8 @@
Endurance (Passive) Endurance (Passive)
</div> </div>
<div class="col"> <div class="col">
how do calc <input type = "range" id = "def_boost_armor" name = "def-boost-armor" min = '0' max = '200' value = '0' step = '1' onchange = "updateArmorPowderSpecials('def_boost_armor')">
<label id = "def_boost_armor_label" for="def-boost-armor">% Fire Dmg Boost: 0</label>
</div> </div>
</div> </div>
</div> </div>
@ -653,7 +663,8 @@
Dodge (Passive) Dodge (Passive)
</div> </div>
<div class="col"> <div class="col">
how do calc <input type = "range" id = "agi_boost_armor" name = "agi-boost-armor" min = '0' max = '150' value = '0' step = '1' onchange = "updateArmorPowderSpecials('agi_boost_armor')">
<label id = "agi_boost_armor_label" for="agi-boost-armor">% Air Dmg Boost: 0</label>
</div> </div>
</div> </div>
</div> </div>
@ -673,7 +684,7 @@
<div id="tab-defensive-btn" class="col-4 text-center fake-button border-bottom border-dark rounded-top dark-4u border border-2 border-dark-7" onclick="show_tab('defensive-stats')"> <div id="tab-defensive-btn" class="col-4 text-center fake-button border-bottom border-dark rounded-top dark-4u border border-2 border-dark-7" onclick="show_tab('defensive-stats')">
Defense Defense
</div> </div>
<div id="tab-overall-btn" class="col-4 text-center fake-button border-bottom border-dark rounded-top dark-4u border border-2 border-dark-7" onclick="show_tab('overall-stats')"> <div id="tab-overall-btn" class="col-4 text-center fake-button border-bottom border-dark rounded-top dark-4u border border-2 border-dark-7 selected-btn" onclick="show_tab('overall-stats')">
Overall Overall
</div> </div>
</div> </div>
@ -1202,6 +1213,7 @@
<script src="https://cdn.jsdelivr.net/npm/macy@2"></script> <script src="https://cdn.jsdelivr.net/npm/macy@2"></script>
<script type="text/javascript" src="js/utils.js"></script> <script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/build_utils.js"></script> <script type="text/javascript" src="js/build_utils.js"></script>
<script type="text/javascript" src="js/icons.js"></script>
<script type="text/javascript" src="sq2icons.js"></script> <script type="text/javascript" src="sq2icons.js"></script>
<script type="text/javascript" src="js/powders.js"></script> <script type="text/javascript" src="js/powders.js"></script>
<script type="text/javascript" src="js/skillpoints.js"></script> <script type="text/javascript" src="js/skillpoints.js"></script>

View file

@ -16,7 +16,7 @@ document.addEventListener('DOMContentLoaded', function() {
} }
for (const eq of powderable_keys) { for (const eq of powderable_keys) {
document.querySelector("#"+eq+"-powder").setAttribute("oninput", "calcBuildSchedule(); updatePowders(" + eq + "-powder)"); document.querySelector("#"+eq+"-powder").setAttribute("oninput", "calcBuildSchedule(); updatePowders('" + eq + "-powder');");
} }
for (const i of spell_disp) { for (const i of spell_disp) {

View file

@ -70,6 +70,9 @@ let powderInputs = [
"weapon-powder", "weapon-powder",
]; ];
//keeps track of the armor powder special sliders. Needed for math. Assumes everything starts at 0.
armor_powder_boosts = [0, 0, 0, 0, 0];
function init() { function init() {
console.log("builder.js init"); console.log("builder.js init");
init_autocomplete(); init_autocomplete();
@ -344,7 +347,6 @@ function calculateBuild(save_skp, skp){
while (input) { while (input) {
let first = input.slice(0, 2); let first = input.slice(0, 2);
let powder = powderIDs.get(first); let powder = powderIDs.get(first);
console.log(powder);
if (powder === undefined) { if (powder === undefined) {
errorederrors.push(first); errorederrors.push(first);
} else { } else {
@ -555,7 +557,7 @@ function updateBoosts(buttonId, recalcStats) {
} }
} }
/* Updates all powder special boosts /* Updates ACTIVE powder special boosts (weapons)
*/ */
function updatePowderSpecials(buttonId, recalcStats) { function updatePowderSpecials(buttonId, recalcStats) {
//console.log(player_build.statMap); //console.log(player_build.statMap);
@ -643,6 +645,31 @@ function updatePowderSpecials(buttonId, recalcStats) {
displaysq2PowderSpecials(document.getElementById("powder-special-stats"), powderSpecials, player_build, true); displaysq2PowderSpecials(document.getElementById("powder-special-stats"), powderSpecials, player_build, true);
} }
/* Updates PASSIVE powder special boosts (armors)
*/
function updateArmorPowderSpecials(elem_id) {
let wynn_elem = elem_id.split("_")[0]; //str, dex, int, def, agi
//update the label associated w/ the slider
let elem = document.getElementById(elem_id);
let value = elem.value;
let dmg_id = elem_chars[skp_names.indexOf(wynn_elem)] + "DamPct";
let new_dmgboost = player_build.externalStats.get(dmg_id) + (value - armor_powder_boosts[skp_names.indexOf(wynn_elem)]);
armor_powder_boosts[skp_names.indexOf(wynn_elem)] = value;
let label = document.getElementById(elem_id + "_label");
label.textContent = label.textContent.split(":")[0] + ": " + elem.value;
//update build stats
player_build.externalStats.set(dmg_id, new_dmgboost);
//calc build stats and display powder special
calculateBuildStats();
// displaysq2PowderSpecials(document.getElementById("powder-special-stats"), powderSpecials, player_build, true);
}
/* Calculates all build statistics and updates the entire display. /* Calculates all build statistics and updates the entire display.
*/ */
function calculateBuildStats() { function calculateBuildStats() {

View file

@ -1523,8 +1523,13 @@ function toggle_plus_minus(elem_id) {
} }
} }
// updates the powders within this element. Attempts to do so using textContent and innerHTML. // updates the powders within this element.
function updatePowders(elem_id) { function updatePowders(elem_id) {
elem = document.getElementById(elem_id); // let elem = document.getElementById(elem_id);
// for (let i = 0; i < elem.value.length - 1; i++) {
// if ('etwfa'.includes(elem.value.charAt(i)) && elem.value.charAt(i + 1) >= '1' && elem.value.charAt(i + 1) <= '6') {
// elem.value = elem.value.substring(0, i) + powder_chars['etwfa'.indexOf(elem.value.charAt(i))] + elem.value.substring(i + 2);
// }
// }
} }

View file

@ -5,6 +5,30 @@ let powder_chars = [
'\u2739', '\u2739',
'\u274b' '\u274b'
] ]
let subscript_nums = [
'\u2081',
'\u2082',
'\u2083',
'\u2084',
'\u2085',
'\u2086',
]
let skp_names = [
'str',
'dex',
'int',
'def',
'agi'
]
let elem_chars = [
'e',
't',
'w',
'f',
'a'
]
/* /*
* Display commands * Display commands

View file

@ -4,3 +4,31 @@ console.log(window_storage);
icon_state_stored = window_storage.getItem("newicons"); icon_state_stored = window_storage.getItem("newicons");
newIcons = true; newIcons = true;
if (icon_state_stored === "false") {toggleIcons()} if (icon_state_stored === "false") {toggleIcons()}
/** Toggle icons on the ENTIRE page.
*
*/
function toggleIcons() {
newIcons = !newIcons;
let imgs = document.getElementsByTagName("IMG");
let favicon = document.querySelector("link[rel~='icon']");
if (newIcons) { //switch to new
favicon.href = favicon.href.replace("media/icons/old","media/icons/new");
for (const img of imgs) {
if (img.src.includes("media/icons/old")) {img.src = img.src.replace("media/icons/old","media/icons/new");}
if (img.src.includes("media/items/old")) {img.src = img.src.replace("media/items/old","media/items/new");}
}
//toggleiconbutton.textContent = "Use Old Icons";
window_storage.setItem("newicons","true");
} else { //switch to old
favicon.href = favicon.href.replace("media/icons/new","media/icons/old");
for (const img of imgs) {
if (img.src.includes("media/icons/new")) {img.src = img.src.replace("media/icons/new","media/icons/old");}
if (img.src.includes("media/items/new")) {img.src = img.src.replace("media/items/new","media/items/old");}
}
//toggleiconbutton.textContent = "Use New Icons";
window_storage.setItem("newicons","false");
}
}