Skip to content

Commit

Permalink
Fixed egg hatching data
Browse files Browse the repository at this point in the history
 * Need of api call to update inventory when an egg hatchs to be able to encounter the pokemon that hatched
 * Reverted/removed 'except IndexError', not needed now
  • Loading branch information
DeXtroTip committed Aug 30, 2016
1 parent c0f6a36 commit fdcbd76
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions pokemongo_bot/cell_workers/incubate_eggs.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def _apply_incubators(self, available_eggs, available_incubators):
egg["used"] = True

def _check_inventory(self, lookup_ids=[]):
inv = {}
if lookup_ids:
inventory.refresh_inventory()
matched_pokemon = []
temp_eggs = []
temp_used_incubators = []
Expand Down Expand Up @@ -212,21 +213,18 @@ def _hatch_eggs(self):
pokemon['name'] = "error"
except:
pokemon_data = [{"name":"error", "cp":"error", "iv":"error"}]
try:
if not pokemon_ids or pokemon_data[0]['name'] == "error":
self.emit_event(
'egg_hatched',
data={
'pokemon': 'error',
'cp': 'error',
'iv': 'error',
'exp': 'error',
'stardust': 'error',
'candy': 'error',
}
)
return
except IndexError:
if not pokemon_ids or pokemon_data[0]['name'] == "error":
self.emit_event(
'egg_hatched',
data={
'pokemon': 'error',
'cp': 'error',
'iv': 'error',
'exp': 'error',
'stardust': 'error',
'candy': 'error',
}
)
return
for i in range(len(pokemon_data)):
msg = "Egg hatched with a {pokemon} (CP {cp} - IV {iv}), {exp} exp, {stardust} stardust and {candy} candies."
Expand Down

0 comments on commit fdcbd76

Please sign in to comment.