Ejemplo n.º 1
0
        public void AddItemToInventory(Gameitem item)
        {
            Inventory.Add(item);
            if (item.IsUnique)
            {
                GroupedInventory.Add(new GroupedInventory(item, 1));
            }
            else
            {
                if (!GroupedInventory.Any(gi => gi.Item.TypeID == item.TypeID))
                {
                    GroupedInventory.Add(new GroupedInventory(item, 0));
                }

                GroupedInventory.First(gi => gi.Item.TypeID == item.TypeID).Quantity++;
            }
        }
Ejemplo n.º 2
0
        public void AddItemToInventory(Item item)
        {
            Inventory.Add(item);

            // if item is unique, create a stack with single item inside of it
            if (item.IsUnique)
            {
                GroupedInventory.Add(new GroupedInventoryItem(item, 1));
            }
            // if it isn't, loop through every item using id to see if passed id is equal then skip. if not, create the stack and add the item to stack inventory
            else
            {
                if (!GroupedInventory.Any(gi => gi.Item.ID == item.ID))
                {
                    GroupedInventory.Add(new GroupedInventoryItem(item, 0));
                }

                GroupedInventory.First(gi => gi.Item.ID == item.ID).Quantity++;
            }
        }
Ejemplo n.º 3
0
 public void AddItemToInventory(Item item)
 {
     Inventory.Add(item);
     if (item.IsUnique)
     {
         GroupedInventory.Add(new InventoryItem(item, 1));
     }
     else
     {
         if (!GroupedInventory.Any(gi => gi.GameItem.ItemID == item.ItemID))
         {
             GroupedInventory.Add(new InventoryItem(item, 0));
         }
         GroupedInventory.First(gi => gi.GameItem.ItemID == item.ItemID).Quantity++;
     }
     OnPropertyChanged(nameof(Weapons));
     OnPropertyChanged(nameof(Armors));
     OnPropertyChanged(nameof(Gloves));
     OnPropertyChanged(nameof(Boots));
 }