private static void LevelUpPokemon(Queue <PokemonUiData> pokemonQueue, bool toMax = false) { if (pokemonQueue == null) { return; } while (pokemonQueue.Count > 0) { var pokemon = pokemonQueue.Dequeue(); if (pokemon == null) { continue; } if (pokemon.OwnerBot != null && pokemon.OwnerBot.Started || _debugMode) { pokemon.OwnerBot.Session.AddActionToQueue( async() => { await LevelUpSpecificPokemonTask.Execute(pokemon.OwnerBot.Session, pokemon.Id, pokemon.OwnerBot.CancellationToken, toMax); return(true); }, $"{TranslationEngine.GetDynamicTranslationString("%LEVEL_UP%", "Level up")}: {pokemon.Name}", pokemon.Id); pokemon.InAction = true; } } }
private async void PowerUpPokemon(IEnumerable <PokemonData> pokemons) { SetState(false); foreach (var pokemon in pokemons) { await LevelUpSpecificPokemonTask.Execute(_session, pokemon.Id); } await ReloadPokemonList(); }
private async void LevelUpPokemon(Queue <PokemonUiData> pokemonQueue, ListBox pokeListBox, bool toMax = false) { if (pokemonQueue == null) { return; } pokeListBox.IsEnabled = false; while (pokemonQueue.Count > 0) { var pokemon = pokemonQueue.Dequeue(); if (pokemon?.OwnerBot != null && pokemon.OwnerBot.Started) { await LevelUpSpecificPokemonTask.Execute(pokemon.OwnerBot.Session, pokemon.Id, toMax); } } pokeListBox.IsEnabled = true; }
public async Task Handle(ISession session, WebSocketSession webSocketSession, dynamic message) { await LevelUpSpecificPokemonTask.Execute(session, (ulong)message.PokemonId); }
private static async void LevelUpPokemon(ISession session, PokemonUiData pokemon, bool toMax = false) { await LevelUpSpecificPokemonTask.Execute(session, pokemon.Id, toMax); }