Larkinabout / fvtt-token-action-hud-pf2e

Token Action HUD is a repositionable HUD of actions for a selected token.
10 stars 15 forks source link

PF2 5.4.0, Strike modifier has changed (shows NaN) #84

Closed apoapostolov closed 1 year ago

apoapostolov commented 1 year ago

As simple as the title above, the strike modifier on strikes no longer shows the modifier value in the just-released new core version.

Korwyn commented 1 year ago

seconded, this is happening to me as well

devfinnd commented 1 year ago

thirded, mee too

tsbonev commented 1 year ago

image Started happening after I updated today

Larkinabout commented 1 year ago

Yeah, it'll be a change in PF2e 5.4.0. Will have a look when I have some time.

terrybjr commented 1 year ago

image As a GM when I click on NPC Actors, the above error occurs and the hud does not render.

Korwyn commented 1 year ago

Here is the problem code:

l = i.label.includes(e.api.Utils.i18n("PF2E.MAPAbbreviationLabel").replace(" {penalty}", "")) ? game.system.version < "5.2.0" ? n.totalModifier + parseInt(i.label.split(" ")[1]) : parseInt(i.label.split(" ")[0]) : parseInt(i.label.split(" ")[1])

Minimizing your Javascript just makes it harder to debug. The issue happens when you are splitting your label and comparing game versions. Perhaps the label changed somehow. I am not sure what changed from before. I fixed the appearance on my local version with changing the final parseInt(i.label.split(" ")[1] back to a 0. It tried to find a value in the array which doesn't exist, adds it to the totalModifier and gets NaN as a result.

I changed the final parseInt(i.label.split(" ")[1] to be parseInt(i.label.split(" ")[0]

I am not sure if this breaks on older versions of Foundry. This is what this line of code looks like for me now (just the end changed)

l = i.label.includes(e.api.Utils.i18n("PF2E.MAPAbbreviationLabel").replace(" {penalty}", "")) ? game.system.version < "5.2.0" ? n.totalModifier + parseInt(i.label.split(" ")[1]) : parseInt(i.label.split(" ")[0]) : parseInt(i.label.split(" ")[0])

badgkat commented 1 year ago

Experiencing the same issue

apoapostolov commented 1 year ago

Any chance we can get a fix soon?

biggusbeardus commented 1 year ago

Any update on this bug?

Larkinabout commented 1 year ago

Fixed in Token Action HUD Pathfinder 2 1.4.14.

terrybjr commented 1 year ago

Fixed in Token Action HUD Pathfinder 2 1.4.14.

image image

This issue is still present for creatures.

Larkinabout commented 1 year ago

Ah, yes, they're structured differently... awesome. I'll have a look to see if it's possible to not use the label as it relies too much on it being and staying consistent. If not, I might dump the feature as it's probably not doing much anymore with PF2e showing the calculated modifier by default now.

terrybjr commented 1 year ago

Ah, yes, they're structured differently... awesome. I'll have a look to see if it's possible to not use the label as it relies too much on it being and staying consistent. If not, I might dump the feature as it's probably not doing much anymore with PF2e showing the calculated modifier by default now.

Appreciate the work that you do.

Larkinabout commented 1 year ago

Fixed in Token Action HUD Pathfinder 2 1.4.15 (hopefully). Label is still used as trying to get the modifier elsewhere is convoluted.

terrybjr commented 1 year ago

Fixed in Token Action HUD Pathfinder 2 1.4.15 (hopefully). Label is still used as trying to get the modifier elsewhere is convoluted.

Confirmed, Fixed!

Thanks! image