From f04eda347a544d34930f8f22ab3b99a832cc7399 Mon Sep 17 00:00:00 2001 From: Gambit Date: Thu, 1 Feb 2024 20:47:32 -0500 Subject: [PATCH] 0.0.27 --- .github/workflows/main.yml | 2 +- module.json | 2 +- scripts/integrations/cpr.js | 7 +++++-- scripts/module.js | 10 ++++++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 055f676a..5e7ce217 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,7 @@ jobs: draft: false prerelease: false body: | - Bugfix: cpr integration + Bugfix: Actually fixed cpr integration this time token: ${{ secrets.GITHUB_TOKEN }} artifacts: './module.zip, ./module.json' tag: ${{ steps.get-version.outputs.version }} diff --git a/module.json b/module.json index d20e86f5..601970c2 100644 --- a/module.json +++ b/module.json @@ -7,7 +7,7 @@ "name": "Gambit" } ], - "version": "0.0.26", + "version": "0.0.27", "compatibility": { "minimum": "11", "verified": "11", diff --git a/scripts/integrations/cpr.js b/scripts/integrations/cpr.js index de16f9ee..ae13e595 100644 --- a/scripts/integrations/cpr.js +++ b/scripts/integrations/cpr.js @@ -1,7 +1,9 @@ -// Define a global variable to hold the static data let medkitItems = null; async function loadCompendiumData() { + + let items = {}; + const compendiumNames = [ 'gambits-premades.gps-class-features', 'gambits-premades.gps-generic-features', @@ -12,7 +14,6 @@ async function loadCompendiumData() { 'gambits-premades.gps-homebrew-spells', 'gambits-premades.gps-monster-features' ]; - let items = {}; for (const name of compendiumNames) { let compendium = game.packs.get(name); @@ -24,6 +25,8 @@ async function loadCompendiumData() { version: item.system.source?.custom || 'Unknown' }; }); + } else { + console.warn(`Compendium ${name} not found.`); } } diff --git a/scripts/module.js b/scripts/module.js index 98e43f01..5f0ca4a6 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -1,7 +1,13 @@ Hooks.once('init', () => { registerSettings(); - loadCompendiumData(); - game.modules.get('gambits-premades').medkitApi = medkitApi; +}); + +Hooks.once('ready', () => { + loadCompendiumData().then(() => { + game.modules.get('gambits-premades').medkitApi = medkitApi; + }).catch(error => { + console.error("Error loading compendium data:", error); + }); }); Hooks.on('createCombat', async (combat, options, userId) => {