Rolling Hooks

Rolling Hooks! I am working on a couple of additions to one of the upcoming version of 5e to add hooks to all of the system's rolling functions with the intention of allowing modules to fully customize these systems without having to wrap any methods. I welcome an eye on this from any module developers who work on modules that modify or respond to rolling behavior in 5e. Here are the three PRs with the changes: https://github.com/foundryvtt/dnd5e/pull/1670 https://github.com/foundryvtt/dnd5e/pull/1662 https://github.com/foundryvtt/dnd5e/pull/1671
GitHub
[#1002] Add hooks to Actor5e rolling methods by arbron Ā· Pull Req...
Adds a number of hooks to the actor rolling process to allow modules to better customize rolling without having to override or wrap system methods: dnd5e.preRollSkill & dnd5e.rollSkill dnd5e.p...
GitHub
[#1002] Add hooks to Item5e#roll & Item5e#displayCard to allow ...
Adds a number of hooks to the item rolling process to allow modules to better customize that workflow without having to override or wrap system methods: dnd5e.preRoll: Called before the item is co...
GitHub
[#1002] Add hooks to Item5e rolling methods by arbron Ā· Pull Requ...
Add hooks to the specific item rolling methods not covered by #1662. dnd5e.preRollAttack, dnd5e.rollAttack dnd5e.preRollDamage, dnd5e.rollDamage dnd5e.preRollFormula, dnd5e.rollFormula dnd5e.preRo...
21 Replies
Calego
Calegoā€¢3y ago
Giving things a look as I can, probably can't actually test these but I can at least point things out in the PRs
enso
ensoā€¢2y ago
those rollAttack/Damage hooks are a godsend for Multiattack 5e
Zhell
Zhellā€¢2y ago
and the Item#roll hook is a godsend for concentration tracking instead of reading the chatlog. I can do so much less filtering. Isn't this also the perfect opportunity to add more options to Item#roll and items' measuredTemplates?
arbron
arbronā€¢2y ago
What specifically were you thinking?
Zhell
Zhellā€¢2y ago
https://github.com/foundryvtt/dnd5e/issues/1543 for roll options. For templates, I still don't think they have any flags or other data identifying the item that created them? I could kiss you
arbron
arbronā€¢2y ago
Well, the first one was easy enough šŸ˜® Is there an issue for adding an origin flag to templates? If not, why not throw one up so I have something to point to šŸ˜‡
Zhell
Zhellā€¢2y ago
Will check (and if not, will do).
arbron
arbronā€¢2y ago
Whelp, it seems like MeasuredTemplateDocument doesn't like getting passed flags But you can set them after it is created, odd Hmm, it doesn't accept a flattened key for some reason
Zhell
Zhellā€¢2y ago
Is the issue in the dnd5e-specific method? Creating a template directly on the canvas with templateData can definitely accept a flag https://github.com/foundryvtt/dnd5e/issues/1677
arbron
arbronā€¢2y ago
We are calling new MeasuredTemplateDocument(tempateData), so I'm not sure what the issue might be Looks like the constructor doesn't take flattened objects, but the create method does Such a complex change, hours of work: https://github.com/foundryvtt/dnd5e/pull/1662/commits/c48d6874873c4c85f2c3702e8f4810ea996e7663
Zhell
Zhellā€¢2y ago
šŸ‘ I have many plans for this. Speaking of hooks, and I know this could be straying off topic, but are there pre-rest hooks or (pre)-hitDieRoll hooks? šŸ¤”
arbron
arbronā€¢2y ago
The hit die ones are in another PR: https://github.com/foundryvtt/dnd5e/pull/1670
GitHub
[#1002] Add hooks to Actor5e rolling methods by arbron Ā· Pull Req...
Adds a number of hooks to the actor rolling process to allow modules to better customize rolling without having to override or wrap system methods: dnd5e.preRollSkill & dnd5e.rollSkill dnd5e.p...
arbron
arbronā€¢2y ago
No pre rest hook at the moment, but it could be added
Zhell
Zhellā€¢2y ago
I can imagine that to be useful. Cursed to not gain spell slots back. Idk. I'll think of something. should I log an issue?
arbron
arbronā€¢2y ago
Sure, that will remind me
Calego
Calegoā€¢2y ago
this has some minor problems same as chatMessages which outlive their consumable items. scroll of fireball for instance speaking of wishlists, idk if you've already done this or not but including the spellLevel as a flag on the created chatcard is a very useful thing, so consumers (including the system itself) don't have to parse the DOM to get the spell level of an upcast spell (when rolling damage) that's probably a different task though
Zhell
Zhellā€¢2y ago
https://github.com/foundryvtt/dnd5e/issues/1678 "preRestCompleted" seems like a strange name...
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
Wasp
Waspā€¢2y ago
A bit late to the party, but THANK GOD for the preRollHitDie additions, this will make my life so much easier in Rest Recovery ā¤ļø
arbron
arbronā€¢2y ago
Hooks have been merged! Hopefully there will be a new alpha branch soon so everyone can start testing them šŸ™‚
Zhell
Zhellā€¢2y ago
šŸ‘