From 0f206e777da4e78f41f0be219fd92101d834f83c Mon Sep 17 00:00:00 2001 From: cadowtin Date: Mon, 7 Aug 2023 00:26:27 -0500 Subject: [PATCH] fix to errors --- scripts/hooks.js | 6 ++++-- scripts/module.js | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/hooks.js b/scripts/hooks.js index 63737bd..f21660e 100644 --- a/scripts/hooks.js +++ b/scripts/hooks.js @@ -4,14 +4,16 @@ * @property {string} type - Type of damage * @property {number} value - How much damage it was */ -Hooks.on("init", function () { +Hooks.on("init", async () => { console.log("PF2e RPG Numbers is initiated"); if (!game.user.isGM) return; game.RPGNumbers = new RPGNumbers(); }); -Hooks.on("ready", function () { +Hooks.on("ready", async () => { console.log("PF2e RPG Numbers is ready"); game.ui.notify("PF2e RPG Numbers is ready") + if (!game.user.isGM) return; + game.RPGNumbers = new RPGNumbers(); }); Hooks.on("createChatMessage", async function (msg, status, id) { diff --git a/scripts/module.js b/scripts/module.js index 5ad0aba..fc5f528 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -44,7 +44,7 @@ class RPGNumbers { result.push({ dmg: dieResult.result, type: term.options.flavor ?? flavor }); } } else if (term.class === "Grouping") { - extractTerm(term.term, term?.options?.flavor ?? flavor); + this.extractTerm(term.term, term?.options?.flavor ?? flavor); } else if (term.class === "ArithmeticExpression") { for (const operand of term?.operands) { extractTerm(operand, flavor); @@ -52,7 +52,7 @@ class RPGNumbers { } else if (!term?.class) { for (const t of term.rolls) { for (const tt of term.terms) { - extractTerm(tt, tt?.options?.flavor ?? flavor); + this.extractTerm(tt, tt?.options?.flavor ?? flavor); } } } @@ -78,7 +78,7 @@ class RPGNumbers { //console.log(dmg); } //console.log({inp, term}) - //extractTerm(term, inp?.options?.flavor ?? ''); + //this.extractTerm(term, inp?.options?.flavor ?? ''); } }