Hooks
Rollies fires three hooks during rolloffs that other modules can listen for. Hook names follow Foundry’s standard Hooks.on(name, callback) pattern, and all three are prefixed with the rollies module id.
| Hook name | When it fires | Payload |
|---|---|---|
rollies.rollUpdate | A participant’s roll is broadcast during an active rolloff. Fires on active non-GM (player) clients only. | { rolloffId, combatantId, total, name, img } |
rollies.matchComplete | An individual bracket match finishes. Fires only in bracket mode (3+ tied combatants), once per bracket match, on active non-GM clients only. | { tournamentId, matchId, winner, loser } |
rollies.winnerAnnounced | The winner of a bracket tournament is announced (3+ tied combatants). Does not fire for two-combatant pair rolloffs. | { tournamentId } |
rollies.rollUpdate
Section titled “rollies.rollUpdate”Fires on every active non-GM (player) client when a participant’s roll is broadcast inside an active rolloff. The GM client does not fire this hook. Use this for live displays and custom tournament UIs that need to mirror roll results as they come in.
Payload fields:
rolloffId: unique id of the rolloff or match this roll belongs to.combatantId: id of the combatant who rolled.total: numeric roll total.name: display name of the combatant.img: image URL for the combatant, falling back to the actor portrait.
rollies.matchComplete
Section titled “rollies.matchComplete”Fires once per individual bracket match as the bracket progresses, and only in bracket mode (3 or more tied combatants). It does not fire for pair or solo rolloffs. The hook fires on active non-GM clients only; the GM client does not fire it.
Payload fields:
tournamentId: id of the parent tournament.matchId: id of the specific match that just completed.winner: data for the winning combatant.loser: data for the losing combatant.
Hooks.on('rollies.matchComplete', (data) => { console.log(`Match ${data.matchId}: ${data.winner.name} beat ${data.loser.name}`);});rollies.winnerAnnounced
Section titled “rollies.winnerAnnounced”Fires when the winner of a bracket tournament is announced. Only bracket tournaments (3 or more tied combatants) fire this hook; two-combatant pair rolloffs do not. The hook fires whenever a tournament winner is declared, regardless of the Show Winner Announcement setting. The winner announcement dialog renders only when that setting is enabled; when it is disabled the hook still fires but no dialog appears. Use this to trigger downstream effects like awarding initiative, posting chat messages, or cleaning up custom UI tied to the tournament.
Payload fields:
tournamentId: id of the tournament whose winner was just declared.