jacobwojoski / dice-stats

A Module for Foundry VTT that tracks and displays dice stats
MIT License
7 stars 6 forks source link

Error in saveRoll() with Midi-QOL #120

Closed SagaTympana closed 6 months ago

SagaTympana commented 6 months ago

Whenever I make a roll in DND5E with Midi-QOL, I get the following error:

Foundry.js:753 TypeError: undefined. Cannot read properties of undefined (reading 'length') [Detected 2 packages: dice-stats, midi-qol] at PLAYER.saveRoll (dice-stats-player.js:96:55) at dice-stats-main.js:264:24 at Array.forEach (<anonymous>) at DiceStatsTracker.addRoll (dice-stats-main.js:263:15) at Object.fn (dice-stats-hooks.js:36:38) at hookCall (utils.js:4863:16) at asyncHooksCallAll (utils.js:4815:10) at Workflow.WorkflowState_RollFinished (workflow.js:1513:9) at async Workflow.performState (workflow.js:478:21)

It looks like saveRoll expects a single argument, msgRollInfo, but where it's being called from the Midi hook, it's being passed in three arguments.

Unrelated to this issue, I noticed in the readme for the module that when merged cards are enabled in Midi, you have to do some hacks to try to guess at the user who actually made the roll that aren't reliable. I don't know if the Midi workflow has changed since you last looked into this or if I'm just misunderstanding what's required, but it seems like workflow.chatCard.user will give you the user who made the roll, and workflow.chatCard.user._id could be sent in to addRoll as the owner.

jacobwojoski commented 6 months ago

Damn, forgot to update the midi qol support when I did the refactoring. Will be fixed in next release

jacobwojoski commented 6 months ago

Should be fixed with 1.18.1 release. Let me know if your still seeing an issue after updating