MonsterBlocks icon indicating copy to clipboard operation
MonsterBlocks copied to clipboard

add support for dnd5e v3 and foundry v12

Open erizocosmico opened this issue 1 year ago • 13 comments

This PR along with this one adds support for dnd5e system v3 and foundry v12.

  • _onItemCreate has been removed, so I had to add a custom handler.
  • All other handlers for skills, saves, etc weren't working either, so I added custom handlers as well. Not sure if it's the best approach, but couldn't get it to work otherwise and didn't see any methods from the base 5e sheet that could be used for this.
  • I had to add a getLanguageChecklist method, because the shape of CONFIG.DND5E.languages has changed. It does not have a label (but the others such as damage, conditions, etc, do) and it can contain children for subgroups.
  • dnd5e v3 enrichers seem to be working fine just by calling TextEditor.enrichHTML asynchronously in getData.
  • I updated some calls to mergeObject and flattenObjects to avoid deprecation warnings.

As far as I can tell everything I tested seems to be working now correctly in foundry v12.328 and dnd5e v3.2.1.

erizocosmico avatar Jul 07 '24 10:07 erizocosmico

Not sure if it's meant to be backwards-compatible with foundry v11, but this update creates errors with the average damage listed (which appears in Foundry as "rollMax.evaluateSync is not a function"). in scripts/dnd5e/MonsterBlock5e.js changing from rollMax.evaluateSync back to rollMax.evaluate and rollMin.evaluateSync back to rollMin.evaluate removes the error and seems to create no other issues. (I rarely use Github and couldn't find another way to comment on this. Sorry if it's in an incorrect/inconvenient place!)

n-costello avatar Jul 08 '24 18:07 n-costello

Thanks @erizocosmico! I'll try to review this soon.

@n-costello Thanks for the feedback, I'll make sure to investigate that when I get a chance to review this.

I would not be surprised if the v12 version of Monster Blocks isn't backward compatible. If this is the case, my intent would be to finish fixes to make it compatible with v11, make a final release for v11, then incorporate the changes for v12.

zeel01 avatar Jul 08 '24 18:07 zeel01

If it's just the evaluateSync that's not backwards compatible we could call one or the other depending on the Foundry version. For v12 there's really no other way to do it, as evaluate is now async. Other than that I don't think there are any changes that can't work in v11, TextEditor.enrichHTML was already async in v11 if async: false is not passed, so it should be fine.

erizocosmico avatar Jul 08 '24 18:07 erizocosmico

I just added another commit that uses evaluate when evaluateSync does not exist. That should do it for compatibility with v11.

erizocosmico avatar Jul 08 '24 18:07 erizocosmico

So, what's the holdup?

There are now 6 open pull request, how can a fellow dev help out so they get merged?

DerJJ avatar Jul 10 '24 09:07 DerJJ

@DerJJ if you (or someone else) are in a hurry you can install this zip manually for the time being

erizocosmico avatar Jul 10 '24 09:07 erizocosmico

I can confirm in v12 everything works, With the latest fix of evalute for v11 i still got errors. After using the zip i got this error @zeel01 @erizocosmico image In the average damage it appears 0. Everything is clickable and still works, though it keeps appear the same error every time you open the monsterblock or you click somthing in the menu.

kontokontovtt avatar Jul 11 '24 00:07 kontokontovtt

@kontokontovtt I just made an update, evaluate also needed to be passed async: false in v11 to be sync. I updated the zip as well. I don't have a v11 installation to test on, but I'm almost certain that should do it

erizocosmico avatar Jul 11 '24 09:07 erizocosmico

@erizocosmico I can confirm that everything is working as intended with the latest change in v11 I have to say that only the description is not working but this fix is already solved from another PR #226

kontokontovtt avatar Jul 11 '24 13:07 kontokontovtt

@kontokontovtt yup, since I saw another pr opened for that I didn't fix it in this one

erizocosmico avatar Jul 11 '24 13:07 erizocosmico

I just tested in v4.0.0 of DnD5e and it's broken

erizocosmico avatar Sep 14 '24 13:09 erizocosmico

Is there any ETA or at least an indication that someone is working on v4.x.x support for this module? The use of MonsterBlocks is personally critical for me and i am in favor of it through all available sheets.

kontokontovtt avatar Sep 29 '24 11:09 kontokontovtt

I'm not working on v4 support. There are a lot of breaking changes in v4. I gave it a try, but gave up

erizocosmico avatar Sep 29 '24 12:09 erizocosmico