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

[Bug] Problem in getBestiarySpellLevel #149

Open
xdy opened this issue Nov 3, 2024 · 8 comments
Open

[Bug] Problem in getBestiarySpellLevel #149

xdy opened this issue Nov 3, 2024 · 8 comments

Comments

@xdy
Copy link

xdy commented Nov 3, 2024

Got this last night when playing during a fight with the pcs, a haunt and some geists. Not sure what creature caused the problem as I just quickly patched the code.

2BestiaryTracking.js:356 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'spells')
[Detected 1 package: pf2e-bestiary-tracking(1.1.25)]
    at getBestiarySpellLevel (BestiaryTracking.js:356:31)
    at updateBestiaryData (BestiaryTracking.js:18358:13)

The patch I did was to change line 356 to this, but it's possibly spells should be checked earlier.

if (spells.levels && spells.levels[maxLevel].spells[id]) return maxLevel;

and change 360 to this

if (spells.levels[level]?.spells[id]) {
@WBHarry
Copy link
Owner

WBHarry commented Nov 3, 2024

Heya. You don't happen to know the specific haunt/geists involved?
The fixes you made would stop the errors, but it wouldn't make the functionality in that section of the code actually do what it's supposed to (automatically reveal the spells being cast in the Bestiary).

It seems whichever creatures were present didn't get their spells added to the Bestiary properly 🤔

@xdy
Copy link
Author

xdy commented Nov 17, 2024

Thought I had replied, but, apparently not. It was from Curtain Call book 1, chapter 2, room C2 the Workshop, 4 Geist (from Book of the Dead) and one Mocking Puppets (from Curtain Call). Neither of them have spells, so I don't know how they even got to that part of the code.

@xdy
Copy link
Author

xdy commented Nov 28, 2024

The same thing happened again during another couple of fights in Curtain Call (Ockomlire and Risen Graverobbers) so it might be that actors in that are bad (or were, they might have been updated since I imported book 1).

@WBHarry
Copy link
Owner

WBHarry commented Nov 28, 2024

Hm. Have you by chance added the player characters into the Bestiary? In that case they might be the common denominator here 🤔

@xdy
Copy link
Author

xdy commented Nov 28, 2024

Ah, yes, I have. So, yeah, that's probably it. I guess they'll have to remember things about their partymembers some other way. :)

@WBHarry
Copy link
Owner

WBHarry commented Nov 28, 2024

That, or I have something to fix 😁
It's not really a main intended way for the Bestiary to be used, but since you can add Player Characters into the Bestiary, it shouldn't throw such an error.

If you could export the player characters and toss them my way I could debug the issue.
image

@xdy
Copy link
Author

xdy commented Nov 28, 2024

party.zip

@WBHarry
Copy link
Owner

WBHarry commented Nov 28, 2024

Yup, the error is coming from spellcasting Player Characters. I can reproduce the issue now, so I'll see if I can't fix it 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants