Просмотр исходного кода

feat[orochi]:根据选层切换御魂

ljxun 2 лет назад
Родитель
Сommit
34f1102add
2 измененных файлов с 35 добавлено и 14 удалено
  1. 12 1
      tasks/Orochi/config.py
  2. 23 13
      tasks/Orochi/script_task.py

+ 12 - 1
tasks/Orochi/config.py

@@ -44,9 +44,20 @@ class OrochiConfig(ConfigBase):
     # 是否开启御魂加成
     # 是否开启御魂加成
     soul_buff_enable: bool = Field(default=False, description='soul_buff_enable_help')
     soul_buff_enable: bool = Field(default=False, description='soul_buff_enable_help')
 
 
+
+class OrochiSwitchSoul(ConfigBase):
+    auto_switch_soul: bool = Field(default=False, description='auto_switch_soul_help')
+    # 十层 config
+    ten_switch: str = Field(default='-1,-1', description='ten_switch_help')
+    # 悲鸣 config
+    eleven_switch: str = Field(default='-1,-1', description='eleven_switch_help')
+    # 神罚 config
+    twelve_switch: str = Field(default='-1,-1', description='twelve_switch_help')
+
+
 class Orochi(ConfigBase):
 class Orochi(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     scheduler: Scheduler = Field(default_factory=Scheduler)
     orochi_config: OrochiConfig = Field(default_factory=OrochiConfig)
     orochi_config: OrochiConfig = Field(default_factory=OrochiConfig)
     invite_config: InviteConfig = Field(default_factory=InviteConfig)
     invite_config: InviteConfig = Field(default_factory=InviteConfig)
     general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
     general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
-    switch_soul: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
+    orochi_switch_soul: OrochiSwitchSoul = Field(default_factory=OrochiSwitchSoul)

+ 23 - 13
tasks/Orochi/script_task.py

@@ -13,31 +13,23 @@ from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.page import page_main, page_soul_zones, page_shikigami_records
 from tasks.GameUi.page import page_main, page_soul_zones, page_shikigami_records
 from tasks.Orochi.assets import OrochiAssets
 from tasks.Orochi.assets import OrochiAssets
-from tasks.Orochi.config import Orochi, UserStatus
+from tasks.Orochi.config import Orochi, UserStatus, Layer
 from module.logger import logger
 from module.logger import logger
 from module.exception import TaskEnd
 from module.exception import TaskEnd
 
 
 class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, SwitchSoul, OrochiAssets):
 class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, SwitchSoul, OrochiAssets):
 
 
     def run(self) -> bool:
     def run(self) -> bool:
-        # 御魂切换方式一
-        if self.config.orochi.switch_soul.enable:
-            self.ui_get_current_page()
-            self.ui_goto(page_shikigami_records)
-            self.run_switch_soul(self.config.orochi.switch_soul.switch_group_team)
 
 
-        # 御魂切换方式二
-        if self.config.orochi.switch_soul.enable_switch_by_name:
-            self.ui_get_current_page()
-            self.ui_goto(page_shikigami_records)
-            self.run_switch_soul_by_name(self.config.orochi.switch_soul.group_name,
-                                         self.config.orochi.switch_soul.team_name)
+        # 根据选层换御魂
+        self.orochi_switch_soul()
 
 
         limit_count = self.config.orochi.orochi_config.limit_count
         limit_count = self.config.orochi.orochi_config.limit_count
         limit_time = self.config.orochi.orochi_config.limit_time
         limit_time = self.config.orochi.orochi_config.limit_time
         self.current_count = 0
         self.current_count = 0
         self.limit_count: int = limit_count
         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)
 
 
         config: Orochi = self.config.orochi
         config: Orochi = self.config.orochi
         if not self.is_in_battle(True):
         if not self.is_in_battle(True):
@@ -471,7 +463,25 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
             if random_click_swipt_enable:
             if random_click_swipt_enable:
                 self.random_click_swipt()
                 self.random_click_swipt()
 
 
+    def orochi_switch_soul(self) -> None:
 
 
+        layer = self.config.orochi.orochi_config.layer
+        orochi_switch_soul = self.config.orochi.orochi_switch_soul
+
+        # 按照选择的来切换御魂
+        group_team: str = None
+        match layer:
+            case Layer.TEN:
+                group_team = orochi_switch_soul.ten_switch
+            case Layer.ELEVEN:
+                group_team = orochi_switch_soul.eleven_switch
+            case Layer.TWELVE:
+                group_team = orochi_switch_soul.twelve_switch
+
+        if orochi_switch_soul.auto_switch_soul:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(group_team)
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
     from module.config.config import Config
     from module.config.config import Config