small updates: fixed neutral dmg tooltips showing undefined, fixed custom crafted items not working, added corkian amplifiers to item page
This commit is contained in:
parent
48b7c986d9
commit
a3adc92264
8 changed files with 102 additions and 62 deletions
10
crafter.js
10
crafter.js
|
@ -249,16 +249,6 @@ function populateFields() {
|
|||
|
||||
}
|
||||
|
||||
/* Toggles ONE button
|
||||
*/
|
||||
function toggleButton(buttonId) {
|
||||
let elem = document.getElementById(buttonId);
|
||||
if (elem.classList.contains("toggleOn")) {
|
||||
elem.classList.remove("toggleOn");
|
||||
} else{
|
||||
elem.classList.add("toggleOn");
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy the link
|
||||
*/
|
||||
|
|
|
@ -215,11 +215,11 @@ class Custom{
|
|||
this.statMap.set("nDamBaseLow", Math.floor((parseFloat(this.statMap.get("nDamLow")) + parseFloat(this.statMap.get("nDam"))) / 2) );
|
||||
this.statMap.set("nDamBaseHigh", Math.floor((parseFloat(this.statMap.get("nDamLow")) + parseFloat(this.statMap.get("nDam"))) / 2) );
|
||||
for (const e in skp_elements) {
|
||||
statMap.set(skp_elements[e]+"DamBaseLow", Math.floor((parseFloat(this.statMap.get(skp_elements[e]+"DamLow")) + parseFloat(this.statMap.get(skp_elements[e]+"Dam"))) / 2));
|
||||
statMap.set(skp_elements[e]+"DamBaseHigh", Math.floor((parseFloat(this.statMap.get(skp_elements[e]+"DamLow")) + parseFloat(this.statMap.get(skp_elements[e]+"Dam"))) / 2));
|
||||
this.statMap.set(skp_elements[e]+"DamBaseLow", Math.floor((parseFloat(this.statMap.get(skp_elements[e]+"DamLow")) + parseFloat(this.statMap.get(skp_elements[e]+"Dam"))) / 2));
|
||||
this.statMap.set(skp_elements[e]+"DamBaseHigh", Math.floor((parseFloat(this.statMap.get(skp_elements[e]+"DamLow")) + parseFloat(this.statMap.get(skp_elements[e]+"Dam"))) / 2));
|
||||
}
|
||||
this.statMap.set("ingredPowders", []);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.statMap.get("category") !== "weapon") {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="stylesheet" media="screen and (min-width: 800px)" href="customwide.css"/>
|
||||
<link rel="stylesheet" media="screen and (max-width: 799px)" href="customnarrow.css"/>
|
||||
<link rel="icon" href="./media/icons/custom.png">
|
||||
<link rel="icon" href="./media/icons/old/custom.png">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<title>WynnCustom</title>
|
||||
</head>
|
||||
|
|
|
@ -8,7 +8,7 @@ const custom_url_tag = location.hash.slice(1);
|
|||
// console.log(custom_url_base);
|
||||
// console.log(custom_url_tag);
|
||||
|
||||
const CUSTOM_BUILD_VERSION = "7";
|
||||
const CUSTOM_BUILD_VERSION = "7.0.1";
|
||||
|
||||
function setTitle() {
|
||||
let text = "WynnCustom version "+CUSTOM_BUILD_VERSION;
|
||||
|
@ -193,7 +193,6 @@ function calculateCustom() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
player_custom_item = new Custom(statMap);
|
||||
|
@ -201,8 +200,6 @@ function calculateCustom() {
|
|||
document.getElementById("right-container").classList.remove("sticky-box");
|
||||
let custom_str = encodeCustom(player_custom_item.statMap, true);
|
||||
location.hash = custom_str;
|
||||
|
||||
custom_str = encodeCustom(player_custom_item.statMap, true);
|
||||
player_custom_item.setHash(custom_str);
|
||||
console.log(player_custom_item.statMap.get("hash"));
|
||||
|
||||
|
@ -429,16 +426,7 @@ function populateFields() {
|
|||
}
|
||||
}
|
||||
|
||||
/* Toggles ONE button
|
||||
*/
|
||||
function toggleButton(buttonId) {
|
||||
let elem = document.getElementById(buttonId);
|
||||
if (elem.classList.contains("toggleOn")) {
|
||||
elem.classList.remove("toggleOn");
|
||||
} else{
|
||||
elem.classList.add("toggleOn");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Changes an element's text content from yes to no or vice versa
|
||||
*/
|
||||
|
|
|
@ -131,12 +131,13 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
|||
let skillBoost = [0];
|
||||
for (let i in total_skillpoints) {
|
||||
skillBoost.push(skillPointsToPercentage(total_skillpoints[i]) + buildStats.get("damageBonus")[i] / 100.);
|
||||
tooltipinfo.get("skillBoost")[i] = `(${skillPointsToPercentage(total_skillpoints[i]).toFixed(2)} + ${(buildStats.get("damageBonus")[i]/100.).toFixed(2)})`
|
||||
tooltipinfo.get("skillBoost")[parseInt(i,10)+1] = `(${skillPointsToPercentage(total_skillpoints[i]).toFixed(2)} + ${(buildStats.get("damageBonus")[i]/100.).toFixed(2)})`
|
||||
}
|
||||
tooltipinfo.get("skillBoost")[0] = undefined;
|
||||
|
||||
for (let i in damages) {
|
||||
let damageBoost = 1 + skillBoost[i] + staticBoost;
|
||||
tooltipinfo.set("damageBoost", `(1 + ${tooltipinfo.get("skillBoost")[i-1]} + ${tooltipinfo.get("staticBoost")})`)
|
||||
tooltipinfo.set("damageBoost", `(1 + ${(tooltipinfo.get("skillBoost")[i] ? tooltipinfo.get("skillBoost")[i] + " + " : "")} ${tooltipinfo.get("staticBoost")})`)
|
||||
damages_results.push([
|
||||
//Math.max(damages[i][0] * strBoost * Math.max(damageBoost,0) * damageMult, 0), // Normal min
|
||||
//Math.max(damages[i][1] * strBoost * Math.max(damageBoost,0) * damageMult, 0), // Normal max
|
||||
|
|
66
display.js
66
display.js
|
@ -2391,13 +2391,16 @@ function displayAdditionalInfo(elemID, 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 displayIDProbabilities(parent_id,item) {
|
||||
function displayIDProbabilities(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("p");
|
||||
title_elem.textContent = "Identification Probabilities";
|
||||
title_elem.id = "ID_PROB_TITLE";
|
||||
title_elem.classList.add("Legendary");
|
||||
title_elem.classList.add("title");
|
||||
parent_elem.appendChild(title_elem);
|
||||
|
@ -2406,6 +2409,30 @@ function displayIDProbabilities(parent_id,item) {
|
|||
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("p");
|
||||
amp_row.id = "amp_row";
|
||||
let amp_text = document.createElement("b");
|
||||
amp_text.textContent = "Corkian Amplifier Used: "
|
||||
amp_row.appendChild(amp_text);
|
||||
let amp_1 = document.createElement("button");
|
||||
amp_1.id = "cork_amp_1";
|
||||
amp_1.textContent = "I";
|
||||
amp_row.appendChild(amp_1);
|
||||
let amp_2 = document.createElement("button");
|
||||
amp_2.id = "cork_amp_2";
|
||||
amp_2.textContent = "II";
|
||||
amp_row.appendChild(amp_2);
|
||||
let amp_3 = document.createElement("button");
|
||||
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)}
|
||||
|
||||
let item_name = item.get("displayName");
|
||||
console.log(itemMap.get(item_name))
|
||||
|
||||
|
@ -2415,6 +2442,12 @@ function displayIDProbabilities(parent_id,item) {
|
|||
if (rolledIDs.includes(id)) {
|
||||
let min = item.get("minRolls").get(id);
|
||||
let max = item.get("maxRolls").get(id);
|
||||
//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_title = document.createElement("tr");
|
||||
//row_title.style.textAlign = "left";
|
||||
|
@ -2491,8 +2524,8 @@ function displayIDProbabilities(parent_id,item) {
|
|||
|
||||
|
||||
|
||||
stringPDF(id, max, val); //val is base roll
|
||||
stringCDF(id, max, val); //val is base roll
|
||||
stringPDF(id, max, val, amp); //val is base roll
|
||||
stringCDF(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");
|
||||
|
@ -2500,13 +2533,13 @@ function displayIDProbabilities(parent_id,item) {
|
|||
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}
|
||||
stringPDF(id_name, -1*event.target.value, val); //val is base roll
|
||||
stringCDF(id_name, -1*event.target.value, val); //val is base roll
|
||||
stringPDF(id_name, -1*event.target.value, val, amp); //val is base roll
|
||||
stringCDF(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}
|
||||
stringPDF(id_name, 1*event.target.value, val); //val is base roll
|
||||
stringCDF(id_name, 1*event.target.value, val); //val is base roll
|
||||
stringPDF(id_name, 1*event.target.value, val, amp); //val is base roll
|
||||
stringCDF(id_name, 1*event.target.value, val, amp); //val is base roll
|
||||
}
|
||||
|
||||
if (textbox_elem && textbox_elem.value !== event.target.value) {
|
||||
|
@ -2533,19 +2566,15 @@ function displayIDProbabilities(parent_id,item) {
|
|||
slider_elem.value = -event.target.value;
|
||||
}
|
||||
|
||||
stringPDF(id_name, 1*event.target.value, val);
|
||||
stringCDF(id_name, 1*event.target.value, val);
|
||||
stringPDF(id_name, 1*event.target.value, val, amp);
|
||||
stringCDF(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 stringPDF(id,val,base) {
|
||||
function stringPDF(id,val,base,amp) {
|
||||
/** [0.3b,1.3b] positive normal
|
||||
* [1.3b,0.3b] positive reversed
|
||||
* [1.3b,0.7b] negative normal
|
||||
|
@ -2556,7 +2585,7 @@ function stringPDF(id,val,base) {
|
|||
*/
|
||||
let p; let min; let max; let minr; let maxr; let minround; let maxround;
|
||||
if (base > 0) {
|
||||
minr = 0.3; maxr = 1.3;
|
||||
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) );
|
||||
|
@ -2566,8 +2595,6 @@ function stringPDF(id,val,base) {
|
|||
minround = (min == max) ? (minr) : ( Math.min(minr, (val-0.5) / base) );
|
||||
maxround = (min == max) ? (maxr) : ( Math.max(maxr, (val+0.5) / base) );
|
||||
}
|
||||
|
||||
console.log(( Math.min(maxr, (val+0.5) / base)));
|
||||
|
||||
p = Math.abs(maxround-minround)/Math.abs(maxr-minr)*100;
|
||||
p = p.toFixed(3);
|
||||
|
@ -2586,10 +2613,10 @@ function stringPDF(id,val,base) {
|
|||
document.getElementById(id + "-pdf").appendChild(b3);
|
||||
document.getElementById(id + "-pdf").style.textAlign = "left";
|
||||
}
|
||||
function stringCDF(id,val,base) {
|
||||
function stringCDF(id,val,base,amp) {
|
||||
let p; let min; let max; let minr; let maxr; let minround; let maxround;
|
||||
if (base > 0) {
|
||||
minr = 0.3; maxr = 1.3;
|
||||
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) );
|
||||
|
@ -2600,7 +2627,6 @@ function stringCDF(id,val,base) {
|
|||
maxround = (min == max) ? (maxr) : ( Math.max(maxr, (val+0.5) / base) );
|
||||
}
|
||||
|
||||
console.log(( Math.min(maxr, (val+0.5) / base)));
|
||||
if (reversedIDs.includes(id)) {
|
||||
p = Math.abs(minr-maxround)/Math.abs(maxr-minr)*100;
|
||||
} else {
|
||||
|
|
44
item.js
44
item.js
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
* TESTING SECTION
|
||||
*/
|
||||
|
@ -9,7 +8,7 @@ const item_url_tag = location.hash.slice(1);
|
|||
// console.log(item_url_base);
|
||||
// console.log(item_url_tag);
|
||||
|
||||
const ITEM_BUILD_VERSION = "7";
|
||||
const ITEM_BUILD_VERSION = "7.0.1";
|
||||
|
||||
function setTitle() {
|
||||
let text = "WynnInfo version "+ITEM_BUILD_VERSION;
|
||||
|
@ -20,28 +19,49 @@ function setTitle() {
|
|||
setTitle();
|
||||
|
||||
let item;
|
||||
let amp_state = 0; //the level of corkian map used for ID purposes. Default 0.
|
||||
|
||||
function init_itempage() {
|
||||
//console.log(item_url_tag);
|
||||
|
||||
//displayExpandedItem(expandItem(itemMap.get(item_url_tag).statMap, []), "item-view");
|
||||
try{
|
||||
if(itemMap) {
|
||||
item = expandItem(itemMap.get(item_url_tag.replaceAll("%20"," ")), []);
|
||||
displayExpandedItem(item, "item-view");
|
||||
displayAdditionalInfo("additional-info", item);
|
||||
displayIDCosts("identification-costs", item);
|
||||
if (item.get("set") && sets[item.get("set")]) {
|
||||
displayAllSetBonuses("set-bonus-info",item.get("set"));
|
||||
}
|
||||
console.log(item);
|
||||
displayIDProbabilities("identification-probabilities", item);
|
||||
item = expandItem(itemMap.get(item_url_tag.replaceAll("%20"," ")), []);
|
||||
displayExpandedItem(item, "item-view");
|
||||
displayAdditionalInfo("additional-info", item);
|
||||
displayIDCosts("identification-costs", item);
|
||||
if (item.get("set") && sets[item.get("set")]) {
|
||||
displayAllSetBonuses("set-bonus-info",item.get("set"));
|
||||
}
|
||||
console.log(item);
|
||||
displayIDProbabilities("identification-probabilities", item, amp_state);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
/** Toggles the corkian amplifier level.
|
||||
*
|
||||
* @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 {
|
||||
let button = document.getElementById("cork_amp_" + button_id);
|
||||
if (!button.classList.contains("toggleOn")) {
|
||||
for (const child of document.getElementById("amp_row").childNodes) {
|
||||
if (child.tagName === "BUTTON" && child.id !== button.id && child.classList.contains("toggleOn")) {
|
||||
child.classList.remove("toggleOn");
|
||||
}
|
||||
}
|
||||
amp_state = button_id;
|
||||
}
|
||||
}
|
||||
displayIDProbabilities("identification-probabilities", item, amp_state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
load_init(init_itempage);
|
||||
|
|
15
utils.js
15
utils.js
|
@ -343,4 +343,19 @@ function createTooltip(elem, element_type, tooltiptext, parent, classList) {
|
|||
parent.appendChild(elem);
|
||||
}
|
||||
return elem;
|
||||
}
|
||||
|
||||
/** A generic function that toggles the on and off state of a button.
|
||||
*
|
||||
* @param {String} button_id - the id name of the button.
|
||||
*/
|
||||
function toggleButton(button_id) {
|
||||
let elem = document.getElementById(button_id);
|
||||
if (elem.tagName === "BUTTON") {
|
||||
if (elem.classList.contains("toggleOn")) { //toggle the pressed button off
|
||||
elem.classList.remove("toggleOn");
|
||||
} else {
|
||||
elem.classList.add("toggleOn");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue