death-save / combat-utility-belt

Combat Utility Belt module for Foundry Virtual Tabletop
https://deathsave.dev
GNU General Public License v3.0
53 stars 58 forks source link

Award XP not working with PF2e #638

Open geoidesic opened 2 years ago

geoidesic commented 2 years ago

Hey there,

I have 0.8.9 installed and the latest version of CUB and award XP is no longer working with the following error in the inpsector:

give-xp.js:169 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'data') at give-xp.js:169 at Array.reduce () at Function._distributeXP (give-xp.js:169) at Object.callback (give-xp.js:87) at Dialog.submit (foundry.js:20673) at Dialog._onClickButton (foundry.js:20636) at HTMLButtonElement.dispatch (jquery.min.js:2) at HTMLButtonElement.v.handle (jquery.min.js:2)

I tried this with all other modules disabled

eclarke12 commented 2 years ago

Hey @geoidesic once you update to Foundry v9 please let me know if this continues to occur as I'm no longer working on 0.8.9 releases.

kinland commented 2 years ago

I'm not 100% sure it's the same issue, but it's similar enough that it might as well be a dupe (given how vague the original report was about resulting behavior, other than it didn't work. Maybe they changed a null to undefined in 0.8.9 and then renamed data to value in 0.9?). This seems the most relevant place to report it.

It seems to be showing players/monsters at the award xp screen like expected, but nothing really happens because it thinks all monsters are 0xp.

image

If I start a mock encounter, mark an enemy as defeated, end combat, and go to award xp, and then make sure both players and enemies were properly toggled, it shows 0xp total, and i click end combat, and then the encounter won't properly end. Then I see this in the console:

give-xp.js:169 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'value')
    at give-xp.js:169:117
    at Array.reduce (<anonymous>)
    at GiveXP._distributeXP (give-xp.js:169:51)
    at Object.callback (give-xp.js:87:44)
    at Dialog.submit (foundry.js:44156:35)
    at Dialog._onClickButton (foundry.js:44119:10)
    at HTMLButtonElement.dispatch (jquery.min.js:2:43064)
    at v.handle (jquery.min.js:2:41048)

image image Tested in a fresh Pathfinder 2E world with no other modules enabled and default settings except for ones related to awarding XP. Couldn't find a way to override the xp values (i.e. a text box, etc)

eclarke12 commented 2 years ago

@dhorkin most likely the PF2e system changed where XP values are stored. I will review during the next CUB update.