public bool RemoveItem(InventoryItemType type, string id, int count) { if (items.ContainsKey(type)) { Dictionary <string, InventoryItem> filtered = items[type]; if (filtered.ContainsKey(id)) { InventoryItem targetItem = filtered[id]; if (targetItem.count >= count) { targetItem.RemoveCount(count); if (targetItem.count <= 0) { filtered.Remove(targetItem.id); } RavenhillEvents.OnInventoryItemRemoved(type, id, count); RavenhillEvents.OnInventoryChanged(type, id, count); return(true); } } } return(false); }