From 65f74acba0528a0bec3e514e495d67ed13334ca2 Mon Sep 17 00:00:00 2001 From: aeon0 Date: Sat, 13 Nov 2021 00:51:35 +0100 Subject: [PATCH] actually use the do_chicken on chicken --- src/health_manager.py | 2 +- src/template_finder.py | 11 ++++++----- src/ui_manager.py | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/health_manager.py b/src/health_manager.py index ae1e518..c783b49 100644 --- a/src/health_manager.py +++ b/src/health_manager.py @@ -83,7 +83,7 @@ class HealthManager: keyboard.release(self._config.char["stand_still"]) keyboard.release(self._config.char["show_items"]) time.sleep(0.01) - self._ui_manager.save_and_exit() + self._ui_manager.save_and_exit(does_chicken=True) self._did_chicken = True kill_thread(run_thread) self._do_monitor = False diff --git a/src/template_finder.py b/src/template_finder.py index a9c8e98..32608ed 100644 --- a/src/template_finder.py +++ b/src/template_finder.py @@ -183,11 +183,12 @@ class TemplateFinder: success, pos = self.search(x, img, roi=roi, threshold=threshold) if success: break - if not is_loading_black_roi and success: - return True, pos - if time_out is not None and (time.time() - start) > time_out: - cv2.imwrite(f"info_wait_for_{ref}_time_out.png", img) - return False, None + if not is_loading_black_roi: + if success: + return True, pos + elif time_out is not None and (time.time() - start) > time_out: + cv2.imwrite(f"info_wait_for_{ref}_time_out.png", img) + return False, None # Testing: Have whatever you want to find on the screen diff --git a/src/ui_manager.py b/src/ui_manager.py index 15a9689..93d05f8 100644 --- a/src/ui_manager.py +++ b/src/ui_manager.py @@ -136,7 +136,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"]) - x_m, y_m = self._screen.convert_screen_to_monitor(exit_btn_pos) + x_m, y_m = self._screen.convert_screen_to_monitor(exit_btn_pos) away_x_m, away_y_m = self._screen.convert_screen_to_monitor((200, 450)) while self._template_finder.search_and_wait(["SAVE_AND_EXIT_NO_HIGHLIGHT","SAVE_AND_EXIT_HIGHLIGHT"], roi=self._config.ui_roi["save_and_exit"], time_out=1.5)[0]: delay = [0.9, 1.1]