diff --git a/README.md b/README.md index 8f21aefe1b..56d0636e91 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,8 @@ This project uses Google Maps. There's one map coupled with the project, but as -du, --distance_unit UNIT Set the unit to display distance in (e.g, km for kilometers, mi for miles, ft for feet) -it, --initial_transfer Start the bot with a pokemon clean up, keeping only the higher CP of each pokemon. It respects -c as upper limit to release. -ms, --max_steps MAX_STEP Set the steps around your initial location (DEFAULT 5 mean 25 cells around your location) + -iv IV, --pokemon_potential Set the ratio for the IV values to transfer (DEFAULT 0.4 eg. 0.4 will transfer a pokemon with IV 0.3) + -if LIST, --item_filter LIST Pass a list of unwanted items to recycle when collected at a Pokestop (e.g, [\"101\",\"102\",\"103\",\"104\"] to recycle potions when collected)" -d, --debug Debug Mode -t, --test Only parse the specified location diff --git a/config.json.example b/config.json.example index 66aed50122..4886d229b1 100644 --- a/config.json.example +++ b/config.json.example @@ -11,7 +11,8 @@ "debug": false, "test": false, "initial_transfer": false, - "pokemon_potential": 0.70, + "pokemon_potential": 0.1, "location_cache": true, - "distance_unit": "km" + "distance_unit": "km", + "item_filter": ["101","102","103","104"] } diff --git a/pokecli.py b/pokecli.py index b960d53597..0f7e1d3553 100755 --- a/pokecli.py +++ b/pokecli.py @@ -117,6 +117,14 @@ def init_config(): "Set the unit to display distance in (e.g, km for kilometers, mi for miles, ft for feet)", type=str, default="km") + + parser.add_argument( + "-if", + "--item_filter", + help= + "Pass a list of unwanted items to recycle when collected at a Pokestop (e.g, [\"101\",\"102\",\"103\",\"104\"] to recycle potions when collected)", + type=list, + default=[]) config = parser.parse_args() if not config.username and not 'username' in load: diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py index 95a9ec27e8..f59c4cfbbd 100644 --- a/pokemongo_bot/__init__.py +++ b/pokemongo_bot/__init__.py @@ -193,9 +193,6 @@ def _setup_api(self): logger.log('[#] GreatBalls: ' + str(balls_stock[2])) logger.log('[#] UltraBalls: ' + str(balls_stock[3])) - # Testing - # self.drop_item(Item.ITEM_POTION.value,1) - # exit(0) self.get_player_info() if self.config.initial_transfer: @@ -207,7 +204,10 @@ def _setup_api(self): def drop_item(self, item_id, count): self.api.recycle_inventory_item(item_id=item_id, count=count) inventory_req = self.api.call() - print(inventory_req) + + # Example of good request response + #{'responses': {'RECYCLE_INVENTORY_ITEM': {'result': 1, 'new_count': 46}}, 'status_code': 1, 'auth_ticket': {'expire_timestamp_ms': 1469306228058L, 'start': '/HycFyfrT4t2yB2Ij+yoi+on778aymMgxY6RQgvrGAfQlNzRuIjpcnDd5dAxmfoTqDQrbz1m2dGqAIhJ+eFapg==', 'end': 'f5NOZ95a843tgzprJo4W7Q=='}, 'request_id': 8145806132888207460L} + return inventory_req def initial_transfer(self): logger.log('[x] Initial Transfer.') diff --git a/pokemongo_bot/cell_workers/pokemon_catch_worker.py b/pokemongo_bot/cell_workers/pokemon_catch_worker.py index 133882d1ea..4d21cb18a5 100644 --- a/pokemongo_bot/cell_workers/pokemon_catch_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_catch_worker.py @@ -75,14 +75,20 @@ def work(self): # print 'use Poke Ball' pokeball = 1 - if cp > 300 and balls_stock[2] > 0: - # print 'use Great Ball' - pokeball = 2 - - if cp > 700 and balls_stock[3] > 0: - # print 'use Utra Ball' - pokeball = 3 - + if balls_stock[2] > 0: + if pokeball is 0 and cp <= 300 and balls_stock[2] < 10: + print('Great Ball stock is low... saving for pokemon with cp greater than 300') + elif cp > 300 or pokeball is 0: + #print 'use Great Ball' + pokeball = 2 + + if balls_stock[3] > 0: + if pokeball is 0 and cp <= 700 and balls_stock[3] < 10: + print('Ultra Ball stock is low... saving for pokemon with cp greater than 700') + elif cp > 700 or pokeball is 0: + #print 'use Utra Ball' + pokeball = 3 + if pokeball is 0: print_red( '[x] Out of pokeballs, switching to farming mode...') diff --git a/pokemongo_bot/cell_workers/seen_fort_worker.py b/pokemongo_bot/cell_workers/seen_fort_worker.py index 4a062f8f84..f43b949795 100644 --- a/pokemongo_bot/cell_workers/seen_fort_worker.py +++ b/pokemongo_bot/cell_workers/seen_fort_worker.py @@ -13,6 +13,7 @@ class SeenFortWorker(object): def __init__(self, fort, bot): self.fort = fort self.api = bot.api + self.bot = bot self.position = bot.position self.config = bot.config self.item_list = bot.item_list @@ -87,12 +88,27 @@ def work(self): tmp_count_items[item_id] += item['item_count'] for item_id, item_count in tmp_count_items.iteritems(): - item_id = str(item_id) - item_name = self.item_list[item_id] - - logger.log("[+] " + str(item_count) + "x " + item_name, - 'green') - + item_name = self.item_list[str(item_id)] + + logger.log("[+] " + str(item_count) + + "x " + item_name, 'green') + + + # RECYCLING UNWANTED ITEMS + if str(item_id) in self.config.item_filter: + logger.log("[+] Recycling " + str(item_count) + "x " + item_name + "...", 'green') + #RECYCLE_INVENTORY_ITEM + response_dict_recycle = self.bot.drop_item(item_id=item_id, count=item_count) + + if response_dict_recycle and \ + 'responses' in response_dict_recycle and \ + 'RECYCLE_INVENTORY_ITEM' in response_dict_recycle['responses'] and \ + 'result' in response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']: + result = response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']['result'] + if result is 1: # Request success + logger.log("[+] Recycling success, count of " + item_name + "s kept at : " + str(response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']['new_count']), 'green') + else: + logger.log("[+] Recycling failed!", 'red') else: logger.log("[#] Nothing found.", 'yellow') diff --git a/pokemongo_bot/stepper.py b/pokemongo_bot/stepper.py index 167af9a52b..d6004d9fe3 100644 --- a/pokemongo_bot/stepper.py +++ b/pokemongo_bot/stepper.py @@ -35,7 +35,6 @@ def take_step(self): position = (self.origin_lat, self.origin_lon, 0.0) self.api.set_position(*position) - for step in range(self.steplimit2): # starting at 0 index logger.log('[#] Scanning area for objects ({} / {})'.format(