Copy Hash button added to customizer, MS, MR, and LS displays are now accurate to time, update to item view page.

This commit is contained in:
ferricles 2021-03-24 15:49:17 -07:00
parent e04ee5134d
commit f352f1ba8f
7 changed files with 101 additions and 21 deletions

View file

@ -1829,9 +1829,9 @@
Reset
</button>
</div>
<div class = "button copy-button-long" style = "grid-item-6">
<button class = "copy-button-long" id = "copy-button-long" onclick = "copyCustomLong()">
Copy Long
<div class = "button copy-button-hash" style = "grid-item-6">
<button class = "copy-button-hash" id = "copy-button-hash" onclick = "copyHash()">
Copy Hash
</button>
</div>
<div class="button set-button center" id = "fixID" style = "grid-item-5">

View file

@ -548,13 +548,12 @@ function copyCustom() {
}
}
function copyCustomLong() {
function copyHash() {
if (player_custom_item) {
let hash = encodeCustom(player_custom_item.statMap,true);
let hash = player_custom_item.statMap.get("hash");
console.log(hash);
location.hash = hash;
copyTextToClipboard(custom_url_base+location.hash);
document.getElementById("copy-button-long").textContent = "Copied!";
copyTextToClipboard(hash);
document.getElementById("copy-button-hash").textContent = "Copied!";
}
}

View file

@ -140,7 +140,7 @@ function idRound(id){
//Used for item IDs and ingredient id field IDs
let idPrefixes = {"displayName": "", "lvl":"Combat Level Min: ", "classReq":"Class Req: ","strReq":"Strength Min: ","dexReq":"Dexterity Min: ","intReq":"Intelligence Min: ","defReq":"Defense Min: ","agiReq":"Agility Min: ", "nDam_":"Neutral Damage: ", "eDam_":"Earth Damage: ", "tDam_":"Thunder Damage: ", "wDam_":"Water Damage: ", "fDam_":"Fire Damage: ", "aDam_":"Air Damage: ", "atkSpd":"Attack Speed: ", "hp":"Health : ", "eDef":"Earth Defense: ", "tDef":"Thunder Defense: ", "wDef":"Water Defense: ", "fDef":"Fire Defense: ", "aDef":"Air Defense: ", "str":"Strength: ", "dex":"Dexterity: ", "int":"Intelligence: ", "def":"Defense: ","agi":"Agility: ", "hpBonus":"Health Bonus: ", "hprRaw":"Health Regen Raw: ", "hprPct":"Health Regen %: ", "sdRaw":"Raw Spell Damage: ", "sdPct":"Spell Damage %: ", "mdRaw":"Raw Melee Damage: ", "mdPct":"Melee Damage %: ", "mr":"Mana Regen: ", "ms":"Mana Steal: ", "ref":"Reflection: ", "ls":"Life Steal: ", "poison":"Poison: ", "thorns":"Thorns: ", "expd":"Exploding: ", "spd":"Walk Speed Bonus: ", "atkTier":"Attack Speed Bonus: ", "eDamPct":"Earth Damage %: ", "tDamPct":"Thunder Damage %: ", "wDamPct":"Water Damage %: ", "fDamPct":"Fire Damage %: ", "aDamPct":"Air Damage %: ", "eDefPct":"Earth Defense %: ", "tDefPct":"Thunder Defense %: ", "wDefPct":"Water Defense %: ", "fDefPct":"Fire Defense %: ", "aDefPct":"Air Defense %: ", "spPct1":"1st Spell Cost %: ", "spRaw1":"1st Spell Cost Raw: ", "spPct2":"2nd Spell Cost %: ", "spRaw2":"2nd Spell Cost Raw: ", "spPct3":"3rd Spell Cost %: ", "spRaw3":"3rd Spell Cost Raw: ", "spPct4":"4th Spell Cost %: ", "spRaw4":"4th Spell Cost Raw: ", "rainbowRaw":"Rainbow Spell Damage Raw: ", "sprint":"Sprint Bonus: ", "sprintReg":"Sprint Regen Bonus: ", "jh":"Jump Height: ", "xpb":"Combat XP Bonus: ", "lb":"Loot Bonus: ", "lq":"Loot Quality: ", "spRegen":"Soul Point Regen: ", "eSteal":"Stealing: ", "gXp":"Gathering XP Bonus: ", "gSpd":"Gathering Speed Bonus: ", "slots":"Powder Slots: ", "set":"Set: ", "quest":"Quest Req: ", "restrict":"", "lore": ""};
let idSuffixes = {"displayName": "", "lvl":"", "classReq":"","strReq":"","dexReq":"","intReq":"","defReq":"","agiReq":"", "nDam_":"", "eDam_":"", "tDam_":"", "wDam_":"", "fDam_":"", "aDam_":"", "atkSpd":"", "hp":"", "eDef":"", "tDef":"", "wDef":"", "fDef":"", "aDef":"", "str":"", "dex":"", "int":"", "def":"","agi":"", "hpBonus":"", "hprRaw":"", "hprPct":"%", "sdRaw":"", "sdPct":"%", "mdRaw":"", "mdPct":"%", "mr":"/4s", "ms":"/4s", "ref":"%", "ls":"/4s", "poison":"/3s", "thorns":"%", "expd":"%", "spd":"%", "atkTier":" tier", "eDamPct":"%", "tDamPct":"%", "wDamPct":"%", "fDamPct":"%", "aDamPct":"%", "eDefPct":"%", "tDefPct":"%", "wDefPct":"%", "fDefPct":"%", "aDefPct":"%", "spPct1":"%", "spRaw1":"", "spPct2":"%", "spRaw2":"", "spPct3":"%", "spRaw3":"", "spPct4":"%", "spRaw4":"", "rainbowRaw":"", "sprint":"%", "sprintReg":"%", "jh":"", "xpb":"%", "lb":"%", "lq":"%", "spRegen":"%", "eSteal":"%", "gXp":"%", "gSpd":"%", "slots":"", "set":" set.", "quest":"", "restrict":"", "lore": ""};
let idSuffixes = {"displayName": "", "lvl":"", "classReq":"","strReq":"","dexReq":"","intReq":"","defReq":"","agiReq":"", "nDam_":"", "eDam_":"", "tDam_":"", "wDam_":"", "fDam_":"", "aDam_":"", "atkSpd":"", "hp":"", "eDef":"", "tDef":"", "wDef":"", "fDef":"", "aDef":"", "str":"", "dex":"", "int":"", "def":"","agi":"", "hpBonus":"", "hprRaw":"", "hprPct":"%", "sdRaw":"", "sdPct":"%", "mdRaw":"", "mdPct":"%", "mr":"/5s", "ms":"/3s", "ref":"%", "ls":"/3s", "poison":"/3s", "thorns":"%", "expd":"%", "spd":"%", "atkTier":" tier", "eDamPct":"%", "tDamPct":"%", "wDamPct":"%", "fDamPct":"%", "aDamPct":"%", "eDefPct":"%", "tDefPct":"%", "wDefPct":"%", "fDefPct":"%", "aDefPct":"%", "spPct1":"%", "spRaw1":"", "spPct2":"%", "spRaw2":"", "spPct3":"%", "spRaw3":"", "spPct4":"%", "spRaw4":"", "rainbowRaw":"", "sprint":"%", "sprintReg":"%", "jh":"", "xpb":"%", "lb":"%", "lq":"%", "spRegen":"%", "eSteal":"%", "gXp":"%", "gSpd":"%", "slots":"", "set":" set.", "quest":"", "restrict":"", "lore": ""};
//Used for ingredient IDs - name, lvl, tier. As of now, not used.
/*let ingPrefixes = {"name": "", "lvl": "", "tier": ""};
let ingSuffixes = {"name": "", "lvl": "", "tier": ""}*/
@ -250,6 +250,7 @@ function displaySetBonuses(parent_id,build) {
}
}
function displayBuildStats(parent_id,build){
// Commands to "script" the creation of nice formatting.
// #commands create a new element.
@ -2051,10 +2052,10 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell
/** Displays the ID costs of an item
*
* @param {Map} item - the statMap of an item.
* @param {String} elemID - the id of the parent element.
* @param {Map} item - the statMap of an item.
*/
function displayIDCosts(item, elemID) {
function displayIDCosts(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"))) {
@ -2174,11 +2175,11 @@ function displayIDCosts(item, elemID) {
/** Displays Additional Info for
*
* @param {Map} item - the statMap of the item
* @param {String} elemID - the parent element's id
* @param {Map} item - the statMap of the item
* @returns
*/
function displayAdditionalInfo(item, elemID) {
function displayAdditionalInfo(elemID, item) {
let parent_elem = document.getElementById(elemID);
parent_elem.classList.add("left");
@ -2196,3 +2197,74 @@ function displayAdditionalInfo(item, elemID) {
return;
}
/** 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 displayAllSetBonuses(parent_id,setName) {
let parent_elem = document.getElementById(parent_id);
parent_elem.style.display = "";
let set = sets[setName];
let title_elem = document.createElement("p");
title_elem.textContent = setName + " Set Bonuses";
title_elem.classList.add("Set");
title_elem.classList.add("title");
parent_elem.appendChild(title_elem);
let grid_elem = document.createElement("div");
grid_elem.style.display = "flex";
grid_elem.style.flexDirection = "rows";
grid_elem.style.flexWrap = "wrap";
grid_elem.style.gap = "5px";
parent_elem.appendChild(grid_elem);
for (let i = 0; i < set.items.length; i++) {
let set_elem = document.createElement('p');
set_elem.classList.add("container");
set_elem.style = "grid-item-"+(i+1);
set_elem.style.maxWidth = "max(180px, 15%)";
set_elem.id = "set-"+setName+"-"+i;
grid_elem.appendChild(set_elem);
const bonus = set.bonuses[i];
let mock_item = new Map();
mock_item.set("fixID", true);
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", []);
displayExpandedItem(mock_item, set_elem.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
*/
function displayIDProbabilities(parent_id,item) {
let parent_elem = document.getElementById(parent_id);
parent_elem.style.display = "";
let title_elem = document.createElement("p");
title_elem.textContent = "Identification Probabilities";
title_elem.classList.add("Legendary");
title_elem.classList.add("title");
parent_elem.appendChild(title_elem);
let item_name = item.get("displayName");
console.log(itemMap.get(item_name))
}

View file

@ -25,7 +25,7 @@
margin-bottom: 40px;
width: 96%;
}
.identification-costs {
.bigcontainer {
margin-top: 10px;
margin-bottom: 20px;
}

View file

@ -25,7 +25,7 @@
margin-bottom: 40px;
width: 96%;
}
.identification-costs {
.bigcontainer{
margin-top: 10px;
margin-bottom: 20px;
}

View file

@ -10,8 +10,8 @@
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="items.css">
<link rel="stylesheet" media="screen and (min-width: 1100px)" href="item-wide.css"/>
<link rel="stylesheet" media="screen and (max-width: 1099px)" href="item-narrow.css"/>
<link rel="stylesheet" media="screen and (min-width: 800px)" href="item-wide.css"/>
<link rel="stylesheet" media="screen and (max-width: 799px)" href="item-narrow.css"/>
<link rel="icon" href="./favicon.png">
<link rel="manifest" href="manifest.json">
<title>Wynn Clientside</title>
@ -44,8 +44,13 @@
<div class = "additional-info" id = "additional-info"></div>
</div>
</div>
<div class = "container identification-costs" id = "identification-costs" style = "display: none">
<div class = "container set-bonus-info bigcontainer" id = "set-bonus-info" style = "display: none">
</div>
<div class = "container identification-costs bigcontainer" id = "identification-costs" style = "display: none">
</div>
<div class = "container identification-probabilities bigcontainer" id = "identification-probabilities" style = "display: none">
</div>
</div>
<script type="text/javascript" src="utils.js"></script>
<script type="text/javascript" src="loadheader.js"></script>

10
item.js
View file

@ -9,7 +9,7 @@ const item_url_tag = location.hash.slice(1);
console.log(item_url_base);
console.log(item_url_tag);
const ITEM_BUILD_VERSION = "6.9.42";
const ITEM_BUILD_VERSION = "6.9.42.0";
function setTitle() {
let text = "WynnInfo version "+ITEM_BUILD_VERSION;
@ -38,9 +38,13 @@ function init() {
if(itemMap) {
item = expandItem(itemMap.get(item_url_tag.replaceAll("%20"," ")), []);
displayExpandedItem(item, "item-view");
displayIDCosts(item, "identification-costs");
displayAdditionalInfo(item, "additional-info");
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);
}
} catch (error) {
console.log(error);