Переглянути джерело

Merge pull request #470 from ohspecial/dev-fix

feat(HeroTest, WantedQuests): 自动换御魂功能添加至英杰试炼和悬赏任务
huangrunheng 2 роки тому
батько
коміт
f38b267782

+ 2 - 1
tasks/HeroTest/config.py

@@ -9,7 +9,7 @@ from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleCon
 from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.config_base import ConfigBase, Time, TimeDelta
 from tasks.Component.config_base import ConfigBase, Time, TimeDelta
 from tasks.Component.BaseActivity.config_activity import GeneralClimb
 from tasks.Component.BaseActivity.config_activity import GeneralClimb
-
+from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
 
 
 class Layer(str, Enum):
 class Layer(str, Enum):
     YANWU: str = "鬼兵演武"
     YANWU: str = "鬼兵演武"
@@ -37,3 +37,4 @@ class HeroTest(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     scheduler: Scheduler = Field(default_factory=Scheduler)
     herotest: HeroTestConfig = Field(default_factory=HeroTestConfig)
     herotest: HeroTestConfig = Field(default_factory=HeroTestConfig)
     general_battle: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
     general_battle: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
+    switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)

+ 13 - 2
tasks/HeroTest/script_task.py

@@ -6,14 +6,15 @@ import random  # type: ignore
 
 
 from tasks.Component.BaseActivity.base_activity import BaseActivity
 from tasks.Component.BaseActivity.base_activity import BaseActivity
 from tasks.HeroTest.assets import HeroTestAssets
 from tasks.HeroTest.assets import HeroTestAssets
-from tasks.GameUi.page import page_main
+from tasks.GameUi.page import page_main, page_shikigami_records
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.game_ui import GameUi
+from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 
 
 from module.logger import logger
 from module.logger import logger
 from module.exception import TaskEnd
 from module.exception import TaskEnd
 
 
 
 
-class ScriptTask(GameUi, BaseActivity, HeroTestAssets):
+class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
 
 
     is_update = False
     is_update = False
     is_skill = False
     is_skill = False
@@ -23,6 +24,16 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets):
         config = self.config.hero_test
         config = self.config.hero_test
         global is_update
         global is_update
         global is_skill
         global is_skill
+         # 自动换御魂
+        if config.switch_soul_config.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(config.switch_soul_config.switch_group_team)
+        if config.switch_soul_config.enable_switch_by_name:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul_by_name(config.switch_soul_config.group_name, config.switch_soul_config.team_name)
+
         if config.herotest.layer.value == "鬼兵演武":
         if config.herotest.layer.value == "鬼兵演武":
             is_update = True
             is_update = True
             is_skill = False
             is_skill = False

+ 1 - 0
tasks/WantedQuests/config.py

@@ -88,3 +88,4 @@ class WantedQuestsConfig(BaseModel):
 class WantedQuests(ConfigBase):
 class WantedQuests(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     scheduler: Scheduler = Field(default_factory=Scheduler)
     wanted_quests_config: WantedQuestsConfig = Field(default_factory=WantedQuestsConfig)
     wanted_quests_config: WantedQuestsConfig = Field(default_factory=WantedQuestsConfig)
+    switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)

+ 15 - 3
tasks/WantedQuests/script_task.py

@@ -14,7 +14,7 @@ from module.logger import logger
 from module.base.timer import Timer
 from module.base.timer import Timer
 
 
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.game_ui import GameUi
-from tasks.GameUi.page import page_main, page_exploration
+from tasks.GameUi.page import page_main, page_exploration, page_shikigami_records
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
 from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
@@ -24,12 +24,24 @@ from tasks.WantedQuests.config import WantedQuestsConfig, CooperationType, Coope
 from tasks.WantedQuests.assets import WantedQuestsAssets
 from tasks.WantedQuests.assets import WantedQuestsAssets
 from tasks.Component.Costume.config import MainType
 from tasks.Component.Costume.config import MainType
 from typing import List
 from typing import List
+from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 
 
-
-class ScriptTask(SecretScriptTask, GeneralInvite, WantedQuestsAssets):
+class ScriptTask(SecretScriptTask, GeneralInvite, WantedQuestsAssets, SwitchSoul):
 
 
     def run(self):
     def run(self):
         con = self.config
         con = self.config
+
+         # 自动换御魂
+        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)
+
+
         if not self.pre_work():
         if not self.pre_work():
             # 无法完成预处理 很有可能你已经完成了悬赏任务
             # 无法完成预处理 很有可能你已经完成了悬赏任务
             logger.warning('Cannot pre-work')
             logger.warning('Cannot pre-work')