From 8d3a700f2ef80f839269f715fcef3444e5ee917e Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:27:12 +0800 Subject: [PATCH 1/7] Fix: Inventory.set() finishes before clicked --- tasks/item/inventory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/item/inventory.py b/tasks/item/inventory.py index e5acb0d21..847d930dc 100644 --- a/tasks/item/inventory.py +++ b/tasks/item/inventory.py @@ -303,6 +303,7 @@ class InventoryManager: loca = item interval = Timer(2, count=6) + clicked = False while 1: if skip_first_screenshot: skip_first_screenshot = False @@ -319,13 +320,14 @@ class InventoryManager: continue # End - if item.is_selected: + if clicked and item.is_selected: logger.info('Inventory item selected') break # Click if interval.reached(): self.main.device.click(item) interval.reset() + clicked = True continue def wait_selected(self, skip_first_screenshot=True): From e327371c8afa17606c7dd77f55996b9f200cb6bc Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 6 Jul 2024 01:02:18 +0800 Subject: [PATCH 2/7] Fix: Increase SecondaryMaatouchBuilder to contact=2 --- tasks/base/daemon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/base/daemon.py b/tasks/base/daemon.py index deb483fa4..23e1c5b5a 100644 --- a/tasks/base/daemon.py +++ b/tasks/base/daemon.py @@ -16,7 +16,7 @@ class SecondaryMaatouchBuilder(maatouch.MaatouchBuilder): """ Click on secondary contact to avoid interruption of real-person contact """ - super().__init__(device, contact=1, handle_orientation=handle_orientation) + super().__init__(device, contact=2, handle_orientation=handle_orientation) maatouch.MaatouchBuilder = SecondaryMaatouchBuilder From 73897882781dcfd6b722696c27346bf404f2f6b9 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 6 Jul 2024 01:02:49 +0800 Subject: [PATCH 3/7] =?UTF-8?q?Fix:=20Handle=20missing=20=E4=B8=80=20on=20?= =?UTF-8?q?A=5Fbox=5Fof=5Fexpired=5Fdoughnuts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasks/rogue/event/event.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/rogue/event/event.py b/tasks/rogue/event/event.py index b8f48d6fe..4461fcf35 100644 --- a/tasks/rogue/event/event.py +++ b/tasks/rogue/event/event.py @@ -96,6 +96,8 @@ class OcrRogueEventOption(OcrRogueEvent): (KEYWORDS_ROGUE_EVENT_OPTION.Choose_number_two_It_snores_like_Andatur_Zazzalo, '.*二号.*安达.*'), (KEYWORDS_ROGUE_EVENT_OPTION.Choose_number_three_Its_teeth_are_rusted, '.*三号.*牙齿.*'), (KEYWORDS_ROGUE_EVENT_OPTION.Believe_in_THEM_with_pure_devotion, '虔诚信仰'), + (KEYWORDS_ROGUE_EVENT_OPTION.A_box_of_expired_doughnuts_6308, '^盒过期甜甜圈'), + (KEYWORDS_ROGUE_EVENT_OPTION.A_box_of_expired_doughnuts_cc8c, '^盒过期甜甜圈'), ], 'en': [ (KEYWORDS_ROGUE_EVENT_OPTION.Deposit_2_Cosmic_Fragments, 'Deposit \d+.*'), From 81a26d5e78560f1539f653d20d96d3d82e9c4392 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 6 Jul 2024 01:03:43 +0800 Subject: [PATCH 4/7] Pref: Lower screenshot speed during teleportation --- tasks/dungeon/ui.py | 11 ++++++++++- tasks/rogue/route/base.py | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tasks/dungeon/ui.py b/tasks/dungeon/ui.py index 08b48554c..45e09b102 100644 --- a/tasks/dungeon/ui.py +++ b/tasks/dungeon/ui.py @@ -5,6 +5,7 @@ import numpy as np from module.base.base import ModuleBase from module.base.button import ClickButton +from module.base.decorator import run_once from module.base.timer import Timer from module.base.utils import get_color from module.exception import ScriptError @@ -614,7 +615,12 @@ class DungeonUI(DungeonState): """ logger.hr('Dungeon enter', level=2) DUNGEON_LIST.use_plane = bool(dungeon.is_Calyx_Crimson) - skip_first_load = True + skip_first_load = skip_first_screenshot + + @run_once + def screenshot_interval_set(): + self.device.screenshot_interval_set('combat') + while 1: if skip_first_screenshot: skip_first_screenshot = False @@ -624,11 +630,13 @@ class DungeonUI(DungeonState): # End if self.appear(enter_check_button): logger.info(f'Arrive {enter_check_button.name}') + self.device.screenshot_interval_set() break # Additional # Popup that confirm character switch if self.handle_popup_confirm(): + self.interval_reset(page_guide.check_button) continue # Click teleport @@ -640,6 +648,7 @@ class DungeonUI(DungeonState): entrance = DUNGEON_LIST.keyword2button(dungeon) if entrance is not None: self.device.click(entrance) + screenshot_interval_set() self.interval_reset(page_guide.check_button) continue else: diff --git a/tasks/rogue/route/base.py b/tasks/rogue/route/base.py index 548d1deec..d54aba29a 100644 --- a/tasks/rogue/route/base.py +++ b/tasks/rogue/route/base.py @@ -261,6 +261,7 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward): or page_rogue if rogue cleared """ logger.info('Wait next domain') + self.device.screenshot_interval_set('combat') while 1: if skip_first_screenshot: skip_first_screenshot = False @@ -270,10 +271,12 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward): # End if self.is_in_main(): logger.info('Entered another domain') + self.device.screenshot_interval_set() self.wait_until_minimap_stabled() break if self.is_page_rogue_main(): logger.info('Rogue cleared') + self.device.screenshot_interval_set() break if self.match_template_color(ROGUE_REPORT, interval=2): From 364d5e9c5c3ff64c5e574956e03d4181c32d9945 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 6 Jul 2024 01:13:01 +0800 Subject: [PATCH 5/7] Fix: Remove chinese comma from ocr results --- module/ocr/keyword.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/ocr/keyword.py b/module/ocr/keyword.py index 31bb8cdc3..d185007df 100644 --- a/module/ocr/keyword.py +++ b/module/ocr/keyword.py @@ -7,7 +7,7 @@ import module.config.server as server from module.exception import ScriptError # ord('.') = 65294 -REGEX_PUNCTUATION = re.compile(r'[ ,..\'"“”,。…::;;!!??·・•●〇°*※\-—–-/\\|丨\n\t()\[\]()「」『』【】《》[]]') +REGEX_PUNCTUATION = re.compile(r'[ ,..\'"“”,。、…::;;!!??·・•●〇°*※\-—–-/\\|丨\n\t()\[\]()「」『』【】《》[]]') def parse_name(n): From 7c434049fbe6edd0560675c8ef81785a8ea22673 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 6 Jul 2024 01:42:46 +0800 Subject: [PATCH 6/7] Fix: Empty character_current --- tasks/character/switch.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasks/character/switch.py b/tasks/character/switch.py index 22e1790b9..9f743f3c9 100644 --- a/tasks/character/switch.py +++ b/tasks/character/switch.py @@ -280,6 +280,10 @@ class CharacterSwitch(UI): logger.hr('Character switch to ranged') if update: self.character_update() + if self.character_current is None: + # Cannot switch, keep None to retry at next call + self.character_is_ranged = None + return None character = self._get_ranged_character() if character is True: From 7042ddcfb61cba090b4924001be34c160265cec0 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 6 Jul 2024 02:04:45 +0800 Subject: [PATCH 7/7] Fix: [CN] Handle OCR error on Interstellar_Construct_Burst_Lattice --- tasks/rogue/blessing/blessing.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/rogue/blessing/blessing.py b/tasks/rogue/blessing/blessing.py index 597187ad2..483bff85d 100644 --- a/tasks/rogue/blessing/blessing.py +++ b/tasks/rogue/blessing/blessing.py @@ -90,6 +90,7 @@ class RogueBuffOcr(Ocr): "阅下": "阈下", '未日': '末日', '尚末': '尚未', + '进裂晶格': '迸裂晶格', } elif self.lang == 'en': replace_pattern_dict = {