Skip to content

Commit

Permalink
Merge branch 'remove-mode' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSavior committed Jul 28, 2016
2 parents d9085fb + f675597 commit 4c46ad7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
20 changes: 15 additions & 5 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,16 @@ def init_config():
default=False
)
parser.add_argument(
"-m",
"--mode",
help="Farming Mode",
type=str,
default="all"
"--catch_pokemon",
help="Enable catching pokemon",
type=bool,
default=True
)
parser.add_argument(
"--spin_forts",
help="Enable Spinning Pokestops",
type=bool,
default=True
)
parser.add_argument(
"-w",
Expand Down Expand Up @@ -206,6 +211,11 @@ def init_config():
logging.error("Invalid Auth service specified! ('ptc' or 'google')")
return None

if 'mode' in load or 'mode' in config:
parser.error('"mode" has been removed and replaced with two new flags: "catch_pokemon" and "spin_forts". ' +
' Set these to true or false and remove "mode" from your configuration')
return None

if not (config.location or config.location_cache):
parser.error("Needs either --use-location-cache or --location.")
return None
Expand Down
4 changes: 2 additions & 2 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ def work_on_cell(self, cell, position):

number_of_things_gained_by_stop = 5

if ((self.get_inventory_count('item') < self._player['max_item_storage'] - number_of_things_gained_by_stop) and
(self.config.mode == "all" or self.config.mode == "farm")):
if (self.config.spin_forts and
(self.get_inventory_count('item') < self._player['max_item_storage'] - number_of_things_gained_by_stop)):
nearest_fort = self.get_nearest_fort(cell)

if nearest_fort:
Expand Down
4 changes: 1 addition & 3 deletions pokemongo_bot/cell_workers/catch_visible_pokmeon_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ def __init__(self, bot, cell):
self.position = bot.position

def work(self):
config_wants_pokmeon = self.config.mode == "all" or self.config.mode == "poke"

if not config_wants_pokmeon:
if not self.config.catch_pokemon:
return

if 'catchable_pokemons' in self.cell and len(self.cell['catchable_pokemons']) > 0:
Expand Down
5 changes: 2 additions & 3 deletions pokemongo_bot/cell_workers/pokemon_catch_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def work(self):
logger.log('Pokemon Bag is full!', 'red')
worker = PokemonTransferWorker(self)
worker.work()

else:
raise RuntimeError('Pokemon Bag is full!')

Expand Down Expand Up @@ -115,9 +115,8 @@ def work(self):

## re-check stock again
if items_stock[pokeball] is 0:
logger.log('Out of pokeballs, switching to farming mode...', 'red')
logger.log('Out of pokeballs', 'red')
# Begin searching for pokestops.
self.config.mode = 'farm'
return PokemonCatchWorker.NO_POKEBALLS

## Use berry to increase success chance.
Expand Down
2 changes: 1 addition & 1 deletion pokemongo_bot/cell_workers/seen_fort_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def work(self):
fort_name = 'Unknown'
logger.log('Now at Pokestop: ' + fort_name,
'cyan')
if self.config.mode != 'farm' and 'lure_info' in self.fort:
if self.config.catch_pokemon and 'lure_info' in self.fort:
# Check if the lure has a pokemon active
if 'encounter_id' in self.fort['lure_info']:
logger.log("Found a lure on this pokestop! Catching pokemon...", 'cyan')
Expand Down

0 comments on commit 4c46ad7

Please sign in to comment.