Feature: implement loot resolution system with gold and item tracking from defeated creatures

This commit is contained in:
Keith Solomon
2026-03-15 14:24:39 -05:00
parent cf98636a52
commit 6c2257b032
10 changed files with 478 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
import type {
ContentPack,
CreatureDefinition,
ItemDefinition,
RoomTemplate,
TableDefinition,
} from "@/types/content";
@@ -74,3 +75,13 @@ export function findCreatureById(
return creature;
}
export function findItemById(content: ContentPack, itemId: string): ItemDefinition {
const item = content.items.find((entry) => entry.id === itemId);
if (!item) {
throw new Error(`Unknown item id: ${itemId}`);
}
return item;
}