mr-ice / maptool-macros

place for maptool macros
2 stars 3 forks source link

Give dnd5e_Conditions the ability to call back to a macro #301

Open trey-kirk-sp opened 3 years ago

trey-kirk-sp commented 3 years ago

Attack Editor uses this pattern:

  1. [some launcher macro sets themselves as the call-back and an object to modify] launches dnd5e_AttackEditor.
  2. Attack Editor invokes the processor on submit
  3. The processor handles the recombobulation of the form and launches the call-back with an updated version of the original object.
  4. The original launcher macro is called to do whatever it wants to do with that object

For the Character Sheet, this model works out well as the Char Sheet can invoke the Attack Editor with the Char Sheet launcher macro as the call back. The AE processor returns to the CharSheet callback launcher. All that launcher does is send the updated details to AE's native handler macro to take care of the CRUD operations. Then the launcher refreshes the CharSheet page.

CharSheet is also leveraging dnd5e_Conditions which doesn't use this same pattern. So right now the user has to manually refresh the sheet after setting conditions.