minor formatting changes

main
Matt Huntington 1 month ago
parent 95a4f51fdb
commit 2dcbf0a69c

@ -71,6 +71,7 @@ Hooks.on("createChatMessage", async (chatData, options, userId) => {
// For damage rolls, try to extract damage types from the terms
if (pf2eContext.type === "damage-roll" && r.options?.damage?.categories) {
// Damage categories might be available
// TODO: add in damage types
}
return detail;
}).join("; ");
@ -91,22 +92,26 @@ Hooks.on("createChatMessage", async (chatData, options, userId) => {
if (targetName) parts.push(`targeting ${targetName}`);
}
parts.push('. ')
// Traits (e.g. "fire", "mental", "incapacitation")
if (pf2eContext.traits?.length > 0) {
parts.push(`(traits: ${pf2eContext.traits.join(", ")})`);
parts.push(`Traits: ${pf2eContext.traits.join(", ")}.`);
}
// Modifiers/notes from the flavor text (often contains the breakdown)
// The flavor field in PF2E often has rich HTML with modifier breakdowns
// We'll grab a clean text version as supplemental info
if (flavor) {
const cleanFlavor = flavor.replace(/<[^>]*>/g, " ").replace(/\s{2,}/g, '. ').trim();
if (cleanFlavor && !parts.some(p => p.includes(cleanFlavor))) {
parts.push(`| ${cleanFlavor}`);
parts.push('Additional traits: ')
const cleanFlavor = flavor.replace(/<[^>]*>/g, " ").replace(/\s{2,}/g, ', ').trim();
if (cleanFlavor){
parts.push(cleanFlavor);
}
}
const rollString = `[ROLL] ${parts.join(" ")}`;
console.log(chatData);
console.log(rollString);
}
})

Loading…
Cancel
Save