Inventory item info

This commit is contained in:
Aslan 2026-01-21 14:53:49 -05:00
parent 2bfce22530
commit 22dc1a5d9c
3 changed files with 64 additions and 5 deletions

View file

@ -1,4 +1,4 @@
import type { IItem } from "./structures/items.js";
import type { IItem, IStat } from "./structures/items.js";
import {
rarities,
Rarity,
@ -20,4 +20,18 @@ const getRarity = (id: Rarity): IRarity => {
return rarity ? rarity : rarityCommon;
};
export { getFullItemName, getRarityName, getRarity };
const getTotalStats = (item: IItem): IStat => {
const totalStats: IStat = {
damage: 0,
defense: 0,
};
item.stats.forEach((stat) => {
totalStats.damage += stat.damage;
totalStats.defense += stat.defense;
});
return totalStats;
};
export { getFullItemName, getRarityName, getRarity, getTotalStats };