private ActionStatus PickupItems() { if (this.m_ItemCollection.Count == 0) { InventoryManager.Notifications.empty.Show(gameObject.name.Replace("(Clone)", "").ToLower()); return(ActionStatus.Failure); } ItemContainer[] windows = WidgetUtility.FindAll <ItemContainer>(this.m_WindowName); List <Item> items = new List <Item>(); if (this.m_Amount < 0) { items.AddRange(this.m_ItemCollection); } else { for (int i = 0; i < this.m_Amount; i++) { Item item = this.m_ItemCollection[Random.Range(0, this.m_ItemCollection.Count)]; items.Add(item); } } for (int i = 0; i < items.Count; i++) { Item item = items[i]; if (windows.Length > 0) { for (int j = 0; j < windows.Length; j++) { ItemContainer current = windows[j]; if (current.StackOrAdd(item)) { this.m_ItemCollection.Remove(item); break; } } } else { //Drop items to ground DropItem(item); this.m_ItemCollection.Remove(item); } } return(ActionStatus.Success); }