Guard source gear namespaces and retain recoverable legacy records (#9)

This commit is contained in:
warren committed 2026-10-10 11:36:10 -04:00
1 parent ab37006932
commit e567910c04
23 files changed
+1203 -66

No files matched your search

+10 -4
View File
@@ -1,8 +1,14 @@
import type { InventoryItem } from "./lootTypes";
import type { ContentCategoryId } from "../app/contentCategories";
import { inventoryItemUsableForCategory, type InventoryItem } from "./lootTypes";
/** Leveling dungeon bosses award cards through the separate boss-card path. */
export function allowedLootDrops(drops: readonly InventoryItem[], playerLevel: number): readonly InventoryItem[] {
return Number.isFinite(playerLevel) && playerLevel >= 80
export function allowedLootDrops(
drops: readonly InventoryItem[],
playerLevel: number,
ownerCategory?: ContentCategoryId,
): readonly InventoryItem[] {
if (!Number.isFinite(playerLevel) || playerLevel < 80) return [];
return ownerCategory === undefined
? drops
: [];
: drops.filter((item) => inventoryItemUsableForCategory(item, ownerCategory));
}