public bool CanGainItems(UserItem[] items) { int itemCount = items.Count(e => e != null); uint itemWeight = 0; uint stackOffset = 0; if (itemCount < 1) return true; for (int i = 0; i < items.Length; i++) { if (items[i] == null) continue; itemWeight += items[i].Weight; if (items[i].Info.StackSize > 1) { uint count = items[i].Count; for (int u = 0; u < Info.Inventory.Length; u++) { UserItem bagItem = Info.Inventory[u]; if (bagItem == null || bagItem.Info != items[i].Info) continue; if (bagItem.Count + count > bagItem.Info.StackSize) stackOffset++; break; } } } if (CurrentBagWeight + (itemWeight) > MaxBagWeight) return false; if (FreeSpace(Info.Inventory) < itemCount + stackOffset) return false; return true; }