Example #1
0
        /// <summary>
        ///     Updates inventory data
        /// </summary>
        public static async Task UpdateInventory()
        {
            // Get ALL the items
            var fullInventory = (await GetInventory()).InventoryDelta.InventoryItems;
            // Update items
            var tmpItemsInventory = fullInventory.Where(item => item.InventoryItemData.Item != null).GroupBy(item => item.InventoryItemData.Item);

            ItemsInventory.Clear();
            foreach (var item in tmpItemsInventory)
            {
                ItemsInventory.Add(item.First().InventoryItemData.Item);
            }
            // Update Pokemons
            var tmpPokemonsInventory = fullInventory.Where(item => item.InventoryItemData.PokemonData != null).Select(itemt => itemt.InventoryItemData.PokemonData);

            PokemonsInventory.Clear();
            foreach (var pokemon in tmpPokemonsInventory)
            {
                PokemonsInventory.Add(pokemon);
            }
        }
Example #2
0
        /// <summary>
        ///     Updates inventory data
        /// </summary>
        public static async Task UpdateInventory()
        {
            // Get ALL the items
            var fullInventory = (await GetInventory()).InventoryDelta.InventoryItems;
            // Update items
            var tmpItemsInventory = fullInventory.Where(item => item.InventoryItemData.Item != null).GroupBy(item => item.InventoryItemData.Item);

            ItemsInventory.Clear();
            foreach (var item in tmpItemsInventory)
            {
                ItemsInventory.Add(item.First().InventoryItemData.Item);
            }
            // Update incbuators
            //var tmpIncubatorsInventory = fullInventory.Where(item => item.InventoryItemData.EggIncubators != null).GroupBy(item => item.InventoryItemData.EggIncubators);
            //IncubatorsInventory.Clear();
            //foreach (var item in tmpIncubatorsInventory)
            //{
            //    IncubatorsInventory.Add(item.First().InventoryItemData.Item);
            //}
            // Update Pokemons
            var tmpPokemonsInventory = fullInventory.Where(item => item.InventoryItemData.PokemonData != null).Select(itemt => itemt.InventoryItemData.PokemonData);

            PokemonsInventory.Clear();
            EggsInventory.Clear();
            foreach (var pokemon in tmpPokemonsInventory)
            {
                if (pokemon.IsEgg)
                {
                    EggsInventory.Add(pokemon);
                }
                else
                {
                    PokemonsInventory.Add(pokemon);
                }
            }
        }