Complete merge (2)

This commit is contained in:
b 2021-01-07 20:51:32 -06:00
parent b4a633b4c9
commit a39f19ee58
3 changed files with 8 additions and 43 deletions

View file

@ -54,7 +54,7 @@ function displayExpandedItem(item, parent_id){
"#ldiv",
"!elemental",
"hp",
"nDam", "eDam", "tDam", "wDam", "tDam", "aDam",
"nDam", "eDam", "tDam", "wDam", "fDam", "aDam",
"eDef", "tDef", "wDef", "fDef", "aDef",
"!elemental",
"#ldiv",
@ -62,7 +62,7 @@ function displayExpandedItem(item, parent_id){
"lvl",
"strReq", "dexReq", "intReq", "defReq","agiReq",
"#ldiv",
"str", "dex", "int", "agi", "def",
"str", "dex", "int", "def", "agi",
"#table",
"hpBonus",
"hprRaw", "hprPct",
@ -147,6 +147,10 @@ function displayExpandedItem(item, parent_id){
let p_elem = document.createElement('p');
p_elem.classList.add('itemp');
if (elemental_format) {
// HACK TO AVOID DISPLAYING ZERO DAMAGE! TODO
if (item.get(id) === "0-0") {
continue;
}
apply_elemental_format(p_elem, id, item.get(id));
}
else {

View file

@ -40,7 +40,7 @@ function calculate_skillpoints(equipment, weapon) {
total -= item.skillpoints[i];
}
if (item.reqs[i] == 0) continue;
skillpoint_filter[i] = true;
if (skillpoint_filter) skillpoint_filter[i] = true;
const req = item.reqs[i];
const cur = skillpoints[i];
if (req > cur) {

41
test.js
View file

@ -11,7 +11,7 @@ console.log(url_tag);
* END testing section
*/
const BUILD_VERSION = "1.1";
const BUILD_VERSION = "1.2";
document.getElementById("header").textContent = "Wynn build calculator "+BUILD_VERSION+" (db version "+DB_VERSION+")";
@ -356,45 +356,6 @@ function calculateBuild(){
setHTML("build-cumulative-stats", "".concat(meleeSummary)); //Incomplete function
location.hash = encodeBuild();
}
/* Helper function that gets stats ranges for wearable items.
@param item - an item in Object format.
*/
/* A second helper function that takes items from expandItem() and stringifies them.
@param item - a map with non-rolled Ids as normal key:value pairs and all rolled IDs as 2 separate key:value pairs in the minRoll and maxRoll keys that are mapped to maps.
TODO: write the function
*/
function expandedItemToString(item){
let ids = ["lvl", "classReq","strReq", "dexReq", "intReq", "defReq","agiReq", "nDam", "eDam", "tDam", "wDam", "tDam", "aDam", "atkSpd", "hp", "eDef", "tDef", "wDef", "fDef", "aDef", "str", "dex", "int", "agi", "def", "hpBonus", "hprRaw", "hprPct", "sdRaw", "sdPct", "mdRaw", "mdPct", "mr", "ms", "ref", "ls", "poison", "thorns", "exploding", "spd", "atkTier", "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", "quest", "restrict"];
let idPrefixes = {"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":"Main Attack Neutral Damage: ", "mdPct":"Main Attack Damage %: ", "mr":"Mana Regen: ", "ms":"Mana Steal: ", "ref":"Reflection: ", "ls":"Life Steal: ", "poison":"Poison: ", "thorns":"Thorns: ", "exploding":"Expoding: ", "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":"This item belongs to the ", "quest":"This item is from the quest<br>", "restrict":""};
let idSuffixes = {"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":"%", "exploding":"%", "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":""};
let itemString = "";
itemString = itemString.concat(item.get("name"),"<br><br>");
if(item.has("fixID") && item.get("fixID")){//fixed IDs
for(i = 0; i < ids.length; i++){ //iterate the ids
if(nonRolledIDs.includes(ids[i]) && item.get(ids[i])){//nonRolledID & non-0/non-null/non-und ID
itemString = itemString.concat(idPrefixes[ids[i]]);
itemString = itemString.concat(item.get(ids[i]), idSuffixes[ids[i]],"<br>");
}
if(rolledIDs.includes(ids[i]) && item.get("minRolls").get(ids[i]) && item.get("maxRolls").get(ids[i]) ){//rolled ID & non-0/non-null/non-und ID
itemString = itemString.concat(idPrefixes[ids[i]]);
itemString = itemString.concat(item.get("minRolls").get(ids[i]), idSuffixes[ids[i]],"<br>");
}//Just don't do anything if else
}
}else{//non-fixed IDs
for(i = 0; i < ids.length; i++){ //iterate the ids
if(nonRolledIDs.includes(ids[i]) && item.get(ids[i])){//nonRolledID & non-0/non-null/non-und ID
itemString = itemString.concat(idPrefixes[ids[i]]);
itemString = itemString.concat(item.get(ids[i]), idSuffixes[ids[i]],"<br>");
}
if(rolledIDs.includes(ids[i]) && item.get("minRolls").get(ids[i]) && item.get("maxRolls").get(ids[i]) ){//rolled ID & non-0/non-null/non-und ID
itemString = itemString.concat(idPrefixes[ids[i]]);
itemString = itemString.concat(item.get("minRolls").get(ids[i]), idSuffixes[ids[i]], " -> ", idRound(item.get("maxRolls").get(ids[i])),idSuffixes[ids[i]],"<br>");
}//Just don't do anything if else
}
}
itemString = itemString.concat("<br>",item.get("tier")," ", item.get("type"));
return itemString;
}
/*An independent helper function that rounds a rolled ID to the nearest integer OR brings the roll away from 0.
* @param id
*/