Fix display bugs with 0 minroll crafted
This commit is contained in:
parent
810218f5d9
commit
2686beef13
4 changed files with 21 additions and 10 deletions
|
@ -2,7 +2,7 @@ const url_tag = location.hash.slice(1);
|
||||||
console.log(url_base);
|
console.log(url_base);
|
||||||
console.log(url_tag);
|
console.log(url_tag);
|
||||||
|
|
||||||
const BUILD_VERSION = "6.9.34";
|
const BUILD_VERSION = "6.9.35";
|
||||||
|
|
||||||
function setTitle() {
|
function setTitle() {
|
||||||
let text;
|
let text;
|
||||||
|
|
4
craft.js
4
craft.js
|
@ -326,9 +326,9 @@ class Craft{
|
||||||
statMap.set(key, statMap.get("charges") + value);
|
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) {
|
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});
|
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("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]);
|
statMap.get("maxRolls").set(key, (statMap.get("maxRolls").get(key)) ? statMap.get("maxRolls").get(key) + rolls[1] : rolls[1]);
|
||||||
|
|
|
@ -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
|
* END testing section
|
||||||
*/
|
*/
|
||||||
|
@ -126,8 +126,9 @@ function init() {
|
||||||
populateFields();
|
populateFields();
|
||||||
decodeCraft(ing_url_tag);
|
decodeCraft(ing_url_tag);
|
||||||
setTitle();
|
setTitle();
|
||||||
} catch (Error) {
|
} catch (error) {
|
||||||
console.log("If you are seeing this while building, do not worry. Oherwise, panic! (jk contact ferricles)");
|
console.log("If you are seeing this while building, do not worry. Oherwise, panic! (jk contact ferricles)");
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
20
display.js
20
display.js
|
@ -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";
|
let style = "positive";
|
||||||
if (item.get("minRolls").get(id) < 0) {
|
if (item.get("minRolls").get(id) < 0) {
|
||||||
style = "negative";
|
style = "negative";
|
||||||
|
@ -1120,11 +1120,12 @@ function displayExpandedIngredient(ingred, parent_id) {
|
||||||
p_elem.append(p);
|
p_elem.append(p);
|
||||||
}
|
}
|
||||||
} else if (command === "ids") { //warp
|
} else if (command === "ids") { //warp
|
||||||
for (const [key,value] of ingred.get("ids").get("minRolls")) {
|
for (let [key,value] of ingred.get("ids").get("maxRolls")) {
|
||||||
if (ingred.get("ids").get("minRolls").get(key) && value != 0 && ingred.get("ids").get("maxRolls").get(key) != 0){
|
if (value !== undefined && value != 0) {
|
||||||
|
value = ingred.get("ids").get("minRolls").get(key);
|
||||||
if(value > 0) {
|
if(value > 0) {
|
||||||
style = "positive";
|
style = "positive";
|
||||||
} else if (value < 0) {
|
} else if (value <= 0) {
|
||||||
style = "negative";
|
style = "negative";
|
||||||
}
|
}
|
||||||
if(reversedIDs.filter(e => e !== "atkTier").includes(key)){
|
if(reversedIDs.filter(e => e !== "atkTier").includes(key)){
|
||||||
|
@ -1151,9 +1152,18 @@ function displayExpandedIngredient(ingred, parent_id) {
|
||||||
row.appendChild(desc_elem);
|
row.appendChild(desc_elem);
|
||||||
|
|
||||||
let max_elem = document.createElement('td');
|
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('right');
|
||||||
max_elem.classList.add(style);
|
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);
|
row.appendChild(max_elem);
|
||||||
active_elem.appendChild(row);
|
active_elem.appendChild(row);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue