Skip to content

Commit

Permalink
Merge pull request #9 from PokemonGoF/dev
Browse files Browse the repository at this point in the history
Importing Latest dev build from Head
  • Loading branch information
goedzo authored Jul 18, 2017
2 parents e32cd14 + 7b95e6a commit a760243
Show file tree
Hide file tree
Showing 10 changed files with 963 additions and 23 deletions.
11 changes: 11 additions & 0 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,16 @@
"enabled": true
}
},
{
"type": "GymPokemon",
"config": {
"enabled": false,
"order_by": "cp",
"min_interval":360,
"min_recheck":30,
"max_recheck":120
}
},
{
"type": "MoveToFort",
"config": {
Expand All @@ -482,6 +492,7 @@
"step_size": 70
}
}

],
"map_object_cache_time": 5,
"forts": {
Expand Down
25 changes: 24 additions & 1 deletion pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,21 +372,23 @@ def _register_events(self):
'moving_to_fort',
parameters=(
'fort_name',
'target_type',
'distance'
)
)
self.event_manager.register_event(
'moving_to_lured_fort',
parameters=(
'fort_name',
'target_type',
'distance',
'lure_distance'
)
)
self.event_manager.register_event(
'spun_pokestop',
parameters=(
'pokestop', 'exp', 'items'
'pokestop', 'exp', 'items', 'stop_kind', 'spin_amount_now'
)
)
self.event_manager.register_event(
Expand Down Expand Up @@ -559,6 +561,8 @@ def _register_events(self):
self.event_manager.register_event('catch_limit')
self.event_manager.register_event('spin_limit')
self.event_manager.register_event('show_best_pokemon', parameters=('pokemons'))
self.event_manager.register_event('revived_pokemon')
self.event_manager.register_event('healing_pokemon')

# level up stuff
self.event_manager.register_event(
Expand Down Expand Up @@ -1725,6 +1729,25 @@ def get_forts(self, order_by_distance=False):
))

return forts

def get_gyms(self, order_by_distance=False):
forts = [fort
for fort in self.cell['forts']
if 'latitude' in fort and 'type' not in fort]
# Need to filter out disabled gyms!
forts = filter(lambda x: x["enabled"] is True, forts)
forts = filter(lambda x: 'closed' not in fort, forts)
# forts = filter(lambda x: 'type' not in fort, forts)

if order_by_distance:
forts.sort(key=lambda x: distance(
self.position[0],
self.position[1],
x['latitude'],
x['longitude']
))

return forts

def get_map_objects(self, lat, lng, timestamp, cellid):
if time.time() - self.last_time_map_object < self.config.map_object_cache_time:
Expand Down
1 change: 1 addition & 0 deletions pokemongo_bot/cell_workers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
from .update_hash_stats import UpdateHashStats
from .bad_pokemon import BadPokemon
from .heal_pokemon import HealPokemon
from .gym_pokemon import GymPokemon
Loading

0 comments on commit a760243

Please sign in to comment.