/** * Class-metadata lookup for the rows: art, colour, per-level health. Loaded * from the campaign edition JSON (via the shared `gameData` client) and * cached per class. */ import { gameData, type ClassData } from './gameData'; export type { ClassData }; const cache = new Map>(); export function classInfo(edition: string, className: string): Promise { const key = `${edition}/${className}`; let promise = cache.get(key); if (!promise) { promise = gameData .loadCampaign(edition) .then((c) => c.classes.find((x) => x.id === className) ?? null) .catch(() => null); cache.set(key, promise); } return promise; } /** True for the Escort / Objective classes (no initiative input). */ export function isObjectiveOrEscort(className: string): boolean { return className === 'Escort' || className === 'Objective'; }