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

🐞 Encounter XP is 0 with more than one player in pf2e & dnd5e #291

Open
3 of 7 tasks
Trantion897 opened this issue Jul 22, 2024 · 1 comment · May be fixed by #299
Open
3 of 7 tasks

🐞 Encounter XP is 0 with more than one player in pf2e & dnd5e #291

Trantion897 opened this issue Jul 22, 2024 · 1 comment · May be fixed by #299

Comments

@Trantion897
Copy link

Trantion897 commented Jul 22, 2024

Check for existing bug reports before submitting.

  • I searched for existing Bug Reports and found no similar reports.

Expected Behavior

Encounter XP should be non-zero (affects both inline encounter builder and side panel)

Current behaviour

Encounter XP is missing, summarised as "Trivial"
image

Reproduction

  1. Using a vault with Initiative Tracker set up (I found the bug using Pathfinder settings, but get the same with D&D settings)
  2. Set a default party with at least two characters (alternatively, add the characters directly to the encounter)
  3. Create an encounter with any number of enemies
  4. View the encounter inline - XP is missing
  5. Start the encounter - XP gauge is empty

Which Operating Systems are you using?

  • Android
  • iPhone/iPad
  • Linux
  • macOS
  • Windows

Obsidian Version Check

1.6.7 and 1.5.3

Plugin Version

13.0.12

Confirmation

  • I have disabled all other plugins and the issue still persists.

Possible solution

I debugged the plugin and found that the playerLevels parameter being passed to getCreatureDifficulty() in src/utils/rpg-system/pf2e.ts is an array of strings, so line 89 concatenates instead of adding, so after dividing by the number of PCs we get an invalid array index for return XP_CREATURE_DIFFERENCES[creature_differences] ?? 0;.

I made a quick fix to get it working for me (only for Pathfinder), but I think the root cause will be a change that's caused the playerLevels to be an array of strings, because I think this worked some time before. I haven't looked into where that array is coming from, or which version introduced the issue. Therefore I'm considering this commit a proof of concept rather than a pull request, though I might be able to investigate more later on.

@Trantion897
Copy link
Author

Trantion897 commented Aug 16, 2024

This bug is caused because one of my characters (and the first one alphabetically, so the most likely to be included when I tested it) had all the frontmatter in the PC's note defined as text instead of numbers as they should be. Fixing the note fixes the issue, but I'm trying out a patch to add parseInt() when reading the player's note to save anyone this trouble in future. It will only work when the note is parsed, so for existing characters you'll need to delete and recreate the character in the initiative tracker settings.

@Trantion897 Trantion897 linked a pull request Aug 16, 2024 that will close this issue
9 tasks
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

Successfully merging a pull request may close this issue.

1 participant