From 67b64870939a9f19e88321dbe2b0ff6174e7397b Mon Sep 17 00:00:00 2001 From: Jasperrr91 Date: Sun, 31 Jul 2016 05:17:54 +0200 Subject: [PATCH 1/2] Allows users to enter both item ID's and item names in the item_filter. --- pokecli.py | 13 +++++++------ pokemongo_bot/cell_workers/recycle_items.py | 7 ++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pokecli.py b/pokecli.py index 8de464d81f..beb9ff3bf3 100755 --- a/pokecli.py +++ b/pokecli.py @@ -426,12 +426,13 @@ def task_configuration_error(flag_name): parser.error("--catch_randomize_spin_factor is out of range! (should be 0 <= catch_randomize_spin_factor <= 1)") return None - # item list config verification - item_list = json.load(open(os.path.join('data', 'items.json'))) - for config_item_name, bag_count in config.item_filter.iteritems(): - if config_item_name not in item_list.viewvalues(): - parser.error('item "' + config_item_name + '" does not exist, spelling mistake? (check for valid item names in data/items.json)') - return None + # item list config verification + item_list = json.load(open(os.path.join('data', 'items.json'))) + for config_item_name, bag_count in config.item_filter.iteritems(): + if config_item_name not in item_list.viewvalues(): + if config_item_name not in item_list: + parser.error('item "' + config_item_name + '" does not exist, spelling mistake? (check for valid item names in data/items.json)') + return None # create web dir if not exists try: diff --git a/pokemongo_bot/cell_workers/recycle_items.py b/pokemongo_bot/cell_workers/recycle_items.py index b7893dbe3b..8520aa139b 100644 --- a/pokemongo_bot/cell_workers/recycle_items.py +++ b/pokemongo_bot/cell_workers/recycle_items.py @@ -7,6 +7,7 @@ def __init__(self, bot, config): self.bot = bot def work(self): + self.bot.latest_inventory = None item_count_dict = self.bot.item_inventory_count('all') @@ -15,9 +16,13 @@ def work(self): id_filter = self.bot.config.item_filter.get(item_name, 0) if id_filter is not 0: id_filter_keep = id_filter.get('keep', 20) + else: + id_filter = self.bot.config.item_filter.get(str(item_id), 0) + if id_filter is not 0: + id_filter_keep = id_filter.get('keep', 20) bag_count = self.bot.item_inventory_count(item_id) - if item_name in self.bot.config.item_filter and bag_count > id_filter_keep: + if (item_name in self.bot.config.item_filter or str(item_id) in self.bot.config.item_filter) and bag_count > id_filter_keep: items_recycle_count = bag_count - id_filter_keep response_dict_recycle = self.send_recycle_item_request(item_id=item_id, count=items_recycle_count) result = response_dict_recycle.get('responses', {}).get('RECYCLE_INVENTORY_ITEM', {}).get('result', 0) From 492423d29b6196b34da0308a1a2cf04e8fb7d022 Mon Sep 17 00:00:00 2001 From: Jasperrr91 Date: Sun, 31 Jul 2016 05:40:50 +0200 Subject: [PATCH 2/2] no message --- pokemongo_bot/cell_workers/recycle_items.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pokemongo_bot/cell_workers/recycle_items.py b/pokemongo_bot/cell_workers/recycle_items.py index 8520aa139b..0a66bedb42 100644 --- a/pokemongo_bot/cell_workers/recycle_items.py +++ b/pokemongo_bot/cell_workers/recycle_items.py @@ -7,7 +7,6 @@ def __init__(self, bot, config): self.bot = bot def work(self): - self.bot.latest_inventory = None item_count_dict = self.bot.item_inventory_count('all')