MaterialFoundry / MaterialDeck

41 stars 20 forks source link

[BUG] unable to utilize Spellbook type Token on Stream Deck, getting TypeError: undefined. spellcastingEntries.forEach is not a function in pf2e.js #115

Closed churney-unity closed 6 months ago

churney-unity commented 1 year ago

Setup

Describe the bug Unable to use Spellbok Mode - I have tried with multiple tokens, including a Bard, as well as Ezren imported from the beginner box from testing, but get the same console errors with both on load, and when clicking on the button on my SD. I am by no means fluent in JS, but I did try saving a copy of pf2e.js and modifying line 468 to Object.keys(spellcastingEntries).forEach(spellCastingEntry => { however this threw an undefined error on line 470.

Screenshots image

Console Log


pf2e.js:468
Uncaught (in promise) TypeError: undefined. spellcastingEntries.forEach is not a function [Detected 1 package: MaterialDeck] at pf2e.buildSpellData (pf2e.js:468:29) at pf2e.getSpellData (pf2e.js:501:57) at pf2e.getSpells (pf2e.js:519:30) at TokenHelper.getSpells (tokenHelper.js:398:28) at TokenControl.pushData (token.js:395:41) at TokenControl.update (token.js:18:28)
  | buildSpellData | @ | pf2e.js:468 -- | -- | -- | --   | getSpellData | @ | pf2e.js:501   | getSpells | @ | pf2e.js:519   | getSpells | @ | tokenHelper.js:398   | pushData | @ | token.js:395   | update | @ | token.js:18   | await in update (async) |   |     | (anonymous) | @ | MaterialDeck.js:623   | #call | @ | foundry.js:730   | callAll | @ | foundry.js:687   | _render | @ | foundry.js:5855   | await in _render (async) |   |     | _render | @ | foundry.js:6532   | (anonymous) | @ | pf2e.mjs:1403   | maintainFocusInRender | @ | pf2e.mjs:1350   | _render | @ | pf2e.mjs:1403   | render | @ | foundry.js:5769   | render | @ | foundry.js:7111   | _onClickLeft2 | @ | foundry.js:56272   | callback | @ | foundry.js:31766   | #handleClickLeft2 | @ | foundry.js:31971   | #handleMouseDown | @ | foundry.js:31938   | notifyListeners | @ | earcut.js:128   | notifyTarget | @ | earcut.js:128   | propagate | @ | earcut.js:128   | dispatchEvent | @ | earcut.js:128   | mapPointerDown | @ | earcut.js:128   | mapEvent | @ | earcut.js:128   | onPointerDown | @ | earcut.js:128

Additional context Add any other context about the problem here.

MaterialFoundry commented 1 year ago

I'm able to reproduce this. It looks like something changed in the pf2e code so it no longer functions properly. I'll take a look at it for the next update.

RHeynsZa commented 10 months ago

Bumping this, same issue

MaterialFoundry commented 6 months ago

This should be fixed in the latest version