shemetz / roll-from-compendium

FoundryVTT module that adds easy buttons to post things to chat.
MIT License
5 stars 2 forks source link

Module doesn't work in Pathfinder 2e #5

Closed shemetz closed 2 years ago

shemetz commented 3 years ago

Basic bug: stuff like Actions can't be rolled from compendiums because rolling them from an actor fails due to:

main.bundle.js:formatted:5661 Uncaught (in promise) TypeError: Cannot read property 'roll' of null
    at CRBStyleCharacterActorSheetPF2E._onItemRoll (main.bundle.js:formatted:5661)
    at rollItem (VM420 roll-from-compendium.js:65)

This can be manually fixed by just calling item.roll() for all items, instead of assigning them to actors. However, trying a more complicated solution -- and trying to cast spells at all - also doesn't work, because of another bug.

main.bundle.js:formatted:1392 Uncaught (in promise) TypeError: Cannot read property 'value' of undefined
    at PF2ESpell.getChatData (main.bundle.js:formatted:1392)
    at PF2ESpell.roll (main.bundle.js:formatted:1366)
    at eval (eval at rollItem (VM420 roll-from-compendium.js:51), <anonymous>:1:29)

It looks like PF2e spells call _spellChatData() which checks spellcastingEntry = this.actor.getOwnedItem(data.location.value);; my guess is that Pathfinder spells are not just stored in the items list but have a "parent" item of sort, called Spellcasting Entry, that represents the source of magic or group of spells.

image

shemetz commented 2 years ago

Partially improved in v1.1.3.

shemetz commented 2 years ago

Fixed in v1.2.0.