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

Cannot create property 'value' on number '0' #185

Closed
DFreds opened this issue Oct 16, 2021 · 3 comments
Closed

Cannot create property 'value' on number '0' #185

DFreds opened this issue Oct 16, 2021 · 3 comments

Comments

@DFreds
Copy link

DFreds commented Oct 16, 2021

Hey, not sure if you knew this, but I utilize this module in my own module (DFreds Pocket Change) to provide some easy looting mechanisms. After the latest update, I see this:

foundry.js:2013 TypeError: Cannot create property 'value' on number '0'
[Detected 1 package: lootsheetnpc5e]
    at LootSheet5eNPC._prepareGMSettings (lootsheetnpc5e.js:1188)
    at LootSheet5eNPC.getData (lootsheetnpc5e.js:141)
    at LootSheet5eNPC._render (foundry.js:2049)
    at B.🎁call_wrapped [as call_wrapped] (libWrapper-wrapper.js:466)
    at LootSheet5eNPC.🎁Application.prototype._render#lib-wrapper (listeners.js:110)
    at LootSheet5eNPC.🎁Application.prototype._render#0 (libWrapper-wrapper.js:161)
    at LootSheet5eNPC._render (foundry.js:2736)
    at LootSheet5eNPC.render (foundry.js:2011)
    at LootSheet5eNPC.render (foundry.js:3231)
    at Token5e._onClickLeft2 (foundry.js:46090)
    at MouseInteractionManager.callback (foundry.js:35929)
    at MouseInteractionManager._handleClickLeft2 (foundry.js:36133)
    at MouseInteractionManager._handleMouseDown (foundry.js:36095)
    at Token5e.a.emit (index.js:181)
    at r.dispatchEvent (interaction.min.js:8)
    at r.processPointerDown (interaction.min.js:8)
    at t.recursiveFindHit (interaction.min.js:8)
    at t.recursiveFindHit (interaction.min.js:8)
    at t.recursiveFindHit (interaction.min.js:8)
    at t.recursiveFindHit (interaction.min.js:8)
    at t.findHit (interaction.min.js:8)
    at r.processInteractive (interaction.min.js:8)
    at r.onPointerDown (interaction.min.js:8)

It seems to relate to still using .value here, but I'm not totally sure: 3.1.0...3.2.0#diff-5801441f493a61e4a2a4ed4da9367f5c482b5d14b27cd4ae367834a02f9d21b3R1185

I manually removed all the uses of .value in the above method, which causes the error to stop occurring. However, the currency is then not displayed on the loot sheet.

Steps to Reproduce

  1. Install libWrapper, LootSheetNpc5e, and DFreds Pocket Change and activate them in a new world
  2. Drop an NPC (such as acolyte) onto the canvas (observe that the console log says (dfreds-pocket-change | Generating treasure)
  3. Convert that actor to a lootable (via Convert Selected Tokens to Loot macro included with pocket change)
  4. Attempt to open that NPC's sheet and observe error in console

I don't know if this helps at all, but here is the code for converting to a lootable sheet: https://github.com/DFreds/dfreds-pocket-change/blob/main/scripts/pocket-change.js#L197

I used to account for the .value here but that seems like it should be unnecessary now.

@flamewave000
Copy link
Contributor

@DFreds I've just pushed a currency fix PR. If you happen to have a chance, try pulling my fork and see if it fixes your issue.
https://github.com/flamewave000/fvtt-loot-sheet-npc-5e

@jopeek
Copy link
Owner

jopeek commented Oct 19, 2021

Try 3.2.2 and let us know if that solved it.

@DFreds
Copy link
Author

DFreds commented Oct 19, 2021

Looks fixed to me. Thanks!

@DFreds DFreds closed this as completed Oct 19, 2021
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

3 participants