Larkinabout / fvtt-custom-dnd5e

11 stars 6 forks source link

[BUG] Same Key on Character and NPC Counter #24

Closed Larkinabout closed 6 months ago

Larkinabout commented 6 months ago

Describe the bug

  1. There is currently no validation for counter keys to check whether it already exists. If this happens, it will cause breaking errors.
  2. It would be useful to allow a character counter and an NPC counter to share a key where the function of the counter is the same, for example, an Exhaustion counter for both characters and NPCs.

Fix for 1. is to validate key against existing keys when the user clicks Save and Close and stop the form submission if the key is the same as an existing key. Fix for 2. is to allow duplicate keys across character and NPC counters and either add the actor type to the field name in the counters form or handle the arrays created.

Steps to reproduce

  1. Edit the key for a character counter
  2. Edit the key for an NPC counter to be the same key
  3. See error

Versions:

Larkinabout commented 6 months ago

Fixed in 0.7.2.