diff --git a/.gitmodules b/.gitmodules index 7930970692..e69de29bb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "origin"] - path = web - url = https://github.com/OpenPoGo/OpenPoGoWeb.git \ No newline at end of file diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 410bdac704..acf2ec877e 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -212,6 +212,7 @@ def _setup_api(self): logger.log('[#] PokeBalls: ' + str(balls_stock[1])) logger.log('[#] GreatBalls: ' + str(balls_stock[2])) logger.log('[#] UltraBalls: ' + str(balls_stock[3])) + logger.log('[#] Razz Berries: ' + str(self.item_inventory_count(701))) self.get_player_info() diff --git a/pokemongo_bot/cell_workers/pokemon_catch_worker.py b/pokemongo_bot/cell_workers/pokemon_catch_worker.py index 05ace03865..55f5742c50 100644 --- a/pokemongo_bot/cell_workers/pokemon_catch_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_catch_worker.py @@ -33,8 +33,11 @@ def work(self): if 'ENCOUNTER' in response_dict['responses']: if 'status' in response_dict['responses']['ENCOUNTER']: if response_dict['responses']['ENCOUNTER']['status'] is 7: - logger.log('[x] Pokemon Bag is full!', 'red') - return PokemonCatchWorker.BAG_FULL + if self.config.initial_transfer: + logger.log('[x] Pokemon Bag is full!', 'red') + return PokemonCatchWorker.BAG_FULL + else: + raise RuntimeError('Pokemon Bag is full!') if response_dict['responses']['ENCOUNTER']['status'] is 1: cp = 0 @@ -81,8 +84,28 @@ def work(self): pokeball = 2 # then use great balls elif balls_stock[3] > 0: # or if great balls are out of stock too, and player has ultra balls... pokeball = 3 # then use ultra balls + + ## Use berry to increase success chance. + berry_id = 701 # @ TODO: use better berries if possible + berries_count = self.bot.item_inventory_count(berry_id) + if(catch_rate[pokeball-1] < 0.5 and berries_count > 0): # and berry is in stock + success_percentage = '{0:.2f}'.format(catch_rate[pokeball-1]*100) + logger.log('[x] Catch Rate with normal Pokeball is low ({}%). Throwing {}... ({} left!)'.format(success_percentage,self.item_list[str(berry_id)],berries_count-1)) + self.api.use_item_capture( + item_id=berry_id, + encounter_id = encounter_id, + spawn_point_guid = spawnpoint_id + ) + response_dict = self.api.call() + if response_dict and response_dict['status_code'] is 1 and 'item_capture_mult' in response_dict['responses']['USE_ITEM_CAPTURE']: + + for i in range(len(catch_rate)): + catch_rate[i] = catch_rate[i] * response_dict['responses']['USE_ITEM_CAPTURE']['item_capture_mult'] + + success_percentage = '{0:.2f}'.format(catch_rate[pokeball-1]*100) + logger.log('[#] Catch Rate with normal Pokeball has increased to {}%'.format(success_percentage)) else: - pokeball = 0 # player doesn't have any of pokeballs, great balls or ultra balls + logger.log('[x] Fail to use berry. Status Code: {}'.format(response_dict['status_code']),'red') while(pokeball < 3): if catch_rate[pokeball-1] < 0.35 and balls_stock[pokeball+1] > 0: @@ -92,8 +115,8 @@ def work(self): break # @TODO, use the best ball in stock to catch VIP (Very Important Pokemon: Configurable) - - if pokeball is 0: + + if balls_stock[pokeball] is 0: logger.log( '[x] Out of pokeballs, switching to farming mode...', 'red') # Begin searching for pokestops. @@ -126,23 +149,24 @@ def work(self): 'CATCH_POKEMON']['status'] if status is 2: logger.log( - '[-] Attempted to capture {}- failed.. trying again!'.format(pokemon_name), 'red') + '[-] Attempted to capture {} - failed.. trying again!'.format(pokemon_name), 'red') sleep(2) continue if status is 3: logger.log( '[x] Oh no! {} vanished! :('.format(pokemon_name), 'red') if status is 1: - logger.log( - '[x] Captured {}! [CP {}] [IV {}]'.format( - pokemon_name, - cp, - pokemon_potential - ), 'green' - ) - + id_list2 = self.count_pokemon_inventory() - + + logger.log('[x] Captured {}! [CP {}] [{}/{}/{}]'.format( + pokemon_name, + cp, + pokemon['pokemon_data']['individual_stamina'], + pokemon['pokemon_data']['individual_attack'], + pokemon['pokemon_data']['individual_defense'] + ), 'blue') + if self.config.evolve_captured: pokemon_to_transfer = list(Set(id_list2) - Set(id_list1)) self.api.evolve_pokemon(pokemon_id=pokemon_to_transfer[0]) @@ -166,9 +190,7 @@ def work(self): pokemon_to_transfer[0]) logger.log( '[#] {} has been exchanged for candy!'.format(pokemon_name), 'green') - else: - logger.log( - '[x] Captured {}! [CP {}]'.format(pokemon_name, cp), 'green') + break time.sleep(5) diff --git a/pokemongo_bot/logger.py b/pokemongo_bot/logger.py index 151e578a0f..f80d6b4ccb 100644 --- a/pokemongo_bot/logger.py +++ b/pokemongo_bot/logger.py @@ -9,9 +9,10 @@ def log(string, color = 'white'): colorHex = { + 'red': '91m', 'green': '92m', 'yellow': '93m', - 'red': '91m' + 'blue': '94m' } if color not in colorHex: print('[' + time.strftime("%Y-%m-%d %H:%M:%S") + '] '+ string) diff --git a/web b/web deleted file mode 160000 index dc742c598a..0000000000 --- a/web +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dc742c598a2636337bd358dae8a558ef02159e8e