From e65250c0f48a3660a6d28fa369d7bbc824ec3fb3 Mon Sep 17 00:00:00 2001 From: cadowtin Date: Mon, 7 Aug 2023 01:10:50 -0500 Subject: [PATCH] possible fix --- scripts/module.js | 73 ++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/scripts/module.js b/scripts/module.js index 625fc79..f78a4f8 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -1,41 +1,3 @@ -class RPGNumbers { - constructor() { - this.fontSize = 20; - this.fontMod = 1; - this.colors = { - acid: "0x56fc03", - bludgeoning: "0xc7c7c7", - cold: "0x0394fc", - fire: "0xfc5603", - force: "0xff006a", - lightning: "0x0313fc", - "": "0xffffff", - piercing: "0xc7c7c7", - poison: "0x0b6625", - mental: "0x710996", - radiant: "0xffff54", - slashing: "0xc7c7c7", - electricity: "0x54ffb2", - healing: "0x09ff00", - negative: "0x4e4e68", - positive: "0xffffbf", - chaotic: "0xa600a6", - evil: "0x611f90", - good: "0x9d730a", - lawful: "0x683e00", - sonic: "darkcyan", - bleed: "0x99001a", - }; - this.style = { - "fill": "white", - "fontSize": fontSize * fontMod, - align: "center", - dropShadow: true, - strokeThickness: 5, - } - }; -} - function extractTerm(term, flavor = '') { if (term.class === "NumericTerm") { result.push({ dmg: term.number, type: term.options.flavor ?? flavor }); @@ -118,6 +80,39 @@ function generateDamageScroll(dmg_list, targets) { const tok = game.canvas.tokens.get(target_id); const size = tok.document.texture.scaleY * tok.document.width; const topOffset = size / 4; + const fontSize = 20; + const fontMod = 1; + const colors = { + acid: "0x56fc03", + bludgeoning: "0xc7c7c7", + cold: "0x0394fc", + fire: "0xfc5603", + force: "0xff006a", + lightning: "0x0313fc", + "": "0xffffff", + piercing: "0xc7c7c7", + poison: "0x0b6625", + mental: "0x710996", + radiant: "0xffff54", + slashing: "0xc7c7c7", + electricity: "0x54ffb2", + healing: "0x09ff00", + negative: "0x4e4e68", + positive: "0xffffbf", + chaotic: "0xa600a6", + evil: "0x611f90", + good: "0x9d730a", + lawful: "0x683e00", + sonic: "darkcyan", + bleed: "0x99001a", + }; + const style = { + "fill": "white", + "fontSize": fontSize * fontMod, + align: "center", + dropShadow: true, + strokeThickness: 5, + } const seq = new Sequence(); const color = (new RPGNumbers).colors @@ -156,7 +151,7 @@ Hooks.on("ready", async () => { if (!game.user.isGM) return; console.error("PF2e RPG Numbers is ready"); game.ui.notify("PF2e RPG Numbers is ready") - game.RPGNumbers = new RPGNumbers(); + //game.RPGNumbers = new RPGNumbers(); }) Hooks.on("createChatMessage", async function (msg, status, id) {