public void AddItem(InventoryItem item) { if (item.type == InventoryItemType.None) { return; } AddItemImpl(item); RavenhillEvents.OnInventoryItemAdded(item.data.type, item.id, item.count); RavenhillEvents.OnInventoryChanged(item.data.type, item.id, item.count); }
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); }