From 88548e97fc3d07c677841b66e1f167e0e7e5d9f0 Mon Sep 17 00:00:00 2001 From: vietdungdev Date: Thu, 21 May 2026 19:55:37 +0700 Subject: [PATCH] update code --- pkg/data/items.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/data/items.go b/pkg/data/items.go index ae3d5a4..ea5557d 100644 --- a/pkg/data/items.go +++ b/pkg/data/items.go @@ -75,11 +75,15 @@ func (i Inventory) FindByID(unitID UnitID) (Item, bool) { return Item{}, false } -func (i Inventory) ByOwnerLocation(owner UnitID, locations ...item.LocationType) []Item { +func (i Inventory) ByMercLocation(mercID UnitID, locations ...item.LocationType) []Item { var items []Item for _, it := range i.AllItems { for _, l := range locations { + owner := mercID + if l != item.LocationMercenary { + owner = i.PlayerID + } if it.Location.LocationType == l && isMatchOwner(owner, it) { items = append(items, it) }