@@ -1144,8 +1135,13 @@
+
+
+
+
+
diff --git a/sq2.js b/sq2.js
index aeb421f..aa931f0 100644
--- a/sq2.js
+++ b/sq2.js
@@ -51,53 +51,72 @@ $(document).ready(function(){
// set search style
$("#weapon-choice").on('input', function(){
- set_input_style('weapon');
- check_item($("#weapon-choice").val());
- update_powder_count('weapon');
+ setTimeout(function() {
+ set_input_style('weapon');
+ check_item($("#weapon-choice").val());
+ update_powder_count('weapon');
+ }, 500);
});
$("#helmet-choice").on('input', function(){
- set_input_style('helmet');
- check_item($("#helmet-choice").val());
- update_powder_count('helmet', '|example: t6t6');
+ setTimeout(function() {
+ set_input_style('helmet');
+ check_item($("#helmet-choice").val());
+ update_powder_count('helmet', '|example: t6t6');
+ }, 500);
});
$("#chestplate-choice").on('input', function(){
- set_input_style('chestplate');
- check_item($("#chestplate-choice").val());
- update_powder_count('chestplate');
+ setTimeout(function() {
+ set_input_style('chestplate');
+ check_item($("#chestplate-choice").val());
+ update_powder_count('chestplate');
+ }, 500);
});
$("#leggings-choice").on('input', function(){
- set_input_style('leggings');
- check_item($("#leggings-choice").val());
- update_powder_count('leggings');
+ setTimeout(function() {
+ set_input_style('leggings');
+ check_item($("#leggings-choice").val());
+ update_powder_count('leggings');
+ }, 500);
+
});
$("#boots-choice").on('input', function(){
- set_input_style('boots');
- check_item($("#boots-choice").val());
- update_powder_count('boots');
+ setTimeout(function() {
+ set_input_style('boots');
+ check_item($("#boots-choice").val());
+ update_powder_count('boots');
+ }, 500);
});
$("#ring1-choice").on('input', function(){
- set_input_style('ring1');
- check_item($("#ring1-choice").val());
+ setTimeout(function() {
+ set_input_style('ring1');
+ check_item($("#ring1-choice").val());
+ }, 500);
});
$("#ring2-choice").on('input', function(){
- set_input_style('ring2');
- check_item($("#ring2-choice").val());
+ setTimeout(function() {
+ set_input_style('ring2');
+ check_item($("#ring2-choice").val());
+ }, 500);
});
$("#bracelet-choice").on('input', function(){
- set_input_style('bracelet');
- check_item($("#bracelet-choice").val());
+ setTimeout(function() {
+ set_input_style('bracelet');
+ check_item($("#bracelet-choice").val());
+ }, 500);
});
$("#necklace-choice").on('input', function(){
- set_input_style('necklace');
- check_item($("#necklace-choice").val());
+ setTimeout(function() {
+ set_input_style('necklace');
+ check_item($("#necklace-choice").val());
+ }, 500);
});
// control vars
diff --git a/sq2build.js b/sq2build.js
index ab44ad9..bdb3918 100644
--- a/sq2build.js
+++ b/sq2build.js
@@ -299,17 +299,10 @@ class Build{
errors.push(new ItemNotFound(equipment[7], "necklace", true));
}
}
-
if(itemMap.get(equipment[8]) && 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]);
- /*
- if (equipment[8] !== "No Weapon") {
- document.getElementsByClassName("powder-specials")[0].style.display = "grid";
- } else {
- document.getElementsByClassName("powder-specials")[0].style.display = "none";
- }*/
}else{
try {
let weapon = getCustomFromHash(equipment[8]) ? getCustomFromHash(equipment[8]) : (getCraftFromHash(equipment[8]) ? getCraftFromHash(equipment[8]) : undefined);
diff --git a/sq2builder.js b/sq2builder.js
index a32fc12..33b818a 100644
--- a/sq2builder.js
+++ b/sq2builder.js
@@ -830,29 +830,29 @@ function calculateBuildStats() {
}
for (let i in player_build.items) {
- displayExpandedItem(player_build.items[i], buildFields[i], true);
+ displaysq2ExpandedItem(player_build.items[i], buildFields[i], true);
}
- displayWeaponBase(player_build);
- displayArmorStats(player_build);
- displayMinimalBuildStats("all-stats", player_build, build_overall_display_commands);
+ displaysq2WeaponBase(player_build);
+ displaysq2ArmorStats(player_build);
+ displayMinimalBuildStats("all-stats", player_build, build_all_display_commands);
displayMinimalBuildStats("minimal-stats", player_build, build_basic_display_commands);
displayMinimalBuildStats("minimal-offensive-stats",player_build, build_offensive_display_commands);
displaySetBonuses("set-info",player_build);
displayNextCosts("int-info",player_build);
let meleeStats = player_build.getMeleeStats();
- displayMeleeDamage(document.getElementById("build-melee-stats"), document.getElementById("build-melee-statsAvg"), meleeStats);
+ displaysq2MeleeDamage(document.getElementById("build-melee-stats"), document.getElementById("build-melee-statsAvg"), meleeStats);
- displayDefenseStats(document.getElementById("minimal-defensive-stats"),player_build);
+ displaysq2DefenseStats(document.getElementById("minimal-defensive-stats"),player_build);
- displayPoisonDamage(document.getElementById("build-poison-stats"),player_build);
+ displaysq2PoisonDamage(document.getElementById("build-poison-stats"),player_build);
let spells = spell_table[player_build.weapon.get("type")];
for (let i = 0; i < 4; ++i) {
let parent_elem = document.getElementById("spell"+i+"-info");
let overallparent_elem = document.getElementById("spell"+i+"-infoAvg");
- displaySpellDamage(parent_elem, overallparent_elem, player_build, spells[i], i+1);
+ displaysq2SpellDamage(parent_elem, overallparent_elem, player_build, spells[i], i+1);
}
location.hash = encodeBuild();
diff --git a/sq2display.js b/sq2display.js
index ce5ccc2..048d1d8 100644
--- a/sq2display.js
+++ b/sq2display.js
@@ -1,200 +1,3 @@
-/**
- * Apply armor powdering.
- * Also for jeweling for crafted items.
- */
-function applyArmorPowders(expandedItem, powders) {
- applyArmorPowdersOnce(expandedItem, powders);
- if (expandedItem.get("crafted")) {
- applyArmorPowdersOnce(expandedItem, powders);
- }
-}
-function applyArmorPowdersOnce(expandedItem, powders) {
- for(const id of powders){
- let powder = powderStats[id];
- let name = powderNames.get(id);
- expandedItem.set(name.charAt(0) + "Def", (expandedItem.get(name.charAt(0)+"Def") || 0) + powder["defPlus"]);
- expandedItem.set(skp_elements[(skp_elements.indexOf(name.charAt(0)) + 4 )% 5] + "Def", (expandedItem.get(skp_elements[(skp_elements.indexOf(name.charAt(0)) + 4 )% 5]+"Def") || 0) - powder["defMinus"]);
- }
-}
-
-function expandItem(item, powders) {
- let minRolls = new Map();
- let maxRolls = new Map();
- let expandedItem = new Map();
- if(item.fixID){ //The item has fixed IDs.
- expandedItem.set("fixID",true);
- for (const id of rolledIDs){ //all rolled IDs are numerical
- let val = (item[id] || 0);
- //if(item[id]) {
- minRolls.set(id,val);
- maxRolls.set(id,val);
- //}
- }
- }else{ //The item does not have fixed IDs.
- for (const id of rolledIDs){
- let val = (item[id] || 0);
- if(val > 0){ // positive rolled IDs
- if (reversedIDs.includes(id)) {
- maxRolls.set(id,idRound(val*0.3));
- minRolls.set(id,idRound(val*1.3));
- } else {
- maxRolls.set(id,idRound(val*1.3));
- minRolls.set(id,idRound(val*0.3));
- }
- }else if(val < 0){ //negative rolled IDs
- if (reversedIDs.includes(id)) {
- maxRolls.set(id,idRound(val*1.3));
- minRolls.set(id,idRound(val*0.7));
- }
- else {
- minRolls.set(id,idRound(val*1.3));
- maxRolls.set(id,idRound(val*0.7));
- }
- }else{//Id = 0
- minRolls.set(id,0);
- maxRolls.set(id,0);
- }
- }
- }
- for (const id of nonRolledIDs){
- expandedItem.set(id,item[id]);
- }
- expandedItem.set("minRolls",minRolls);
- expandedItem.set("maxRolls",maxRolls);
- expandedItem.set("powders", powders);
- if(item.category === "armor") {
- applyArmorPowders(expandedItem, powders);
- }
- return expandedItem;
-}
-
-/* Takes in an ingredient object and returns an equivalent Map().
-*/
-function expandIngredient(ing) {
- let expandedIng = new Map();
- let mapIds = ['consumableIDs', 'itemIDs', 'posMods'];
- for (const id of mapIds) {
- let idMap = new Map();
- for (const key of Object.keys(ing[id])) {
- idMap.set(key, ing[id][key]);
- }
- expandedIng.set(id, idMap);
- }
- let normIds = ['lvl','name', 'displayName','tier','skills','id'];
- for (const id of normIds) {
- expandedIng.set(id, ing[id]);
- }
- if (ing['isPowder']) {
- expandedIng.set("isPowder",ing['isPowder']);
- expandedIng.set("pid",ing['pid']);
- }
- //now the actually hard one
- let idMap = new Map();
- idMap.set("minRolls", new Map());
- idMap.set("maxRolls", new Map());
- for (const field of ingFields) {
- let val = (ing['ids'][field] || 0);
- idMap.get("minRolls").set(field, val['minimum']);
- idMap.get("maxRolls").set(field, val['maximum']);
- }
- expandedIng.set("ids",idMap);
- return expandedIng;
-}
-
-/* Takes in a recipe object and returns an equivalent Map().
-*/
-function expandRecipe(recipe) {
- let expandedRecipe = new Map();
- let normIDs = ["name", "skill", "type","id"];
- for (const id of normIDs) {
- expandedRecipe.set(id,recipe[id]);
- }
- let rangeIDs = ["durability","lvl", "healthOrDamage", "duration", "basicDuration"];
- for (const id of rangeIDs) {
- if(recipe[id]){
- expandedRecipe.set(id, [recipe[id]['minimum'], recipe[id]['maximum']]);
- } else {
- expandedRecipe.set(id, [0,0]);
- }
- }
- expandedRecipe.set("materials", [ new Map([ ["item", recipe['materials'][0]['item']], ["amount", recipe['materials'][0]['amount']] ]) , new Map([ ["item", recipe['materials'][1]['item']], ["amount",recipe['materials'][1]['amount'] ] ]) ]);
- return expandedRecipe;
-}
-
-/*An independent helper function that rounds a rolled ID to the nearest integer OR brings the roll away from 0.
-* @param id
-*/
-function idRound(id){
- rounded = Math.round(id);
- if(rounded == 0){
- return 1; //this is a hack, will need changing along w/ rest of ID system if anything changes
- }else{
- return rounded;
- }
-}
-
-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 displaySetBonuses(parent_id,build) {
- setHTML(parent_id, "");
- let parent_div = document.getElementById(parent_id);
-
- let set_summary_elem = document.createElement('p');
- set_summary_elem.classList.add('itemcenter');
- set_summary_elem.textContent = "Set Bonuses:";
- parent_div.append(set_summary_elem);
-
- if (build.activeSetCounts.size) {
- parent_div.parentElement.style.display = "block";
- } else {
- parent_div.parentElement.style.display = "none";
- }
-
- for (const [setName, count] of build.activeSetCounts) {
- const active_set = sets[setName];
- if (active_set["hidden"]) { continue; }
-
- let set_elem = document.createElement('p');
- set_elem.id = "set-"+setName;
- set_summary_elem.append(set_elem);
-
- const bonus = active_set.bonuses[count-1];
- let mock_item = new Map();
- mock_item.set("fixID", true);
- mock_item.set("displayName", setName+" Set: "+count+"/"+sets[setName].items.length);
- let mock_minRolls = new Map();
- let mock_maxRolls = new Map();
- mock_item.set("minRolls", mock_minRolls);
- mock_item.set("maxRolls", mock_maxRolls);
- for (const id in bonus) {
- if (rolledIDs.includes(id)) {
- mock_minRolls.set(id, bonus[id]);
- mock_maxRolls.set(id, bonus[id]);
- }
- else {
- mock_item.set(id, bonus[id]);
- }
- }
- mock_item.set("powders", []);
- displayExpandedItem(mock_item, set_elem.id);
- console.log(mock_item);
- }
-}
-
function displayMinimalBuildStats(parent_id,build,command_group){
// Commands to "script" the creation of nice formatting.
// #commands create a new element.
@@ -233,7 +36,7 @@ function displayMinimalBuildStats(parent_id,build,command_group){
active_elem.classList.add('full-border')
}
else if (command === "#defense-stats") {
- displayDefenseStats(active_elem, build, true);
+ displaysq2DefenseStats(active_elem, build, true);
}
else if(command === "#spacer") {
let row = document.createElement('tr');
@@ -276,7 +79,7 @@ function displayMinimalBuildStats(parent_id,build,command_group){
if (id === "poison" && id_val > 0) {
id_val = Math.ceil(id_val*build.statMap.get("poisonPct")/100);
}
- displayFixedID(active_elem, id, id_val, elemental_format, style);
+ displaysq2FixedID(active_elem, id, id_val, elemental_format, style);
if (id === "poison" && id_val > 0) {
let row = document.createElement('tr');
let value_elem = document.createElement('td');
@@ -306,14 +109,14 @@ function displayMinimalBuildStats(parent_id,build,command_group){
style = "negative";
}
if (diff != 0) {
- displayFixedID(active_elem, id, diff, false, style);
+ displaysq2FixedID(active_elem, id, diff, false, style);
}
}
}
}
}
-function displayExpandedItem(item, parent_id, mini=false){
+function displaysq2ExpandedItem(item, parent_id, mini=false){
// Commands to "script" the creation of nice formatting.
// #commands create a new element.
// !elemental is some janky hack for elemental damage.
@@ -509,9 +312,9 @@ function displayExpandedItem(item, parent_id, mini=false){
} else {
let p_elem;
if ( !(item.get("tier") === "Crafted" && item.get("category") === "armor" && id === "hp") && (!skp_order.includes(id)) || (skp_order.includes(id) && item.get("tier") !== "Crafted" && active_elem.nodeName === "DIV") ) { //skp warp
- p_elem = displayFixedID(active_elem, id, item.get(id), elemental_format);
+ p_elem = displaysq2FixedID(active_elem, id, item.get(id), elemental_format);
} else if (item.get("tier") === "Crafted" && item.get("category") === "armor" && id === "hp") {
- p_elem = displayFixedID(active_elem, id, item.get(id+"Low")+"-"+item.get(id), elemental_format);
+ p_elem = displaysq2FixedID(active_elem, id, item.get(id+"Low")+"-"+item.get(id), elemental_format);
}
if (id === "lore") {
p_elem.style = "font-style: italic";
@@ -536,7 +339,7 @@ function displayExpandedItem(item, parent_id, mini=false){
row.appendChild(boost);
p_elem.appendChild(row);
} else if ( item.get("tier") === "Crafted" && active_elem.nodeName === "TABLE") {
- let row = displayRolledID(item, id, elemental_format);
+ let row = displaysq2RolledID(item, id, elemental_format);
active_elem.appendChild(row);
}
} else if (id === "restrict") {
@@ -555,10 +358,10 @@ function displayExpandedItem(item, parent_id, mini=false){
style === "positive" ? style = "negative" : style = "positive";
}
if (fix_id) {
- displayFixedID(active_elem, id, item.get("minRolls").get(id), elemental_format, style);
+ displaysq2FixedID(active_elem, id, item.get("minRolls").get(id), elemental_format, style);
}
else {
- let row = displayRolledID(item, id, elemental_format);
+ let row = displaysq2RolledID(item, id, elemental_format);
active_elem.appendChild(row);
}
}else{
@@ -691,418 +494,7 @@ function displayExpandedItem(item, parent_id, mini=false){
}
}
-/* Displays stats about a recipe that are NOT displayed in the craft stats.
-* Includes: mat name and amounts
-* ingred names in an "array" with ingred effectiveness
-*/
-function displayRecipeStats(craft, parent_id) {
- let elem = document.getElementById(parent_id);
- elem.textContent = "";
- recipe = craft["recipe"];
- mat_tiers = craft["mat_tiers"];
- ingreds = [];
- for (const n of craft["ingreds"]) {
- ingreds.push(n.get("name"));
- }
- let effectiveness = craft["statMap"].get("ingredEffectiveness");
-
- let ldiv = document.createElement("div");
- ldiv.classList.add("itemleft");
- let title = document.createElement("p");
- title.classList.add("smalltitle");
- title.textContent = "Recipe Stats";
- ldiv.appendChild(title);
- let mats = document.createElement("p");
- mats.classList.add("itemp");
- mats.textContent = "Crafting Materials: ";
- for (let i = 0; i < 2; i++) {
- let tier = mat_tiers[i];
- let row = document.createElement("p");
- row.classList.add("left");
- let b = document.createElement("b");
- let mat = recipe.get("materials")[i];
- b.textContent = "- " + mat.get("amount") + "x " + mat.get("item").split(" ").slice(1).join(" ");
- b.classList.add("space");
- let starsB = document.createElement("b");
- starsB.classList.add("T1-bracket");
- starsB.textContent = "[";
- row.appendChild(b);
- row.appendChild(starsB);
- for(let j = 0; j < 3; j ++) {
- let star = document.createElement("b");
- star.textContent = "\u272B";
- if(j < tier) {
- star.classList.add("T1");
- } else {
- star.classList.add("T0");
- }
- row.append(star);
- }
- let starsE = document.createElement("b");
- starsE.classList.add("T1-bracket");
- starsE.textContent = "]";
- row.appendChild(starsE);
- mats.appendChild(row);
- }
- ldiv.appendChild(mats);
-
- let ingredTable = document.createElement("table");
- ingredTable.classList.add("itemtable");
- ingredTable.classList.add("ingredTable");
- for (let i = 0; i < 3; i++) {
- let row = document.createElement("tr");
- for (let j = 0; j < 2; j++) {
- let ingredName = ingreds[2 * i + j];
- let cell = document.createElement("td");
- cell.style.minWidth = "50%";
- cell.classList.add("center");
- cell.classList.add("box");
- cell.classList.add("tooltip");
- let b = document.createElement("b");
- b.textContent = ingredName;
- b.classList.add("space");
- let eff = document.createElement("b");
- let e = effectiveness[2 * i + j];
- if (e > 0) {
- eff.classList.add("positive");
- } else if (e < 0) {
- eff.classList.add("negative");
- }
- eff.textContent = "[" + e + "%]";
- cell.appendChild(b);
- cell.appendChild(eff);
- row.appendChild(cell);
-
- let tooltip = document.createElement("div");
- tooltip.classList.add("tooltiptext");
- tooltip.classList.add("ing-tooltip");
- tooltip.classList.add("center");
- tooltip.id = "tooltip-" + (2*i + j);
- cell.appendChild(tooltip);
- }
- ingredTable.appendChild(row);
- }
- elem.appendChild(ldiv);
- elem.appendChild(ingredTable);
-}
-
-//Displays a craft. If things change, this function should be modified.
-function displayCraftStats(craft, parent_id) {
- let mock_item = craft.statMap;
- displayExpandedItem(mock_item,parent_id);
-}
-
-//Displays an ingredient in item format. However, an ingredient is too far from a normal item to display as one.
-function displayExpandedIngredient(ingred, parent_id) {
- let parent_elem = document.getElementById(parent_id);
- parent_elem.textContent = "";
- let display_order = [
- "#cdiv",
- "displayName", //tier will be displayed w/ name
- "#table",
- "ids",
- "#ldiv",
- "posMods",
- "itemIDs",
- "consumableIDs",
- "#ldiv",
- "lvl",
- "skills",
- ]
- let item_order = [
- "dura",
- "strReq",
- "dexReq",
- "intReq",
- "defReq",
- "agiReq"
- ]
- let consumable_order = [
- "dura",
- "charges"
- ]
- let posMods_order = [
- "above",
- "under",
- "left",
- "right",
- "touching",
- "notTouching"
- ];
- let id_display_order = [
- "eDefPct",
- "tDefPct",
- "wDefPct",
- "fDefPct",
- "aDefPct",
- "eDamPct",
- "tDamPct",
- "wDamPct",
- "fDamPct",
- "aDamPct",
- "str",
- "dex",
- "int",
- "agi",
- "def",
- "hpBonus",
- "mr",
- "ms",
- "ls",
- "hprRaw",
- "hprPct",
- "sdRaw",
- "sdPct",
- "mdRaw",
- "mdPct",
- "xpb",
- "lb",
- "lq",
- "ref",
- "thorns",
- "expd",
- "spd",
- "atkTier",
- "poison",
- "spRegen",
- "eSteal",
- "spRaw1",
- "spRaw2",
- "spRaw3",
- "spRaw4",
- "spPct1",
- "spPct2",
- "spPct3",
- "spPct4",
- "jh",
- "sprint",
- "sprintReg",
- "gXp",
- "gSpd",
- ];
- let active_elem;
- let elemental_format = false;
- let style;
- for (const command of display_order) {
- 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_elem.appendChild(active_elem);
- }else {
- let p_elem = document.createElement("p");
- p_elem.classList.add("left");
- if (command === "displayName") {
- p_elem.classList.add("title");
- p_elem.classList.remove("left");
- let title_elem = document.createElement("b");
- title_elem.textContent = ingred.get("displayName");
- p_elem.appendChild(title_elem);
-
- let space = document.createElement("b");
- space.classList.add("space");
- p_elem.appendChild(space);
-
- let tier = ingred.get("tier"); //tier in [0,3]
- let begin = document.createElement("b");
- begin.classList.add("T"+tier+"-bracket");
- begin.textContent = "[";
- p_elem.appendChild(begin);
-
- for (let i = 0; i < 3; i++) {
- let tier_elem = document.createElement("b");
- if(i < tier) {tier_elem.classList.add("T"+tier)}
- else {tier_elem.classList.add("T0")}
- tier_elem.textContent = "\u272B";
- p_elem.appendChild(tier_elem);
- }
- let end = document.createElement("b");
- end.classList.add("T"+tier+"-bracket");
- end.textContent = "]";
- p_elem.appendChild(end);
- }else if (command === "lvl") {
- p_elem.textContent = "Crafting Lvl Min: " + ingred.get("lvl");
- }else if (command === "posMods") {
- for (const [key,value] of ingred.get("posMods")) {
- let p = document.createElement("p");
- p.classList.add("nomarginp");
- if (value != 0) {
- let title = document.createElement("b");
- title.textContent = posModPrefixes[key];
- let val = document.createElement("b");
- val.textContent = value + posModSuffixes[key];
- if(value > 0) {
- val.classList.add("positive");
- } else {
- val.classList.add("negative");
- }
- p.appendChild(title);
- p.appendChild(val);
- p_elem.appendChild(p);
- }
- }
- } else if (command === "itemIDs") { //dura, reqs
- for (const [key,value] of ingred.get("itemIDs")) {
- let p = document.createElement("p");
- p.classList.add("nomarginp");
- if (value != 0) {
- let title = document.createElement("b");
- title.textContent = itemIDPrefixes[key];
- p.appendChild(title);
- }
- let desc = document.createElement("b");
- if(value > 0) {
- if(key !== "dura") {
- desc.classList.add("negative");
- } else{
- desc.classList.add("positive");
- }
- desc.textContent = "+"+value;
- } else if (value < 0){
- if(key !== "dura") {
- desc.classList.add("positive");
- } else{
- desc.classList.add("negative");
- }
- desc.textContent = value;
- }
- if(value != 0){
- p.appendChild(desc);
- }
- p_elem.append(p);
- }
- } else if (command === "consumableIDs") { //dura, charges
- for (const [key,value] of ingred.get("consumableIDs")) {
- let p = document.createElement("p");
- p.classList.add("nomarginp");
- if (value != 0) {
- let title = document.createElement("b");
- title.textContent = consumableIDPrefixes[key];
- p.appendChild(title);
- }
- let desc = document.createElement("b");
- if(value > 0) {
- desc.classList.add("positive");
- desc.textContent = "+"+value;
- } else if (value < 0){
- desc.classList.add("negative");
- desc.textContent = value;
- }
- if(value != 0){
- p.appendChild(desc);
- let suffix = document.createElement("b");
- suffix.textContent = consumableIDSuffixes[key];
- p.appendChild(suffix);
- }
- p_elem.append(p);
- }
- }else if (command === "skills") {
- p_elem.textContent = "Used in:";
- for(const skill of ingred.get("skills")) {
- let p = document.createElement("p");
- p.textContent = skill.charAt(0) + skill.substring(1).toLowerCase();
- p.classList.add("left");
- p_elem.append(p);
- }
- } else if (command === "ids") { //warp
- for (let [key,value] of ingred.get("ids").get("maxRolls")) {
- if (value !== undefined && value != 0) {
- let row = displayRolledID(ingred.get("ids"), key, false, "auto");
- active_elem.appendChild(row);
- }
- }
- } else {//this shouldn't be happening
- }
-
- active_elem.appendChild(p_elem);
- }
- }
-}
-
-function displayNextCosts(parent_id, build) {
- let p_elem = document.getElementById(parent_id);
- let int = build.total_skillpoints[2];
- let spells = spell_table[build.weapon.get("type")];
-
- p_elem.textContent = "";
-
- let title = document.createElement("p");
- title.classList.add("title");
- title.classList.add("Normal");
- title.textContent = "Next Spell Costs";
-
- let int_title = document.createElement("p");
- int_title.classList.add("itemp");
- int_title.textContent = int + " Intelligence points.";
-
- p_elem.append(title);
- p_elem.append(int_title);
-
- for (const spell of spells) {
- let spellp = document.createElement("p");
- let spelltitle = document.createElement("p");
- spelltitle.classList.add("itemp");
- spelltitle.textContent = spell.title;
- spellp.appendChild(spelltitle);
- let row = document.createElement("p");
- row.classList.add("itemp");
- let init_cost = document.createElement("b");
- init_cost.textContent = build.getSpellCost(spells.indexOf(spell) + 1, spell.cost);
- init_cost.classList.add("Mana");
- let arrow = document.createElement("b");
- arrow.textContent = "\u279C";
- let next_cost = document.createElement("b");
- next_cost.textContent = (init_cost.textContent === "1" ? 1 : build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) - 1);
- next_cost.classList.add("Mana");
- let int_needed = document.createElement("b");
- if (init_cost.textContent === "1") {
- int_needed.textContent = ": n/a (+0)";
- }else { //do math
- let target = build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) - 1;
- let needed = int;
- let noUpdate = false;
- //forgive me... I couldn't inverse ceil, floor, and max.
- while (build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) > target) {
- if(needed > 150) {
- noUpdate = true;
- break;
- }
- needed++;
- build.total_skillpoints[2] = needed;
- }
- let missing = needed - int;
- //in rare circumstances, the next spell cost can jump.
- if (noUpdate) {
- next_cost.textContent = (init_cost.textContent === "1" ? 1 : build.getSpellCost(spells.indexOf(spell) + 1, spell.cost)-1);
- }else {
- next_cost.textContent = (init_cost.textContent === "1" ? 1 : build.getSpellCost(spells.indexOf(spell) + 1, spell.cost));
- }
-
-
- build.total_skillpoints[2] = int;//forgive me pt 2
- int_needed.textContent = ": " + (needed > 150 ? ">150" : needed) + " int (+" + (needed > 150 ? "n/a" : missing) + ")";
- }
-
- row.appendChild(init_cost);
- row.appendChild(arrow);
- row.appendChild(next_cost);
- row.appendChild(int_needed);
- spellp.appendChild(row);
-
- p_elem.append(spellp);
- }
-}
-
-function displayRolledID(item, id, elemental_format) {
+function displaysq2RolledID(item, id, elemental_format) {
let row = document.createElement('tr');
let min_elem = document.createElement('td');
min_elem.classList.add('shaded-table');
@@ -1142,7 +534,7 @@ function displayRolledID(item, id, elemental_format) {
return row;
}
-function displayWeaponBase(build) {
+function displaysq2WeaponBase(build) {
// let base_damage = build.get('damageRaw');
let damage_keys = [ "nDam", "eDam", "tDam", "wDam", "fDam", "aDam" ];
@@ -1170,7 +562,7 @@ function displayWeaponBase(build) {
}
}
-function displayFixedID(active, id, value, elemental_format, style) {
+function displaysq2FixedID(active, id, value, elemental_format, style) {
if (style) {
let row = document.createElement('tr');
let desc_elem = document.createElement('td');
@@ -1212,26 +604,8 @@ function displayFixedID(active, id, value, elemental_format, style) {
return p_elem;
}
}
-function displayEquipOrder(parent_elem,buildOrder){
- parent_elem.textContent = "";
- const order = buildOrder.slice();
- let title_elem = document.createElement("p");
- title_elem.textContent = "Equip order ";
- title_elem.classList.add("title");
- title_elem.classList.add("Normal");
- title_elem.classList.add("itemp");
- parent_elem.append(title_elem);
- parent_elem.append(document.createElement("br"));
- for (const item of order) {
- let p_elem = document.createElement("p");
- p_elem.classList.add("itemp");
- p_elem.classList.add("left");
- p_elem.textContent = item.get("displayName");
- parent_elem.append(p_elem);
- }
-}
-function displayPoisonDamage(overallparent_elem, build) {
+function displaysq2PoisonDamage(overallparent_elem, build) {
overallparent_elem.textContent = "";
//Title
@@ -1258,7 +632,7 @@ function displayPoisonDamage(overallparent_elem, build) {
overallparent_elem.append(overallpoisonDamage);
}
-function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
+function displaysq2MeleeDamage(parent_elem, overallparent_elem, meleeStats){
console.log("Melee Stats");
console.log(meleeStats);
let tooltipinfo = meleeStats[13];
@@ -1301,8 +675,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
//average DPS
let averageDamage = document.createElement("p");
averageDamage.classList.add("left");
- averageDamage.classList.add("itemp");
- averageDamage.classList.add("tooltip");
averageDamage.textContent = "Average DPS: " + stats[10];
tooltiptext = `= ((${stats[8]} * ${(stats[6][2]).toFixed(2)}) + (${stats[9]} * ${(stats[7][2]).toFixed(2)}))`
tooltip = createTooltip(tooltip, "p", tooltiptext, averageDamage, ["melee-tooltip"]);
@@ -1328,7 +700,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
//attack speed
let atkSpd = document.createElement("p");
atkSpd.classList.add("left");
- atkSpd.classList.add("itemp");
atkSpd.textContent = "Attack Speed: " + attackSpeeds[stats[11]];
parent_elem.append(atkSpd);
parent_elem.append(document.createElement("br"));
@@ -1349,7 +720,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
//Non-Crit: n->elem, total dmg, DPS
let nonCritStats = document.createElement("p");
nonCritStats.classList.add("left");
- nonCritStats.classList.add("itemp");
nonCritStats.textContent = "Non-Crit Stats: ";
nonCritStats.append(document.createElement("br"));
for (let i = 0; i < 6; i++){
@@ -1366,7 +736,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
let normalDamage = document.createElement("p");
normalDamage.textContent = "Total: " + stats[6][0] + " \u2013 " + stats[6][1];
- normalDamage.classList.add("itemp");
let tooltiparr = ["Min: = ", "Max: = "]
let arr = []; let arr2 = [];
for (let i = 0; i < 6; i++) {
@@ -1381,7 +750,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
let normalDPS = document.createElement("p");
normalDPS.textContent = "Normal DPS: " + stats[8];
- normalDPS.classList.add("itemp");
normalDPS.classList.add("tooltip");
tooltiptext = ` = ((${stats[6][0]} + ${stats[6][1]}) / 2) * ${baseDamageMultiplier[stats[11]]}`;
tooltip = createTooltip(tooltip, "p", tooltiptext, normalDPS, ["melee-tooltip"]);
@@ -1405,7 +773,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
let normalChance = document.createElement("p");
normalChance.textContent = "Non-Crit Chance: " + (stats[6][2]*100).toFixed(2) + "%";
- normalChance.classList.add("itemp");
normalChance.append(document.createElement("br"));
normalChance.append(document.createElement("br"));
nonCritStats.append(normalChance);
@@ -1416,7 +783,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
//Crit: n->elem, total dmg, DPS
let critStats = document.createElement("p");
critStats.classList.add("left");
- critStats.classList.add("itemp");
critStats.textContent = "Crit Stats: ";
critStats.append(document.createElement("br"));
for (let i = 0; i < 6; i++){
@@ -1432,7 +798,6 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
}
let critDamage = document.createElement("p");
critDamage.textContent = "Total: " + stats[7][0] + " \u2013 " + stats[7][1];
- critDamage.classList.add("itemp");
tooltiparr = ["Min: = ", "Max: = "]
arr = []; arr2 = [];
for (let i = 0; i < 6; i++) {
@@ -1448,14 +813,12 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
let critDPS = document.createElement("p");
critDPS.textContent = "Crit DPS: " + stats[9];
- critDPS.classList.add("itemp");
tooltiptext = ` = ((${stats[7][0]} + ${stats[7][1]}) / 2) * ${baseDamageMultiplier[stats[11]]}`;
tooltip = createTooltip(tooltip, "p", tooltiptext, critDPS, ["melee-tooltip"]);
critStats.append(critDPS);
let critChance = document.createElement("p");
critChance.textContent = "Crit Chance: " + (stats[7][2]*100).toFixed(2) + "%";
- critChance.classList.add("itemp");
critChance.append(document.createElement("br"));
critChance.append(document.createElement("br"));
critStats.append(critChance);
@@ -1463,7 +826,7 @@ function displayMeleeDamage(parent_elem, overallparent_elem, meleeStats){
parent_elem.append(critStats);
}
-function displayArmorStats(build) {
+function displaysq2ArmorStats(build) {
let armor_keys = ['helmet', 'chestplate', 'leggings', 'boots', 'ring1', 'ring2', 'bracelet', 'necklace'];
for (const i in armor_keys) {
@@ -1473,7 +836,7 @@ function displayArmorStats(build) {
}
-function displayDefenseStats(parent_elem, build, insertSummary){
+function displaysq2DefenseStats(parent_elem, build, insertSummary){
let defenseStats = build.getDefenseStats();
insertSummary = (typeof insertSummary !== 'undefined') ? insertSummary : false;
if (!insertSummary) {
@@ -1695,7 +1058,7 @@ function displayDefenseStats(parent_elem, build, insertSummary){
}
}
-function displayPowderSpecials(parent_elem, powderSpecials, build) {
+function displaysq2PowderSpecials(parent_elem, powderSpecials, build) {
parent_elem.textContent = "Powder Specials";
let specials = powderSpecials.slice();
let stats = build.statMap;
@@ -1820,7 +1183,7 @@ function displayPowderSpecials(parent_elem, powderSpecials, build) {
}
}
-function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spellIdx) {
+function displaysq2SpellDamage(parent_elem, overallparent_elem, build, spell, spellIdx) {
parent_elem.textContent = "";
@@ -2056,466 +1419,3 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell
}
}
}
-
-/** Displays the ID costs of an item
- *
- * @param {String} elemID - the id of the parent element.
- * @param {Map} item - the statMap of an item.
- */
-function displayIDCosts(elemID, item) {
- let parent_elem = document.getElementById(elemID);
- let tier = item.get("tier");
- if ( (item.has("fixID") && item.get("fixID")) || ["Normal","Crafted","Custom","none", " ",].includes(item.get("tier"))) {
- return;
- } else {
- /** Returns the number of inventory slots minimum an amount of emeralds would take up + the configuration of doing so.
- * Returns an array of [invSpace, E, EB, LE, Stx LE]
- *
- * @param {number} ems - the total numerical value of emeralds to compact.
- */
- function emsToInvSpace(ems) {
- let stx = Math.floor(ems/262144);
- ems -= stx*4096*64;
- let LE = Math.floor(ems/4096);
- ems -= LE*4096;
- let EB = Math.floor(ems/64);
- ems -= EB*64;
- let e = ems;
- return [ stx + Math.ceil(LE/64) + Math.ceil(EB/64) + Math.ceil(e/64) , e, EB, LE, stx];
- }
- /**
- *
- * @param {String} tier - item tier
- * @param {Number} lvl - item level
- */
- function getIDCost(tier, lvl) {
- switch (tier) {
- case "Unique":
- return Math.round(0.5*lvl + 3);
- case "Rare":
- return Math.round(1.2*lvl + 8);
- case "Legendary":
- return Math.round(4.5*lvl + 12);
- case "Fabled":
- return Math.round(12*lvl + 26);
- case "Mythic":
- return Math.round(18*lvl + 90);
- case "Set":
- return Math.round(1.5*lvl + 8)
- default:
- return -1;
- }
- }
-
- parent_elem.style = "display: visible";
- let lvl = item.get("lvl");
- if (typeof(lvl) === "string") { lvl = parseFloat(lvl); }
-
- let title_elem = document.createElement("p");
- title_elem.classList.add("smalltitle");
- title_elem.style.color = "white";
- title_elem.textContent = "Identification Costs";
- parent_elem.appendChild(title_elem);
- parent_elem.appendChild(document.createElement("br"));
-
- let grid_item = document.createElement("div");
- grid_item.style.display = "flex";
- grid_item.style.flexDirection = "rows";
- grid_item.style.flexWrap = "wrap";
- grid_item.style.gap = "5px";
- parent_elem.appendChild(grid_item);
-
- let IDcost = getIDCost(tier, lvl);
- let initIDcost = IDcost;
- let invSpace = emsToInvSpace(IDcost);
- let rerolls = 0;
-
- while(invSpace[0] <= 28 && IDcost > 0) {
- let container = document.createElement("div");
- container.classList.add("container");
- container.style = "grid-item-" + (rerolls+1);
- container.style.maxWidth = "max(120px, 15%)";
-
- let container_title = document.createElement("p");
- container_title.style.color = "white";
- if (rerolls == 0) {
- container_title.textContent = "Initial ID Cost: ";
- } else {
- container_title.textContent = "Reroll to [" + (rerolls+1) + "] Cost:";
- }
- container.appendChild(container_title);
- let total_cost_container = document.createElement("p");
- let total_cost_number = document.createElement("b");
- total_cost_number.classList.add("Set");
- total_cost_number.textContent = IDcost + " ";
- let total_cost_suffix = document.createElement("b");
- total_cost_suffix.textContent = "emeralds."
- total_cost_container.appendChild(total_cost_number);
- total_cost_container.appendChild(total_cost_suffix);
- container.appendChild(total_cost_container);
-
- let OR = document.createElement("p");
- OR.classList.add("center");
- OR.textContent = "OR";
- container.appendChild(OR);
-
- let esuffixes = ["", "emeralds.", "EB.", "LE.", "stacks of LE."];
- for (let i = 4; i > 0; i--) {
- let n_container = document.createElement("p");
- let n_number = document.createElement("b");
- n_number.classList.add("Set");
- n_number.textContent = invSpace[i] + " ";
- let n_suffix = document.createElement("b");
- n_suffix.textContent = esuffixes[i];
- n_container.appendChild(n_number);
- n_container.appendChild(n_suffix);
- container.appendChild(n_container);
- }
- grid_item.appendChild(container);
-
- rerolls += 1;
- IDcost = Math.round(initIDcost * (5 ** rerolls));
- invSpace = emsToInvSpace(IDcost);
- }
- }
-}
-
-/** Displays Additional Info for
- *
- * @param {String} elemID - the parent element's id
- * @param {Map} item - the statMap of the item
- * @returns
- */
-function displayAdditionalInfo(elemID, item) {
- let parent_elem = document.getElementById(elemID);
- parent_elem.classList.add("left");
-
- let droptype_elem = document.createElement("div");
- droptype_elem.classList.add("container");
- droptype_elem.style.marginBottom = "5px";
- droptype_elem.textContent = "Drop type: " + (item.has("drop") ? item.get("drop"): "NEVER");
- parent_elem.appendChild(droptype_elem);
-
- let warning_elem = document.createElement("div");
- warning_elem.classList.add("container");
- warning_elem.style.marginBottom ="5px";
- warning_elem.textContent = "This page is incomplete. Will work on it later.";
- parent_elem.appendChild(warning_elem);
-
- return;
-}
-
-/** Displays all set bonuses (0/n, 1/n, ... n/n) for a given set
- *
- * @param {String} parent_id - id of the parent element
- * @param {String} setName - the name of the set
- */
- function displayAllSetBonuses(parent_id,setName) {
- let parent_elem = document.getElementById(parent_id);
- parent_elem.style.display = "";
- let set = sets[setName];
- let title_elem = document.createElement("p");
- title_elem.textContent = setName + " Set Bonuses";
- title_elem.classList.add("Set");
- title_elem.classList.add("title");
- parent_elem.appendChild(title_elem);
- let grid_elem = document.createElement("div");
- grid_elem.style.display = "flex";
- grid_elem.style.flexDirection = "rows";
- grid_elem.style.flexWrap = "wrap";
- grid_elem.style.gap = "5px";
- parent_elem.appendChild(grid_elem);
-
- for (let i = 0; i < set.items.length; i++) {
-
- let set_elem = document.createElement('p');
- set_elem.classList.add("container");
- set_elem.style = "grid-item-"+(i+1);
- set_elem.style.maxWidth = "max(180px, 15%)";
- set_elem.id = "set-"+setName+"-"+i;
- grid_elem.appendChild(set_elem);
- const bonus = set.bonuses[i];
- let mock_item = new Map();
- mock_item.set("fixID", true);
- mock_item.set("displayName", setName+" Set: " + (i+1) + "/"+sets[setName].items.length);
- set_elem.textContent = mock_item.get("displayName");
- let mock_minRolls = new Map();
- let mock_maxRolls = new Map();
- mock_item.set("minRolls", mock_minRolls);
- mock_item.set("maxRolls", mock_maxRolls);
- for (const id in bonus) {
- if (rolledIDs.includes(id)) {
- mock_minRolls.set(id, bonus[id]);
- mock_maxRolls.set(id, bonus[id]);
- }
- else {
- mock_item.set(id, bonus[id]);
- }
- }
- mock_item.set("powders", []);
- displayExpandedItem(mock_item, set_elem.id);
- }
-
-}
-
-/** Displays the individual probabilities of each possible value of each rollable ID for this item.
- *
- * @param {String} parent_id the document id of the parent element
- * @param {String} item expandedItem object
- * @param {String} amp the level of corkian amplifier used. 0 means no amp, 1 means Corkian Amplifier I, etc. [0,3]
- */
-function displayIDProbabilities(parent_id, item, amp) {
- if (item.has("fixID") && item.get("fixID")) {return}
- let parent_elem = document.getElementById(parent_id);
- parent_elem.style.display = "";
- parent_elem.innerHTML = "";
- let title_elem = document.createElement("p");
- title_elem.textContent = "Identification Probabilities";
- title_elem.id = "ID_PROB_TITLE";
- title_elem.classList.add("Legendary");
- title_elem.classList.add("title");
- parent_elem.appendChild(title_elem);
-
- let disclaimer_elem = document.createElement("p");
- disclaimer_elem.textContent = "IDs are rolled on a uniform distribution. A chance of 0% means that either the minimum or maximum possible multiplier must be rolled to get this value."
- parent_elem.appendChild(disclaimer_elem);
-
- let amp_row = document.createElement("p");
- amp_row.id = "amp_row";
- let amp_text = document.createElement("b");
- amp_text.textContent = "Corkian Amplifier Used: "
- amp_row.appendChild(amp_text);
- let amp_1 = document.createElement("button");
- amp_1.id = "cork_amp_1";
- amp_1.textContent = "I";
- amp_row.appendChild(amp_1);
- let amp_2 = document.createElement("button");
- amp_2.id = "cork_amp_2";
- amp_2.textContent = "II";
- amp_row.appendChild(amp_2);
- let amp_3 = document.createElement("button");
- amp_3.id = "cork_amp_3";
- amp_3.textContent = "III";
- amp_row.appendChild(amp_3);
- amp_1.addEventListener("click", (event) => {toggleAmps(1)});
- amp_2.addEventListener("click", (event) => {toggleAmps(2)});
- amp_3.addEventListener("click", (event) => {toggleAmps(3)});
- parent_elem.appendChild(amp_row);
-
- if (amp != 0) {toggleButton("cork_amp_" + amp)}
-
- let item_name = item.get("displayName");
- console.log(itemMap.get(item_name))
-
- let table_elem = document.createElement("table");
- parent_elem.appendChild(table_elem);
- for (const [id,val] of Object.entries(itemMap.get(item_name))) {
- if (rolledIDs.includes(id)) {
- let min = item.get("minRolls").get(id);
- let max = item.get("maxRolls").get(id);
- //Apply corkian amps
- if (val > 0) {
- let base = itemMap.get(item_name)[id];
- if (reversedIDs.includes(id)) {max = Math.max( Math.round((0.3 + 0.05*amp) * base), 1)}
- else {min = Math.max( Math.round((0.3 + 0.05*amp) * base), 1)}
- }
-
- let row_title = document.createElement("tr");
- //row_title.style.textAlign = "left";
- let title_left = document.createElement("td");
- let left_elem = document.createElement("p");
- let left_val_title = document.createElement("b");
- let left_val_elem = document.createElement("b");
- title_left.style.textAlign = "left";
- left_val_title.textContent = idPrefixes[id] + "Base ";
- left_val_elem.textContent = val + idSuffixes[id];
- if (val > 0 == !reversedIDs.includes(id)) {
- left_val_elem.classList.add("positive");
- } else if (val > 0 == reversedIDs.includes(id)) {
- left_val_elem.classList.add("negative");
- }
- left_elem.appendChild(left_val_title);
- left_elem.appendChild(left_val_elem);
- title_left.appendChild(left_elem);
- row_title.appendChild(title_left);
-
- let title_right = document.createElement("td");
- let title_right_text = document.createElement("b");
- title_right.style.textAlign = "left";
- title_right_text.textContent = "[ " + min + idSuffixes[id] + ", " + max + idSuffixes[id] + " ]";
- if ( (min > 0 && max > 0 && !reversedIDs.includes(id)) || (min < 0 && max < 0 && reversedIDs.includes(id)) ) {
- title_right_text.classList.add("positive");
- } else if ( (min < 0 && max < 0 && !reversedIDs.includes(id)) || (min > 0 && max > 0 && reversedIDs.includes(id)) ) {
- title_right_text.classList.add("negative");
- }
- title_right.appendChild(title_right_text);
-
- let title_input = document.createElement("td");
- let title_input_slider = document.createElement("input");
- title_input_slider.type = "range";
- title_input_slider.id = id+"-slider";
- if (!reversedIDs.includes(id)) {
- title_input_slider.step = 1;
- title_input_slider.min = `${min}`;
- title_input_slider.max = `${max}`;
- title_input_slider.value = `${max}`;
- } else {
- title_input_slider.step = 1;
- title_input_slider.min = `${-1*min}`;
- title_input_slider.max = `${-1*max}`;
- title_input_slider.value = `${-1*max}`;
- }
- let title_input_textbox = document.createElement("input");
- title_input_textbox.type = "text";
- title_input_textbox.value = `${max}`;
- title_input_textbox.id = id+"-textbox";
- title_input_textbox.classList.add("small-input");
- title_input.appendChild(title_input_slider);
- title_input.appendChild(title_input_textbox);
-
- row_title.appendChild(title_left);
- row_title.appendChild(title_right);
- row_title.appendChild(title_input);
-
- let row_chances = document.createElement("tr");
- let chance_cdf = document.createElement("td");
- let chance_pdf = document.createElement("td");
- let cdf_p = document.createElement("p");
- cdf_p.id = id+"-cdf";
- let pdf_p = document.createElement("p");
- pdf_p.id = id+"-pdf";
-
- chance_cdf.appendChild(cdf_p);
- chance_pdf.appendChild(pdf_p);
- row_chances.appendChild(chance_cdf);
- row_chances.appendChild(chance_pdf);
-
- table_elem.appendChild(row_title);
- table_elem.appendChild(row_chances);
-
-
-
- stringPDF(id, max, val, amp); //val is base roll
- stringCDF(id, max, val, amp); //val is base roll
- title_input_slider.addEventListener("change", (event) => {
- let id_name = event.target.id.split("-")[0];
- let textbox_elem = document.getElementById(id_name+"-textbox");
-
- if (reversedIDs.includes(id_name)) {
- if (event.target.value < -1*min) { event.target.value = -1*min}
- if (event.target.value > -1*max) { event.target.value = -1*max}
- stringPDF(id_name, -1*event.target.value, val, amp); //val is base roll
- stringCDF(id_name, -1*event.target.value, val, amp); //val is base roll
- } else {
- if (event.target.value < min) { event.target.value = min}
- if (event.target.value > max) { event.target.value = max}
- stringPDF(id_name, 1*event.target.value, val, amp); //val is base roll
- stringCDF(id_name, 1*event.target.value, val, amp); //val is base roll
- }
-
- if (textbox_elem && textbox_elem.value !== event.target.value) {
- if (reversedIDs.includes(id_name)) {
- textbox_elem.value = -event.target.value;
- } else {
- textbox_elem.value = event.target.value;
- }
- }
-
-
- });
- title_input_textbox.addEventListener("change", (event) => {
- let id_name = event.target.id.split("-")[0];
- if (reversedIDs.includes(id_name)) {
- if (event.target.value > min) { event.target.value = min}
- if (event.target.value < max) { event.target.value = max}
- } else {
- if (event.target.value < min) { event.target.value = min}
- if (event.target.value > max) { event.target.value = max}
- }
- let slider_elem = document.getElementById(id_name+"-slider");
- if (slider_elem.value !== event.target.value) {
- slider_elem.value = -event.target.value;
- }
-
- stringPDF(id_name, 1*event.target.value, val, amp);
- stringCDF(id_name, 1*event.target.value, val, amp);
- });
- }
- }
-}
-
-//helper functions. id - the string of the id's name, val - the value of the id, base - the base value of the item for this id
-function stringPDF(id,val,base,amp) {
- /** [0.3b,1.3b] positive normal
- * [1.3b,0.3b] positive reversed
- * [1.3b,0.7b] negative normal
- * [0.7b,1.3b] negative reversed
- *
- * [0.3, 1.3] minr, maxr [0.3b, 1.3b] min, max
- * the minr/maxr decimal roll that corresponds to val -> minround, maxround
- */
- let p; let min; let max; let minr; let maxr; let minround; let maxround;
- if (base > 0) {
- minr = 0.3 + 0.05*amp; maxr = 1.3;
- min = Math.max(1, Math.round(minr*base)); max = Math.max(1, Math.round(maxr*base));
- minround = (min == max) ? (minr) : ( Math.max(minr, (val-0.5) / base) );
- maxround = (min == max) ? (maxr) : ( Math.min(maxr, (val+0.5) / base) );
- } else {
- minr = 1.3; maxr = 0.7;
- min = Math.min(-1, Math.round(minr*base)); max = Math.min(-1, Math.round(maxr*base));
- minround = (min == max) ? (minr) : ( Math.min(minr, (val-0.5) / base) );
- maxround = (min == max) ? (maxr) : ( Math.max(maxr, (val+0.5) / base) );
- }
-
- p = Math.abs(maxround-minround)/Math.abs(maxr-minr)*100;
- p = p.toFixed(3);
-
- let b1 = document.createElement("b");
- b1.textContent = "Roll exactly ";
- let b2 = document.createElement("b");
- b2.textContent = val + idSuffixes[id];
- if (val > 0 == !reversedIDs.includes(id)) {b2.classList.add("positive")}
- if (val > 0 == reversedIDs.includes(id)) {b2.classList.add("negative")}
- let b3 = document.createElement("b");
- b3.textContent = ": " + p + "%";
- document.getElementById(id + "-pdf").innerHTML = "";
- document.getElementById(id + "-pdf").appendChild(b1);
- document.getElementById(id + "-pdf").appendChild(b2);
- document.getElementById(id + "-pdf").appendChild(b3);
- document.getElementById(id + "-pdf").style.textAlign = "left";
-}
-function stringCDF(id,val,base,amp) {
- let p; let min; let max; let minr; let maxr; let minround; let maxround;
- if (base > 0) {
- minr = 0.3 + 0.05*amp; maxr = 1.3;
- min = Math.max(1, Math.round(minr*base)); max = Math.max(1, Math.round(maxr*base));
- minround = (min == max) ? (minr) : ( Math.max(minr, (val-0.5) / base) );
- maxround = (min == max) ? (maxr) : ( Math.min(maxr, (val+0.5) / base) );
- } else {
- minr = 1.3; maxr = 0.7;
- min = Math.min(-1, Math.round(minr*base)); max = Math.min(-1, Math.round(maxr*base));
- minround = (min == max) ? (minr) : ( Math.min(minr, (val-0.5) / base) );
- maxround = (min == max) ? (maxr) : ( Math.max(maxr, (val+0.5) / base) );
- }
-
- if (reversedIDs.includes(id)) {
- p = Math.abs(minr-maxround)/Math.abs(maxr-minr)*100;
- } else {
- p = Math.abs(maxr-minround)/Math.abs(maxr-minr)*100;
- }
- p = p.toFixed(3);
-
- let b1 = document.createElement("b");
- b1.textContent = "Roll ";
- let b2 = document.createElement("b");
- b2.textContent = val + idSuffixes[id];
- if (val > 0 == !reversedIDs.includes(id)) {b2.classList.add("positive")}
- if (val > 0 == reversedIDs.includes(id)) {b2.classList.add("negative")}
- let b3 = document.createElement("b");
- b3.textContent= " or better: " + p + "%";
- document.getElementById(id + "-cdf").innerHTML = "";
- document.getElementById(id + "-cdf").appendChild(b1);
- document.getElementById(id + "-cdf").appendChild(b2);
- document.getElementById(id + "-cdf").appendChild(b3);
- document.getElementById(id + "-cdf").style.textAlign = "left";
-}
diff --git a/sq2display_constants.js b/sq2display_constants.js
index 3626e03..b5a9d38 100644
--- a/sq2display_constants.js
+++ b/sq2display_constants.js
@@ -1,311 +1,7 @@
-let nonRolledIDs = [
- "name",
- "lore",
- "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_",
- "majorIds"];
-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" ];
-let colorMap = new Map(
- [
- ["Normal", "#fff"],
- ["Unique", "#ff5"],
- ["Rare","#f5f"],
- ["Legendary","#5ff"],
- ["Fabled","#f55"],
- ["Mythic","#a0a"],
- ["Crafted","#0aa"],
- ["Custom","#0aa"],
- ["Set","#5f5"]
- ]
-);
-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":"Raw Melee Damage: ",
- "mdPct":"Melee 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":"",
- "lore": ""
-};
-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":"/5s",
- "ms":"/3s",
- "ref":"%",
- "ls":"/3s",
- "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":"",
- "lore": ""
-};
-
-//Used for item IDs and ingredient id field IDs
-//Used for ingredient IDs - name, lvl, tier. As of now, not used.
-/*let ingPrefixes = {"name": "", "lvl": "", "tier": ""};
-let ingSuffixes = {"name": "", "lvl": "", "tier": ""}*/
-//Used for ingredient consumableIDs
-let consumableIDPrefixes = {
- "charges": "Charges: ",
- "dura": "Duration: "
-}
-let consumableIDSuffixes = {
- "charges": "",
- "dura": " sec."
-}
-//Used for ingredient itemIDs
-let itemIDPrefixes = {
- "dura": "Durability: ",
- "strReq": "Strength Min: ",
- "dexReq": "Dexterity Min: ",
- "intReq": "Intelligence Min: ",
- "defReq": "Defense Min: ",
- "agiReq": "Agility Min: "
-}
-
-//Used for ingredient posMods IDs
-let posModPrefixes = {
- "left":"Effectiveness Left: ",
- "right":"EFfectiveness Right: ",
- "above":"Effectiveness Above: ",
- "under":"Effectiveness Under: ",
- "touching":"EFfectiveness Touching: ",
- "notTouching":"Effectiveness Not Touching: "
-}
-let posModSuffixes = {
- "left":"%",
- "right":"%",
- "above":"%",
- "under":"%",
- "touching":"%",
- "notTouching":"%"
-}
-
/*
* Display commands
*/
-let build_overall_display_commands = [
+let build_all_display_commands = [
"#table",
"#defense-stats",
"str", "dex", "int", "def", "agi",
@@ -366,54 +62,3 @@ let build_basic_display_commands = [
"atkTier",
]
-let item_display_commands = [
- "#cdiv",
- "displayName",
- //"type", //REPLACE THIS WITH SKIN
- "#ldiv",
- "atkSpd",
- "#ldiv",
- "!elemental",
- "hp",
- "nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_",
- "fDef", "wDef", "aDef", "tDef", "eDef",
- "!elemental",
- "#ldiv",
- "classReq",
- "lvl",
- "strReq", "dexReq", "intReq", "defReq","agiReq",
- "#ldiv",
- "str", "dex", "int", "def", "agi",
- "#table",
- "str", "dex", "int", "def", "agi", //jank lmao
- "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",
- "#ldiv",
- "majorIds",
- "slots",
- "set",
- "lore",
- "quest",
- "restrict"
-];
diff --git a/sq2icons.js b/sq2icons.js
index 6c03a9d..6339415 100644
--- a/sq2icons.js
+++ b/sq2icons.js
@@ -4,35 +4,3 @@ console.log(window_storage);
icon_state_stored = window_storage.getItem("newicons");
newIcons = true;
if (icon_state_stored === "false") {toggleIcons()}
-
-//REMOVE THIS IN THE REAL VERSION 7 OR SOMETHING
-window_storage.removeItem("rick");
-
-/** Toggle icons on the ENTIRE page.
- *
- */
-/*
-function toggleIcons() {
- newIcons = !newIcons;
- let imgs = document.getElementsByTagName("IMG");
- let favicon = document.querySelector("link[rel~='icon']");
- let toggleiconbutton = document.getElementById("toggle-icon-button");
-
- if (newIcons) { //switch to new
- favicon.href = favicon.href.replace("media/icons/old","media/icons/new");
- for (const img of imgs) {
- if (img.src.includes("media/icons/old")) {img.src = img.src.replace("media/icons/old","media/icons/new");}
- if (img.src.includes("media/items/old")) {img.src = img.src.replace("media/items/old","media/items/new");}
- }
- toggleiconbutton.textContent = "Use Old Icons";
- window_storage.setItem("newicons","true");
- } else { //switch to old
- favicon.href = favicon.href.replace("media/icons/new","media/icons/old");
- for (const img of imgs) {
- if (img.src.includes("media/icons/new")) {img.src = img.src.replace("media/icons/new","media/icons/old");}
- if (img.src.includes("media/items/new")) {img.src = img.src.replace("media/items/new","media/items/old");}
- }
- toggleiconbutton.textContent = "Use New Icons";
- window_storage.setItem("newicons","false");
- }
-}*/
\ No newline at end of file
diff --git a/sq2items.js b/sq2items.js
index 8520422..1f20572 100644
--- a/sq2items.js
+++ b/sq2items.js
@@ -143,7 +143,6 @@ function doItemSearch() {
queries.push(new NameQuery(document.getElementById("name-choice").value.trim()));
let categoryOrType = document.getElementById("category-choice").value;
- console.log("category: "+categoryOrType)
if (itemTypes.includes(categoryOrType)) {
queries.push(new IdMatchQuery("type", categoryOrType));
}
@@ -188,8 +187,6 @@ function doItemSearch() {
console.log(items_copy.length);
}
// document.getElementById("summary").textContent = items_copy.length + " results."
- console.log('a')
- console.log(items_copy);
displayItems(items_copy);
}