Example #1
0
 public bool RemoveInventoryItem(KeyValuePair <InventoryItem, ItemType> item)
 {
     if (InventoryItems.Contains(item))
     {
         InventoryItems.Remove(item);
         return(true);
     }
     return(false);
 }
Example #2
0
 public void RemoveItem(ItemVM selectedItem)
 {
     foreach (ItemVM item in InventoryItems)
     {
         if (item.ToModel().Id != selectedItem.ToModel().Id)
         {
             continue;
         }
         Gold += item.Price;
         InventoryItems.Remove(item);
         UpdateStats();
         break;
     }
 }
Example #3
0
 public void RemoveInventory(Item pItem)
 {
     try
     {
         locker.WaitOne();
         Handler12.ModifyInventorySlot(InventoryOwner, 0x24, (byte)pItem.Slot, 0, null);
         pItem.Delete();
         InventoryItems.Remove((byte)pItem.Slot);
     }
     finally
     {
         locker.ReleaseMutex();
     }
 }
Example #4
0
        /// <summary>
        /// Find the selected item in InventoryItems and subtract 1 from the count
        /// If the count becomes 0 remove the item from InventoryItems
        /// </summary>
        private void RemoveOneFromList()
        {
            if (SelectedItem == null)
            {
                MessageBox.Show("Please Select an Item to remove.");
                return;
            }
            InventoryItem item = InventoryItems.First(x => x.Name == SelectedItem.Name);

            item.ItemCount--;

            if (item.ItemCount == 0)
            {
                InventoryItems.Remove(item);
            }
        }
Example #5
0
        public void AddToInventory(Item pItem)
        {
            try
            {
                locker.WaitOne();
                if (InventoryItems.ContainsKey((byte)pItem.Slot))
                {
                    InventoryItems[(byte)pItem.Slot].Delete();  //removes from DB
                    InventoryItems.Remove((byte)pItem.Slot);
                }

                InventoryItems.Add((byte)pItem.Slot, pItem);
            }
            finally
            {
                locker.ReleaseMutex();
            }
        }
Example #6
0
 public void RemoveItem(IInventoryItem item)
 {
     CheckItemInInventory(item);
     InventoryItems.Remove(item);
 }