Files
edbridge-scholars/src/hooks/useCrewRank.ts

14 lines
494 B
TypeScript

import { QUEST_ARCS } from "../data/questData";
// Returns the player's current crew rank, or a default if none earned yet
export function getCrewRank(arcs = QUEST_ARCS): string {
const earned = arcs
.flatMap((a) => a.nodes)
.filter((n) => n.status === "completed" && n.reward.title)
.map((n) => n.reward.title!);
// Return the last one — questData is ordered by difficulty,
// so the last earned title is always the highest rank
return earned.at(-1) ?? "Cabin Hand";
}