Răsfoiți Sursa

Merge pull request #243 from rwerplus/develop

永生之海增加两组御魂切换,没有适配中文
huangrunheng 2 ani în urmă
părinte
comite
8006537477

+ 3 - 0
tasks/EternitySea/config.py

@@ -4,6 +4,7 @@
 from pydantic import BaseModel, Field
 from enum import Enum
 from datetime import datetime, time
+from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
 
 from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.config_base import ConfigBase, Time
@@ -31,4 +32,6 @@ class EternitySea(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     eternity_sea_config: EternitySeaConfig = Field(default_factory=EternitySeaConfig)
     general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
+    switch_soul_config_1: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
+    switch_soul_config_2: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
 

+ 14 - 1
tasks/EternitySea/script_task.py

@@ -7,7 +7,7 @@ from module.exception import TaskEnd
 from module.logger import logger
 
 from tasks.GameUi.game_ui import GameUi, Page
-from tasks.GameUi.page import page_soul_zones
+from tasks.GameUi.page import page_soul_zones, page_shikigami_records
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralRoom.general_room import GeneralRoom
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
@@ -25,7 +25,20 @@ class ScriptTask(
     def task_name(self):
         return "EternitySea"
 
+    def _two_teams_switch_sous(self, config):
+        if config.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(config.switch_group_team)
+
+        if config.enable_switch_by_name:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul_by_name(config.group_name, config.team_name)
+
     def run(self) -> None:
+        self._two_teams_switch_sous(self._task_config.switch_soul_config_1)
+        self._two_teams_switch_sous(self._task_config.switch_soul_config_2)
         match self._task_config.eternity_sea_config.user_status:
             case UserStatus.ALONE:
                 success = self.run_alone()

+ 4 - 1
tasks/EvoZone/config.py

@@ -4,6 +4,7 @@
 from pydantic import BaseModel, Field
 from enum import Enum
 from datetime import datetime, time
+from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
 
 from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.config_base import ConfigBase, Time
@@ -48,11 +49,13 @@ class EvoZoneConfig(ConfigBase):
     # 限制次数
     limit_count: int = Field(default=30, description='limit_count_help')
     # 是否开启觉醒加成
-    soul_buff_enable: bool = Field(default=False, description='soul_buff_enable_help')
+    soul_buff_enable: bool = Field(default=False, description='是否开启觉醒加成')
 
 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)
+    switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
+
 

+ 26 - 40
tasks/EvoZone/script_task.py

@@ -8,14 +8,16 @@ 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.Component.SwitchSoul.switch_soul import SwitchSoul
 from tasks.GameUi.game_ui import GameUi
-from tasks.GameUi.page import page_main, page_awake_zones
+from tasks.GameUi.page import page_main, page_awake_zones, page_shikigami_records
 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):
+
+class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, EvoZoneAssets, SwitchSoul):
 
     def run(self) -> bool:
 
@@ -23,7 +25,17 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         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.limit_time: timedelta = timedelta(hours=limit_time.hour, minutes=limit_time.minute,
+                                               seconds=limit_time.second)
+        con = self.config.evo_zone
+        if con.switch_soul_config.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(con.switch_soul_config.switch_group_team)
+        if con.switch_soul_config.enable_switch_by_name:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul_by_name(con.switch_soul_config.group_name, con.switch_soul_config.team_name)
 
         self.ui_get_current_page()
         self.ui_goto(page_main)
@@ -35,11 +47,16 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
 
         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')
+            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:
@@ -105,21 +122,6 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
                 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()
@@ -170,8 +172,6 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
                     logger.info('EvoZone time limit out')
                     break
 
-
-
             # 如果没有进入房间那就不需要后面的邀请
             if not self.is_in_room():
                 # 如果在探索界面或者是出现在组队界面, 那就是可能房间死了
@@ -267,7 +267,6 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
             if self.exit_battle():
                 pass
 
-
         self.ui_get_current_page()
         self.ui_goto(page_main)
         return True
@@ -324,20 +323,15 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         self.ui_current = page_awake_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
+
     c = Config('oas1')
     d = Device(c)
     t = ScriptTask(c, d)
@@ -347,11 +341,3 @@ if __name__ == '__main__':
     # t.check_layer('悲')
 
     from module.base.timer import timer
-
-
-
-
-
-
-
-

+ 10 - 0
tasks/GameUi/game_ui.py

@@ -11,6 +11,7 @@ from module.atom.ocr import RuleOcr
 
 from tasks.GameUi.assets import GameUiAssets
 from tasks.GameUi.page import *
+from tasks.Restart.assets import RestartAssets
 from tasks.base_task import BaseTask
 from module.logger import logger
 from module.exception import (GameNotRunningError, GamePageUnknownError, RequestHumanTakeover)
@@ -69,6 +70,12 @@ class GameUi(BaseTask, GameUiAssets):
         """
         return self.appear(page.check_button)
 
+    def ensure_scroll_open(self):
+        """
+        判断庭院界面卷轴是否打开
+        """
+        return self.appear(RestartAssets.I_LOGIN_SCROOLL_CLOSE)
+
     def ensure_button_execute(self, button):
         """
         确保button执行
@@ -139,6 +146,9 @@ class GameUi(BaseTask, GameUiAssets):
             minicap_check()
             rotation_check()
 
+        if self.ensure_scroll_open():
+            self.ui_click_until_disappear(RestartAssets.I_LOGIN_SCROOLL_CLOSE)
+
         # Unknown page, need manual switching
         logger.warning("Unknown ui page")
         logger.attr("EMULATOR__SCREENSHOT_METHOD", self.config.script.device.screenshot_method)