Skip to content

Commit

Permalink
Merge pull request #221 from Pbatch/Leviaria-patch-1
Browse files Browse the repository at this point in the history
Prevent Accidental Chest Click in Lobby
  • Loading branch information
Leviaria authored Aug 30, 2024
2 parents a81095c + 331d87d commit c68b7a1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion clashroyalebuildabot/bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Bot:
def __init__(self, actions, auto_start=True):
self.actions = actions
self.auto_start = auto_start
self.end_of_game_clicked = False

self._setup_logger()

Expand Down Expand Up @@ -170,9 +171,22 @@ def step(self):
if new_screen != old_screen:
logger.info(f"New screen state: {new_screen}")

if self.auto_start and new_screen != Screens.IN_GAME:
if new_screen == Screens.END_OF_GAME:
if not self.end_of_game_clicked:
self.emulator.click(*self.state.screen.click_xy)
self.end_of_game_clicked = True
logger.debug(
"Clicked END_OF_GAME screen. Waiting for 2 seconds."
)
time.sleep(2)
return

self.end_of_game_clicked = False

if self.auto_start and new_screen == Screens.LOBBY:
self.emulator.click(*self.state.screen.click_xy)
logger.info("Starting game. Waiting for 2 seconds")
self.end_of_game_clicked = False
time.sleep(2)
return

Expand Down

0 comments on commit c68b7a1

Please sign in to comment.