Skip to content

Add support for displaying Spell Points in Tidy5e Sheet#11

Open
CeaneC wants to merge 3 commits intoMary-Usagi:masterfrom
CeaneC:feature/tidy5e-compatibility
Open

Add support for displaying Spell Points in Tidy5e Sheet#11
CeaneC wants to merge 3 commits intoMary-Usagi:masterfrom
CeaneC:feature/tidy5e-compatibility

Conversation

@CeaneC
Copy link
Copy Markdown

@CeaneC CeaneC commented Aug 6, 2022

Adds support for displaying Spell Points as an attribute or a resource in Tidy5e Sheet

Attribute

  • Displays at the end of the header-attributes list, where armour class and initiative are; before the ability scores list.
  • Abbreviated spell points to "SP" to fit with the other abbreviations, but it'll display "Spell Points" when you hover over it.
  • Supports the same spellcasting levels tooltip that the attributes do on the base sheet. Triggers when you hover over any section of the spell points attribute

image

Resource

  • Appends to the end of the resources block
  • Looks a little weird because it's full width on the next row; but squeezing it onto the first row wouldn't be as nice for compatibility with other modules that add resources

image

Other code changes/justifications

  • Move the spellcasting levels tooltip html into its own template so it can be easily reused between the default sheet and the Tidy5e Sheet (and any future ones)
  • Refactored the TEMPLATES model to better support possible future additions of different sheets
  • Made Tidy5e's templates two different files 'cause it's easier to read, instead of trying to get them both into the one handlebars file
  • Used an input element for the maximum spell points value, and set it to disabled to stop people from editing it (it would get overridden when the sheet reloads anyway). Tidy5e's css is set up for input elements, using a span or something else that's static would require us adding new css which I'm trying to avoid for forwards-compatibility

Known Issues

When displaying spell points as a resource, the resource is only visible if:

  • The sheet is unlocked for editing, or
  • A custom resource is already in use

If not, the entire resource block disappears as the locked version of the sheet tidies up unused elements. The cleanup code is called in the renderTidy5eSheet hook
https://github.com/sdenec/tidy5e-sheet/blob/99bf2912400eb860a99042e02e2adfd7f3c7cbb2/src/scripts/tidy5e-sheet.js#L548-L550
https://github.com/sdenec/tidy5e-sheet/blob/99bf2912400eb860a99042e02e2adfd7f3c7cbb2/src/scripts/tidy5e-sheet.js#L298-L304
which is called before renderActorSheet5e. This could be fixed if we could append the spell points resource before/during the renderTidy5eSheet hook.

Closes #10

@daved181
Copy link
Copy Markdown

daved181 commented Jul 1, 2023

When trying to download through the module.json manifest url I get error: An unexpected error occurred when downloading file WILL BE AUTO REPLACED: Invalid URL

Is there another way of downloading this update or is it meant to be merged into dev?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for different character sheets.

2 participants