def _setup_api(self): # instantiate pgoapi self.api = PGoApi() # provide player position on the earth self._set_starting_position() if not self.api.login(self.config.auth_service, str(self.config.username), str(self.config.password)): self.logger.error('Login Error, server busy', 'red') exit(0) # chain subrequests (methods) into one RPC call # get player profile call # ---------------------- self.api.get_player() response_dict = self.api.call() currency_1 = "0" currency_2 = "0" player = response_dict['responses']['GET_PLAYER']['player_data'] print response_dict # @@@ TODO: Convert this to d/m/Y H:M:S creation_date = datetime.datetime.fromtimestamp( player['creation_timestamp_ms'] / 1e3) pokecoins = '0' stardust = '0' balls_stock = self.pokeball_inventory() if 'amount' in player['currencies'][0]: pokecoins = player['currencies'][0]['amount'] if 'amount' in player['currencies'][1]: stardust = player['currencies'][1]['amount'] self.logger.info('[#] Username: {username}'.format(**player)) self.logger.info('[#] Acccount Creation: {}'.format(creation_date)) self.logger.info('[#] Bag Storage: {}/{}'.format( self.get_inventory_count('item'), player['max_item_storage'])) self.logger.info('[#] Pokemon Storage: {}/{}'.format( self.get_inventory_count('pokemon'), player[ 'max_pokemon_storage'])) self.logger.info('[#] Stardust: {}'.format(stardust)) self.logger.info('[#] Pokecoins: {}'.format(pokecoins)) self.logger.info('[#] PokeBalls: ' + str(balls_stock[1])) self.logger.info('[#] GreatBalls: ' + str(balls_stock[2])) self.logger.info('[#] UltraBalls: ' + str(balls_stock[3])) self.get_player_info() if self.config.initial_transfer: worker = InitialTransferWorker(self) worker.work() self.logger.info('[#]') self.update_inventory()
def catch_pokemon(self, pokemon): worker = PokemonCatchWorker(pokemon, self) return_value = worker.work() if return_value == PokemonCatchWorker.BAG_FULL: worker = InitialTransferWorker(self) worker.work() return return_value
def _setup_api(self): # instantiate pgoapi self.api = PGoApi() # check if the release_config file exists try: with open('release_config.json') as file: pass except: # the file does not exist, warn the user and exit. logger.log('[#] IMPORTANT: Rename and configure release_config.json.example for your Pokemon release logic first!', 'red') exit(0) # provide player position on the earth self._set_starting_position() if not self.api.login(self.config.auth_service, str(self.config.username), str(self.config.password)): logger.log('Login Error, server busy', 'red') exit(0) # chain subrequests (methods) into one RPC call # get player profile call # ---------------------- self.api.get_player() response_dict = self.api.call() #print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2))) currency_1 = "0" currency_2 = "0" player = response_dict['responses']['GET_PLAYER']['player_data'] # @@@ TODO: Convert this to d/m/Y H:M:S creation_date = datetime.datetime.fromtimestamp( player['creation_timestamp_ms'] / 1e3) pokecoins = '0' stardust = '0' balls_stock = self.pokeball_inventory() if 'amount' in player['currencies'][0]: pokecoins = player['currencies'][0]['amount'] if 'amount' in player['currencies'][1]: stardust = player['currencies'][1]['amount'] logger.log('[#] Username: {username}'.format(**player)) logger.log('[#] Acccount Creation: {}'.format(creation_date)) logger.log('[#] Bag Storage: {}/{}'.format( self.get_inventory_count('item'), player['max_item_storage'])) logger.log('[#] Pokemon Storage: {}/{}'.format( self.get_inventory_count('pokemon'), player[ 'max_pokemon_storage'])) logger.log('[#] Stardust: {}'.format(stardust)) logger.log('[#] Pokecoins: {}'.format(pokecoins)) logger.log('[#] PokeBalls: ' + str(balls_stock[1])) logger.log('[#] GreatBalls: ' + str(balls_stock[2])) logger.log('[#] UltraBalls: ' + str(balls_stock[3])) self.get_player_info() if self.config.initial_transfer: worker = InitialTransferWorker(self) worker.work() logger.log('[#]') self.update_inventory()
def _setup_api(self): # instantiate pgoapi self.api = PGoApi() # check if the release_config file exists try: with open("release_config.json") as file: pass except: # the file does not exist, warn the user and exit. logger.log( "[#] IMPORTANT: Rename and configure release_config.json.example for your Pokemon release logic first!", "red", ) exit(0) # set the farming border self._set_border_limit() # provide player position on the earth self._set_starting_position() # check if posisition is within the border self._check_starting_position_in_border() if not self.api.login(self.config.auth_service, str(self.config.username), str(self.config.password)): logger.log("Login Error, server busy", "red") exit(0) # chain subrequests (methods) into one RPC call # get player profile call # ---------------------- self.api.get_player() response_dict = self.api.call() # print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2))) currency_1 = "0" currency_2 = "0" player = response_dict["responses"]["GET_PLAYER"]["player_data"] # @@@ TODO: Convert this to d/m/Y H:M:S creation_date = datetime.datetime.fromtimestamp(player["creation_timestamp_ms"] / 1e3) pokecoins = "0" stardust = "0" balls_stock = self.pokeball_inventory() if "amount" in player["currencies"][0]: pokecoins = player["currencies"][0]["amount"] if "amount" in player["currencies"][1]: stardust = player["currencies"][1]["amount"] logger.log("[#] Username: {username}".format(**player)) logger.log("[#] Acccount Creation: {}".format(creation_date)) logger.log("[#] Bag Storage: {}/{}".format(self.get_inventory_count("item"), player["max_item_storage"])) logger.log( "[#] Pokemon Storage: {}/{}".format(self.get_inventory_count("pokemon"), player["max_pokemon_storage"]) ) logger.log("[#] Stardust: {}".format(stardust)) logger.log("[#] Pokecoins: {}".format(pokecoins)) logger.log("[#] PokeBalls: " + str(balls_stock[1])) logger.log("[#] GreatBalls: " + str(balls_stock[2])) logger.log("[#] UltraBalls: " + str(balls_stock[3])) self.get_player_info() if self.config.initial_transfer: worker = InitialTransferWorker(self) worker.work() logger.log("[#]") self.update_inventory()