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
Giving things a look as I can, probably can't actually test these but I can at least point things out in the PRs
those rollAttack/Damage hooks are a godsend for Multiattack 5e
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?What specifically were you thinking?
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
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 😇
Will check (and if not, will do).
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 reasonIs 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
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👏
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? 🤔
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...
No pre rest hook at the moment, but it could be added
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?
Sure, that will remind me
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
https://github.com/foundryvtt/dnd5e/issues/1678
"preRestCompleted" seems like a strange name...
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
A bit late to the party, but THANK GOD for the
preRollHitDie
additions, this will make my life so much easier in Rest Recovery ❤️Hooks have been merged! Hopefully there will be a new alpha branch soon so everyone can start testing them 🙂
👏