Fix display bugs with 0 minroll crafted

This commit is contained in:
b 2021-02-25 00:03:44 -06:00
parent 810218f5d9
commit 2686beef13
4 changed files with 21 additions and 10 deletions

View file

@ -2,7 +2,7 @@ const url_tag = location.hash.slice(1);
console.log(url_base);
console.log(url_tag);
const BUILD_VERSION = "6.9.34";
const BUILD_VERSION = "6.9.35";
function setTitle() {
let text;

View file

@ -326,9 +326,9 @@ class Craft{
statMap.set(key, statMap.get("charges") + value);
}
}
for (const [key,value] of ingred.get("ids").get("minRolls")) {
for (const [key,value] of ingred.get("ids").get("maxRolls")) {
if (value && value != 0) {
let rolls = [value,ingred.get("ids").get("maxRolls").get(key)];
let rolls = [ingred.get("ids").get("minRolls").get(key), value];
rolls = rolls.map(x => Math.floor(x * eff_mult)).sort(function(a, b){return a - b});
statMap.get("minRolls").set(key, (statMap.get("minRolls").get(key)) ? statMap.get("minRolls").get(key) + rolls[0] : rolls[0]);
statMap.get("maxRolls").set(key, (statMap.get("maxRolls").get(key)) ? statMap.get("maxRolls").get(key) + rolls[1] : rolls[1]);

View file

@ -9,7 +9,7 @@ console.log(ing_url_tag);
const ING_BUILD_VERSION = "6.9.20";
const ING_BUILD_VERSION = "6.9.21";
/*
* END testing section
*/
@ -126,8 +126,9 @@ function init() {
populateFields();
decodeCraft(ing_url_tag);
setTitle();
} catch (Error) {
} catch (error) {
console.log("If you are seeing this while building, do not worry. Oherwise, panic! (jk contact ferricles)");
console.log(error);
}

View file

@ -656,7 +656,7 @@ function displayExpandedItem(item, parent_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
else if ( (rolledIDs.includes(id) && item.get("maxRolls").get(id)) ){ // && item.get("maxRolls").get(id) ){//rolled ID & non-0/non-null/non-und ID
let style = "positive";
if (item.get("minRolls").get(id) < 0) {
style = "negative";
@ -1120,11 +1120,12 @@ function displayExpandedIngredient(ingred, parent_id) {
p_elem.append(p);
}
} else if (command === "ids") { //warp
for (const [key,value] of ingred.get("ids").get("minRolls")) {
if (ingred.get("ids").get("minRolls").get(key) && value != 0 && ingred.get("ids").get("maxRolls").get(key) != 0){
for (let [key,value] of ingred.get("ids").get("maxRolls")) {
if (value !== undefined && value != 0) {
value = ingred.get("ids").get("minRolls").get(key);
if(value > 0) {
style = "positive";
} else if (value < 0) {
} else if (value <= 0) {
style = "negative";
}
if(reversedIDs.filter(e => e !== "atkTier").includes(key)){
@ -1151,9 +1152,18 @@ function displayExpandedIngredient(ingred, parent_id) {
row.appendChild(desc_elem);
let max_elem = document.createElement('td');
value = ingred.get("ids").get("maxRolls").get(key);
if(value > 0) {
style = "positive";
} else if (value <= 0) {
style = "negative";
}
if(reversedIDs.filter(e => e !== "atkTier").includes(key)){
style === "positive" ? style = "negative" : style = "positive";
}
max_elem.classList.add('right');
max_elem.classList.add(style);
max_elem.textContent = ingred.get("ids").get("maxRolls").get(key) + idSuffixes[key];
max_elem.textContent = value + idSuffixes[key];
row.appendChild(max_elem);
active_elem.appendChild(row);
}