فهرست منبع

Merge pull request #475 from runhey/dev

Dev
huangrunheng 2 سال پیش
والد
کامیت
4a78456a87
61فایلهای تغییر یافته به همراه544 افزوده شده و 159 حذف شده
  1. 3 0
      module/atom/image.py
  2. 18 0
      module/base/protect.py
  3. 39 0
      module/base/utils.py
  4. 2 2
      module/config/config_manual.py
  5. 6 0
      tasks/ActivityShikigami/script_task.py
  6. 3 3
      tasks/AreaBoss/assets.py
  7. 6 6
      tasks/AreaBoss/res/image.json
  8. BIN
      tasks/AreaBoss/res/res_battle_1.png
  9. BIN
      tasks/AreaBoss/res/res_battle_2.png
  10. BIN
      tasks/AreaBoss/res/res_battle_3.png
  11. 4 0
      tasks/Component/BaseActivity/config_activity.py
  12. 2 0
      tasks/Component/Costume/config.py
  13. 13 0
      tasks/Component/Costume/costume_base.py
  14. 24 0
      tasks/Component/CostumeBattle/assets.py
  15. 0 0
      tasks/Component/CostumeBattle/battle4/battle4_friends_4.png
  16. 0 0
      tasks/Component/CostumeBattle/battle6/battle6_friends_6.png
  17. BIN
      tasks/Component/CostumeBattle/battle7/battle7_exit_7.png
  18. BIN
      tasks/Component/CostumeBattle/battle7/battle7_friends_7.png
  19. BIN
      tasks/Component/CostumeBattle/battle7/battle7_local_7.png
  20. 29 0
      tasks/Component/CostumeBattle/battle7/image.json
  21. BIN
      tasks/Component/CostumeBattle/battle8/battle8_de_win_8.png
  22. BIN
      tasks/Component/CostumeBattle/battle8/battle8_exit_8.png
  23. BIN
      tasks/Component/CostumeBattle/battle8/battle8_false_8.png
  24. BIN
      tasks/Component/CostumeBattle/battle8/battle8_friends_8.png
  25. BIN
      tasks/Component/CostumeBattle/battle8/battle8_local_8.png
  26. BIN
      tasks/Component/CostumeBattle/battle8/battle8_win_8.png
  27. 56 0
      tasks/Component/CostumeBattle/battle8/image.json
  28. BIN
      tasks/Component/GeneralBattle/gb/res_win.png
  29. 1 0
      tasks/Component/RightActivity/right_activity.py
  30. 8 0
      tasks/DailyTrifles/assets.py
  31. 1 0
      tasks/DailyTrifles/config.py
  32. BIN
      tasks/DailyTrifles/love/Screenshots_click_bless.png
  33. BIN
      tasks/DailyTrifles/love/Screenshots_luck_msg.png
  34. BIN
      tasks/DailyTrifles/love/Screenshots_luck_title.png
  35. BIN
      tasks/DailyTrifles/love/Screenshots_one_click_bless.png
  36. 36 0
      tasks/DailyTrifles/love/image.json
  37. 32 2
      tasks/DailyTrifles/script_task.py
  38. 12 9
      tasks/DemonEncounter/config.py
  39. 1 1
      tasks/DemonEncounter/data/answer.py
  40. 15 8
      tasks/DemonEncounter/script_task.py
  41. 1 2
      tasks/Exploration/base.py
  42. 18 18
      tasks/FrogBoss/assets.py
  43. BIN
      tasks/FrogBoss/fb/fb_gold_30_check.png
  44. 24 24
      tasks/FrogBoss/fb/image.json
  45. 3 3
      tasks/FrogBoss/fb/image2.json
  46. 6 6
      tasks/FrogBoss/fb/ocr.json
  47. 6 2
      tasks/FrogBoss/script_task.py
  48. 2 1
      tasks/HeroTest/config.py
  49. 15 4
      tasks/HeroTest/script_task.py
  50. 14 5
      tasks/KekkaiUtilize/script_task.py
  51. 8 0
      tasks/Restart/assets.py
  52. BIN
      tasks/Restart/harvest/harvest_harvest_guild_reward.png
  53. BIN
      tasks/Restart/harvest/harvest_harvest_soul_1.png
  54. BIN
      tasks/Restart/harvest/harvest_harvest_soul_2.png
  55. BIN
      tasks/Restart/harvest/harvest_harvest_soul_3.png
  56. 36 0
      tasks/Restart/harvest/image.json
  57. 15 4
      tasks/Restart/login.py
  58. 1 1
      tasks/RichMan/assets.py
  59. 2 2
      tasks/RichMan/guild/ocr.json
  60. 1 0
      tasks/WantedQuests/config.py
  61. 81 56
      tasks/WantedQuests/script_task.py

+ 3 - 0
module/atom/image.py

@@ -9,6 +9,7 @@ from pathlib import Path
 
 from module.base.decorator import cached_property
 from module.logger import logger
+from module.base.utils import is_approx_rectangle
 
 class RuleImage:
 
@@ -261,6 +262,8 @@ class RuleImage:
                 self.roi_front[1] = dst[0, 0, 1] + self.roi_back[1]
                 if show:
                     cv2.polylines(source, [dst], isClosed=True, color=(0, 0, 255), thickness=2)
+                if not is_approx_rectangle(np.array([pos[0] for pos in dst])):
+                    result = False
         else:
             result = False
 

+ 18 - 0
module/base/protect.py

@@ -0,0 +1,18 @@
+import random
+from time import sleep
+
+from module.logger import logger
+
+
+def random_delay(min_value: float = 2.0, max_value: float = 6.0, decimal: int = 1):
+    """
+    防封
+    """
+    random_float_in_range = random.uniform(min_value, max_value)
+    sleep(round(random_float_in_range, decimal))
+
+
+def random_sleep(probability: float = 0.05):
+    if random.random() <= probability:
+        logger.info('Tigger random sleep')
+        random_delay()

+ 39 - 0
module/base/utils.py

@@ -900,3 +900,42 @@ def load_module(moduleName :str, moduleFile :str):
     spec.loader.exec_module(module)
     sys.modules[moduleName] = module
     return module
+
+
+def angle(p1, p2, p3):
+    """计算三点形成的角度(单位:度)"""
+    v1 = p2 - p1
+    v2 = p3 - p2
+    cos_angle = np.dot(v1, v2) / (np.linalg.norm(v1) * np.linalg.norm(v2))
+    return np.degrees(np.arccos(np.clip(cos_angle, -1.0, 1.0)))  # 限制范围以防止浮点错误
+
+
+def is_approx_rectangle(points, tolerance=30):
+    """判断四个点是否近似于矩形
+    :param points: 坐上开始,逆时针
+    :param tolerance: 角度 不是弧度
+    """
+    if points.shape[0] != 4:
+        return False
+    # # 计算边长
+    # distances = [distance(points[i], points[j]) for i in range(4) for j in range(i + 1, 4)]
+    # distances.sort()
+    # # 最小边和最大边
+    # short_sides = distances[:4]
+    # long_sides = distances[4:]
+    # # 判断边长是否接近
+    # if not (np.isclose(short_sides[0], short_sides[1], atol=tolerance) and
+    #         np.isclose(long_sides[0], long_sides[1], atol=tolerance)):
+    #     return False
+
+    # 检查角度
+    angles = [
+        angle(points[0], points[1], points[2]),
+        angle(points[1], points[2], points[3]),
+        angle(points[2], points[3], points[0]),
+        angle(points[3], points[0], points[1])
+    ]
+
+    # 判断角度是否接近90度
+    return all(np.isclose(a, 90, atol=tolerance) for a in angles)
+

+ 2 - 2
module/config/config_manual.py

@@ -8,7 +8,7 @@ class ConfigManual:
     """
 
     SCHEDULER_PRIORITY = """
-        Restart
+        Restart > SoulsTidy
         > KekkaiUtilize > KekkaiActivation > DemonEncounter
         > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > Tako > RealmRaid > RyouToppa > DailyTrifles > Exploration
         > Dokan > Hunt 
@@ -17,7 +17,7 @@ class ConfigManual:
         > BondlingFairyland > EvoZone > GoryouRealm > HeroTest
         > TrueOrochi > RichMan
         > CollectiveMissions
-        > Pets > TalismanPass > SoulsTidy > Delegation > Hyakkiyakou
+        > Pets > TalismanPass > Delegation > Hyakkiyakou
         > Secret > WeeklyTrifles > MysteryShop > Duel > MetaDemon > FrogBoss > FloatParade > Quiz
         """
 

+ 6 - 0
tasks/ActivityShikigami/script_task.py

@@ -16,6 +16,7 @@ from tasks.GameUi.game_ui import GameUi
 
 from module.logger import logger
 from module.exception import TaskEnd
+from module.base.protect import random_sleep
 
 
 class ScriptTask(GameUi, BaseActivity, SwitchSoul, ActivityShikigamiAssets):
@@ -100,6 +101,9 @@ class ScriptTask(GameUi, BaseActivity, SwitchSoul, ActivityShikigamiAssets):
                     logger.info("Activity ap out")
                     break
 
+            # 随机休息
+            if config.general_climb.random_sleep:
+                random_sleep()
             # 点击战斗
             logger.info("Click battle")
             while 1:
@@ -119,6 +123,8 @@ class ScriptTask(GameUi, BaseActivity, SwitchSoul, ActivityShikigamiAssets):
                 logger.info("General battle success")
 
         self.main_home()
+        if config.general_climb.active_souls_clean:
+            self.set_next_run(task='SoulsTidy', success=False, finish=False, target=datetime.now())
         self.set_next_run(task="ActivityShikigami", success=True)
         raise TaskEnd
 

+ 3 - 3
tasks/AreaBoss/assets.py

@@ -66,11 +66,11 @@ class AreaBossAssets:
 	# 右上边选中鬼王的 
 	I_FILTER = RuleImage(roi_front=(1116,33,35,31), roi_back=(1076,19,98,78), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_filter.png")
 	# 除悬赏外 选中第一个鬼王的 
-	I_BATTLE_1 = RuleImage(roi_front=(1066,210,100,100), roi_back=(1066,210,100,100), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_battle_1.png")
+	I_BATTLE_1 = RuleImage(roi_front=(1083,235,65,54), roi_back=(1083,235,65,54), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_battle_1.png")
 	# 除悬赏外 选中第二个鬼王的 
-	I_BATTLE_2 = RuleImage(roi_front=(1068,364,100,100), roi_back=(1068,364,100,100), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_battle_2.png")
+	I_BATTLE_2 = RuleImage(roi_front=(1086,390,56,53), roi_back=(1086,390,56,53), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_battle_2.png")
 	# 除悬赏外 选中第三个鬼王的 
-	I_BATTLE_3 = RuleImage(roi_front=(1071,521,100,100), roi_back=(1071,521,100,100), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_battle_3.png")
+	I_BATTLE_3 = RuleImage(roi_front=(1083,545,66,53), roi_back=(1083,545,66,53), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_battle_3.png")
 	# 点击挑战 
 	I_FIRE = RuleImage(roi_front=(1109,490,100,73), roi_back=(1075,463,150,158), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_fire.png")
 	# 跟buff冲突弃用 

+ 6 - 6
tasks/AreaBoss/res/image.json

@@ -38,8 +38,8 @@
   {
     "itemName": "battle_1",
     "imageName": "res_battle_1.png",
-    "roiFront": "1066,210,100,100",
-    "roiBack": "1066,210,100,100",
+    "roiFront": "1083,235,65,54",
+    "roiBack": "1083,235,65,54",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "除悬赏外 选中第一个鬼王的"
@@ -47,8 +47,8 @@
   {
     "itemName": "battle_2",
     "imageName": "res_battle_2.png",
-    "roiFront": "1068,364,100,100",
-    "roiBack": "1068,364,100,100",
+    "roiFront": "1086,390,56,53",
+    "roiBack": "1086,390,56,53",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "除悬赏外 选中第二个鬼王的"
@@ -56,8 +56,8 @@
   {
     "itemName": "battle_3",
     "imageName": "res_battle_3.png",
-    "roiFront": "1071,521,100,100",
-    "roiBack": "1071,521,100,100",
+    "roiFront": "1083,545,66,53",
+    "roiBack": "1083,545,66,53",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "除悬赏外 选中第三个鬼王的"

BIN
tasks/AreaBoss/res/res_battle_1.png


BIN
tasks/AreaBoss/res/res_battle_2.png


BIN
tasks/AreaBoss/res/res_battle_3.png


+ 4 - 0
tasks/Component/BaseActivity/config_activity.py

@@ -28,6 +28,10 @@ class GeneralClimb(ConfigBase):
     # 如果挂完的活动的体力,是不是需要挂游戏的体力
     # 在我的设计理念中:活动体力>游戏体力。所以不提供从300挂满然后才到挂活动币
     activity_toggle: bool = Field(default=False, description='activity_toggle_help')
+    # 结束后激活 御魂清理
+    active_souls_clean: bool = Field(default=False, description='active_souls_clean_help')
+    # 点击战斗随机休息
+    random_sleep: bool = Field(default=False, description='random_delay_help')
 
     @validator('limit_time', pre=True, always=True)
     def parse_limit_time(cls, value):

+ 2 - 0
tasks/Component/Costume/config.py

@@ -46,6 +46,8 @@ class BattleType(str, Enum):
     COSTUME_BATTLE_4 = 'costume_battle_4'  # 春缕含青
     COSTUME_BATTLE_5 = 'costume_battle_5'  # 祥夜幽芳
     COSTUME_BATTLE_6 = 'costume_battle_6'  # 桂馥金秋
+    COSTUME_BATTLE_7 = 'costume_battle_7'  # 笼梦之境
+    COSTUME_BATTLE_8 = 'costume_battle_8'  # 藏金台阁
 
 
 

+ 13 - 0
tasks/Component/Costume/costume_base.py

@@ -103,6 +103,19 @@ battle_theme_model = {
         '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',
+    },
 }
 
 

+ 24 - 0
tasks/Component/CostumeBattle/assets.py

@@ -64,3 +64,27 @@ class CostumeBattleAssets:
 	I_FRIENDS_6 = RuleImage(roi_front=(89,18,35,34), roi_back=(89,18,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle6/battle6_friends_6.png")
 
 
+	# Image Rule Assets
+	# 指针 
+	I_LOCAL_7 = RuleImage(roi_front=(30,566,23,25), roi_back=(30,566,23,25), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle7/battle7_local_7.png")
+	# 左上角退出 
+	I_EXIT_7 = RuleImage(roi_front=(22,17,27,31), roi_back=(22,17,27,31), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle7/battle7_exit_7.png")
+	# 左上角好友 
+	I_FRIENDS_7 = RuleImage(roi_front=(89,18,35,34), roi_back=(89,18,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle7/battle6_friends_7.png")
+
+
+	# Image Rule Assets
+	# 指针 
+	I_LOCAL_8 = RuleImage(roi_front=(30,566,23,25), roi_back=(30,566,23,25), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle8/battle8_local_8.png")
+	# 左上角退出 
+	I_EXIT_8 = RuleImage(roi_front=(22,17,27,31), roi_back=(22,17,27,31), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle8/battle8_exit_8.png")
+	# 左上角好友 
+	I_FRIENDS_8 = RuleImage(roi_front=(89,18,35,34), roi_back=(89,18,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle8/battle8_friends_8.png")
+	# 战斗胜利 
+	I_WIN_8 = RuleImage(roi_front=(391,100,100,100), roi_back=(296,33,414,224), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle8/battle8_win_8.png")
+	# 针对封魔的特殊 
+	I_DE_WIN_8 = RuleImage(roi_front=(392,99,100,100), roi_back=(239,36,399,198), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle8/battle8_de_win_8.png")
+	# 失败 
+	I_FALSE_8 = RuleImage(roi_front=(384,106,100,100), roi_back=(346,96,184,120), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle8/battle8_false_8.png")
+
+

+ 0 - 0
tasks/Component/CostumeBattle/battle4/battle1_friends_4.png → tasks/Component/CostumeBattle/battle4/battle4_friends_4.png


+ 0 - 0
tasks/Component/CostumeBattle/battle6/battle1_friends_6.png → tasks/Component/CostumeBattle/battle6/battle6_friends_6.png


BIN
tasks/Component/CostumeBattle/battle7/battle7_exit_7.png


BIN
tasks/Component/CostumeBattle/battle7/battle7_friends_7.png


BIN
tasks/Component/CostumeBattle/battle7/battle7_local_7.png


+ 29 - 0
tasks/Component/CostumeBattle/battle7/image.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "local_7",
+    "imageName": "battle7_local_7.png",
+    "roiFront": "30,566,23,25",
+    "roiBack": "30,566,23,25",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "指针"
+  },
+  {
+    "itemName": "exit_7",
+    "imageName": "battle7_exit_7.png",
+    "roiFront": "22,17,27,31",
+    "roiBack": "22,17,27,31",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角退出"
+  },
+  {
+    "itemName": "friends_7",
+    "imageName": "battle6_friends_7.png",
+    "roiFront": "89,18,35,34",
+    "roiBack": "89,18,35,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友"
+  }
+]

BIN
tasks/Component/CostumeBattle/battle8/battle8_de_win_8.png


BIN
tasks/Component/CostumeBattle/battle8/battle8_exit_8.png


BIN
tasks/Component/CostumeBattle/battle8/battle8_false_8.png


BIN
tasks/Component/CostumeBattle/battle8/battle8_friends_8.png


BIN
tasks/Component/CostumeBattle/battle8/battle8_local_8.png


BIN
tasks/Component/CostumeBattle/battle8/battle8_win_8.png


+ 56 - 0
tasks/Component/CostumeBattle/battle8/image.json

@@ -0,0 +1,56 @@
+[
+  {
+    "itemName": "local_8",
+    "imageName": "battle8_local_8.png",
+    "roiFront": "30,566,23,25",
+    "roiBack": "30,566,23,25",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "指针"
+  },
+  {
+    "itemName": "exit_8",
+    "imageName": "battle8_exit_8.png",
+    "roiFront": "22,17,27,31",
+    "roiBack": "22,17,27,31",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角退出"
+  },
+  {
+    "itemName": "friends_8",
+    "imageName": "battle8_friends_8.png",
+    "roiFront": "89,18,35,34",
+    "roiBack": "89,18,35,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友"
+  },
+  {
+    "itemName": "win_8",
+    "imageName": "battle8_win_8.png",
+    "roiFront": "391,100,100,100",
+    "roiBack": "296,33,414,224",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "战斗胜利"
+  },
+  {
+    "itemName": "de_win_8",
+    "imageName": "battle8_de_win_8.png",
+    "roiFront": "392,99,100,100",
+    "roiBack": "239,36,399,198",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "针对封魔的特殊"
+  },
+  {
+    "itemName": "false_8",
+    "imageName": "battle8_false_8.png",
+    "roiFront": "384,106,100,100",
+    "roiBack": "346,96,184,120",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "失败"
+  }
+]

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


+ 1 - 0
tasks/Component/RightActivity/right_activity.py

@@ -14,6 +14,7 @@ class RightActivity(GameUi, RightActivityAssets):
     def enter(self, target: RuleImage):
         self.ui_get_current_page()
         self.ui_goto(page_main)
+
         self.ui_click_until_disappear(target, interval=3.5)
 
     def right_open(self):

+ 8 - 0
tasks/DailyTrifles/assets.py

@@ -17,6 +17,14 @@ class DailyTriflesAssets:
 	I_L_LOVE = RuleImage(roi_front=(123,625,67,72), roi_back=(123,625,67,72), threshold=0.9, method="Template matching", file="./tasks/DailyTrifles/love/love_l_love.png")
 	# 一键收取 
 	I_L_COLLECT = RuleImage(roi_front=(47,537,129,56), roi_back=(47,537,129,56), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/love_l_collect.png")
+	# 吉闻 
+	I_LUCK_MSG = RuleImage(roi_front=(22,47,46,27), roi_back=(22,47,46,27), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_luck_msg.png")
+	# 一键祝福 
+	I_ONE_CLICK_BLESS = RuleImage(roi_front=(1115,500,93,33), roi_back=(1115,500,93,33), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_one_click_bless.png")
+	# 点击祝福 
+	I_CLICK_BLESS = RuleImage(roi_front=(617,442,92,39), roi_back=(617,442,92,39), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_click_bless.png")
+	# 吉闻页 
+	I_LUCK_TITLE = RuleImage(roi_front=(600,52,131,67), roi_back=(600,52,131,67), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_luck_title.png")
 
 
 	# Image Rule Assets

+ 1 - 0
tasks/DailyTrifles/config.py

@@ -12,6 +12,7 @@ class DailyTriflesConfig(BaseModel):
     one_summon: bool = Field(title='One Summon', default=False)
     guild_wish: bool = Field(title='Guild Wish', default=False)
     friend_love: bool = Field(title='Friend Love', default=False)
+    luck_msg: bool = Field(title='Luck Msg', default=False)
     store_sign: bool = Field(title='Store Sign', default=False, description='store_sign_help')
 
 

BIN
tasks/DailyTrifles/love/Screenshots_click_bless.png


BIN
tasks/DailyTrifles/love/Screenshots_luck_msg.png


BIN
tasks/DailyTrifles/love/Screenshots_luck_title.png


BIN
tasks/DailyTrifles/love/Screenshots_one_click_bless.png


+ 36 - 0
tasks/DailyTrifles/love/image.json

@@ -25,5 +25,41 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "一键收取"
+  },
+  {
+    "itemName": "luck_msg",
+    "imageName": "Screenshots_luck_msg.png",
+    "roiFront": "22,47,46,27",
+    "roiBack": "22,47,46,27",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "吉闻"
+  },
+  {
+    "itemName": "one_click_bless",
+    "imageName": "Screenshots_one_click_bless.png",
+    "roiFront": "1115,500,93,33",
+    "roiBack": "1115,500,93,33",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "一键祝福"
+  },
+  {
+    "itemName": "click_bless",
+    "imageName": "Screenshots_click_bless.png",
+    "roiFront": "617,442,92,39",
+    "roiBack": "617,442,92,39",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击祝福"
+  },
+  {
+    "itemName": "luck_title",
+    "imageName": "Screenshots_luck_title.png",
+    "roiFront": "600,52,131,67",
+    "roiBack": "600,52,131,67",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "吉闻页"
   }
 ]

+ 32 - 2
tasks/DailyTrifles/script_task.py

@@ -27,6 +27,8 @@ class ScriptTask(GameUi, Summon, DailyTriflesAssets):
             pass
         if con.friend_love:
             self.run_friend_love()
+        if con.luck_msg:
+            self.run_luck_msg()
         if con.store_sign:
             self.run_store_sign()
         self.set_next_run('DailyTrifles', success=True, finish=False)
@@ -41,6 +43,34 @@ class ScriptTask(GameUi, Summon, DailyTriflesAssets):
     def run_guild_wish(self):
         pass
 
+    def run_luck_msg(self):
+        self.ui_get_current_page()
+        self.ui_goto(page_friends)
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_LUCK_TITLE):
+                break
+            if self.appear_then_click(self.I_LUCK_MSG, interval=1):
+                continue
+        logger.info('Start luck msg')
+        check_timer = Timer(2)
+        check_timer.start()
+        while 1:
+            self.screenshot()
+
+            if self.appear_then_click(self.I_CLICK_BLESS, interval=1):
+                continue
+            if self.appear_then_click(self.I_ONE_CLICK_BLESS, interval=1):
+                continue
+            if self.ui_reward_appear_click():
+                logger.info('Get reward of luck msg')
+                break
+            if check_timer.reached():
+                logger.warning('There is no any luck msg')
+                break
+
+        self.ui_click(self.I_UI_BACK_RED, self.I_CHECK_MAIN)
+
     def run_friend_love(self):
         self.ui_get_current_page()
         self.ui_goto(page_friends)
@@ -104,10 +134,10 @@ if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
 
-    c = Config('oas1')
+    c = Config('du')
     d = Device(c)
     t = ScriptTask(c, d)
 
     # t.run_one_summon()
-    t.run_store_sign()
+    t.run_luck_msg()
 

+ 12 - 9
tasks/DemonEncounter/config.py

@@ -13,24 +13,27 @@ from tasks.Utils.config_enum import ShikigamiClass
 
 # 不同封魔boss的御魂配置
 class DemonConfig(BaseModel):
-    enable: bool = Field(default=False)
+    enable: bool = Field(
+        default=False,
+        description="通过预设名称来匹配御魂分组\n例如=> 逢魔之时,歌(中间的是英文逗号)",
+    )
     # 周一
-    demon_kiryou_utahime: str = Field(default="-1,-1", description="鬼灵歌姬御魂1")
+    demon_kiryou_utahime: str = Field(default="group,team", description="鬼灵歌姬御魂1")
     demon_kiryou_utahime_supplementary: str = Field(
-        default="-1,-1", description="鬼灵歌姬御魂补充"
+        default="group,team", description="鬼灵歌姬御魂补充"
     )
     # 周二
-    demon_shinkirou: str = Field(default="-1,-1", description="蜃气楼御魂")
+    demon_shinkirou: str = Field(default="group,team", description="蜃气楼御魂")
     # 周三 土蜘蛛
-    demon_tsuchigumo: str = Field(default="-1,-1", description="土蜘蛛御魂")
+    demon_tsuchigumo: str = Field(default="group,team", description="土蜘蛛御魂")
     # 周四 荒骷髅
-    demon_gashadokuro: str = Field(default="-1,-1", description="荒骷髅御魂")
+    demon_gashadokuro: str = Field(default="group,team", description="荒骷髅御魂")
     # 周五 地震鲇
-    demon_namazu: str = Field(default="-1,-1", description="地震鲇御魂")
+    demon_namazu: str = Field(default="group,team", description="地震鲇御魂")
     # 周六 胧车
-    demon_oboroguruma: str = Field(default="-1,-1", description="胧车御魂")
+    demon_oboroguruma: str = Field(default="group,team", description="胧车御魂")
     # 周日 夜荒魂
-    demon_nightly_aramitama: str = Field(default="-1,-1", description="夜荒魂御魂")
+    demon_nightly_aramitama: str = Field(default="group,team", description="夜荒魂御魂")
 
 
 class UtilizeScheduler(Scheduler):

+ 1 - 1
tasks/DemonEncounter/data/answer.py

@@ -101,7 +101,7 @@ class Answer:
                 if match == option:
                     return index + 1
         # 可能选项识别某一个字错误
-        if options[0] != '' and options[1] != '' and options[2] != '' and options[3] != '':
+        if all(options):
             for index, option in enumerate(options):
                 for match in question_matches:
                     if len(match) != len(option):

+ 15 - 8
tasks/DemonEncounter/script_task.py

@@ -54,21 +54,28 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
         # 判断今天是周几
         today = datetime.now().weekday()
         soul_config = self.config.demon_encounter.demon_soul_config
+        group, team = None, None
         if today == 0:
-            self.run_switch_soul(soul_config.demon_kiryou_utahime)
-            self.run_switch_soul(soul_config.demon_kiryou_utahime_supplementary)
+            # 获取group,team
+            group, team = soul_config.demon_kiryou_utahime.split(",")
         elif today == 1:
-            self.run_switch_soul(soul_config.demon_shinkirou)
+            group, team = soul_config.demon_kiryou_utahime.split(",")
         elif today == 2:
-            self.run_switch_soul(soul_config.demon_tsuchigumo)
+            group, team = soul_config.demon_tsuchigumo.split(",")
         elif today == 3:
-            self.run_switch_soul(soul_config.demon_gashadokuro)
+            group, team = soul_config.demon_gashadokuro.split(",")
         elif today == 4:
-            self.run_switch_soul(soul_config.demon_namazu)
+            group, team = soul_config.demon_namazu.split(",")
         elif today == 5:
-            self.run_switch_soul(soul_config.demon_oboroguruma)
+            group, team = soul_config.demon_oboroguruma.split(",")
         elif today == 6:
-            self.run_switch_soul(soul_config.demon_nightly_aramitama)
+            group, team = soul_config.demon_nightly_aramitama.split(",")
+        if group and team:
+            self.run_switch_soul_by_name(group, team)
+        if today == 0:
+            # 获取group,team
+            group, team = soul_config.demon_kiryou_utahime_supplementary.split(",")
+            self.run_switch_soul_by_name(group, team)
 
     def execute_boss(self):
         """

+ 1 - 2
tasks/Exploration/base.py

@@ -55,7 +55,7 @@ class BaseExploration(GeneralBattle, GeneralRoom, GeneralInvite, ReplaceShikigam
         if not reuse_screenshot:
             self.screenshot()
 
-        if self.appear(self.I_CHECK_EXPLORATION):
+        if self.appear(self.I_CHECK_EXPLORATION) and not self.appear(self.I_E_SETTINGS_BUTTON):
             return Scene.WORLD
         elif self.appear(self.I_UI_BACK_RED) and self.appear(self.I_E_EXPLORATION_CLICK):
             return Scene.ENTRANCE
@@ -285,7 +285,6 @@ class BaseExploration(GeneralBattle, GeneralRoom, GeneralInvite, ReplaceShikigam
         # 判断是否开启突破票检测
         if not con_scrolls.scrolls_enable:
             return
-        self.screenshot()
         if self.appear(self.I_E_EXPLORATION_CLICK) and self.appear(self.I_EXP_CREATE_TEAM):
             cu, res, total = self.O_REALM_RAID_NUMBER1.ocr(self.device.image)
         else:

+ 18 - 18
tasks/FrogBoss/assets.py

@@ -12,31 +12,31 @@ class FrogBossAssets:
 
 	# Image Rule Assets
 	# 左边竞猜 
-	I_BET_LEFT = RuleImage(roi_front=(88,342,145,100), roi_back=(88,342,145,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_left.png")
+	I_BET_LEFT = RuleImage(roi_front=(95,308,145,100), roi_back=(58,248,245,195), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_left.png")
 	# 右边竞猜 
-	I_BET_RIGHT = RuleImage(roi_front=(1044,344,146,100), roi_back=(1044,344,146,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_right.png")
+	I_BET_RIGHT = RuleImage(roi_front=(1038,303,146,100), roi_back=(1012,268,187,208), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_right.png")
 	# description 
-	I_BET_SUCCESS_BOX = RuleImage(roi_front=(590,439,87,50), roi_back=(590,439,87,50), threshold=0.75, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_success_box.png")
+	I_BET_SUCCESS_BOX = RuleImage(roi_front=(593,419,87,50), roi_back=(564,378,140,133), threshold=0.75, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_success_box.png")
 	# 左边赢了 
-	I_SUCCESS_LEFT = RuleImage(roi_front=(108,352,100,100), roi_back=(108,352,100,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_success_left.png")
+	I_SUCCESS_LEFT = RuleImage(roi_front=(123,316,100,100), roi_back=(91,254,202,221), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_success_left.png")
 	# 右边输了 
-	I_FAILURE_RIGHT = RuleImage(roi_front=(1067,341,100,100), roi_back=(1067,341,100,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_failure_right.png")
+	I_FAILURE_RIGHT = RuleImage(roi_front=(1063,291,100,100), roi_back=(993,242,224,199), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_failure_right.png")
 	# description 
-	I_NEXT_COMPETITION = RuleImage(roi_front=(1098,510,42,36), roi_back=(1098,510,42,36), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_next_competition.png")
+	I_NEXT_COMPETITION = RuleImage(roi_front=(673,510,42,36), roi_back=(658,488,91,98), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_next_competition.png")
 	# 30万金币 
-	I_GOLD_30 = RuleImage(roi_front=(824,499,78,76), roi_back=(824,499,78,76), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_gold_30.png")
+	I_GOLD_30 = RuleImage(roi_front=(858,494,78,76), roi_back=(809,427,147,187), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_gold_30.png")
 	# 确认竞猜 
-	I_BET_SURE = RuleImage(roi_front=(1014,404,100,100), roi_back=(1014,404,100,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_sure.png")
+	I_BET_SURE = RuleImage(roi_front=(1025,402,100,100), roi_back=(1000,297,200,226), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_sure.png")
 	# description 
-	I_GOLD_30_CHECK = RuleImage(roi_front=(512,180,68,83), roi_back=(402,141,459,489), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_gold_30_check.png")
+	I_GOLD_30_CHECK = RuleImage(roi_front=(513,196,58,53), roi_back=(402,141,459,489), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_gold_30_check.png")
 	# description 
-	I_BETTED = RuleImage(roi_front=(93,352,125,54), roi_back=(49,322,1192,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_betted.png")
+	I_BETTED = RuleImage(roi_front=(93,352,125,54), roi_back=(49,283,1192,161), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_betted.png")
 	# description 
-	I_SUCCESS_RIGHT = RuleImage(roi_front=(1061,336,122,116), roi_back=(1061,336,122,116), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_success_right.png")
+	I_SUCCESS_RIGHT = RuleImage(roi_front=(1048,341,122,116), roi_back=(999,243,201,260), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_success_right.png")
 	# description 
-	I_FAILURE_LEFT = RuleImage(roi_front=(107,351,100,100), roi_back=(107,351,100,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_failure_left.png")
+	I_FAILURE_LEFT = RuleImage(roi_front=(116,307,100,100), roi_back=(76,256,193,219), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_failure_left.png")
 	# description 
-	I_BET_FAILURE = RuleImage(roi_front=(510,266,269,72), roi_back=(510,266,269,72), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_failure.png")
+	I_BET_FAILURE = RuleImage(roi_front=(496,252,269,72), roi_back=(439,220,400,152), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_failure.png")
 	# description 
 	I_BET_SUCCESS = RuleImage(roi_front=(512,264,260,73), roi_back=(433,214,418,151), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_success.png")
 
@@ -44,16 +44,16 @@ class FrogBossAssets:
 	# Image Rule Assets
 	# description 
 	I_FROG_BOSS_ENTER = RuleImage(roi_front=(1191,391,36,38), roi_back=(1174,135,78,320), threshold=0.7, method="Template matching", file="./tasks/FrogBoss/fb/fb_frog_boss_enter.png")
-	# description 
-	I_FROG_BOSS_REST = RuleImage(roi_front=(508,266,169,64), roi_back=(508,266,169,64), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_frog_boss_rest.png")
+	# 休息中 
+	I_FROG_BOSS_REST = RuleImage(roi_front=(510,274,169,64), roi_back=(492,260,220,113), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_frog_boss_rest.png")
 
 
 	# Ocr Rule Assets
 	# Ocr-description 
-	O_LEFT_COUNT = RuleOcr(roi=(144,541,69,31), area=(144,541,69,31), mode="Digit", method="Default", keyword="", name="left_count")
+	O_LEFT_COUNT = RuleOcr(roi=(143,496,69,31), area=(143,496,69,31), mode="Digit", method="Default", keyword="", name="left_count")
 	# Ocr-description 
-	O_RIGHT_COUNT = RuleOcr(roi=(1110,542,77,32), area=(1110,542,77,32), mode="Digit", method="Default", keyword="", name="right_count")
+	O_RIGHT_COUNT = RuleOcr(roi=(1105,497,77,32), area=(1105,497,77,32), mode="Digit", method="Default", keyword="", name="right_count")
 	# Ocr-description 
-	O_TIME_REMAIN = RuleOcr(roi=(590,601,91,35), area=(590,601,91,35), mode="Duration", method="Default", keyword="", name="time_remain")
+	O_TIME_REMAIN = RuleOcr(roi=(594,564,91,35), area=(594,564,91,35), mode="Duration", method="Default", keyword="", name="time_remain")
 
 

BIN
tasks/FrogBoss/fb/fb_gold_30_check.png


+ 24 - 24
tasks/FrogBoss/fb/image.json

@@ -2,8 +2,8 @@
   {
     "itemName": "bet_left",
     "imageName": "fb_bet_left.png",
-    "roiFront": "88,342,145,100",
-    "roiBack": "88,342,145,100",
+    "roiFront": "95,308,145,100",
+    "roiBack": "58,248,245,195",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "左边竞猜"
@@ -11,8 +11,8 @@
   {
     "itemName": "bet_right",
     "imageName": "fb_bet_right.png",
-    "roiFront": "1044,344,146,100",
-    "roiBack": "1044,344,146,100",
+    "roiFront": "1038,303,146,100",
+    "roiBack": "1012,268,187,208",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "右边竞猜"
@@ -20,8 +20,8 @@
   {
     "itemName": "bet_success_box",
     "imageName": "fb_bet_success_box.png",
-    "roiFront": "590,439,87,50",
-    "roiBack": "590,439,87,50",
+    "roiFront": "593,419,87,50",
+    "roiBack": "564,378,140,133",
     "method": "Template matching",
     "threshold": 0.75,
     "description": "description"
@@ -29,8 +29,8 @@
   {
     "itemName": "success_left",
     "imageName": "fb_success_left.png",
-    "roiFront": "108,352,100,100",
-    "roiBack": "108,352,100,100",
+    "roiFront": "123,316,100,100",
+    "roiBack": "91,254,202,221",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "左边赢了"
@@ -38,8 +38,8 @@
   {
     "itemName": "failure_right",
     "imageName": "fb_failure_right.png",
-    "roiFront": "1067,341,100,100",
-    "roiBack": "1067,341,100,100",
+    "roiFront": "1063,291,100,100",
+    "roiBack": "993,242,224,199",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "右边输了"
@@ -47,8 +47,8 @@
   {
     "itemName": "next_competition",
     "imageName": "fb_next_competition.png",
-    "roiFront": "1098,510,42,36",
-    "roiBack": "1098,510,42,36",
+    "roiFront": "673,510,42,36",
+    "roiBack": "658,488,91,98",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -56,8 +56,8 @@
   {
     "itemName": "gold_30",
     "imageName": "fb_gold_30.png",
-    "roiFront": "824,499,78,76",
-    "roiBack": "824,499,78,76",
+    "roiFront": "858,494,78,76",
+    "roiBack": "809,427,147,187",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "30万金币"
@@ -65,8 +65,8 @@
   {
     "itemName": "bet_sure",
     "imageName": "fb_bet_sure.png",
-    "roiFront": "1014,404,100,100",
-    "roiBack": "1014,404,100,100",
+    "roiFront": "1025,402,100,100",
+    "roiBack": "1000,297,200,226",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "确认竞猜"
@@ -74,7 +74,7 @@
   {
     "itemName": "gold_30_check",
     "imageName": "fb_gold_30_check.png",
-    "roiFront": "512,180,68,83",
+    "roiFront": "513,196,58,53",
     "roiBack": "402,141,459,489",
     "method": "Template matching",
     "threshold": 0.8,
@@ -84,7 +84,7 @@
     "itemName": "betted",
     "imageName": "fb_betted.png",
     "roiFront": "93,352,125,54",
-    "roiBack": "49,322,1192,100",
+    "roiBack": "49,283,1192,161",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -92,8 +92,8 @@
   {
     "itemName": "success_right",
     "imageName": "fb_success_right.png",
-    "roiFront": "1061,336,122,116",
-    "roiBack": "1061,336,122,116",
+    "roiFront": "1048,341,122,116",
+    "roiBack": "999,243,201,260",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -101,8 +101,8 @@
   {
     "itemName": "failure_left",
     "imageName": "fb_failure_left.png",
-    "roiFront": "107,351,100,100",
-    "roiBack": "107,351,100,100",
+    "roiFront": "116,307,100,100",
+    "roiBack": "76,256,193,219",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -110,8 +110,8 @@
   {
     "itemName": "bet_failure",
     "imageName": "fb_bet_failure.png",
-    "roiFront": "510,266,269,72",
-    "roiBack": "510,266,269,72",
+    "roiFront": "496,252,269,72",
+    "roiBack": "439,220,400,152",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"

+ 3 - 3
tasks/FrogBoss/fb/image2.json

@@ -11,10 +11,10 @@
   {
     "itemName": "frog_boss_rest",
     "imageName": "fb_frog_boss_rest.png",
-    "roiFront": "508,266,169,64",
-    "roiBack": "508,266,169,64",
+    "roiFront": "510,274,169,64",
+    "roiBack": "492,260,220,113",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "description"
+    "description": "休息中"
   }
 ]

+ 6 - 6
tasks/FrogBoss/fb/ocr.json

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "left_count",
-    "roiFront": "144,541,69,31",
-    "roiBack": "144,541,69,31",
+    "roiFront": "143,496,69,31",
+    "roiBack": "143,496,69,31",
     "mode": "Digit",
     "method": "Default",
     "keyword": "",
@@ -10,8 +10,8 @@
   },
   {
     "itemName": "right_count",
-    "roiFront": "1110,542,77,32",
-    "roiBack": "1110,542,77,32",
+    "roiFront": "1105,497,77,32",
+    "roiBack": "1105,497,77,32",
     "mode": "Digit",
     "method": "Default",
     "keyword": "",
@@ -19,8 +19,8 @@
   },
   {
     "itemName": "time_remain",
-    "roiFront": "590,601,91,35",
-    "roiBack": "590,601,91,35",
+    "roiFront": "594,564,91,35",
+    "roiBack": "594,564,91,35",
     "mode": "Duration",
     "method": "Default",
     "keyword": "",

+ 6 - 2
tasks/FrogBoss/script_task.py

@@ -12,11 +12,13 @@ from module.base.timer import Timer
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.page import page_main
 from tasks.Component.RightActivity.right_activity import RightActivity
+from tasks.Component.GeneralBattle.assets import GeneralBattleAssets
 from tasks.Component.config_base import TimeDelta
 from tasks.FrogBoss.assets import FrogBossAssets
 from tasks.FrogBoss.config import Strategy
 
-class ScriptTask(RightActivity, FrogBossAssets):
+
+class ScriptTask(RightActivity, FrogBossAssets, GeneralBattleAssets):
     def run(self):
         self.enter(self.I_FROG_BOSS_ENTER)
         # 进入主界面
@@ -41,6 +43,8 @@ class ScriptTask(RightActivity, FrogBossAssets):
                         break
                     if self.appear_then_click(self.I_BET_SUCCESS_BOX, interval=1):
                         continue
+                    if self.appear_then_click(self.I_REWARD, interval=2):
+                        continue
                     if self.appear_then_click(self.I_NEXT_COMPETITION, interval=4):
                         continue
                 continue
@@ -75,7 +79,7 @@ class ScriptTask(RightActivity, FrogBossAssets):
         elif 18 <= time_now.hour < 20:
             time_set = time_set.replace(hour=22)
         elif 20 <= time_now.hour < 22:
-            time_set = time_set.replace(hour=24)
+            time_set = time_set.replace(hour=0) + TimeDelta(days=1)
         elif 22 <= time_now.hour < 24:
             day = time_now.day + 1
             time_set = time_set.replace(day=day, hour=12)

+ 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_base import ConfigBase, Time, TimeDelta
 from tasks.Component.BaseActivity.config_activity import GeneralClimb
-
+from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
 
 class Layer(str, Enum):
     YANWU: str = "鬼兵演武"
@@ -37,3 +37,4 @@ class HeroTest(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     herotest: HeroTestConfig = Field(default_factory=HeroTestConfig)
     general_battle: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
+    switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)

+ 15 - 4
tasks/HeroTest/script_task.py

@@ -6,14 +6,15 @@ import random  # type: ignore
 
 from tasks.Component.BaseActivity.base_activity import BaseActivity
 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.Component.SwitchSoul.switch_soul import SwitchSoul
 
 from module.logger import logger
 from module.exception import TaskEnd
 
 
-class ScriptTask(GameUi, BaseActivity, HeroTestAssets):
+class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
 
     is_update = False
     is_skill = False
@@ -23,6 +24,16 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets):
         config = self.config.hero_test
         global is_update
         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 == "鬼兵演武":
             is_update = True
             is_skill = False
@@ -191,12 +202,12 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets):
                         break
                     if self.appear_then_click(self.I_BCMJ_SKILL_ADD2, interval=1):
                         break
+                    if self.appear_then_click(self.I_BCMJ_BLESS, interval=1):
+                        break
                     if self.appear_then_click(
                         self.I_BCMJ_PROPERTY_ADD_CRITICAL, interval=1
                     ):
                         break
-                    if self.appear_then_click(self.I_BCMJ_BLESS, interval=1):
-                        break
                     if self.appear_then_click(
                         self.I_BCMJ__DEFALUT_ATTRIBUTE, interval=1
                     ):

+ 14 - 5
tasks/KekkaiUtilize/script_task.py

@@ -53,9 +53,17 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
             raise TaskEnd
         if not self.grown_goto_utilize():
             logger.info('Utilize failed, exit')
-        self.run_utilize(con.select_friend_list, con.shikigami_class, con.shikigami_order)
+        success = self.run_utilize(con.select_friend_list, con.shikigami_class, con.shikigami_order)
         self.back_guild()
-        self.set_next_run(task='KekkaiUtilize', success=True, finish=True)
+        if success:
+            self.set_next_run(task='KekkaiUtilize', success=True, finish=True)
+        else:
+            self.set_next_run(
+                task='KekkaiUtilize',
+                success=False,
+                finish=False,
+                target=datetime.now() + timedelta(minutes=5)
+            )
         raise TaskEnd
 
 
@@ -340,7 +348,7 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
 
     def run_utilize(self, friend: SelectFriendList = SelectFriendList.SAME_SERVER,
                     shikigami_class: ShikigamiClass = ShikigamiClass.N,
-                    shikigami_order: int = 7):
+                    shikigami_order: int = 7) -> bool:
         """
         执行寄养
         :param shikigami_class:
@@ -415,7 +423,7 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
             logger.warning('Cannot find enter realm button')
             # 可能是滑动的时候出错
             logger.warning('The best reason is that the swipe is wrong')
-            return
+            return False
         while 1:
             self.screenshot()
             if self.appear(self.I_CHECK_FRIEND_REALM_1):
@@ -448,9 +456,10 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
             # 没有坑位可能是其他人的手速太快了抢占了
             logger.warning('Cannot find stop image')
             logger.warning('Maybe other people is faster than you')
-            return
+            return False
 
         self.set_shikigami(shikigami_order, stop_image)
+        return True
 
 
     def back_guild(self):

+ 8 - 0
tasks/Restart/assets.py

@@ -39,6 +39,14 @@ class RestartAssets:
 	I_HARVEST_SIGN_3 = RuleImage(roi_front=(291,495,33,36), roi_back=(100,473,1014,91), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_sign_3.png")
 	# description 
 	I_HARVEST_SIGN_4 = RuleImage(roi_front=(587,151,100,228), roi_back=(547,123,185,281), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_sign_4.png")
+	# 点击随机御魂 
+	I_HARVEST_SOUL_1 = RuleImage(roi_front=(248,501,34,37), roi_back=(165,389,929,168), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_soul_1.png")
+	# 选择第一个御魂 
+	I_HARVEST_SOUL_2 = RuleImage(roi_front=(586,561,112,47), roi_back=(570,547,139,71), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_soul_2.png")
+	# description 
+	I_HARVEST_SOUL_3 = RuleImage(roi_front=(313,489,188,33), roi_back=(302,472,216,60), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_soul_3.png")
+	# 寮包 
+	I_HARVEST_GUILD_REWARD = RuleImage(roi_front=(244,498,41,42), roi_back=(200,403,817,157), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_guild_reward.png")
 
 
 	# Image Rule Assets

BIN
tasks/Restart/harvest/harvest_harvest_guild_reward.png


BIN
tasks/Restart/harvest/harvest_harvest_soul_1.png


BIN
tasks/Restart/harvest/harvest_harvest_soul_2.png


BIN
tasks/Restart/harvest/harvest_harvest_soul_3.png


+ 36 - 0
tasks/Restart/harvest/image.json

@@ -124,5 +124,41 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "harvest_soul_1",
+    "imageName": "harvest_harvest_soul_1.png",
+    "roiFront": "248,501,34,37",
+    "roiBack": "165,389,929,168",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击随机御魂"
+  },
+  {
+    "itemName": "harvest_soul_2",
+    "imageName": "harvest_harvest_soul_2.png",
+    "roiFront": "586,561,112,47",
+    "roiBack": "570,547,139,71",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "选择第一个御魂"
+  },
+  {
+    "itemName": "harvest_soul_3",
+    "imageName": "harvest_harvest_soul_3.png",
+    "roiFront": "313,489,188,33",
+    "roiBack": "302,472,216,60",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "harvest_guild_reward",
+    "imageName": "harvest_harvest_guild_reward.png",
+    "roiFront": "244,498,41,42",
+    "roiBack": "200,403,817,157",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寮包"
   }
 ]

+ 15 - 4
tasks/Restart/login.py

@@ -131,11 +131,11 @@ class LoginHandler(BaseTask, RestartAssets):
                 continue
 
             # 勾玉
-            if self.appear_then_click(self.I_HARVEST_JADE, interval=1):
+            if self.appear_then_click(self.I_HARVEST_JADE, interval=1.5):
                 timer_harvest.reset()
                 continue
             # 签到
-            if self.appear_then_click(self.I_HARVEST_SIGN, interval=1):
+            if self.appear_then_click(self.I_HARVEST_SIGN, interval=1.5):
                 timer_harvest.reset()
                 continue
             # 某些活动的特殊签到,有空看到就删掉
@@ -144,11 +144,11 @@ class LoginHandler(BaseTask, RestartAssets):
             if self.appear_then_click(self.I_HARVEST_SIGN_4, interval=1):
                 timer_harvest.reset()
                 continue
-            if self.appear_then_click(self.I_HARVEST_SIGN_2, interval=1):
+            if self.appear_then_click(self.I_HARVEST_SIGN_2, interval=1.5):
                 timer_harvest.reset()
                 continue
             # 999天的签到福袋
-            if self.appear_then_click(self.I_HARVEST_SIGN_999, interval=1):
+            if self.appear_then_click(self.I_HARVEST_SIGN_999, interval=1.5):
                 timer_harvest.reset()
                 continue
             # 邮件
@@ -186,6 +186,17 @@ class LoginHandler(BaseTask, RestartAssets):
             if self.appear_then_click(self.I_HARVEST_SOUL, interval=1):
                 timer_harvest.reset()
                 continue
+            # 寮包
+            if self.appear_then_click(self.I_HARVEST_GUILD_REWARD, interval=2):
+                timer_harvest.reset()
+                continue
+            # 自选御魂
+            if self.appear(self.I_HARVEST_SOUL_1):
+                logger.info('Select soul 1')
+                self.ui_click(self.I_HARVEST_SOUL_1, stop=self.I_HARVEST_SOUL_2)
+                self.ui_click(self.I_HARVEST_SOUL_2, stop=self.I_HARVEST_SOUL_3, interval=3)
+                self.ui_click_until_disappear(click=self.I_HARVEST_SOUL_3)
+                timer_harvest.reset()
 
 
             # 红色的关闭

+ 1 - 1
tasks/RichMan/assets.py

@@ -29,7 +29,7 @@ class RichManAssets:
 
 	# Ocr Rule Assets
 	# 总的功勋 
-	O_GUILD_TOTAL = RuleOcr(roi=(1151,6,100,42), area=(1151,6,100,42), mode="Digit", method="Default", keyword="", name="guild_total")
+	O_GUILD_TOTAL = RuleOcr(roi=(978,16,58,27), area=(978,16,58,27), mode="Digit", method="Default", keyword="", name="guild_total")
 	# Ocr-description 
 	O_GUILD_NUMBER_BLUE = RuleOcr(roi=(888,269,25,33), area=(888,269,25,33), mode="Digit", method="Default", keyword="", name="guild_number_blue")
 	# Ocr-description 

+ 2 - 2
tasks/RichMan/guild/ocr.json

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "guild_total",
-    "roiFront": "1151,6,100,42",
-    "roiBack": "1151,6,100,42",
+    "roiFront": "978,16,58,27",
+    "roiBack": "978,16,58,27",
     "mode": "Digit",
     "method": "Default",
     "keyword": "",

+ 1 - 0
tasks/WantedQuests/config.py

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

+ 81 - 56
tasks/WantedQuests/script_task.py

@@ -14,7 +14,7 @@ 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_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.config_general_battle import GeneralBattleConfig
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
@@ -24,12 +24,23 @@ from tasks.WantedQuests.config import WantedQuestsConfig, CooperationType, Coope
 from tasks.WantedQuests.assets import WantedQuestsAssets
 from tasks.Component.Costume.config import MainType
 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):
-        con = self.config
+        con = self.config.model.wanted_quests
+        # 自动换御魂
+        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():
             # 无法完成预处理 很有可能你已经完成了悬赏任务
             logger.warning('Cannot pre-work')
@@ -153,6 +164,40 @@ class ScriptTask(SecretScriptTask, GeneralInvite, WantedQuestsAssets):
         :param num_challenge: 现在有的挑战卷数量
         :return:
         """
+        OCR_WQ_TYPE = [self.O_WQ_TYPE_1, self.O_WQ_TYPE_2, self.O_WQ_TYPE_3, self.O_WQ_TYPE_4]
+        OCR_WQ_INFO = [self.O_WQ_INFO_1, self.O_WQ_INFO_2, self.O_WQ_INFO_3, self.O_WQ_INFO_4]
+        GOTO_BUTTON = [self.I_GOTO_1, self.I_GOTO_2, self.I_GOTO_3, self.I_GOTO_4]
+
+        def extract_info(index: int) -> tuple or None:
+            """
+            提取每一个地点的信息
+            :param index: 从零开始
+            :return:
+            (type, destination, number, goto_button)
+            (类型, 地点层级,可以打败的数量,前往按钮)
+            类型: 探索0, 挑战1, 秘闻2
+            """
+            result = [-1, '', -1, GOTO_BUTTON[index]]
+            type_wq = OCR_WQ_TYPE[index].ocr(self.device.image)
+            info_wq_1 = OCR_WQ_INFO[index].ocr(self.device.image)
+            info_wq_1 = info_wq_1.replace(':', ':').replace('(', '(').replace(')', ')')
+            info_wq_1 = info_wq_1.replace(':', ':')
+            match = re.match(r"^(.*?)\(数量:\s*(\d+)\)", info_wq_1)
+            if not match:
+                return None
+            wq_destination = match.group(1)
+            wq_number = int(match.group(2))
+            result[1] = wq_destination
+            result[2] = wq_number
+            if type_wq == '探索':
+                result[0] = -1
+            elif type_wq == '挑战':
+                result[0] = 1 if num_challenge >= 10 else -1
+            elif type_wq == '秘闻':
+                result[0] = 2
+            logger.info(f'[Wanted Quests] type: {type_wq} destination: {wq_destination} number: {wq_number} ')
+            return tuple(result) if result[0] != -1 else None
+
         logger.hr('Start wanted quests')
         while 1:
             self.screenshot()
@@ -164,61 +209,40 @@ class ScriptTask(SecretScriptTask, GeneralInvite, WantedQuestsAssets):
             # 如果没有出现 '前往'按钮, 那就是这个可能是神秘任务但是没有解锁
             logger.warning('This is a secret mission but not unlock')
             self.ui_click(self.I_TRACE_TRUE, self.I_TRACE_FALSE)
-            return
-        # 找到一个最优的关卡来挑战
-        challenge = True if num_challenge >= 10 else False
+            return False
 
-        def check_battle(cha: bool, wq_type, wq_info) -> tuple:
-            battle = False
-            self.screenshot()
-            type_wq = wq_type.ocr(self.device.image)
-            if cha and type_wq == '挑战':
-                battle = 'CHALLENGE'
-            if type_wq == '秘闻':
-                battle = 'SECRET'
-            if not battle:
-                return None, None
-            info = wq_info.ocr(self.device.image)
-            try:
-                # 匹配: 第九章(数量:5)
-                one_number = int(re.findall(r'(\d+)', info)[-1])
-                # one_number = int(re.findall(r'\*\(\数量:\s*(\d+)\)', info)[0])
-            except IndexError:
-                # 匹配: 第九章
-                one_number = 3
-            # num_want / one_number = 一共要打几次
-            if one_number > num_want:
-                return battle, 1
-            else:
-                return battle, num_want // one_number + (1 if num_want % one_number > 0 else 0)
-
-        battle, num, goto = None, None, None
-        if not battle:
-            battle, num = check_battle(challenge, self.O_WQ_TYPE_1, self.O_WQ_INFO_1)
-            goto = self.I_GOTO_1
-        if not battle:
-            battle, num = check_battle(challenge, self.O_WQ_TYPE_2, self.O_WQ_INFO_2)
-            goto = self.I_GOTO_2
-        if not battle:
-            battle, num = check_battle(challenge, self.O_WQ_TYPE_3, self.O_WQ_INFO_3)
-            goto = self.I_GOTO_3
-        if not battle:
-            battle, num = check_battle(challenge, self.O_WQ_TYPE_4, self.O_WQ_INFO_4)
-            goto = self.I_GOTO_4
-        if battle == 'CHALLENGE':
-            self.challenge(goto, num)
-        elif battle == 'SECRET':
-            self.secret(goto, num)
-        else:
-            # 没有找到可以挑战的关卡 那就关闭
+        info_wq_list = []
+        for i in range(4):
+            info_wq = extract_info(i)
+            if info_wq:
+                info_wq_list.append(info_wq)
+        if not info_wq_list:
             logger.warning('No wanted quests can be challenged')
             return False
+        # sort
+        info_wq_list.sort(key=lambda x: x[0])
+        best_type, destination, once_number, goto_button = info_wq_list[0]
+        do_number = 1 if once_number >= num_want else num_want // once_number + (1 if num_want % once_number > 0 else 0)
+        match best_type:
+            case 0:
+                self.explore(goto_button, do_number)
+            case 1:
+                self.challenge(goto_button, do_number)
+            case 2:
+                self.secret(goto_button, do_number)
+            case _:
+                logger.warning('No wanted quests can be challenged')
+
+    def explore(self, goto, num):
+        self.challenge(goto, num)
 
     def challenge(self, goto, num):
         self.ui_click(goto, self.I_WQC_FIRE)
-        self.ui_click(self.I_WQC_LOCK, self.I_WQC_UNLOCK)
+        self.ui_click(self.I_WQC_UNLOCK, self.I_WQC_LOCK)
         self.ui_click_until_disappear(self.I_WQC_FIRE)
-        self.run_general_battle()
+        # 锁定阵容进入战斗
+        wq_config = GeneralBattleConfig(lock_team_enable=True)
+        self.run_general_battle(config=wq_config)
         self.wait_until_appear(self.I_WQC_FIRE, wait_time=4)
         self.ui_click_until_disappear(self.I_UI_BACK_RED)
         # 我忘记了打完后是否需要关闭 挑战界面
@@ -305,8 +329,8 @@ class ScriptTask(SecretScriptTask, GeneralInvite, WantedQuestsAssets):
         if len(ret) == 0:
             logger.info("no Cooperation found")
             return False
-        typeMask=15
-        typeMask = CooperationSelectMask [self.config.wanted_quests.wanted_quests_config.cooperation_type.value]
+        typeMask = 15
+        typeMask = CooperationSelectMask[self.config.wanted_quests.wanted_quests_config.cooperation_type.value]
         for item in ret:
             # 该任务是需要邀请的任务类型
             if not (item['type'] & typeMask):
@@ -327,7 +351,7 @@ class ScriptTask(SecretScriptTask, GeneralInvite, WantedQuestsAssets):
                 logger.info("%s not found,Wait 20s,%d invitations left", name, 5 - index - 1)
                 index += 1
                 sleep(20) if index < 5 else sleep(0)
-                #NOTE 等待过程如果出现协作邀请 将会卡住 为了防止卡住
+                # NOTE 等待过程如果出现协作邀请 将会卡住 为了防止卡住
                 self.screenshot()
         return ret
 
@@ -413,10 +437,11 @@ if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
 
-    c = Config('回归')
+    c = Config('oas1')
     d = Device(c)
     t = ScriptTask(c, d)
     t.screenshot()
 
     t.run()
-    # print(t.appear(t.I_WQ_CHECK_TASK))
+
+