public void UpdateInventory() { LogCaller(new LoggerEventArgs("Updating inventory.", LoggerTypes.Debug)); try { var inventoryItems = _client?.ClientSession?.Player?.Inventory?.InventoryItems; if (inventoryItems == null) { return; } Items.Clear(); Pokemon.Clear(); Pokedex.Clear(); PokemonCandy.Clear(); Incubators.Clear(); Eggs.Clear(); foreach (var inventoryItem in inventoryItems) { if (inventoryItem.InventoryItemData?.PlayerStats != null) { Stats = inventoryItem.InventoryItemData.PlayerStats; } if (inventoryItem.InventoryItemData?.Item != null) { Items.Add(inventoryItem.InventoryItemData.Item); } if (inventoryItem.InventoryItemData?.PokedexEntry != null) { Pokedex.Add(inventoryItem.InventoryItemData.PokedexEntry); } if (inventoryItem.InventoryItemData?.Candy != null) { PokemonCandy.Add(inventoryItem.InventoryItemData.Candy); } if (inventoryItem.InventoryItemData?.EggIncubators != null) { foreach (var eggIncubator in inventoryItem.InventoryItemData.EggIncubators.EggIncubator) { if (eggIncubator != null) { Incubators.Add(eggIncubator); } } } if (inventoryItem.InventoryItemData?.PokemonData != null) { if (inventoryItem.InventoryItemData.PokemonData.IsEgg) { Eggs.Add(inventoryItem.InventoryItemData.PokemonData); } else { Pokemon.Add(inventoryItem.InventoryItemData.PokemonData); } } } } catch (Exception ex1) { AccountState = Enums.AccountState.TemporalBan; LogCaller(new LoggerEventArgs(String.Format("Failed updating inventory."), LoggerTypes.Debug, ex1)); Stop(); } }