public static BankItemRecord ExistingItem(this List<BankItemRecord> itemlist,BankItemRecord item)
 {
     var existingItem = itemlist.Find(x => x.GID == item.GID && x.EffectsLinkedToList == item.EffectsLinkedToList);
     if (existingItem == null)
         return null;
     else return existingItem;
 }
Example #2
0
        public void RemoveItemFromPanel(BankItemRecord obj, int quantity)
        {
            if (obj.IsNull())
                return;
            if (obj.Quantity == (uint)-quantity)
            {
                SaveTask.RemoveElement(obj);
                var existing = Client.Character.Inventory.Items.ExistingItem(obj);
                if (existing != null)
                {
                    existing.Quantity += (uint)-quantity;
                    SaveTask.UpdateElement(existing);
                    Client.Character.Inventory.Refresh();
                }
                else
                {
                    Client.Character.Inventory.Add(obj);
                }
                Client.Send(new StorageObjectRemoveMessage(obj.UID));

            }
            else
            {
                obj.Quantity = (uint)(obj.Quantity + quantity);
                SaveTask.UpdateElement(obj);
                Client.Character.Inventory.Add(obj,(uint)-quantity);
                Client.Send(new StorageObjectUpdateMessage(obj.GetObjectItem()));
            }
        }