ironmonk88 / monks-tokenbar

GNU General Public License v3.0
48 stars 44 forks source link

[BUG] TokenBar doesn't load properly when logged in as Gamemaster #522

Open neologiker opened 4 days ago

neologiker commented 4 days ago

Describe the bug In Foundry 12.331 and using D&D 4.0, TokenBar does not load properly. This only happens when logged in as Gamemaster.

The console contains the following error(s):

Error: Error thrown in hooked function 'ready' for hook 'ready'. "dnd5e.disableExperienceTracking" is not a registered game setting
    at Hooks.onError (foundry.js:654:24)
    at #call (foundry.js:636:36)
    at Hooks.callAll (foundry.js:589:17)
    at Game.setupGame (foundry.js:9098:11)
    at async Game._initializeGameView (foundry.js:10432:5)
    at async Game.initialize (foundry.js:8995:5)
Caused by: Error: "dnd5e.disableExperienceTracking" is not a registered game setting
    at #assertKey (foundry.js:3402:42)
    at ClientSettings.get (foundry.js:3334:26)
    at get showXP (dnd5e-rolls.js:69:31)
    at DnD5eRolls.getButtons (base-rolls.js:152:70)
    at new TokenBar (tokenbar.js:97:45)
    at Object.ready [as fn] (monks-tokenbar.js:434:38)
    at #call (foundry.js:632:20)
    at Hooks.callAll (foundry.js:589:17)
    at Game.setupGame (foundry.js:9098:11)
    at async Game._initializeGameView (foundry.js:10432:5)
Error: An error occurred while rendering TokenBar 36. this.buttons is not iterable
    at Hooks.onError (foundry.js:654:24)
    at foundry.js:5795:13
Caused by: TypeError: this.buttons is not iterable
    at TokenBar.activateListeners (tokenbar.js:474:36)
    at TokenBar._render (foundry.js:5867:10)
onError @   foundry.js:655
(anonymous) @   foundry.js:5795
Promise.catch       
render  @   foundry.js:5793
(anonymous) @   tokenbar.js:203
setTimeout      
refresh @   tokenbar.js:200
(anonymous) @   tokenbar.js:16
#call   @   foundry.js:632
call    @   foundry.js:614
#draw   @   foundry.js:25090
Promise.finally     
draw    @   foundry.js:24947
view    @   foundry.js:21369
_onClickScene   @   foundry.js:83527
dispatch    @   jquery.min.js:2
(anonymous) @   jquery.min.js:2

To Reproduce Steps to reproduce the behavior:

  1. Open a world using D&D 4.0 and log in as Gamemaster.
  2. Deactivate all modules. Save/reload.
  3. Activate Monk's TokenBar. Save/reload.
  4. TokenBar will not render and the console contains the first error, above.
  5. Change scenes.
  6. TokenBar will render but you can't interact and the console will contain the second error, above.
  7. Further switching scenes will always reproduce 6.

Expected behavior No errors in console and TokenBar will render and work properly.

Please complete as much of the following information as possible:

Additional context Add any other context about the problem here.

davidR1974 commented 1 day ago

below setting used in showXP() (modules/monks-tokenbar/systems/dnd5e-rolls.js Line 68) has been deprecated to include epic boons levelling mode (so now it's an option box with 3 choices)

    get showXP() {
        return !game.settings.get('dnd5e', 'disableExperienceTracking');
    }
replaced the function with :
    get showXP() {
        return ! (game.settings.get('dnd5e', 'levelingMode') == 'noxp' );
//        return !game.settings.get('dnd5e', 'disableExperienceTracking');
    }
to resume testing .. seems to work like a charm so far...
neologiker commented 1 day ago

below setting used in showXP() (modules/monks-tokenbar/systems/dnd5e-rolls.js Line 68) has been deprecated to include epic boons levelling mode (so now it's an option box with 3 choices)

    get showXP() {
        return !game.settings.get('dnd5e', 'disableExperienceTracking');
    }
replaced the function with :
    get showXP() {
        return ! (game.settings.get('dnd5e', 'levelingMode') == 'noxp' );
//        return !game.settings.get('dnd5e', 'disableExperienceTracking');
    }
to resume testing .. seems to work like a charm so far...

Thanks, seems to work here, just in time for tonight's game!