diff --git a/pkg/data/items.go b/pkg/data/items.go index 2a02368..c09a50b 100644 --- a/pkg/data/items.go +++ b/pkg/data/items.go @@ -33,6 +33,16 @@ func (i Inventory) Find(name item.Name, locations ...item.LocationType) (Item, b return Item{}, false } +func (i Inventory) FindByID(unitID UnitID) (Item, bool) { + for _, it := range i.AllItems { + if it.UnitID == unitID { + return it, true + } + } + + return Item{}, false +} + func (i Inventory) ByLocation(locations ...item.LocationType) []Item { var items []Item