diff --git a/build.js b/build.js index cb87ae8..6a14ee0 100644 --- a/build.js +++ b/build.js @@ -49,58 +49,67 @@ class Build{ /*Construct a build. */ - constructor(level,helmet,chestplate,leggings,boots,ring1,ring2,bracelet,necklace,weapon,powders){ + constructor(level,equipment, powders){ // NOTE: powders is just an array of arrays of powder IDs. Not powder objects. this.powders = powders - if(helmet.type.valueOf() != "helmet".valueOf()){ - throw new TypeError("No such helmet named ", helmet.name); - }else{ + if(itemMap.get(equipment[0]) && itemMap.get(equipment[0]).type === "helmet") { + const helmet = itemMap.get(equipment[0]); this.powders[0] = this.powders[0].slice(0,helmet.slots); this.helmet = expandItem(helmet, this.powders[0]); - } - if(chestplate.type.valueOf() != "chestplate"){ - throw new TypeError("No such chestplate named ", chestplate.name); }else{ + throw new TypeError("No such helmet named ", equipment[0]); + } + if(itemMap.get(equipment[1]).type === "chestplate") { + const chestplate = itemMap.get(equipment[1]); this.powders[1] = this.powders[1].slice(0,chestplate.slots); this.chestplate = expandItem(chestplate, this.powders[1]); - } - if(leggings.type.valueOf() != "leggings"){ - throw new TypeError("No such leggings named ", leggings.name); }else{ + throw new TypeError("No such chestplate named ", equipment[1]); + } + if(itemMap.get(equipment[2]).type === "leggings") { + const leggings = itemMap.get(equipment[2]); this.powders[2] = this.powders[2].slice(0,leggings.slots); this.leggings = expandItem(leggings, this.powders[2]); - } - if(boots.type.valueOf() != "boots"){ - throw new TypeError("No such boots named ", boots.name); }else{ + throw new TypeError("No such leggings named ", equipment[2]); + } + if(itemMap.get(equipment[3]).type === "boots") { + const boots = itemMap.get(equipment[3]); this.powders[3] = this.powders[3].slice(0,boots.slots); this.boots = expandItem(boots, this.powders[3]); - } - if(ring1.type.valueOf() != "ring"){ - throw new TypeError("No such ring named ", ring1.name); }else{ - this.ring1 = expandItem(ring1, []); + throw new TypeError("No such boots named ", equipment[3]); } - if(ring2.type.valueOf() != "ring"){ - throw new TypeError("No such ring named ", ring2.name); + if(itemMap.get(equipment[4]).type === "ring") { + const ring = itemMap.get(equipment[4]); + this.ring1 = expandItem(ring, []) }else{ - this.ring2 = expandItem(ring2, []); + throw new TypeError("No such ring named ", equipment[4]); } - if(bracelet.type.valueOf() != "bracelet"){ - throw new TypeError("No such bracelet named ", bracelet.name); + if(itemMap.get(equipment[5]).type === "ring") { + const ring = itemMap.get(equipment[5]); + this.ring2 = expandItem(ring, []) }else{ - this.bracelet = expandItem(bracelet, []); + throw new TypeError("No such ring named ", equipment[5]); } - if(necklace.type.valueOf() != "necklace"){ - throw new TypeError("No such necklace named ", necklace.name); + if(itemMap.get(equipment[6]).type === "bracelet") { + const bracelet = itemMap.get(equipment[6]); + this.bracelet = expandItem(bracelet, []) }else{ - this.necklace = expandItem(necklace, []); + throw new TypeError("No such bracelet named ", equipment[6]); } - if(weapon.type.valueOf() == "wand" || weapon.type.valueOf() == "bow" || weapon.type.valueOf() == "dagger" || weapon.type.valueOf() == "spear" || weapon.type.valueOf() == "relik"){ + if(itemMap.get(equipment[7]).type === "necklace") { + const necklace = itemMap.get(equipment[7]); + this.necklace = expandItem(necklace, []) + }else{ + throw new TypeError("No such necklace named ", equipment[7]); + } + if(itemMap.get(equipment[8]).category === "weapon") { + const weapon = itemMap.get(equipment[8]); this.powders[4] = this.powders[4].slice(0,weapon.slots); this.weapon = expandItem(weapon, this.powders[4]); }else{ - throw new TypeError("No such weapon named ", weapon.name); + throw new TypeError("No such weapon named ", equipment[8]); } if(level < 1){ //Should these be constants? this.level = 1; @@ -162,7 +171,10 @@ class Build{ } // 0 for melee damage. - let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], stats.get("mdRaw"), stats.get("mdPct"), 0, this.weapon, this.damageMultiplier, this.total_skillpoints); + let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], stats.get("mdRaw"), stats.get("mdPct"), 0, this.weapon, this.total_skillpoints); + + //TODO: Account for strength (this.damageMultiplier). + let totalDamNorm = results[0]; let totalDamCrit = results[1]; let damages_results = results[2]; diff --git a/damage_calc.js b/damage_calc.js index 18f6958..93ba751 100644 --- a/damage_calc.js +++ b/damage_calc.js @@ -1,6 +1,6 @@ // Calculate spell damage given a spell elemental conversion table, and a spell multiplier. // If spell mult is 0, its melee damage and we don't multiply by attack speed. -function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, spellMultiplier, weapon, damageMultiplier, total_skillpoints) { +function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, spellMultiplier, weapon, total_skillpoints) { // Array of neutral + ewtfa damages. Each entry is a pair (min, max). let damages = []; for (const damage_string of stats.get("damageRaw")) { @@ -42,7 +42,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, damages[0][1] *= neutralRemaining / 100; console.log(damages); - let damageMult = damageMultiplier; + let damageMult = 1; // If we are doing melee calculations: if (spellMultiplier == 0) { spellMultiplier = 1; @@ -77,9 +77,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, totalDamCrit[0] += damages_results[i][2]; totalDamCrit[1] += damages_results[i][3]; } - for (let i in damages_results[0]) { - // Never account for attack speed. - damages_results[0][i] += rawModifier * damageMultiplier; - } + damages_results[0][0] += rawModifier; + damages_results[0][1] += rawModifier; return [totalDamNorm, totalDamCrit, damages_results]; } diff --git a/display.js b/display.js index 2008c7d..0e3ac75 100644 --- a/display.js +++ b/display.js @@ -60,7 +60,7 @@ function displayExpandedItem(item, parent_id){ stats.set("atkSpd", item.get("atkSpd")); stats.set("damageBonus", [0, 0, 0, 0, 0]); stats.set("damageRaw", [item.get("nDam"), item.get("eDam"), item.get("tDam"), item.get("wDam"), item.get("fDam"), item.get("aDam")]); - let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, 1, [0, 0, 0, 0, 0]); + let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, [0, 0, 0, 0, 0]); let damages = results[2]; let damage_keys = [ "nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_" ]; for (const i in damage_keys) { @@ -76,8 +76,8 @@ function displayExpandedItem(item, parent_id){ "#ldiv", "!elemental", "hp", - "nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_", - "eDef", "tDef", "wDef", "fDef", "aDef", + "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_", + "fDef", "wDef", "aDef", "tDef", "eDef", "!elemental", "#ldiv", "classReq", @@ -98,8 +98,8 @@ function displayExpandedItem(item, parent_id){ "spd", "atkTier", "!elemental", - "eDamPct", "tDamPct", "wDamPct", "fDamPct", "aDamPct", - "eDefPct", "tDefPct", "wDefPct", "fDefPct", "aDefPct", + "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", + "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "!elemental", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", @@ -115,7 +115,7 @@ function displayExpandedItem(item, parent_id){ "quest", "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: ", "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":"Set: ", "quest":"Quest Req: ", "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: ", "exploding":"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":"%", "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":""}; function apply_elemental_format(p_elem, id, suffix) { @@ -176,7 +176,14 @@ function displayExpandedItem(item, parent_id){ apply_elemental_format(p_elem, id, item.get(id)); } else { - p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]); + 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); } @@ -212,6 +219,7 @@ function displayExpandedItem(item, parent_id){ let desc_elem = document.createElement('td'); desc_elem.classList.add('center'); + //TODO elemental format jank if (elemental_format) { apply_elemental_format(desc_elem, id); } diff --git a/index.html b/index.html index ab62eda..e23f782 100644 --- a/index.html +++ b/index.html @@ -241,6 +241,24 @@
+
+
+
Spell 1
+
+
+
+
Spell 2
+
+
+
+
Spell 3
+
+
+
+
Spell 4
+
+
+
diff --git a/styles.css b/styles.css index e17c1b4..0999cd2 100644 --- a/styles.css +++ b/styles.css @@ -36,7 +36,7 @@ text-align: left; } -.build{ +.build, .spells { padding: 1%; display: grid; grid-template-columns: repeat(4, 1fr); @@ -44,6 +44,13 @@ grid-auto-rows: minmax(60px, auto); width: 98%; } + +.spell-info { + border: 2px solid black; + border-radius: 3px; + width: 100%; +} + .build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order { color: #aaa; background: #110110; diff --git a/test.js b/test.js index 0d741bc..946f73b 100644 --- a/test.js +++ b/test.js @@ -20,9 +20,35 @@ let player_build; let armorTypes = [ "helmet", "chestplate", "leggings", "boots" ]; let accessoryTypes = [ "ring", "bracelet", "necklace" ]; let weaponTypes = [ "wand", "spear", "bow", "dagger", "relik" ]; +// THIS IS SUPER DANGEROUS, WE SHOULD NOT BE KEEPING THIS IN SO MANY PLACES 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 skpReqs = ["strReq", "dexReq", "intReq", "defReq", "agiReq"]; +let equipment_fields = [ + "helmet", + "chestplate", + "leggings", + "boots", + "ring1", + "ring2", + "bracelet", + "necklace", + "weapon" +]; +let equipment_names = [ + "Helmet", + "Chestplate", + "Leggings", + "Boots", + "Ring 1", + "Ring 2", + "Bracelet", + "Necklace", + "Weapon" +]; +let equipmentInputs = equipment_fields.map(x => x + "-choice"); +let buildFields = equipment_fields.map(x => "build-"+x); + let powderIDs = new Map(); let powderNames = new Map(); let _powderID = 0; @@ -131,10 +157,6 @@ function init() { itemMap.set(item.displayName, item); idMap.set(item.id, item.displayName); } - /*for (const item of noneItems){ - itemLists.get(item.type).push(item.name); - itemMap.set(item.name, item); - }*/ for (const armorType of armorTypes) { populateItemList(armorType); @@ -192,29 +214,15 @@ function init() { */ function populateFromURL() { if (url_tag) { - let helmet; - let chestplate; - let leggings; - let boots; - let ring1; - let ring2; - let bracelet; - let necklace; - let weapon; + let equipment = [null, null, null, null, null, null, null, null, null]; let powdering = ["", "", "", "", ""]; let info = url_tag.split("_"); let version = info[0]; if (version === "0" || version === "1") { let equipments = info[1]; - helmet = idMap.get(Base64.toInt(equipments.slice(0,3))); - chestplate = idMap.get(Base64.toInt(equipments.slice(3,6))); - leggings = idMap.get(Base64.toInt(equipments.slice(6,9))); - boots = idMap.get(Base64.toInt(equipments.slice(9,12))); - ring1 = idMap.get(Base64.toInt(equipments.slice(12,15))); - ring2 = idMap.get(Base64.toInt(equipments.slice(15,18))); - bracelet = idMap.get(Base64.toInt(equipments.slice(18,21))); - necklace = idMap.get(Base64.toInt(equipments.slice(21,24))); - weapon = idMap.get(Base64.toInt(equipments.slice(24,27))); + for (let i = 0; i < 9; ++i ) { + equipment[i] = idMap.get(Base64.toInt(equipments.slice(i*3,i*3+3))); + } } if (version === "1") { let powder_info = info[1].slice(27); @@ -239,20 +247,12 @@ function populateFromURL() { } } - setValue("helmet-choice", helmet); - setValue("helmet-powder", powdering[0]); - setValue("chestplate-choice", chestplate); - setValue("chestplate-powder", powdering[1]); - setValue("leggings-choice", leggings); - setValue("leggings-powder", powdering[2]); - setValue("boots-choice", boots); - setValue("boots-powder", powdering[3]); - setValue("ring1-choice", ring1); - setValue("ring2-choice", ring2); - setValue("bracelet-choice", bracelet); - setValue("necklace-choice", necklace); - setValue("weapon-choice", weapon); - setValue("weapon-powder", powdering[4]); + for (let i in powderInputs) { + setValue(powderInputs[i], powdering[i]); + } + for (let i in equipment) { + setValue(equipmentInputs[i], equipment[i]); + } setValue("str-skp", "0"); setValue("dex-skp", "0"); setValue("int-skp", "0"); @@ -308,41 +308,11 @@ function calculateBuild(){ /* TODO: implement level changing Make this entire function prettier */ - let helmet = getValue("helmet-choice"); - let chestplate = getValue("chestplate-choice"); - let leggings = getValue("leggings-choice"); - let boots = getValue("boots-choice"); - let ring1 = getValue("ring1-choice"); - let ring2 = getValue("ring2-choice"); - let bracelet = getValue("bracelet-choice"); - let necklace = getValue("necklace-choice"); - let weapon = getValue("weapon-choice"); - if(helmet===""){ - helmet = "No Helmet"; - } - if(chestplate===""){ - chestplate = "No Chestplate"; - } - if(leggings===""){ - leggings = "No Leggings"; - } - if(boots===""){ - boots = "No Boots"; - } - if(ring1===""){ - ring1 = "No Ring 1"; - } - if(ring2===""){ - ring2 = "No Ring 2"; - } - if(bracelet===""){ - bracelet = "No Bracelet"; - } - if(necklace===""){ - necklace = "No Necklace"; - } - if(weapon===""){ - weapon = "No Weapon"; + let equipment = [ null, null, null, null, null, null, null, null, null ]; + for (let i in equipment) { + let equip = getValue(equipmentInputs[i]); + if (equip === "") equip = "No " + equipment_names[i]; + equipment[i] = equip; } let powderings = []; for (const i in powderInputs) { @@ -357,19 +327,8 @@ function calculateBuild(){ } powderings.push(powdering); } - player_build = new Build( - 106, - itemMap.get(helmet), - itemMap.get(chestplate), - itemMap.get(leggings), - itemMap.get(boots), - itemMap.get(ring1), - itemMap.get(ring2), - itemMap.get(bracelet), - itemMap.get(necklace), - itemMap.get(weapon), - powderings - ); + console.log(equipment); + player_build = new Build(106, equipment, powderings); console.log(player_build.toString()); let equip_order_text = "Equip order:
"; @@ -399,16 +358,9 @@ function calculateBuild(){ setText("summary-box", "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints."); } - displayExpandedItem(player_build.helmet, "build-helmet"); - displayExpandedItem(player_build.chestplate, "build-chestplate"); - displayExpandedItem(player_build.leggings, "build-leggings"); - displayExpandedItem(player_build.boots, "build-boots"); - displayExpandedItem(player_build.ring1, "build-ring1"); - displayExpandedItem(player_build.ring2, "build-ring2"); - displayExpandedItem(player_build.bracelet, "build-bracelet"); - displayExpandedItem(player_build.necklace, "build-necklace"); - displayExpandedItem(player_build.weapon, "build-weapon"); - + for (let i in player_build.items) { + displayExpandedItem(player_build.items[i], buildFields[i]); + } calculateBuildStats(); } @@ -454,25 +406,13 @@ function calculateBuildStats() { location.hash = encodeBuild(); } - - - - function resetFields(){ - setValue("helmet-choice", ""); - setValue("helmet-powder", ""); - setValue("chestplate-choice", ""); - setValue("chestplate-powder", ""); - setValue("leggings-choice", ""); - setValue("leggings-powder", ""); - setValue("boots-choice", ""); - setValue("boots-powder", ""); - setValue("ring1-choice", ""); - setValue("ring2-choice", ""); - setValue("bracelet-choice", ""); - setValue("necklace-choice", ""); - setValue("weapon-choice", ""); - setValue("weapon-powder", ""); + for (let i in powderInputs) { + setValue(powderInputs[i], ""); + } + for (let i in equipment) { + setValue(equipmentInputs[i], ""); + } setValue("str-skp", "0"); setValue("dex-skp", "0"); setValue("int-skp", "0");