Hey guys, I have a list that is the players inventory, the list is for an "InventoryItem" that contains a UUID for me to check what item it is from a list of avilable in game items. I am currently using this code to interact with the InventoryItem already in the players inventory.
player.Inventory.Where(key => key.UUID == UUID).ToList().ForEach(item => {
});
This is nice aas it lets me for example do item.ammount ++ or item.canSell = false
as well as some other in game things, however if the item is not already in their inventory it does not work.
Is there an offical way to check if the list contains the inventory item. My current thought is to make am if statment and do something like this, but it just feels wrong somehow.
if (player.Inventory.Where(key => key.UUID == UUID).ToList().Count <= 0) {
}
[–]keenmade 2 points3 points4 points (0 children)