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
Calego2y 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
enso2y ago
those rollAttack/Damage hooks are a godsend for Multiattack 5e
Zhell (∩ ͡° ͜ʖ ͡°)⊃━☆゚. *
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
arbron2y ago
What specifically were you thinking?
Zhell (∩ ͡° ͜ʖ ͡°)⊃━☆゚. *
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
arbron2y 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 (∩ ͡° ͜ʖ ͡°)⊃━☆゚. *
Will check (and if not, will do).
arbron
arbron2y 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 (∩ ͡° ͜ʖ ͡°)⊃━☆゚. *
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
arbron2y 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 (∩ ͡° ͜ʖ ͡°)⊃━☆゚. *
👏 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
arbron2y 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
arbron2y ago
No pre rest hook at the moment, but it could be added
Zhell (∩ ͡° ͜ʖ ͡°)⊃━☆゚. *
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
arbron2y ago
Sure, that will remind me
Calego
Calego2y 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
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Wasp
Wasp2y 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
arbron2y ago
Hooks have been merged! Hopefully there will be a new alpha branch soon so everyone can start testing them 🙂