Full minimal builder
This commit is contained in:
parent
8772d33fe1
commit
ced13fd9b8
6 changed files with 176 additions and 70 deletions
8
build.js
8
build.js
|
@ -151,11 +151,7 @@ class Build{
|
||||||
/* Get total health for build.
|
/* Get total health for build.
|
||||||
*/
|
*/
|
||||||
getHealth(){
|
getHealth(){
|
||||||
let health = levelToHPBase(this.level);
|
let health = this.statMap.get("hp") + this.statMap.get("hpBonus");
|
||||||
for (const item of this.items) {
|
|
||||||
if (item.get("hp")) health += item.get("hp");
|
|
||||||
if (item.get("hpBonus")) health += item.get("hpBonus");
|
|
||||||
}
|
|
||||||
if(health<5){
|
if(health<5){
|
||||||
return 5;
|
return 5;
|
||||||
}else{
|
}else{
|
||||||
|
@ -222,7 +218,7 @@ class Build{
|
||||||
statMap.set(id,(statMap.get(id) || 0)+value);
|
statMap.set(id,(statMap.get(id) || 0)+value);
|
||||||
}
|
}
|
||||||
for (const staticID of staticIDs) {
|
for (const staticID of staticIDs) {
|
||||||
if (item[staticID]) { statMap.set(statMap.get(staticID) + item[staticID]); }
|
if (item.get(staticID)) { statMap.set(staticID, statMap.get(staticID) + item.get(staticID)); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,4 +168,4 @@ const spell_table = {
|
||||||
{ subtitle: "", type: "damage", multiplier: 50, conversion: [70, 30, 0, 0, 0, 0] },
|
{ subtitle: "", type: "damage", multiplier: 50, conversion: [70, 30, 0, 0, 0, 0] },
|
||||||
] },
|
] },
|
||||||
]
|
]
|
||||||
}
|
};
|
||||||
|
|
220
display.js
220
display.js
|
@ -1,6 +1,8 @@
|
||||||
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", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_"];
|
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", "skillpoints", "reqs", "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_"];
|
||||||
let rolledIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "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 rolledIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "expd", "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 reversedIDs = [ "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4" ];
|
||||||
|
|
||||||
function expandItem(item, powders){
|
function expandItem(item, powders){
|
||||||
let minRolls = new Map();
|
let minRolls = new Map();
|
||||||
let maxRolls = new Map();
|
let maxRolls = new Map();
|
||||||
|
@ -20,8 +22,14 @@ function expandItem(item, powders){
|
||||||
minRolls.set(id,idRound(item[id]*0.3));
|
minRolls.set(id,idRound(item[id]*0.3));
|
||||||
maxRolls.set(id,idRound(item[id]*1.3));
|
maxRolls.set(id,idRound(item[id]*1.3));
|
||||||
}else if(item[id] < 0){ //negative rolled IDs
|
}else if(item[id] < 0){ //negative rolled IDs
|
||||||
minRolls.set(id,idRound(item[id]*1.3));
|
if (reversedIDs.includes(id)) {
|
||||||
maxRolls.set(id,idRound(item[id]*0.7));
|
maxRolls.set(id,idRound(item[id]*1.3));
|
||||||
|
minRolls.set(id,idRound(item[id]*0.7));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
minRolls.set(id,idRound(item[id]*1.3));
|
||||||
|
maxRolls.set(id,idRound(item[id]*0.7));
|
||||||
|
}
|
||||||
}else{//Id = 0
|
}else{//Id = 0
|
||||||
minRolls.set(id,0);
|
minRolls.set(id,0);
|
||||||
maxRolls.set(id,0);
|
maxRolls.set(id,0);
|
||||||
|
@ -51,6 +59,114 @@ function idRound(id){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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":"Main Attack Neutral Damage: ", "mdPct":"Main Attack 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":""};
|
||||||
|
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":""};
|
||||||
|
|
||||||
|
function apply_elemental_format(p_elem, id, suffix) {
|
||||||
|
suffix = (typeof suffix !== 'undefined') ? suffix : "";
|
||||||
|
// THIS IS SO JANK BUT IM TOO LAZY TO FIX IT TODO
|
||||||
|
let parts = idPrefixes[id].split(/ (.*)/);
|
||||||
|
let element_prefix = parts[0];
|
||||||
|
let desc = parts[1];
|
||||||
|
let i_elem = document.createElement('b');
|
||||||
|
i_elem.classList.add(element_prefix);
|
||||||
|
i_elem.textContent = element_prefix;
|
||||||
|
p_elem.appendChild(i_elem);
|
||||||
|
|
||||||
|
let i_elem2 = document.createElement('b');
|
||||||
|
i_elem2.textContent = " " + desc + suffix;
|
||||||
|
p_elem.appendChild(i_elem2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayBuildStats(build, parent_id){
|
||||||
|
// Commands to "script" the creation of nice formatting.
|
||||||
|
// #commands create a new element.
|
||||||
|
// !elemental is some janky hack for elemental damage.
|
||||||
|
// normals just display a thing.
|
||||||
|
|
||||||
|
let display_commands = [
|
||||||
|
"#ldiv",
|
||||||
|
"!elemental",
|
||||||
|
"hp",
|
||||||
|
"fDef", "wDef", "aDef", "tDef", "eDef",
|
||||||
|
"!elemental",
|
||||||
|
"#table",
|
||||||
|
"str", "dex", "int", "def", "agi",
|
||||||
|
"hpBonus",
|
||||||
|
"hprRaw", "hprPct",
|
||||||
|
"sdRaw", "sdPct",
|
||||||
|
"mdRaw", "mdPct",
|
||||||
|
"mr", "ms",
|
||||||
|
"ref", "thorns",
|
||||||
|
"ls",
|
||||||
|
"poison",
|
||||||
|
"expd",
|
||||||
|
"spd",
|
||||||
|
"atkTier",
|
||||||
|
"!elemental",
|
||||||
|
"fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct",
|
||||||
|
"fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct",
|
||||||
|
"!elemental",
|
||||||
|
"spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4",
|
||||||
|
"rainbowRaw",
|
||||||
|
"sprint", "sprintReg",
|
||||||
|
"jh",
|
||||||
|
"xpb", "lb", "lq",
|
||||||
|
"spRegen",
|
||||||
|
"eSteal",
|
||||||
|
"gXp", "gSpd",
|
||||||
|
];
|
||||||
|
|
||||||
|
// Clear the parent div.
|
||||||
|
setHTML(parent_id, "");
|
||||||
|
let parent_div = document.getElementById(parent_id);
|
||||||
|
|
||||||
|
let stats = build.statMap;
|
||||||
|
|
||||||
|
let active_elem;
|
||||||
|
let elemental_format = false;
|
||||||
|
|
||||||
|
//TODO this is put here for readability, consolidate with definition in build.js
|
||||||
|
let staticIDs = ["hp", "eDef", "tDef", "wDef", "fDef", "aDef"];
|
||||||
|
|
||||||
|
for (const command of display_commands) {
|
||||||
|
if (command.charAt(0) === "#") {
|
||||||
|
if (command === "#cdiv") {
|
||||||
|
active_elem = document.createElement('div');
|
||||||
|
active_elem.classList.add('itemcenter');
|
||||||
|
}
|
||||||
|
else if (command === "#ldiv") {
|
||||||
|
active_elem = document.createElement('div');
|
||||||
|
active_elem.classList.add('itemleft');
|
||||||
|
}
|
||||||
|
else if (command === "#table") {
|
||||||
|
active_elem = document.createElement('table');
|
||||||
|
active_elem.classList.add('itemtable');
|
||||||
|
}
|
||||||
|
parent_div.appendChild(active_elem);
|
||||||
|
}
|
||||||
|
else if (command.charAt(0) === "!") {
|
||||||
|
// TODO: This is sooo incredibly janky.....
|
||||||
|
if (command === "!elemental") {
|
||||||
|
elemental_format = !elemental_format;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let id = command;
|
||||||
|
if (stats.get(id)) {
|
||||||
|
let style = null;
|
||||||
|
if (!staticIDs.includes(id)) {
|
||||||
|
style = "positive";
|
||||||
|
if (stats.get(id) < 0) {
|
||||||
|
style = "negative";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
displayFixedID(active_elem, id, stats.get(id), elemental_format, style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function displayExpandedItem(item, parent_id){
|
function displayExpandedItem(item, parent_id){
|
||||||
// Commands to "script" the creation of nice formatting.
|
// Commands to "script" the creation of nice formatting.
|
||||||
// #commands create a new element.
|
// #commands create a new element.
|
||||||
|
@ -116,25 +232,6 @@ function displayExpandedItem(item, parent_id){
|
||||||
"quest",
|
"quest",
|
||||||
"restrict"];
|
"restrict"];
|
||||||
|
|
||||||
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":"Main Attack Neutral Damage: ", "mdPct":"Main Attack 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":""};
|
|
||||||
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":""};
|
|
||||||
|
|
||||||
function apply_elemental_format(p_elem, id, suffix) {
|
|
||||||
suffix = (typeof suffix !== 'undefined') ? suffix : "";
|
|
||||||
// THIS IS SO JANK BUT IM TOO LAZY TO FIX IT TODO
|
|
||||||
let parts = idPrefixes[id].split(/ (.*)/);
|
|
||||||
let element_prefix = parts[0];
|
|
||||||
let desc = parts[1];
|
|
||||||
let i_elem = document.createElement('b');
|
|
||||||
i_elem.classList.add(element_prefix);
|
|
||||||
i_elem.textContent = element_prefix;
|
|
||||||
p_elem.appendChild(i_elem);
|
|
||||||
|
|
||||||
let i_elem2 = document.createElement('b');
|
|
||||||
i_elem2.textContent = " " + desc + suffix;
|
|
||||||
p_elem.appendChild(i_elem2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the parent div.
|
// Clear the parent div.
|
||||||
setHTML(parent_id, "");
|
setHTML(parent_id, "");
|
||||||
let parent_div = document.getElementById(parent_id);
|
let parent_div = document.getElementById(parent_id);
|
||||||
|
@ -167,51 +264,23 @@ function displayExpandedItem(item, parent_id){
|
||||||
else {
|
else {
|
||||||
let id = command;
|
let id = command;
|
||||||
if(nonRolledIDs.includes(id) && item.get(id)){//nonRolledID & non-0/non-null/non-und ID
|
if(nonRolledIDs.includes(id) && item.get(id)){//nonRolledID & non-0/non-null/non-und ID
|
||||||
let p_elem = document.createElement('p');
|
displayFixedID(active_elem, id, item.get(id), elemental_format);
|
||||||
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 {
|
|
||||||
if (id === "slots") {
|
|
||||||
// HACK TO MAKE POWDERS DISPLAY NICE!! TODO
|
|
||||||
p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]) +
|
|
||||||
" [ " + item.get("powders").map(x => powderNames.get(x)) + " ]";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
active_elem.appendChild(p_elem);
|
|
||||||
}
|
}
|
||||||
else if(rolledIDs.includes(id)&& item.get("minRolls").get(id)){ // && item.get("maxRolls").get(id) ){//rolled ID & non-0/non-null/non-und ID
|
else if(rolledIDs.includes(id)&& item.get("minRolls").get(id)){ // && item.get("maxRolls").get(id) ){//rolled ID & non-0/non-null/non-und ID
|
||||||
let row = document.createElement('tr');
|
|
||||||
let style = "positive";
|
let style = "positive";
|
||||||
if (item.get("minRolls").get(id) < 0) {
|
if (item.get("minRolls").get(id) < 0) {
|
||||||
style = "negative";
|
style = "negative";
|
||||||
}
|
}
|
||||||
if (fix_id) {
|
if (fix_id) {
|
||||||
let desc_elem = document.createElement('td');
|
let p_elem = displayFixedID(active_elem, id, item.get("minRolls").get(id), elemental_format, style);
|
||||||
desc_elem.classList.add('left');
|
if (id === "slots") {
|
||||||
if (elemental_format) {
|
// HACK TO MAKE POWDERS DISPLAY NICE!! TODO
|
||||||
apply_elemental_format(desc_elem, id);
|
p_elem.textContent = idPrefixes[id].concat(value, idSuffixes[id]) +
|
||||||
|
" [ " + item.get("powders").map(x => powderNames.get(x)) + " ]";
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
desc_elem.textContent = idPrefixes[id];
|
|
||||||
}
|
|
||||||
row.appendChild(desc_elem);
|
|
||||||
|
|
||||||
let value_elem = document.createElement('td');
|
|
||||||
value_elem.classList.add('right');
|
|
||||||
value_elem.classList.add(style);
|
|
||||||
value_elem.textContent = item.get("minRolls").get(id) + idSuffixes[id];
|
|
||||||
row.appendChild(value_elem);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
let row = document.createElement('tr');
|
||||||
let min_elem = document.createElement('td');
|
let min_elem = document.createElement('td');
|
||||||
min_elem.classList.add('left');
|
min_elem.classList.add('left');
|
||||||
min_elem.classList.add(style);
|
min_elem.classList.add(style);
|
||||||
|
@ -234,8 +303,8 @@ function displayExpandedItem(item, parent_id){
|
||||||
max_elem.classList.add(style);
|
max_elem.classList.add(style);
|
||||||
max_elem.textContent = item.get("maxRolls").get(id) + idSuffixes[id];
|
max_elem.textContent = item.get("maxRolls").get(id) + idSuffixes[id];
|
||||||
row.appendChild(max_elem);
|
row.appendChild(max_elem);
|
||||||
|
active_elem.appendChild(row);
|
||||||
}
|
}
|
||||||
active_elem.appendChild(row);
|
|
||||||
}//Just don't do anything if else
|
}//Just don't do anything if else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,8 +315,43 @@ function displayExpandedItem(item, parent_id){
|
||||||
parent_div.append(item_desc_elem);
|
parent_div.append(item_desc_elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayFixedID(id, value) {
|
function displayFixedID(active, id, value, elemental_format, style) {
|
||||||
|
if (style) {
|
||||||
|
let row = document.createElement('tr');
|
||||||
|
let desc_elem = document.createElement('td');
|
||||||
|
desc_elem.classList.add('left');
|
||||||
|
if (elemental_format) {
|
||||||
|
apply_elemental_format(desc_elem, id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
desc_elem.textContent = idPrefixes[id];
|
||||||
|
}
|
||||||
|
row.appendChild(desc_elem);
|
||||||
|
|
||||||
|
let value_elem = document.createElement('td');
|
||||||
|
value_elem.classList.add('right');
|
||||||
|
value_elem.classList.add(style);
|
||||||
|
value_elem.textContent = value + idSuffixes[id];
|
||||||
|
row.appendChild(value_elem);
|
||||||
|
active.appendChild(row);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// HACK TO AVOID DISPLAYING ZERO DAMAGE! TODO
|
||||||
|
if (value === "0-0") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let p_elem = document.createElement('p');
|
||||||
|
p_elem.classList.add('itemp');
|
||||||
|
if (elemental_format) {
|
||||||
|
apply_elemental_format(p_elem, id, value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p_elem.textContent = idPrefixes[id].concat(value, idSuffixes[id]);
|
||||||
|
}
|
||||||
|
active.appendChild(p_elem);
|
||||||
|
return p_elem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function displaySpellDamage(parent_elem, build, spell, spellIdx) {
|
function displaySpellDamage(parent_elem, build, spell, spellIdx) {
|
||||||
|
|
|
@ -244,8 +244,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class = "center" id = "build-melee-stats" style = "grid-column:3;grid-row:3">
|
<div class = "center" id = "build-melee-stats" style = "grid-column:3;grid-row:3">
|
||||||
</div>
|
</div>
|
||||||
<div class = "center" id = "build-defense-stats" style = "grid-column:4;grid-row:3">
|
<div class = "center build-overall" id = "build-overall" style = "grid-column:4;grid-row:3">
|
||||||
|
<p class="itemcenter">Overall Build Stats:<p>
|
||||||
|
<div class = "center" id = "build-overall-stats"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--div class = "center" id = "build-defense-stats" style = "grid-column:4;grid-row:3">
|
||||||
|
</div-->
|
||||||
</div>
|
</div>
|
||||||
<div class = "spells">
|
<div class = "spells">
|
||||||
<div class = "center spell-info" id = "spell0" style = "grid-column:1;grid-row:1">
|
<div class = "center spell-info" id = "spell0" style = "grid-column:1;grid-row:1">
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order {
|
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order, .build-overall {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
background: #110110;
|
background: #110110;
|
||||||
border: 2px solid black;
|
border: 2px solid black;
|
||||||
|
|
8
test.js
8
test.js
|
@ -11,7 +11,7 @@ console.log(url_tag);
|
||||||
* END testing section
|
* END testing section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const BUILD_VERSION = "2.6";
|
const BUILD_VERSION = "2.7";
|
||||||
|
|
||||||
document.getElementById("header").textContent = "Wynn build calculator "+BUILD_VERSION+" (db version "+DB_VERSION+")";
|
document.getElementById("header").textContent = "Wynn build calculator "+BUILD_VERSION+" (db version "+DB_VERSION+")";
|
||||||
|
|
||||||
|
@ -422,6 +422,8 @@ function calculateBuildStats() {
|
||||||
displayExpandedItem(player_build.items[i], buildFields[i]);
|
displayExpandedItem(player_build.items[i], buildFields[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayBuildStats(player_build, "build-overall-stats");
|
||||||
|
|
||||||
let meleeStats = player_build.getMeleeStats();
|
let meleeStats = player_build.getMeleeStats();
|
||||||
//nDamAdj,eDamAdj,tDamAdj,wDamAdj,fDamAdj,aDamAdj,totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS
|
//nDamAdj,eDamAdj,tDamAdj,wDamAdj,fDamAdj,aDamAdj,totalDamNorm,totalDamCrit,normDPS,critDPS,avgDPS
|
||||||
for (let i = 0; i < 6; ++i) {
|
for (let i = 0; i < 6; ++i) {
|
||||||
|
@ -457,9 +459,9 @@ function calculateBuildStats() {
|
||||||
meleeSummary = meleeSummary.concat("<br>Total Damage: ",meleeStats[7][0]," -> ",meleeStats[7][1],"<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>");
|
meleeSummary = meleeSummary.concat("Crit DPS: ",Math.round(meleeStats[9]),"<br><br>");
|
||||||
setHTML("build-melee-stats", "".concat(meleeSummary)); //basically complete function
|
setHTML("build-melee-stats", "".concat(meleeSummary)); //basically complete function
|
||||||
let defenseStats = "";
|
//let defenseStats = "";
|
||||||
|
|
||||||
setHTML("build-defense-stats", "".concat(defenseStats));
|
//setHTML("build-defense-stats", "".concat(defenseStats));
|
||||||
|
|
||||||
let spells = spell_table[player_build.weapon.get("type")];
|
let spells = spell_table[player_build.weapon.get("type")];
|
||||||
for (let i = 0; i < 4; ++i) {
|
for (let i = 0; i < 4; ++i) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue