diff --git a/display.js b/display.js index eddfbee..9b6f3dc 100644 --- a/display.js +++ b/display.js @@ -229,6 +229,9 @@ function displayBuildStats(build, parent_id){ } } let id_val = stats.get(id); + if(reversedIDs.filter(e => e !== "atkTier").includes(id)){ + style === "positive" ? style = "negative" : style = "positive"; + } displayFixedID(active_elem, id, id_val, elemental_format, style); if (id === "poison" && id_val > 0) { let style = "positive"; @@ -454,7 +457,6 @@ function displayExpandedItem(item, parent_id){ //Show powder specials ;-; let powder_special = document.createElement("p"); powder_special.classList.add("left"); - powder_special.classList.add("itemp"); let powders = item.get("powders"); let element = ""; let power = 0; @@ -488,17 +490,6 @@ function displayExpandedItem(item, parent_id){ if (item.get("category") === "weapon") {//weapon effects = powderSpecial["weaponSpecialEffects"]; specialTitle.textContent = powderSpecial["weaponSpecialName"]; - /*for (const [key,value] of effects) { - let effect = document.createElement("p"); - effect.classList.add("itemp"); - effect.textContent += key + ": " + value[power] + specialSuffixes.get(key); - if(key === "Damage"){ - effect.textContent += elementIcons[skp_elements.indexOf(element)]; - } - specialEffects.appendChild(effect); - } - specialTitle.append(specialEffects); - powder_special.appendChild(specialTitle);*/ }else if (item.get("category") === "armor") {//armor effects = powderSpecial["armorSpecialEffects"]; specialTitle.textContent += powderSpecial["armorSpecialName"] + ": "; @@ -527,9 +518,8 @@ function displayExpandedItem(item, parent_id){ } //Show item tier - if (item.get("tier") & item.get("tier") !== " ") { + if (item.get("tier") && item.get("tier") !== " ") { let item_desc_elem = document.createElement('p'); - item_desc_elem.classList.add('itemp'); item_desc_elem.classList.add('left'); item_desc_elem.classList.add(item.get("tier")); item_desc_elem.textContent = item.get("tier")+" "+item.get("type"); @@ -539,9 +529,9 @@ function displayExpandedItem(item, parent_id){ function displayFixedID(active, id, value, elemental_format, style) { if (style) { - if(reversedIDs.filter(e => e !== "atkTier").includes(id)){ + /*if(reversedIDs.filter(e => e !== "atkTier").includes(id)){ style === "positive" ? style = "negative" : style = "positive"; - } + }*/ let row = document.createElement('tr'); let desc_elem = document.createElement('td'); desc_elem.classList.add('left'); diff --git a/index.html b/index.html index 7334e2c..c9fefef 100644 --- a/index.html +++ b/index.html @@ -208,7 +208,7 @@
- +
@@ -222,7 +222,7 @@
- +
@@ -236,7 +236,7 @@
- +
@@ -250,7 +250,7 @@
- +
@@ -264,7 +264,7 @@
- +
diff --git a/media/items/boots--diamond.png b/media/items/boots--diamond.png new file mode 100644 index 0000000..793207e Binary files /dev/null and b/media/items/boots--diamond.png differ diff --git a/styles.css b/styles.css index 641dbbb..013c115 100644 --- a/styles.css +++ b/styles.css @@ -233,6 +233,6 @@ input { .Set{ color:#5f5; } -.restrict { +.restrict, .warning { color: #ff8180; } diff --git a/test.js b/test.js index 6e2efe7..bdd51ce 100644 --- a/test.js +++ b/test.js @@ -423,13 +423,7 @@ function calculateBuild(save_skp, skp){ const assigned = player_build.base_skillpoints; const skillpoints = player_build.total_skillpoints; - for (let i in skp_order){ //big bren - if(assigned[i] <= 100){ - setText(skp_order[i] + "-skp-base", "Original Value: " + skillpoints[i]); - }else{ - setHTML(skp_order[i] + "-skp-base", "Original Value: " + skillpoints[i] + "
WARNING: cannot assign " + assigned[i] + " skillpoints naturally."); - } - } + if (save_skp) { // TODO: reduce duplicated code, @updateStats let skillpoints = player_build.total_skillpoints; @@ -449,6 +443,7 @@ function calculateBuild(save_skp, skp){ } function updateStats() { + //WILL BREAK WEBSITE IF NO BUILD HAS BEEN INITIALIZED! @HPP let skillpoints = player_build.total_skillpoints; let delta_total = 0; for (let i in skp_order) { @@ -470,16 +465,23 @@ function calculateBuildStats() { for (let i in skp_order){ //big bren setText(skp_order[i] + "-skp-assign", "Manually Assigned: " + assigned[i]); setValue(skp_order[i] + "-skp", skillpoints[i]); + let linebreak = document.createElement("br"); + linebreak.classList.add("itemp"); + document.getElementById(skp_order[i] + "-skp-label").append(document.createElement("br")); setText(skp_order[i] + "-skp-pct", (skillPointsToPercentage(skillpoints[i])*100).toFixed(1).concat(skp_effects[i])); + if (assigned[i] > 100) { + let skp_warning = document.createElement("p"); + skp_warning.classList.add("warning"); + skp_warning.textContent += "WARNING: Cannot assign " + assigned[i] + " skillpoints in " + ["Strength","Dexterity","Intelligence","Defense","Agility"][i] + " manually."; + document.getElementById(skp_order[i]+"-skp-pct").appendChild(skp_warning); + } } let summarybox = document.getElementById("summary-box"); summarybox.textContent = ""; let skpRow = document.createElement("tr"); - //let skpSummary = document.createElement("p"); - //skpSummary.textContent = "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints. Total: ( " + player_build.total_skillpoints.join(" | ") + " )"; let skpSummary = document.createElement("td"); - skpSummary.textContent = "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints. Total: ("; + skpSummary.textContent = "Summary: Assigned " + player_build.assigned_skillpoints + " skillpoints. Total: ("; skpSummary.classList.add("itemp"); skpRow.appendChild(skpSummary); for (let i = 0; i < skp_order.length; i++){ @@ -499,32 +501,60 @@ function calculateBuildStats() { skpRow.appendChild(separator); } } - //summarybox.append(skpSummary); - + let skpEnd = document.createElement("td"); skpEnd.textContent = ")"; skpEnd.classList.add("itemp"); skpRow.append(skpEnd); + let remainingRow = document.createElement("tr"); + remainingRow.classList.add("itemp"); + let remainingSkp = document.createElement("td"); + remainingSkp.classList.add("left"); + let remainingSkpTitle = document.createElement("b"); + remainingSkpTitle.textContent = "Remaining skillpoints: "; + let remainingSkpContent = document.createElement("b"); + remainingSkpContent.textContent = "" + (levelToSkillPoints(player_build.level) - player_build.assigned_skillpoints < 0 ? "< 0" : levelToSkillPoints(player_build.level) - player_build.assigned_skillpoints); + remainingSkpContent.classList.add(levelToSkillPoints(player_build.level) - player_build.assigned_skillpoints < 0 ? "negative" : "positive"); + + remainingSkp.appendChild(remainingSkpTitle); + remainingSkp.appendChild(remainingSkpContent); + + remainingRow.appendChild(remainingSkp); + summarybox.append(skpRow); + summarybox.append(remainingRow); if(player_build.assigned_skillpoints > levelToSkillPoints(player_build.level)){ let skpWarning = document.createElement("p"); + //skpWarning.classList.add("itemp"); + skpWarning.classList.add("warning"); skpWarning.classList.add("itemp"); skpWarning.textContent = "WARNING: Too many skillpoints need to be assigned!"; let skpCount = document.createElement("p"); skpCount.classList.add("itemp"); - skpCount.textContent = "For level " + player_build.level + ", there are only " + levelToSkillPoints(player_build.level) + " skill points available."; + skpCount.textContent = "For level " + (player_build.level>101 ? "101+" : player_build.level) + ", there are only " + levelToSkillPoints(player_build.level) + " skill points available."; summarybox.append(skpWarning); summarybox.append(skpCount); } - for(const item of player_build.items){ - if(player_build.level < item.get("lvl")){ - let lvlWarning = document.createElement("p"); - lvlWarning.classList.add("itemp"); - lvlWarning.textContent = "WARNING: The build is level " + player_build.level + " but " + item.get("name") + " requires level " + item.get("lvl") + " to use."; - summarybox.append(lvlWarning); + let lvlWarning; + for (const item of player_build.items) { + if (player_build.level < item.get("lvl")) { + if (!lvlWarning) { + lvlWarning = document.createElement("p"); + lvlWarning.classList.add("itemp"); + lvlWarning.classList.add("warning"); + lvlWarning.textContent = "WARNING: A level 50 player cannot use some piece(s) of this build." + } + let baditem = document.createElement("p"); + baditem.classList.add("nocolor"); + baditem.classList.add("itemp"); + baditem.textContent = item.get("name") + " requires level " + item.get("lvl") + " to use."; + lvlWarning.appendChild(baditem); } } + if(lvlWarning){ + summarybox.append(lvlWarning); + } for (let i in player_build.items) { displayExpandedItem(player_build.items[i], buildFields[i]); @@ -539,11 +569,6 @@ function calculateBuildStats() { let defenseStats = player_build.getDefenseStats(); displayDefenseStats(document.getElementById("build-defense-stats"),defenseStats); - - //let defenseStats = ""; - - //setHTML("build-defense-stats", "".concat(defenseStats)); - displayPoisonDamage(document.getElementById("build-poison-stats"),player_build); let spells = spell_table[player_build.weapon.get("type")];