Skip to content

Commit

Permalink
Merge branch 'dev' into map_synergy
Browse files Browse the repository at this point in the history
* dev: (21 commits)
  Use Default map_object_cache_time if not specified
  Request meta cell data once every 5 seconds (PokemonGoF#2171)
  Change FortID to FortName (PokemonGoF#2249)
  Let the user know that the maps api key exceeded its limits. (PokemonGoF#1989)
  fixed pokemon transfer so that "keep_best_*" filters can work again without requiring to be combined with "release_below_*" rules (PokemonGoF#2215)
  Using the logger instead of print in EvolveAll
  Remove MoveToFort from the FollowPath example config (PokemonGoF#2203)
  Removing nickname pokemon from the example config
  Adding a SleepSchedule worker.  Pause for some time every day (PokemonGoF#2193)
  Added nickname worker (PokemonGoF#1850)
  Moving evolve_cp_min to be a task level configuration
  Moving evolve_all to be a task level configuration
  Moving item_filter to be a task level configuration
  Fix incorrect config value for HandleSoftban. (PokemonGoF#2191)
  Better enforce rules about Pokemons to retain. (PokemonGoF#2073)
  This should fix issue: (PokemonGoF#2185)
  Revert "Adding an Anyball item to the release config" (PokemonGoF#2166)
  removed wrong log (PokemonGoF#2160)
  Adding an Anyball item to the release config (PokemonGoF#2140)
  Cluster Selection so it doesn't jump from cluster to cluster (PokemonGoF#2153)
  ...
  • Loading branch information
mhdasding committed Aug 1, 2016
2 parents d8fd589 + 2efe1b5 commit 33c6232
Show file tree
Hide file tree
Showing 21 changed files with 510 additions and 135 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@
* mhdasding
* MFizz
* NamPNQ
* matheussampaio
78 changes: 64 additions & 14 deletions configs/config.json.cluster.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
"tasks": [
{
"auth_service": "google",
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD",
"location": "SOME_LOCATION",
"gmapkey": "GOOGLE_MAPS_API_KEY",
"tasks": [
{
"type": "HandleSoftBan"
},
Expand All @@ -17,12 +23,24 @@
{
"type": "EvolveAll",
"config": {
"evolve_all": "NONE",
"evolve_cp_min": 300,
"evolve_speed": 20,
"use_lucky_egg": true
"use_lucky_egg": false
}
},
{
"type": "RecycleItems"
"type": "RecycleItems",
"config": {
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
"Super Potion": { "keep" : 20 },
"Hyper Potion": { "keep" : 30 },
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
}
}
},
{
"type": "CatchVisiblePokemon"
Expand Down Expand Up @@ -56,16 +74,48 @@
"location_cache": true,
"distance_unit": "km",
"reconnecting_timeout": 15,
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
"Super Potion": { "keep" : 20 },
"Hyper Potion": { "keep" : 30 },
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
},
"evolve_all": "NONE",
"evolve_cp_min": 300,
"evolve_captured": "NONE",
"catch_randomize_reticle_factor": 1.0,
"catch_randomize_spin_factor": 1.0,
"catch_randomize_spin_factor": 1.0,
"catch": {
"any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"},
"// Example of always catching Rattata:": {},
"// Rattata": { "always_catch" : true }
},
"release": {
"any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"},
"// Example of always releasing Rattata:": {},
"// Rattata": {"always_release": true},
"// Example of keeping 3 stronger (based on CP) Pidgey:": {},
"// Pidgey": {"keep_best_cp": 3},
"// Example of keeping 2 stronger (based on IV) Zubat:": {},
"// Zubat": {"keep_best_iv": 2},
"// Also, it is working with any": {},
"// any": {"keep_best_iv": 3},
"// Example of keeping the 2 strongest (based on CP) and 3 best (based on IV) Zubat:": {},
"// Zubat": {"keep_best_cp": 2, "keep_best_iv": 3}
},
"vips" : {
"Any pokemon put here directly force to use Berry & Best Ball to capture, to secure the capture rate!": {},
"any": {"catch_above_cp": 1200, "catch_above_iv": 0.9, "logic": "or" },
"Lapras": {},
"Moltres": {},
"Zapdos": {},
"Articuno": {},

"// S-Tier pokemons (if pokemon can be evolved into tier, list the representative)": {},
"Mewtwo": {},
"Dragonite": {},
"Snorlax": {},
"// Mew evolves to Mewtwo": {},
"Mew": {},
"Arcanine": {},
"Vaporeon": {},
"Gyarados": {},
"Exeggutor": {},
"Muk": {},
"Weezing": {},
"Flareon": {}

}
}
25 changes: 14 additions & 11 deletions configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@
{
"type": "EvolveAll",
"config": {
"evolve_all": "NONE",
"evolve_cp_min": 300,
"evolve_speed": 20,
"use_lucky_egg": false
}
},
{
"type": "RecycleItems"
"type": "RecycleItems",
"config": {
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
"Super Potion": { "keep" : 20 },
"Hyper Potion": { "keep" : 30 },
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
}
}
},
{
"type": "CatchVisiblePokemon"
Expand All @@ -46,6 +58,7 @@
"type": "FollowSpiral"
}
],
"map_object_cache_time": 5,
"max_steps": 5,
"forts": {
"avoid_circles": true,
Expand All @@ -61,16 +74,6 @@
"location_cache": true,
"distance_unit": "km",
"reconnecting_timeout": 15,
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
"Super Potion": { "keep" : 20 },
"Hyper Potion": { "keep" : 30 },
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
},
"evolve_all": "NONE",
"evolve_cp_min": 300,
"evolve_captured": "NONE",
"catch_randomize_reticle_factor": 1.0,
"catch_randomize_spin_factor": 1.0,
Expand Down
28 changes: 14 additions & 14 deletions configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@
{
"type": "EvolveAll",
"config": {
"evolve_all": "NONE",
"evolve_cp_min": 300,
"evolve_speed": 20,
"use_lucky_egg": false
}
},
{
"type": "RecycleItems"
"type": "RecycleItems",
"config": {
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
"Super Potion": { "keep" : 20 },
"Hyper Potion": { "keep" : 30 },
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
}
}
},
{
"type": "CatchVisiblePokemon"
Expand All @@ -39,9 +51,6 @@
{
"type": "SpinFort"
},
{
"type": "MoveToFort"
},
{
"type": "FollowPath",
"config": {
Expand All @@ -50,6 +59,7 @@
}
}
],
"map_object_cache_time": 5,
"max_steps": 5,
"forts": {
"avoid_circles": true,
Expand All @@ -65,16 +75,6 @@
"location_cache": true,
"distance_unit": "km",
"reconnecting_timeout": 15,
"item_filter": {
"1": { "keep" : 100 },
"101": { "keep" : 10 },
"102": { "keep" : 30 },
"103": { "keep" : 30 },
"201": { "keep" : 30 },
"701": { "keep" : 100 }
},
"evolve_all": "NONE",
"evolve_cp_min": 300,
"evolve_captured": "NONE",
"catch_randomize_reticle_factor": 1.0,
"catch_randomize_spin_factor": 1.0,
Expand Down
27 changes: 14 additions & 13 deletions configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@
{
"type": "EvolveAll",
"config": {
"evolve_all": "NONE",
"evolve_cp_min": 300,
"evolve_speed": 20,
"use_lucky_egg": false
}
},
{
"type": "RecycleItems"
"type": "RecycleItems",
"config": {
"item_filter": {
"Pokeball": { "keep" : 100 },
"Potion": { "keep" : 10 },
"Super Potion": { "keep" : 20 },
"Hyper Potion": { "keep" : 30 },
"Revive": { "keep" : 30 },
"Razz Berry": { "keep" : 100 }
}
}
},
{
"type": "CatchVisiblePokemon"
Expand All @@ -46,6 +58,7 @@
"type": "FollowSpiral"
}
],
"map_object_cache_time": 5,
"max_steps": 5,
"forts": {
"avoid_circles": true,
Expand All @@ -61,18 +74,6 @@
"location_cache": true,
"distance_unit": "km",
"reconnecting_timeout": 15,
"item_filter": {
"1": { "keep" : 50 },
"2": { "keep" : 50 },
"3": { "keep" : 50 },
"101": { "keep" : 10 },
"102": { "keep" : 25 },
"103": { "keep" : 25 },
"201": { "keep" : 25 },
"701": { "keep" : 100 }
},
"evolve_all": "NONE",
"evolve_cp_min": 300,
"evolve_captured": "NONE",
"catch_randomize_reticle_factor": 1.0,
"catch_randomize_spin_factor": 1.0,
Expand Down
47 changes: 17 additions & 30 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from datetime import timedelta
from getpass import getpass
from pgoapi.exceptions import NotLoggedInException
from geopy.exc import GeocoderQuotaExceeded

from pokemongo_bot import PokemonGoBot, TreeConfigBuilder
from pokemongo_bot import logger
Expand Down Expand Up @@ -76,6 +77,9 @@ def main():
except NotLoggedInException:
logger.log('[x] Error while connecting to the server, please wait %s minutes' % config.reconnecting_timeout, 'red')
time.sleep(config.reconnecting_timeout * 60)
except GeocoderQuotaExceeded:
logger.log('[x] The given maps api key has gone over the requests limit.', 'red')
finished = True
except:
# always report session summary and then raise exception
report_summary(bot)
Expand Down Expand Up @@ -259,24 +263,6 @@ def init_config():
type=str,
default='km'
)
add_config(
parser,
load,
short_flag="-ev",
long_flag="--evolve_all",
help="(Batch mode) Pass \"all\" or a list of pokemon to evolve (e.g., \"Pidgey,Weedle,Caterpie\"). Bot will start by attempting to evolve all pokemon. Great after popping a lucky egg!",
type=str,
default=[]
)
add_config(
parser,
load,
short_flag="-ecm",
long_flag="--evolve_cp_min",
help="Minimum CP for evolve all. Bot will attempt to first evolve highest IV pokemon with CP larger than this.",
type=int,
default=300
)
add_config(
parser,
load,
Expand Down Expand Up @@ -338,6 +324,14 @@ def init_config():
type=float,
default=1.0
)
add_config(
parser,
load,
long_flag="--map_object_cache_time",
help="Amount of seconds to keep the map object in cache (bypass Niantic throttling)",
type=float,
default=5.0
)

# Start to parse other attrs
config = parser.parse_args()
Expand All @@ -348,13 +342,16 @@ def init_config():

config.catch = load.get('catch', {})
config.release = load.get('release', {})
config.item_filter = load.get('item_filter', {})
config.action_wait_max = load.get('action_wait_max', 4)
config.action_wait_min = load.get('action_wait_min', 1)
config.raw_tasks = load.get('tasks', [])

config.vips = load.get('vips', {})

if config.map_object_cache_time < 0.0:
parser.error("--map_object_cache_time is out of range! (should be >= 0.0)")
return None

if len(config.raw_tasks) == 0:
logging.error("No tasks are configured. Did you mean to configure some behaviors? Read https://github.com/PokemonGoF/PokemonGo-Bot/wiki/Configuration-files#configuring-tasks for more information")
return None
Expand All @@ -371,7 +368,7 @@ def task_configuration_error(flag_name):
""".format(flag_name))

old_flags = ['mode', 'catch_pokemon', 'spin_forts', 'forts_spin', 'hatch_eggs', 'release_pokemon', 'softban_fix',
'longer_eggs_first', 'evolve_speed', 'use_lucky_egg']
'longer_eggs_first', 'evolve_speed', 'use_lucky_egg', 'item_filter', 'evolve_all', 'evolve_cp_min']
for flag in old_flags:
if flag in load:
task_configuration_error(flag)
Expand Down Expand Up @@ -402,23 +399,13 @@ def task_configuration_error(flag_name):
parser.error("--catch_randomize_spin_factor is out of range! (should be 0 <= catch_randomize_spin_factor <= 1)")
return None

# item list config verification
item_list = json.load(open(os.path.join('data', 'items.json')))
for config_item_name, bag_count in config.item_filter.iteritems():
if config_item_name not in item_list.viewvalues():
if config_item_name not in item_list:
parser.error('item "' + config_item_name + '" does not exist, spelling mistake? (check for valid item names in data/items.json)')
return None

# create web dir if not exists
try:
os.makedirs(web_dir)
except OSError:
if not os.path.isdir(web_dir):
raise

if config.evolve_all and isinstance(config.evolve_all, str):
config.evolve_all = [str(pokemon_name) for pokemon_name in config.evolve_all.split(',')]
if config.evolve_captured and isinstance(config.evolve_captured, str):
config.evolve_captured = [str(pokemon_name) for pokemon_name in config.evolve_captured.split(',')]

Expand Down
Loading

0 comments on commit 33c6232

Please sign in to comment.