Connect battle rewards to campaign equipment
This commit is contained in:
@@ -239,10 +239,28 @@ export const itemCatalog: Record<string, ItemDefinition> = {
|
||||
}
|
||||
};
|
||||
|
||||
export const itemCatalogEntries = Object.values(itemCatalog);
|
||||
|
||||
export function getItem(itemId: string) {
|
||||
return itemCatalog[itemId] ?? itemCatalog['training-sword'];
|
||||
}
|
||||
|
||||
export function findItemByName(name: string) {
|
||||
return itemCatalogEntries.find((item) => item.name === name);
|
||||
}
|
||||
|
||||
export function itemInventoryLabel(itemId: string) {
|
||||
return getItem(itemId).name;
|
||||
}
|
||||
|
||||
export function equipmentItemIdForInventoryLabel(label: string) {
|
||||
return findItemByName(label)?.id;
|
||||
}
|
||||
|
||||
export function isEquipmentInventoryLabel(label: string) {
|
||||
return Boolean(findItemByName(label));
|
||||
}
|
||||
|
||||
export function equipmentExpToNext(level: number) {
|
||||
return 50 + Math.min(level, 9) * 20;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user