From adcf1ee3621393fb191acffa71b9c2ba816933bb Mon Sep 17 00:00:00 2001 From: reschan Date: Mon, 23 May 2022 13:20:03 +0700 Subject: [PATCH 1/2] re-enable melee breakdown --- builder/index.html | 2 +- js/sq2bs.js | 2 ++ js/sq2display.js | 26 +++++++------------------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/builder/index.html b/builder/index.html index 2569df8..806d3e5 100644 --- a/builder/index.html +++ b/builder/index.html @@ -1240,7 +1240,7 @@
-
melee
+
melee
diff --git a/js/sq2bs.js b/js/sq2bs.js index dce7eba..cb571d3 100644 --- a/js/sq2bs.js +++ b/js/sq2bs.js @@ -29,6 +29,8 @@ document.addEventListener('DOMContentLoaded', function() { document.querySelector("#"+i+"Avg").setAttribute("onclick", "toggle_spell_tab('"+i+"')"); } + document.querySelector("#build-melee-statsAvg").setAttribute("onclick", "toggle_spell_tab('build-melee-stats')"); + 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()"); diff --git a/js/sq2display.js b/js/sq2display.js index 07715d5..7dd1d27 100644 --- a/js/sq2display.js +++ b/js/sq2display.js @@ -692,7 +692,6 @@ function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){ title_elem.classList.add("title"); title_elem.textContent = "Melee Stats"; parent_elem.append(title_elem); - parent_elem.append(document.createElement("br")); //overall title let title_elemavg = document.createElement("b"); @@ -703,9 +702,6 @@ function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){ let averageDamage = document.createElement("p"); averageDamage.classList.add("left"); averageDamage.textContent = "Average DPS: " + stats[10]; - tooltiptext = `= ((${stats[8]} * ${(stats[6][2]).toFixed(2)}) + (${stats[9]} * ${(stats[7][2]).toFixed(2)}))` - tooltip = createTooltip(tooltip, "p", tooltiptext, averageDamage, ["melee-tooltip"]); - averageDamage.appendChild(tooltip); parent_elem.append(averageDamage); //overall average DPS @@ -751,8 +747,6 @@ function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){ dmg.textContent = stats[i][0] + " \u2013 " + stats[i][1]; dmg.classList.add(damageClasses[i]); dmg.classList.add("itemp"); - tooltiptext = tooltipinfo.get("damageformulas")[i].slice(0,2).join("\n"); - tooltip = createTooltip(tooltip, "p", tooltiptext, dmg, ["melee-tooltip"]); nonCritStats.append(dmg); } } @@ -767,15 +761,11 @@ function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){ arr2.push(stats[i][1]); } } - tooltiptext = tooltiparr[0] + arr.join(" + ") + "\n" + tooltiparr[1] + arr2.join(" + "); - tooltip = createTooltip(tooltip, "p", tooltiptext, normalDamage, ["melee-tooltip"]); nonCritStats.append(normalDamage); let normalDPS = document.createElement("p"); normalDPS.textContent = "Normal DPS: " + stats[8]; normalDPS.classList.add("tooltip"); - tooltiptext = ` = ((${stats[6][0]} + ${stats[6][1]}) / 2) * ${baseDamageMultiplier[stats[11]]}`; - tooltip = createTooltip(tooltip, "p", tooltiptext, normalDPS, ["melee-tooltip"]); nonCritStats.append(normalDPS); //overall average DPS @@ -785,9 +775,6 @@ function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){ let singleHitDamageSecond = document.createElement("span"); singleHitDamageSecond.classList.add("Damage"); singleHitDamageSecond.textContent = stats[12].toFixed(2); - tooltiptext = ` = ((${stats[6][0]} + ${stats[6][1]}) / 2) * ${stats[6][2].toFixed(2)} + ((${stats[7][0]} + ${stats[7][1]}) / 2) * ${stats[7][2].toFixed(2)}`; - // tooltip = createTooltip(tooltip, "p", tooltiptext, singleHitDamage, ["melee-tooltip", "summary-tooltip"]); - singleHitDamage.appendChild(singleHitDamageFirst); singleHitDamage.appendChild(singleHitDamageSecond); overallparent_elem.append(singleHitDamage); @@ -812,8 +799,6 @@ function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){ dmg.textContent = stats[i][2] + " \u2013 " + stats[i][3]; dmg.classList.add(damageClasses[i]); dmg.classList.add("itemp"); - tooltiptext = tooltipinfo.get("damageformulas")[i].slice(2,4).join("\n"); - tooltip = createTooltip(tooltip, "p", tooltiptext, dmg, ["melee-tooltip"]); critStats.append(dmg); } } @@ -827,15 +812,11 @@ function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){ arr2.push(stats[i][3]); } } - tooltiptext = tooltiparr[0] + arr.join(" + ") + "\n" + tooltiparr[1] + arr2.join(" + "); - tooltip = createTooltip(tooltip, "p", tooltiptext, critDamage, ["melee-tooltip"]); critStats.append(critDamage); let critDPS = document.createElement("p"); critDPS.textContent = "Crit DPS: " + stats[9]; - tooltiptext = ` = ((${stats[7][0]} + ${stats[7][1]}) / 2) * ${baseDamageMultiplier[stats[11]]}`; - tooltip = createTooltip(tooltip, "p", tooltiptext, critDPS, ["melee-tooltip"]); critStats.append(critDPS); let critChance = document.createElement("p"); @@ -845,6 +826,13 @@ function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){ critStats.append(critChance); parent_elem.append(critStats); + + //up and down arrow - done ugly + let arrow = document.createElement("img"); + arrow.id = "arrow_" + overallparent_elem.id; + arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem"; + arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_down.png"; + overallparent_elem.appendChild(arrow); } function displaysq2ArmorStats(build) { From 564e4709cd4f7635ce7d88f8ae90dee6f9df54dc Mon Sep 17 00:00:00 2001 From: reschan Date: Wed, 22 Jun 2022 09:34:06 +0700 Subject: [PATCH 2/2] change clickable arrow to a function --- js/sq2display.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/js/sq2display.js b/js/sq2display.js index 7dd1d27..ef8f77e 100644 --- a/js/sq2display.js +++ b/js/sq2display.js @@ -827,12 +827,7 @@ function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){ parent_elem.append(critStats); - //up and down arrow - done ugly - let arrow = document.createElement("img"); - arrow.id = "arrow_" + overallparent_elem.id; - arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem"; - arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_down.png"; - overallparent_elem.appendChild(arrow); + addClickableArrow(overallparent_elem); } function displaysq2ArmorStats(build) { @@ -1401,12 +1396,7 @@ function displaysq2SpellDamage(parent_elem, overallparent_elem, build, spell, sp } } - //up and down arrow - done ugly - let arrow = document.createElement("img"); - arrow.id = "arrow_" + overallparent_elem.id; - arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem"; - arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_down.png"; - overallparent_elem.appendChild(arrow); + addClickableArrow(overallparent_elem); } function displaysq2EquipOrder(parent_elem, buildOrder){ @@ -2390,3 +2380,12 @@ function sq2StringCDF(id,val,base,amp) { document.getElementById(id + "-cdf").appendChild(div2); document.getElementById(id + "-cdf").appendChild(div3); } + +function addClickableArrow(elem) { + //up and down arrow - done ugly + let arrow = document.createElement("img"); + arrow.id = "arrow_" + elem.id; + arrow.style.maxWidth = document.body.clientWidth > 900 ? "3rem" : "10rem"; + arrow.src = "../media/icons/" + (newIcons ? "new" : "old") + "/toggle_down.png"; + elem.appendChild(arrow); +}