Larkinabout / fvtt-custom-dnd5e

11 stars 7 forks source link

[BUG] Use the abbreviation, not a random ID, as the object key when adding to `CONFIG.DND5E` #133

Closed kaelad02 closed 1 week ago

kaelad02 commented 4 weeks ago

Describe the bug

It might happen for other things, but I experienced this when adding a new Item Property. Go through the process of adding a new Item Property. In this example, it was called Holy. I also set the abbreviation to "holy" and checked the Item Types box for Weapon. Editing an weapon to add the Holy property worked as expected. I then tried to use the system's Enchantment feature to create a feature that enchants a weapon to make it Holy. When creating the active effect, adding a property is done with the following change:

system.properties | Add | holy

The effect's value is supposed to be the object key that's in CONFIG.DND5E.itemProperties. I expected the module to use the abbreviation it gave me, but it didn't. Instead, it added an entry with a random ID.

image

If I wanted to create an Enchantment to add the Holy property, I'd have to use the console to look up this random ID instead of being able to use the abbreviation I set. Can the module be changed to use the abbreviation instead of generating a random ID?

Module Data

Go into the module's settings, open up the Debug Settings menu, click Export Data, save and attach the file here.

custom-dnd5e.json

Versions:

Additional context I have helped people on Discord with this before. I can't remember exactly which other config items it happened with, but the latest was Item Properties. If it happens with this one, I suspect it happens with others as well.

Larkinabout commented 4 weeks ago

Yeah, it's a little annoying that the system has to use those keys everywhere and expect users to know them instead of using the label or abbreviation. For instance, how would you know to use 'mgc' just as much as a random ID?

Anyway, I'll surface the key itself on the form, so users can set it to something else.

kaelad02 commented 4 weeks ago

Probably worth looking for all uses of randomID or foundry.utils.randomID and change them. I'm remembering now you fixed it for new ability scores, but IMHO would be worth a pass to make the change everywhere.

FWIW, the keys are documented on the system's wiki in the Active Effects and Roll Data pages.

Larkinabout commented 1 week ago

Added in 1.2.0.