-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#881] Add spell level and item id to message flags when a spell is cast #1916
Conversation
module/documents/item.mjs
Outdated
@@ -783,6 +783,7 @@ export default class Item5e extends Item { | |||
item.prepareFinalAttributes(); | |||
} | |||
} | |||
if ( isSpell ) foundry.utils.setProperty(options.flags, "dnd5e.use", {spellLevel: item.system.level, itemId: this.id}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, is the original item ID not already attached to the chat card?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On item.use()
there are no system flags at all. The item id and the spell level have always been present in the dataset, however. But as the issue says, this makes it easier.
I'm wondering if it would just be simpler to put these at the top level, so Also, it would probably be better to store the item's UUID rather than the ID otherwise it would be difficult to retrieve the original item. And the ID should be stored for all items rather than just spells. |
I had the same thought about putting it at the top level. Something like I chose the item id because that is what is stored on attack rolls and damage rolls. Should those be changed? |
- spellLevel still only on spell uses.
Perhaps, in order to avoid breakage, we can include both for now, and retire |
I realise it would veer out of scope of the PR slightly, but I did so and added itemUuid to all other item roll types since those used itemId too. So in total, tool checks, other formula, attack, damage, and use. |
This is a one-liner to add a spell's level, as well as its item id, as
flags.dnd5e.use.spellLevel: <Number>
, and hopefully resolve #881.I have put this in a separate PR to get some feedback on what the best flag would be; attack rolls use
flags.dnd5e.roll.type: "attack"
and damage rolls useflags.dnd5e.roll.type: "damage"
, and this is not entirely in line with that, but usingflags.dnd5e.roll.type: "use"
didn't seem correct either.