Switch PF2e data source from Pf2eTools to Foundry VTT PF2e
Replace the stagnant Pf2eTools bestiary with Foundry VTT PF2e system data (github.com/foundryvtt/pf2e, v13-dev branch). This gives us 4,355 remaster-era creatures across 49 sources including Monster Core 1+2 and all adventure paths. Changes: - Rewrite index generation script to walk Foundry pack directories - Rewrite PF2e normalization adapter for Foundry JSON shape (system.* fields, items[] for attacks/abilities/spells) - Add stripFoundryTags utility for Foundry HTML + enrichment syntax - Implement multi-file source fetching (one request per creature file) - Add spellcasting section to PF2e stat block (ranked spells + cantrips) - Add saveConditional and hpDetails to PF2e domain type and stat block - Add size and rarity to PF2e trait tags - Filter redundant glossary abilities (healing when in hp.details, spell mechanic reminders, allSaves duplicates) - Add PF2e stat block component tests (22 tests) - Bump IndexedDB cache version to 5 for clean migration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,8 @@ interface CompactCreature {
|
||||
readonly pc: number;
|
||||
readonly sz: string;
|
||||
readonly tp: string;
|
||||
readonly f: string;
|
||||
readonly li: string;
|
||||
}
|
||||
|
||||
interface CompactIndex {
|
||||
@@ -53,15 +55,18 @@ export function getAllPf2eSourceCodes(): string[] {
|
||||
}
|
||||
|
||||
export function getDefaultPf2eFetchUrl(
|
||||
sourceCode: string,
|
||||
_sourceCode: string,
|
||||
baseUrl?: string,
|
||||
): string {
|
||||
const filename = `creatures-${sourceCode.toLowerCase()}.json`;
|
||||
if (baseUrl !== undefined) {
|
||||
const normalized = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
|
||||
return `${normalized}${filename}`;
|
||||
return baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
|
||||
}
|
||||
return `https://raw.githubusercontent.com/Pf2eToolsOrg/Pf2eTools/dev/data/bestiary/${filename}`;
|
||||
return "https://raw.githubusercontent.com/foundryvtt/pf2e/v13-dev/packs/pf2e/";
|
||||
}
|
||||
|
||||
export function getCreaturePathsForSource(sourceCode: string): string[] {
|
||||
const compact = rawIndex as unknown as CompactIndex;
|
||||
return compact.creatures.filter((c) => c.s === sourceCode).map((c) => c.f);
|
||||
}
|
||||
|
||||
export function getPf2eSourceDisplayName(sourceCode: string): string {
|
||||
|
||||
Reference in New Issue
Block a user