RocketBot icon indicating copy to clipboard operation
RocketBot copied to clipboard

Enabling ''EvolveAllGivenPokemons" causes..

Open Myojine opened this issue 10 years ago • 1 comments

.. the bot to never get past trying to evolve.

It never reaches the step of transfering or beginning to farm Pokestops & Pokemons just keeps trying to evolve forever (I think?).

Just to be sure, please take a look at this code and see if there's anything out of place or missing.

    private static async Task EvolveAllGivenPokemons(Client client, IEnumerable<PokemonData> pokemonToEvolve)
    {
        foreach (var pokemon in pokemonToEvolve)
        {
            /*
            enum Holoholo.Rpc.Types.EvolvePokemonOutProto.Result {
                UNSET = 0;
                SUCCESS = 1;
                FAILED_POKEMON_MISSING = 2;
                FAILED_INSUFFICIENT_RESOURCES = 3;
                FAILED_POKEMON_CANNOT_EVOLVE = 4;
                FAILED_POKEMON_IS_DEPLOYED = 5;
            }
            }*/

            var countOfEvolvedUnits = 0;
            var xpCount = 0;

            EvolvePokemonOut evolvePokemonOutProto;
            do
            {
                evolvePokemonOutProto = await client.EvolvePokemon(pokemon.Id);
                    //todo: someone check whether this still works

                if (evolvePokemonOutProto.Result == 1)
                {
                    ColoredConsoleWrite(ConsoleColor.Cyan, 
                        $"[{DateTime.Now.ToString("HH:mm:ss")}] Evolved {pokemon.PokemonId} successfully for {evolvePokemonOutProto.ExpAwarded}xp");

                    countOfEvolvedUnits++;
                    xpCount += evolvePokemonOutProto.ExpAwarded;
                }
                else
                {
                    var result = evolvePokemonOutProto.Result;
                    /*
                    ColoredConsoleWrite(ConsoleColor.White, $"Failed to evolve {pokemon.PokemonId}. " +
                                             $"EvolvePokemonOutProto.Result was {result}");

                    ColoredConsoleWrite(ConsoleColor.White, $"Due to above error, stopping evolving {pokemon.PokemonId}");
                    */
                }
            } while (evolvePokemonOutProto.Result == 1);
            if (countOfEvolvedUnits > 0)
                ColoredConsoleWrite(ConsoleColor.Cyan, 
                    $"[{DateTime.Now.ToString("HH:mm:ss")}] Evolved {countOfEvolvedUnits} pieces of {pokemon.PokemonId} for {xpCount}xp");

            await Task.Delay(3000);
        }
    } 

Myojine avatar Jul 22 '16 02:07 Myojine

There are things I changed in this function. Cant really tell you if there is an error in your version. Maybe someone will help you or you get my version when I commit it in approx. 12 hours or something.

Sen66 avatar Jul 22 '16 02:07 Sen66