pafvel / dragonbane

Other
11 stars 6 forks source link

Error when clicking [[/damage ...]] links from item sheet #22

Closed aniki21 closed 8 months ago

aniki21 commented 8 months ago

I've been adding the new Kin from the Bestiary into my own World, but although the enricher correctly renders the link from [[/damage 2D6 bludgeoning]], clicking the button causes an error:

Uncaught (in promise) Error: undefined. Roll.safeEval produced a non-numeric result from expression ""
[No packages detected]
    at DoDRoll.safeEval (foundry.js:10378:13)
    at DoDRoll._evaluateTotal (foundry.js:10283:36)
    at DoDRoll._evaluate (foundry.js:10231:24)
    at DoDRoll.evaluate (foundry.js:10191:25)
    at DoDRoll.toMessage (foundry.js:10872:40)
    at HTMLAnchorElement._onClickInlineRoll (foundry.js:66333:17)
    at HTMLBodyElement.dispatch (jquery.min.js:2:43184)
    at y.handle (jquery.min.js:2:41168)

This appears to be because there's no .inline-damage-roll listener activated for the Item Sheet - modifying the file locally, I added an import for the DoDChat class, and copied the listener from other sheets, and it now works as expected.

// systems/dragonbane/modules/item-sheet.js

import * as DoDChat from './chat.js'

// ...

  activateListeners(html) {
    if (this.object.isOwner) {
      // ...
     }
    html.on('click', '.inline-damage-roll', DoDChat.onInlineDamageRoll)
    super.activateListeners(html)
  }

// ...
pafvel commented 8 months ago

Fixed in https://github.com/pafvel/dragonbane/commit/00fb142fd382f06a1cf998d7c2c421a3b5642640

Thanks for the report!