add support for dnd5e v3 and foundry v12
This PR along with this one adds support for dnd5e system v3 and foundry v12.
_onItemCreatehas 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
getLanguageChecklistmethod, because the shape ofCONFIG.DND5E.languageshas changed. It does not have a label (but the others such as damage, conditions, etc, do) and it can containchildrenfor subgroups. - dnd5e v3 enrichers seem to be working fine just by calling
TextEditor.enrichHTMLasynchronously ingetData. - I updated some calls to
mergeObjectandflattenObjectsto 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.
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!)
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.
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.
I just added another commit that uses evaluate when evaluateSync does not exist. That should do it for compatibility with v11.
So, what's the holdup?
There are now 6 open pull request, how can a fellow dev help out so they get merged?
@DerJJ if you (or someone else) are in a hurry you can install this zip manually for the time being
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
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 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 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 yup, since I saw another pr opened for that I didn't fix it in this one
I just tested in v4.0.0 of DnD5e and it's broken
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.
I'm not working on v4 support. There are a lot of breaking changes in v4. I gave it a try, but gave up