espositos / fvtt-tokenactionhud

Creating a token action HUD module for Foundry VTT
31 stars 38 forks source link

Token Action HUD - 0.8.5 Fix #233

Closed yahavatar closed 3 years ago

yahavatar commented 3 years ago

I got the module to work... Made the following changes. Lines numbers are approximate. Can't be 100% sure as there might have been blank lines that got deleted. The testing is not exhaustive, but I've been able to restore most all functionality that I was missing and I see no errors in the console anymore.

dnd5e-actions.js: line 260 was: let prep = s.data.preparation.mode; line 260 now: let prep = s.data.data.preparation.mode;

line 367 was: const activationType = f.data.activation.type; line 367 now: const activationType = f.data.data.activation.type;

line 560 was: const effects = actor.effects.entries; line 560 now: const effects = actor.effects;

line 621 was: const cssClass = actor.effects.entries.some(e => e.data.flags.core?.statusId === c.id) ? 'active' : ''; line 621 now: const cssClass = actor.effects.some(e => e.data.flags.core?.statusId === c.id) ? 'active' : '';

line 832 was: result = spells.filter(i => i.data.preparation.prepared || nonpreparableSpells.includes(i.data.preparation.mode) || i.data.level === 0) line 832 now: result = spells.filter(i => i.data.data.preparation.prepared || nonpreparableSpells.includes(i.data.data.preparation.mode) || i.data.data.level === 0)

line 834 was: result = spells.filter(i => i.data.preparation.prepared); line 834 now: result = spells.filter(i => i.data.data.preparation.prepared);

I do hope this helps a little. yah.

espositos commented 3 years ago

That's amazing, thank you. Sorry, I've had no time to look into it. Really appreciate it!

yahavatar commented 3 years ago

espositos, no problem. Please be aware that I'm not that familiar with all of the details of your code and did the best I could to get it working. I don't think my fixes are 100% stable, but they might be a start.

Thanks you so much for the work you have done! yah.

espositos commented 3 years ago

No, it's great just having an idea of what has changed.

espositos commented 3 years ago

I have pushed a patch based on your changes. If it's not working, let me know.

yahavatar commented 3 years ago

Unfortunately, I am seeing a few different errors now. It looks like it kind of works for creatures, but errors out on dnd5e-actions.js on line 633 then 851. Sorry if I'm creating issues for you...

yah.

Battenhatch commented 3 years ago

I'm seeing failure to work for actors with a spell list, which this error message seems to indicate also:

dnd5e-actions.js:853 Uncaught (in promise) ReferenceError: getData is not defined at dnd5e-actions.js:853 at Array.filter () at ActionHandler5e._filterNonpreparedSpells (dnd5e-actions.js:853) at ActionHandler5e._getSpellsList (dnd5e-actions.js:199) at ActionHandler5e.doBuildActionList (dnd5e-actions.js:45) at ActionHandler5e.buildActionList (actionHandler.js:32) at TokenActionHUD.updateHud (tokenactionhud.js:386)

Battenhatch commented 3 years ago

When enabling "Show Conditions Category", HUD stops working alltogether, and throws this errror:

Uncaught (in promise) TypeError: actor.effects.entries.some is not a function at dnd5e-actions.js:633 at Array.forEach () at ActionHandler5e._addConditionsSubcategory (dnd5e-actions.js:629) at ActionHandler5e._getConditionsList (dnd5e-actions.js:559) at ActionHandler5e.doBuildActionList (dnd5e-actions.js:40) at ActionHandler5e.buildActionList (actionHandler.js:32) at TokenActionHUD.updateHud (tokenactionhud.js:386)