Fix merge conflicts
This commit is contained in:
commit
7a4d047ed5
3 changed files with 235 additions and 31 deletions
161
build.js
161
build.js
|
@ -104,7 +104,6 @@ class Build{
|
|||
this.items = [helmet, chestplate, leggings, boots, ring1, ring2, bracelet, necklace, weapon];
|
||||
// return [equip_order, best_skillpoints, final_skillpoints, best_total];
|
||||
let result = calculate_skillpoints(this.equipment, weapon);
|
||||
console.log(result);
|
||||
this.equip_order = result[0];
|
||||
this.base_skillpoints = result[1];
|
||||
this.total_skillpoints = result[2];
|
||||
|
@ -129,22 +128,93 @@ class Build{
|
|||
return health;
|
||||
}
|
||||
}
|
||||
/* Get total melee dps for build.
|
||||
/* Get melee stats for build.
|
||||
Returns an array in the order:
|
||||
|
||||
*/
|
||||
getMeleeDPS(){
|
||||
let meleeMult = {
|
||||
"SUPER_SLOW":"0.51",
|
||||
"VERY_SLOW":"0.83",
|
||||
"SLOW":"1.5",
|
||||
"NORMAL":"2.05",
|
||||
"FAST":"2.5",
|
||||
"VERY_FAST":"3.1",
|
||||
"SUPER_FAST":"4.3",
|
||||
}
|
||||
let stats = this.getBuildStats();
|
||||
let nDam = stats.get("nDam");
|
||||
getMeleeStats(){
|
||||
//Establish vars
|
||||
let meleeMult = new Map();
|
||||
meleeMult.set("SUPER_SLOW",0.51);
|
||||
meleeMult.set("VERY_SLOW",0.83);
|
||||
meleeMult.set("SLOW",1.5);
|
||||
meleeMult.set("NORMAL",2.05);
|
||||
meleeMult.set("FAST",2.5);
|
||||
meleeMult.set("VERY_FAST",3.1);
|
||||
meleeMult.set("SUPER_FAST",4.3);
|
||||
let atkSpdToNum = new Map();
|
||||
atkSpdToNum.set("SUPER_SLOW",-3);
|
||||
atkSpdToNum.set("VERY_SLOW",-2);
|
||||
atkSpdToNum.set("SLOW",-1);
|
||||
atkSpdToNum.set("NORMAL",0);
|
||||
atkSpdToNum.set("FAST",1);
|
||||
atkSpdToNum.set("VERY_FAST",2);
|
||||
atkSpdToNum.set("SUPER_FAST",3);
|
||||
let numToAtkSpd = new Map();
|
||||
numToAtkSpd.set(-3,"SUPER_SLOW");
|
||||
numToAtkSpd.set(-2,"VERY_SLOW");
|
||||
numToAtkSpd.set(-1,"SLOW");
|
||||
numToAtkSpd.set(0,"NORMAL");
|
||||
numToAtkSpd.set(1,"FAST");
|
||||
numToAtkSpd.set(2,"VERY_FAST");
|
||||
numToAtkSpd.set(3,"SUPER_FAST");
|
||||
|
||||
return [];
|
||||
let stats = this.getBuildStats();
|
||||
let nDam = stats.get("nDam").split("-").map(Number);
|
||||
let eDam = stats.get("eDam").split("-").map(Number);
|
||||
let tDam = stats.get("tDam").split("-").map(Number);
|
||||
let wDam = stats.get("wDam").split("-").map(Number);
|
||||
let fDam = stats.get("fDam").split("-").map(Number);
|
||||
let aDam = stats.get("aDam").split("-").map(Number);
|
||||
let mdRaw = stats.get("maxStats").get("mdRaw");
|
||||
|
||||
let mdPct = stats.get("maxStats").get("mdPct");
|
||||
let eDamPct = stats.get("maxStats").get("eDamPct");
|
||||
let tDamPct = stats.get("maxStats").get("tDamPct");
|
||||
let wDamPct = stats.get("maxStats").get("wDamPct");
|
||||
let fDamPct = stats.get("maxStats").get("fDamPct");
|
||||
let aDamPct = stats.get("maxStats").get("aDamPct");
|
||||
|
||||
let baseAtkTier = stats.get("atkSpd");
|
||||
let atkTier = stats.get("maxStats").get("atkTier");
|
||||
let adjAtkSpd = atkSpdToNum.get(baseAtkTier) + atkTier;
|
||||
if(adjAtkSpd > 3){
|
||||
adjAtkSpd = 3;
|
||||
}else if(adjAtkSpd < -3){
|
||||
adjAtkSpd = -3;
|
||||
}
|
||||
adjAtkSpd = numToAtkSpd.get(adjAtkSpd);
|
||||
let str = stats.get("str");
|
||||
let strReq = stats.get("strReq");
|
||||
str = str + strReq;
|
||||
let dex = stats.get("dex");
|
||||
let dexReq = stats.get("dexReq");
|
||||
dex = dex + dexReq;
|
||||
let int = stats.get("int");
|
||||
let intReq = stats.get("intReq");
|
||||
int = int + intReq;
|
||||
let def = stats.get("def");
|
||||
let defReq = stats.get("defReq");
|
||||
def = def + defReq;
|
||||
let agi = stats.get("agi");
|
||||
let agiReq = stats.get("agiReq");
|
||||
agi = agi + agiReq;
|
||||
let poison = stats.get("maxStats").get("poison");
|
||||
|
||||
//Now do math
|
||||
let nDamAdj = [Math.round(nDam[0] * ((100 + mdPct + skillPointsToPercentage(str) * 100) / 100.) + mdRaw), Math.round(nDam[1] * ((100 + mdPct + skillPointsToPercentage(str) * 100) / 100.) + mdRaw), Math.round(nDam[0] * ((200 + mdPct + skillPointsToPercentage(str) * 100) / 100.) + mdRaw), Math.round(nDam[1] * ((200 + mdPct + skillPointsToPercentage(str) * 100) / 100.) + mdRaw)];
|
||||
let eDamAdj = [Math.round(eDam[0] * ((100 + mdPct + eDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(str) * 100) / 100.)), Math.round(eDam[1] * ((100 + mdPct + eDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(str) * 100) / 100.)), Math.round(eDam[0] * ((200 + mdPct + eDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(str) * 100) / 100.)), Math.round(eDam[1] * ((200 + mdPct + eDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(str) * 100) / 100.))];
|
||||
let tDamAdj = [Math.round(tDam[0] * ((100 + mdPct + tDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(dex) * 100) / 100.)), Math.round(tDam[1] * ((100 + mdPct + tDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(dex) * 100) / 100.)), Math.round(tDam[0] * ((200 + mdPct + tDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(dex) * 100) / 100.)), Math.round(tDam[1] * ((200 + mdPct + tDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(dex) * 100) / 100.))];
|
||||
let wDamAdj = [Math.round(wDam[0] * ((100 + mdPct + wDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(int) * 100) / 100.)), Math.round(wDam[1] * ((100 + mdPct + wDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(int) * 100) / 100.)), Math.round(wDam[0] * ((200 + mdPct + wDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(int) * 100) / 100.)), Math.round(wDam[1] * ((200 + mdPct + wDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(int) * 100) / 100.))];
|
||||
let fDamAdj = [Math.round(fDam[0] * ((100 + mdPct + fDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(def) * 100) / 100.)), Math.round(fDam[1] * ((100 + mdPct + fDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(def) * 100) / 100.)), Math.round(fDam[0] * ((200 + mdPct + fDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(def) * 100) / 100.)), Math.round(fDam[1] * ((200 + mdPct + fDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(def) * 100) / 100.))];
|
||||
let aDamAdj = [Math.round(aDam[0] * ((100 + mdPct + aDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(agi) * 100) / 100.)), Math.round(aDam[1] * ((100 + mdPct + aDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(agi) * 100) / 100.)), Math.round(aDam[0] * ((200 + mdPct + aDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(agi) * 100) / 100.)), Math.round(aDam[1] * ((200 + mdPct + aDamPct + skillPointsToPercentage(str) * 100 + skillPointsToPercentage(agi) * 100) / 100.))];
|
||||
let totalDamNorm = [nDamAdj[0]+eDamAdj[0]+tDamAdj[0]+wDamAdj[0]+fDamAdj[0]+aDamAdj[0], nDamAdj[1]+eDamAdj[1]+tDamAdj[1]+wDamAdj[1]+fDamAdj[1]+aDamAdj[1]];
|
||||
let totalDamCrit = [nDamAdj[2]+eDamAdj[2]+tDamAdj[2]+wDamAdj[2]+fDamAdj[2]+aDamAdj[2], nDamAdj[3]+eDamAdj[3]+tDamAdj[3]+wDamAdj[3]+fDamAdj[3]+aDamAdj[3]];
|
||||
let normDPS = (totalDamNorm[0]+totalDamNorm[1])/2 * meleeMult.get(adjAtkSpd);
|
||||
let critDPS = (totalDamCrit[0]+totalDamCrit[1])/2 * meleeMult.get(adjAtkSpd);
|
||||
let avgDPS = (normDPS * (1 - skillPointsToPercentage(dex))) + (critDPS * (skillPointsToPercentage(dex))) + (poison / 3.0 * (1 + skillPointsToPercentage(str)));
|
||||
//console.log([nDamAdj,eDamAdj,tDamAdj,wDamAdj,fDamAdj,aDamAdj,totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS]);
|
||||
return [nDamAdj,eDamAdj,tDamAdj,wDamAdj,fDamAdj,aDamAdj,totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS];
|
||||
}
|
||||
|
||||
/* Get all stats for this build. Returns a map w/ sums of all IDs.
|
||||
|
@ -159,28 +229,61 @@ class Build{
|
|||
//Create a map of this build's stats
|
||||
//This is universal for every possible build, so it's possible to move this elsewhere.
|
||||
let statMap = new Map();
|
||||
let minStats = new Map(); //for rolled mins
|
||||
let maxStats = new Map(); //for rolled maxs
|
||||
for (const i in item_fields){
|
||||
let id = item_fields[i];
|
||||
if(stackingIDs.includes(id)){ //IDs stack - make it number
|
||||
statMap.set(id,0);
|
||||
}else if(standaloneIDs.includes(id)){ //IDs do not stack - string
|
||||
statMap.set(id,"");
|
||||
}
|
||||
if(rolledIDs.includes(id)){ //ID is rolled - put the min and max rolls in min and max stats
|
||||
if(stackingIDs.includes(id)){ //IDs stack - make it number
|
||||
minStats.set(id,0);
|
||||
maxStats.set(id,0);
|
||||
}//if standaloneIDs includes id, something's wrong.
|
||||
}else{ //ID is not rolled - just set w/ default
|
||||
if(stackingIDs.includes(id)){//stacking but not rolled: ex skill points
|
||||
statMap.set(id,0);
|
||||
}else if(standaloneIDs.includes(id)){
|
||||
statMap.set(id,"");
|
||||
}else if(skpReqs.includes(id)){
|
||||
statMap.set(id,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
statMap.set("minStats",minStats);
|
||||
statMap.set("maxStats",maxStats);
|
||||
|
||||
for (const i in this.items){
|
||||
let item = expandItem(this.items[i]);
|
||||
console.log(item,type(item));
|
||||
if(item.has("fixID") && item.get("fixID")){//item has fixed IDs
|
||||
for(const [key,value] in item.entries()){
|
||||
console.log(key,value);
|
||||
for(const [key,value] of item){ //for each key:value pair in item
|
||||
if(key === "minRolls"){
|
||||
for (const [id,roll] of value){ //for each id:roll pair in minRolls
|
||||
statMap.get("minStats").set(id,statMap.get("minStats").get(id) + roll); //we know they must stack
|
||||
}
|
||||
}else if(key==="maxRolls"){
|
||||
for (const [id,roll] of value){ //for each id:roll pair in maxRolls
|
||||
statMap.get("maxStats").set(id,statMap.get("maxStats").get(id) + roll); //we know they must stack
|
||||
}
|
||||
}else if(typeof value === "undefined"){ //does not stack - convert to string
|
||||
statMap.set(key,statMap.get(key).concat("undefined,"));
|
||||
}else if(typeof value === "null"){ //does not stack - convert to string
|
||||
statMap.set(key,statMap.get(key).concat("null,"));
|
||||
}else if(typeof value === "number"){ //although the value is not rolled, it stacks b/c it's a number.
|
||||
if(key === "strReq" || key === "dexReq" || key === "intReq" || key === "defReq" || key === "agiReq" ){
|
||||
if(value > statMap.get(key)){
|
||||
statMap.set(key,value);
|
||||
}
|
||||
}else{
|
||||
statMap.set(key,statMap.get(key)+value);
|
||||
}
|
||||
}else if(typeof value === "string"){ //does not stack
|
||||
if(key === "nDam" || key === "eDam" || key === "tDam" || key === "wDam" || key === "fDam" || key === "aDam" || key === "atkSpd"){
|
||||
statMap.set(key,statMap.get(key).concat(value));
|
||||
}else{
|
||||
statMap.set(key,statMap.get(key).concat(value.concat(",")));
|
||||
}
|
||||
}
|
||||
}else{//item does not have fixed IDs
|
||||
for (const i in item) {
|
||||
console.log(entry,": ",item.get(entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(statMap);
|
||||
return statMap;
|
||||
}
|
||||
|
||||
|
|
10
index.html
10
index.html
|
@ -140,6 +140,8 @@
|
|||
<div id="str-skp-base">
|
||||
Original Value: 0
|
||||
</div>
|
||||
<div id ="str-skp-pct">
|
||||
</div>
|
||||
</div>
|
||||
<div class="center" style="grid-column:2;grid-row:1">
|
||||
<div id="dex-skp-assign">
|
||||
|
@ -152,6 +154,8 @@
|
|||
<div id="dex-skp-base">
|
||||
Original Value: 0
|
||||
</div>
|
||||
<div id ="dex-skp-pct">
|
||||
</div>
|
||||
</div>
|
||||
<div class="center" style="grid-column:3;grid-row:1">
|
||||
<div id="int-skp-assign">
|
||||
|
@ -164,6 +168,8 @@
|
|||
<div id="int-skp-base">
|
||||
Original Value: 0
|
||||
</div>
|
||||
<div id ="int-skp-pct">
|
||||
</div>
|
||||
</div>
|
||||
<div class="center" style="grid-column:4;grid-row:1">
|
||||
<div id="def-skp-assign">
|
||||
|
@ -176,6 +182,8 @@
|
|||
<div id="def-skp-base">
|
||||
Original Value: 0
|
||||
</div>
|
||||
<div id ="def-skp-pct">
|
||||
</div>
|
||||
</div>
|
||||
<div class="center" style="grid-column:5;grid-row:1">
|
||||
<div id="agi-skp-assign">
|
||||
|
@ -188,6 +196,8 @@
|
|||
<div id="agi-skp-base">
|
||||
Original Value: 0
|
||||
</div>
|
||||
<div id ="agi-skp-pct">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class = "build">
|
||||
|
|
95
test.js
95
test.js
|
@ -20,7 +20,12 @@ let player_build;
|
|||
let armorTypes = [ "helmet", "chestplate", "leggings", "boots" ];
|
||||
let accessoryTypes = [ "ring", "bracelet", "necklace" ];
|
||||
let weaponTypes = [ "wand", "spear", "bow", "dagger", "relik" ];
|
||||
let item_fields = [ "name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "agiReq", "defReq", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "str", "dex", "int", "agi", "def", "thorns", "exploding", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "fixID", "category", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd", "id" ];
|
||||
let item_fields = [ "name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "str", "dex", "int", "agi", "def", "thorns", "exploding", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "fixID", "category", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd", "id" ];
|
||||
let nonRolledIDs = ["name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq","str", "dex", "int", "agi", "def", "fixID", "category", "id"];
|
||||
let rolledIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "exploding", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd"];
|
||||
let stackingIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "exploding", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd", "fDef", "wDef", "aDef", "tDef", "eDef", "str", "dex", "int", "agi", "def"];
|
||||
let standaloneIDs = ["name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "lvl", "classReq", "fixID", "category", "id"];
|
||||
let skpReqs = ["strReq", "dexReq", "intReq", "defReq", "agiReq"];
|
||||
let itemTypes = armorTypes.concat(accessoryTypes).concat(weaponTypes);
|
||||
let itemLists = new Map();
|
||||
for (const it of itemTypes) {
|
||||
|
@ -286,6 +291,13 @@ function calculateBuild(){
|
|||
setText("int-skp-base", "Original Value: " + skillpoints[2]);
|
||||
setText("def-skp-base", "Original Value: " + skillpoints[3]);
|
||||
setText("agi-skp-base", "Original Value: " + skillpoints[4]);
|
||||
console.log(skillpoints);
|
||||
|
||||
setHTML("str-skp-pct", skillPointsToPercentage(skillpoints[0])*100 );
|
||||
setHTML("dex-skp-pct", skillPointsToPercentage(skillpoints[1])*100 );
|
||||
setHTML("int-skp-pct", skillPointsToPercentage(skillpoints[2])*100 );
|
||||
setHTML("def-skp-pct", skillPointsToPercentage(skillpoints[3])*100 );
|
||||
setHTML("agi-skp-pct", skillPointsToPercentage(skillpoints[4])*100 );
|
||||
|
||||
setText("summary-box", "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints.");
|
||||
|
||||
|
@ -298,7 +310,54 @@ function calculateBuild(){
|
|||
displayExpandedItem(expandItem(player_build.bracelet), "build-bracelet");
|
||||
displayExpandedItem(expandItem(player_build.necklace), "build-necklace");
|
||||
displayExpandedItem(expandItem(player_build.weapon), "build-weapon");
|
||||
//setHTML("build-cumulative-stats", player_build.getMeleeDPS()); //Incomplete function
|
||||
let meleeStats = player_build.getMeleeStats();
|
||||
//nDamAdj,eDamAdj,tDamAdj,wDamAdj,fDamAdj,aDamAdj,totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS
|
||||
let meleeSummary = "";
|
||||
meleeSummary = meleeSummary.concat("<h1><u>Melee Stats</u></h1>");
|
||||
meleeSummary = meleeSummary.concat("<h2>Average DPS: ",Math.round(meleeStats[10]),"</h2> <br><br>");
|
||||
meleeSummary = meleeSummary.concat("<b>Non-Crit Stats: </b><br>");
|
||||
if(meleeStats[0][0] > 0){
|
||||
meleeSummary = meleeSummary.concat("Neutral Damage: ",meleeStats[0][0]," -> ",meleeStats[0][1],"<br>");
|
||||
}
|
||||
if(meleeStats[1][0] > 0){
|
||||
meleeSummary = meleeSummary.concat("Earth Damage: ",meleeStats[1][0]," -> ",meleeStats[1][1],"<br>");
|
||||
}
|
||||
if(meleeStats[2][0] > 0){
|
||||
meleeSummary = meleeSummary.concat("Thunder Damage: ",meleeStats[2][0]," -> ",meleeStats[2][1],"<br>");
|
||||
}
|
||||
if(meleeStats[3][0] > 0){
|
||||
meleeSummary = meleeSummary.concat("Water Damage: ",meleeStats[3][0]," -> ",meleeStats[3][1],"<br>");
|
||||
}
|
||||
if(meleeStats[4][0] > 0){
|
||||
meleeSummary = meleeSummary.concat("Fire Damage: ",meleeStats[4][0]," -> ",meleeStats[4][1],"<br>");
|
||||
}
|
||||
if(meleeStats[5][0] > 0){
|
||||
meleeSummary = meleeSummary.concat("Air Damage: ",meleeStats[5][0]," -> ",meleeStats[5][1],"<br>");
|
||||
}
|
||||
meleeSummary = meleeSummary.concat("<br>Total Damage: ",meleeStats[6][0]," -> ",meleeStats[6][1],"<br>");
|
||||
meleeSummary = meleeSummary.concat("Normal DPS: ",Math.round(meleeStats[8]),"<br><br>");
|
||||
meleeSummary = meleeSummary.concat("<b>Crit Stats: </b><br>");
|
||||
if(meleeStats[0][2] > 0){
|
||||
meleeSummary = meleeSummary.concat("Neutral Damage: ",meleeStats[0][2]," -> ",meleeStats[0][3],"<br>");
|
||||
}
|
||||
if(meleeStats[1][2] > 0){
|
||||
meleeSummary = meleeSummary.concat("Earth Damage: ",meleeStats[1][2]," -> ",meleeStats[1][3],"<br>");
|
||||
}
|
||||
if(meleeStats[2][2] > 0){
|
||||
meleeSummary = meleeSummary.concat("Thunder Damage: ",meleeStats[2][2]," -> ",meleeStats[2][3],"<br>");
|
||||
}
|
||||
if(meleeStats[3][2] > 0){
|
||||
meleeSummary = meleeSummary.concat("Water Damage: ",meleeStats[3][2]," -> ",meleeStats[3][3],"<br>");
|
||||
}
|
||||
if(meleeStats[4][2] > 0){
|
||||
meleeSummary = meleeSummary.concat("Fire Damage: ",meleeStats[4][2]," -> ",meleeStats[4][3],"<br>");
|
||||
}
|
||||
if(meleeStats[5][2] > 0){
|
||||
meleeSummary = meleeSummary.concat("Air Damage: ",meleeStats[5][2]," -> ",meleeStats[5][3],"<br>");
|
||||
}
|
||||
meleeSummary = meleeSummary.concat("<br>Total Damage: ",meleeStats[7][0]," -> ",meleeStats[7][1],"<br>");
|
||||
meleeSummary = meleeSummary.concat("Crit DPS: ",Math.round(meleeStats[9]),"<br><br>");
|
||||
setHTML("build-cumulative-stats", "".concat(meleeSummary)); //Incomplete function
|
||||
location.hash = encodeBuild();
|
||||
}
|
||||
/* Helper function that gets stats ranges for wearable items.
|
||||
|
@ -308,6 +367,38 @@ function calculateBuild(){
|
|||
@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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue