Adds more hooks to the 5e system. This is intended to be a library module for other modules (or Hook Macro users) to leverage.
Its goal is to eventually contribute these hooks directly to the core 5e system and disappear. The API is going to follow Semantic Versioning as it is likely to undergo sizable changes as the hooks are hammered out.
LPT: Use
CONFIG.debug.hooks = true
or Developer Mode to more easily explore what a hook does and when it fires.
A hook event that fires before an Actor takes damage. Note this only fires when the applyDamage
method is called, not when the actor's HP is updated manually.
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that took the damage |
amount | number |
The total amount of damage the actor took. Informational, does not drive update. |
updates | object |
The updates about to be made to the actor's hp. This should be mutated to affect the outcome of the damage application. |
A hook event that fires after an Actor takes damage. Note this only fires when the applyDamage
method is called, not when the actor's HP is updated manually.
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor after taking damage |
totalDamageTaken | number |
The total amount of damage the actor took |
A hook event that fires before an Actor rolls a Ability Save. This will fire before the configuration dialog appears.
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that rolled the ability save |
rollData | object |
The rolldata being provided to the D20Roll instance |
abilityId | string |
The ability id (e.g. "str") |
A hook event that fires after an Actor rolls a Ability Save
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that rolled the ability save |
result | D20Roll |
The Result of the ability save |
abilityId | string |
The ability id (e.g. "str") |
A hook event that fires before an Actor rolls a Ability Test. This will fire before the configuration dialog appears.
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that rolled the ability test |
rollData | object |
The rolldata being provided to the D20Roll instance |
abilityId | string |
The ability id (e.g. "str") |
A hook event that fires after an Actor rolls a Ability Test
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that rolled the ability test |
result | D20Roll |
The Result of the ability test |
abilityId | string |
The ability id (e.g. "str") |
A hook event that fires before an Actor rolls a Death Save
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that rolled the death save |
rollData | object |
Roll config which will be provided to the d20Roll function |
A hook event that fires after an Actor's Death Save has been evaluated
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that rolled the death save |
result | D20Roll |
The Result of the death save |
success | boolean |
Whether or not the death save was successful |
A hook event that fires before an Actor rolls a hit die.
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that rolled a hitDie |
rollData | object |
The rolldata being provided to the DamageRoll instance |
A hook event that fires after an Actor has healed from a hit die roll.
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that took the damage |
roll | DamageRoll |
The resulting roll from the hit die |
A hook event that fires before an Actor rolls a Skill Check. This will fire before the configuration dialog appears.
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that rolled the skill check |
rollData | object |
The rolldata being provided to the D20Roll instance |
skillId | string |
The skill id (e.g. "ins") |
A hook event that fires after an Actor rolls a Skill Check
Param | Type | Description |
---|---|---|
actor | Actor5e |
The Actor that rolled the skill check |
result | D20Roll |
The Result of the skill check |
skillId | string |
The skill id (e.g. "ins") |
A hook event that fires before an Item rolls a Damage Roll. This happens before the Roll Config dialog appears.
Param | Type | Description |
---|---|---|
item | Item5e |
The Item that rolls the Damage Roll |
rollConfig | object |
Roll config which will be provided to the damageRoll function |
A hook event that fires after an Item rolls a Damage Roll
Param | Type | Description |
---|---|---|
item | Item5e |
The Item that rolls the Damage Roll |
result | DamageRoll |
The Result of the Damage Roll |
A hook event that fires before an Item Roll's chat message is created
Param | Type | Description |
---|---|---|
item | Item5e |
The Item being rolled |
chatData | object |
The data that will be provided to the ChatMessage |
A hook event that fires after an Item Roll's chat message is created
Param | Type | Description |
---|---|---|
item | Item5e |
The Item being rolled |
chatMessage | ChatMessage | object |
The created ChatMessage instance or ChatMessageData depending on options.createMessage |
A hook event that fires before an Item's roll workflow begins. This happens before the Ability Use Dialog is shown.
Param | Type | Description |
---|---|---|
item | Item5e |
The Item that rolls the Attack Roll |
options | object |
The options passed to the Item.roll method. |
[options.configureDialog] | boolean |
Display a configuration dialog for the item roll, if applicable? |
[options.rollMode] | string |
The roll display mode with which to display (or not) the card |
[options.createMessage] | boolean |
Whether to automatically create a chat message (if true) or simply |
usageParameters | object |
Usage Parameters that will create the Ability use Dialog. These can change what the user is prompted for during the ability use dialog. |
usageParameters.consumeRecharge | boolean |
Should the item consume its recharge? |
usageParameters.consumeResource | boolean |
Should the item consume the configured resource item? |
usageParameters.consumeSpellSlot | boolean |
Should the item consume a spell slot? |
usageParameters.consumeUsage | boolean |
Should the item consume the configured charges? |
usageParameters.consumeQuantity | boolean |
Should the item consume its own quantity? |
A hook event that fires before an Item's usage updates are calculated.
Param | Type | Description |
---|---|---|
item | Item5e |
The Item that rolls the Attack Roll // * @param {object} usageParameters Usage Parameters from the Ability use Dialog. These are passed into Item5e._getUsageUpdates to determine the actor and item changes to be committed. |
usageParameters.consumeRecharge | boolean |
Should the item consume its recharge? |
usageParameters.consumeResource | boolean |
Should the item consume the configured resource item? |
usageParameters.consumeSpellLevel | string |
What level spell should the item consume? This should be either 'pact' or 'spell1', 'spell2', etc |
usageParameters.consumeUsage | boolean |
Should the item consume the configured charges? |
usageParameters.consumeQuantity | boolean |
Should the item consume its own quantity? |
A hook event that fires after an Item is rolled
Param | Type | Description |
---|---|---|
item | Item5e |
The Item being rolled |
chatMessage | ChatMessage | object |
The created ChatMessage or ChatMessageData depending on options.createMessage |
A hook event that fires before an Item rolls an Attack Roll. This happens before the Roll Config dialog appears.
Param | Type | Description |
---|---|---|
item | Item5e |
The Item that rolls the Attack Roll |
rollConfig | object |
Roll config which will be provided to the d20Roll function |
A hook event that fires after an Item rolls an Attack Roll
Param | Type | Description |
---|---|---|
item | Item5e |
The Item that rolls the Attack Roll |
result | D20Roll |
The Result of the Attack Roll |
A hook event that fires before an Item rolls a Formula Roll.
Param | Type | Description |
---|---|---|
item | Item5e |
The Item that rolls the Formula Roll |
formula | string |
Formula that will be rolled |
rollData | object |
Roll config which will be provided to the Roll instance |
A hook event that fires after an Item's "Other Formula" is rolled
Param | Type | Description |
---|---|---|
item | Item5e |
The Item being rolled |
result | Roll |
The roll instance after evaluation |
A hook event that fires before an Item's Recharge attempt is rolled.
Param | Type | Description |
---|---|---|
item | Item5e |
The Item that is rolling a recharge |
Occurs after an Item's Recharge attempt is rolled
Param | Type | Description |
---|---|---|
item | Item5e |
The Item being recharged |
result | Roll |
The result of the d6 roll |
success | boolean |
Was the recharge a success? |
A hook event that fires before an Item's Recharge attempt is rolled.
Param | Type | Description |
---|---|---|
item | Item5e |
The Item that is rolling a recharge |
rollConfig | object |
Roll config which will be provided to the d20Roll function |
A hook event that fires after an Item rolls a Tool Check
Param | Type | Description |
---|---|---|
item | Item5e |
The Item that rolls the Tool Check |
result | D20Roll |
The Result of the Tool Check Roll |