Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Retry town portal creation on fail (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeon0 authored Dec 24, 2021
1 parent 8b8f55a commit 413218f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/char/i_char.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,17 @@ def tp_town(self):
wait(0.8, 1.3) # takes quite a while for tp to be visible
roi = self._config.ui_roi["tp_search"]
start = time.time()
while (time.time() - start) < 8:
retry_count = 0
while (time.time() - start) < 8:
if time.time() - start > 3.7 and retry_count == 0:
retry_count += 1
Logger.debug("Move to another position and try to open tp again")
pos_m = self._screen.convert_abs_to_monitor((random.randint(-70, 70), random.randint(-70, 70)))
self.pre_move()
self.move(pos_m)
if self._ui_manager.has_tps():
mouse.click(button="right")
wait(0.8, 1.3) # takes quite a while for tp to be visible
img = self._screen.grab()
template_match = self._template_finder.search(
["BLUE_PORTAL","BLUE_PORTAL_2"],
Expand Down

0 comments on commit 413218f

Please sign in to comment.