Skip to content

Commit

Permalink
fix rolltable import loop bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Forien committed Sep 2, 2023
1 parent 70c20d4 commit 2dc2042
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## v1.X.X
### v1.1.6
* Fixed the Item Piles Rolltables looped import due to a bug with non-existing compendium in WFRP4e Core 4.0.0
### v1.1.5
* Fixed the "Percentage" modes for Ammo Reclamation not working properly
### v1.1.4
Expand Down
7 changes: 4 additions & 3 deletions dist/modules/module-integrations/ItemPiles.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,11 @@ export default class ItemPiles {
}

async #importRollTables() {
const coreModuleActive = game.modules.get('wfrp4e-core')?.active || false;
const coreModule = game.modules.get('wfrp4e-core');
const coreModuleActive = coreModule?.active || false;
if (!coreModuleActive) return;

const coreCollectionName = 'wfrp4e-core.trappings';
const coreCollectionName = isNewerVersion(coreModule.version, '3.999') ? 'wfrp4e-core.items' : 'wfrp4e-core.trappings';
const coreCollection = coreModuleActive ? game.packs.get(coreCollectionName) : null;
const folder = await this.#createFolder();
const rolltableCompendium = await game.packs.get("forien-armoury.merchant-rolltables");
Expand All @@ -267,7 +268,7 @@ export default class ItemPiles {
let pack = game.packs.get(entry.documentCollection);
if (pack) continue;
if (!pack && coreModuleActive) {
let coreItem = coreCollection.index.find(index => index.name === entry.text)
let coreItem = coreCollection?.index.find(index => index.name === entry.text)
if (coreItem) {
entry.documentCollection = coreCollectionName;
entry.documentId = coreItem._id;
Expand Down

0 comments on commit 2dc2042

Please sign in to comment.