diff --git a/assets/share/ornament/ui/DU_MAIN_CHECK.png b/assets/share/ornament/ui/DU_MAIN_CHECK.png new file mode 100644 index 000000000..95aa772ae Binary files /dev/null and b/assets/share/ornament/ui/DU_MAIN_CHECK.png differ diff --git a/assets/share/ornament/ui/DU_MODE_CHECK.png b/assets/share/ornament/ui/DU_MODE_CHECK.png new file mode 100644 index 000000000..c756e98b5 Binary files /dev/null and b/assets/share/ornament/ui/DU_MODE_CHECK.png differ diff --git a/assets/share/ornament/ui/DU_OE_SELECT_CHECK.png b/assets/share/ornament/ui/DU_OE_SELECT_CHECK.png new file mode 100644 index 000000000..9c92e7289 Binary files /dev/null and b/assets/share/ornament/ui/DU_OE_SELECT_CHECK.png differ diff --git a/tasks/ornament/assets/assets_ornament_ui.py b/tasks/ornament/assets/assets_ornament_ui.py new file mode 100644 index 000000000..23f2b1cb1 --- /dev/null +++ b/tasks/ornament/assets/assets_ornament_ui.py @@ -0,0 +1,35 @@ +from module.base.button import Button, ButtonWrapper + +# This file was auto-generated, do not modify it manually. To generate: +# ``` python -m dev_tools.button_extract ``` + +DU_MAIN_CHECK = ButtonWrapper( + name='DU_MAIN_CHECK', + share=Button( + file='./assets/share/ornament/ui/DU_MAIN_CHECK.png', + area=(774, 631, 796, 653), + search=(754, 611, 816, 673), + color=(149, 132, 98), + button=(774, 631, 796, 653), + ), +) +DU_MODE_CHECK = ButtonWrapper( + name='DU_MODE_CHECK', + share=Button( + file='./assets/share/ornament/ui/DU_MODE_CHECK.png', + area=(125, 175, 142, 205), + search=(105, 155, 162, 225), + color=(117, 98, 63), + button=(125, 175, 142, 205), + ), +) +DU_OE_SELECT_CHECK = ButtonWrapper( + name='DU_OE_SELECT_CHECK', + share=Button( + file='./assets/share/ornament/ui/DU_OE_SELECT_CHECK.png', + area=(1058, 24, 1084, 50), + search=(1038, 4, 1104, 70), + color=(196, 195, 193), + button=(1058, 24, 1084, 50), + ), +) diff --git a/tasks/ornament/combat.py b/tasks/ornament/combat.py index 13a05c65d..eff9d4637 100644 --- a/tasks/ornament/combat.py +++ b/tasks/ornament/combat.py @@ -1,12 +1,14 @@ from module.base.decorator import run_once from module.exception import RequestHumanTakeover from module.logger import logger +from tasks.base.assets.assets_base_page import MAP_EXIT from tasks.base.assets.assets_base_popup import POPUP_CANCEL from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE from tasks.combat.assets.assets_combat_support import COMBAT_SUPPORT_LIST from tasks.combat.combat import Combat from tasks.dungeon.event import DungeonEvent from tasks.ornament.assets.assets_ornament_combat import * +from tasks.ornament.assets.assets_ornament_ui import * class OrnamentCombat(DungeonEvent, Combat): @@ -19,6 +21,36 @@ class OrnamentCombat(DungeonEvent, Combat): # Different position to OCR return super().get_double_event_remain_at_combat(button) + def oe_leave(self, skip_first_screenshot=True): + self.interval_clear([COMBAT_PREPARE, MAP_EXIT]) + logger.hr('OE leave') + while 1: + if skip_first_screenshot: + skip_first_screenshot = False + else: + self.device.screenshot() + + # End + exit_ = self.is_in_map_exit() + if not exit_ and self.is_in_main(): + logger.info('OE left') + break + + # Click + if self.handle_ui_back(DU_OE_SELECT_CHECK, interval=2): + continue + if self.handle_ui_back(DU_MODE_CHECK, interval=2): + continue + if self.handle_ui_back(DU_MAIN_CHECK, interval=2): + continue + if self.handle_ui_back(COMBAT_PREPARE, interval=2): + continue + if exit_ and self.is_in_map_exit(interval=3): + self.device.click(MAP_EXIT) + continue + if self.handle_popup_confirm(): + continue + def support_set(self, support_character_name: str = "FirstCharacter"): """ Args: