From dd7fdd0a5d81a663c3f66deab240506934e2c27d Mon Sep 17 00:00:00 2001 From: developerllazy Date: Sat, 1 Oct 2016 13:50:56 +0800 Subject: [PATCH 01/12] Seperate the event of Pokemon_caught to 2. 1 for normal and 1 for VIP. Therefore, you can subscrib the vip_caught event in telegram. --- pokemongo_bot/__init__.py | 14 +++++ .../cell_workers/pokemon_catch_worker.py | 60 +++++++++++++------ 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 2a258b22aa..6e81651c1f 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -476,6 +476,20 @@ def _register_events(self): 'caught_last_24_hour', ) ) + self.event_manager.register_event( + 'pokemon_vip_caught', + parameters=( + 'pokemon', + 'ncp', 'cp', 'iv', 'iv_display', 'exp', + 'stardust', + 'encounter_id', + 'latitude', + 'longitude', + 'pokemon_id', + 'daily_catch_limit', + 'caught_last_24_hour', + ) + ) self.event_manager.register_event( 'pokemon_evolved', parameters=('pokemon', 'iv', 'cp', 'candy', 'xp') diff --git a/pokemongo_bot/cell_workers/pokemon_catch_worker.py b/pokemongo_bot/cell_workers/pokemon_catch_worker.py index 75ecb579df..ae43e44da5 100644 --- a/pokemongo_bot/cell_workers/pokemon_catch_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_catch_worker.py @@ -649,25 +649,47 @@ def _do_catch(self, pokemon, encounter_id, catch_rate_by_ball, is_vip=False): result = c.fetchone() - self.emit_event( - 'pokemon_caught', - formatted='Captured {pokemon}! (CP: {cp} IV: {iv} {iv_display} NCP: {ncp}) Catch Limit: ({caught_last_24_hour}/{daily_catch_limit}) +{exp} exp +{stardust} stardust', - data={ - 'pokemon': pokemon.name, - 'ncp': str(round(pokemon.cp_percent, 2)), - 'cp': str(int(pokemon.cp)), - 'iv': str(pokemon.iv), - 'iv_display': str(pokemon.iv_display), - 'exp': str(exp_gain), - 'stardust': stardust_gain, - 'encounter_id': str(self.pokemon['encounter_id']), - 'latitude': str(self.pokemon['latitude']), - 'longitude': str(self.pokemon['longitude']), - 'pokemon_id': str(pokemon.pokemon_id), - 'caught_last_24_hour': str(result[0]), - 'daily_catch_limit': str(self.daily_catch_limit) - } - ) + if is_vip: + self.emit_event( + 'pokemon_vip_caught', + formatted='Vip Captured {pokemon}! (CP: {cp} IV: {iv} {iv_display} NCP: {ncp}) Catch Limit: ({caught_last_24_hour}/{daily_catch_limit}) +{exp} exp +{stardust} stardust', + data={ + 'pokemon': pokemon.name, + 'ncp': str(round(pokemon.cp_percent, 2)), + 'cp': str(int(pokemon.cp)), + 'iv': str(pokemon.iv), + 'iv_display': str(pokemon.iv_display), + 'exp': str(exp_gain), + 'stardust': stardust_gain, + 'encounter_id': str(self.pokemon['encounter_id']), + 'latitude': str(self.pokemon['latitude']), + 'longitude': str(self.pokemon['longitude']), + 'pokemon_id': str(pokemon.pokemon_id), + 'caught_last_24_hour': str(result[0]), + 'daily_catch_limit': str(self.daily_catch_limit) + } + ) + + else: + self.emit_event( + 'pokemon_caught', + formatted='Captured {pokemon}! (CP: {cp} IV: {iv} {iv_display} NCP: {ncp}) Catch Limit: ({caught_last_24_hour}/{daily_catch_limit}) +{exp} exp +{stardust} stardust', + data={ + 'pokemon': pokemon.name, + 'ncp': str(round(pokemon.cp_percent, 2)), + 'cp': str(int(pokemon.cp)), + 'iv': str(pokemon.iv), + 'iv_display': str(pokemon.iv_display), + 'exp': str(exp_gain), + 'stardust': stardust_gain, + 'encounter_id': str(self.pokemon['encounter_id']), + 'latitude': str(self.pokemon['latitude']), + 'longitude': str(self.pokemon['longitude']), + 'pokemon_id': str(pokemon.pokemon_id), + 'caught_last_24_hour': str(result[0]), + 'daily_catch_limit': str(self.daily_catch_limit) + } + ) inventory.pokemons().add(pokemon) From 9adee341a063b45c8522ef42521a4119074d3a84 Mon Sep 17 00:00:00 2001 From: developerllazy Date: Sun, 2 Oct 2016 08:52:08 +0800 Subject: [PATCH 02/12] define color in logging_handler --- pokemongo_bot/event_handlers/logging_handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pokemongo_bot/event_handlers/logging_handler.py b/pokemongo_bot/event_handlers/logging_handler.py index f12544d0e6..1fea294e02 100644 --- a/pokemongo_bot/event_handlers/logging_handler.py +++ b/pokemongo_bot/event_handlers/logging_handler.py @@ -70,6 +70,7 @@ class LoggingHandler(EventHandler): 'pokemon_release': 'green', 'pokemon_upgraded': 'green', 'pokemon_vanished': 'red', + 'pokemon_vip_caught': 'blue', 'pokestop_empty': 'yellow', 'pokestop_log': 'magenta', 'pokestop_searching_too_often': 'yellow', From 17cc2b4fc31d7b3c9d48259956576c1dc8553090 Mon Sep 17 00:00:00 2001 From: Ghoster Date: Wed, 5 Oct 2016 11:27:46 +0200 Subject: [PATCH 03/12] Sniper task : More logs + correction of pokewatcher 's source Add more logs to see which pokemons will be used by the Sniper task. Correction of the pokewatcher source, change the expiration format type from "milliseconds" to "seconds" in configs files and documentation --- configs/config.json.example | 2 +- configs/config.json.map.example | 2 +- docs/configuration_files.md | 2 +- pokemongo_bot/cell_workers/sniper.py | 10 ++++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/configs/config.json.example b/configs/config.json.example index 901bae608d..568a62bad4 100644 --- a/configs/config.json.example +++ b/configs/config.json.example @@ -252,7 +252,7 @@ "name": { "param": "pokemon" }, "latitude": { "param": "cords" }, "longitude": { "param": "cords" }, - "expiration": { "param": "timeend", "format": "milliseconds" } + "expiration": { "param": "timeend", "format": "seconds" } } }, { diff --git a/configs/config.json.map.example b/configs/config.json.map.example index af64d62a77..be06a3f36c 100644 --- a/configs/config.json.map.example +++ b/configs/config.json.map.example @@ -506,7 +506,7 @@ "name": { "param": "pokemon" }, "latitude": { "param": "cords" }, "longitude": { "param": "cords" }, - "expiration": { "param": "timeend", "format": "milliseconds" } + "expiration": { "param": "timeend", "format": "seconds" } } }, { diff --git a/docs/configuration_files.md b/docs/configuration_files.md index 77b57afc16..854292238d 100644 --- a/docs/configuration_files.md +++ b/docs/configuration_files.md @@ -846,7 +846,7 @@ This task is an upgrade version of the MoveToMapPokemon task. It will fetch poke "name": { "param": "pokemon" }, "latitude": { "param": "cords" }, "longitude": { "param": "cords" }, - "expiration": { "param": "timeend", "format": "milliseconds" } + "expiration": { "param": "timeend", "format": "seconds" } } } ], diff --git a/pokemongo_bot/cell_workers/sniper.py b/pokemongo_bot/cell_workers/sniper.py index f4c9e648e5..edac1fd7ce 100644 --- a/pokemongo_bot/cell_workers/sniper.py +++ b/pokemongo_bot/cell_workers/sniper.py @@ -416,6 +416,16 @@ def work(self): if targets: # Order the targets (descending) targets = sorted(targets, key=itemgetter(*self.order), reverse=True) + #List Pokemons found + self._trace('Sniping the {} best Pokemons found, ordered by {}'.format(self.bullets, self.order)) + self._trace('+----+------+----------------+-------+----------+---------+---------+----------+') + self._trace('| # | Id | Name | IV | Verified | VIP | Missing | Priority |') + self._trace('+----+------+----------------+-------+----------+---------+---------+----------+') + row_format ="|{:>3} |{:>5} | {:<15}|{:>6} | {:<9}| {:<8}| {:<8}|{:>9} |" + for index, target in enumerate(targets): + self._trace(row_format.format(*[index+1, target.get('pokemon_id'), target.get('pokemon_name'), target.get('iv'), str(target.get('verified')), str(target.get('vip')), str(target.get('missing')), target.get('priority')])) + + self._trace('+----+------+----------------+-------+----------+---------+---------+----------+') shots = 0 # For as long as there are targets available, try to snipe untill we run out of bullets From b0ff209c0656719fdb5eb00eb62a4bbac003625e Mon Sep 17 00:00:00 2001 From: ChaosMarc Date: Wed, 5 Oct 2016 14:31:56 +0200 Subject: [PATCH 04/12] added candy_limit_absolute --- configs/config.json.cluster.example | 1 + configs/config.json.example | 1 + configs/config.json.map.example | 1 + configs/config.json.path.example | 1 + configs/config.json.pokemon.example | 1 + docs/configuration_files.md | 2 ++ pokemongo_bot/cell_workers/buddy_pokemon.py | 35 ++++++++++++++++++--- 7 files changed, 38 insertions(+), 4 deletions(-) diff --git a/configs/config.json.cluster.example b/configs/config.json.cluster.example index d0fea74420..c7c40db333 100644 --- a/configs/config.json.cluster.example +++ b/configs/config.json.cluster.example @@ -46,6 +46,7 @@ "best_in_family": true, "// candy_limit = 0 means no limit, so it will never change current buddy": {}, "candy_limit": 0, + "candy_limit_absolute":0, "// force_first_change = true will always change buddy at start removing current one": {}, "force_first_change": false, "buddy_change_wait_min": 3, diff --git a/configs/config.json.example b/configs/config.json.example index f4f088ca83..c3c4f47c23 100644 --- a/configs/config.json.example +++ b/configs/config.json.example @@ -83,6 +83,7 @@ "best_in_family": true, "// candy_limit = 0 means no limit, so it will never change current buddy": {}, "candy_limit": 0, + "candy_limit_absolute":0, "// force_first_change = true will always change buddy at start removing current one": {}, "force_first_change": false, "buddy_change_wait_min": 3, diff --git a/configs/config.json.map.example b/configs/config.json.map.example index 44f6c83dd8..fd487bb8de 100644 --- a/configs/config.json.map.example +++ b/configs/config.json.map.example @@ -46,6 +46,7 @@ "best_in_family": true, "// candy_limit = 0 means no limit, so it will never change current buddy": {}, "candy_limit": 0, + "candy_limit_absolute":0, "// force_first_change = true will always change buddy at start removing current one": {}, "force_first_change": false, "buddy_change_wait_min": 3, diff --git a/configs/config.json.path.example b/configs/config.json.path.example index eef1d26559..533bd570f1 100644 --- a/configs/config.json.path.example +++ b/configs/config.json.path.example @@ -46,6 +46,7 @@ "best_in_family": true, "// candy_limit = 0 means no limit, so it will never change current buddy": {}, "candy_limit": 0, + "candy_limit_absolute":0, "// force_first_change = true will always change buddy at start removing current one": {}, "force_first_change": false, "buddy_change_wait_min": 3, diff --git a/configs/config.json.pokemon.example b/configs/config.json.pokemon.example index 6fb5ba7f3c..fb0cb54574 100644 --- a/configs/config.json.pokemon.example +++ b/configs/config.json.pokemon.example @@ -46,6 +46,7 @@ "best_in_family": true, "// candy_limit = 0 means no limit, so it will never change current buddy": {}, "candy_limit": 0, + "candy_limit_absolute":0, "// force_first_change = true will always change buddy at start removing current one": {}, "force_first_change": false, "buddy_change_wait_min": 3, diff --git a/docs/configuration_files.md b/docs/configuration_files.md index f956af9579..fc079b0c19 100644 --- a/docs/configuration_files.md +++ b/docs/configuration_files.md @@ -1298,6 +1298,7 @@ After setting a buddy it's not possible to remove it, only change it. So if a bu * `buddy_list`: `Default: []`. List of pokemon names that will be used as buddy. If '[]' or 'none', will not use or change buddy. * `best_in_family`: `Default: True`. If True, picks best Pokemon in the family (sorted by cp). * `candy_limit`: `Default: 0`. Set the candy limit to be rewarded per buddy, when reaching this limit the bot will change the buddy to the next in the list. When candy_limit = 0 or only one buddy in list, it has no limit and never changes buddy. +* `candy_limit_absolute`: `Default: 0`. Set the absolute candy limit to be rewarded per buddy, when reaching this limit the bot will change the buddy to the next in the list. When candy_limit_absolute = 0 or only one buddy in list, it has no limit and never changes buddy. Use this to stop collecting candy when a candy threshold for your buddy's pokemon family is reached (e.g. 50 for evolving). * `force_first_change`: `Default: False`. If True, will try to change buddy at bot start according to the buddy list. If False, will use the buddy already set until candy_limit is reached and then use the buddy list. * `buddy_change_wait_min`: `Default: 3`. Minimum time (in seconds) that the buddy change takes. * `buddy_change_wait_max`: `Default: 5`. Maximum time (in seconds) that the buddy change takes. @@ -1314,6 +1315,7 @@ After setting a buddy it's not possible to remove it, only change it. So if a bu "best_in_family": true, "// candy_limit = 0 means no limit, so it will never change current buddy": {}, "candy_limit": 0, + "candy_limit_absolute": 0, "// force_first_change = true will always change buddy at start removing current one": {}, "force_first_change": false, "buddy_change_wait_min": 3, diff --git a/pokemongo_bot/cell_workers/buddy_pokemon.py b/pokemongo_bot/cell_workers/buddy_pokemon.py index 1db8a0b5de..bfe298e9e0 100644 --- a/pokemongo_bot/cell_workers/buddy_pokemon.py +++ b/pokemongo_bot/cell_workers/buddy_pokemon.py @@ -25,6 +25,7 @@ class BuddyPokemon(BaseTask): "best_in_family": true, "// candy_limit = 0 means no limit, so it will never change current buddy": {}, "candy_limit": 0, + "candy_limit_absolute": 0, "// force_first_change = true will always change buddy at start removing current one": {}, "force_first_change": false, "buddy_change_wait_min": 3, @@ -42,6 +43,16 @@ class BuddyPokemon(BaseTask): to the next in the list. When candy_limit = 0 or only one buddy in list, it has no limit and never changes buddy. + candy_limit_absolute: Default: 0. Set the absolute candy limit to be + rewarded per buddy, when reaching this + limit the bot will change the buddy to the + next in the list. When + candy_limit_absolute = 0 or only one buddy + in list, it has no limit and never changes + buddy. Use this to stop collecting candy + when a candy threshold for your buddy's + pokemon family is reached (e.g. 50 for + evolving). force_first_change: Default: False. If True, will try to change buddy at bot start according to the buddy list. If False, will use the buddy already set until candy_limit is reached @@ -61,6 +72,7 @@ def initialize(self): self.buddy_list = self.config.get('buddy_list', []) self.best_in_family = self.config.get('best_in_family', True) self.candy_limit = self.config.get('candy_limit', 0) # 0 = No Limit + self.candy_limit_absolute = self.config.get('candy_limit_absolute', 0) # 0 = No Limit self.force_first_change = self.config.get('force_first_change', False) self.buddy_change_wait_min = self.config.get('buddy_change_wait_min', 3) self.buddy_change_wait_max = self.config.get('buddy_change_wait_max', 5) @@ -93,10 +105,25 @@ def work(self): return WorkerResult.SUCCESS if self.buddy_list: - if self.force_first_change or not self.buddy or self.candy_limit != 0 and self.candy_awarded >= self.candy_limit: + pokemon = self._get_pokemon_by_name(self._get_pokemon_by_id(self.buddy['id']).name) + if pokemon is None: + self.force_first_change = True + else: + candies_absolute = inventory.candies().get(pokemon.family_id).quantity + + if self.force_first_change or not self.buddy or (self.candy_limit != 0 and self.candy_awarded >= self.candy_limit) or (self.candy_limit_absolute != 0 and candies_absolute >= self.candy_limit_absolute): self.force_first_change = False - remaining = [name for name in self.buddy_list if name not in self.cache] + remaining = [] + for name in self.buddy_list: + pokemon = self._get_pokemon_by_name(name) + if pokemon is None: + continue + elif self.candy_limit_absolute != 0 and inventory.candies().get(pokemon.family_id).quantity >= self.candy_limit_absolute: + continue + if name not in self.cache: + remaining.append(name) + if not remaining: self.cache = [] return WorkerResult.SUCCESS @@ -215,7 +242,7 @@ def _get_pokemon_by_name(self, name): pokemons = inventory.pokemons().all() pokemon = None for p in pokemons: - if p.name.lower() == name: + if p.name.lower() == name.lower(): pokemon = p break @@ -228,7 +255,7 @@ def _get_pokemon_by_name(self, name): } ) return None - + fam_id = pokemon.family_id poke_id = pokemon.pokemon_id if self.best_in_family: From f1a260755a096d7a50f8bd3e5a82c55f89e94ec0 Mon Sep 17 00:00:00 2001 From: ChaosMarc Date: Wed, 5 Oct 2016 14:40:11 +0200 Subject: [PATCH 05/12] revoved trailing spaces --- pokemongo_bot/cell_workers/buddy_pokemon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pokemongo_bot/cell_workers/buddy_pokemon.py b/pokemongo_bot/cell_workers/buddy_pokemon.py index bfe298e9e0..e49de7a08f 100644 --- a/pokemongo_bot/cell_workers/buddy_pokemon.py +++ b/pokemongo_bot/cell_workers/buddy_pokemon.py @@ -255,7 +255,7 @@ def _get_pokemon_by_name(self, name): } ) return None - + fam_id = pokemon.family_id poke_id = pokemon.pokemon_id if self.best_in_family: From fd4c8cd1d37ea9932d15d905a65065f6e3a8bd53 Mon Sep 17 00:00:00 2001 From: ChaosMarc Date: Wed, 5 Oct 2016 16:09:05 +0200 Subject: [PATCH 06/12] simplyfied checks --- pokemongo_bot/cell_workers/buddy_pokemon.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pokemongo_bot/cell_workers/buddy_pokemon.py b/pokemongo_bot/cell_workers/buddy_pokemon.py index e49de7a08f..3ebab38148 100644 --- a/pokemongo_bot/cell_workers/buddy_pokemon.py +++ b/pokemongo_bot/cell_workers/buddy_pokemon.py @@ -106,22 +106,13 @@ def work(self): if self.buddy_list: pokemon = self._get_pokemon_by_name(self._get_pokemon_by_id(self.buddy['id']).name) - if pokemon is None: - self.force_first_change = True - else: - candies_absolute = inventory.candies().get(pokemon.family_id).quantity - - if self.force_first_change or not self.buddy or (self.candy_limit != 0 and self.candy_awarded >= self.candy_limit) or (self.candy_limit_absolute != 0 and candies_absolute >= self.candy_limit_absolute): + if self.force_first_change or not self.buddy or pokemon is None or (self.candy_limit != 0 and self.candy_awarded >= self.candy_limit) or (self.candy_limit_absolute != 0 and inventory.candies().get(pokemon.family_id).quantity >= self.candy_limit_absolute): self.force_first_change = False remaining = [] for name in self.buddy_list: pokemon = self._get_pokemon_by_name(name) - if pokemon is None: - continue - elif self.candy_limit_absolute != 0 and inventory.candies().get(pokemon.family_id).quantity >= self.candy_limit_absolute: - continue - if name not in self.cache: + if name not in self.cache and pokemon is not None and (self.candy_limit_absolute == 0 or inventory.candies().get(pokemon.family_id).quantity < self.candy_limit_absolute): remaining.append(name) if not remaining: From 99d26d1aa79cd51dd0d499c70989e44f956804bb Mon Sep 17 00:00:00 2001 From: ChaosMarc Date: Wed, 5 Oct 2016 16:21:23 +0200 Subject: [PATCH 07/12] refactored absolute candy limit check into a function --- pokemongo_bot/cell_workers/buddy_pokemon.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pokemongo_bot/cell_workers/buddy_pokemon.py b/pokemongo_bot/cell_workers/buddy_pokemon.py index 3ebab38148..811a3b67dc 100644 --- a/pokemongo_bot/cell_workers/buddy_pokemon.py +++ b/pokemongo_bot/cell_workers/buddy_pokemon.py @@ -106,13 +106,13 @@ def work(self): if self.buddy_list: pokemon = self._get_pokemon_by_name(self._get_pokemon_by_id(self.buddy['id']).name) - if self.force_first_change or not self.buddy or pokemon is None or (self.candy_limit != 0 and self.candy_awarded >= self.candy_limit) or (self.candy_limit_absolute != 0 and inventory.candies().get(pokemon.family_id).quantity >= self.candy_limit_absolute): + if self.force_first_change or not self.buddy or pokemon is None or (self.candy_limit != 0 and self.candy_awarded >= self.candy_limit) or self._check_candy_limit_absolute(pokemon): self.force_first_change = False remaining = [] for name in self.buddy_list: pokemon = self._get_pokemon_by_name(name) - if name not in self.cache and pokemon is not None and (self.candy_limit_absolute == 0 or inventory.candies().get(pokemon.family_id).quantity < self.candy_limit_absolute): + if name not in self.cache and pokemon is not None and not self._check_candy_limit_absolute(pokemon): remaining.append(name) if not remaining: @@ -217,6 +217,9 @@ def _get_award(self): ) return False + def _check_candy_limit_absolute(self, pokemon): + return self.candy_limit_absolute != 0 and inventory.candies().get(pokemon.family_id).quantity >= self.candy_limit_absolute + def _check_old_reward(self): if not self.buddy: return From f5379555a12255ab67a58fb00f6a49ec9e593e56 Mon Sep 17 00:00:00 2001 From: Pablo Silva Date: Sun, 6 Nov 2016 12:13:46 -0800 Subject: [PATCH 08/12] Minimum changes for new API to work on Windows and Linux --- pokemongo_bot/__init__.py | 54 +++++++++++++++++++++++++-------------- requirements.txt | 2 +- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 6e81651c1f..36e44595ec 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -476,20 +476,6 @@ def _register_events(self): 'caught_last_24_hour', ) ) - self.event_manager.register_event( - 'pokemon_vip_caught', - parameters=( - 'pokemon', - 'ncp', 'cp', 'iv', 'iv_display', 'exp', - 'stardust', - 'encounter_id', - 'latitude', - 'longitude', - 'pokemon_id', - 'daily_catch_limit', - 'caught_last_24_hour', - ) - ) self.event_manager.register_event( 'pokemon_evolved', parameters=('pokemon', 'iv', 'cp', 'candy', 'xp') @@ -924,7 +910,8 @@ def check_session(self, position): self.api = ApiWrapper(config=self.config) self.api.set_position(*position) self.login() - self.api.activate_signature(self.get_encryption_lib()) + self.api.set_signature_lib(self.get_encryption_lib()) + self.api.set_hash_lib(self.get_hash_lib()) def login(self): self.event_manager.emit( @@ -974,15 +961,16 @@ def login(self): ) self.heartbeat() + #I'm missing OSX libraries support, anyone that can help me on this. def get_encryption_lib(self): if _platform == "Windows" or _platform == "win32": # Check if we are on 32 or 64 bit if sys.maxsize > 2**32: - file_name = 'encrypt_64.dll' + file_name = 'encrypt64.dll' else: - file_name = 'encrypt.dll' + file_name = 'encrypt32.dll' else: - file_name = 'encrypt.so' + file_name = 'libencrypt-linux-x86-64.so' if self.config.encrypt_location == '': path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) @@ -999,6 +987,32 @@ def get_encryption_lib(self): return full_path + #I'm missing OSX libraries support, anyone that can help me on this. + def get_hash_lib(self): + if _platform == "Windows" or _platform == "win32": + # Check if we are on 32 or 64 bit + if sys.maxsize > 2**32: + file_name = 'niantichash64.dll' + else: + file_name = 'niantichash32.dll' + else: + file_name = 'libniantichash-linux-x86-64.so' + + if self.config.encrypt_location == '': + path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + else: + path = self.config.encrypt_location + + full_path = path + '/'+ file_name + if not os.path.isfile(full_path): + self.logger.error(file_name + ' is not found! Please place it in the bots root directory') + self.logger.info('Platform: '+ _platform + ' ' + file_name + ' directory: '+ path) + sys.exit(1) + else: + self.logger.info('Found '+ file_name +'! Platform: ' + _platform + ' ' + file_name + ' directory: ' + path) + + return full_path + def _setup_api(self): # instantiate pgoapi @var ApiWrapper self.api = ApiWrapper(config=self.config) @@ -1009,7 +1023,9 @@ def _setup_api(self): self.login() # chain subrequests (methods) into one RPC call - self.api.activate_signature(self.get_encryption_lib()) + self.api.set_signature_lib(self.get_encryption_lib()) + self.api.set_hash_lib(self.get_hash_lib()) + self.logger.info('') # send empty map_cells and then our position self.update_web_location() diff --git a/requirements.txt b/requirements.txt index 6036f1fb16..62c16aae25 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ numpy==1.11.0 networkx==1.11 --e git+https://github.com/pogodevorg/pgoapi.git/@3a02e7416f6924b1bbcbcdde60c10bd247ba8e11#egg=pgoapi +-e git+https://github.com/pogodevorg/pgoapi.git#egg=pgoapi geopy==1.11.0 geographiclib==1.46.3 protobuf==3.0.0b4 From c409a9ca69e45bd5d58e236c1e8dfc920daff6dc Mon Sep 17 00:00:00 2001 From: Pablo Silva Date: Sun, 6 Nov 2016 12:20:09 -0800 Subject: [PATCH 09/12] Minimum changes for new API to work on Windows and Linux --- pokemongo_bot/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 36e44595ec..c0d7d0c1be 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -476,6 +476,20 @@ def _register_events(self): 'caught_last_24_hour', ) ) + self.event_manager.register_event( + 'pokemon_vip_caught', + parameters=( + 'pokemon', + 'ncp', 'cp', 'iv', 'iv_display', 'exp', + 'stardust', + 'encounter_id', + 'latitude', + 'longitude', + 'pokemon_id', + 'daily_catch_limit', + 'caught_last_24_hour', + ) + ) self.event_manager.register_event( 'pokemon_evolved', parameters=('pokemon', 'iv', 'cp', 'candy', 'xp') From 526db0ab55e9b39d74412656703df54e0ada6c97 Mon Sep 17 00:00:00 2001 From: Pablo Silva Date: Mon, 7 Nov 2016 04:47:01 -0800 Subject: [PATCH 10/12] Fix on wrong filename for Linux libraries --- pokemongo_bot/__init__.py | 26 +++++++++++++------------- requirements.txt | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index c0d7d0c1be..c0a27effe4 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -167,7 +167,7 @@ def _setup_event_system(self): if self.config.websocket_start_embedded_server: self.sio_runner = SocketIoRunner(self.config.websocket_server_url) self.sio_runner.start_listening_async() - + websocket_handler = SocketIoHandler( self, self.config.websocket_server_url @@ -975,17 +975,17 @@ def login(self): ) self.heartbeat() - #I'm missing OSX libraries support, anyone that can help me on this. def get_encryption_lib(self): if _platform == "Windows" or _platform == "win32": # Check if we are on 32 or 64 bit if sys.maxsize > 2**32: - file_name = 'encrypt64.dll' + file_name = 'src/pgoapi/pgoapi/lib/encrypt64.dll' else: - file_name = 'encrypt32.dll' - else: - file_name = 'libencrypt-linux-x86-64.so' - + file_name = 'src/pgoapi/pgoapi/lib/encrypt32.dll' + if _platform.lower() == "darwin": + file_name= 'src/pgoapi/pgoapi/lib/libencrypt-osx-64.so' + if _platform.lower() == "linux" or _platform.lower() == "linux2": + file_name = 'src/pgoapi/pgoapi/lib/libencrypt-linux-x86-64.so' if self.config.encrypt_location == '': path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) else: @@ -1001,17 +1001,17 @@ def get_encryption_lib(self): return full_path - #I'm missing OSX libraries support, anyone that can help me on this. def get_hash_lib(self): if _platform == "Windows" or _platform == "win32": # Check if we are on 32 or 64 bit if sys.maxsize > 2**32: - file_name = 'niantichash64.dll' + file_name = 'src/pgoapi/pgoapi/lib/niantichash64.dll' else: - file_name = 'niantichash32.dll' - else: - file_name = 'libniantichash-linux-x86-64.so' - + file_name = 'src/pgoapi/pgoapi/lib/niantichash32.dll' + if _platform.lower() == "darwin": + file_name= 'src/pgoapi/pgoapi/lib/libniantichash-osx-64.so' + if _platform.lower() == "linux" or _platform.lower() == "linux2": + file_name = 'src/pgoapi/pgoapi/lib/libniantichash-linux-x86-64.so' if self.config.encrypt_location == '': path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) else: diff --git a/requirements.txt b/requirements.txt index 62c16aae25..f90247648a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ numpy==1.11.0 networkx==1.11 --e git+https://github.com/pogodevorg/pgoapi.git#egg=pgoapi +-e git+https://github.com/pogodevorg/pgoapi.git/@1a112879f424b518f994b99f43859dd95cd43fdf#egg=pgoapi geopy==1.11.0 geographiclib==1.46.3 protobuf==3.0.0b4 From e113ae561568c06366f8361809b9b56734e2f6e4 Mon Sep 17 00:00:00 2001 From: Simba Zhang Date: Mon, 7 Nov 2016 11:44:14 -0800 Subject: [PATCH 11/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1834026450..5e4e2a36de 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ If you do not want any data to be gathered, you can turn off this feature by set ## Credits - [tejado](https://github.com/tejado) many thanks for the API -- [U6 Group](http://pgoapi.com) for the U6 +- [pogodevorg](https://github.com/pogodevorg/pgoapi) Without keyphact's coordination, this would not gonna happan again. - [Mila432](https://github.com/Mila432/Pokemon_Go_API) for the login secrets - [elliottcarlson](https://github.com/elliottcarlson) for the Google Auth PR - [AeonLucid](https://github.com/AeonLucid/POGOProtos) for improved protos From 227f7986692c433908a6121580f1513cf6c70aa3 Mon Sep 17 00:00:00 2001 From: Simba Zhang Date: Mon, 7 Nov 2016 11:53:03 -0800 Subject: [PATCH 12/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a225794f2..8d0ce8d959 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # PokemonGo-Bot [PokemonGo-Bot](https://github.com/PokemonGoF/PokemonGo-Bot) is a project created by the [PokemonGoF](https://github.com/PokemonGoF) team. -## Is the bot working? [New API basic support](https://github.com/PokemonGoF/PokemonGo-Bot/pull/5784) +## Is the bot working? [Yes, since this PR](https://github.com/PokemonGoF/PokemonGo-Bot/pull/5784) ## Table of Contents - [Installation](https://github.com/PokemonGoF/PokemonGo-Bot/blob/dev/docs/installation.md)