From 44fcd363e9bc568b6618265edabb4e13ee2595db Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Thu, 11 Jun 2026 22:55:14 +0800 Subject: [PATCH] Fix: retry on using data key confirm --- module/handler/info_handler.py | 42 ++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/module/handler/info_handler.py b/module/handler/info_handler.py index 55b20a4ee..ba6d0707a 100644 --- a/module/handler/info_handler.py +++ b/module/handler/info_handler.py @@ -203,24 +203,30 @@ class InfoHandler(ModuleBase): return False if self.appear(USE_DATA_KEY, offset=(20, 20)): - skip_first_screenshot = True - while 1: - if skip_first_screenshot: - skip_first_screenshot = False - else: - self.device.screenshot() - + # enable USE_DATA_KEY_NOTIFIED + for _ in self.loop(): enabled = self.image_color_count( USE_DATA_KEY_NOTIFIED, color=(140, 207, 66), threshold=180, count=10) if enabled: break - if self.appear(USE_DATA_KEY, offset=(20, 20), interval=5): self.device.click(USE_DATA_KEY_NOTIFIED) continue self.config.USE_DATA_KEY = False # Reset on success as task can be stopped before can be recovered - return self.handle_popup_confirm('USE_DATA_KEY') + + # click confirm + # POPUP_CONFIRM from data key page has minor differece from the standard one + # so we just bind clicking it + self.interval_clear(USE_DATA_KEY, interval=5) + for _ in self.loop(): + if not self.appear(USE_DATA_KEY, offset=(20, 20)): + break + if self.appear(USE_DATA_KEY, offset=(20, 20), interval=5): + self.device.click(POPUP_CONFIRM) + continue + + return True return False @@ -242,6 +248,15 @@ class InfoHandler(ModuleBase): """ return self.appear_then_click(GET_SKIN, offset=(20, 20), interval=2) + def handle_get_items_small(self): + if self.appear(GET_ITEMS_SMALL1, offset=(-45, -5, 5, 5)): + return GET_ITEMS_SMALL1 + if self.appear(GET_ITEMS_SMALL2, offset=(-45, -5, 5, 5)): + return GET_ITEMS_SMALL2 + if self.appear(GET_ITEMS_SMALL3, offset=(-45, -5, 5, 5)): + return GET_ITEMS_SMALL3 + return False + """ Guild popup info """ @@ -553,4 +568,11 @@ class InfoHandler(ModuleBase): self.wait_until_manjuu_disappear() return True else: - return False \ No newline at end of file + return False + + +if __name__ == '__main__': + self = InfoHandler('alas') + self.image_file = r'D:\Downloads\589909030-c7431879-3b7d-4b75-972e-c449ad410885.png' + for row in self._story_option_buttons_2(): + print(row)