Repository: PokemonGoF/PokemonGo-Bot

Issue:
Evolve speed in config being disregarded
`{
        "type": "EvolvePokemon",
        "config": {
          "enabled": true,
          "evolve_list": "Caterpie,Weedle,Pidgey,Rattata,Spearow",
          "donot_evolve_list": "",
          "first_evolve_by": "iv",
          "evolve_above_cp": 9,
          "evolve_above_iv": 0.1,
          "logic": "and",
          "min_evolve_speed": 31,
          "max_evolve_speed": 36,
          "use_lucky_egg": false
        }
      },`

[2016-09-07 14:07:16] Evolved Weedle [IV 0.24] [CP 44] [3 candies] [+500 xp]
[2016-09-07 14:07:41] Moving towards pokestop Roland Gibson Gallery - 378.09m
~25 seconds

[2016-09-07 14:16:12] Evolved Pidgey [IV 0.58] [CP 116] [4 candies] [+500 xp]
[2016-09-07 14:16:39] Moving towards pokestop Roland Gibson Gallery - 97.63m
~27 seconds

[2016-09-07 15:08:22] Evolved Rattata [IV 0.71] [CP 196] [2 candies] [+500 xp]
[2016-09-07 15:08:46] Moving towards pokestop Winnebago - 261.16m
~24 seconds

Editing evolve_pokemon.py obviously resolved the issue. This does not appear to happen during start of bot when a batch is evolved but only appears to be happening for me when between other tasks.

Evolve speed in config being disregarded
`{
        "type": "EvolvePokemon",
        "config": {
          "enabled": true,
          "evolve_list": "Caterpie,Weedle,Pidgey,Rattata,Spearow",
          "donot_evolve_list": "",
          "first_evolve_by": "iv",
          "evolve_above_cp": 9,
          "evolve_above_iv": 0.1,
          "logic": "and",
          "min_evolve_speed": 31,
          "max_evolve_speed": 36,
          "use_lucky_egg": false
        }
      },`

[2016-09-07 14:07:16] Evolved Weedle [IV 0.24] [CP 44] [3 candies] [+500 xp]
[2016-09-07 14:07:41] Moving towards pokestop Roland Gibson Gallery - 378.09m
~25 seconds

[2016-09-07 14:16:12] Evolved Pidgey [IV 0.58] [CP 116] [4 candies] [+500 xp]
[2016-09-07 14:16:39] Moving towards pokestop Roland Gibson Gallery - 97.63m
~27 seconds

[2016-09-07 15:08:22] Evolved Rattata [IV 0.71] [CP 196] [2 candies] [+500 xp]
[2016-09-07 15:08:46] Moving towards pokestop Winnebago - 261.16m
~24 seconds

Editing evolve_pokemon.py obviously resolved the issue. This does not appear to happen during start of bot when a batch is evolved but only appears to be happening for me when between other tasks.



Discussion:

Resolving patch:
diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py
--- a/pokemongo_bot/__init__.py
+++ b/pokemongo_bot/__init__.py
@@ -1078,6 +1078,7 @@ def get_poke_info(info, pokemon):
         self.logger.info('Pokemon:')
 
         for pokes in pokemon_list:
+            pokes.sort(key=lambda p: p.cp, reverse=True)
             line_p = '#{} {}'.format(pokes[0].pokemon_id, pokes[0].name)
             if show_count:
                 line_p += '[{}]'.format(len(pokes))
diff --git a/pokemongo_bot/cell_workers/evolve_pokemon.py b/pokemongo_bot/cell_workers/evolve_pokemon.py
--- a/pokemongo_bot/cell_workers/evolve_pokemon.py
+++ b/pokemongo_bot/cell_workers/evolve_pokemon.py
@@ -1,7 +1,7 @@
 from random import uniform
 
 from pokemongo_bot import inventory
-from pokemongo_bot.human_behaviour import sleep
+from pokemongo_bot.human_behaviour import sleep, action_delay
 from pokemongo_bot.inventory import Pokemon
 from pokemongo_bot.item_list import Item
 from pokemongo_bot.base_task import BaseTask
@@ -143,7 +143,7 @@ def _execute_pokemon_evolve(self, pokemon, cache):
             inventory.pokemons().add(new_pokemon)
             inventory.player().exp += xp
 
-            sleep(uniform(self.min_evolve_speed, self.max_evolve_speed))
+            action_delay(self.min_evolve_speed, self.max_evolve_speed)
             evolve_result = True
         else:
             # cache pokemons we can't evolve. Less server calls


Test patch: