Fix undefined entries in items during expansion
This commit is contained in:
parent
940f4368f4
commit
41275e20b8
2 changed files with 16 additions and 11 deletions
4
build.js
4
build.js
|
@ -249,7 +249,9 @@ class Build{
|
||||||
statMap.set(id,(statMap.get(id) || 0)+value);
|
statMap.set(id,(statMap.get(id) || 0)+value);
|
||||||
}
|
}
|
||||||
for (const staticID of staticIDs) {
|
for (const staticID of staticIDs) {
|
||||||
if (item.get(staticID)) { statMap.set(staticID, statMap.get(staticID) + item.get(staticID)); }
|
if (item.get(staticID)) {
|
||||||
|
statMap.set(staticID, statMap.get(staticID) + item.get(staticID));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const [setName, count] of this.activeSetCounts) {
|
for (const [setName, count] of this.activeSetCounts) {
|
||||||
|
|
23
display.js
23
display.js
|
@ -10,24 +10,26 @@ function expandItem(item, powders){
|
||||||
if(item.fixID){ //The item has fixed IDs.
|
if(item.fixID){ //The item has fixed IDs.
|
||||||
expandedItem.set("fixID",true);
|
expandedItem.set("fixID",true);
|
||||||
for (const id of rolledIDs){ //all rolled IDs are numerical
|
for (const id of rolledIDs){ //all rolled IDs are numerical
|
||||||
|
let val = (item[id] || 0);
|
||||||
//if(item[id]) {
|
//if(item[id]) {
|
||||||
minRolls.set(id,item[id]);
|
minRolls.set(id,val);
|
||||||
maxRolls.set(id,item[id]);
|
maxRolls.set(id,val);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}else{ //The item does not have fixed IDs.
|
}else{ //The item does not have fixed IDs.
|
||||||
for (const id of rolledIDs){
|
for (const id of rolledIDs){
|
||||||
if(item[id] > 0){ // positive rolled IDs
|
let val = (item[id] || 0);
|
||||||
minRolls.set(id,idRound(item[id]*0.3));
|
if(val > 0){ // positive rolled IDs
|
||||||
maxRolls.set(id,idRound(item[id]*1.3));
|
minRolls.set(id,idRound(val*0.3));
|
||||||
}else if(item[id] < 0){ //negative rolled IDs
|
maxRolls.set(id,idRound(val*1.3));
|
||||||
|
}else if(val < 0){ //negative rolled IDs
|
||||||
if (reversedIDs.includes(id)) {
|
if (reversedIDs.includes(id)) {
|
||||||
maxRolls.set(id,idRound(item[id]*1.3));
|
maxRolls.set(id,idRound(val*1.3));
|
||||||
minRolls.set(id,idRound(item[id]*0.7));
|
minRolls.set(id,idRound(val*0.7));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
minRolls.set(id,idRound(item[id]*1.3));
|
minRolls.set(id,idRound(val*1.3));
|
||||||
maxRolls.set(id,idRound(item[id]*0.7));
|
maxRolls.set(id,idRound(val*0.7));
|
||||||
}
|
}
|
||||||
}else{//Id = 0
|
}else{//Id = 0
|
||||||
minRolls.set(id,0);
|
minRolls.set(id,0);
|
||||||
|
@ -165,6 +167,7 @@ function displayBuildStats(build, parent_id){
|
||||||
}
|
}
|
||||||
|
|
||||||
let stats = build.statMap;
|
let stats = build.statMap;
|
||||||
|
console.log(build.statMap);
|
||||||
|
|
||||||
let active_elem;
|
let active_elem;
|
||||||
let elemental_format = false;
|
let elemental_format = false;
|
||||||
|
|
Loading…
Reference in a new issue