diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index f79a72a9a1..ee47484e3f 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -418,7 +418,7 @@ def _register_events(self): self.event_manager.register_event( 'arrived_at_cluster', parameters=( - 'forts', 'radius' + 'num_points', 'forts', 'radius' ) ) diff --git a/pokemongo_bot/cell_workers/follow_cluster.py b/pokemongo_bot/cell_workers/follow_cluster.py index 27008dcdf8..1e227c0343 100644 --- a/pokemongo_bot/cell_workers/follow_cluster.py +++ b/pokemongo_bot/cell_workers/follow_cluster.py @@ -21,10 +21,10 @@ def work(self): log_lure_avail_str = '' log_lured_str = '' if self.lured: - log_lured_str = 'lured ' - lured_forts = [x for x in forts if 'lure_info' in x] + lured_forts = [x for x in forts if 'active_fort_modifier' in x] if len(lured_forts) > 0: - self.dest = find_biggest_cluster(self.radius, lured_forts, 'lure_info') + log_lured_str = 'lured ' + self.dest = find_biggest_cluster(self.radius, lured_forts, '9QM=') else: log_lure_avail_str = 'No lured pokestops in vicinity. Search for normal ones instead. ' self.dest = find_biggest_cluster(self.radius, forts) @@ -39,7 +39,7 @@ def work(self): if not self.is_at_destination: msg = log_lure_avail_str + ( - "Move to destiny {num_points}. {forts} " + "Move to cluster: {num_points} {forts} " "pokestops will be in range of {radius}. Walking {distance}m." ) self.emit_event( @@ -49,7 +49,7 @@ def work(self): 'num_points': cnt, 'forts': log_lured_str, 'radius': str(self.radius), - 'distance': str(distance(self.bot.position[0], self.bot.position[1], lat, lng)) + 'distance': str(round(distance(self.bot.position[0], self.bot.position[1], lat, lng), 2)) } ) @@ -71,9 +71,10 @@ def work(self): elif not self.announced: self.emit_event( 'arrived_at_cluster', - formatted="Arrived at cluster. {forts} are in a range of {radius}m radius.", + formatted="Arrived at cluster. {num_points} {forts} pokestops are in a range of {radius}m radius.", data={ - 'forts': str(cnt), + 'num_points': cnt, + 'forts': log_lured_str, 'radius': self.radius } ) diff --git a/pokemongo_bot/cell_workers/move_to_map_pokemon.py b/pokemongo_bot/cell_workers/move_to_map_pokemon.py index 82bb509419..7717d5db21 100644 --- a/pokemongo_bot/cell_workers/move_to_map_pokemon.py +++ b/pokemongo_bot/cell_workers/move_to_map_pokemon.py @@ -144,7 +144,7 @@ def get_pokemon_from_map(self): # pokemon not reachable with mean walking speed (by config) mean_walk_speed = (self.bot.config.walk_max + self.bot.config.walk_min) / 2 - if pokemon['dist'] > ((pokemon['expire'] - now) * mean_walk_speed) and not self.config['snipe']: + if pokemon['dist'] > ((pokemon['disappear_time'] - now) * mean_walk_speed) and not self.config['snipe']: continue pokemon_list.append(pokemon) diff --git a/pokemongo_bot/cell_workers/utils.py b/pokemongo_bot/cell_workers/utils.py index 946c757b16..99fa2b23e2 100644 --- a/pokemongo_bot/cell_workers/utils.py +++ b/pokemongo_bot/cell_workers/utils.py @@ -216,8 +216,11 @@ def rad2deg(rad): def find_biggest_cluster(radius, points, order=None): graph = nx.Graph() for point in points: - if order is 'lure_info': - f = point['latitude'], point['longitude'], point['lure_info']['lure_expires_timestamp_ms'] + if order is '9QM=': + #is a lure module - 9QM= + now = int(time.time()) + remaining = now - point['last_modified_timestamp_ms'] + f = point['latitude'], point['longitude'], remaining else: f = point['latitude'], point['longitude'], 0 graph.add_node(f)