From 80646b260f6cbdd2167093286179bb31b02d8e62 Mon Sep 17 00:00:00 2001 From: LmeSzinc Date: Wed, 17 Jun 2020 01:11:24 +0800 Subject: [PATCH 1/2] Fix: Infinite click on switch when switch is unknown - Increase ui retry interval for potato device --- module/base/switch.py | 8 +++++++- module/exercise/combat.py | 2 +- module/ui/ui.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/module/base/switch.py b/module/base/switch.py index df777d293..6ef1e6849 100644 --- a/module/base/switch.py +++ b/module/base/switch.py @@ -1,5 +1,6 @@ from module.base.base import ModuleBase from module.base.button import Button +from module.base.timer import Timer from module.logger import logger @@ -50,6 +51,7 @@ class Switch: bool: """ changed = False + warning_show_timer = Timer(5, count=10).start() while 1: if skip_first_screenshot: skip_first_screenshot = False @@ -65,8 +67,12 @@ class Switch: matched = data if current == status: return changed + if current == 'unknown': - logger.warning(f'Unknown {self.name} switch') + if warning_show_timer.reached(): + logger.warning(f'Unknown {self.name} switch') + warning_show_timer.reset() + continue for data in self.status_list: if data['status'] == status: diff --git a/module/exercise/combat.py b/module/exercise/combat.py index cafed9cd1..4e10a9020 100644 --- a/module/exercise/combat.py +++ b/module/exercise/combat.py @@ -65,7 +65,7 @@ class ExerciseCombat(HpDaemon, OpponentChoose, ExerciseEquipment): if self.appear_then_click(EXP_INFO_D): continue # Last D rank screen - if self.appear_then_click(OPTS_INFO_D, offset=(30,30)): + if self.appear_then_click(OPTS_INFO_D, offset=(30, 30)): continue # Quit diff --git a/module/ui/ui.py b/module/ui/ui.py index 4182c9774..b4e28a2fc 100644 --- a/module/ui/ui.py +++ b/module/ui/ui.py @@ -17,7 +17,7 @@ class UI(ModuleBase): """ return self.appear(page.check_button, offset=(20, 20)) - def ui_click(self, click_button, check_button, appear_button=None, offset=(20, 20), retry_wait=3, + def ui_click(self, click_button, check_button, appear_button=None, offset=(20, 20), retry_wait=10, skip_first_screenshot=False): """ Args: From 6f8b449540836c8818d1626402540bba51809f08 Mon Sep 17 00:00:00 2001 From: LmeSzinc Date: Wed, 17 Jun 2020 01:37:23 +0800 Subject: [PATCH 2/2] Fix: Click low emotion warn as story confirm when fleet lock disabled --- module/handler/info_handler.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/module/handler/info_handler.py b/module/handler/info_handler.py index 1dc784aec..f9d038e84 100644 --- a/module/handler/info_handler.py +++ b/module/handler/info_handler.py @@ -92,16 +92,25 @@ class InfoHandler(ModuleBase): """ Story """ + + story_popup_timout = Timer(10, count=20) + def story_skip(self): - if self.handle_popup_confirm(): - return True + if self.story_popup_timout.started() and not self.story_popup_timout.reached(): + if self.handle_popup_confirm('STORY_SKIP'): + self.story_popup_timout = Timer(10) + return True if self.appear_then_click(STORY_SKIP, offset=True, interval=2): + self.story_popup_timout.start() return True - if self.appear(STORY_LETTER_BLACK) and self.appear_then_click(STORY_LETTERS_ONLY, offset=True, interval=2): + if self.appear(STORY_LETTER_BLACK) and self.appear_then_click(STORY_LETTERS_ONLY, offset=True, interval=2): + self.story_popup_timout.start() return True if self.appear_then_click(STORY_CHOOSE, offset=True, interval=2): + self.story_popup_timout.start() return True if self.appear_then_click(STORY_CHOOSE_2, offset=True, interval=2): + self.story_popup_timout.start() return True return False @@ -109,6 +118,8 @@ class InfoHandler(ModuleBase): def handle_story_skip(self): if not self.config.ENABLE_MAP_CLEAR_MODE: return False + if self.config.ENABLE_FAST_FORWARD: + return False return self.story_skip()