✨Feature: implement loot resolution system with gold and item tracking from defeated creatures
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user