Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable item ID's in the item_filter. #1986

Merged
merged 2 commits into from
Jul 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion pokemongo_bot/cell_workers/recycle_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,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)
Expand Down