Ver código fonte

Merge pull request #63 from TripleEarth/dev

fix Ryoutoppa goto realmraid may lead to error by adding page_ryoutop…
huangrunheng 3 anos atrás
pai
commit
5feadb3588

+ 1 - 1
module/config/config_manual.py

@@ -13,7 +13,7 @@ class ConfigManual:
         > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > RealmRaid > RyouToppa > DailyTrifles
         > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > RealmRaid > RyouToppa > DailyTrifles
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
         > ActivityShikigami
         > ActivityShikigami
-        > BondlingFairyland
+        > BondlingFairyland > EvoZone
         > TrueOrochi > RichMan
         > TrueOrochi > RichMan
         > Pets > TalismanPass > SoulsTidy
         > Pets > TalismanPass > SoulsTidy
         """
         """

+ 1 - 1
module/config/config_menu.py

@@ -23,7 +23,7 @@ class ConfigMenu:
         self.menu["Daily Task"] = ['DailyTrifles', 'AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian',
         self.menu["Daily Task"] = ['DailyTrifles', 'AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian',
                                    'TalismanPass', 'DemonEncounter', 'Pets', 'SoulsTidy']
                                    'TalismanPass', 'DemonEncounter', 'Pets', 'SoulsTidy']
         # 很肝的任务
         # 很肝的任务
-        self.menu["Liver Emperor Exclusive"] = ['BondlingFairyland']
+        self.menu["Liver Emperor Exclusive"] = ['BondlingFairyland', 'EvoZone']
         # 阴阳寮
         # 阴阳寮
         self.menu["Guild"] = ['KekkaiUtilize', 'KekkaiActivation', 'RealmRaid', 'RyouToppa']
         self.menu["Guild"] = ['KekkaiUtilize', 'KekkaiActivation', 'RealmRaid', 'RyouToppa']
         # 每周任务
         # 每周任务

+ 3 - 0
module/config/config_model.py

@@ -41,6 +41,7 @@ from tasks.ActivityShikigami.config import ActivityShikigami
 
 
 # 肝帝专属---------------------------------------------------------------------------------------------------------------
 # 肝帝专属---------------------------------------------------------------------------------------------------------------
 from tasks.BondlingFairyland.config import BondlingFairyland
 from tasks.BondlingFairyland.config import BondlingFairyland
+from tasks.EvoZone.config import EvoZone
 # ----------------------------------------------------------------------------------------------------------------------
 # ----------------------------------------------------------------------------------------------------------------------
 
 
 # 每周任务---------------------------------------------------------------------------------------------------------------
 # 每周任务---------------------------------------------------------------------------------------------------------------
@@ -81,6 +82,8 @@ class ConfigModel(ConfigBase):
 
 
     # 这些是肝帝专属
     # 这些是肝帝专属
     bondling_fairyland: BondlingFairyland = Field(default_factory=BondlingFairyland)
     bondling_fairyland: BondlingFairyland = Field(default_factory=BondlingFairyland)
+    evo_zone: EvoZone = Field(default_factory=EvoZone)
+
 
 
     # 这些是每周任务
     # 这些是每周任务
     true_orochi: TrueOrochi = Field(default_factory=TrueOrochi)
     true_orochi: TrueOrochi = Field(default_factory=TrueOrochi)

+ 48 - 0
tasks/EvoZone/assets.py

@@ -0,0 +1,48 @@
+from module.atom.image import RuleImage
+from module.atom.click import RuleClick
+from module.atom.long_click import RuleLongClick
+from module.atom.swipe import RuleSwipe
+from module.atom.ocr import RuleOcr
+from module.atom.list import RuleList
+
+# This file was automatically generated by ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class EvoZoneAssets: 
+
+
+	# Image Rule Assets
+	# 火麒麟进入 
+	I_FIRE_KIRIN = RuleImage(roi_front=(84,126,217,406), roi_back=(84,126,217,406), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_fire_kirin.png")
+	# 组队 
+	I_FORM_TEAM = RuleImage(roi_front=(937,591,100,100), roi_back=(937,591,100,100), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_form_team.png")
+	# description 
+	I_EVOZONE_LOCK = RuleImage(roi_front=(558,565,31,32), roi_back=(548,554,53,54), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_evozone_lock.png")
+	# description 
+	I_EVOZONE_UNLOCK = RuleImage(roi_front=(560,565,26,29), roi_back=(551,557,43,45), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_evozone_unlock.png")
+	# 点击挑战 
+	I_EVOZONE_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/EvoZone/o/o_evozone_fire.png")
+	# 式神录 
+	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_shi_records.png")
+	# description 
+	I_EVOZONE_MATCHING = RuleImage(roi_front=(62,568,44,114), roi_back=(62,568,44,114), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_evozone_matching.png")
+	# 小小宠物,发现宝藏 
+	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_pet_present.png")
+	# 风麒麟进入 
+	I_WIND_KIRIN = RuleImage(roi_front=(377,126,232,420), roi_back=(377,126,232,420), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_wind_kirin.png")
+	# 水麒麟进入 
+	I_WATER_KIRIN = RuleImage(roi_front=(671,122,236,420), roi_back=(671,122,236,420), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_water_kirin.png")
+	# 雷麒麟进入 
+	I_LIGHTNING_KIRIN = RuleImage(roi_front=(967,121,239,419), roi_back=(967,121,239,419), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_lightning_kirin.png")
+
+
+	# List Rule Assets
+	# 这个是觉醒界面选择不同层数的 
+	L_LAYER_LIST = RuleList(folder="./tasks/EvoZone/res", direction="vertical", mode="ocr", roi_back=(138,130,359,500), size=(44, 88), 
+					 array=["壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖", "拾"])
+
+
+	# Ocr Rule Assets
+	# Ocr-description 
+	O_O_TEST_OCR = RuleOcr(roi=(126,136,360,491), area=(126,136,360,491), mode="Full", method="Default", keyword="", name="o_test_ocr")
+
+

+ 58 - 0
tasks/EvoZone/config.py

@@ -0,0 +1,58 @@
+# This Python file uses the following encoding: utf-8
+# @author TripleEarth
+# github https://github.com/TripleEarth
+from pydantic import BaseModel, Field
+from enum import Enum
+from datetime import datetime, time
+
+from tasks.Component.config_scheduler import Scheduler
+from tasks.Component.config_base import ConfigBase, TimeDelta
+from tasks.Component.GeneralInvite.config_invite import InviteConfig
+from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
+
+
+class UserStatus(str, Enum):
+    LEADER = 'leader'
+    MEMBER = 'member'
+    ALONE = 'alone'
+    WILD = 'wild'  # 还不打算实现
+
+class Layer(str, Enum):
+    ONE = '壹层'
+    TWO = '贰层'
+    THREE = '叁层'
+    FOUR = '肆层'
+    FIVE = '伍层'
+    SIX = '陆层'
+    SEVEN = '柒层'
+    EIGHT = '捌层'
+    NINE = '玖层'
+    TEN = '拾层'
+
+class KirinType(str, Enum):
+    FIREKIRIN = '火麒麟'
+    WINDKIRIN = '风麒麟'
+    WATERKIRIN = '水麒麟'
+    LIGHTNINGKIRIN = '雷麒麟'
+
+
+class EvoZoneConfig(ConfigBase):
+    # 身份
+    user_status: UserStatus = Field(default=UserStatus.LEADER, description='user_status_help')
+    # 类型
+    kirin_type: KirinType = Field(default=KirinType.LIGHTNINGKIRIN, description='kirin_type_help')
+    # 层数
+    layer: Layer = Field(default=Layer.TEN, description='layer_help')
+    # 限制时间
+    limit_time: time = Field(default=time(minute=30), description='limit_time_help')
+    # 限制次数
+    limit_count: int = Field(default=30, description='limit_count_help')
+    # 是否开启觉醒加成
+    soul_buff_enable: bool = Field(default=False, description='soul_buff_enable_help')
+
+class EvoZone(ConfigBase):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+    evo_zone_config: EvoZoneConfig = Field(default_factory=EvoZoneConfig)
+    invite_config: InviteConfig = Field(default_factory=InviteConfig)
+    general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
+

+ 101 - 0
tasks/EvoZone/o/image.json

@@ -0,0 +1,101 @@
+[
+  {
+    "itemName": "fire_kirin",
+    "imageName": "o_fire_kirin.png",
+    "roiFront": "84,126,217,406",
+    "roiBack": "84,126,217,406",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "火麒麟进入"
+  },
+  {
+    "itemName": "form_team",
+    "imageName": "o_form_team.png",
+    "roiFront": "937,591,100,100",
+    "roiBack": "937,591,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "组队"
+  },
+  {
+    "itemName": "evozone_lock",
+    "imageName": "o_evozone_lock.png",
+    "roiFront": "558,565,31,32",
+    "roiBack": "548,554,53,54",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "evozone_unlock",
+    "imageName": "o_evozone_unlock.png",
+    "roiFront": "560,565,26,29",
+    "roiBack": "551,557,43,45",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "evozone_fire",
+    "imageName": "o_evozone_fire.png",
+    "roiFront": "1095,577,131,124",
+    "roiBack": "1095,577,131,124",
+    "method": "Template matching",
+    "threshold": 0.6,
+    "description": "点击挑战"
+  },
+  {
+    "itemName": "shi_records",
+    "imageName": "o_shi_records.png",
+    "roiFront": "821,638,48,45",
+    "roiBack": "821,638,48,45",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "式神录"
+  },
+  {
+    "itemName": "evozone_matching",
+    "imageName": "o_evozone_matching.png",
+    "roiFront": "62,568,44,114",
+    "roiBack": "62,568,44,114",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "pet_present",
+    "imageName": "o_pet_present.png",
+    "roiFront": "873,184,62,147",
+    "roiBack": "873,184,62,147",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "小小宠物,发现宝藏"
+  },
+  {
+    "itemName": "wind_kirin",
+    "imageName": "o_wind_kirin.png",
+    "roiFront": "377,126,232,420",
+    "roiBack": "377,126,232,420",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "风麒麟进入"
+  },
+  {
+    "itemName": "water_kirin",
+    "imageName": "o_water_kirin.png",
+    "roiFront": "671,122,236,420",
+    "roiBack": "671,122,236,420",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "水麒麟进入"
+  },
+  {
+    "itemName": "lightning_kirin",
+    "imageName": "o_lightning_kirin.png",
+    "roiFront": "967,121,239,419",
+    "roiBack": "967,121,239,419",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "雷麒麟进入"
+  }
+]

BIN
tasks/EvoZone/o/o_evozone_fire.png


BIN
tasks/EvoZone/o/o_evozone_lock.png


BIN
tasks/EvoZone/o/o_evozone_matching.png


BIN
tasks/EvoZone/o/o_evozone_unlock.png


BIN
tasks/EvoZone/o/o_fire_kirin.png


BIN
tasks/EvoZone/o/o_form_team.png


BIN
tasks/EvoZone/o/o_lightning_kirin.png


BIN
tasks/EvoZone/o/o_pet_present.png


BIN
tasks/EvoZone/o/o_shi_records.png


BIN
tasks/EvoZone/o/o_water_kirin.png


BIN
tasks/EvoZone/o/o_wind_kirin.png


+ 49 - 0
tasks/EvoZone/res/list.json

@@ -0,0 +1,49 @@
+{
+  "name": "layer_list",
+  "direction": "vertical",
+  "type": "ocr",
+  "roiBack": "138,130,359,500",
+  "description": "这个是觉醒界面选择不同层数的",
+  "list": [
+    {
+      "itemName": "壹",
+      "roiFront": "281,135,39,102"
+    },
+    {
+      "itemName": "贰",
+      "roiFront": "280,253,39,85"
+    },
+    {
+      "itemName": "叁",
+      "roiFront": "283,422,43,93"
+    },
+    {
+      "itemName": "肆",
+      "roiFront": "280,312,44,90"
+    },
+    {
+      "itemName": "伍",
+      "roiFront": "282,425,43,82"
+    },
+    {
+      "itemName": "陆",
+      "roiFront": "275,316,47,89"
+    },
+    {
+      "itemName": "柒",
+      "roiFront": "279,312,48,93"
+    },
+    {
+      "itemName": "捌",
+      "roiFront": "275,203,51,89"
+    },
+    {
+      "itemName": "玖",
+      "roiFront": "278,206,48,81"
+    },
+    {
+      "itemName": "拾",
+      "roiFront": "282,315,45,84"
+    }
+  ]
+}

+ 11 - 0
tasks/EvoZone/res/ocr.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "o_test_ocr",
+    "roiFront": "126,136,360,491",
+    "roiBack": "126,136,360,491",
+    "mode": "Full",
+    "method": "Default",
+    "keyword": "",
+    "description": "Ocr-description"
+  }
+]

+ 367 - 0
tasks/EvoZone/script_task.py

@@ -0,0 +1,367 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from time import sleep
+from datetime import time, datetime, timedelta
+
+from tasks.Component.GeneralBattle.general_battle import GeneralBattle
+from tasks.Component.GeneralInvite.general_invite import GeneralInvite
+from tasks.Component.GeneralBuff.general_buff import GeneralBuff
+from tasks.Component.GeneralRoom.general_room import GeneralRoom
+from tasks.GameUi.game_ui import GameUi
+from tasks.GameUi.page import page_main, page_awake_zones
+from tasks.EvoZone.assets import EvoZoneAssets
+from tasks.EvoZone.config import EvoZone, UserStatus, KirinType
+from module.logger import logger
+from module.exception import TaskEnd
+
+class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, EvoZoneAssets):
+
+    def run(self) -> bool:
+
+        limit_count = self.config.evo_zone.evo_zone_config.limit_count
+        limit_time = self.config.evo_zone.evo_zone_config.limit_time
+        self.current_count = 0
+        self.limit_count: int = limit_count
+        self.limit_time: timedelta = timedelta(hours=limit_time.hour, minutes=limit_time.minute, seconds=limit_time.second)
+
+        self.ui_get_current_page()
+        self.ui_goto(page_main)
+        config: EvoZone = self.config.evo_zone
+        if config.evo_zone_config.soul_buff_enable:
+            self.open_buff()
+            self.awake(is_open=True)
+            self.close_buff()
+
+        success = True
+        match config.evo_zone_config.user_status:
+            case UserStatus.LEADER: success = self.run_leader()
+            case UserStatus.MEMBER: success = self.run_member()
+            case UserStatus.ALONE: self.run_alone()
+            case UserStatus.WILD: self.run_wild()
+            case _: logger.error('Unknown user status')
+
+        # 记得关掉
+        if config.evo_zone_config.soul_buff_enable:
+            self.open_buff()
+            self.awake(is_open=False)
+            self.close_buff()
+        # 下一次运行时间
+        if success:
+            self.set_next_run('EvoZone', finish=True, success=True)
+        else:
+            self.set_next_run('EvoZone', finish=False, success=False)
+
+        raise TaskEnd
+
+    def evozone_enter(self) -> bool:
+        logger.info('Enter evozone')
+        kirintype = self.I_LIGHTNING_KIRIN
+        match self.config.evo_zone.evo_zone_config.kirin_type:
+            case KirinType.FIREKIRIN:
+                kirintype = self.I_FIRE_KIRIN
+            case KirinType.WINDKIRIN:
+                kirintype = self.I_WIND_KIRIN
+            case KirinType.WATERKIRIN:
+                kirintype = self.I_WATER_KIRIN
+            case KirinType.LIGHTNINGKIRIN:
+                kirintype = self.I_LIGHTNING_KIRIN
+        while True:
+            self.screenshot()
+            if self.appear(self.I_FORM_TEAM):
+                return True
+            if self.appear_then_click(kirintype, interval=1):
+                continue
+
+    def check_layer(self, layer: str) -> bool:
+        """
+        检查挑战的层数, 并选中挑战的层
+        :return:
+        """
+        pos = self.list_find(self.L_LAYER_LIST, layer)
+        if pos:
+            self.device.click(x=pos[0], y=pos[1])
+            return True
+
+    def check_lock(self, lock: bool = True) -> bool:
+        """
+        检查是否锁定阵容, 要求在觉醒界面
+        :param lock:
+        :return:
+        """
+        logger.info('Check lock: %s', lock)
+        if lock:
+            while 1:
+                self.screenshot()
+                if self.appear(self.I_EVOZONE_LOCK):
+                    return True
+                if self.appear_then_click(self.I_EVOZONE_UNLOCK, interval=1):
+                    continue
+        else:
+            while 1:
+                self.screenshot()
+                if self.appear(self.I_EVOZONE_UNLOCK):
+                    return True
+                if self.appear_then_click(self.I_EVOZONE_LOCK, interval=1):
+                    continue
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    def run_leader(self):
+        logger.info('Start run leader')
+        self.ui_get_current_page()
+        # self.ui_goto(page_soul_zones)
+        self.ui_goto(page_awake_zones)
+        self.evozone_enter()
+        layer = self.config.evo_zone.evo_zone_config.layer
+        logger.info("test0")
+        self.check_layer(layer)
+        logger.info("test1")
+        self.check_lock(self.config.evo_zone.general_battle_config.lock_team_enable)
+        logger.info("test2")
+        # 创建队伍
+        logger.info('Create team')
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_EVOZONE_MATCHING):
+                break
+            if self.appear_then_click(self.I_FORM_TEAM, interval=1):
+                continue
+        # 创建房间
+        self.create_room()
+        self.ensure_private()
+        self.create_ensure()
+
+        # 邀请队友
+        success = True
+        is_first = True
+        # 这个时候我已经进入房间了哦
+        while 1:
+            self.screenshot()
+            # 无论胜利与否, 都会出现是否邀请一次队友
+            # 区别在于,失败的话不会出现那个勾选默认邀请的框
+            if self.check_and_invite(self.config.evo_zone.invite_config.default_invite):
+                continue
+
+            # 检查猫咪奖励
+            if self.appear_then_click(self.I_PET_PRESENT, action=self.C_WIN_3, interval=1):
+                continue
+
+            if self.current_count >= self.limit_count:
+                if self.is_in_room():
+                    logger.info('EvoZone count limit out')
+                    break
+
+            if datetime.now() - self.start_time >= self.limit_time:
+                if self.is_in_room():
+                    logger.info('EvoZone time limit out')
+                    break
+
+
+
+            # 如果没有进入房间那就不需要后面的邀请
+            if not self.is_in_room():
+                # 如果在探索界面或者是出现在组队界面, 那就是可能房间死了
+                # 要结束任务
+                sleep(0.5)
+                if self.appear(self.I_MATCHING) or self.appear(self.I_CHECK_EXPLORATION):
+                    sleep(0.5)
+                    if self.appear(self.I_MATCHING) or self.appear(self.I_CHECK_EXPLORATION):
+                        logger.warning('EvoZone task failed')
+                        success = False
+                        break
+                continue
+
+            # 点击挑战
+            if not is_first:
+                if self.run_invite(config=self.config.evo_zone.invite_config):
+                    self.run_general_battle(config=self.config.evo_zone.general_battle_config)
+                else:
+                    # 邀请失败,退出任务
+                    logger.warning('Invite failed and exit this EvoZone task')
+                    success = False
+                    break
+
+            # 第一次会邀请队友
+            if is_first:
+                if not self.run_invite(config=self.config.evo_zone.invite_config, is_first=True):
+                    logger.warning('Invite failed and exit this evozone task')
+                    success = False
+                    break
+                else:
+                    is_first = False
+                    self.run_general_battle(config=self.config.evo_zone.general_battle_config)
+
+        # 当结束或者是失败退出循环的时候只有两个UI的可能,在房间或者是在组队界面
+        # 如果在房间就退出
+        if self.exit_room():
+            pass
+        # 如果在组队界面就退出
+        if self.exit_team():
+            pass
+
+        self.ui_get_current_page()
+        self.ui_goto(page_main)
+
+        if not success:
+            return False
+        return True
+
+    def run_member(self):
+        logger.info('Start run member')
+        self.ui_get_current_page()
+        # self.ui_goto(page_soul_zones)
+        # self.evozone_enter()
+        # self.check_lock(self.config.evo_zone.general_battle_config.lock_team_enable)
+
+        # 进入战斗流程
+        self.device.stuck_record_add('BATTLE_STATUS_S')
+        while 1:
+            self.screenshot()
+
+            # 检查猫咪奖励
+            if self.appear_then_click(self.I_PET_PRESENT, action=self.C_WIN_3, interval=1):
+                continue
+
+            if self.current_count >= self.limit_count:
+                logger.info('EvoZone count limit out')
+                break
+            if datetime.now() - self.start_time >= self.limit_time:
+                logger.info('EvoZone time limit out')
+                break
+
+            if self.check_then_accept():
+                continue
+
+            if self.is_in_room():
+                self.device.stuck_record_clear()
+                if self.wait_battle(wait_time=self.config.evo_zone.invite_config.wait_time):
+                    self.run_general_battle(config=self.config.evo_zone.general_battle_config)
+                else:
+                    break
+            # 队长秒开的时候,检测是否进入到战斗中
+            elif self.check_take_over_battle(False, config=self.config.evo_zone.general_battle_config):
+                continue
+
+        while 1:
+            # 有一种情况是本来要退出的,但是队长邀请了进入的战斗的加载界面
+            if self.appear(self.I_GI_HOME) or self.appear(self.I_GI_EXPLORE):
+                break
+            # 如果可能在房间就退出
+            if self.exit_room():
+                pass
+            # 如果还在战斗中,就退出战斗
+            if self.exit_battle():
+                pass
+
+
+        self.ui_get_current_page()
+        self.ui_goto(page_main)
+        return True
+
+    def run_alone(self):
+        logger.info('Start run alone')
+        self.ui_get_current_page()
+        self.ui_goto(page_awake_zones)
+        self.evozone_enter()
+        layer = self.config.evo_zone.evo_zone_config.layer
+        self.check_layer(layer)
+        self.check_lock(self.config.evo_zone.general_battle_config.lock_team_enable)
+
+        def is_in_evozone(screenshot=False) -> bool:
+            if screenshot:
+                self.screenshot()
+            return self.appear(self.I_EVOZONE_FIRE)
+
+        while 1:
+            self.screenshot()
+
+            # 检查猫咪奖励
+            if self.appear_then_click(self.I_PET_PRESENT, action=self.C_WIN_3, interval=1):
+                continue
+
+            if not is_in_evozone():
+                continue
+
+            if self.current_count >= self.limit_count:
+                logger.info('EvoZone count limit out')
+                break
+            if datetime.now() - self.start_time >= self.limit_time:
+                logger.info('EvoZone time limit out')
+                break
+
+            # 点击挑战
+            while 1:
+                self.screenshot()
+                if self.appear_then_click(self.I_EVOZONE_FIRE, interval=1):
+                    pass
+
+                if not self.appear(self.I_EVOZONE_FIRE):
+                    self.run_general_battle(config=self.config.evo_zone.general_battle_config)
+                    break
+
+        # 回去
+        while 1:
+            self.screenshot()
+            if not self.appear(self.I_FORM_TEAM):
+                break
+            if self.appear_then_click(self.I_BACK_BL, interval=1):
+                continue
+
+        self.ui_current = page_soul_zones
+        self.ui_goto(page_main)
+
+
+
+    def run_wild(self):
+        logger.error('Wild mode is not implemented')
+        pass
+
+
+
+
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+    from memory_profiler import profile
+    c = Config('oas1')
+    d = Device(c)
+    t = ScriptTask(c, d)
+
+    # t.run()
+
+    # t.check_layer('悲')
+
+    from module.base.timer import timer
+
+    @timer
+    @profile
+    def test_memory():
+        t.screenshot()
+        print(t.ocr_appear(t.O_O_TEST_OCR))
+        print(t.L_LAYER_LIST.image_appear(t.device.image, '悲'))
+    for i in range(4):
+        test_memory()
+        print('=====================')
+
+
+
+
+
+
+

+ 2 - 0
tasks/GameUi/assets.py

@@ -82,6 +82,8 @@ class GameUiAssets:
 	I_SIX_GATES_GOTO_EXPLORATION = RuleImage(roi_front=(18,19,52,55), roi_back=(18,19,52,55), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_six_gates_goto_exploration.png")
 	I_SIX_GATES_GOTO_EXPLORATION = RuleImage(roi_front=(18,19,52,55), roi_back=(18,19,52,55), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_six_gates_goto_exploration.png")
 	# description 
 	# description 
 	I_BONDLING_GOTO_EXPLORATION = RuleImage(roi_front=(20,13,60,59), roi_back=(20,13,60,59), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_bondling_goto_exploration.png")
 	I_BONDLING_GOTO_EXPLORATION = RuleImage(roi_front=(20,13,60,59), roi_back=(20,13,60,59), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_bondling_goto_exploration.png")
+	# description 
+	I_RYOUTOPPA_GOTO_REALMRAID = RuleImage(roi_front=(1201,234,62,105), roi_back=(1201,234,62,105), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_ryoutoppa_goto_realmraid.png")
 
 
 
 
 	# Image Rule Assets
 	# Image Rule Assets

+ 1 - 0
tasks/GameUi/page.py

@@ -64,6 +64,7 @@ page_exploration.link(button=G.I_EXPLORATION_GOTO_REALM_RAID, destination=page_r
 page_kekkai_toppa = Page(G.I_KEKKAI_TOPPA)
 page_kekkai_toppa = Page(G.I_KEKKAI_TOPPA)
 page_kekkai_toppa.link(button=G.I_REALM_RAID_GOTO_EXPLORATION, destination=page_exploration)
 page_kekkai_toppa.link(button=G.I_REALM_RAID_GOTO_EXPLORATION, destination=page_exploration)
 page_realm_raid.link(button=RyouToppaAssets.I_RYOU_TOPPA, destination=page_kekkai_toppa)
 page_realm_raid.link(button=RyouToppaAssets.I_RYOU_TOPPA, destination=page_kekkai_toppa)
+page_kekkai_toppa.link(button=G.I_RYOUTOPPA_GOTO_REALMRAID, destination=page_realm_raid)
 # 御灵 goryou realm
 # 御灵 goryou realm
 page_goryou_realm = Page(G.I_CHECK_GORYOU)
 page_goryou_realm = Page(G.I_CHECK_GORYOU)
 page_goryou_realm.link(button=G.I_BACK_BLUE, destination=page_exploration)
 page_goryou_realm.link(button=G.I_BACK_BLUE, destination=page_exploration)

+ 9 - 0
tasks/GameUi/page/page_img.json

@@ -232,5 +232,14 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
+  },
+  {
+    "itemName": "ryoutoppa_goto_realmraid",
+    "imageName": "page_ryoutoppa_goto_realmraid.png",
+    "roiFront": "1201,234,62,105",
+    "roiBack": "1201,234,62,105",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
   }
 ]
 ]

BIN
tasks/GameUi/page/page_ryoutoppa_goto_realmraid.png