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

Add A(H)BCD tabs to Compendium Browser #15790

Open
wants to merge 56 commits into
base: master
Choose a base branch
from

Conversation

mysurvive
Copy link
Contributor

This PR adds Ancestries, Heritages, Backgrounds, Classes, and Deities to the compendium browser and additionally redirects the search buttons of the Character page on the Character sheet to the corresponding compendium browser tabs. This allows A(H)BCD content that is stored in compendiums to be loaded into the compendium browser to browse and filter during character building instead of searching through a myriad of compendia to find available content.

There is one issue that I ran into that I don't know how to solve. src/module/apps/compendium-browser/index.ts throws errors in the Tagify section starting at line 642. I tried a myriad of fixes but couldn't figure it out - this happened after removing the traits filter from the new A(H)BCD tabs. I don't know why this is happening, I thought the objectHasKey method in the if statement at line 631 would handle this, but it appears not.

I realize this is an extremely large PR and probably has a lot of places where the code can be optimized and/or doesn't follow the system's standards, so take as much time as necessary to review. There's no rush on this, just a project I wanted to work on.

@intrand
Copy link
Contributor

intrand commented Aug 6, 2024

There are several failing CI checks found in the Details link here in the PR. Please take a look at those and resolve them

@mysurvive
Copy link
Contributor Author

mysurvive commented Aug 7, 2024

Fixed the linting issues.

Also... maybe fixed the Tagify errors? Seems kind of janky to me but maybe it's the right way, I don't know.

@intrand
Copy link
Contributor

intrand commented Aug 7, 2024

I'm seeing errors when I enable a module that contains compendium packs with valid items inside of it (class, feats, spells, etc) and enable those packs in the settings of the compendium browser. I will make a new world and test more slowly. If you want, you may install PF2E Lifeblade and/or PF2E Companion Compendia to try to reproduce the issue.

Here's a copy of the error from the console:

pf2e.mjs:1341 TypeError: Cannot read properties of undefined (reading 'toString')
    at CompendiumBrowserClassTab.loadData (pf2e.mjs:1676:75999)
    at async CompendiumBrowserClassTab.init (pf2e.mjs:1676:50897)
    at async CompendiumBrowser.loadTab (pf2e.mjs:1676:112592)
    at async HTMLFormElement.sheetHandler (pf2e.mjs:1341:441966)

Disabling any modules that had packs that were added to the compendium browser allows it to work again without issue.

@stwlam
Copy link
Collaborator

stwlam commented Aug 7, 2024

Screenshot?

@intrand
Copy link
Contributor

intrand commented Aug 7, 2024

Here are some of it working as expected (without any 3rd party content):

image
image
image
image
image
image

@mysurvive
Copy link
Contributor Author

image
image
image
image
image
It works if the compendium only has one type of item in it (i.e. only classes, only backgrounds, etc). I saw that Lifeblade has effects as well as classes, etc. in them (I'm having trouble downloading Companion Compendia right now... probably a github issue so I can't test, but I'm guessing it probably is the same way). I thought this was a design philosophy to have a unique compendium for each item type. As soon as I added an effect to my class compendium, I got the same error as you. I didn't test with mixed compendia!

@mysurvive
Copy link
Contributor Author

This commit should fix the error you're seeing, and I added a warning if any of the index fields are missing to be more in line with the other tabs.

@intrand
Copy link
Contributor

intrand commented Aug 7, 2024

After fixing my own dumb mistake, it looks like everything is working! I can successfully add packs from various modules and everything seems to come up normally and filter correctly! Huzzah!

Thank you for your work on this, @mysurvive 😄

@intrand
Copy link
Contributor

intrand commented Aug 7, 2024

image

for posterity

@intrand
Copy link
Contributor

intrand commented Aug 7, 2024

Upon further testing, I see some deities missing from the browser. Some examples: Aakriti, Abraxas, Adanye. Opening the pf2e.deities pack next to the browser is a good way to see what's missing and what was found. I double-checked that the browser wasn't excluding sources (in settings and in filters).

@mysurvive
Copy link
Contributor Author

I found the problem - I will get a commit in later tonight or tomorrow to fix it.

@CarlosFdez
Copy link
Collaborator

Unfortunately, I'm not a fan of how many entries are there at the top. I don't know how to tackle it though. One idea I had was to create different contexts somehow, and have bestiary/hazards into a completely separate context, but I don't think that'd be enough.

@mysurvive
Copy link
Contributor Author

Would a tab for "Character Building" be a better option, with tabs for A(H)BCD (like the settings tab has)? I have a commit that I've been working on that does that, but it's not working yet.

I think this is an important enhancement for the compendium browser, so I'm willing to keep pecking at it until it's in a good place.

@mysurvive
Copy link
Contributor Author

Does this look better @CarlosFdez ?
image

@mysurvive
Copy link
Contributor Author

Fixed the CSS too
image

@mysurvive mysurvive force-pushed the New_Compendium_Browser_Tabs branch 2 times, most recently from fb7964b to 50a8cfd Compare August 11, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants