Skip to content

Commit

Permalink
2.0.3
Browse files Browse the repository at this point in the history
Support for rollable tables that contain dnd5e compendium items, such as the Foundry VTT Community Tables from https://github.com/foundry-vtt-community/tables
  • Loading branch information
jopeek committed May 28, 2020
1 parent 0f5f7ea commit 8d7041c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions lootsheetnpc5e.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,16 @@ class LootSheet5eNPC extends ActorSheet5eNPC {
let newItem = game.items.get(rollResult.results[0].resultId);
//console.log(newItem);
if (!newItem || newItem === null) {
console.log(`Loot Sheet | No item found "${rollResult.results[0].resultId}".`);
return ui.notifications.error(`No item found "${rollResult.results[0].resultId}".`);
//Item doesn't exist in game, let's see if we can import it from the dnd5e compendium
const dnd5eitems = game.packs.get("dnd5e.items");
//dnd5eitems.getIndex().then(index => console.log(index));
//let newItem = dnd5eitems.index.find(e => e.id === rollResult.results[0].resultId);
dnd5eitems.getEntity(rollResult.results[0].resultId).then(i => console.log(i));
newItem = await dnd5eitems.getEntity(rollResult.results[0].resultId);
if (!newItem || newItem === null) {
console.log(`Loot Sheet | No item found "${rollResult.results[0].resultId}".`);
return ui.notifications.error(`No item found "${rollResult.results[0].resultId}".`);
}
}

let itemQtyRoll = new Roll(itemQtyFormula);
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "lootsheetnpc5e",
"title": "Loot Sheet NPC 5e",
"description": "This module adds an additional NPC sheet which can be used for loot containers such as chests or shopkeepers.",
"version": "2.0.2",
"version": "2.0.3",
"minimumCoreVersion": "0.5.7",
"compatibleCoreVersion": "0.5.7",
"compatibleCoreVersion": "0.6.0",
"author": "Jan Ole Peek (ChalkOne), Charles Miller (Kage)",
"systems": ["dnd5e"],
"esmodules": ["/lootsheetnpc5e.js"],
Expand Down

0 comments on commit 8d7041c

Please sign in to comment.