Skip to content

Commit

Permalink
Merge pull request #4955 from PokemonGoF/fix_clean_run_issues
Browse files Browse the repository at this point in the history
Fix clean run issues
  • Loading branch information
solderzzc authored Aug 30, 2016
2 parents 3e7c638 + 83213e1 commit 87c401b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ def heartbeat(self):
'level': badgelevel}
)
human_behaviour.action_delay(3, 10)

inventory.refresh_inventory()

try:
Expand Down Expand Up @@ -1322,7 +1322,7 @@ def _load_recent_forts(self):
with open(cached_forts_path) as f:
cached_recent_forts = json.load(f)
except (IOError, ValueError) as e:
self.bot.logger.info('[x] Error while opening cached forts: %s' % e, 'red')
self.logger.info('[x] Error while opening cached forts: %s' % e, 'red')
pass
except:
raise FileIOException("Unexpected error opening {}".cached_forts_path)
Expand Down
19 changes: 13 additions & 6 deletions pokemongo_bot/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def exp(self, value):

def refresh(self,inventory):
self.player_stats = self.retrieve_data(inventory)

def parse(self, item):
if not item:
item = {}
Expand Down Expand Up @@ -1222,9 +1222,9 @@ def update_web_inventory(self):

def jsonify_inventory(self):
json_inventory = []

json_inventory.append({"inventory_item_data": {"player_stats": self.player.player_stats}})

for pokedex in self.pokedex.all():
json_inventory.append({"inventory_item_data": {"pokedex_entry": pokedex}})

Expand Down Expand Up @@ -1335,11 +1335,18 @@ def refresh_inventory(data=None):
:return: Nothing.
:rtype: None
"""
_inventory.refresh(data)
try:
_inventory.refresh(data)
except AttributeError:
print '_inventory was not initialized'

def jsonify_inventory():
return _inventory.jsonify_inventory()

try:
return _inventory.jsonify_inventory()
except AttributeError:
print '_inventory was not initialized'
return []

def update_web_inventory():
_inventory.update_web_inventory()

Expand Down

0 comments on commit 87c401b

Please sign in to comment.