Skip to content

Commit

Permalink
Merge pull request #2 from goedzo/Basic-Gym-Support
Browse files Browse the repository at this point in the history
Update DEV: Basic gym support
  • Loading branch information
goedzo authored Jul 15, 2017
2 parents 22ff6eb + d17c4e1 commit dc7711c
Show file tree
Hide file tree
Showing 8 changed files with 769 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

FROM alpine

ARG BUILD_REPO=goedzo/PokemonGo-Bot
ARG BUILD_REPO=PokemonGoF/PokemonGo-Bot
ARG BUILD_BRANCH=master

LABEL build_repo=$BUILD_REPO build_branch=$BUILD_BRANCH
Expand Down
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 @@ -1725,6 +1725,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 @@ -34,3 +34,4 @@
from .catch_limiter import CatchLimiter
from .update_hash_stats import UpdateHashStats
from .bad_pokemon import BadPokemon
from .gym_pokemon import GymPokemon
Loading

0 comments on commit dc7711c

Please sign in to comment.