diff --git a/assets/templates/play_btn_gray.png b/assets/templates/play_btn_gray.png new file mode 100644 index 0000000..f2b2ed9 Binary files /dev/null and b/assets/templates/play_btn_gray.png differ diff --git a/src/template_finder.py b/src/template_finder.py index a2e62c7..55e2fef 100644 --- a/src/template_finder.py +++ b/src/template_finder.py @@ -49,6 +49,7 @@ class TemplateFinder: "D2_LOGO_HS": [load_template("assets/templates/d2_logo_hs.png", 1.0), 1.0], "LOADING": [load_template("assets/templates/loading.png", 1.0), 1.0], "PLAY_BTN": [load_template("assets/templates/play_btn.png", 1.0), 1.0], + "PLAY_BTN_GRAY": [load_template("assets/templates/play_btn_gray.png", 1.0), 1.0], "HELL_BTN": [load_template("assets/templates/hell_btn.png", 1.0), 1.0], "SAVE_AND_EXIT": [load_template("assets/templates/save_and_exit.png", 1.0), 1.0], "SERVER_ISSUES": [load_template("assets/templates/server_issues.png", 1.0), 1.0], diff --git a/src/ui_manager.py b/src/ui_manager.py index 3d43793..67468d3 100644 --- a/src/ui_manager.py +++ b/src/ui_manager.py @@ -137,7 +137,7 @@ class UiManager(): keyboard.send("esc") wait(0.1) exit_btn_pos = (self._config.ui_pos["save_and_exit_x"], self._config.ui_pos["save_and_exit_y"]) - found, _ = self._template_finder.search_and_wait("SAVE_AND_EXIT", roi=self._config.ui_roi["save_and_exit"], time_out=3) + found, _ = self._template_finder.search_and_wait("SAVE_AND_EXIT", roi=self._config.ui_roi["save_and_exit"], time_out=7) if found: x_m, y_m = self._screen.convert_screen_to_monitor(exit_btn_pos) custom_mouse.move(x_m, y_m, duration=0.2, randomize=12) @@ -151,6 +151,9 @@ class UiManager(): Starting a game in hell mode. Will wait and retry on server connection issue. :return: Bool if action was successful """ + while self._template_finder.search("PLAY_BTN_GRAY", self._screen.grab(), roi=self._config.ui_roi["play_btn"], threshold=0.95)[0]: + time.sleep(2) + Logger.debug(f"Searching for Play Btn...") found, pos = self._template_finder.search_and_wait("PLAY_BTN", roi=self._config.ui_roi["play_btn"], time_out=8) if not found: