Skip to content

Commit

Permalink
Module-configurable A(H)BCD sheet compendia
Browse files Browse the repository at this point in the history
Allow modules to change which compendia are opened from the player character sheet when clicking the magnifying glass icons for ancestries, heritages, backgrounds, classes, and deities. Useful for modules like the Starfinder 2E playtest.
  • Loading branch information
nikolaj-a committed Aug 18, 2024
1 parent 0e13181 commit d88fb31
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/module/actor/character/sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ class CharacterSheetPF2e<TActor extends CharacterPF2e> extends CreatureSheetPF2e
};
});

sheetData.compendium = CONFIG.PF2E.sheetCompendium;

// Return data for rendering
return sheetData;
}
Expand Down Expand Up @@ -1667,6 +1669,7 @@ interface CharacterSheetData<TActor extends CharacterPF2e = CharacterPF2e> exten
elementalBlasts: ElementalBlastSheetConfig[];
senses: Sense[];
speeds: SpeedSheetData[];
compendium: Record<string, string>;
}

type LanguageSheetData = {
Expand Down
8 changes: 8 additions & 0 deletions src/scripts/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,14 @@ export const PF2ECONFIG = {
urban: "PF2E.Environment.Type.Urban",
},

sheetCompendium: {
ancestries: "pf2e.ancestries",
heritages: "pf2e.heritages",
backgrounds: "pf2e.backgrounds",
classes: "pf2e.classes",
deities: "pf2e.deities",
},

SETTINGS: {
automation: {
rulesBasedVision: {
Expand Down
10 changes: 5 additions & 5 deletions static/templates/actors/character/tabs/character.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@
</ul>

<div class="detail ancestry{{#if ancestry}} selected{{/if}}">
{{> detailItem item=ancestry type="ancestry" compendium="pf2e.ancestries"}}
{{> detailItem item=ancestry type="ancestry" compendium=compendium.ancestries}}
</div>

<div class="detail heritage{{#if heritage}} selected{{/if}}">
{{> detailItem item=heritage type="heritage" compendium="pf2e.heritages"}}
{{> detailItem item=heritage type="heritage" compendium=compendium.heritages}}
</div>

<div class="detail background{{#if background}} selected{{/if}}">
{{> detailItem item=background type="background" compendium="pf2e.backgrounds"}}
{{> detailItem item=background type="background" compendium=compendium.backgrounds}}
</div>

<div class="detail class{{#if class}} selected{{/if}}">
{{> detailItem item=class type="class" compendium="pf2e.classes"}}
{{> detailItem item=class type="class" compendium=compendium.classes}}
</div>

<div class="detail deity{{#if deity}} selected{{/if}}">
{{> detailItem item=deity type="deity" compendium="pf2e.deities" showEmblem=deity}}
{{> detailItem item=deity type="deity" compendium=compendium.deities showEmblem=deity}}
</div>
</div>

Expand Down

0 comments on commit d88fb31

Please sign in to comment.