Skip to content

Commit

Permalink
fail late compendiums
Browse files Browse the repository at this point in the history
  • Loading branch information
AngryBeaver committed Feb 6, 2023
1 parent 8855e87 commit d4c3347
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 2.3.1 bug pulling items from compendium
fixed: when dropping items from compendium they no longer have an itemType thus they will not be detected correctly as equal to any item on actor.

fixed: when one recipe refers to an item no longer in this world you could not open the compendium browser
## 2.3.0 feature system independent

⚠️This module now depends on other modules to work, you need to enable them ⚠️
Expand Down
15 changes: 10 additions & 5 deletions src/apps/RecipeCompendium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,16 @@ export class RecipeCompendium {
static async isAnyAnyOfInList(listOfAnyOfIngredients: Component[], listOfItems) {
for (const component of listOfAnyOfIngredients) {
if (component.type === Settings.ANYOF_SUBTYPE) {
const item = await component.getEntity();
const anyOf = new AnyOf(item);
const results = await anyOf.filter(listOfItems);
if (results.filter(c => c.quantity >= component.quantity).length == 0) {
return false;
try {
const item = await component.getEntity();
const anyOf = new AnyOf(item);
const results = await anyOf.filter(listOfItems);
if (results.filter(c => c.quantity >= component.quantity).length == 0) {
return false;
}
}catch(error)
{
console.warn(error);
}
}
}
Expand Down

0 comments on commit d4c3347

Please sign in to comment.