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