SobranDM / foundryvtt-wwn

GNU General Public License v3.0
12 stars 18 forks source link

Clicking on instinct not showing anything when the roll fails (not even the failed roll) #64

Closed mascarenhas closed 1 year ago

mascarenhas commented 1 year ago

Instinct rolls for monsters are only showing up when they succeed. If the instinct roll fails there is no feedback, just nothing shows up in the chat. Is this happening for someone else?

Version 1.1.4 of the module (started with 1.0.0 on Foundry v9, upgraded to Foundry v10 after upgrading to 1.1.0). Tried both with monsters that had already been created pre-upgrade, and with new monsters, same result.

Screenshot shows my list of modules:

image

Let me know if this is a bug or something might be borked with my install, I can try to contribute a fix! I would like to start using instinct more, and having the automation so the instinct result would show up when it fails would be a great help for this.

mascarenhas commented 1 year ago

Doh, forgot to also check devtools, here is the error message when the instinct roll fails:

dice.js:50 Uncaught (in promise) TypeError: undefined. Cannot read properties of undefined (reading 'details')
[Detected 1 package: system:wwn]
    at WwnDice.digestResult (dice.js:50:38)
    at WwnDice.sendRoll (dice.js:112:35)
    at Object.callback (dice.js:375:23)
    at Dialog.submit (foundry.js:56403:37)
    at Dialog._onClickButton (foundry.js:56332:10)
    at HTMLButtonElement.dispatch (jquery.min.js:2:43064)
    at y.handle (jquery.min.js:2:41048)
digestResult @ dice.js:50
sendRoll @ dice.js:112
callback @ dice.js:375
submit @ foundry.js:56403
_onClickButton @ foundry.js:56332
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2
mascarenhas commented 1 year ago

Looks like the issue is that the system object of the actor is being passed to the roller at https://github.com/SobranDM/foundryvtt-wwn/blob/f71d03a461b51d4382121e89e916cb41bed8af6f/module/actor/entity.js#L263 as data.actor, but the roller is trying to get the system object again at https://github.com/SobranDM/foundryvtt-wwn/blob/f71d03a461b51d4382121e89e916cb41bed8af6f/module/dice.js#L50 (so gives undefined).

mascarenhas commented 1 year ago

I opened a PR that should fix it! And thanks for all the work put into this module!