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

Merge pull request #780 from runhey/dev

Automated PR 2025.03.20
huangrunheng 1 год назад
Родитель
Сommit
a8ba1d08da
50 измененных файлов с 605 добавлено и 196 удалено
  1. 1 1
      module/config/config_manual.py
  2. 1 1
      module/config/config_menu.py
  3. 2 0
      module/config/config_model.py
  4. 16 9
      module/device/platform2/platform_windows.py
  5. 1 1
      tasks/AreaBoss/assets.py
  6. 24 111
      tasks/Component/Costume/costume_base.py
  7. 2 0
      tasks/Component/GeneralBattle/assets.py
  8. BIN
      tasks/Component/GeneralBattle/gb/gb_preset_wit_number.png
  9. 9 0
      tasks/Component/GeneralBattle/gb/image.json
  10. 4 2
      tasks/Component/GeneralBattle/general_battle.py
  11. 7 5
      tasks/Component/SwitchSoul/assets.py
  12. 19 10
      tasks/Component/SwitchSoul/ss/image.json
  13. BIN
      tasks/Component/SwitchSoul/ss/ss_check_block.png
  14. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_switch_1.png
  15. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_switch_2.png
  16. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_switch_3.png
  17. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_switch_4.png
  18. BIN
      tasks/Component/SwitchSoul/ss/ss_soul_preset.png
  19. 4 2
      tasks/Component/SwitchSoul/switch_soul.py
  20. BIN
      tasks/DemonRetreat/DemonRetreat/DemonRetreat_demon_back_check.png
  21. BIN
      tasks/DemonRetreat/DemonRetreat/DemonRetreat_demon_gather.png
  22. BIN
      tasks/DemonRetreat/DemonRetreat/DemonRetreat_enter_fire.png
  23. BIN
      tasks/DemonRetreat/DemonRetreat/DemonRetreat_hunt.png
  24. BIN
      tasks/DemonRetreat/DemonRetreat/DemonRetreat_hunt_check.png
  25. BIN
      tasks/DemonRetreat/DemonRetreat/DemonRetreat_new.png
  26. BIN
      tasks/DemonRetreat/DemonRetreat/DemonRetreat_pray.png
  27. BIN
      tasks/DemonRetreat/DemonRetreat/DemonRetreat_rank_lsit.png
  28. BIN
      tasks/DemonRetreat/DemonRetreat/DemonRetreat_reward_all.png
  29. BIN
      tasks/DemonRetreat/DemonRetreat/DemonRetreat_shrine.png
  30. 92 0
      tasks/DemonRetreat/DemonRetreat/image.json
  31. 11 0
      tasks/DemonRetreat/DemonRetreat/ocr.json
  32. 40 0
      tasks/DemonRetreat/assets.py
  33. 22 0
      tasks/DemonRetreat/config.py
  34. 281 0
      tasks/DemonRetreat/script_task.py
  35. 11 11
      tasks/Hyakkiyakou/assets.py
  36. 12 12
      tasks/Hyakkiyakou/hya/click.json
  37. BIN
      tasks/Hyakkiyakou/hya/hya_hinvite.png
  38. 2 2
      tasks/Hyakkiyakou/hya/image1.json
  39. 8 8
      tasks/Hyakkiyakou/hya/image5.json
  40. 3 0
      tasks/Script/config_device.py
  41. 2 1
      tasks/SixRealms/config.py
  42. 16 5
      tasks/SixRealms/script_task.py
  43. BIN
      tasks/SoulsTidy/simple/simple_st_replace.png
  44. BIN
      tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_jade.png
  45. BIN
      tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_wechat.png
  46. 5 5
      tasks/WeeklyTrifles/area_boss/image.json
  47. 6 6
      tasks/WeeklyTrifles/assets.py
  48. 4 4
      tasks/WeeklyTrifles/secret/image.json
  49. BIN
      tasks/WeeklyTrifles/secret/secret_wt_se_jade.png
  50. BIN
      tasks/WeeklyTrifles/secret/secret_wt_se_wechat.png

+ 1 - 1
module/config/config_manual.py

@@ -11,7 +11,7 @@ class ConfigManual:
         Restart > SoulsTidy
         > KekkaiUtilize > KekkaiActivation > DemonEncounter
         > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > Tako > RealmRaid > RyouToppa > DailyTrifles > Exploration
-        > Dokan > AbyssShadows > Hunt > GuildBanquet
+        > Dokan > AbyssShadows > Hunt > GuildBanquet > DemonRetreat
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea > SixRealms
         > ActivityShikigami > WantedQuests
         > BondlingFairyland > EvoZone > GoryouRealm > HeroTest

+ 1 - 1
module/config/config_menu.py

@@ -36,7 +36,7 @@ class ConfigMenu:
         ]
         # 阴阳寮
         self.menu["Guild"] = ['KekkaiUtilize', 'KekkaiActivation', 'RealmRaid', 'RyouToppa', 'Dokan', 'CollectiveMissions',
-                              'Hunt' , 'AbyssShadows', 'GuildBanquet']
+                              'Hunt' , 'AbyssShadows', 'GuildBanquet', 'DemonRetreat']
         # 每周任务
         self.menu["Weekly Task"] = ['TrueOrochi', 'RichMan', 'Secret', 'WeeklyTrifles', 'MysteryShop', 'Duel']
         # 活动的任务

+ 2 - 0
module/config/config_model.py

@@ -47,6 +47,7 @@ from tasks.CollectiveMissions.config import CollectiveMissions
 from tasks.Hunt.config import Hunt
 from tasks.AbyssShadows.config import AbyssShadows
 from tasks.GuildBanquet.config import GuildBanquet
+from tasks.DemonRetreat.config import DemonRetreat
 
 # 这一部分是活动的配置-----------------------------------------------------------------------------------------------------
 from tasks.ActivityShikigami.config import ActivityShikigami
@@ -139,6 +140,7 @@ class ConfigModel(ConfigBase):
     dokan: Dokan = Field(default_factory=Dokan)
     abyss_shadows: AbyssShadows = Field(default_factory=AbyssShadows)
     guild_banquet: GuildBanquet = Field(default_factory=GuildBanquet)
+    demon_retreat: DemonRetreat = Field(default_factory=DemonRetreat)
 
     def __init__(self, config_name: str=None) -> None:
         """

+ 16 - 9
module/device/platform2/platform_windows.py

@@ -315,15 +315,22 @@ class PlatformWindows(PlatformBase, EmulatorManager):
             # All check passed
             break
 
-        if new_window != 0 and new_window != current_window:
-            logger.info(f'Minimize new window: {new_window}')
-            minimize_window(new_window)
-        if current_window:
-            logger.info(f'De-flash current window: {current_window}')
-            flash_window(current_window, flash=False)
-        if new_window:
-            logger.info(f'Flash new window: {new_window}')
-            flash_window(new_window, flash=True)
+        emulator_window_minimize = self.config.script.device.emulator_window_minimize
+        logger.info(f'Minimize new emulator window: {emulator_window_minimize}')
+        if emulator_window_minimize:
+            if new_window != 0 and new_window != current_window:
+                # 如果有新窗口且新窗口不是当前窗口,最小化新窗口
+                logger.info(f'Minimize new window: {new_window}')
+                minimize_window(new_window)
+            if current_window:
+                # 如果有当前窗口,取消当前窗口的闪烁
+                logger.info(f'De-flash current window: {current_window}')
+                flash_window(current_window, flash=False)
+            if new_window:
+                # 如果有新窗口,使新窗口闪烁
+                logger.info(f'Flash new window: {new_window}')
+                flash_window(new_window, flash=True)
+
         logger.info('Emulator start completed')
         return True
 

+ 1 - 1
tasks/AreaBoss/assets.py

@@ -101,7 +101,7 @@ class AreaBossAssets:
 	I_AB_JI_FLOOR_TEN = RuleImage(roi_front=(390,370,60,40), roi_back=(390,370,60,40), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_ji_floor_ten.png")
 	# 小组内未取得名次 
 	I_AB_GROUP_RANK_NONE = RuleImage(roi_front=(890,415,95,85), roi_back=(890,415,95,85), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_rank_none.png")
-	# 挑战数进度条
+	# 挑战数进度条 
 	I_AB_NUM_CHALLENGE_RAIL = RuleImage(roi_front=(895,639,14,27), roi_back=(895,639,14,27), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_num_challenge_rail.png")
 
 

+ 24 - 111
tasks/Component/Costume/costume_base.py

@@ -12,64 +12,18 @@ from tasks.Component.CostumeRealm.assets import CostumeRealmAssets
 from tasks.Component.CostumeBattle.assets import CostumeBattleAssets
 
 # 庭院皮肤
+# 主界面皮肤(使用字典推导式动态生成)
 main_costume_model = {
-    MainType.COSTUME_MAIN_1: {'I_CHECK_MAIN': 'I_CHECK_MAIN_1',
-                              'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_1',
-                              'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_1',
-                              'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_1',
-                              'I_PET_HOUSE': 'I_PET_HOUSE_1', },
-    MainType.COSTUME_MAIN_2: {'I_CHECK_MAIN': 'I_CHECK_MAIN_2',
-                              'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_2',
-                              'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_2',
-                              'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_2',
-                              'I_PET_HOUSE': 'I_PET_HOUSE_2', },
-    MainType.COSTUME_MAIN_3: {'I_CHECK_MAIN': 'I_CHECK_MAIN_3',
-                              'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_3',
-                              'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_3',
-                              'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_3',
-                              'I_PET_HOUSE': 'I_PET_HOUSE_3', },
-    MainType.COSTUME_MAIN_4: {'I_CHECK_MAIN': 'I_CHECK_MAIN_4',
-                              'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_4',
-                              'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_4',
-                              'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_4',
-                              'I_PET_HOUSE': 'I_PET_HOUSE_4', },
-    MainType.COSTUME_MAIN_5: {'I_CHECK_MAIN': 'I_CHECK_MAIN_5',
-                              'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_5',
-                              'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_5',
-                              'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_5',
-                              'I_PET_HOUSE': 'I_PET_HOUSE_5', },
-    MainType.COSTUME_MAIN_6: {'I_CHECK_MAIN': 'I_CHECK_MAIN_6',
-                              'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_6',
-                              'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_6',
-                              'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_6',
-                              'I_PET_HOUSE': 'I_PET_HOUSE_6', },
-    MainType.COSTUME_MAIN_7: {'I_CHECK_MAIN': 'I_CHECK_MAIN_7',
-                              'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_7',
-                              'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_7',
-                              'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_7',
-                              'I_PET_HOUSE': 'I_PET_HOUSE_7', },
-    MainType.COSTUME_MAIN_8: {'I_CHECK_MAIN': 'I_CHECK_MAIN_8',
-                              'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_8',
-                              'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_8',
-                              'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_8',
-                              'I_PET_HOUSE': 'I_PET_HOUSE_8', },
-    MainType.COSTUME_MAIN_9: {'I_CHECK_MAIN': 'I_CHECK_MAIN_9',
-                              'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_9',
-                              'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_9',
-                              'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_9',
-                              'I_PET_HOUSE': 'I_PET_HOUSE_9', },
-    MainType.COSTUME_MAIN_10: {'I_CHECK_MAIN': 'I_CHECK_MAIN_10',
-                               'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_10',
-                               'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_10',
-                               'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_10',
-                               'I_PET_HOUSE': 'I_PET_HOUSE_10', },
-    MainType.COSTUME_MAIN_11: {'I_CHECK_MAIN': 'I_CHECK_MAIN_11',
-                               'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_11',
-                               'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_11',
-                               'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_11',
-                               'I_PET_HOUSE': 'I_PET_HOUSE_11', },
+    getattr(MainType, f"COSTUME_MAIN_{i}"): {
+        'I_CHECK_MAIN': f'I_CHECK_MAIN_{i}',
+        'I_MAIN_GOTO_EXPLORATION': f'I_MAIN_GOTO_EXPLORATION_{i}',
+        'I_MAIN_GOTO_SUMMON': f'I_MAIN_GOTO_SUMMON_{i}',
+        'I_MAIN_GOTO_TOWN': f'I_MAIN_GOTO_TOWN_{i}',
+        'I_PET_HOUSE': f'I_PET_HOUSE_{i}'
+    } for i in range(1, 12)
 }
 
+
 # 结界皮肤
 realm_costume_model = {
     RealmType.COSTUME_REALM_1: {'I_SHI_CARD': 'I_SHI_CARD_1',
@@ -81,62 +35,21 @@ realm_costume_model = {
                                 'I_BOX_EXP': 'I_BOX_EXP_2'},
 }
 
-# 战斗主题
-battle_theme_model = {
-    BattleType.COSTUME_BATTLE_1: {
-        'I_LOCAL': 'I_LOCAL_1',
-        'I_EXIT': 'I_EXIT_1',
-        'I_FRIENDS': 'I_FRIENDS_1',
-    },
-    BattleType.COSTUME_BATTLE_2: {
-        'I_LOCAL': 'I_LOCAL_2',
-        'I_EXIT': 'I_EXIT_2',
-        'I_FRIENDS': 'I_FRIENDS_2',
-    },
-    BattleType.COSTUME_BATTLE_3: {
-        'I_LOCAL': 'I_LOCAL_3',
-        'I_EXIT': 'I_EXIT_3',
-        'I_FRIENDS': 'I_FRIENDS_3',
-    },
-    BattleType.COSTUME_BATTLE_4: {
-        'I_LOCAL': 'I_LOCAL_4',
-        'I_EXIT': 'I_EXIT_4',
-        'I_FRIENDS': 'I_FRIENDS_4',
-    },
-    BattleType.COSTUME_BATTLE_5: {
-        'I_LOCAL': 'I_LOCAL_5',
-        'I_EXIT': 'I_EXIT_5',
-        'I_FRIENDS': 'I_FRIENDS_5',
-    },
-    BattleType.COSTUME_BATTLE_6: {
-        'I_LOCAL': 'I_LOCAL_6',
-        'I_EXIT': 'I_EXIT_6',
-        'I_FRIENDS': 'I_FRIENDS_6',
-    },
-    BattleType.COSTUME_BATTLE_7: {
-        'I_LOCAL': 'I_LOCAL_7',
-        'I_EXIT': 'I_EXIT_7',
-        'I_FRIENDS': 'I_FRIENDS_7',
-    },
-    BattleType.COSTUME_BATTLE_8: {
-        'I_LOCAL': 'I_LOCAL_8',
-        'I_EXIT': 'I_EXIT_8',
-        'I_FRIENDS': 'I_FRIENDS_8',
-        'I_WIN': 'I_WIN_8',
-        'I_DE_WIN': 'I_DE_WIN_8',
-        'I_FALSE': 'I_FALSE_8',
-    },
-    BattleType.COSTUME_BATTLE_9: {
-        'I_LOCAL': 'I_LOCAL_9',
-        'I_EXIT': 'I_EXIT_9',
-        'I_FRIENDS': 'I_FRIENDS_9',
-    },
-    BattleType.COSTUME_BATTLE_10: {
-        'I_LOCAL': 'I_LOCAL_10',
-        'I_EXIT': 'I_EXIT_10',
-        'I_FRIENDS': 'I_FRIENDS_10',
-    },
-}
+# 战斗主题(使用循环处理常规情况 + 特例处理)
+battle_theme_model = {}
+for i in range(1, 11):
+    entry = {
+        'I_LOCAL': f'I_LOCAL_{i}',
+        'I_EXIT': f'I_EXIT_{i}',
+        'I_FRIENDS': f'I_FRIENDS_{i}',
+    }
+    if i == 8:  # 特殊处理第8项
+        entry.update({
+            'I_WIN': 'I_WIN_8',
+            'I_DE_WIN': 'I_DE_WIN_8',
+            'I_FALSE': 'I_FALSE_8'
+        })
+    battle_theme_model[getattr(BattleType, f"COSTUME_BATTLE_{i}")] = entry
 
 
 class CostumeBase:

+ 2 - 0
tasks/Component/GeneralBattle/assets.py

@@ -121,6 +121,8 @@ class GeneralBattleAssets:
 	I_GREEN_MARKER_LEFT_TOP = RuleImage(roi_front=(0,0,1280,720), roi_back=(0,0,1280,720), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_green_marker_left_top.png")
 	# 绿标-下半部分 
 	I_GREEN_MARKER_BOTTOM = RuleImage(roi_front=(0,0,1280,720), roi_back=(0,0,1280,720), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_green_marker_bottom.png")
+	# 新版本的预设图案带数字 
+	I_PRESET_WIT_NUMBER = RuleImage(roi_front=(40,655,37,37), roi_back=(9,636,100,74), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_preset_wit_number.png")
 
 
 	# Image Rule Assets

BIN
tasks/Component/GeneralBattle/gb/gb_preset_wit_number.png


+ 9 - 0
tasks/Component/GeneralBattle/gb/image.json

@@ -241,5 +241,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "绿标-下半部分"
+  },
+  {
+    "itemName": "preset_wit_number",
+    "imageName": "gb_preset_wit_number.png",
+    "roiFront": "40,655,37,37",
+    "roiBack": "9,636,100,74",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "新版本的预设图案带数字"
   }
 ]

+ 4 - 2
tasks/Component/GeneralBattle/general_battle.py

@@ -87,7 +87,7 @@ class GeneralBattle(GeneralBuff, GeneralBattleAssets):
                 self.screenshot()
                 if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.5):
                     continue
-                if not self.appear(self.I_PRESET):
+                if not (self.appear(self.I_PRESET) or self.appear(self.I_PRESET_WIT_NUMBER)):
                     break
             logger.info(f"Click {self.I_PREPARE_HIGHLIGHT.name}")
 
@@ -297,6 +297,8 @@ class GeneralBattle(GeneralBuff, GeneralBattleAssets):
                 break
             if self.appear_then_click(self.I_PRESET, threshold=0.8, interval=1):
                 continue
+            if self.appear_then_click(self.I_PRESET_WIT_NUMBER, threshold=0.8, interval=1):
+                continue
             if self.ocr_appear(self.O_PRESET):
                 self.click(self.O_PRESET, interval=1)
                 continue
@@ -417,7 +419,7 @@ class GeneralBattle(GeneralBuff, GeneralBattleAssets):
             return True
         elif self.appear(self.I_PREPARE_DARK):
             return True
-        elif self.appear(self.I_PRESET):
+        elif self.appear(self.I_PRESET) or self.appear(self.I_PRESET_WIT_NUMBER):
             return True
         else:
             return False

+ 7 - 5
tasks/Component/SwitchSoul/assets.py

@@ -33,15 +33,15 @@ class SwitchSoulAssets:
 	# 退出式神录 
 	I_RECORD_SOUL_BACK = RuleImage(roi_front=(19,9,51,44), roi_back=(19,9,51,44), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_record_soul_back.png")
 	# 预设 
-	I_SOUL_PRESET = RuleImage(roi_front=(332,70,90,51), roi_back=(332,70,90,51), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_soul_preset.png")
+	I_SOUL_PRESET = RuleImage(roi_front=(335,73,90,51), roi_back=(310,57,169,72), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_soul_preset.png")
 	# description 
-	I_SOU_SWITCH_1 = RuleImage(roi_front=(971,148,37,35), roi_back=(971,148,37,35), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_1.png")
+	I_SOU_SWITCH_1 = RuleImage(roi_front=(971,149,34,32), roi_back=(962,141,51,48), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_1.png")
 	# description 
-	I_SOU_SWITCH_2 = RuleImage(roi_front=(978,304,27,29), roi_back=(978,304,27,29), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_2.png")
+	I_SOU_SWITCH_2 = RuleImage(roi_front=(967,296,42,39), roi_back=(961,292,54,49), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_2.png")
 	# description 
-	I_SOU_SWITCH_3 = RuleImage(roi_front=(973,454,26,26), roi_back=(973,454,26,26), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_3.png")
+	I_SOU_SWITCH_3 = RuleImage(roi_front=(968,448,41,38), roi_back=(962,442,52,48), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_3.png")
 	# description 
-	I_SOU_SWITCH_4 = RuleImage(roi_front=(971,600,37,26), roi_back=(971,600,37,26), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_4.png")
+	I_SOU_SWITCH_4 = RuleImage(roi_front=(967,597,42,25), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_4.png")
 	# description 
 	I_SOU_SWITCH_SURE = RuleImage(roi_front=(668,401,180,61), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_sure.png")
 	# 用于判断是否在式神录里面 
@@ -64,6 +64,8 @@ class SwitchSoulAssets:
 	I_SOU_TEAM_PRESENT = RuleImage(roi_front=(737,82,148,43), roi_back=(727,71,165,63), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_team_present.png")
 	# 需要切换的预设按钮(颜色深一点) 
 	I_SOU_CLICK_PRESENT = RuleImage(roi_front=(967,305,43,22), roi_back=(965,142,48,480), threshold=0.9, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_click_present.png")
+	# 误触点到式神检查 
+	I_CHECK_BLOCK = RuleImage(roi_front=(572,408,137,49), roi_back=(572,408,137,49), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_check_block.png")
 
 
 	# Ocr Rule Assets

+ 19 - 10
tasks/Component/SwitchSoul/ss/image.json

@@ -11,8 +11,8 @@
   {
     "itemName": "soul_preset",
     "imageName": "ss_soul_preset.png",
-    "roiFront": "332,70,90,51",
-    "roiBack": "332,70,90,51",
+    "roiFront": "335,73,90,51",
+    "roiBack": "310,57,169,72",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "预设"
@@ -20,8 +20,8 @@
   {
     "itemName": "sou_switch_1",
     "imageName": "ss_sou_switch_1.png",
-    "roiFront": "971,148,37,35",
-    "roiBack": "971,148,37,35",
+    "roiFront": "971,149,34,32",
+    "roiBack": "962,141,51,48",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -29,8 +29,8 @@
   {
     "itemName": "sou_switch_2",
     "imageName": "ss_sou_switch_2.png",
-    "roiFront": "978,304,27,29",
-    "roiBack": "978,304,27,29",
+    "roiFront": "967,296,42,39",
+    "roiBack": "961,292,54,49",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -38,8 +38,8 @@
   {
     "itemName": "sou_switch_3",
     "imageName": "ss_sou_switch_3.png",
-    "roiFront": "973,454,26,26",
-    "roiBack": "973,454,26,26",
+    "roiFront": "968,448,41,38",
+    "roiBack": "962,442,52,48",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -47,8 +47,8 @@
   {
     "itemName": "sou_switch_4",
     "imageName": "ss_sou_switch_4.png",
-    "roiFront": "971,600,37,26",
-    "roiBack": "971,600,37,26",
+    "roiFront": "967,597,42,25",
+    "roiBack": "962,592,53,34",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -151,5 +151,14 @@
     "method": "Template matching",
     "threshold": 0.9,
     "description": "需要切换的预设按钮(颜色深一点)"
+  },
+  {
+    "itemName": "check_block",
+    "imageName": "ss_check_block.png",
+    "roiFront": "572,408,137,49",
+    "roiBack": "572,408,137,49",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "误触点到式神检查"
   }
 ]

BIN
tasks/Component/SwitchSoul/ss/ss_check_block.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_switch_1.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_switch_2.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_switch_3.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_switch_4.png


BIN
tasks/Component/SwitchSoul/ss/ss_soul_preset.png


+ 4 - 2
tasks/Component/SwitchSoul/switch_soul.py

@@ -100,7 +100,7 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
                 break
             cur_text = ocr_text
             # 向上滑动
-            self.swipe(self.S_SS_GROUP_SWIPE_UP, 0.5)
+            self.swipe(self.S_SS_GROUP_SWIPE_UP, 1.5)
             # 等待滑动动画
             sleep(0.5)
 
@@ -129,10 +129,12 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
                 while 1:
                     self.click(self.I_SOU_SWITCH_SURE, 3)
                     self.screenshot()
+                    if self.appear_then_click(self.I_CHECK_BLOCK, 3):
+                        continue
                     if not self.appear(self.I_SOU_SWITCH_SURE):
                         break
                 continue
-            if not self.appear_then_click(target_team, interval=1):
+            if not self.appear_then_click(target_team, interval=3):
                 logger.warning(f'Click team {team} failed in group {group}')
 
         logger.info(f'Switch soul_one group {group} team {team}')

BIN
tasks/DemonRetreat/DemonRetreat/DemonRetreat_demon_back_check.png


BIN
tasks/DemonRetreat/DemonRetreat/DemonRetreat_demon_gather.png


BIN
tasks/DemonRetreat/DemonRetreat/DemonRetreat_enter_fire.png


BIN
tasks/DemonRetreat/DemonRetreat/DemonRetreat_hunt.png


BIN
tasks/DemonRetreat/DemonRetreat/DemonRetreat_hunt_check.png


BIN
tasks/DemonRetreat/DemonRetreat/DemonRetreat_new.png


BIN
tasks/DemonRetreat/DemonRetreat/DemonRetreat_pray.png


BIN
tasks/DemonRetreat/DemonRetreat/DemonRetreat_rank_lsit.png


BIN
tasks/DemonRetreat/DemonRetreat/DemonRetreat_reward_all.png


BIN
tasks/DemonRetreat/DemonRetreat/DemonRetreat_shrine.png


+ 92 - 0
tasks/DemonRetreat/DemonRetreat/image.json

@@ -0,0 +1,92 @@
+[
+  {
+    "itemName": "shrine",
+    "imageName": "DemonRetreat_shrine.png",
+    "roiFront": "870,624,65,61",
+    "roiBack": "870,624,65,61",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "神社"
+  },
+  {
+    "itemName": "hunt",
+    "imageName": "DemonRetreat_hunt.png",
+    "roiFront": "661,164,187,165",
+    "roiBack": "661,164,187,165",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "首领退治"
+  },
+  {
+    "itemName": "hunt_check",
+    "imageName": "DemonRetreat_hunt_check.png",
+    "roiFront": "570,12,143,46",
+    "roiBack": "570,12,143,46",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "检查是否成功进入首领退治"
+  },
+  {
+    "itemName": "demon_gather",
+    "imageName": "DemonRetreat_demon_gather.png",
+    "roiFront": "26,487,76,48",
+    "roiBack": "26,487,76,48",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "demon_back_check",
+    "imageName": "DemonRetreat_demon_back_check.png",
+    "roiFront": "27,26,42,36",
+    "roiBack": "14,2,86,86",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "非退治时间进行检查"
+  },
+  {
+    "itemName": "enter_fire",
+    "imageName": "DemonRetreat_enter_fire.png",
+    "roiFront": "1141,581,100,67",
+    "roiBack": "1141,581,100,67",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "迟到直接进入战斗"
+  },
+  {
+    "itemName": "quit_back",
+    "imageName": "DemonRetreat_new.png",
+    "roiFront": "488,401,100,44",
+    "roiBack": "488,401,100,44",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "取消退出"
+  },
+  {
+    "itemName": "rank_lsit",
+    "imageName": "DemonRetreat_rank_lsit.png",
+    "roiFront": "542,5,200,54",
+    "roiBack": "542,5,200,54",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "退治排行榜"
+  },
+  {
+    "itemName": "reward_all",
+    "imageName": "DemonRetreat_reward_all.png",
+    "roiFront": "535,540,177,60",
+    "roiBack": "535,540,177,60",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "全部领取"
+  },
+  {
+    "itemName": "pray",
+    "imageName": "DemonRetreat_pray.png",
+    "roiFront": "1176,385,43,70",
+    "roiBack": "1176,385,43,70",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "祈愿"
+  }
+]

+ 11 - 0
tasks/DemonRetreat/DemonRetreat/ocr.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "later_enter_check",
+    "roiFront": "928,16,48,35",
+    "roiBack": "928,16,48,35",
+    "mode": "Single",
+    "method": "Default",
+    "keyword": "",
+    "description": "检查是否迟到"
+  }
+]

+ 40 - 0
tasks/DemonRetreat/assets.py

@@ -0,0 +1,40 @@
+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 DemonRetreatAssets: 
+
+
+	# Image Rule Assets
+	# 神社 
+	I_SHRINE = RuleImage(roi_front=(870,624,65,61), roi_back=(870,624,65,61), threshold=0.8, method="Template matching", file="./tasks/DemonRetreat/DemonRetreat/DemonRetreat_shrine.png")
+	# 首领退治 
+	I_HUNT = RuleImage(roi_front=(661,164,187,165), roi_back=(661,164,187,165), threshold=0.8, method="Template matching", file="./tasks/DemonRetreat/DemonRetreat/DemonRetreat_hunt.png")
+	# 检查是否成功进入首领退治 
+	I_HUNT_CHECK = RuleImage(roi_front=(570,12,143,46), roi_back=(570,12,143,46), threshold=0.8, method="Template matching", file="./tasks/DemonRetreat/DemonRetreat/DemonRetreat_hunt_check.png")
+	# description 
+	I_DEMON_GATHER = RuleImage(roi_front=(26,487,76,48), roi_back=(26,487,76,48), threshold=0.8, method="Template matching", file="./tasks/DemonRetreat/DemonRetreat/DemonRetreat_demon_gather.png")
+	# 非退治时间进行检查 
+	I_DEMON_BACK_CHECK = RuleImage(roi_front=(27,26,42,36), roi_back=(14,2,86,86), threshold=0.7, method="Template matching", file="./tasks/DemonRetreat/DemonRetreat/DemonRetreat_demon_back_check.png")
+	# 迟到直接进入战斗 
+	I_ENTER_FIRE = RuleImage(roi_front=(1141,581,100,67), roi_back=(1141,581,100,67), threshold=0.8, method="Template matching", file="./tasks/DemonRetreat/DemonRetreat/DemonRetreat_enter_fire.png")
+	# 取消退出 
+	I_QUIT_BACK = RuleImage(roi_front=(488,401,100,44), roi_back=(488,401,100,44), threshold=0.8, method="Template matching", file="./tasks/DemonRetreat/DemonRetreat/DemonRetreat_new.png")
+	# 退治排行榜 
+	I_RANK_LSIT = RuleImage(roi_front=(542,5,200,54), roi_back=(542,5,200,54), threshold=0.8, method="Template matching", file="./tasks/DemonRetreat/DemonRetreat/DemonRetreat_rank_lsit.png")
+	# 全部领取 
+	I_REWARD_ALL = RuleImage(roi_front=(535,540,177,60), roi_back=(535,540,177,60), threshold=0.8, method="Template matching", file="./tasks/DemonRetreat/DemonRetreat/DemonRetreat_reward_all.png")
+	# 祈愿 
+	I_PRAY = RuleImage(roi_front=(1176,385,43,70), roi_back=(1176,385,43,70), threshold=0.8, method="Template matching", file="./tasks/DemonRetreat/DemonRetreat/DemonRetreat_pray.png")
+
+
+	# Ocr Rule Assets
+	# 检查是否迟到 
+	O_LATER_ENTER_CHECK = RuleOcr(roi=(928,16,48,35), area=(928,16,48,35), mode="Single", method="Default", keyword="", name="later_enter_check")
+
+

+ 22 - 0
tasks/DemonRetreat/config.py

@@ -0,0 +1,22 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from datetime import timedelta
+from pydantic import BaseModel, Field
+
+from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
+from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
+from tasks.Component.config_scheduler import Scheduler
+from tasks.Component.config_base import ConfigBase, Time
+
+
+class DemonRetreatTime(ConfigBase):
+    # 自定义运行时间
+    custom_run_time: Time = Field(default=Time(hour=10, minute=0, second=0))
+
+
+class DemonRetreat(ConfigBase):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+    demon_retreat_time: DemonRetreatTime = Field(default_factory=DemonRetreatTime)
+    general_battle: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
+    switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)

+ 281 - 0
tasks/DemonRetreat/script_task.py

@@ -0,0 +1,281 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from time import sleep
+from datetime import timedelta, datetime, time
+from cached_property import cached_property
+
+from module.exception import TaskEnd
+from module.logger import logger
+from module.base.timer import Timer
+
+from tasks.GameUi.game_ui import GameUi
+from tasks.GameUi.page import page_main, page_hunt, page_shikigami_records, page_guild
+from tasks.Component.GeneralBattle.general_battle import GeneralBattle
+from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
+from tasks.Component.GeneralInvite.general_invite import GeneralInvite
+from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
+from tasks.DemonRetreat.assets import DemonRetreatAssets
+from tasks.AbyssShadows.assets import AbyssShadowsAssets
+from tasks.DemonRetreat.config import DemonRetreat
+
+class ScriptTask(GameUi, GeneralBattle, SwitchSoul, DemonRetreatAssets, AbyssShadowsAssets):
+
+    def run(self):
+        """
+        首领退治主函数
+        """
+
+        cfg: DemonRetreat = self.config.demon_retreat
+
+        # 判断是否为周六,只有周六才可以进行退治
+        current_date = datetime.now()
+        current_day_of_week = current_date.weekday()  # Monday is 0 and Sunday is 6
+
+        if current_day_of_week == 5:
+            # 是周六,继续运行写好的任务代码
+            pass
+        else:
+            # 不是周六
+            if current_day_of_week < 5:
+                # 周一至周五
+                days_until_saturday = 5 - current_day_of_week
+            else:
+                # 周日
+                days_until_saturday = 5 - current_day_of_week + 7
+
+                # 设置下次运行时间
+            self.custom_next_run(task='DemonRetreat', custom_time=cfg.demon_retreat_time.custom_run_time, time_delta=days_until_saturday)
+            raise TaskEnd
+
+        if cfg.switch_soul_config.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(cfg.switch_soul_config.switch_group_team)
+        if cfg.switch_soul_config.enable_switch_by_name:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul_by_name(cfg.switch_soul_config.group_name, cfg.switch_soul_config.team_name)
+
+        # 进入妖怪退治
+        if not self.goto_demon_retreat():
+            logger.warning("Failed to enter demon retreat")
+            if self.appear_then_click(self.I_DEMON_BACK_CHECK, interval=1):
+                pass
+            self.goto_main()
+            self.set_next_run(task='DemonRetreat', finish=False, server=True, success=False)
+            raise TaskEnd
+
+        # 首领退治战斗
+        success = self.demon_retreat()
+
+        # 战斗结束 回到寮信息界面 准备领取奖励
+        # 先返回
+        while 1:
+            self.screenshot()
+            if self.appear_then_click(self.I_PRAY, interval=1):
+                logger.warning("Claim rewards")
+            if self.appear_then_click(self.I_HUNT, interval=1):
+                continue
+            if self.appear_then_click(self.I_REWARD_ALL, interval=1.5):
+                self.ui_reward_appear_click(True)
+                logger.info('Claim rewards finished')
+                break
+            if self.appear(self.I_RANK_LSIT):
+                logger.info("No rewards to claim")
+                if self.appear_then_click(self.I_DEMON_BACK_CHECK, interval=1):
+                    break
+
+        # 保持好习惯,一个任务结束了就返回到庭院,方便下一任务的开始
+        self.goto_main()
+
+        # 设置下次运行时间
+        if success:
+            logger.info(f"The next time the demon retreat is next Saturday")
+            self.custom_next_run(task='DemonRetreat', custom_time=cfg.demon_retreat_time.custom_run_time, time_delta=7)
+        else:
+            self.set_next_run(task="DemonRetreat", finish=True, server=True, success=False)
+
+        raise TaskEnd
+
+
+
+    def goto_demon_retreat(self) -> bool:
+        """
+        进入首领退治
+        """
+        cfg: DemonRetreat = self.config.demon_retreat
+        self.ui_get_current_page()
+        logger.info("Entering demon_retreat")
+        self.ui_goto(page_guild)
+
+        goto_demon_retreat_num = 0
+        while 1:
+            self.screenshot()
+            # 进入神社
+            if self.appear_then_click(self.I_SHRINE, interval=1):
+                logger.info("Enter I_SHRINE")
+                continue
+            # 进入首领退治
+            if self.appear_then_click(self.I_HUNT, interval=1.5):
+                goto_demon_retreat_num += 1
+
+            # 确保不离开退治
+            if self.appear_then_click(self.I_QUIT_BACK, interval=1):
+                pass
+            if self.appear(self.I_HUNT_CHECK):
+                if self.appear_then_click(self.I_QUIT_BACK, interval=1):
+                    pass
+                logger.info("Enter demon_retreat success")
+                return True
+
+            # 周六打完了,但是迟到了只能领取奖励
+            if self.appear_then_click(self.I_REWARD_ALL, interval=1):
+                logger.info("Already challenged demon_retreat")
+                sleep(1)
+                if self.appear_then_click(self.I_DEMON_BACK_CHECK, interval=1):
+                    pass
+                logger.info(f"The next time the demon retreat is next Saturday")
+                self.custom_next_run(task='DemonRetreat', custom_time=cfg.demon_retreat_time.custom_run_time,
+                                     time_delta=7)
+                raise TaskEnd
+
+            if self.appear(self.I_RANK_LSIT):
+                logger.info("Enter demon_retreat false")
+                sleep(3)
+                if self.appear_then_click(self.I_DEMON_BACK_CHECK, interval=1):
+                    pass
+                sleep(20)
+            # 超过五次没有进入进入认为失败
+            if goto_demon_retreat_num >= 5:
+                break
+        return False
+
+    def demon_retreat(self):
+        cfg: DemonRetreat = self.config.demon_retreat
+        logger.hr('demon retreat', 2)
+
+        # 来晚了直接进入战斗
+        if not set(self.O_LATER_ENTER_CHECK.ocr(image=self.device.image)).intersection(set("集结")):
+            logger.info("arrive later")
+            self.ui_click_until_disappear(self.I_ENTER_FIRE, interval=1)
+            self.device.stuck_record_add('BATTLE_STATUS_S')
+            success = self.run_demon_battle(cfg.general_battle)
+        else:
+            # 等待进入战斗
+            sleep(5)
+            self.device.stuck_record_add('BATTLE_STATUS_S')
+            self.wait_until_disappear(self.I_DEMON_GATHER)
+            self.device.stuck_record_clear()
+            self.device.stuck_record_add('BATTLE_STATUS_S')
+            success = self.run_demon_battle(cfg.general_battle)
+
+        return success
+
+
+
+
+    def run_demon_battle(self, config: GeneralBattleConfig = None) -> bool:
+        """
+        重写通用战斗
+        三轮战斗 战斗过程中检测挑战
+        """
+        # TODO 战斗过程中切换预设
+        logger.hr("General battle start", 2)
+        self.current_count += 1
+        logger.info(f"Current count: {self.current_count}")
+        if config is None:
+            config = GeneralBattleConfig()
+
+        # 如果没有锁定队伍。那么可以根据配置设定队伍
+        if not config.lock_team_enable:
+            logger.info("Lock team is not enable")
+            # 如果更换队伍
+            if self.current_count == 1:
+                self.switch_preset_team(config.preset_enable, config.preset_group, config.preset_team)
+
+            # 点击准备按钮
+            self.wait_until_appear(self.I_PREPARE_HIGHLIGHT)
+            self.wait_until_appear(self.I_BUFF)
+            while 1:
+                self.screenshot()
+                if not self.appear(self.I_BUFF):
+                    break
+                if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.5):
+                    continue
+
+            logger.info("Click prepare ensure button")
+
+            # 照顾一下某些模拟器慢的
+            sleep(0.1)
+
+        # 绿标
+        self.wait_until_disappear(self.I_BUFF)
+        if self.is_in_battle(False):
+            self.green_mark(config.green_enable, config.green_mark)
+
+        win = self.battle_wait(config.random_click_swipt_enable)
+        if win:
+            return True
+        else:
+            return False
+
+
+
+
+    def battle_wait(self, random_click_swipt_enable: bool) -> bool:
+        """
+        重写 三轮战斗 战斗过程中点击准备 返回到寮信息界面
+        :param random_click_swipt_enable:
+        :return:
+        """
+        self.device.stuck_record_add('BATTLE_STATUS_S')
+        self.device.click_record_clear()
+        # 战斗过程 随机点击和滑动 防封 并点击 准备
+        logger.info("Start battle process")
+        stuck_timer = Timer(180)
+        stuck_timer.start()
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_WIN):
+                logger.info('Battle win')
+                self.ui_click_until_disappear(self.I_WIN)
+                return True
+            # 战斗过程中出现准备
+            if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.5):
+                self.device.stuck_record_clear()
+                self.device.stuck_record_add('BATTLE_STATUS_S')
+            # 如果出现失败 就点击,返回False
+            if self.appear(self.I_FALSE, threshold=0.8):
+                logger.info("Battle result is false")
+                self.ui_click_until_disappear(self.I_FALSE)
+                return False
+            # 如果三分钟还没打完,再延长五分钟
+            if stuck_timer and stuck_timer.reached():
+                stuck_timer = None
+                self.device.stuck_record_clear()
+                self.device.stuck_record_add('BATTLE_STATUS_S')
+
+
+    def goto_main(self):
+        ''' 保持好习惯,一个任务结束了就返回庭院,方便下一任务的开始或者是出错重启
+        '''
+        self.ui_get_current_page()
+        logger.info("Exiting DemonRetreat")
+        self.ui_goto(page_main)
+
+
+
+
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+    c = Config('日常1')
+    d = Device(c)
+    t = ScriptTask(c, d)
+    t.screenshot()
+
+    t.run()
+

+ 11 - 11
tasks/Hyakkiyakou/assets.py

@@ -18,22 +18,22 @@ class HyakkiyakouAssets:
 	# description 
 	C_HSELECT_3 = RuleClick(roi_front=(934,298,115,306), roi_back=(934,298,115,306), name="hselect_3")
 	# description 
-	C_FRIEND_1 = RuleClick(roi_front=(466,227,161,67), roi_back=(466,227,161,67), name="friend_1")
+	C_FRIEND_1 = RuleClick(roi_front=(254,223,161,67), roi_back=(254,223,161,67), name="friend_1")
 	# description 
-	C_FRIEND_2 = RuleClick(roi_front=(738,229,158,64), roi_back=(738,229,158,64), name="friend_2")
+	C_FRIEND_2 = RuleClick(roi_front=(532,226,158,64), roi_back=(532,226,158,64), name="friend_2")
 	# description 
-	C_FRIEND_3 = RuleClick(roi_front=(445,310,183,66), roi_back=(445,310,183,66), name="friend_3")
+	C_FRIEND_3 = RuleClick(roi_front=(240,310,183,66), roi_back=(240,310,183,66), name="friend_3")
 	# description 
-	C_FRIEND_4 = RuleClick(roi_front=(712,311,184,62), roi_back=(712,311,184,62), name="friend_4")
+	C_FRIEND_4 = RuleClick(roi_front=(504,311,184,62), roi_back=(504,311,184,62), name="friend_4")
 	# description 
-	C_FRIEND_5 = RuleClick(roi_front=(449,394,178,61), roi_back=(449,394,178,61), name="friend_5")
+	C_FRIEND_5 = RuleClick(roi_front=(241,395,178,61), roi_back=(241,395,178,61), name="friend_5")
 	# description 
-	C_FRIEND_6 = RuleClick(roi_front=(714,397,182,62), roi_back=(714,397,182,62), name="friend_6")
+	C_FRIEND_6 = RuleClick(roi_front=(508,394,182,62), roi_back=(508,394,182,62), name="friend_6")
 
 
 	# Image Rule Assets
 	# 邀请按钮 
-	I_HINVITE = RuleImage(roi_front=(139,569,63,60), roi_back=(139,569,63,60), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_hinvite.png")
+	I_HINVITE = RuleImage(roi_front=(139,593,63,39), roi_back=(105,535,129,147), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_hinvite.png")
 	# 进入 
 	I_HACCESS = RuleImage(roi_front=(1059,554,100,100), roi_back=(1059,554,100,100), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_haccess.png")
 	# 开始 
@@ -135,13 +135,13 @@ class HyakkiyakouAssets:
 
 	# Image Rule Assets
 	# description 
-	I_FRIEND_SAME_1 = RuleImage(roi_front=(375,122,106,62), roi_back=(375,122,106,62), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_same_1.png")
+	I_FRIEND_SAME_1 = RuleImage(roi_front=(167,123,106,62), roi_back=(154,105,132,94), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_same_1.png")
 	# description 
-	I_FRIEND_REMOTE_1 = RuleImage(roi_front=(498,125,106,56), roi_back=(498,125,106,56), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_remote_1.png")
+	I_FRIEND_REMOTE_1 = RuleImage(roi_front=(288,123,106,56), roi_back=(269,106,159,91), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_remote_1.png")
 	# description 
-	I_FRIEND_SAME_2 = RuleImage(roi_front=(377,126,100,60), roi_back=(377,126,100,60), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_same_2.png")
+	I_FRIEND_SAME_2 = RuleImage(roi_front=(168,126,100,60), roi_back=(152,112,133,80), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_same_2.png")
 	# description 
-	I_FRIEND_REMOTE_2 = RuleImage(roi_front=(504,127,100,56), roi_back=(504,127,100,56), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_remote_2.png")
+	I_FRIEND_REMOTE_2 = RuleImage(roi_front=(296,122,100,56), roi_back=(278,115,131,81), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_remote_2.png")
 
 
 	# Ocr Rule Assets

+ 12 - 12
tasks/Hyakkiyakou/hya/click.json

@@ -19,38 +19,38 @@
   },
   {
     "itemName": "friend_1",
-    "roiFront": "466,227,161,67",
-    "roiBack": "466,227,161,67",
+    "roiFront": "254,223,161,67",
+    "roiBack": "254,223,161,67",
     "description": "description"
   },
   {
     "itemName": "friend_2",
-    "roiFront": "738,229,158,64",
-    "roiBack": "738,229,158,64",
+    "roiFront": "532,226,158,64",
+    "roiBack": "532,226,158,64",
     "description": "description"
   },
   {
     "itemName": "friend_3",
-    "roiFront": "445,310,183,66",
-    "roiBack": "445,310,183,66",
+    "roiFront": "240,310,183,66",
+    "roiBack": "240,310,183,66",
     "description": "description"
   },
   {
     "itemName": "friend_4",
-    "roiFront": "712,311,184,62",
-    "roiBack": "712,311,184,62",
+    "roiFront": "504,311,184,62",
+    "roiBack": "504,311,184,62",
     "description": "description"
   },
   {
     "itemName": "friend_5",
-    "roiFront": "449,394,178,61",
-    "roiBack": "449,394,178,61",
+    "roiFront": "241,395,178,61",
+    "roiBack": "241,395,178,61",
     "description": "description"
   },
   {
     "itemName": "friend_6",
-    "roiFront": "714,397,182,62",
-    "roiBack": "714,397,182,62",
+    "roiFront": "508,394,182,62",
+    "roiBack": "508,394,182,62",
     "description": "description"
   }
 ]

BIN
tasks/Hyakkiyakou/hya/hya_hinvite.png


+ 2 - 2
tasks/Hyakkiyakou/hya/image1.json

@@ -2,8 +2,8 @@
   {
     "itemName": "hinvite",
     "imageName": "hya_hinvite.png",
-    "roiFront": "139,569,63,60",
-    "roiBack": "139,569,63,60",
+    "roiFront": "139,593,63,39",
+    "roiBack": "105,535,129,147",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "邀请按钮"

+ 8 - 8
tasks/Hyakkiyakou/hya/image5.json

@@ -2,8 +2,8 @@
   {
     "itemName": "friend_same_1",
     "imageName": "hya_friend_same_1.png",
-    "roiFront": "375,122,106,62",
-    "roiBack": "375,122,106,62",
+    "roiFront": "167,123,106,62",
+    "roiBack": "154,105,132,94",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -11,8 +11,8 @@
   {
     "itemName": "friend_remote_1",
     "imageName": "hya_friend_remote_1.png",
-    "roiFront": "498,125,106,56",
-    "roiBack": "498,125,106,56",
+    "roiFront": "288,123,106,56",
+    "roiBack": "269,106,159,91",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -20,8 +20,8 @@
   {
     "itemName": "friend_same_2",
     "imageName": "hya_friend_same_2.png",
-    "roiFront": "377,126,100,60",
-    "roiBack": "377,126,100,60",
+    "roiFront": "168,126,100,60",
+    "roiBack": "152,112,133,80",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -29,8 +29,8 @@
   {
     "itemName": "friend_remote_2",
     "imageName": "hya_friend_remote_2.png",
-    "roiFront": "504,127,100,56",
-    "roiBack": "504,127,100,56",
+    "roiFront": "296,122,100,56",
+    "roiBack": "278,115,131,81",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"

+ 3 - 0
tasks/Script/config_device.py

@@ -70,6 +70,9 @@ class Device(BaseModel):
     emulatorinfo_path: str = Field(default='',
                                    description='emulatorinfo_path_help')
     # 举例, E:\ProgramFiles\MuMuPlayer-12.0\shell\MuMuPlayer.exe
+    # 模拟器启动后最小化
+    emulator_window_minimize: bool = Field(default=False,
+                                             description='emulator_window_minimize_help')
 
 
 

+ 2 - 1
tasks/SixRealms/config.py

@@ -17,7 +17,8 @@ class SixRealmsGate(BaseModel):
 
 class SixRealms(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
-    switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
+    switch_soul_config_1: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
+    switch_soul_config_2: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
     six_realms_gate: SixRealmsGate = Field(default_factory=SixRealmsGate)
 
 

+ 16 - 5
tasks/SixRealms/script_task.py

@@ -31,16 +31,27 @@ class ScriptTask(GameUi, SwitchSoul, MoonSea):
         return self.config.model.six_realms
 
     def run(self):
-        if self._config.switch_soul_config.enable:
+        if self._config.switch_soul_config_1.enable:
             self.ui_get_current_page()
             self.ui_goto(page_shikigami_records)
-            self.run_switch_soul(self._config.switch_soul_config.switch_group_team)
-        if self._config.switch_soul_config.enable_switch_by_name:
+            self.run_switch_soul(self._config.switch_soul_config_1.switch_group_team)
+        if self._config.switch_soul_config_1.enable_switch_by_name:
             self.ui_get_current_page()
             self.ui_goto(page_shikigami_records)
             self.run_switch_soul_by_name(
-                self._config.switch_soul_config.group_name,
-                self._config.switch_soul_config.team_name
+                self._config.switch_soul_config_1.group_name,
+                self._config.switch_soul_config_1.team_name
+            )
+        if self._config.switch_soul_config_2.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(self._config.switch_soul_config_2.switch_group_team)
+        if self._config.switch_soul_config_2.enable_switch_by_name:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul_by_name(
+                self._config.switch_soul_config_2.group_name,
+                self._config.switch_soul_config_2.team_name
             )
         self.ui_get_current_page()
         self.ui_goto(page_six_gates)

BIN
tasks/SoulsTidy/simple/simple_st_replace.png


BIN
tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_jade.png


BIN
tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_wechat.png


+ 5 - 5
tasks/WeeklyTrifles/area_boss/image.json

@@ -21,7 +21,7 @@
     "itemName": "wt_share_ab",
     "imageName": "area_boss_wt_share_ab.png",
     "roiFront": "1183,308,45,39",
-    "roiBack": "1136,292,105,79",
+    "roiBack": "1183,308,45,39",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "地鬼分享"
@@ -29,8 +29,8 @@
   {
     "itemName": "wt_ab_jade",
     "imageName": "area_boss_wt_ab_jade.png",
-    "roiFront": "922,554,44,47",
-    "roiBack": "922,554,44,47",
+    "roiFront": "977,552,44,47",
+    "roiBack": "977,552,44,47",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "分享勾玉"
@@ -38,8 +38,8 @@
   {
     "itemName": "wt_ab_wechat",
     "imageName": "area_boss_wt_ab_wechat.png",
-    "roiFront": "1032,643,50,56",
-    "roiBack": "1032,643,50,56",
+    "roiFront": "845,643,50,41",
+    "roiBack": "845,643,50,41",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "微信分享"

+ 6 - 6
tasks/WeeklyTrifles/assets.py

@@ -21,11 +21,11 @@ class WeeklyTriflesAssets:
 	# 今天一个都没有打 
 	I_WT_NO_DAY = RuleImage(roi_front=(167,360,72,69), roi_back=(167,360,72,69), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_no_day.png")
 	# 地鬼分享 
-	I_WT_SHARE_AB = RuleImage(roi_front=(1183,308,45,39), roi_back=(1136,292,105,79), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_share_ab.png")
+	I_WT_SHARE_AB = RuleImage(roi_front=(1183,308,45,39), roi_back=(1183,308,45,39), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_share_ab.png")
 	# 分享勾玉 
-	I_WT_AB_JADE = RuleImage(roi_front=(922,554,44,47), roi_back=(922,554,44,47), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_jade.png")
+	I_WT_AB_JADE = RuleImage(roi_front=(977,552,44,47), roi_back=(977,552,44,47), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_jade.png")
 	# 微信分享 
-	I_WT_AB_WECHAT = RuleImage(roi_front=(1032,643,50,56), roi_back=(1032,643,50,56), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_wechat.png")
+	I_WT_AB_WECHAT = RuleImage(roi_front=(845,643,50,41), roi_back=(845,643,50,41), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_wechat.png")
 
 
 	# Image Rule Assets
@@ -70,11 +70,11 @@ class WeeklyTriflesAssets:
 	# 秘闻进入 
 	I_WT_ENTER_SE = RuleImage(roi_front=(1145,598,100,100), roi_back=(1145,598,100,100), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_enter_se.png")
 	# 秘闻分享 
-	I_WT_SE_SHARE = RuleImage(roi_front=(911,570,46,43), roi_back=(897,559,85,64), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_share.png")
+	I_WT_SE_SHARE = RuleImage(roi_front=(911,570,46,43), roi_back=(911,570,46,43), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_share.png")
 	# 微信 
-	I_WT_SE_WECHAT = RuleImage(roi_front=(1023,630,56,57), roi_back=(1023,630,56,57), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_wechat.png")
+	I_WT_SE_WECHAT = RuleImage(roi_front=(786,627,45,37), roi_back=(786,627,45,37), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_wechat.png")
 	# 勾玉 
-	I_WT_SE_JADE = RuleImage(roi_front=(1123,532,35,39), roi_back=(1105,520,79,73), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_jade.png")
+	I_WT_SE_JADE = RuleImage(roi_front=(1123,532,35,39), roi_back=(1123,532,35,39), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_jade.png")
 	# 排行 
 	I_WT_SE_RANK = RuleImage(roi_front=(1017,572,45,44), roi_back=(989,556,103,81), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_rank.png")
 

+ 4 - 4
tasks/WeeklyTrifles/secret/image.json

@@ -12,7 +12,7 @@
     "itemName": "wt_se_share",
     "imageName": "secret_wt_se_share.png",
     "roiFront": "911,570,46,43",
-    "roiBack": "897,559,85,64",
+    "roiBack": "911,570,46,43",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "秘闻分享"
@@ -20,8 +20,8 @@
   {
     "itemName": "wt_se_wechat",
     "imageName": "secret_wt_se_wechat.png",
-    "roiFront": "1023,630,56,57",
-    "roiBack": "1023,630,56,57",
+    "roiFront": "786,627,45,37",
+    "roiBack": "786,627,45,37",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "微信"
@@ -30,7 +30,7 @@
     "itemName": "wt_se_jade",
     "imageName": "secret_wt_se_jade.png",
     "roiFront": "1123,532,35,39",
-    "roiBack": "1105,520,79,73",
+    "roiBack": "1123,532,35,39",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "勾玉"

BIN
tasks/WeeklyTrifles/secret/secret_wt_se_jade.png


BIN
tasks/WeeklyTrifles/secret/secret_wt_se_wechat.png