public bool RemoveInventoryItem(KeyValuePair <InventoryItem, ItemType> item) { if (InventoryItems.Contains(item)) { InventoryItems.Remove(item); return(true); } return(false); }
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; } }
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(); } }
/// <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); } }
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(); } }
public void RemoveItem(IInventoryItem item) { CheckItemInInventory(item); InventoryItems.Remove(item); }