From 0eb5a7276f21afed6c29d7e35bdcab16f8f45c31 Mon Sep 17 00:00:00 2001 From: Dapoolp Date: Sun, 6 Jul 2025 02:40:32 +0200 Subject: [PATCH] test --- daggerheart.mjs | 4 ++++ module/dice/dhRoll.mjs | 6 +++++- module/dice/dualityRoll.mjs | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/daggerheart.mjs b/daggerheart.mjs index 82c56dff..c6e686eb 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -264,3 +264,7 @@ Hooks.on('renderJournalDirectory', async (tab, html, _, options) => { }; } }); + +Hooks.on(`${CONFIG.DH.id}.postRollDuality`, async(roll, config, message) => { + console.log(roll, config, message) +}); \ No newline at end of file diff --git a/module/dice/dhRoll.mjs b/module/dice/dhRoll.mjs index c461e14a..15dd8ca2 100644 --- a/module/dice/dhRoll.mjs +++ b/module/dice/dhRoll.mjs @@ -19,7 +19,7 @@ export default class DHRoll extends Roll { } static async buildConfigure(config = {}, message = {}) { - config.hooks = [...(config.hooks ?? []), '']; + config.hooks = [...this.getHooks(), '']; config.dialog ??= {}; for (const hook of config.hooks) { if (Hooks.call(`${CONFIG.DH.id}.preRoll${hook.capitalize()}`, config, message) === false) return null; @@ -94,6 +94,10 @@ export default class DHRoll extends Roll { config.dialog.configure ??= !(config.event.shiftKey || config.event.altKey || config.event.ctrlKey); } + static getHooks(hooks) { + return hooks ?? []; + } + formatModifier(modifier) { const numTerm = modifier < 0 ? '-' : '+'; return [ diff --git a/module/dice/dualityRoll.mjs b/module/dice/dualityRoll.mjs index 0960ba1b..46d73f74 100644 --- a/module/dice/dualityRoll.mjs +++ b/module/dice/dualityRoll.mjs @@ -79,7 +79,10 @@ export default class DualityRoll extends D20Roll { return game.i18n.localize(label); } - updateFormula() {} + static getHooks(hooks) { + + return [...(hooks ?? []), 'Duality']; + } createBaseDice() { if (