Skip to content

Commit

Permalink
Merge pull request #7 from goedzo/Basic-Gym-Support
Browse files Browse the repository at this point in the history
Import Basic gym support
  • Loading branch information
goedzo authored Jul 17, 2017
2 parents 3d5f6a0 + ea3e660 commit 851da62
Show file tree
Hide file tree
Showing 6 changed files with 817 additions and 2 deletions.
12 changes: 12 additions & 0 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,17 @@
"enabled": true
}
},
{
"type": "GymPokemon",
"config": {
"enabled": false,
"feed_berries": false,
"order_by": "cp",
"min_interval":360,
"min_recheck":30,
"max_recheck":120
}
},
{
"type": "MoveToFort",
"config": {
Expand All @@ -482,6 +493,7 @@
"step_size": 70
}
}

],
"map_object_cache_time": 5,
"forts": {
Expand Down
19 changes: 19 additions & 0 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,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 851da62

Please sign in to comment.