diff --git a/atlas/index.html b/atlas/index.html index d1a7f27..9275ce7 100644 --- a/atlas/index.html +++ b/atlas/index.html @@ -25,7 +25,6 @@ WynnCustomWynnCustom WynnGPSWynnGPS WynnfoWynnCrafter - WynnAtlas Mini Swap Icon Style
diff --git a/builder/temp.html b/builder/temp.html deleted file mode 100644 index e6735b5..0000000 --- a/builder/temp.html +++ /dev/null @@ -1,396 +0,0 @@ - \ No newline at end of file diff --git a/crafter/index.html b/crafter/index.html index 31725fa..2c6d8c0 100644 --- a/crafter/index.html +++ b/crafter/index.html @@ -27,7 +27,6 @@ WynnCustomWynnCustom WynnGPSWynnGPS WynnfoWynnfo - WynnAtlas Mini Swap Icon Style
diff --git a/custom/index.html b/custom/index.html index cebfe08..e495fd1 100644 --- a/custom/index.html +++ b/custom/index.html @@ -29,7 +29,6 @@ WynnCustomWynnCustom WynnGPSWynnGPS WynnfoWynnfo - WynnAtlas Mini Swap Icon Style
diff --git a/item/index.html b/item/index.html new file mode 100644 index 0000000..a7b3122 --- /dev/null +++ b/item/index.html @@ -0,0 +1,69 @@ + + + + + WB Item Viewer + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+ + + +
+ + +
+ + + + + + + + + + + + + + diff --git a/items/index.html b/items/index.html index 944bb25..8c4bd80 100644 --- a/items/index.html +++ b/items/index.html @@ -27,7 +27,6 @@ WynnCustomWynnCustom WynnGPSWynnGPS WynnfoWynnfo - WynnAtlas Mini Swap Icon Style
diff --git a/items/item.html b/items/item.html deleted file mode 100644 index b9bd8ce..0000000 --- a/items/item.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - Wynn Clientside - - -
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-

-
- -
-
-
-

Additional Info

-
-
-
- - - - -
- - - - - - - - - - - - - - - - - diff --git a/items_adv/index.html b/items_adv/index.html index 526d97c..fb9da0f 100644 --- a/items_adv/index.html +++ b/items_adv/index.html @@ -28,7 +28,6 @@ WynnCustomWynnCustom WynnGPSWynnGPS WynnfoWynnCrafter - WynnAtlas Mini Swap Icon Style
diff --git a/items_adv/items_2_help.html b/items_adv/items_2_help.html index 62d7cd7..161f077 100644 --- a/items_adv/items_2_help.html +++ b/items_adv/items_2_help.html @@ -31,7 +31,6 @@ WynnCustomWynnCustom WynnGPSWynnGPS WynnfoWynnCrafter - WynnAtlas Mini Swap Icon Style
diff --git a/js/build_utils.js b/js/build_utils.js index 0e2da09..6192b4a 100644 --- a/js/build_utils.js +++ b/js/build_utils.js @@ -76,4 +76,3 @@ for (const [k, v] of translations) { reversetranslations.set(v, k); } -console.log(translations); diff --git a/js/display.js b/js/display.js index 523b677..fcf9f5e 100644 --- a/js/display.js +++ b/js/display.js @@ -2438,7 +2438,6 @@ function stringPDF(id,val,base,amp) { document.getElementById(id + "-pdf").appendChild(b1); document.getElementById(id + "-pdf").appendChild(b2); document.getElementById(id + "-pdf").appendChild(b3); - document.getElementById(id + "-pdf").style.textAlign = "left"; } function stringCDF(id,val,base,amp) { let p; let min; let max; let minr; let maxr; let minround; let maxround; @@ -2473,5 +2472,4 @@ function stringCDF(id,val,base,amp) { document.getElementById(id + "-cdf").appendChild(b1); document.getElementById(id + "-cdf").appendChild(b2); document.getElementById(id + "-cdf").appendChild(b3); - document.getElementById(id + "-cdf").style.textAlign = "left"; } diff --git a/js/icons.js b/js/icons.js index 39cc2f6..a796942 100644 --- a/js/icons.js +++ b/js/icons.js @@ -1,13 +1,9 @@ //which icons to use let window_storage = window.localStorage; -console.log(window_storage); icon_state_stored = window_storage.getItem("newicons"); newIcons = true; if (icon_state_stored === "false") {toggleIcons()} -//REMOVE THIS IN THE REAL VERSION 7 OR SOMETHING -window_storage.removeItem("rick"); - /** Toggle icons on the ENTIRE page. * */ diff --git a/js/item.js b/js/item.js index 27f4bc0..c29d2f0 100644 --- a/js/item.js +++ b/js/item.js @@ -10,13 +10,6 @@ const item_url_tag = location.hash.slice(1); const ITEM_BUILD_VERSION = "7.0.1"; -function setTitle() { - let text = "WynnInfo version "+ITEM_BUILD_VERSION; - document.getElementById("header").classList.add("funnynumber"); - document.getElementById("header").textContent = text; -} - -setTitle(); let item; let amp_state = 0; //the level of corkian map used for ID purposes. Default 0. @@ -27,16 +20,17 @@ function init_itempage() { //displayExpandedItem(expandItem(itemMap.get(item_url_tag).statMap, []), "item-view"); try{ item = expandItem(itemMap.get(item_url_tag.replaceAll("%20"," ")), []); - displayExpandedItem(item, "item-view"); - displayAdditionalInfo("additional-info", item); - displayIDCosts("identification-costs", item); + displaysq2ExpandedItem(item, "item-view"); + displaysq2AdditionalInfo("additional-info", item); + displaysq2IDCosts("identification-costs", item); if (item.get("set") && sets[item.get("set")]) { - displayAllSetBonuses("set-bonus-info",item.get("set")); + displaysq2AllSetBonuses("set-bonus-info",item.get("set")); } console.log(item); - displayIDProbabilities("identification-probabilities", item, amp_state); + displaysq2IDProbabilities("identification-probabilities", item, amp_state); } catch (error) { console.log(error); + console.log(error.stack); } } @@ -45,7 +39,6 @@ function init_itempage() { * @param {Number} button_id the ID of the button just pressed. */ function toggleAmps(button_id) { - console.log(button_id); amp_state = 0; if (button_id == 0) {return;} else { @@ -59,7 +52,7 @@ function toggleAmps(button_id) { amp_state = button_id; } } - displayIDProbabilities("identification-probabilities", item, amp_state); + displaysq2IDProbabilities("identification-probabilities", item, amp_state); } diff --git a/js/map.js b/js/map.js index 30d4592..c846a9c 100644 --- a/js/map.js +++ b/js/map.js @@ -233,7 +233,7 @@ function pullguilds() { .then(res => { guildTags.set(guild, res.prefix); guildColors.set(guild, randomColorHSL([0,1],[0,1],[0.4,1])); - console.log("Succesfully pulled guild data for " + guild + "."); + // console.log("Succesfully pulled guild data for " + guild + "."); }) .catch(error => { console.log(error); diff --git a/js/sq2bs.js b/js/sq2bs.js index afae22e..99872a1 100644 --- a/js/sq2bs.js +++ b/js/sq2bs.js @@ -299,7 +299,6 @@ function init_autocomplete() { let dropdowns = new Map() for (const eq of equipment_keys) { // build dropdown - console.log('init dropdown for '+ eq) let item_arr = []; if (eq == 'weapon') { for (const weaponType of weapon_keys) { @@ -377,8 +376,6 @@ function init_autocomplete() { } let filter_loc = ["filter1", "filter2", "filter3", "filter4"]; for (const i of filter_loc) { - console.log(i); - console.log('init dropdown for '+i+"-choice" ) dropdowns.set(i+"-choice", new autoComplete({ data: { src: sq2ItemFilters, diff --git a/js/sq2display.js b/js/sq2display.js index 855cab2..35668d2 100644 --- a/js/sq2display.js +++ b/js/sq2display.js @@ -249,10 +249,10 @@ function displaysq2ExpandedItem(item, parent_id){ } else if (id === "displayName") { let row = document.createElement("div"); - let p_elem = document.createElement("div"); + let p_elem = document.createElement("a"); row.classList.add("row", "no-collapse"); p_elem.classList.add("col", "text-center", "item-title"); - p_elem.classList.add(item.has("tier") ? item.get("tier").replace(" ","") : "none"); + p_elem.classList.add(item.has("tier") ? item.get("tier").replace(" ","") : "Normal"); p_elem.style.textGrow = 1; row.appendChild(p_elem); @@ -271,13 +271,13 @@ function displaysq2ExpandedItem(item, parent_id){ // row.appendChild(plusminus); if (item.get("custom")) { - // p_elem.href = url_base.replace(/\w+.html/, "") + "customizer.html#" + item.get("hash"); + p_elem.href = "../custom/#" + item.get("hash"); p_elem.textContent = item.get("displayName"); } else if (item.get("crafted")) { - // p_elem.href = url_base.replace(/\w+.html/, "") + "crafter.html#" + item.get("hash"); + p_elem.href = "../crafter/#" + item.get("hash"); p_elem.textContent = item.get(id); } else { - // p_elem.href = url_base.replace(/\w+.html/, "") + "item.html#" + item.get("displayName"); + p_elem.href = "../item/#" + item.get("displayName"); p_elem.textContent = item.get("displayName"); } @@ -1482,14 +1482,6 @@ function displaysq2SetBonuses(parent_id,build) { set_summary_elem.classList.add('text-center'); set_summary_elem.textContent = "Set Bonuses"; parent_div.append(set_summary_elem); - - /* - if (build.activeSetCounts.size) { - parent_div.parentElement.style.display = "block"; - } else { - parent_div.parentElement.style.display = "none"; - } - */ for (const [setName, count] of build.activeSetCounts) { const active_set = sets[setName]; @@ -1892,4 +1884,494 @@ function displaysq2ExpandedIngredient(ingred, parent_id) { parent_elem.appendChild(div); } } -} \ No newline at end of file +} + +//TODO: translate the below to BS + +/** Displays Additional Info for + * + * @param {String} elemID - the parent element's id + * @param {Map} item - the statMap of the item + * @returns + */ +function displaysq2AdditionalInfo(elemID, item) { + let parent_elem = document.getElementById(elemID); + + let title = document.createElement("div"); + title.classList.add("big-title", "justify-content-center"); + title.textContent = "Additional Info"; + parent_elem.appendChild(title); + + let droptype_elem = document.createElement("div"); + droptype_elem.classList.add("row"); + droptype_elem.textContent = "Drop type: " + (item.has("drop") ? item.get("drop"): "NEVER"); + parent_elem.appendChild(droptype_elem); + + let warning_elem = document.createElement("div"); + warning_elem.classList.add("row"); + warning_elem.textContent = "This page is incomplete. Will work on it later."; + parent_elem.appendChild(warning_elem); + + return; +} + +/** Displays the ID costs of an item + * + * @param {String} elemID - the id of the parent element. + * @param {Map} item - the statMap of an item. + */ + function displaysq2IDCosts(elemID, item) { + let parent_elem = document.getElementById(elemID); + let tier = item.get("tier"); + if ( (item.has("fixID") && item.get("fixID")) || ["Normal","Crafted","Custom","none", " ",].includes(item.get("tier"))) { + return; + } else { + /** Returns the number of inventory slots minimum an amount of emeralds would take up + the configuration of doing so. + * Returns an array of [invSpace, E, EB, LE, Stx LE] + * + * @param {number} ems - the total numerical value of emeralds to compact. + */ + function emsToInvSpace(ems) { + let stx = Math.floor(ems/262144); + ems -= stx*4096*64; + let LE = Math.floor(ems/4096); + ems -= LE*4096; + let EB = Math.floor(ems/64); + ems -= EB*64; + let e = ems; + return [ stx + Math.ceil(LE/64) + Math.ceil(EB/64) + Math.ceil(e/64) , e, EB, LE, stx]; + } + /** + * + * @param {String} tier - item tier + * @param {Number} lvl - item level + */ + function getIDCost(tier, lvl) { + switch (tier) { + case "Unique": + return Math.round(0.5*lvl + 3); + case "Rare": + return Math.round(1.2*lvl + 8); + case "Legendary": + return Math.round(4.5*lvl + 12); + case "Fabled": + return Math.round(12*lvl + 26); + case "Mythic": + return Math.round(18*lvl + 90); + case "Set": + return Math.round(1.5*lvl + 8) + default: + return -1; + } + } + + parent_elem.style = "display: visible"; + let lvl = item.get("lvl"); + if (typeof(lvl) === "string") { lvl = parseFloat(lvl); } + + let title_elem = document.createElement("div"); + title_elem.classList.add("big-title", "justify-content-center", "Set"); + title_elem.textContent = "Identification Costs"; + parent_elem.appendChild(title_elem); + + let grid_item = document.createElement("div"); + grid_item.classList.add("row", "g-3"); + parent_elem.appendChild(grid_item); + + let IDcost = getIDCost(tier, lvl); + let initIDcost = IDcost; + let invSpace = emsToInvSpace(IDcost); + let rerolls = 0; + + while(invSpace[0] <= 28 && IDcost > 0) { + let container_container = document.createElement("div"); + container_container.classList.add("col-lg-3", "col-sm-12"); + + let container = document.createElement("div"); + container.classList.add("col", "rounded", "border", "border-dark", "border-2"); + + container_container.appendChild(container); + + let container_title = document.createElement("div"); + container_title.classList.add("row", "box-title", "justify-content-center"); + + if (rerolls == 0) { + container_title.textContent = "Initial ID Cost: "; + } else { + container_title.textContent = "Reroll to [" + (rerolls+1) + "] Cost:"; + } + container.appendChild(container_title); + let total_cost_container = document.createElement("div"); + total_cost_container.classList.add("row"); + let total_cost_number = document.createElement("b"); + total_cost_number.classList.add("Set", "fw-bold", "col-6", "text-end"); + total_cost_number.textContent = IDcost + " "; + let total_cost_suffix = document.createElement("div"); + total_cost_suffix.classList.add("col-6", "text-start"); + total_cost_suffix.textContent = "emeralds." + total_cost_container.appendChild(total_cost_number); + total_cost_container.appendChild(total_cost_suffix); + container.appendChild(total_cost_container); + + let OR = document.createElement("div"); + OR.classList.add("row"); + container.appendChild(OR); + let OR_text = document.createElement("div"); + OR_text.classList.add("col", "text-center"); + OR_text.textContent = "OR"; + OR.appendChild(OR_text); + + let esuffixes = ["", "emeralds.", "EB.", "LE.", "stacks of LE."]; + for (let i = 4; i > 0; i--) { + let n_container = document.createElement("div"); + n_container.classList.add("row"); + let n_number = document.createElement("b"); + n_number.classList.add("Set", "fw-bold", "col-6", "text-end"); + n_number.textContent = invSpace[i] + " "; + let n_suffix = document.createElement("div"); + n_suffix.classList.add("col-6", "text-start"); + n_suffix.textContent = esuffixes[i]; + n_container.appendChild(n_number); + n_container.appendChild(n_suffix); + container.appendChild(n_container); + } + grid_item.appendChild(container_container); + + rerolls += 1; + IDcost = Math.round(initIDcost * (5 ** rerolls)); + invSpace = emsToInvSpace(IDcost); + } + } +} + +/** Displays all set bonuses (0/n, 1/n, ... n/n) for a given set + * + * @param {String} parent_id - id of the parent element + * @param {String} setName - the name of the set + */ + function displaysq2AllSetBonuses(parent_id, setName) { + let parent_elem = document.getElementById(parent_id); + parent_elem.style.display = ""; + let set = sets[setName]; + let title_elem = document.createElement("div"); + title_elem.textContent = setName + " Set Bonuses"; + title_elem.classList.add("Set", "big-title", "justify-content-center"); + parent_elem.appendChild(title_elem); + + let grid_elem = document.createElement("div"); + grid_elem.classList.add("row"); + parent_elem.appendChild(grid_elem); + + for (let i = 0; i < set.items.length; i++) { + + let set_elem = document.createElement('div'); + set_elem.classList.add("col-lg-3", "col-sm-12", "py-2", "my-1"); + grid_elem.appendChild(set_elem); + const bonus = set.bonuses[i]; + + let set_elem_display = document.createElement("div"); + set_elem_display.classList.add("rounded", "col", "g-0", "scaled-font", "border", "border-3", "border-dark", "dark-shadow", "dark-7", "p-3"); + set_elem_display.id = "set-"+setName+"-"+i; + set_elem.appendChild(set_elem_display); + + let mock_item = new Map(); + mock_item.set("fixID", true); + mock_item.set("tier", "Set"); + mock_item.set("displayName", setName+" Set: " + (i+1) + "/"+sets[setName].items.length); + // set_elem.textContent = mock_item.get("displayName"); + let mock_minRolls = new Map(); + let mock_maxRolls = new Map(); + mock_item.set("minRolls", mock_minRolls); + mock_item.set("maxRolls", mock_maxRolls); + for (const id in bonus) { + if (rolledIDs.includes(id)) { + mock_minRolls.set(id, bonus[id]); + mock_maxRolls.set(id, bonus[id]); + } + else { + mock_item.set(id, bonus[id]); + } + } + mock_item.set("powders", []); + displaysq2ExpandedItem(mock_item, set_elem_display.id); + } + +} + +/** Displays the individual probabilities of each possible value of each rollable ID for this item. + * + * @param {String} parent_id the document id of the parent element + * @param {String} item expandedItem object + * @param {String} amp the level of corkian amplifier used. 0 means no amp, 1 means Corkian Amplifier I, etc. [0,3] + */ +function displaysq2IDProbabilities(parent_id, item, amp) { + if (item.has("fixID") && item.get("fixID")) {return} + let parent_elem = document.getElementById(parent_id); + parent_elem.style.display = ""; + parent_elem.innerHTML = ""; + let title_elem = document.createElement("div"); + title_elem.textContent = "Identification Probabilities"; + title_elem.classList.add("row", "Legendary", "big-title", "justify-content-center"); + parent_elem.appendChild(title_elem); + + let disclaimer_elem = document.createElement("div"); + disclaimer_elem.classList.add("row", "justify-content-center"); + disclaimer_elem.textContent = "IDs are rolled on a uniform distribution. A chance of 0% means that either the minimum or maximum possible multiplier must be rolled to get this value." + parent_elem.appendChild(disclaimer_elem); + + let amp_row = document.createElement("div"); + amp_row.classList.add("row", "justify-content-center"); + amp_row.id = "amp_row"; + let amp_text = document.createElement("div"); + amp_text.classList.add("col-lg-2", "col-sm-3"); + amp_text.textContent = "Corkian Amplifier Used: " + amp_row.appendChild(amp_text); + + let amp_1 = document.createElement("button"); + amp_1.classList.add("col-lg-1", "col-sm-3", "border-dark", "text-light", "dark-5", "rounded", "scaled-font"); + amp_1.id = "cork_amp_1"; + amp_1.textContent = "I"; + amp_row.appendChild(amp_1); + let amp_2 = document.createElement("button"); + amp_2.classList.add("col-lg-1", "col-sm-3", "border-dark", "text-light", "dark-5", "rounded", "scaled-font"); + amp_2.id = "cork_amp_2"; + amp_2.textContent = "II"; + amp_row.appendChild(amp_2); + let amp_3 = document.createElement("button"); + amp_3.classList.add("col-lg-1", "col-sm-3", "border-dark", "text-light", "dark-5", "rounded", "scaled-font"); + amp_3.id = "cork_amp_3"; + amp_3.textContent = "III"; + amp_row.appendChild(amp_3); + amp_1.addEventListener("click", (event) => {toggleAmps(1)}); + amp_2.addEventListener("click", (event) => {toggleAmps(2)}); + amp_3.addEventListener("click", (event) => {toggleAmps(3)}); + parent_elem.appendChild(amp_row); + + if (amp != 0) {toggleButton("cork_amp_" + amp)} + + item_name = item.get("displayName"); + for (const [id,val] of Object.entries(itemMap.get(item_name))) { + if (rolledIDs.includes(id)) { + let min = item.get("minRolls").get(id); + let max = item.get("maxRolls").get(id); + + if (min != 0 || max != 0) { + //Apply corkian amps + if (val > 0) { + let base = itemMap.get(item_name)[id]; + if (reversedIDs.includes(id)) {max = Math.max( Math.round((0.3 + 0.05*amp) * base), 1)} + else {min = Math.max( Math.round((0.3 + 0.05*amp) * base), 1)} + } + + let row_elem = document.createElement("div"); + row_elem.classList.add("row"); + parent_elem.appendChild(row_elem); + + let base_and_range = document.createElement("div"); + base_and_range.classList.add("col-lg-4", "col-sm-12"); + + + let base_elem = document.createElement("div"); + let base_val = document.createElement("div"); + base_elem.classList.add("row"); + base_prefix = document.createElement("div"); + base_prefix.classList.add("col-auto"); + base_val.classList.add("col-auto"); + + base_prefix.textContent = idPrefixes[id] + "Base "; + base_val.textContent = val + idSuffixes[id]; + if (val > 0 == !reversedIDs.includes(id)) { + base_val.classList.add("positive"); + } else if (val > 0 == reversedIDs.includes(id)) { + base_val.classList.add("negative"); + } + base_elem.appendChild(base_prefix); + base_elem.appendChild(base_val); + + let range_elem = document.createElement("div"); + range_elem.classList.add("row", "justify-content-center"); + + range_elem.textContent = "[ " + min + idSuffixes[id] + ", " + max + idSuffixes[id] + " ]"; + if ( (min > 0 && max > 0 && !reversedIDs.includes(id)) || (min < 0 && max < 0 && reversedIDs.includes(id)) ) { + range_elem.classList.add("positive"); + } else if ( (min < 0 && max < 0 && !reversedIDs.includes(id)) || (min > 0 && max > 0 && reversedIDs.includes(id)) ) { + range_elem.classList.add("negative"); + } + + base_and_range.appendChild(base_elem); + base_and_range.appendChild(range_elem); + row_elem.appendChild(base_and_range); + + + let pdf_and_cdf = document.createElement("div"); + pdf_and_cdf.classList.add("col-lg-4", "col-sm-12"); + + let pdf_elem = document.createElement("div"); + pdf_elem.id = id + "-pdf"; + let cdf_elem = document.createElement("div"); + cdf_elem.id = id + "-cdf"; + pdf_elem.classList.add("row"); + cdf_elem.classList.add("row"); + + pdf_and_cdf.appendChild(pdf_elem); + pdf_and_cdf.appendChild(cdf_elem); + row_elem.appendChild(pdf_and_cdf); + + let input_sec = document.createElement("div"); + input_sec.classList.add("col-lg-4", "col-sm-12"); + + let title_input_slider = document.createElement("input"); + title_input_slider.classList.add("row"); + title_input_slider.type = "range"; + title_input_slider.id = id+"-slider"; + if (!reversedIDs.includes(id)) { + title_input_slider.step = 1; + title_input_slider.min = `${min}`; + title_input_slider.max = `${max}`; + title_input_slider.value = `${max}`; + } else { + title_input_slider.step = 1; + title_input_slider.min = `${-1*min}`; + title_input_slider.max = `${-1*max}`; + title_input_slider.value = `${-1*max}`; + } + let title_input_textbox = document.createElement("input"); + title_input_textbox.classList.add("row"); + title_input_textbox.type = "text"; + title_input_textbox.value = `${max}`; + title_input_textbox.id = id+"-textbox"; + title_input_textbox.classList.add("rounded", "border", "border-dark", "border-2", "dark-5", "text-light"); + input_sec.appendChild(title_input_slider); + input_sec.appendChild(title_input_textbox); + + row_elem.appendChild(input_sec); + + sq2StringPDF(id, max, val, amp); //val is base roll + sq2StringCDF(id, max, val, amp); //val is base roll + title_input_slider.addEventListener("change", (event) => { + let id_name = event.target.id.split("-")[0]; + let textbox_elem = document.getElementById(id_name+"-textbox"); + + if (reversedIDs.includes(id_name)) { + if (event.target.value < -1*min) { event.target.value = -1*min} + if (event.target.value > -1*max) { event.target.value = -1*max} + sq2StringPDF(id_name, -1*event.target.value, val, amp); //val is base roll + sq2StringCDF(id_name, -1*event.target.value, val, amp); //val is base roll + } else { + if (event.target.value < min) { event.target.value = min} + if (event.target.value > max) { event.target.value = max} + sq2StringPDF(id_name, 1*event.target.value, val, amp); //val is base roll + sq2StringCDF(id_name, 1*event.target.value, val, amp); //val is base roll + } + + if (textbox_elem && textbox_elem.value !== event.target.value) { + if (reversedIDs.includes(id_name)) { + textbox_elem.value = -event.target.value; + } else { + textbox_elem.value = event.target.value; + } + } + + + }); + title_input_textbox.addEventListener("change", (event) => { + let id_name = event.target.id.split("-")[0]; + if (reversedIDs.includes(id_name)) { + if (event.target.value > min) { event.target.value = min} + if (event.target.value < max) { event.target.value = max} + } else { + if (event.target.value < min) { event.target.value = min} + if (event.target.value > max) { event.target.value = max} + } + let slider_elem = document.getElementById(id_name+"-slider"); + if (slider_elem.value !== event.target.value) { + slider_elem.value = -event.target.value; + } + + sq2StringPDF(id_name, 1*event.target.value, val, amp); + sq2StringCDF(id_name, 1*event.target.value, val, amp); + }); + } + } + } +} + +//helper functions. id - the string of the id's name, val - the value of the id, base - the base value of the item for this id +function sq2StringPDF(id,val,base,amp) { + /** [0.3b,1.3b] positive normal + * [1.3b,0.3b] positive reversed + * [1.3b,0.7b] negative normal + * [0.7b,1.3b] negative reversed + * + * [0.3, 1.3] minr, maxr [0.3b, 1.3b] min, max + * the minr/maxr decimal roll that corresponds to val -> minround, maxround + */ + let p; let min; let max; let minr; let maxr; let minround; let maxround; + if (base > 0) { + minr = 0.3 + 0.05*amp; maxr = 1.3; + min = Math.max(1, Math.round(minr*base)); max = Math.max(1, Math.round(maxr*base)); + minround = (min == max) ? (minr) : ( Math.max(minr, (val-0.5) / base) ); + maxround = (min == max) ? (maxr) : ( Math.min(maxr, (val+0.5) / base) ); + } else { + minr = 1.3; maxr = 0.7; + min = Math.min(-1, Math.round(minr*base)); max = Math.min(-1, Math.round(maxr*base)); + minround = (min == max) ? (minr) : ( Math.min(minr, (val-0.5) / base) ); + maxround = (min == max) ? (maxr) : ( Math.max(maxr, (val+0.5) / base) ); + } + + p = Math.abs(maxround-minround)/Math.abs(maxr-minr)*100; + p = p.toFixed(3); + + let div1 = document.createElement("div"); + div1.textContent = "Roll exactly "; + div1.classList.add("col-auto", "px-0"); + let div2 = document.createElement("div"); + div2.textContent = val + idSuffixes[id]; + div2.classList.add("col-auto", "px-1"); + if (val > 0 == !reversedIDs.includes(id)) {div2.classList.add("positive")} + if (val > 0 == reversedIDs.includes(id)) {div2.classList.add("negative")} + let div3 = document.createElement("div"); + div3.textContent = ": " + p + "%"; + div3.classList.add("col-auto", "px-0"); + document.getElementById(id + "-pdf").innerHTML = ""; + document.getElementById(id + "-pdf").appendChild(div1); + document.getElementById(id + "-pdf").appendChild(div2); + document.getElementById(id + "-pdf").appendChild(div3); +} +function sq2StringCDF(id,val,base,amp) { + let p; let min; let max; let minr; let maxr; let minround; let maxround; + if (base > 0) { + minr = 0.3 + 0.05*amp; maxr = 1.3; + min = Math.max(1, Math.round(minr*base)); max = Math.max(1, Math.round(maxr*base)); + minround = (min == max) ? (minr) : ( Math.max(minr, (val-0.5) / base) ); + maxround = (min == max) ? (maxr) : ( Math.min(maxr, (val+0.5) / base) ); + } else { + minr = 1.3; maxr = 0.7; + min = Math.min(-1, Math.round(minr*base)); max = Math.min(-1, Math.round(maxr*base)); + minround = (min == max) ? (minr) : ( Math.min(minr, (val-0.5) / base) ); + maxround = (min == max) ? (maxr) : ( Math.max(maxr, (val+0.5) / base) ); + } + + if (reversedIDs.includes(id)) { + p = Math.abs(minr-maxround)/Math.abs(maxr-minr)*100; + } else { + p = Math.abs(maxr-minround)/Math.abs(maxr-minr)*100; + } + p = p.toFixed(3); + + let div1 = document.createElement("div"); + div1.textContent = "Roll "; + div1.classList.add("col-auto", "px-0"); + let div2 = document.createElement("div"); + div2.textContent = val + idSuffixes[id]; + div2.classList.add("col-auto", "px-1"); + if (val > 0 == !reversedIDs.includes(id)) {div2.classList.add("positive")} + if (val > 0 == reversedIDs.includes(id)) {div2.classList.add("negative")} + let div3 = document.createElement("div"); + div3.textContent= " or better: " + p + "%"; + div3.classList.add("col-auto", "px-0"); + document.getElementById(id + "-cdf").innerHTML = ""; + document.getElementById(id + "-cdf").appendChild(div1); + document.getElementById(id + "-cdf").appendChild(div2); + document.getElementById(id + "-cdf").appendChild(div3); +} diff --git a/map/index.html b/map/index.html index 3dbe73d..6bdc441 100644 --- a/map/index.html +++ b/map/index.html @@ -41,7 +41,6 @@ WynnCustomWynnCustom WynnGPSWynnGPS WynnfoWynnfo - WynnAtlas Mini Swap Icon Style
diff --git a/wynnfo/index.html b/wynnfo/index.html index bc8d121..9687846 100644 --- a/wynnfo/index.html +++ b/wynnfo/index.html @@ -27,7 +27,6 @@ WynnCustomWynnCustom WynnGPSWynnGPS WynnfoWynnfo - WynnAtlas Mini Swap Icon Style