Skip to content

Commit

Permalink
Merge pull request #6035 from davidakachaos/softban_improvement
Browse files Browse the repository at this point in the history
Merged #6035
  • Loading branch information
Jcolomar authored May 7, 2017
2 parents 59b3bc4 + 31fa0a5 commit f610c05
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
9 changes: 9 additions & 0 deletions pokemongo_bot/cell_workers/camp_fort.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ def work(self):
else:
self.bot.camper_disabled_global_warning = False

if self.bot.softban:
if not hasattr(self.bot, "camper_softban_global_warning") or \
(hasattr(self.bot, "camper_softban_global_warning") and not self.bot.camper_softban_global_warning):
self.logger.info("Possible softban! Not camping forts till fixed.")
self.bot.camper_softban_global_warning = True
return WorkerResult.SUCCESS
else:
self.bot.softban_global_warning = False

now = time.time()

if now < self.move_until:
Expand Down
9 changes: 9 additions & 0 deletions pokemongo_bot/cell_workers/catch_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ def work(self):
[Item.ITEM_POKE_BALL, Item.ITEM_GREAT_BALL, Item.ITEM_ULTRA_BALL]]) <= 0:
return WorkerResult.ERROR

if self.bot.softban:
if not hasattr(self.bot, "softban_global_warning") or \
(hasattr(self.bot, "softban_global_warning") and not self.bot.softban_global_warning):
self.logger.info("Possible softban! Not trying to catch Pokemon.")
self.bot.softban_global_warning = True
return WorkerResult.SUCCESS
else:
self.bot.softban_global_warning = False

# Don't try to catch a Pokemon when catching is disabled.
if self.bot.catch_disabled:
if not hasattr(self.bot,"all_disabled_global_warning") or \
Expand Down
2 changes: 1 addition & 1 deletion pokemongo_bot/cell_workers/move_to_fort.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def work(self):
else:
self.emit_event(
'arrived_at_fort',
formatted='Arrived at fort.'
formatted='Arrived at fort %s.' % fort_name
)

return WorkerResult.RUNNING
Expand Down
11 changes: 10 additions & 1 deletion pokemongo_bot/cell_workers/move_to_map_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def work(self):
self._emit_log("Not enough balls to start sniping (have {}, {} needed)".format(
pokeballs_quantity + superballs_quantity + ultraballs_quantity, self.min_ball))
return WorkerResult.SUCCESS

if self.bot.catch_disabled:
if not hasattr(self.bot,"mtmp_disabled_global_warning") or \
(hasattr(self.bot,"mtmp_disabled_global_warning") and not self.bot.mtmp_disabled_global_warning):
Expand All @@ -300,6 +300,15 @@ def work(self):
else:
self.bot.mtmp_disabled_global_warning = False

if self.bot.softban:
if not hasattr(self.bot, "softban_global_warning") or \
(hasattr(self.bot, "softban_global_warning") and not self.bot.softban_global_warning):
self.logger.info("Possible softban! Not trying to catch Pokemon.")
self.bot.softban_global_warning = True
return WorkerResult.SUCCESS
else:
self.bot.softban_global_warning = False

# Retrieve pokemos
self.dump_caught_pokemon()
if self.bot.config.enable_social:
Expand Down
9 changes: 9 additions & 0 deletions pokemongo_bot/cell_workers/pokemon_hunter.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ def work(self):
else:
self.bot.hunter_disabled_global_warning = False

if self.bot.softban:
if not hasattr(self.bot, "softban_global_warning") or \
(hasattr(self.bot, "softban_global_warning") and not self.bot.softban_global_warning):
self.logger.info("Possible softban! Not trying to catch Pokemon.")
self.bot.softban_global_warning = True
return WorkerResult.SUCCESS
else:
self.bot.softban_global_warning = False

if self.get_pokeball_count() <= 0:
self.destination = None
self.last_cell_id = None
Expand Down
10 changes: 10 additions & 0 deletions pokemongo_bot/cell_workers/sniper.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,16 @@ def work(self):
# Resume hunting
self.no_hunt_until = None

if self.bot.softban:
if not hasattr(self.bot, "sniper_softban_global_warning") or \
(hasattr(self.bot, "sniper_softban_global_warning") and not self.bot.sniper_softban_global_warning):
self.logger.info("Possible softban! Not sniping any targets.")
self.bot.sniper_softban_global_warning = True
return WorkerResult.SUCCESS
else:
self.bot.softban_global_warning = False

sniped = False
# Do nothing if this task was invalidated
if self.disabled:
self._error("Sniper was disabled for some reason. Scroll up to find out.")
Expand Down

0 comments on commit f610c05

Please sign in to comment.