Skip to content

Commit

Permalink
attempt to resolve #423
Browse files Browse the repository at this point in the history
  • Loading branch information
jopeek committed Sep 4, 2024
1 parent 4d6b045 commit 8ddde21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions lootsheet-simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,15 @@ class LootSheet5eNPC extends dnd5e.applications.actor.ActorSheet5eNPC {
}
let totalWeight = 0;
this.actor.items.contents.forEach((item) => {
let weight = Math.round(
(item.system.quantity * item.system.weight.value * 100) / 100
);
totalWeight += isNaN(weight) ? 0 : weight;
try {
let weight = Math.round(
(item.system.quantity * item.system.weight.value * 100) / 100
);
totalWeight += isNaN(weight) ? 0 : weight;
} catch (error) {
console.error("An error occurred while calculating weight:", error);
totalWeight += 0;
}
});

if (game.settings.get("lootsheet-simple", "includeCurrencyWeight")) {
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Loot Sheet NPC 5e (Simple Version)",
"description": "This module adds an additional NPC sheet which can be used for loot containers such as chests or shopkeepers.",
"version": "12.400.1",
"version": "12.400.2",
"esmodules": [
"/lootsheet-simple.js"
],
Expand Down

0 comments on commit 8ddde21

Please sign in to comment.