foundryvtt / dnd5e

An implementation of the 5th Edition game system for Foundry Virtual Tabletop (http://foundryvtt.com).
MIT License
336 stars 224 forks source link

Add an editable identifier on all item types #3451

Closed pgervais70 closed 1 month ago

pgervais70 commented 7 months ago

Currently there is an identifier available on all items but it’s only editable on classes and subclasses. Other item types have a computed value based on the name of the item, so it cannot be used accurately by code to determine an item identify because if the name is translated the value changes.

Many macros rely on item name to verify if an actor has a specific feature which breaks when the item names are translated. With an identifier similar to the one used by classes and subclasses, it would make those macros less brittle and more “localizable” friendly.

arbron commented 6 months ago

The current plan is for editable identifiers only for items that have to be inserted into roll data, namely items that support ScaleValueAdvancement. Currently that means we need to add editable identifiers to backgrounds & races, but we probably won't be adding it to other items.

pgervais70 commented 6 months ago

Other than an identifier on features what other mean could be used to lookup for a specific feature without depending on localizable content (name)?

krbz999 commented 6 months ago

An identifier property on physical items (weapons, potions, etc) could also be useful to determine when or if an item should stack rather than create a new item when dropped onto an actor sheet. Currently there is a very naive piece of logic that applies only to Consumable items.

It can also be useful to determine whether a caster has the required spell components for a spell, despite this not being something the system enforces.

pgervais70 commented 6 months ago

Another use case, recently you added support for consumption target to be a UUID to facilitate item creation so it can be added to an actor without having to go in the item an select manually the proper target. This could also be achieved with an identifier, and it would not depend on the sourceId.