From f7678da0f68573a7397c4c55a9804ee22dcbd53e Mon Sep 17 00:00:00 2001 From: cmezh Date: Thu, 11 Aug 2016 00:53:35 +0700 Subject: [PATCH] Fix #3411. Update inventory info before every catch try otherwise old values used --- pokemongo_bot/cell_workers/pokemon_catch_worker.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pokemongo_bot/cell_workers/pokemon_catch_worker.py b/pokemongo_bot/cell_workers/pokemon_catch_worker.py index 345fcabc7e..b712891ba4 100644 --- a/pokemongo_bot/cell_workers/pokemon_catch_worker.py +++ b/pokemongo_bot/cell_workers/pokemon_catch_worker.py @@ -283,11 +283,12 @@ def _do_catch(self, pokemon, encounter_id, catch_rate_by_ball, is_vip=False): maximum_ball = ITEM_ULTRABALL if is_vip else ITEM_GREATBALL ideal_catch_rate_before_throw = 0.9 if is_vip else 0.35 - berry_count = self.bot.item_inventory_count(berry_id) - items_stock = self.bot.current_inventory() - while True: + self.bot.latest_inventory = None + berry_count = self.bot.item_inventory_count(berry_id) + items_stock = self.bot.current_inventory() + # find lowest available ball current_ball = ITEM_POKEBALL while items_stock[current_ball] == 0 and current_ball < maximum_ball: