|
1 | | -const fontSize = 20; |
2 | | -const fontMod = 1; |
3 | | -const colors = { |
4 | | - acid: "0x56fc03", |
5 | | - bludgeoning: "0xc7c7c7", |
6 | | - cold: "0x0394fc", |
7 | | - fire: "0xfc5603", |
8 | | - force: "0xff006a", |
9 | | - lightning: "0x0313fc", |
10 | | - "": "0xffffff", |
11 | | - piercing: "0xc7c7c7", |
12 | | - poison: "0x0b6625", |
13 | | - mental: "0x710996", |
14 | | - radiant: "0xffff54", |
15 | | - slashing: "0xc7c7c7", |
16 | | - electricity: "0x54ffb2", |
17 | | - healing: "0x09ff00", |
18 | | - negative: "0x4e4e68", |
19 | | - positive: "0xffffbf", |
20 | | - chaotic: "0xa600a6", |
21 | | - evil: "0x611f90", |
22 | | - good: "0x9d730a", |
23 | | - lawful: "0x683e00", |
24 | | - sonic: "darkcyan", |
25 | | - bleed: "0x99001a", |
26 | | -}; |
| 1 | +Hooks.on("ready", function () { |
| 2 | + console.log("PF2e RPG Numbers is ready"); |
| 3 | +}); |
27 | 4 |
|
28 | | -const style = { |
29 | | - "fill": "white", |
30 | | - "fontSize": fontSize * fontMod, |
31 | | - align: "center", |
32 | | - dropShadow: true, |
33 | | - strokeThickness: 5, |
34 | | -} |
35 | | -console.log({colors}) |
36 | 5 |
|
37 | 6 | function extractTerm(term, flavor = '') { |
38 | 7 | if (term.class === "NumericTerm") { |
@@ -96,6 +65,41 @@ function extractDamageInfoCombined(rolls) { |
96 | 65 | * @param {string[]} targets list of token ids |
97 | 66 | */ |
98 | 67 | function generateDamageScroll(dmg_list, targets) { |
| 68 | + const fontSize = 20; |
| 69 | + const fontMod = 1; |
| 70 | + const colors = { |
| 71 | + acid: "0x56fc03", |
| 72 | + bludgeoning: "0xc7c7c7", |
| 73 | + cold: "0x0394fc", |
| 74 | + fire: "0xfc5603", |
| 75 | + force: "0xff006a", |
| 76 | + lightning: "0x0313fc", |
| 77 | + "": "0xffffff", |
| 78 | + piercing: "0xc7c7c7", |
| 79 | + poison: "0x0b6625", |
| 80 | + mental: "0x710996", |
| 81 | + radiant: "0xffff54", |
| 82 | + slashing: "0xc7c7c7", |
| 83 | + electricity: "0x54ffb2", |
| 84 | + healing: "0x09ff00", |
| 85 | + negative: "0x4e4e68", |
| 86 | + positive: "0xffffbf", |
| 87 | + chaotic: "0xa600a6", |
| 88 | + evil: "0x611f90", |
| 89 | + good: "0x9d730a", |
| 90 | + lawful: "0x683e00", |
| 91 | + sonic: "darkcyan", |
| 92 | + bleed: "0x99001a", |
| 93 | + }; |
| 94 | + |
| 95 | + const style = { |
| 96 | + "fill": "white", |
| 97 | + "fontSize": fontSize * fontMod, |
| 98 | + align: "center", |
| 99 | + dropShadow: true, |
| 100 | + strokeThickness: 5, |
| 101 | + } |
| 102 | + |
99 | 103 | for (const target_id of targets) { |
100 | 104 | const tok = game.canvas.tokens.get(target_id); |
101 | 105 | const size = tok.document.texture.scaleY * tok.document.width; |
@@ -129,7 +133,7 @@ function getTargetList(msg) { |
129 | 133 | } |
130 | 134 |
|
131 | 135 | Hooks.on("createChatMessage", async function (msg, status, id) { |
132 | | - console.log({msg}) |
| 136 | + console.log({ msg }) |
133 | 137 | if (msg?.flags?.pf2e?.context?.type !== 'damage-roll') return; |
134 | 138 | const dmg_list = extractDamageInfoCombined(msg.rolls); |
135 | 139 | const targets = getTargetList(msg); |
|
0 commit comments