Add: oe_leave()

This commit is contained in:
LmeSzinc 2024-07-01 03:07:11 +08:00
parent 85ac47d6b6
commit d238838dda
5 changed files with 67 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -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),
),
)

View File

@ -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: