free-beer / black-sword-hack

A FoundryVTT extension that implements The Black Sword Hack RPG.
2 stars 4 forks source link

Bug: Rolling initiative caused by data.stories being null in calculateLevel #12

Closed ScottMaclure closed 1 year ago

ScottMaclure commented 1 year ago

Can see this error when I try and roll initiative for a level 1 character. Rolling for a creature is OK.

shared.js:138 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'stories')
    at calculateLevel (shared.js:138)
    at calculateCharacterData (shared.js:57)
    at combat.js:136
    at Array.map (<anonymous>)
    at BSHCombat._rollCombatantInitiatives (combat.js:129)
    at BSHCombat.rollInitiative (combat.js:50)
    at BSHCombat.rollAll (foundry.js:18708)
    at CombatTracker._onCombatControl (foundry.js:75172)
    at HTMLAnchorElement.<anonymous> (foundry.js:75109)
    at HTMLAnchorElement.dispatch (jquery.min.js:2)

Using Foundry v10 b291, Black Sword Hack 1.1.1

ScottMaclure commented 1 year ago

Example:

image

ScottMaclure commented 1 year ago

Looks like the issue is context.system is used, should be context?

(Edit: It's different, depending on if you're rolling initiative vs opening the character sheet)

image

free-beer commented 1 year ago

Corrected. Will go out in the next release.

ScottMaclure commented 1 year ago

I'll close https://github.com/free-beer/black-sword-hack/pull/13 then