Closed rinnocenti closed 2 years ago
I will look into it. Still have some features in my local dev that need polishing. I will add a bugfix for that.
I found the error.
The check for 0
was faulty as it did not check on the weight but the item.
This resulted in 0 values in the table which is not allowed.
If you want to correct that error locally as long as the next release isn't ready. you may correct this https://github.com/ultrakorne/better-rolltables/blob/master/scripts/better-tables.js#L175 line.
Just change it from
results.filter(x => x !== undefined)
to
results.filter(x => x.weight !== 0)
However. For your call to work, the cases should be (lower) camelCase.
As entity.data.data.rarity
is (lower) camelCase.
This is wrong in the Wiki and should be corrected.
Also, I will ask @ultrakorne if he can add me as an collaborator to the project. So I can change things like these.
function predicate(entity) {
switch (entity.data.data.rarity) {
case "common":
return 16;
case "uncommon":
return 8;
case "rare":
return 4;
case "veryRare":
return 2;
case "legendary":
return 1;
default:
return 0;
}
}
betterTables.createTableFromCompendium result in error. it creates the table, but with the wrong weights and ranges