From 85b82ce75520cc0e0b540439fef735d02cf5a8ba Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Thu, 24 Apr 2025 23:10:49 +0800 Subject: [PATCH] Fix: Handle forced map event on the top of action point popup --- module/os_handler/action_point.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/module/os_handler/action_point.py b/module/os_handler/action_point.py index 0bc485188..689c24628 100644 --- a/module/os_handler/action_point.py +++ b/module/os_handler/action_point.py @@ -154,11 +154,16 @@ class ActionPointHandler(UI, MapEventHandler): else: self.device.screenshot() + # End if self.is_current_ap_visible(): break if timeout.reached(): logger.warning('Get action points timeout, wait is_current_ap_visible timeout') break + # Forced map event on the top of action point popup + if self.handle_map_event(): + timeout.reset() + continue skip_first_screenshot = True timeout = Timer(1, count=2).start() @@ -171,6 +176,10 @@ class ActionPointHandler(UI, MapEventHandler): if timeout.reached(): logger.warning('Get action points timeout') break + # Forced map event on the top of action point popup + if self.handle_map_event(): + timeout.reset() + continue self.action_point_update() @@ -331,7 +340,21 @@ class ActionPointHandler(UI, MapEventHandler): in: ACTION_POINT_USE out: page_os """ - self.ui_click(ACTION_POINT_CANCEL, check_button=OS_CHECK, skip_first_screenshot=skip_first_screenshot) + while 1: + if skip_first_screenshot: + skip_first_screenshot = False + else: + self.device.screenshot() + + # End + if self.appear(OS_CHECK, offset=(20, 20)): + break + # Click + if self.appear_then_click(ACTION_POINT_CANCEL, offset=(20, 20), interval=3): + continue + # Forced map event on the top of action point popup + if self.handle_map_event(): + continue def handle_action_point(self, zone, pinned, cost=None, keep_current_ap=True, check_rest_ap=False): """