Incrementing items by drag and drop
I'm trying to handle incrementing item quantities rather than adding new items when you drag and drop an item to a character sheet, as long as the item already exists in their inventory and is of the right type. I've set up a hook in my ready hook section (using the Boilerplate as a base) but now it's both incrementing the existing item and adding a brand new one.
2 Replies
Hook callbacks are not
await
ed. Making one async
will result in its result becoming Promise<boolean>
instead of boolean
, and that Promise
will always be truthy, thus not preventing the creation of an item.
If you're doing this within a system, you might also want to check out the document's Item#_preCreate
, which is awaited. Consideration as to whether this handling should be part of the drag and drop handling instead of all item handling might also apply.Aaaah, right ok. Yeah I'm building out a system so I've looked in to drag and drop handling and got it working that way, thanks for that!