Feature: "Item Grant" system
Blocks #643 (closed)
Feature Summary
Allows a workflow for associating a set of embeddable documents (Items and AEs) by UUID with another Item. This workflow, much like editing AEs on Items, must be initiated from a non-embedded Item.
User Experience
For character features/abilities that give other features/abilities/items/etc, the user will open the main item in the sidebar and either go to a new 'item grant' tab or open an 'item grant' application via a header/sheet button. This dialog will support drag/drop of any Actor-embeddable Document (and the ability to delete a dropped document from that list) and, upon form submission, extracts the UUIDs of the provided Documents and stores this in the parent Item (either as a flag, or part of the system template fields).
When an Item with 'item grant' data is created as an embedded document on an actor, collect the referenced items by uuid lookup and use their data to batch create all listed granted items. During this item creation process, the 'granted' items should be flagged or otherwise denoted with their source Item's UUID.
When an Item with 'item grant' data is deleted from an actor, the inverse operation takes place. We search for any items on the owning actor that have been granted by that Item UUID and display them in a dialog for confirmation of deleting these associated granted items. Bonus points for overriding this deletion by checking (or unchecking) the item's name in this delete confirm dialog.
Need to provide an "actor-centric" way to at least remove item grants directly from the actor sheet in the case of items granted from #643 (closed).
Priority/Importance
Medium, creates a whole new system for character creation and supports higher fidelity combat operations, beyond simple rolls and contested checks.
Implementation Considerations
- Due to the possibility of granting items that grant items, it may be wise to limit Item Grant processing to only the "top level" items being created. I.e. creating a granted item should contain a create option saying "ignoreItemGrants" which halts potentially recursive "createItem" hooks.
- Due to #643 (closed) intending to use this system as its foundation, the process of granting and removing granted items needs to be compartmentalized into a rather agnostic
grantEmbedded(sourceItem, targetActor)
andremoveGranted(sourceItem, targetActor)
pair of functions.- For workflow sanity and cleanliness, it is suggested to consider the removal of granted items ONLY on the actor that owned the 'item grant' item being deleted.
Use-case Example
- User1 uses a power from Char1 that grants them a re-usable ability that buffs a target ally.
- Using #643 (closed) , User1 uses the power, then "Applies Grants" to Char1's token. This creates new items (keeping in mind potential item grant recursion, described above) on Char1.
- Char1 on their next turn uses this granted item, which places an "Applies Grants" button in chat for this granted item's granted items (e.g. target buffs), intended for application by User2 on Char2.
- User2 selects Char2 and "Applies Grants", which creates Items/AEs on Char2 representing the buffs. 4a) From implementation consideration (3), if the granting item (which may in itself be a granted item) is deleted from Char1 (e.g. the duration of this new ability expires), Char2's temporary item grants (buffs) remain intact.