Files
initiative/apps/web/src/adapters/production-adapters.ts
Lukas e62c49434c
All checks were successful
CI / check (push) Successful in 2m21s
CI / build-image (push) Successful in 24s
Add Pathfinder 2e game system mode
Implements PF2e as an alternative game system alongside D&D 5e/5.5e.
Settings modal "Game System" selector switches conditions, bestiary,
stat block layout, and initiative calculation between systems.

- Valued conditions with increment/decrement UX (Clumsy 2, Frightened 3)
- 2,502 PF2e creatures from bundled search index (77 sources)
- PF2e stat block: level, traits, Perception, Fort/Ref/Will, ability mods
- Perception-based initiative rolling
- System-scoped source cache (D&D and PF2e sources don't collide)
- Backwards-compatible condition rehydration (ConditionId[] → ConditionEntry[])
- Difficulty indicator hidden in PF2e mode (excluded from MVP)

Closes dostulata/initiative#19

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 01:26:22 +02:00

52 lines
1.6 KiB
TypeScript

import type { Adapters } from "../contexts/adapter-context.js";
import {
loadEncounter,
saveEncounter,
} from "../persistence/encounter-storage.js";
import {
loadPlayerCharacters,
savePlayerCharacters,
} from "../persistence/player-character-storage.js";
import {
loadUndoRedoStacks,
saveUndoRedoStacks,
} from "../persistence/undo-redo-storage.js";
import * as bestiaryCache from "./bestiary-cache.js";
import * as bestiaryIndex from "./bestiary-index-adapter.js";
import * as pf2eBestiaryIndex from "./pf2e-bestiary-index-adapter.js";
export const productionAdapters: Adapters = {
encounterPersistence: {
load: loadEncounter,
save: saveEncounter,
},
undoRedoPersistence: {
load: loadUndoRedoStacks,
save: saveUndoRedoStacks,
},
playerCharacterPersistence: {
load: loadPlayerCharacters,
save: savePlayerCharacters,
},
bestiaryCache: {
cacheSource: bestiaryCache.cacheSource,
isSourceCached: bestiaryCache.isSourceCached,
getCachedSources: bestiaryCache.getCachedSources,
clearSource: bestiaryCache.clearSource,
clearAll: bestiaryCache.clearAll,
loadAllCachedCreatures: bestiaryCache.loadAllCachedCreatures,
},
bestiaryIndex: {
loadIndex: bestiaryIndex.loadBestiaryIndex,
getAllSourceCodes: bestiaryIndex.getAllSourceCodes,
getDefaultFetchUrl: bestiaryIndex.getDefaultFetchUrl,
getSourceDisplayName: bestiaryIndex.getSourceDisplayName,
},
pf2eBestiaryIndex: {
loadIndex: pf2eBestiaryIndex.loadPf2eBestiaryIndex,
getAllSourceCodes: pf2eBestiaryIndex.getAllPf2eSourceCodes,
getDefaultFetchUrl: pf2eBestiaryIndex.getDefaultPf2eFetchUrl,
getSourceDisplayName: pf2eBestiaryIndex.getPf2eSourceDisplayName,
},
};