From 534c1066a6fe65a343a9ee08a83b5fe3119427cf Mon Sep 17 00:00:00 2001 From: Raiven66 Date: Tue, 16 Aug 2016 23:23:35 +0200 Subject: [PATCH 1/6] * fixed followCluster not following lured clusters because of outdated pokestop data structure * fixed very annoying followCluster wording (OCD senses were tickling) * fixed #4022 --- pokemongo_bot/cell_workers/follow_cluster.py | 6 +++--- pokemongo_bot/cell_workers/move_to_map_pokemon.py | 2 +- pokemongo_bot/cell_workers/utils.py | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pokemongo_bot/cell_workers/follow_cluster.py b/pokemongo_bot/cell_workers/follow_cluster.py index 27008dcdf8..68189858c8 100644 --- a/pokemongo_bot/cell_workers/follow_cluster.py +++ b/pokemongo_bot/cell_workers/follow_cluster.py @@ -22,9 +22,9 @@ def work(self): 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') + 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 destination {num_points}. {forts} " "pokestops will be in range of {radius}. Walking {distance}m." ) self.emit_event( 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..4b5aa459a2 100644 --- a/pokemongo_bot/cell_workers/utils.py +++ b/pokemongo_bot/cell_workers/utils.py @@ -216,8 +216,10 @@ 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= + remaining = now = int(time.time()) - point['last_modified_timestamp_ms'] + f = point['latitude'], point['longitude'], remaining else: f = point['latitude'], point['longitude'], 0 graph.add_node(f) From 4cb50307eb128b30f8fcafa70a5183988255efcb Mon Sep 17 00:00:00 2001 From: Raiven66 Date: Tue, 16 Aug 2016 23:30:47 +0200 Subject: [PATCH 2/6] no message --- pokemongo_bot/cell_workers/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pokemongo_bot/cell_workers/utils.py b/pokemongo_bot/cell_workers/utils.py index 4b5aa459a2..99fa2b23e2 100644 --- a/pokemongo_bot/cell_workers/utils.py +++ b/pokemongo_bot/cell_workers/utils.py @@ -218,7 +218,8 @@ def find_biggest_cluster(radius, points, order=None): for point in points: if order is '9QM=': #is a lure module - 9QM= - remaining = now = int(time.time()) - point['last_modified_timestamp_ms'] + now = int(time.time()) + remaining = now - point['last_modified_timestamp_ms'] f = point['latitude'], point['longitude'], remaining else: f = point['latitude'], point['longitude'], 0 From 4ac070e3b6bb280500b6cdebcd939a3f949eeec2 Mon Sep 17 00:00:00 2001 From: Raiven66 Date: Tue, 16 Aug 2016 23:36:17 +0200 Subject: [PATCH 3/6] string formatting --- pokemongo_bot/cell_workers/follow_cluster.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pokemongo_bot/cell_workers/follow_cluster.py b/pokemongo_bot/cell_workers/follow_cluster.py index 68189858c8..5ddc4edeba 100644 --- a/pokemongo_bot/cell_workers/follow_cluster.py +++ b/pokemongo_bot/cell_workers/follow_cluster.py @@ -39,7 +39,7 @@ def work(self): if not self.is_at_destination: msg = log_lure_avail_str + ( - "Move to destination {num_points}. {forts} " + "Move to destination: {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)) } ) From 5c506c04c699fca4259b9535b330b365ab519582 Mon Sep 17 00:00:00 2001 From: Raiven66 Date: Tue, 16 Aug 2016 23:45:21 +0200 Subject: [PATCH 4/6] correcting message to display lured only when walking to lured cluster --- pokemongo_bot/cell_workers/follow_cluster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pokemongo_bot/cell_workers/follow_cluster.py b/pokemongo_bot/cell_workers/follow_cluster.py index 5ddc4edeba..a5509f8ccb 100644 --- a/pokemongo_bot/cell_workers/follow_cluster.py +++ b/pokemongo_bot/cell_workers/follow_cluster.py @@ -21,9 +21,9 @@ 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 'active_fort_modifier' in x] if len(lured_forts) > 0: + 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. ' From fe7bd9d6bfc848a52c4aeb23d0fd33994cc3faeb Mon Sep 17 00:00:00 2001 From: Raiven66 Date: Tue, 16 Aug 2016 23:48:44 +0200 Subject: [PATCH 5/6] message formatting --- pokemongo_bot/cell_workers/follow_cluster.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pokemongo_bot/cell_workers/follow_cluster.py b/pokemongo_bot/cell_workers/follow_cluster.py index a5509f8ccb..1e227c0343 100644 --- a/pokemongo_bot/cell_workers/follow_cluster.py +++ b/pokemongo_bot/cell_workers/follow_cluster.py @@ -39,7 +39,7 @@ def work(self): if not self.is_at_destination: msg = log_lure_avail_str + ( - "Move to destination: {num_points} {forts} " + "Move to cluster: {num_points} {forts} " "pokestops will be in range of {radius}. Walking {distance}m." ) self.emit_event( @@ -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 } ) From e9caa818d11bf3e6892de1856da0c5388ee7c72c Mon Sep 17 00:00:00 2001 From: Raiven66 Date: Tue, 16 Aug 2016 23:54:47 +0200 Subject: [PATCH 6/6] forgot to add regester event variable --- pokemongo_bot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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' ) )