diff options
| author | historia <[not public]> | 2026-06-17 17:34:40 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-17 17:34:40 -0400 |
| commit | eef5ddaa94f8cff6010d092c30fed53d2be01524 (patch) | |
| tree | 3026ebb5fe34fd778c5f8f6b6d23aec337a99b99 /internal/player | |
| parent | 04998e3e4eff075eee6d00850c752c3c73ab66b5 (diff) | |
| download | thehouseoficarus-eef5ddaa94f8cff6010d092c30fed53d2be01524.tar.gz | |
feat: began implementing smithing, ground item display fixes.
Diffstat (limited to 'internal/player')
| -rw-r--r-- | internal/player/player.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/player/player.go b/internal/player/player.go index 48c9359..e7d98ac 100644 --- a/internal/player/player.go +++ b/internal/player/player.go @@ -338,6 +338,16 @@ func (p *Player) HasItem(itemID string) bool { return false } +func (p *Player) CountItem(itemID string) int { + count := 0 + for _, slot := range p.Inventory { + if slot != nil && slot.ItemID == itemID { + count += slot.Quantity + } + } + return count +} + func (p *Player) RemoveItem(itemID string, qty int) bool { remaining := qty for i, slot := range p.Inventory { |
