Skip to content

Commit

Permalink
Merge pull request #159 from ultrakorne/DanielBoettner-pf1-missingSpe…
Browse files Browse the repository at this point in the history
…llCompendiumError

[HotFix] Pathfinder 1 missing spell compendium
  • Loading branch information
DanielBoettner authored Dec 29, 2021
2 parents f60e1df + 1e9bac5 commit 6bcbedb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "better-rolltables",
"title": "Better Roll Tables",
"description": "Adding functionality to roll tables, especially to roll treasure and magic items",
"version": "1.8.91",
"version": "1.8.92",
"manifestPlusVersion": "1.2.0",
"authors": [
{
Expand Down
18 changes: 11 additions & 7 deletions scripts/better-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,20 @@ export class BetterTables {
}

/**
* Update spell cache used for random spell scroll generation
* @returns {Promise<void>}
*/
* Update spell cache used for random spell scroll generation
*
* @returns {Promise<void>}
*/
async updateSpellCache(pack) {
if (game.user.isGM) {
const defaultPack = game.settings.get(MODULE.ns, BRTCONFIG.SPELL_COMPENDIUM_KEY);
if (!pack || pack === defaultPack) {
const spellCompendium = game.packs.get(defaultPack)
const defaultPack = game.settings.get(MODULE.ns, BRTCONFIG.SPELL_COMPENDIUM_KEY),
spellCompendium = game.packs.get(defaultPack);

if (!pack && spellCompendium || pack === defaultPack) {
const spellCompendiumIndex = await spellCompendium.getIndex({ fields: ['data.level', 'img'] })
this._spellCache = spellCompendiumIndex.filter(entry => entry.type === "spell").map(i => mergeObject(i, { collection: spellCompendium.collection }))
} else {
ui.notifications.error(MODULE.ns + `| Spell cache could not be initialized/updated.`);
}
}
}
Expand Down Expand Up @@ -535,4 +539,4 @@ export class BetterTables {

return item.text
}
}
}
7 changes: 4 additions & 3 deletions scripts/hooks/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class BetterRolltableHooks {
if (game.user.isGM && VersionCheck.check(MODULE.ns)) {
renderWelcomeScreen();
}
await game.betterTables.updateSpellCache();

/** Register Handlebar helpers **/
/** checks if the first argument is equal to any of the subsequent arguments */
Expand Down Expand Up @@ -113,7 +112,9 @@ class BetterRolltableHooks {
if (value == this.switch_value) {
return options.fn(this)
}
});
});

await game.betterTables.updateSpellCache();
}

static foundryInit() {
Expand Down Expand Up @@ -157,4 +158,4 @@ class BetterRolltableHooks {
}
}

export { BetterRolltableHooks };
export { BetterRolltableHooks };
4 changes: 2 additions & 2 deletions styles/tidyDefaults.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.system-dnd5e {
.system-dnd5e, .system-pf1, .system-pf2e {
--modesto: "Modesto Condensed", "Palatino Linotype", serif;
--signika: "Signika", sans-serif;
--primary-font: rgba(0, 0, 0, 0.9);
Expand Down Expand Up @@ -84,4 +84,4 @@
--checkbox-outline: #323232;
--checkbox-unchecked: #4b4b4b;
--checkbox-checked: rgba(0, 255, 0, 0.5);
}
}

0 comments on commit 6bcbedb

Please sign in to comment.