public static async Task Execute()
        {
            if (!Logic._client.Settings.CatchIncensePokemon)
            {
                return;
            }

            var incensePokemon = await Logic._client.Map.GetIncensePokemons();

            if (incensePokemon.Result == GetIncensePokemonResponse.Types.Result.IncenseEncounterAvailable)
            {
                var pokemon = new MapPokemon
                {
                    EncounterId           = incensePokemon.EncounterId,
                    ExpirationTimestampMs = incensePokemon.DisappearTimestampMs,
                    Latitude     = incensePokemon.Latitude,
                    Longitude    = incensePokemon.Longitude,
                    PokemonId    = incensePokemon.PokemonId,
                    SpawnPointId = incensePokemon.EncounterLocation
                };

                if (Logic._client.Settings.UsePokemonDoNotCatchList &&
                    Logic._client.Settings.PokemonsToNotCatch.Contains(pokemon.PokemonId))
                {
                    Logger.Write($"Ignore Pokemon - {pokemon.PokemonId} - is on ToNotCatch List", LogLevel.Debug);
                    return;
                }

                var encounter =
                    await Logic._client.Encounter.EncounterIncensePokemon(pokemon.EncounterId, pokemon.SpawnPointId);

                if (encounter.Result == IncenseEncounterResponse.Types.Result.IncenseEncounterSuccess)
                {
                    await CatchPokemonTask.Execute(encounter, pokemon);
                }
                else
                {
                    Logger.Write($"Encounter problem: {encounter.Result}", LogLevel.Warning);
                }
            }

            if (Logic._client.Settings.EvolvePokemon || Logic._client.Settings.EvolvePokemonAboveIV)
            {
                await EvolvePokemonTask.Execute();
            }
            if (Logic._client.Settings.TransferPokemon)
            {
                await TransferPokemonTask.Execute();
            }
        }
예제 #2
0
        public static async Task Execute()
        {
            if (!Logic._client.Settings.CatchPokemon)
            {
                return;
            }

            var pokemons = await GetNearbyPokemons();

            if (pokemons == null || !pokemons.Any())
            {
                return;
            }

            Logger.Write($"Found {pokemons.Count} catchable Pokemon", LogLevel.Debug);
            foreach (var pokemon in pokemons)
            {
                if (Logic._client.Settings.UsePokemonToNotCatchList && Logic._client.Settings.PokemonsToNotCatch.Contains(pokemon.PokemonId))
                {
                    Logger.Write($"Ignore Pokemon - {pokemon.PokemonId} - is on ToNotCatch List", LogLevel.Debug);
                    continue;
                }

                var encounter = await Logic._client.Encounter.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnPointId);

                if (encounter.Status == EncounterResponse.Types.Status.EncounterSuccess)
                {
                    await CatchPokemonTask.Execute(encounter, pokemon);
                }
                else
                {
                    Logger.Write($"Encounter problem: {encounter.Status}", LogLevel.Warning);
                }
            }

            if (Logic._client.Settings.EvolvePokemon || Logic._client.Settings.EvolveOnlyPokemonAboveIV)
            {
                await EvolvePokemonTask.Execute();
            }
            if (Logic._client.Settings.TransferPokemon)
            {
                await TransferPokemonTask.Execute();
            }
        }
        public static async Task Execute(FortData currentFortData)
        {
            Logger.Write("Looking for lured Pokemon...", LogLevel.Debug);

            var fortId    = currentFortData.Id;
            var pokemonId = currentFortData.LureInfo.ActivePokemonId;

            if (Logic._client.Settings.UsePokemonDoNotCatchList &&
                Logic._client.Settings.PokemonsToNotCatch.Contains(pokemonId))
            {
                Logger.Write($"Ignore Pokemon - {pokemonId} - is on ToNotCatch List", LogLevel.Debug);
                return;
            }

            var encounterId = currentFortData.LureInfo.EncounterId;

            var encounter = await Logic._client.Encounter.EncounterLurePokemon(encounterId, fortId);

            Logger.Write($"fortId: {fortId}", LogLevel.Debug);
            Logger.Write($"pokemonId: {pokemonId}", LogLevel.Debug);
            Logger.Write($"encounterId: {encounterId}", LogLevel.Debug);
            Logger.Write($"encounter: {encounter}", LogLevel.Debug);

            if (encounter.Result == DiskEncounterResponse.Types.Result.Success)
            {
                await CatchPokemonTask.Execute(encounter, null, currentFortData, encounterId);
            }
            else
            {
                if (encounter.Result.ToString().Contains("NotAvailable"))
                {
                    return;
                }
                Logger.Write($"Encounter problem: Lure Pokemon {encounter.Result}", LogLevel.Warning);
            }
        }