Files
healer-man/src/game/dungeonCatalog.ts
T
2026-09-12 23:55:24 -04:00

61 lines
2.4 KiB
TypeScript

import { DUNGEON_DEFINITIONS, dungeonCanEnter, type DungeonId } from "./dungeonRegistry";
import { contentCategoryById, type ContentCategoryId } from "../app/contentCategories";
import { compareDungeonReleaseOrder, dungeonReleaseStage, type DungeonReleaseStage } from "./dungeonReleaseStage";
const DUNGEON_CATEGORY_IDS = ["wow", "rom"] as const satisfies readonly ContentCategoryId[];
export type DungeonCategoryId = (typeof DUNGEON_CATEGORY_IDS)[number];
export interface DungeonCategory {
readonly id: DungeonCategoryId;
readonly label: string;
readonly fullName: string;
}
export const DUNGEON_CATEGORIES: readonly DungeonCategory[] = Object.freeze([
...DUNGEON_CATEGORY_IDS.map((id) => {
const category = contentCategoryById(id);
return { id, label: category.label, fullName: category.name };
}),
]);
export interface DungeonCatalogEntry {
readonly id: DungeonId;
readonly category: DungeonCategoryId;
readonly title: string;
readonly mapId: number;
readonly entranceName: string;
readonly location: string;
readonly theme: string;
readonly summary: string;
readonly available: boolean;
readonly releaseStage: DungeonReleaseStage;
readonly availabilityReason?: string;
}
/** Release readiness first, then alphabetical title within each release stage. */
export const DUNGEON_CATALOG: readonly DungeonCatalogEntry[] = Object.freeze(
DUNGEON_DEFINITIONS.map<DungeonCatalogEntry>((definition) => ({
id: definition.id as DungeonId,
category: definition.expansion === "runewaker" ? "rom" : "wow",
title: definition.title,
mapId: definition.mapId,
entranceName: definition.entrance.name,
location: definition.presentation.location,
theme: definition.presentation.theme,
summary: definition.presentation.summary,
available: dungeonCanEnter(definition.id),
releaseStage: dungeonReleaseStage(definition.id),
availabilityReason: "availabilityReason" in definition ? definition.availabilityReason : undefined,
})).sort(compareDungeonReleaseOrder),
);
export type { DungeonId } from "./dungeonRegistry";
export function dungeonById(id: string): DungeonCatalogEntry | null {
return DUNGEON_CATALOG.find((dungeon) => dungeon.id === id) ?? null;
}
export function dungeonsByCategory(category: DungeonCategoryId): readonly DungeonCatalogEntry[] {
return DUNGEON_CATALOG.filter((dungeon) => dungeon.category === category);
}