Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature user definable HTML pop up stat sheet #4084

Merged

Conversation

cwisniew
Copy link
Member

@cwisniew cwisniew commented May 25, 2023

Identify the Bug or Feature request

resolves #1424
resolves #3149

I know it shouldn't be a two for one but they are quite connected.

Description of the Change

This change adds the ability for users to create pop up stat sheets that can be defined using HTML, CSS, JavaScript.
As part of this change the Campaign Dialog Token Properties has also been revamped an no longer requires several sanity roll checks when trying to update token properties.

Apologies in advance for anyone reviewing this as there are a lot of changes to make this all work.

  • Campaign token property dialog
  • Ability to easily rename / delete token property types
  • Every Campaign no longer requires the "Basic" token property type
  • MapTool "internal" overlays that can not be interacted with via macros
  • New Stat Sheets can appear in any corner or centred along any edge
  • CSS generated based on current theme
  • Support for built in "add-ons" (to serve above CSS via lib:// urls, and eventually built in stat sheet)
  • Utility class for processing handlebars templates (for theme reactive CSS and stat sheets)
  • Ability to define stat sheet to use and location at property type level
  • Ability to override default stat sheet and location for property for each token (changes to token edit dialog)
  • Token Property Type has been added to copy/createToken macros
  • Reusable table cell renderer that allows user to edit string in text field or push the "..." button to edit in macro/html editor
  • Add Token Property Type selection to the new token dialog.
  • Two new events added to event bus for when mouse starts and stops hovering over a token
  • GMs can still use the legacy stat sheet should they want to

Possible Drawbacks

I dread to think what people may not like about this :)

Documentation Notes

Stat sheets can be defined in an add-on.
See https://github.com/cwisniew/MT-test-stat-sheet for an example really simple stat sheet add on and more details on how to define stat sheets.

Update Campaign Property : Token Properties screen
CleanShot 2023-05-25 at 20 11 24@2x
Its now easier to add property types, delete property types and rename them (in the name text field when selected). There is also the ability to set any token property type as the default (needed as you can now delete or rename "Basic"). Note its not possible to delete the default token property type, you would have to make another property type the default before deleting it. There are also check boxes for all of the different options for stats appearing on the stat sheet, so it no longer a text input looks like you are swearing at your token properties.

![CCleanShot 2023-05-25 at 20 12 17@2x
Default values can be edited in the table if they are simple values, or if more complicated then the '...' button can be used to open an editor.
CleanShot 2023-05-25 at 20 12 59@2x

Look Ma... No Basic...
CleanShot 2023-05-25 at 20 15 05@2x

Setting at the token property type level
CleanShot 2023-05-25 at 20 17 25@2x

An example of the basic no frills stat sheet from the above example repo
CleanShot 2023-05-25 at 20 29 47@2x

Using a different theme
CleanShot 2023-05-25 at 20 32 36@2x

The new token dialog has been modified to include property type and stat sheet details
CleanShot 2023-05-25 at 20 18 00@2x

Edit Token Dialog
CleanShot 2023-05-25 at 20 37 19@2x

Stat Sheet pop up at top left
CleanShot 2023-05-25 at 20 38 16@2x

Release Notes


This change is Reviewable

@cwisniew cwisniew changed the title Feature stat sheet overlay dev merge Feature user definable HTML pop stat sheet May 25, 2023
@cwisniew cwisniew added the feature Adding functionality that adds value label May 25, 2023
@thelsing
Copy link
Collaborator

This PR is too big for me to review. Maybe you can split it up into some more manageable chunks?

@cwisniew
Copy link
Member Author

This PR is too big for me to review. Maybe you can split it up into some more manageable chunks?

I will try but you will have to keep in mind when doing the review that if something is added but not used yet it is probably because it's in the next PR. :)

@cwisniew
Copy link
Member Author

cwisniew commented May 31, 2023

This PR is too big for me to review. Maybe you can split it up into some more manageable chunks?

I will try but you will have to keep in mind when doing the review that if something is added but not used yet it is probably because it's in the next PR. :)

actually, I take that back, since develop had to be merged into this branch along the way because of conflicts being created, that would create a bunch of PRs harder to review :( open to other ideas of how we can tackle it though

* @return The notes of the token.
*/
public String getNotes() {
return notes;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we StringUtil.htmlize the noted to account for the different possible note types possible?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated getNotes and getGMNotes to return HTML

*
* @param zone the zone for the event.
*/
public record TokenHoverExit(Zone zone) {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have the same members as TokenHoverEnter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added information to match TokenHoverEnter event.

* @param to the name to rename to.
*/
public record RenamePropertyType(@Nonnull String from, @Nonnull String to) {}
;
Copy link
Collaborator

@thelsing thelsing Jun 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

; Not needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed stray semi colon

@thelsing
Copy link
Collaborator

thelsing commented Jun 2, 2023

Another thing to consider: Maybe we should run the notes and tokennotes through the template engine? That way we could add Statblocks containing token properties as notes.

@cwisniew
Copy link
Member Author

cwisniew commented Jun 5, 2023

Another thing to consider: Maybe we should run the notes and tokennotes through the template engine? That way we could add Statblocks containing token properties as notes.

Isn't that what the HTML stat sheet is though the token stat block? Or do you have other ideas outside of just the stat sheet?

@thelsing
Copy link
Collaborator

thelsing commented Jun 5, 2023

Another thing to consider: Maybe we should run the notes and tokennotes through the template engine? That way we could add Statblocks containing token properties as notes.

Isn't that what the HTML stat sheet is though the token stat block? Or do you have other ideas outside of just the stat sheet?

I'm thinking i things like tracking the number of arrows or usages of an item in a property and us this property to fill the values of an inventory that is kept as a text in the token notes.

@cwisniew cwisniew added this pull request to the merge queue Jun 8, 2023
Merged via the queue into RPTools:develop with commit 041bd4e Jun 8, 2023
@cwisniew cwisniew changed the title Feature user definable HTML pop stat sheet Feature user definable HTML pop up stat sheet Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding functionality that adds value
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

[UI Update]: Campaign settings - Token properties Configurable HTML5 Replacement for mouse over stat sheets
2 participants