Skip to content

Commit

Permalink
renamed module (PF2E -> PF2e) Added more debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasarooniZ committed Aug 4, 2023
1 parent 1f03c8e commit 563f2d0
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 37 deletions.
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "pf2e-rpg-numbers",
"title": "PF2E RPG Numbers",
"title": "PF2e RPG Numbers",
"description": "A module that gives damage pop up text when you roll damage in pf2e.",
"version": "#{VERSION}#",
"compatibility": {
Expand All @@ -25,7 +25,7 @@
}
]
},
"esmodules": [
"scripts": [
"./scripts/module.js"
],
"languages": [
Expand Down
74 changes: 39 additions & 35 deletions scripts/module.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,7 @@
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",
};
Hooks.on("ready", function () {
console.log("PF2e RPG Numbers is ready");
});

const style = {
"fill": "white",
"fontSize": fontSize * fontMod,
align: "center",
dropShadow: true,
strokeThickness: 5,
}
console.log({colors})

function extractTerm(term, flavor = '') {
if (term.class === "NumericTerm") {
Expand Down Expand Up @@ -96,6 +65,41 @@ function extractDamageInfoCombined(rolls) {
* @param {string[]} targets list of token ids
*/
function generateDamageScroll(dmg_list, targets) {
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,
}

for (const target_id of targets) {
const tok = game.canvas.tokens.get(target_id);
const size = tok.document.texture.scaleY * tok.document.width;
Expand Down Expand Up @@ -129,7 +133,7 @@ function getTargetList(msg) {
}

Hooks.on("createChatMessage", async function (msg, status, id) {
console.log({msg})
console.log({ msg })
if (msg?.flags?.pf2e?.context?.type !== 'damage-roll') return;
const dmg_list = extractDamageInfoCombined(msg.rolls);
const targets = getTargetList(msg);
Expand Down

0 comments on commit 563f2d0

Please sign in to comment.