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

Merge pull request #336 from runhey/dev

Dev
huangrunheng 2 лет назад
Родитель
Сommit
9887ce8f0c
75 измененных файлов с 939 добавлено и 235 удалено
  1. 3 2
      README.md
  2. 33 1
      config/template.json
  3. 11 2
      module/config/config.py
  4. BIN
      tasks/ActivityShikigami/as/as_ap.png
  5. BIN
      tasks/ActivityShikigami/as/as_ap_activity.png
  6. BIN
      tasks/ActivityShikigami/as/as_battle.png
  7. BIN
      tasks/ActivityShikigami/as/as_fire.png
  8. BIN
      tasks/ActivityShikigami/as/as_shi.png
  9. BIN
      tasks/ActivityShikigami/as/as_switch.png
  10. 8 8
      tasks/ActivityShikigami/as/image.json
  11. 4 4
      tasks/ActivityShikigami/as/ocr.json
  12. 8 8
      tasks/ActivityShikigami/assets.py
  13. 61 4
      tasks/AreaBoss/assets.py
  14. 84 0
      tasks/AreaBoss/click.json
  15. 1 0
      tasks/AreaBoss/config.py
  16. 5 0
      tasks/AreaBoss/config_boss.py
  17. BIN
      tasks/AreaBoss/res/ab_difficulty_ji.png
  18. BIN
      tasks/AreaBoss/res/ab_difficulty_normal.png
  19. BIN
      tasks/AreaBoss/res/ab_filter_title_famous.png
  20. BIN
      tasks/AreaBoss/res/ab_filter_title_reward.png
  21. BIN
      tasks/AreaBoss/res/ab_ji_floor_list_check.png
  22. BIN
      tasks/AreaBoss/res/ab_ji_floor_one.png
  23. BIN
      tasks/AreaBoss/res/ab_level_60.png
  24. BIN
      tasks/AreaBoss/res/ab_level_handle.png
  25. 78 6
      tasks/AreaBoss/res/image.json
  26. 9 0
      tasks/AreaBoss/res/ocr.json
  27. 248 20
      tasks/AreaBoss/script_task.py
  28. 30 0
      tasks/AreaBoss/swipe.json
  29. 6 0
      tasks/BondlingFairyland/script_task.py
  30. 5 0
      tasks/Component/LootStatistics/README.md
  31. 17 0
      tasks/Component/LootStatistics/assets.py
  32. 26 0
      tasks/Component/LootStatistics/loot_staistics.py
  33. 15 0
      tasks/Component/LootStatistics/loots_config.py
  34. 11 0
      tasks/Component/LootStatistics/ls/image1.json
  35. BIN
      tasks/Component/LootStatistics/ls/ls_realm_raid_pass.png
  36. 5 5
      tasks/Delegation/assets.py
  37. 5 5
      tasks/Delegation/d/image.json
  38. 8 12
      tasks/Dokan/assets.py
  39. 1 1
      tasks/Dokan/res/click.json
  40. 8 26
      tasks/Dokan/res/image.json
  41. 1 1
      tasks/Dokan/res/list.json
  42. 31 32
      tasks/Dokan/script_task.py
  43. 6 0
      tasks/Exploration/assets.py
  44. 12 4
      tasks/Exploration/config.py
  45. 9 0
      tasks/Exploration/res/image.json
  46. 18 0
      tasks/Exploration/res/ocr.json
  47. BIN
      tasks/Exploration/res/res_treasure_box_click.png
  48. 49 4
      tasks/Exploration/script_task.py
  49. 2 2
      tasks/FloatParade/assets.py
  50. BIN
      tasks/FloatParade/fp/fp_fp_getall1.png
  51. 2 2
      tasks/FloatParade/fp/image.json
  52. 1 1
      tasks/Hunt/assets.py
  53. 2 2
      tasks/Hunt/hunt/click.json
  54. BIN
      tasks/Hunt/kirin/kirin_kirin_challage.png
  55. 7 4
      tasks/Hunt/script_task.py
  56. 26 23
      tasks/Restart/login.py
  57. 7 7
      tasks/RichMan/assets.py
  58. 2 2
      tasks/RichMan/mall/navbar/image_side.json
  59. 8 8
      tasks/RichMan/mall/scales/image.json
  60. BIN
      tasks/RichMan/mall/scales/scales_sca_demon_boss_1.png
  61. BIN
      tasks/RichMan/mall/scales/scales_sca_demon_boss_2.png
  62. BIN
      tasks/RichMan/mall/scales/scales_sca_demon_boss_3.png
  63. BIN
      tasks/RichMan/mall/scales/scales_sca_demon_boss_4.png
  64. BIN
      tasks/RichMan/mall/scales/scales_sca_demon_boss_5.png
  65. BIN
      tasks/RichMan/mall/scales/scales_sca_demon_boss_6.png
  66. 5 5
      tasks/RichMan/shrine.py
  67. 1 1
      tasks/RyouToppa/assets.py
  68. 2 2
      tasks/RyouToppa/res/image.json
  69. 1 1
      tasks/TrueOrochi/assets.py
  70. 2 1
      tasks/TrueOrochi/config.py
  71. 50 24
      tasks/TrueOrochi/script_task.py
  72. 2 2
      tasks/TrueOrochi/st/image.json
  73. BIN
      tasks/TrueOrochi/st/st_st_frame.png
  74. 1 1
      tasks/WantedQuests/assets.py
  75. 2 2
      tasks/WantedQuests/invite/image.json

+ 3 - 2
README.md

@@ -80,11 +80,12 @@ OAS 在其基础上进行了如下优化:
 
 ## 联系/加入我们 Contact/Join Us
 
-#### QQ交流群: 465946275
+
 
 相对于其他的游戏,阴阳师玩家总体而言对脚本这类工具具有极高的排斥性。树大招风,无论你是否喜欢 OAS ,我们都希望你不在互联网上进行宣传,这保护 OAS , 也保护开发者们。
 
-为此保持较高的入群门槛:  
+为此保持较高的入群门槛: 
+#### QQ交流群: 465946275
 - 你的QQ等级必须大于32级(🌞🌞),注册时间超过一年,低等级账号成分复杂,还请见谅。
 - 你必须拥有一个 Github 账户来点一个 **Star** (这并不影响你入群后取消Star),同样的要求注册时间过半年。
 - 入群验证填入你的 Github id,无需在意问题是什么,由QQ机器人审核(机器永远的对的)。

+ 33 - 1
config/template.json

@@ -889,5 +889,37 @@
       "kirin_group_team": "-1,-1",
       "netherworld_group_team": "-1,-1"
     }
-  }
+  },
+  "dokan": {
+    "scheduler": {
+      "enable": true,
+      "next_run": "2023-01-01 00:00:00",
+      "priority": 5,
+      "success_interval": "01 00:00:00",
+      "failure_interval": "01 00:00:00",
+      "server_update": "19:00:00"
+    },
+    "dokan_config": {
+      "dokan_attack_priority": 0,
+      "dokan_auto_cheering_while_cd": false,
+      "random_delay": false,
+      "anti_detect_click_fixed_random_area": false
+    },
+    "general_battle_config": {
+      "lock_team_enable": false,
+      "preset_enable": true,
+      "preset_group": 1,
+      "preset_team": 1,
+      "green_enable": true,
+      "green_mark": "green_left4",
+      "random_click_swipt_enable": false
+    },
+    "switch_soul_config": {
+      "enable": false,
+      "switch_group_team": "1,1",
+      "enable_switch_by_name": false,
+      "group_name": "",
+      "team_name": ""
+    }
+  } 
 }

+ 11 - 2
module/config/config.py

@@ -286,6 +286,12 @@ class Config(ConfigState, ConfigManual, ConfigWatcher, ConfigMenu):
         :param finish: 是完成任务后的时间为基准还是开始任务的时间为基准
         :return:
         """
+        # 获取真蛇成功次数
+        global current_success, true_orochi_config
+        if task == 'TrueOrochi':
+            current_success = self.model.true_orochi.true_orochi_config.current_success
+
+        # 加载配置文件
         self.reload()
         # 任务预处理
         if not task:
@@ -346,14 +352,17 @@ class Config(ConfigState, ConfigManual, ConfigWatcher, ConfigMenu):
 
         # 强制设定下一次的运行时间
         if server and hasattr(scheduler, 'server_update') and scheduler.server_update != time(hour=9):
-            next_run = parse_tomorrow_server(scheduler.server_update)
+            if target is None:
+                next_run = parse_tomorrow_server(scheduler.server_update)
 
 
         # 保证线程安全的
         self.lock_config.acquire()
         try:
             scheduler.next_run = next_run
-
+            if task == 'true_orochi':
+                true_orochi_config = getattr(task_object, 'true_orochi_config', None)
+                true_orochi_config.current_success = current_success
             self.save()
         finally:
             self.lock_config.release()

BIN
tasks/ActivityShikigami/as/as_ap.png


BIN
tasks/ActivityShikigami/as/as_ap_activity.png


BIN
tasks/ActivityShikigami/as/as_battle.png


BIN
tasks/ActivityShikigami/as/as_fire.png


BIN
tasks/ActivityShikigami/as/as_shi.png


BIN
tasks/ActivityShikigami/as/as_switch.png


+ 8 - 8
tasks/ActivityShikigami/as/image.json

@@ -2,7 +2,7 @@
   {
     "itemName": "shi",
     "imageName": "as_shi.png",
-    "roiFront": "421,299,60,120",
+    "roiFront": "445,243,26,28",
     "roiBack": "64,216,1110,326",
     "method": "Template matching",
     "threshold": 0.7,
@@ -20,8 +20,8 @@
   {
     "itemName": "battle",
     "imageName": "as_battle.png",
-    "roiFront": "854,108,35,165",
-    "roiBack": "790,58,138,315",
+    "roiFront": "139,301,35,165",
+    "roiBack": "92,217,138,315",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "进入爬塔"
@@ -56,8 +56,8 @@
   {
     "itemName": "fire",
     "imageName": "as_fire.png",
-    "roiFront": "1143,585,84,78",
-    "roiBack": "1117,498,142,174",
+    "roiFront": "1134,587,84,78",
+    "roiBack": "1107,522,142,174",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "点击战斗"
@@ -65,7 +65,7 @@
   {
     "itemName": "ap",
     "imageName": "as_ap.png",
-    "roiFront": "1135,515,29,26",
+    "roiFront": "1122,516,29,26",
     "roiBack": "1092,487,103,71",
     "method": "Template matching",
     "threshold": 0.8,
@@ -74,7 +74,7 @@
   {
     "itemName": "ap_activity",
     "imageName": "as_ap_activity.png",
-    "roiFront": "1133,516,27,25",
+    "roiFront": "1123,516,27,25",
     "roiBack": "1090,500,84,54",
     "method": "Template matching",
     "threshold": 0.8,
@@ -83,7 +83,7 @@
   {
     "itemName": "switch",
     "imageName": "as_switch.png",
-    "roiFront": "1221,518,23,23",
+    "roiFront": "1211,518,23,23",
     "roiBack": "1200,497,69,56",
     "method": "Template matching",
     "threshold": 0.8,

+ 4 - 4
tasks/ActivityShikigami/as/ocr.json

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "remain_ap",
-    "roiFront": "1165,672,87,25",
-    "roiBack": "1165,672,87,25",
+    "roiFront": "1160,673,87,25",
+    "roiBack": "1160,673,87,25",
     "mode": "DigitCounter",
     "method": "Default",
     "keyword": "",
@@ -10,8 +10,8 @@
   },
   {
     "itemName": "remain_ap_activity",
-    "roiFront": "912,25,95,30",
-    "roiBack": "912,25,95,30",
+    "roiFront": "714,24,95,30",
+    "roiBack": "714,24,95,30",
     "mode": "DigitCounter",
     "method": "Default",
     "keyword": "",

+ 8 - 8
tasks/ActivityShikigami/assets.py

@@ -34,11 +34,11 @@ class ActivityShikigamiAssets:
 
 	# Image Rule Assets
 	# 进入活动 
-	I_SHI = RuleImage(roi_front=(421,299,60,120), roi_back=(64,216,1110,326), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
+	I_SHI = RuleImage(roi_front=(445,243,26,28), roi_back=(64,216,1110,326), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
 	# 左上角返回 
 	I_BACK_GREEN = RuleImage(roi_front=(23,27,44,44), roi_back=(23,27,44,44), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
 	# 进入爬塔 
-	I_BATTLE = RuleImage(roi_front=(854,108,35,165), roi_back=(790,58,138,315), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
+	I_BATTLE = RuleImage(roi_front=(139,301,35,165), roi_back=(92,217,138,315), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
 	# 归鹿之途 
 	I_DRUM = RuleImage(roi_front=(885,310,29,145), roi_back=(860,244,87,232), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
 	# 上锁图标 
@@ -46,13 +46,13 @@ class ActivityShikigamiAssets:
 	# 还未上锁图片 
 	I_UNLOCK = RuleImage(roi_front=(823,654,28,28), roi_back=(802,610,86,87), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
 	# 点击战斗 
-	I_FIRE = RuleImage(roi_front=(1143,585,84,78), roi_back=(1117,498,142,174), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
+	I_FIRE = RuleImage(roi_front=(1134,587,84,78), roi_back=(1107,522,142,174), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
 	# 体力按钮 
-	I_AP = RuleImage(roi_front=(1135,515,29,26), roi_back=(1092,487,103,71), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
+	I_AP = RuleImage(roi_front=(1122,516,29,26), roi_back=(1092,487,103,71), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
 	# 活动体力 
-	I_AP_ACTIVITY = RuleImage(roi_front=(1133,516,27,25), roi_back=(1090,500,84,54), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap_activity.png")
+	I_AP_ACTIVITY = RuleImage(roi_front=(1123,516,27,25), roi_back=(1090,500,84,54), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap_activity.png")
 	# 切换按键 
-	I_SWITCH = RuleImage(roi_front=(1221,518,23,23), roi_back=(1200,497,69,56), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_switch.png")
+	I_SWITCH = RuleImage(roi_front=(1211,518,23,23), roi_back=(1200,497,69,56), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_switch.png")
 	# 购买活动的体力 
 	I_BUY_JADE = RuleImage(roi_front=(1004,192,38,42), roi_back=(836,619,38,42), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_buy_jade.png")
 	# 增加到最大 
@@ -63,9 +63,9 @@ class ActivityShikigamiAssets:
 
 	# Ocr Rule Assets
 	# 体力的数量检测 
-	O_REMAIN_AP = RuleOcr(roi=(1165,672,87,25), area=(1165,672,87,25), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
+	O_REMAIN_AP = RuleOcr(roi=(1160,673,87,25), area=(1160,673,87,25), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
 	# 活动体力的剩余检测 
-	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(912,25,95,30), area=(912,25,95,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
+	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(714,24,95,30), area=(714,24,95,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
 	# 还有多少次购买体力的机会 
 	O_REMAIN_BUY = RuleOcr(roi=(808,531,39,42), area=(808,531,39,42), mode="DigitCounter", method="Default", keyword="", name="remain_buy")
 

+ 61 - 4
tasks/AreaBoss/assets.py

@@ -11,10 +11,49 @@ class AreaBossAssets:
 
 
 	# Click Rule Assets
+	# 悬赏按钮 
+	C_AB_REWARD_BTN = RuleClick(roi_front=(1190,100,50,120), roi_back=(1190,100,50,120), name="ab_reward_btn")
 	# 热门按钮 
 	C_AB_FAMOUS_BTN = RuleClick(roi_front=(1190,220,50,120), roi_back=(1190,220,50,120), name="ab_famous_btn")
 	# 收藏按钮 
 	C_AB_COLLECTION_BTN = RuleClick(roi_front=(1190,580,50,120), roi_back=(1190,580,50,120), name="ab_collection_btn")
+	# 筛选中 除悬赏外 第一个boss的头像位置 
+	C_AB_BOSS_PHOTO_1 = RuleClick(roi_front=(940,210,95,70), roi_back=(940,210,95,70), name="ab_boss_photo_1")
+	# 筛选中 除悬赏外 第二个boss的头像位置 
+	C_AB_BOSS_PHOTO_2 = RuleClick(roi_front=(940,365,95,70), roi_back=(940,365,95,70), name="ab_boss_photo_2")
+	# 筛选中 除悬赏外 第三个boss的头像位置 
+	C_AB_BOSS_PHOTO_3 = RuleClick(roi_front=(940,520,95,70), roi_back=(940,520,95,70), name="ab_boss_photo_3")
+	# 筛选中 除悬赏外 滑动到最底部时 第一个boss的头像位置 即倒数第三个 
+	C_AB_BOSS_PHOTO_MINUS_3 = RuleClick(roi_front=(940,255,95,70), roi_back=(940,255,95,70), name="ab_boss_photo_minus_3")
+	# 筛选中 除悬赏外 滑动到最底部时 第二个boss的头像位置 即倒数第二个 
+	C_AB_BOSS_PHOTO_MINUS_2 = RuleClick(roi_front=(940,410,95,70), roi_back=(940,410,95,70), name="ab_boss_photo_minus_2")
+	# 筛选中 除悬赏外 滑动到最底部时 第三个boss的头像位置 即倒数第一个 
+	C_AB_BOSS_PHOTO_MINUS_1 = RuleClick(roi_front=(940,560,95,70), roi_back=(940,560,95,70), name="ab_boss_photo_minus_1")
+	# 筛选中 悬赏中 第一个boss的头像位置 
+	C_AB_BOSS_REWARD_PHOTO_1 = RuleClick(roi_front=(940,250,95,70), roi_back=(940,250,95,70), name="ab_boss_reward_photo_1")
+	# 筛选中 悬赏中 第二个boss的头像位置 
+	C_AB_BOSS_REWARD_PHOTO_2 = RuleClick(roi_front=(940,375,95,70), roi_back=(940,375,95,70), name="ab_boss_reward_photo_2")
+	# 筛选中 悬赏中 第三个boss的头像位置 
+	C_AB_BOSS_REWARD_PHOTO_3 = RuleClick(roi_front=(940,500,95,70), roi_back=(940,500,95,70), name="ab_boss_reward_photo_3")
+	# 筛选中 悬赏中 滑动到最底部时 第一个boss的头像位置 即倒数第三个 
+	C_AB_BOSS_REWARD_PHOTO_MINUS_3 = RuleClick(roi_front=(940,335,95,70), roi_back=(940,335,95,70), name="ab_boss_reward_photo_minus_3")
+	# 筛选中 悬赏中 滑动到最底部时 第二个boss的头像位置 即倒数第二个 
+	C_AB_BOSS_REWARD_PHOTO_MINUS_2 = RuleClick(roi_front=(940,460,95,70), roi_back=(940,460,95,70), name="ab_boss_reward_photo_minus_2")
+	# 筛选中 悬赏中 滑动到最底部时 第三个boss的头像位置 即倒数第一个 
+	C_AB_BOSS_REWARD_PHOTO_MINUS_1 = RuleClick(roi_front=(940,585,95,70), roi_back=(940,585,95,70), name="ab_boss_reward_photo_minus_1")
+	# 当前选择 的极地鬼层数 
+	C_AB_JI_FLOOR_SELECTED = RuleClick(roi_front=(380,120,70,30), roi_back=(380,120,70,30), name="ab_ji_floor_selected")
+
+
+	# Swipe Rule Assets
+	# 筛选列表 手指向上滑动 
+	S_AB_FILTER_UP = RuleSwipe(roi_front=(920,680,10,10), roi_back=(1130,230,10,10), mode="default", name="ab_filter_up")
+	# 筛选列表 手指向下滑动 
+	S_AB_FILTER_DOWN = RuleSwipe(roi_front=(1130,230,10,10), roi_back=(920,680,10,10), mode="default", name="ab_filter_down")
+	# 极地鬼 层数列表 手指向下滑动  
+	S_AB_FLOOR_DOWN = RuleSwipe(roi_front=(390,260,10,10), roi_back=(450,500,10,10), mode="default", name="ab_floor_down")
+	# 普通地鬼 等级滑轨 手指向右滑动  
+	S_AB_LEVEL_RIGHT = RuleSwipe(roi_front=(0,0,10,10), roi_back=(570,270,10,10), mode="default", name="ab_level_right")
 
 
 	# Image Rule Assets
@@ -26,11 +65,11 @@ class AreaBossAssets:
 	I_BACK_BLUE = RuleImage(roi_front=(51,30,51,52), roi_back=(4,1,128,110), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_back_blue.png")
 	# 右上边选中鬼王的 
 	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_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_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_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")
@@ -38,10 +77,26 @@ class AreaBossAssets:
 	I_CLOSE_RED = RuleImage(roi_front=(1190,24,37,38), roi_back=(1190,24,37,38), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_close_red.png")
 	# 红色关闭 
 	I_AB_CLOSE_RED = RuleImage(roi_front=(1194,24,38,37), roi_back=(1194,24,38,37), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_ab_close_red.png")
+	# 筛选中 选中悬赏标识 
+	I_AB_FILTER_TITLE_REWARD = RuleImage(roi_front=(920,110,190,70), roi_back=(920,110,190,70), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_filter_title_reward.png")
+	# 筛选中 选中热门标识 
+	I_AB_FILTER_TITLE_FAMOUS = RuleImage(roi_front=(920,110,190,70), roi_back=(920,110,190,70), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_filter_title_famous.png")
 	# 筛选中 选中收藏标识 
-	I_AB_FILTER_TITLE_COLLECTION = RuleImage(roi_front=(940,110,170,70), roi_back=(940,110,170,70), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_filter_title_collection.png")
+	I_AB_FILTER_TITLE_COLLECTION = RuleImage(roi_front=(920,110,190,70), roi_back=(920,110,190,70), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_filter_title_collection.png")
 	# 筛选界面打开标识 
 	I_AB_FILTER_OPENED = RuleImage(roi_front=(840,110,130,70), roi_back=(840,110,130,70), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_filter_opened.png")
+	# 极地鬼标识 出现此图片表明 是 极地鬼 
+	I_AB_DIFFICULTY_JI = RuleImage(roi_front=(260,100,70,70), roi_back=(260,100,70,70), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_difficulty_ji.png")
+	# 极地鬼标识 出现此图片表明 是 普通地鬼 
+	I_AB_DIFFICULTY_NORMAL = RuleImage(roi_front=(260,100,70,70), roi_back=(260,100,70,70), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_difficulty_normal.png")
+	# 普通地鬼 更改等级 的把手 
+	I_AB_LEVEL_HANDLE = RuleImage(roi_front=(170,250,400,75), roi_back=(170,250,400,75), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_level_handle.png")
+	# 普通地鬼 等级为60 标志 
+	I_AB_LEVEL_60 = RuleImage(roi_front=(300,160,110,100), roi_back=(300,160,110,100), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_level_60.png")
+	# 极地鬼 层数列表打开 标志 
+	I_AB_JI_FLOOR_LIST_CHECK = RuleImage(roi_front=(390,150,60,290), roi_back=(390,150,60,290), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_ji_floor_list_check.png")
+	# 极地鬼 一层 
+	I_AB_JI_FLOOR_ONE = RuleImage(roi_front=(390,150,60,290), roi_back=(390,150,60,290), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_ji_floor_one.png")
 
 
 	# Ocr Rule Assets
@@ -53,5 +108,7 @@ class AreaBossAssets:
 	O_AB_FAMOUS = RuleOcr(roi=(1190,220,50,120), area=(1190,220,50,120), mode="Single", method="Default", keyword="热门", name="ab_famous")
 	# 收藏 
 	O_AB_COLLECTING = RuleOcr(roi=(1190,580,50,120), area=(1190,580,50,120), mode="Single", method="Default", keyword="收藏", name="ab_collecting")
+	# 挑战人数 
+	O_AB_NUM_OF_CHALLENGE = RuleOcr(roi=(270,630,150,36), area=(270,630,150,36), mode="Digit", method="Default", keyword="", name="ab_num_of_challenge")
 
 

+ 84 - 0
tasks/AreaBoss/click.json

@@ -1,4 +1,10 @@
 [
+  {
+    "itemName": "ab_reward_btn",
+    "roiFront": "1190,100,50,120",
+    "roiBack": "1190,100,50,120",
+    "description": "悬赏按钮"
+  },
   {
     "itemName": "ab_famous_btn",
     "roiFront": "1190,220,50,120",
@@ -10,5 +16,83 @@
     "roiFront": "1190,580,50,120",
     "roiBack": "1190,580,50,120",
     "description": "收藏按钮"
+  },
+  {
+    "itemName": "ab_boss_photo_1",
+    "roiFront": "940,210,95,70",
+    "roiBack": "940,210,95,70",
+    "description": "筛选中 除悬赏外 第一个boss的头像位置"
+  },
+  {
+    "itemName": "ab_boss_photo_2",
+    "roiFront": "940,365,95,70",
+    "roiBack": "940,365,95,70",
+    "description": "筛选中 除悬赏外 第二个boss的头像位置"
+  },
+  {
+    "itemName": "ab_boss_photo_3",
+    "roiFront": "940,520,95,70",
+    "roiBack": "940,520,95,70",
+    "description": "筛选中 除悬赏外 第三个boss的头像位置"
+  },
+  {
+    "itemName": "ab_boss_photo_minus_3",
+    "roiFront": "940,255,95,70",
+    "roiBack": "940,255,95,70",
+    "description": "筛选中 除悬赏外 滑动到最底部时 第一个boss的头像位置 即倒数第三个"
+  },
+  {
+    "itemName": "ab_boss_photo_minus_2",
+    "roiFront": "940,410,95,70",
+    "roiBack": "940,410,95,70",
+    "description": "筛选中 除悬赏外 滑动到最底部时 第二个boss的头像位置 即倒数第二个"
+  },
+  {
+    "itemName": "ab_boss_photo_minus_1",
+    "roiFront": "940,560,95,70",
+    "roiBack": "940,560,95,70",
+    "description": "筛选中 除悬赏外 滑动到最底部时 第三个boss的头像位置 即倒数第一个"
+  },
+  {
+    "itemName": "ab_boss_reward_photo_1",
+    "roiFront": "940,250,95,70",
+    "roiBack": "940,250,95,70",
+    "description": "筛选中 悬赏中 第一个boss的头像位置"
+  },
+  {
+    "itemName": "ab_boss_reward_photo_2",
+    "roiFront": "940,375,95,70",
+    "roiBack": "940,375,95,70",
+    "description": "筛选中 悬赏中 第二个boss的头像位置"
+  },
+  {
+    "itemName": "ab_boss_reward_photo_3",
+    "roiFront": "940,500,95,70",
+    "roiBack": "940,500,95,70",
+    "description": "筛选中 悬赏中 第三个boss的头像位置"
+  },
+  {
+    "itemName": "ab_boss_reward_photo_minus_3",
+    "roiFront": "940,335,95,70",
+    "roiBack": "940,335,95,70",
+    "description": "筛选中 悬赏中 滑动到最底部时 第一个boss的头像位置 即倒数第三个"
+  },
+  {
+    "itemName": "ab_boss_reward_photo_minus_2",
+    "roiFront": "940,460,95,70",
+    "roiBack": "940,460,95,70",
+    "description": "筛选中 悬赏中 滑动到最底部时 第二个boss的头像位置 即倒数第二个"
+  },
+  {
+    "itemName": "ab_boss_reward_photo_minus_1",
+    "roiFront": "940,585,95,70",
+    "roiBack": "940,585,95,70",
+    "description": "筛选中 悬赏中 滑动到最底部时 第三个boss的头像位置 即倒数第一个"
+  },
+  {
+    "itemName": "ab_ji_floor_selected",
+    "roiFront": "380,120,70,30",
+    "roiBack": "380,120,70,30",
+    "description": "当前选择 的极地鬼层数"
   }
 ]

+ 1 - 0
tasks/AreaBoss/config.py

@@ -16,3 +16,4 @@ class AreaBoss(ConfigBase):
     general_battle: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
     switch_soul: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
 
+

+ 5 - 0
tasks/AreaBoss/config_boss.py

@@ -5,9 +5,14 @@ from enum import Enum
 from datetime import datetime, time
 from pydantic import BaseModel, ValidationError, validator, Field
 
+
 class Boss(BaseModel):
     boss_number: int = Field(title='Boss Number',
                              default=3,
                              description='默认为3 可选[1-3], 当你设置为三时默认你拥有全部的挑战资格,会挑战热门的前三个,\n'
                                          '如果不是请将你可以挑战的boss进行收藏',
                              ge=1, le=3)
+    # 是否查找当日悬赏鬼王
+    boss_reward: bool = Field(default=False, description='boss_reward_help')
+    # 是否使用收藏的
+    use_collect: bool = Field(default=False, description='use_collect_help')

BIN
tasks/AreaBoss/res/ab_difficulty_ji.png


BIN
tasks/AreaBoss/res/ab_difficulty_normal.png


BIN
tasks/AreaBoss/res/ab_filter_title_famous.png


BIN
tasks/AreaBoss/res/ab_filter_title_reward.png


BIN
tasks/AreaBoss/res/ab_ji_floor_list_check.png


BIN
tasks/AreaBoss/res/ab_ji_floor_one.png


BIN
tasks/AreaBoss/res/ab_level_60.png


BIN
tasks/AreaBoss/res/ab_level_handle.png


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

@@ -42,7 +42,7 @@
     "roiBack": "1066,210,100,100",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "选中第一个鬼王的"
+    "description": "除悬赏外 选中第一个鬼王的"
   },
   {
     "itemName": "battle_2",
@@ -51,7 +51,7 @@
     "roiBack": "1068,364,100,100",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "选中第二个鬼王的"
+    "description": "除悬赏外 选中第二个鬼王的"
   },
   {
     "itemName": "battle_3",
@@ -60,7 +60,7 @@
     "roiBack": "1071,521,100,100",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "选中第三个鬼王的"
+    "description": "除悬赏外 选中第三个鬼王的"
   },
   {
     "itemName": "fire",
@@ -89,11 +89,29 @@
     "threshold": 0.8,
     "description": "红色关闭"
   },
+  {
+    "itemName": "ab_filter_title_reward",
+    "imageName": "ab_filter_title_reward.png",
+    "roiFront": "920,110,190,70",
+    "roiBack": "920,110,190,70",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "筛选中 选中悬赏标识"
+  },
+  {
+    "itemName": "ab_filter_title_famous",
+    "imageName": "ab_filter_title_famous.png",
+    "roiFront": "920,110,190,70",
+    "roiBack": "920,110,190,70",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "筛选中 选中热门标识"
+  },
   {
     "itemName": "ab_filter_title_collection",
     "imageName": "ab_filter_title_collection.png",
-    "roiFront": "940,110,170,70",
-    "roiBack":  "940,110,170,70",
+    "roiFront": "920,110,190,70",
+    "roiBack": "920,110,190,70",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "筛选中 选中收藏标识"
@@ -102,9 +120,63 @@
     "itemName": "ab_filter_opened",
     "imageName": "ab_filter_opened.png",
     "roiFront": "840,110,130,70",
-    "roiBack":  "840,110,130,70",
+    "roiBack": "840,110,130,70",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "筛选界面打开标识"
+  },
+  {
+    "itemName": "ab_difficulty_ji",
+    "imageName": "ab_difficulty_ji.png",
+    "roiFront": "260,100,70,70",
+    "roiBack": "260,100,70,70",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "极地鬼标识 出现此图片表明 是 极地鬼"
+  },
+  {
+    "itemName": "ab_difficulty_normal",
+    "imageName": "ab_difficulty_normal.png",
+    "roiFront": "260,100,70,70",
+    "roiBack": "260,100,70,70",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "极地鬼标识 出现此图片表明 是 普通地鬼"
+  },
+  {
+    "itemName": "ab_level_handle",
+    "imageName": "ab_level_handle.png",
+    "roiFront": "170,250,400,75",
+    "roiBack": "170,250,400,75",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "普通地鬼 更改等级 的把手"
+  },
+  {
+    "itemName": "ab_level_60",
+    "imageName": "ab_level_60.png",
+    "roiFront": "300,160,110,100",
+    "roiBack": "300,160,110,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "普通地鬼 等级为60 标志"
+  },
+  {
+    "itemName": "ab_ji_floor_list_check",
+    "imageName": "ab_ji_floor_list_check.png",
+    "roiFront": "390,150,60,290",
+    "roiBack": "390,150,60,290",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "极地鬼 层数列表打开 标志"
+  },
+    {
+    "itemName": "ab_ji_floor_one",
+    "imageName": "ab_ji_floor_one.png",
+    "roiFront": "390,150,60,290",
+    "roiBack": "390,150,60,290",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "极地鬼 一层"
   }
 ]

+ 9 - 0
tasks/AreaBoss/res/ocr.json

@@ -34,5 +34,14 @@
     "method": "Default",
     "keyword": "收藏",
     "description": "收藏"
+  },
+  {
+    "itemName": "ab_num_of_challenge",
+    "roiFront": "270,630,150,36",
+    "roiBack": "270,630,150,36",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "挑战人数"
   }
 ]

+ 248 - 20
tasks/AreaBoss/script_task.py

@@ -4,6 +4,8 @@
 import time
 
 import cv2
+import numpy as np
+import random
 from tasks.base_task import BaseTask
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.GameUi.game_ui import GameUi
@@ -14,6 +16,7 @@ from tasks.AreaBoss.assets import AreaBossAssets
 from module.logger import logger
 from module.exception import TaskEnd
 from module.atom.image import RuleImage
+from typing import List
 
 
 class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
@@ -41,15 +44,29 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         self.ui_get_current_page()
         self.ui_goto(page_area_boss)
 
-        if con.boss_number == 3:
-            self.boss(self.I_BATTLE_1)
-            self.boss(self.I_BATTLE_2)
-            self.boss(self.I_BATTLE_3)
-        elif con.boss_number == 2:
-            self.boss(self.I_BATTLE_1, collect=True)
-            self.boss(self.I_BATTLE_2, collect=True)
-        elif con.boss_number == 1:
-            self.boss(self.I_BATTLE_1, collect=True)
+        self.open_filter()
+        # 以挑战鬼王数量
+        boss_fought = 0
+        if con.boss_reward:
+            self.fight_reward_boss()
+            boss_fought += 1
+
+        self.open_filter()
+        # 切换到对应集合(热门/收藏)
+        if con.use_collect:
+            self.switch_to_collect()
+        else:
+            self.switch_to_famous()
+
+        if con.boss_number - boss_fought == 3:
+            self.boss_fight(self.I_BATTLE_1)
+            self.boss_fight(self.I_BATTLE_2)
+            self.boss_fight(self.I_BATTLE_3)
+        elif con.boss_number - boss_fought == 2:
+            self.boss_fight(self.I_BATTLE_1)
+            self.boss_fight(self.I_BATTLE_2)
+        elif con.boss_number - boss_fought == 1:
+            self.boss_fight(self.I_BATTLE_1)
 
         # 退出
         self.go_back()
@@ -73,14 +90,6 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
                 break
 
     def boss(self, battle: RuleImage, collect: bool = False):
-        def switch2mycollect():
-            while 1:
-                self.screenshot()
-                if self.appear(self.I_AB_FILTER_TITLE_COLLECTION):
-                    break
-                if self.appear(self.I_AB_FILTER_OPENED):
-                    self.click(self.C_AB_COLLECTION_BTN, 1.5)
-                    continue
 
         # 点击右上角的鬼王选择
         logger.info("Script filter")
@@ -94,7 +103,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
                 continue
 
         if collect:
-            switch2mycollect()
+            self.switch_to_collect()
         # 页面没有可挑战的BOSS
         if not (self.appear(self.I_BATTLE_1) or self.appear(self.I_BATTLE_2) or self.appear(self.I_BATTLE_3)):
             logger.error("There is no boss could be challenged")
@@ -117,13 +126,232 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         self.wait_until_appear(self.I_AB_CLOSE_RED)
         self.ui_click(self.I_AB_CLOSE_RED, self.I_FILTER)
 
+    def boss_fight(self, battle: RuleImage, ultra: bool = False) -> bool:
+        """
+            完成挑战一个鬼王的全流程
+            从打开筛选界面开始 到关闭鬼王详情界面结束
+        @param battle: 挑战按钮,鬼王头像也可,只要点击能进入详情界面
+        @type battle:
+        @param ultra: 是否需要切换到极地鬼
+        @type ultra:
+        @return:    True        挑战成功
+                    False       挑战失败
+        @rtype:
+        """
+        if not self.appear(self.I_AB_FILTER_OPENED):
+            self.open_filter()
+        self.ui_click(battle, self.I_AB_CLOSE_RED)
+
+        if ultra:
+            if not self.get_difficulty():
+                # 判断是否能切换到极地鬼
+                if not self.appear(self.I_AB_DIFFICULTY_NORMAL):
+                    self.switch_to_level_60()
+                    if not self.start_fight():
+                        logger.warning("you are so weakness!")
+                        self.wait_until_appear(self.I_AB_CLOSE_RED)
+                        self.ui_click_until_disappear(self.I_AB_CLOSE_RED, interval=1)
+                        return False
+                # 切换到 极地鬼
+                self.switch_difficulty(True)
+
+            self.switch_to_floor_1()
+        result = True
+        if not self.start_fight():
+            result = False
+            logger.warning("Area Boss Fight Failed ")
+        self.wait_until_appear(self.I_AB_CLOSE_RED)
+        self.ui_click_until_disappear(self.I_AB_CLOSE_RED, interval=1)
+        return result
+
+    def start_fight(self) -> bool:
+        while 1:
+            self.screenshot()
+            if self.appear_then_click(self.I_FIRE, interval=1):
+                continue
+            if not self.appear(self.I_AB_CLOSE_RED):  # 如果这个红色的关闭不见了才可以进行继续
+                break
+
+        return self.run_general_battle(self.config.area_boss.general_battle)
+
+    def switch_to_level_60(self):
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_AB_LEVEL_60):
+                break
+            if self.appear(self.I_AB_LEVEL_HANDLE):
+                x, y = self.I_AB_LEVEL_HANDLE.front_center()
+                self.S_AB_LEVEL_RIGHT.roi_front = (x, y, 10, 10)
+                self.swipe(self.S_AB_LEVEL_RIGHT)
+
+    def get_difficulty(self) -> bool:
+        """
+        @return:    True           极地鬼
+                    False           普通地鬼
+        @rtype: bool
+        """
+        self.screenshot()
+        return self.appear(self.I_AB_DIFFICULTY_JI)
+
+    def switch_difficulty(self, ultra: bool = True):
+        """
+            切换普通地鬼/极地鬼
+        @param ultra:  是否切换到极地鬼
+                    True        切换到极地鬼
+                    False       切换到普通地鬼
+        @type ultra:
+        """
+        _from = self.I_AB_DIFFICULTY_NORMAL if ultra else self.I_AB_DIFFICULTY_JI
+        _to = self.I_AB_DIFFICULTY_JI if ultra else self.I_AB_DIFFICULTY_NORMAL
+        while 1:
+            self.screenshot()
+            if self.appear(_to):
+                break
+            if self.appear(_from):
+                self.click(_from, interval=1)
+                continue
+
+    def switch_to_floor_1(self):
+        """
+            更改层数为一层
+        """
+        _Floor = ["壹星", "贰星", "叁星", "肆星", "伍星", "陆星", "柒星", "捌星", "玖星", "拾星"]
+        # 打开选择列表
+        self.ui_click(self.C_AB_JI_FLOOR_SELECTED, self.I_AB_JI_FLOOR_LIST_CHECK, interval=1)
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_AB_JI_FLOOR_ONE):
+                self.click(self.I_AB_JI_FLOOR_ONE)
+                break
+            self.swipe(self.S_AB_FLOOR_DOWN, interval=1)
+
+    def fight_reward_boss(self):
+        index = self.get_hot_in_reward()
+        self.open_filter()
+        # 滑动到最顶层
+        if index < 3:
+            logger.info("swipe to top")
+            for i in range(3):
+                self.swipe(self.S_AB_FILTER_DOWN)
+        #
+        if index == 0:
+            return self.boss_fight(self.C_AB_BOSS_REWARD_PHOTO_1, True)
+        elif index == 1:
+            return self.boss_fight(self.C_AB_BOSS_REWARD_PHOTO_2, True)
+        elif index == 2:
+            return self.boss_fight(self.C_AB_BOSS_REWARD_PHOTO_3, True)
+        # 保证滑动到最底部
+        for i in range(3):
+            self.swipe(self.S_AB_FILTER_UP)
+        if index == 3:
+            return self.boss_fight(self.C_AB_BOSS_REWARD_PHOTO_MINUS_2, True)
+        elif index == 4:
+            return self.boss_fight(self.C_AB_BOSS_REWARD_PHOTO_MINUS_1, True)
+
+    def get_hot_in_reward(self):
+        """
+            返回挑战人数最多的悬赏鬼王
+        @return:    index
+        @rtype:
+        """
+        self.switch_to_reward()
+        lst = []
+        num = self.get_num_challenge(self.C_AB_BOSS_REWARD_PHOTO_1)
+        lst.append(num)
+        self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
+        #
+        self.open_filter()
+        num = self.get_num_challenge(self.C_AB_BOSS_REWARD_PHOTO_2)
+        lst.append(num)
+        self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
+        #
+        self.open_filter()
+        num = self.get_num_challenge(self.C_AB_BOSS_REWARD_PHOTO_3)
+        lst.append(num)
+        self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
+        #
+        self.open_filter()
+        for i in range(random.randint(1, 3)):
+            self.swipe(self.S_AB_FILTER_UP)
+        num = self.get_num_challenge(self.C_AB_BOSS_REWARD_PHOTO_MINUS_2)
+        lst.append(num)
+        self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
+        #
+        self.open_filter()
+        for i in range(random.randint(1, 3)):
+            self.swipe(self.S_AB_FILTER_UP)
+        num = self.get_num_challenge(self.C_AB_BOSS_REWARD_PHOTO_MINUS_1)
+        lst.append(num)
+        self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
+
+        index = 0
+        num = 0
+        for idx, val in enumerate(lst):
+            if val > num:
+                index = idx
+                num = val
+        return index
+
+    def get_num_challenge(self, click_area):
+        """
+            获取鬼王挑战人数
+        @param click_area: 鬼王相应的挑战按钮
+        @type click_area:
+        @return:
+        @rtype:
+        """
+        # 如果鬼王不可挑战(未解锁),限制3次尝试打开鬼王详情界面
+        numTry = 0
+        while numTry < 3:
+            self.screenshot()
+            if self.appear(self.I_AB_CLOSE_RED):
+                break
+            if self.click(click_area, interval=2):
+                numTry += 1
+        if numTry >= 3:
+            return 0
+        return self.O_AB_NUM_OF_CHALLENGE.ocr_digit(self.device.image)
+
+    def open_filter(self):
+        logger.info("openFilter")
+        self.ui_click(self.I_FILTER, self.I_AB_FILTER_OPENED, interval=1)
+
+    def switch_to_collect(self):
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_AB_FILTER_TITLE_COLLECTION):
+                break
+            if self.appear(self.I_AB_FILTER_OPENED):
+                self.click(self.C_AB_COLLECTION_BTN, 1.5)
+                continue
+
+    def switch_to_famous(self):
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_AB_FILTER_TITLE_FAMOUS):
+                break
+            if self.appear(self.I_AB_FILTER_OPENED):
+                self.click(self.C_AB_FAMOUS_BTN, 1.5)
+                continue
+
+    def switch_to_reward(self):
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_AB_FILTER_TITLE_REWARD):
+                break
+            if self.appear(self.I_AB_FILTER_OPENED):
+                self.click(self.C_AB_REWARD_BTN, 1.5)
+                continue
+
 
 if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
 
-    c = Config('oas1')
+    c = Config('oas2')
     d = Device(c)
     t = ScriptTask(c, d)
-
+    time.sleep(3)
+    # t.switchFloor2One()
+    # t.switch2Level60()
     t.run()

+ 30 - 0
tasks/AreaBoss/swipe.json

@@ -0,0 +1,30 @@
+[
+  {
+    "itemName": "ab_filter_up",
+    "roiFront": "920,680,10,10",
+    "roiBack": "1130,230,10,10",
+    "mode": "default",
+    "description": "筛选列表 手指向上滑动"
+  },
+  {
+    "itemName": "ab_filter_down",
+    "roiFront": "1130,230,10,10",
+    "roiBack": "920,680,10,10",
+    "mode": "default",
+    "description": "筛选列表 手指向下滑动"
+  },
+  {
+    "itemName": "ab_floor_down",
+    "roiFront": "390,260,10,10",
+    "roiBack": "450,500,10,10",
+    "mode": "default",
+    "description": "极地鬼 层数列表 手指向下滑动 "
+  },
+  {
+    "itemName": "ab_level_right",
+    "roiFront": "0,0,10,10",
+    "roiBack": "570,270,10,10",
+    "mode": "default",
+    "description": "普通地鬼 等级滑轨 手指向右滑动 "
+  }
+]

+ 6 - 0
tasks/BondlingFairyland/script_task.py

@@ -39,6 +39,12 @@ class ScriptTask(GameUi, BondlingBattle, SwitchSoul, BondlingFairylandAssets):
         # 引用配置
         cong = self.config.bondling_fairyland
 
+        # 御魂切换方式一
+        if cong.switch_soul_config.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(cong.switch_soul_config.switch_group_team)
+          # 御魂切换方式二
         if cong.switch_soul_config.enable_switch_by_name:
             self.ui_get_current_page()
             self.ui_goto(page_shikigami_records)

+ 5 - 0
tasks/Component/LootStatistics/README.md

@@ -0,0 +1,5 @@
+
+
+掉落统计模块,将其作为通用战斗模块的父类
+
+

+ 17 - 0
tasks/Component/LootStatistics/assets.py

@@ -0,0 +1,17 @@
+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 LootStatisticsAssets: 
+
+
+	# Image Rule Assets
+	# 突破卷 
+	I_REALM_RAID_PASS = RuleImage(roi_front=(402,175,100,100), roi_back=(251,161,809,128), threshold=0.8, method="Template matching", file="./tasks/Component/LootStatistics/ls/ls_realm_raid_pass.png")
+
+

+ 26 - 0
tasks/Component/LootStatistics/loot_staistics.py

@@ -0,0 +1,26 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from module.atom.click import RuleClick
+from module.atom.image import RuleImage
+from module.atom.ocr import RuleOcr
+from module.base.timer import Timer
+from module.logger import logger
+
+from tasks.base_task import BaseTask
+
+
+class LootStatistics(BaseTask):
+
+    def loot_detect(self, image) -> dict:
+        """
+
+        :param image:
+        :return: 返回举例
+        {
+        "RealmRaidPass": 1,
+        }
+        """
+        return {}
+
+

+ 15 - 0
tasks/Component/LootStatistics/loots_config.py

@@ -0,0 +1,15 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+
+
+from enum import Enum
+from datetime import datetime, time
+from pydantic import BaseModel, ValidationError, validator, Field
+
+from tasks.Component.config_base import ConfigBase
+
+# 可以从这儿找
+# https://onmyoji.fandom.com/wiki/Items
+class Item(str, Enum):
+    Realm_Raid_Pass = 'RealmRaidPass'  # 突破券

+ 11 - 0
tasks/Component/LootStatistics/ls/image1.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "realm_raid_pass",
+    "imageName": "ls_realm_raid_pass.png",
+    "roiFront": "402,175,100,100",
+    "roiBack": "251,161,809,128",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "突破卷"
+  }
+]

BIN
tasks/Component/LootStatistics/ls/ls_realm_raid_pass.png


+ 5 - 5
tasks/Delegation/assets.py

@@ -33,15 +33,15 @@ class DelegationAssets:
 	# 跳过 
 	I_D_SKIP = RuleImage(roi_front=(661,518,70,39), roi_back=(661,518,70,39), threshold=0.67, method="Template matching", file="./tasks/Delegation/d/d_d_skip.png")
 	# description 
-	I_D_SELECT_1 = RuleImage(roi_front=(230,593,44,41), roi_back=(216,578,71,81), threshold=0.7, method="Template matching", file="./tasks/Delegation/d/d_d_select_1.png")
+	I_D_SELECT_1 = RuleImage(roi_front=(230,593,44,41), roi_back=(216,553,71,106), threshold=0.7, method="Template matching", file="./tasks/Delegation/d/d_d_select_1.png")
 	# description 
-	I_D_SELECT_2 = RuleImage(roi_front=(363,595,40,41), roi_back=(327,585,97,60), threshold=0.7, method="Template matching", file="./tasks/Delegation/d/d_d_select_2.png")
+	I_D_SELECT_2 = RuleImage(roi_front=(363,595,40,41), roi_back=(327,547,97,98), threshold=0.7, method="Template matching", file="./tasks/Delegation/d/d_d_select_2.png")
 	# description 
-	I_D_SELECT_3 = RuleImage(roi_front=(497,595,38,41), roi_back=(456,584,105,66), threshold=0.7, method="Template matching", file="./tasks/Delegation/d/d_d_select_3.png")
+	I_D_SELECT_3 = RuleImage(roi_front=(497,595,38,41), roi_back=(456,548,105,102), threshold=0.7, method="Template matching", file="./tasks/Delegation/d/d_d_select_3.png")
 	# description 
-	I_D_SELECT_4 = RuleImage(roi_front=(632,595,42,40), roi_back=(579,584,111,57), threshold=0.7, method="Template matching", file="./tasks/Delegation/d/d_d_select_4.png")
+	I_D_SELECT_4 = RuleImage(roi_front=(632,595,42,40), roi_back=(579,556,111,85), threshold=0.7, method="Template matching", file="./tasks/Delegation/d/d_d_select_4.png")
 	# description 
-	I_D_SELECT_5 = RuleImage(roi_front=(767,593,41,40), roi_back=(721,582,103,60), threshold=0.7, method="Template matching", file="./tasks/Delegation/d/d_d_select_5.png")
+	I_D_SELECT_5 = RuleImage(roi_front=(767,593,41,40), roi_back=(721,556,103,86), threshold=0.7, method="Template matching", file="./tasks/Delegation/d/d_d_select_5.png")
 	# 返回 
 	I_D_BACK = RuleImage(roi_front=(940,415,138,51), roi_back=(940,415,138,51), threshold=0.8, method="Template matching", file="./tasks/Delegation/d/d_d_back.png")
 

+ 5 - 5
tasks/Delegation/d/image.json

@@ -39,7 +39,7 @@
     "itemName": "d_select_1",
     "imageName": "d_d_select_1.png",
     "roiFront": "230,593,44,41",
-    "roiBack": "216,578,71,81",
+    "roiBack": "216,553,71,106",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "description"
@@ -48,7 +48,7 @@
     "itemName": "d_select_2",
     "imageName": "d_d_select_2.png",
     "roiFront": "363,595,40,41",
-    "roiBack": "327,585,97,60",
+    "roiBack": "327,547,97,98",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "description"
@@ -57,7 +57,7 @@
     "itemName": "d_select_3",
     "imageName": "d_d_select_3.png",
     "roiFront": "497,595,38,41",
-    "roiBack": "456,584,105,66",
+    "roiBack": "456,548,105,102",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "description"
@@ -66,7 +66,7 @@
     "itemName": "d_select_4",
     "imageName": "d_d_select_4.png",
     "roiFront": "632,595,42,40",
-    "roiBack": "579,584,111,57",
+    "roiBack": "579,556,111,85",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "description"
@@ -75,7 +75,7 @@
     "itemName": "d_select_5",
     "imageName": "d_d_select_5.png",
     "roiFront": "767,593,41,40",
-    "roiBack": "721,582,103,60",
+    "roiBack": "721,556,103,86",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "description"

+ 8 - 12
tasks/Dokan/assets.py

@@ -15,7 +15,7 @@ class DokanAssets:
 	C_DOKAN_RANDOM_CLICK_AREA = RuleClick(roi_front=(142,294,107,555), roi_back=(142,294,107,555), name="dokan_random_click_area")
 	# 道馆随机点击安全区域1:竂友突破信息 
 	C_DOKAN_RANDOM_CLICK_AREA1 = RuleClick(roi_front=(42,594,10,100), roi_back=(42,594,10,100), name="dokan_random_click_area1")
-	# 道馆随机点击安全区域2:切换查看队伍模式 
+	# 道馆随机点击安全区域2:切换查看队伍模式。初步测试下来这个地方最安全,除了庭院、町中、逢魔外其他各场景都可用。 
 	C_DOKAN_RANDOM_CLICK_AREA2 = RuleClick(roi_front=(1122,360,10,40), roi_back=(1122,360,10,40), name="dokan_random_click_area2")
 	# 道馆随机点击安全区域3 
 	C_DOKAN_RANDOM_CLICK_AREA3 = RuleClick(roi_front=(333,44,107,20), roi_back=(333,44,107,20), name="dokan_random_click_area3")
@@ -35,17 +35,17 @@ class DokanAssets:
 	# 是否已经成功进入道馆,上面中间的“道馆突破”文字 
 	I_RYOU_DOKAN_CHECK = RuleImage(roi_front=(567,15,144,42), roi_back=(567,15,144,42), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_check.png")
 	# 优先攻击选项 
-	I_RYOU_DOKAN_ATTACK_PRIORITY = RuleImage(roi_front=(567,15,144,42), roi_back=(567,15,144,42), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_attack_priority.png")
+	I_RYOU_DOKAN_ATTACK_PRIORITY = RuleImage(roi_front=(666,672,58,25), roi_back=(666,672,58,25), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_priority.png")
 	# 优先攻击: 见习 
-	I_RYOU_DOKAN_ATTACK_PRIORITY_0 = RuleImage(roi_front=(98,170,94,43), roi_back=(98,170,94,43), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_attack_priority_0.png")
+	I_RYOU_DOKAN_ATTACK_PRIORITY_0 = RuleImage(roi_front=(98,170,94,43), roi_back=(98,170,94,43), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_priority_0.png")
 	# 优先攻击: 初级 
-	I_RYOU_DOKAN_ATTACK_PRIORITY_1 = RuleImage(roi_front=(342,175,96,42), roi_back=(342,175,96,42), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_attack_priority_1.png")
+	I_RYOU_DOKAN_ATTACK_PRIORITY_1 = RuleImage(roi_front=(342,175,96,42), roi_back=(342,175,96,42), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_priority_1.png")
 	# 优先攻击: 中级 
-	I_RYOU_DOKAN_ATTACK_PRIORITY_2 = RuleImage(roi_front=(585,175,89,35), roi_back=(585,175,89,35), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_attack_priority_2.png")
+	I_RYOU_DOKAN_ATTACK_PRIORITY_2 = RuleImage(roi_front=(585,175,89,35), roi_back=(585,175,89,35), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_priority_2.png")
 	# 优先攻击: 高级 
-	I_RYOU_DOKAN_ATTACK_PRIORITY_3 = RuleImage(roi_front=(830,175,88,41), roi_back=(830,175,88,41), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_attack_priority_3.png")
+	I_RYOU_DOKAN_ATTACK_PRIORITY_3 = RuleImage(roi_front=(830,175,88,41), roi_back=(830,175,88,41), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_priority_3.png")
 	# 优先攻击: 黑脸 
-	I_RYOU_DOKAN_ATTACK_PRIORITY_4 = RuleImage(roi_front=(1072,178,94,39), roi_back=(1072,178,94,39), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_attack_priority_4.png")
+	I_RYOU_DOKAN_ATTACK_PRIORITY_4 = RuleImage(roi_front=(1072,178,94,39), roi_back=(1072,178,94,39), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_priority_4.png")
 	# 状态:集结等待中。检查右下角的挑战是不是灰色的。FIXME 黄色和灰色的挑战截图总是傻傻分不清,先改用OCR 
 	I_RYOU_DOKAN_GATHERING = RuleImage(roi_front=(653,76,46,26), roi_back=(653,76,46,26), threshold=0.85, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_gathering.png")
 	# 状态:检查右下角有没有挑战?通常是失败了,并退出来到集结界面,可重新开始点击右下角挑战进入战斗 
@@ -66,10 +66,6 @@ class DokanAssets:
 	I_RYOU_DOKAN_BATTLE_OVER = RuleImage(roi_front=(571,503,106,49), roi_back=(571,503,106,49), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_battle_over.png")
 	# 状态:战斗中,左上角的加油图标 
 	I_RYOU_DOKAN_FIGHTING = RuleImage(roi_front=(232,36,42,19), roi_back=(232,36,42,19), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_fighting.png")
-	# 状态:加油中,左下角有鼓 
-	I_RYOU_DOKAN_CHEERING = RuleImage(roi_front=(68,597,69,33), roi_back=(68,597,69,33), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_cheering.png")
-	# 状态:加油中,左下角有鼓,灰色的鼓 
-	I_RYOU_DOKAN_CHEERING_GRAY = RuleImage(roi_front=(59,600,81,38), roi_back=(59,600,81,38), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_cheering_gray.png")
 	# 状态:道馆已经结束 
 	I_RYOU_DOKAN_FINISHED = RuleImage(roi_front=(658,649,91,27), roi_back=(658,649,91,27), threshold=0.8, method="Template matching", file="./tasks/Dokan/res/res_ryou_dokan_finished.png")
 	# 状态:道馆挑战失败,投票NO 
@@ -88,7 +84,7 @@ class DokanAssets:
 
 	# List Rule Assets
 	# 这个是当前活跃的竂活动列表界面 
-	L_LAYER_LIST = RuleList(folder="./tasks/Dokan/res", direction="vertical", mode="ocr", roi_back=(35,157,37,250), size=(42, 27), 
+	L_RYOU_ACTIVITY_LIST = RuleList(folder="./tasks/Dokan/res", direction="vertical", mode="ocr", roi_back=(35,157,37,250), size=(42, 27), 
 					 array=["道馆", "首领", "狭间"])
 
 

+ 1 - 1
tasks/Dokan/res/click.json

@@ -15,7 +15,7 @@
     "itemName": "dokan_random_click_area2",
     "roiFront": "1122,360,10,40",
     "roiBack": "1122,360,10,40",
-    "description": "道馆随机点击安全区域2:切换查看队伍模式"
+    "description": "道馆随机点击安全区域2:切换查看队伍模式。初步测试下来这个地方最安全,除了庭院、町中、逢魔外其他各场景都可用。"
   },
   {
     "itemName": "dokan_random_click_area3",

+ 8 - 26
tasks/Dokan/res/image.json

@@ -46,16 +46,16 @@
   },
   {
     "itemName": "ryou_dokan_attack_priority",
-    "imageName": "res_ryou_dokan_attack_priority.png",
-    "roiFront": "567,15,144,42",
-    "roiBack": "567,15,144,42",
+    "imageName": "res_ryou_dokan_priority.png",
+    "roiFront": "666,672,58,25",
+    "roiBack": "666,672,58,25",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "优先攻击选项"
   },
   {
     "itemName": "ryou_dokan_attack_priority_0",
-    "imageName": "res_ryou_dokan_attack_priority_0.png",
+    "imageName": "res_ryou_dokan_priority_0.png",
     "roiFront": "98,170,94,43",
     "roiBack": "98,170,94,43",
     "method": "Template matching",
@@ -64,7 +64,7 @@
   },
   {
     "itemName": "ryou_dokan_attack_priority_1",
-    "imageName": "res_ryou_dokan_attack_priority_1.png",
+    "imageName": "res_ryou_dokan_priority_1.png",
     "roiFront": "342,175,96,42",
     "roiBack": "342,175,96,42",
     "method": "Template matching",
@@ -73,7 +73,7 @@
   },
   {
     "itemName": "ryou_dokan_attack_priority_2",
-    "imageName": "res_ryou_dokan_attack_priority_2.png",
+    "imageName": "res_ryou_dokan_priority_2.png",
     "roiFront": "585,175,89,35",
     "roiBack": "585,175,89,35",
     "method": "Template matching",
@@ -82,7 +82,7 @@
   },
   {
     "itemName": "ryou_dokan_attack_priority_3",
-    "imageName": "res_ryou_dokan_attack_priority_3.png",
+    "imageName": "res_ryou_dokan_priority_3.png",
     "roiFront": "830,175,88,41",
     "roiBack": "830,175,88,41",
     "method": "Template matching",
@@ -91,7 +91,7 @@
   },
   {
     "itemName": "ryou_dokan_attack_priority_4",
-    "imageName": "res_ryou_dokan_attack_priority_4.png",
+    "imageName": "res_ryou_dokan_priority_4.png",
     "roiFront": "1072,178,94,39",
     "roiBack": "1072,178,94,39",
     "method": "Template matching",
@@ -193,24 +193,6 @@
     "threshold": 0.8,
     "description": "状态:战斗中,左上角的加油图标"
   },
-  {
-    "itemName": "ryou_dokan_cheering",
-    "imageName": "res_ryou_dokan_cheering.png",
-    "roiFront": "68,597,69,33",
-    "roiBack": "68,597,69,33",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "状态:加油中,左下角有鼓"
-  },
-  {
-    "itemName": "ryou_dokan_cheering_gray",
-    "imageName": "res_ryou_dokan_cheering_gray.png",
-    "roiFront": "59,600,81,38",
-    "roiBack": "59,600,81,38",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "状态:加油中,左下角有鼓,灰色的鼓"
-  },
   {
     "itemName": "ryou_dokan_finished",
     "imageName": "res_ryou_dokan_finished.png",

+ 1 - 1
tasks/Dokan/res/list.json

@@ -1,5 +1,5 @@
 {
-    "name": "layer_list",
+    "name": "ryou_activity_list",
     "direction": "vertical",
     "type": "ocr",
     "roiBack": "35,157,37,250",

+ 31 - 32
tasks/Dokan/script_task.py

@@ -72,11 +72,11 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DokanAssets):
 
     @cached_property
     def _attack_priorities(self) -> list:
-        return [self.I_RYOU_DOKAN_PRIORITY_0,
-                self.I_RYOU_DOKAN_PRIORITY_1,
-                self.I_RYOU_DOKAN_PRIORITY_2,
-                self.I_RYOU_DOKAN_PRIORITY_3,
-                self.I_RYOU_DOKAN_PRIORITY_4]
+        return [self.I_RYOU_DOKAN_ATTACK_PRIORITY_0,
+                self.I_RYOU_DOKAN_ATTACK_PRIORITY_1,
+                self.I_RYOU_DOKAN_ATTACK_PRIORITY_2,
+                self.I_RYOU_DOKAN_ATTACK_PRIORITY_3,
+                self.I_RYOU_DOKAN_ATTACK_PRIORITY_4]
 
     def run(self):
         """ 道馆主函数
@@ -137,44 +137,45 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DokanAssets):
 
             # 场景状态:道馆集结中
             if current_scene == DokanScene.RYOU_DOKAN_SCENE_GATHERING:
-                logger.debug(f"Ryou DOKAN gathering, 集结中...")
+                logger.debug(f"Ryou DOKAN gathering...")
                 # 如果还未选择优先攻击,选一下
                 if not self.attack_priority_selected:
                     self.dokan_choose_attack_priority(attack_priority=attack_priority)
                     self.attack_priority_selected = True
+                    continue
             # 场景状态:等待馆主战开始
             elif current_scene == DokanScene.RYOU_DOKAN_SCENE_BOSS_WAITING:
                 logger.debug(f"Ryou DOKAN boss battle waiting...")
             # 场景状态:检查右下角有没有挑战?通常是失败了,并退出来到集结界面,可重新开始点击右下角挑战进入战斗
             elif current_scene == DokanScene.RYOU_DOKAN_SCENE_START_CHALLENGE:
-                self.appear_then_click(self.I_RYOU_DOKAN_START_CHALLENGE)
+                self.appear_then_click(self.I_RYOU_DOKAN_START_CHALLENGE, interval=1.2)
             # 场景状态:进入战斗,待开始
             elif current_scene == DokanScene.RYOU_DOKAN_SCENE_IN_FIELD:
                 # 战斗
                 success = self.dokan_battle(cfg)
                 # 战斗结束后,随便点三下,确保跳过各种结算画面
-                self.click(click=self.C_DOKAN_READY_FOR_BATLLE, interval=1.5)
+                self.click(click=self.C_DOKAN_READY_FOR_BATTLE, interval=1.5)
                 self.click(click=self.C_DOKAN_RANDOM_CLICK_AREA2, interval=2.2)
                 self.click(click=self.C_DOKAN_RANDOM_CLICK_AREA3, interval=1.8)
                 # 每次战斗结束都重置绿标
                 self.green_mark_done = False
             # 场景状态:如果CD中,开始加油
             elif current_scene == DokanScene.RYOU_DOKAN_SCENE_CD:
-                logger.info(f"CD中,是否加油:{cfg.dokan_config.dokan_auto_cheering_while_cd}..")
+                logger.info(f"Fail CD: start cheering={cfg.dokan_config.dokan_auto_cheering_while_cd}..")
                 if cfg.dokan_config.dokan_auto_cheering_while_cd:
                     self.start_cheering()
             # 场景状态:战斗中,左上角的加油图标
             elif current_scene == DokanScene.RYOU_DOKAN_SCENE_FIGHTING:
-                logger.info("战斗进行中")
-            # 场景状态:加油中
-            elif current_scene == DokanScene.RYOU_DOKAN_SCENE_CHEERING:
-                self.appear_then_click(self.I_RYOU_DOKAN_CHEERING)
+                logger.info("Battle undergoing")
+            # # 场景状态:加油中
+            # elif current_scene == DokanScene.RYOU_DOKAN_SCENE_CHEERING:
+            #     self.appear_then_click(self.I_RYOU_DOKAN_CHEERING)
             # 场景状态:道馆已经结束
             elif current_scene == DokanScene.RYOU_DOKAN_SCENE_FINISHED:
-                logger.info("道馆已经结束,退出")
+                logger.info("Dokan challenge finished, exit Dokan")
                 break
             elif current_scene == DokanScene.RYOU_DOKAN_SCENE_FAILED_VOTE_NO:
-                logger.info("道馆挑战失败:投票保留")
+                logger.info("Dokan challenge failed: vote for keep the awards")
             else:
                 logger.info(f"unknown scene, skipped")
 
@@ -210,30 +211,29 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DokanAssets):
         # 更换队伍
         if not self.team_switched:
             logger.info(
-                f"更换队伍: config.preset_enable={config.preset_enable}, config.preset_group={config.preset_group}, config.preset_team={config.preset_team}")
+                f"switch team preset: enable={config.preset_enable}, preset_group={config.preset_group}, preset_team={config.preset_team}")
             self.switch_preset_team(config.preset_enable, config.preset_group, config.preset_team)
             self.team_switched = True
             # 切完队伍后有时候会卡顿,先睡一觉,防止快速跳到绿标流程,导致未能成功绿标
             time.sleep(3)
 
         # 等待准备按钮的出现
-        logger.debug("等待准备按钮的出现")
         self.wait_until_appear(self.I_PREPARE_HIGHLIGHT)
 
         # 点击准备
         if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.5):
-            logger.info("点击准备")
+            logger.info("Prepare")
 
             # 绿标式神, should we check there's a green marked role?
             if not self.green_mark_done and self.is_in_battle(False):
                 logger.info(
-                    f"绿标式神:config.green_enable={config.green_enable}, config.green_mark={config.green_mark}")
+                    f"green mark: enable={config.green_enable}, green_mark={config.green_mark}")
                 self.green_mark(config.green_enable, config.green_mark)
                 self.green_mark_done = True
 
         # 等待战斗结果
-        logger.info(f"等待战斗结果:config.random_click_swipt_enable={config.random_click_swipt_enable}")
-        logger.info("come on baby, let's go.")
+        # logger.info(f"等待战斗结果:config.random_click_swipt_enable={config.random_click_swipt_enable}")
+        # logger.info("come on baby, let's go.")
 
         while 1:
             # logger.info("take a nap")
@@ -246,7 +246,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DokanAssets):
 
             # 如果出现赢 就点击
             if self.appear(GeneralBattle.I_WIN, threshold=0.8):
-                logger.info("道馆的小朋友们打完了,boss is on the way")
+                logger.info("Dokan guards eliminated, boss is on the way")
                 win = True
                 break
 
@@ -284,7 +284,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DokanAssets):
 
             continue
 
-        logger.info(f"输赢:{win}")
+        logger.info(f"Win: {win}")
         if win:
             return True
         else:
@@ -297,7 +297,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DokanAssets):
         logger.hr('Try to choose attack priority')
         max_try = 5
 
-        if not self.appear_then_click(self.I_RYOU_DOKAN_PRIORITY, interval=2):
+        if not self.appear_then_click(self.I_RYOU_DOKAN_ATTACK_PRIORITY, interval=2):
             logger.error(f"can not find dokan priority option button, choose attack priority process skipped")
             return False
 
@@ -411,7 +411,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DokanAssets):
         try_count = 0
         while try_count < 5:
             # 点击进入道馆
-            logger.info("进入阴阳竂")
+            logger.info("Entering Ryou")
             self.ui_goto(page_guild)
             # 查找道馆
             activity = "道馆"
@@ -424,11 +424,9 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DokanAssets):
                 time.sleep(2)
                 image = self.screenshot()
 
-                # O_DOKAN_MAP = RuleOcr(roi=(270,130,740,460), area=(270,130,740,460), mode="Full", method="Default", keyword="万", name="dokan_map")
-                # image = cv2.imread("g:/yys/oas/tests/2.png")
                 pos = self.O_DOKAN_MAP.ocr_full(image)
                 if pos == (0, 0, 0, 0):
-                    logger.info("failed to find {self.O_DOKAN_MAP.keyword}")
+                    logger.info(f"failed to find {self.O_DOKAN_MAP.keyword}")
                 else:
                     # 取中间
                     x = pos[0] + pos[2] / 2
@@ -480,10 +478,11 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DokanAssets):
         # 状态:达到失败次数,CD中
         if self.appear(self.I_RYOU_DOKAN_CD, threshold=0.8):
             return True, DokanScene.RYOU_DOKAN_SCENE_CD
-        # 状态:加油中,左下角有鼓
-        if self.appear_then_click(self.I_RYOU_DOKAN_CHEERING, threshold=0.8) or self.appear(
-                self.I_RYOU_DOKAN_CHEERING_GRAY, threshold=0.8):
-            return True, DokanScene.RYOU_DOKAN_SCENE_CHEERING
+        
+        # # 状态:加油中,左下角有鼓
+        # if self.appear_then_click(self.I_RYOU_DOKAN_CHEERING, threshold=0.8) or self.appear(
+        #         self.I_RYOU_DOKAN_CHEERING_GRAY, threshold=0.8):
+        #     return True, DokanScene.RYOU_DOKAN_SCENE_CHEERING
         # # 状态:战斗中,左上角的加油图标
         # if self.appear(self.I_RYOU_DOKAN_FIGHTING, threshold=0.8):
         #     return True, DokanScene.RYOU_DOKAN_SCENE_FIGHTING

+ 6 - 0
tasks/Exploration/assets.py

@@ -68,6 +68,8 @@ class ExplorationAssets:
 	I_RED_CLOSE = RuleImage(roi_front=(1027,129,41,42), roi_back=(1021,121,54,55), threshold=0.6, method="Template matching", file="./tasks/Exploration/res/res_red_close.png")
 	# description 
 	I_E_EXIT_CONFIRM = RuleImage(roi_front=(694,380,163,49), roi_back=(694,380,163,49), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_e_exit_confirm.png")
+	# 宝箱 
+	I_TREASURE_BOX_CLICK = RuleImage(roi_front=(33,476,70,49), roi_back=(2,130,135,406), threshold=0.7, method="Template matching", file="./tasks/Exploration/res/res_treasure_box_click.png")
 
 
 	# Ocr Rule Assets
@@ -75,6 +77,10 @@ class ExplorationAssets:
 	O_E_EXPLORATION_LEVEL_NUMBER = RuleOcr(roi=(1079,193,147,467), area=(1079,193,147,467), mode="Full", method="Default", keyword="", name="e_exploration_level_number")
 	# 候补出战的数量 
 	O_E_ALTERNATE_NUMBER = RuleOcr(roi=(1092,122,69,32), area=(1092,122,69,32), mode="DigitCounter", method="Default", keyword="", name="e_alternate_number")
+	# 探索右上角 突破卷的数量 
+	O_REALM_RAID_NUMBER = RuleOcr(roi=(739,11,78,37), area=(739,11,78,37), mode="DigitCounter", method="Default", keyword="", name="realm_raid_number")
+	# (点出困难28时候)探索右上角 突破卷的数量 
+	O_REALM_RAID_NUMBER1 = RuleOcr(roi=(936,10,82,36), area=(936,10,82,36), mode="DigitCounter", method="Default", keyword="", name="realm_raid_number1")
 
 
 	# Swipe Rule Assets

+ 12 - 4
tasks/Exploration/config.py

@@ -2,7 +2,7 @@ from pydantic import BaseModel, Field
 from enum import Enum
 from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
 from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
-from tasks.Component.config_base import ConfigBase
+from tasks.Component.config_base import ConfigBase, TimeDelta
 from tasks.Component.config_scheduler import Scheduler
 
 
@@ -60,16 +60,23 @@ class ChooseRarity(str, Enum):
     S = '素材'
 
 
+class Scrolls(BaseModel):
+    # 绘卷模式
+    scrolls_enable: bool = Field(title='绘卷模式', default=False, description='绘卷模式')
+    scrolls_cd: TimeDelta = Field(title='间隔时间', default=TimeDelta(hours=0, minutes=30, seconds=0), description='间隔时间')
+    scrolls_threshold: int = Field(title='突破票数量', default='25', description='突破票数量,超过打突破')
+
+
 class ExplorationConfig(BaseModel):
     buff_gold_50_click: bool = Field(default=False)
     buff_gold_100_click: bool = Field(default=False)
     buff_exp_50_click: bool = Field(default=False)
     buff_exp_100_click: bool = Field(default=False)
 
-    attack_number: AttackNumber = Field(title='探索次数', default=AttackNumber.SEVEN,
-                                        description='默认探索7次')
+    # attack_number: AttackNumber = Field(title='探索次数', default=AttackNumber.SEVEN,
+    #                                     description='默认探索7次')
 
-    current_exploration_times: str = Field(default='0', description='探索次数')
+    current_exploration_count: int = Field(title='探索次数', default='7', description='默认探索7次')
 
     exploration_level: ExplorationLevel = Field(title='探索等级', default=ExplorationLevel.EXPLORATION_28,
                                                 description='探索等级 默认二十八')
@@ -86,6 +93,7 @@ class ExplorationConfig(BaseModel):
 class Exploration(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     exploration_config: ExplorationConfig = Field(default_factory=ExplorationConfig)
+    scrolls: Scrolls = Field(default_factory=Scrolls)
     general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
     switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
     # auto_rotate_after_times: str = Field(default='30', description='探索30次后, 检测是否需要添加候补式神')

+ 9 - 0
tasks/Exploration/res/image.json

@@ -169,5 +169,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "treasure_box_click",
+    "imageName": "res_treasure_box_click.png",
+    "roiFront": "33,476,70,49",
+    "roiBack": "2,130,135,406",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "宝箱"
   }
 ]

+ 18 - 0
tasks/Exploration/res/ocr.json

@@ -16,5 +16,23 @@
     "method": "Default",
     "keyword": "",
     "description": "候补出战的数量"
+  },
+  {
+    "itemName": "realm_raid_number",
+    "roiFront": "739,11,78,37",
+    "roiBack": "739,11,78,37",
+    "mode": "DigitCounter",
+    "method": "Default",
+    "keyword": "",
+    "description": "探索右上角 突破卷的数量"
+  },
+  {
+    "itemName": "realm_raid_number1",
+    "roiFront": "936,10,82,36",
+    "roiBack": "936,10,82,36",
+    "mode": "DigitCounter",
+    "method": "Default",
+    "keyword": "",
+    "description": "(点出困难28时候)探索右上角 突破卷的数量"
   }
 ]

BIN
tasks/Exploration/res/res_treasure_box_click.png


+ 49 - 4
tasks/Exploration/script_task.py

@@ -2,6 +2,7 @@
 # @author runhey
 # github https://github.com/runhey
 import time
+from datetime import timedelta, datetime
 
 from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 from tasks.Exploration.assets import ExplorationAssets
@@ -9,6 +10,7 @@ from tasks.Exploration.config import ChooseRarity, AutoRotate, AttackNumber
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.page import page_exploration, page_shikigami_records, page_main
+from tasks.RealmRaid.script_task import ScriptTask as RealmRaidScriptTask
 
 from module.logger import logger
 from module.exception import RequestHumanTakeover, TaskEnd
@@ -65,17 +67,32 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, ExplorationAssets):
             logger.critical(f'Not find {explorationConfig.exploration_config.exploration_level} or'
                             f' Enter {explorationConfig.exploration_config.exploration_level} failed!')
             raise RequestHumanTakeover
+        con_scrolls = self.config.exploration.scrolls
+        # 判断是否绘卷模式,设置探索次数
+        if con_scrolls.scrolls_enable:
+            exploration_count = 50
+        else:
+            exploration_count = explorationConfig.exploration_config.current_exploration_count
 
-        # 只探索7次
-        if explorationConfig.exploration_config.attack_number == AttackNumber.SEVEN:
+        logger.info("exploration_count:" + str(exploration_count))
+        if exploration_count > 0:
             count = 0
-            while count < 7:
+            while count < exploration_count:
                 if self.wait_until_appear(self.I_E_EXPLORATION_CLICK, wait_time=1):
+                    # 绘卷模式
+                    self.activate_realm_raid(con_scrolls,con)
+
                     self.click(self.I_E_EXPLORATION_CLICK)
                     count += 1
+                    logger.info("exploration count :" + str(count))
                     # 进入战斗环节
                     self.battle_process()
-                if self.appear(self.I_EXPLORATION_TITLE):
+                # 判断宝箱
+                if self.appear(self.I_TREASURE_BOX_CLICK):
+                    self.click(self.I_TREASURE_BOX_CLICK)
+                    self.open_expect_level()
+                # 判断妖气
+                elif self.appear(self.I_EXPLORATION_TITLE):
                     self.open_expect_level()
 
             if self.wait_until_appear(self.I_RED_CLOSE, wait_time=2):
@@ -253,6 +270,34 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, ExplorationAssets):
         # 进入战斗环节
         self.do_battle()
 
+    def activate_realm_raid(self, con_scrolls, con) -> None:
+        # 判断是否开启突破票检测
+        if not con_scrolls.scrolls_enable:
+            return
+        self.screenshot()
+        cu, res, total = self.O_REALM_RAID_NUMBER1.ocr(self.device.image)
+        # 判断突破票数量
+        if cu < con_scrolls.scrolls_threshold:
+            return
+
+        # 关闭加成
+        self.appear_then_click(self.I_RED_CLOSE)
+        self.ui_goto(page_main)
+        if con.buff_gold_50_click or con.buff_gold_100_click or con.buff_exp_50_click or con.buff_exp_100_click:
+            self.open_buff()
+            self.gold_50(is_open=False)
+            self.gold_100(is_open=False)
+            self.exp_50(is_open=False)
+            self.exp_100(is_open=False)
+            self.close_buff()
+
+        # 设置下次执行行时间
+        logger.info("RealmRaid and Exploration  set_next_run !")
+        next_run = datetime.now() + con_scrolls.scrolls_cd
+        self.set_next_run(task='Exploration', success=False, finish=False, target=next_run)
+        self.set_next_run(task='RealmRaid', success=False, finish=False, target=datetime.now())
+        raise TaskEnd
+
 
 if __name__ == "__main__":
     from module.config.config import Config

+ 2 - 2
tasks/FloatParade/assets.py

@@ -18,7 +18,7 @@ class FloatParadeAssets:
 	# description 
 	I_FP_RED_POINT0 = RuleImage(roi_front=(1242,604,22,21), roi_back=(1225,585,53,54), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_red_point0.png")
 	# description 
-	I_FP_GETALL1 = RuleImage(roi_front=(1194,539,60,61), roi_back=(1167,520,100,100), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_getall1.png")
+	I_FP_GETALL1 = RuleImage(roi_front=(1196,544,53,54), roi_back=(1159,489,113,164), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_getall1.png")
 	# description 
 	I_FP_RED_POINT1 = RuleImage(roi_front=(1249,155,21,21), roi_back=(1223,138,56,62), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_red_point1.png")
 	# description 
@@ -33,7 +33,7 @@ class FloatParadeAssets:
 	I_FP_TASKS = RuleImage(roi_front=(1175,617,79,76), roi_back=(1162,605,100,100), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_tasks.png")
 	# 升级 
 	I_FP_UPGRADE = RuleImage(roi_front=(1075,75,116,49), roi_back=(1040,52,169,100), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_upgrade.png")
-	# description 
+	# 红色关闭 
 	I_FP_RED_CLOSE = RuleImage(roi_front=(1170,109,43,44), roi_back=(1157,101,72,62), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_red_close.png")
 
 

BIN
tasks/FloatParade/fp/fp_fp_getall1.png


+ 2 - 2
tasks/FloatParade/fp/image.json

@@ -29,8 +29,8 @@
   {
     "itemName": "fp_getall1",
     "imageName": "fp_fp_getall1.png",
-    "roiFront": "1194,539,60,61",
-    "roiBack": "1167,520,100,100",
+    "roiFront": "1196,544,53,54",
+    "roiBack": "1159,489,113,164",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"

+ 1 - 1
tasks/Hunt/assets.py

@@ -12,7 +12,7 @@ class HuntAssets:
 
 	# Click Rule Assets
 	# description 
-	C_HUNT_ENTER = RuleClick(roi_front=(1059,600,193,100), roi_back=(1059,600,193,100), name="hunt_enter")
+	C_HUNT_ENTER = RuleClick(roi_front=(1090,597,94,59), roi_back=(1090,597,94,59), name="hunt_enter")
 
 
 	# Image Rule Assets

+ 2 - 2
tasks/Hunt/hunt/click.json

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "hunt_enter",
-    "roiFront": "1059,600,193,100",
-    "roiBack": "1059,600,193,100",
+    "roiFront": "1090,597,94,59",
+    "roiBack": "1090,597,94,59",
     "description": "description"
   }
 ]

BIN
tasks/Hunt/kirin/kirin_kirin_challage.png


+ 7 - 4
tasks/Hunt/script_task.py

@@ -28,10 +28,13 @@ class ScriptTask(GameUi, GeneralBattle, GeneralInvite, SwitchSoul, HuntAssets):
         if con.kirin_group_team != '-1,-1' or con.netherworld_group_team != '-1,-1':
             self.ui_get_current_page()
             self.ui_goto(page_shikigami_records)
-            if con.kirin_group_team != '-1,-1':
-                self.run_switch_soul(con.kirin_group_team)
-            if con.netherworld_group_team != '-1,-1':
-                self.run_switch_soul(con.netherworld_group_team)
+
+            if self.kirin_day:
+                if con.kirin_group_team != '-1,-1':
+                    self.run_switch_soul(con.kirin_group_team)
+            else:
+                if con.netherworld_group_team != '-1,-1':
+                    self.run_switch_soul(con.netherworld_group_team)
         self.ui_get_current_page()
         self.ui_goto(page_hunt)
 

+ 26 - 23
tasks/Restart/login.py

@@ -152,29 +152,32 @@ class LoginHandler(BaseTask, RestartAssets):
                 timer_harvest.reset()
                 continue
             # 邮件
-            if self.appear_then_click(self.I_HARVEST_MAIL, interval=1.2):
-                timer_harvest.reset()
-                continue
-            if self.appear(self.I_HARVEST_MAIL_TITLE, interval=0.2):
-                while 1:
-                    self.screenshot()
-                    if self.appear_then_click(self.I_HARVEST_MAIL_ALL, interval=2):
-                        timer_harvest.reset()
-                        pass
-                    if self.appear_then_click(self.I_HARVEST_MAIL_CONFIRM, interval=1):
-                        continue
-
-                    # 如果一直出现收取全部,那就说明还在进行中
-                    if self.appear(self.I_HARVEST_MAIL_ALL):
-                        pass
-                    # 如果没有出现 ‘收取全部’ 也没有出现 ‘还未读的邮件’ 那就可以退出了
-                    if not self.appear(self.I_HARVEST_MAIL_ALL) and not self.appear(self.I_HARVEST_MAIL_OPEN):
-                        logger.info('Mail has been harvested')
-                        logger.info('Exit mail')
-                        break
-                    if self.appear_then_click(self.I_HARVEST_MAIL_OPEN, interval=1):
-                        timer_harvest.reset()
-                        continue
+            # 判断是否勾选了收取邮件(不收取邮件可以查看每日收获)
+            if self.config.restart.harvest_config.enable_mail:
+
+                if self.appear_then_click(self.I_HARVEST_MAIL, interval=1.2):
+                    timer_harvest.reset()
+                    continue
+                if self.appear(self.I_HARVEST_MAIL_TITLE, interval=0.2):
+                    while 1:
+                        self.screenshot()
+                        if self.appear_then_click(self.I_HARVEST_MAIL_ALL, interval=2):
+                            timer_harvest.reset()
+                            pass
+                        if self.appear_then_click(self.I_HARVEST_MAIL_CONFIRM, interval=1):
+                            continue
+
+                        # 如果一直出现收取全部,那就说明还在进行中
+                        if self.appear(self.I_HARVEST_MAIL_ALL):
+                            pass
+                        # 如果没有出现 ‘收取全部’ 也没有出现 ‘还未读的邮件’ 那就可以退出了
+                        if not self.appear(self.I_HARVEST_MAIL_ALL) and not self.appear(self.I_HARVEST_MAIL_OPEN):
+                            logger.info('Mail has been harvested')
+                            logger.info('Exit mail')
+                            break
+                        if self.appear_then_click(self.I_HARVEST_MAIL_OPEN, interval=1):
+                            timer_harvest.reset()
+                            continue
             # 体力
             if self.appear_then_click(self.I_HARVEST_AP, interval=1, threshold=0.7):
                 timer_harvest.reset()

+ 7 - 7
tasks/RichMan/assets.py

@@ -185,7 +185,7 @@ class RichManAssets:
 	# 勋章 
 	I_SIDE_SURE_MEDAL = RuleImage(roi_front=(1190,375,39,62), roi_back=(1156,352,99,113), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_sure_medal.png")
 	# 勋章 
-	I_SIDE_CHECK_MEDAL = RuleImage(roi_front=(889,11,40,44), roi_back=(889,11,40,44), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_medal.png")
+	I_SIDE_CHECK_MEDAL = RuleImage(roi_front=(665,6,40,44), roi_back=(453,1,476,58), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_medal.png")
 	# 魅力值 
 	I_SIDE_SURE_CHARISMA = RuleImage(roi_front=(1181,467,59,58), roi_back=(1158,445,101,106), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_sure_charisma.png")
 	# 魅力值 
@@ -234,17 +234,17 @@ class RichManAssets:
 	# 永生之海 
 	I_SCA_PICTURE_BOOK = RuleImage(roi_front=(995,258,100,100), roi_back=(995,258,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_picture_book.png")
 	# 土蜘蛛 
-	I_SCA_DEMON_BOSS_1 = RuleImage(roi_front=(209,168,192,193), roi_back=(168,142,346,290), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_1.png")
+	I_SCA_DEMON_BOSS_1 = RuleImage(roi_front=(246,224,112,126), roi_back=(168,142,346,290), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_1.png")
 	# 胧车 
-	I_SCA_DEMON_BOSS_2 = RuleImage(roi_front=(457,158,180,198), roi_back=(413,136,273,250), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_2.png")
+	I_SCA_DEMON_BOSS_2 = RuleImage(roi_front=(457,203,123,153), roi_back=(413,136,273,250), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_2.png")
 	# 荒骷髅 
-	I_SCA_DEMON_BOSS_3 = RuleImage(roi_front=(687,178,181,175), roi_back=(631,132,344,273), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_3.png")
+	I_SCA_DEMON_BOSS_3 = RuleImage(roi_front=(686,239,131,121), roi_back=(631,132,344,273), threshold=0.6, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_3.png")
 	# 地震鲶 
-	I_SCA_DEMON_BOSS_4 = RuleImage(roi_front=(883,162,188,211), roi_back=(804,121,315,292), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_4.png")
+	I_SCA_DEMON_BOSS_4 = RuleImage(roi_front=(912,188,141,169), roi_back=(804,121,315,292), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_4.png")
 	# 蜃气楼 
-	I_SCA_DEMON_BOSS_5 = RuleImage(roi_front=(326,425,211,218), roi_back=(241,414,504,242), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_5.png")
+	I_SCA_DEMON_BOSS_5 = RuleImage(roi_front=(345,469,136,160), roi_back=(241,414,504,242), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_5.png")
 	# 歌姬 
-	I_SCA_DEMON_BOSS_6 = RuleImage(roi_front=(561,432,178,189), roi_back=(437,401,555,236), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_6.png")
+	I_SCA_DEMON_BOSS_6 = RuleImage(roi_front=(561,480,141,141), roi_back=(437,402,555,236), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_demon_boss_6.png")
 	# 永生之海第一个选择 
 	I_SCA_SELECT_1 = RuleImage(roi_front=(189,519,113,51), roi_back=(189,519,113,51), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_select_1.png")
 	# description 

+ 2 - 2
tasks/RichMan/mall/navbar/image_side.json

@@ -65,8 +65,8 @@
   {
     "itemName": "side_check_medal",
     "imageName": "navbar_side_check_medal.png",
-    "roiFront": "889,11,40,44",
-    "roiBack": "889,11,40,44",
+    "roiFront": "665,6,40,44",
+    "roiBack": "453,1,476,58",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "勋章"

+ 8 - 8
tasks/RichMan/mall/scales/image.json

@@ -29,7 +29,7 @@
   {
     "itemName": "sca_demon_boss_1",
     "imageName": "scales_sca_demon_boss_1.png",
-    "roiFront": "209,168,192,193",
+    "roiFront": "246,224,112,126",
     "roiBack": "168,142,346,290",
     "method": "Template matching",
     "threshold": 0.8,
@@ -38,7 +38,7 @@
   {
     "itemName": "sca_demon_boss_2",
     "imageName": "scales_sca_demon_boss_2.png",
-    "roiFront": "457,158,180,198",
+    "roiFront": "457,203,123,153",
     "roiBack": "413,136,273,250",
     "method": "Template matching",
     "threshold": 0.8,
@@ -47,16 +47,16 @@
   {
     "itemName": "sca_demon_boss_3",
     "imageName": "scales_sca_demon_boss_3.png",
-    "roiFront": "687,178,181,175",
+    "roiFront": "686,239,131,121",
     "roiBack": "631,132,344,273",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.6,
     "description": "荒骷髅"
   },
   {
     "itemName": "sca_demon_boss_4",
     "imageName": "scales_sca_demon_boss_4.png",
-    "roiFront": "883,162,188,211",
+    "roiFront": "912,188,141,169",
     "roiBack": "804,121,315,292",
     "method": "Template matching",
     "threshold": 0.8,
@@ -65,7 +65,7 @@
   {
     "itemName": "sca_demon_boss_5",
     "imageName": "scales_sca_demon_boss_5.png",
-    "roiFront": "326,425,211,218",
+    "roiFront": "345,469,136,160",
     "roiBack": "241,414,504,242",
     "method": "Template matching",
     "threshold": 0.8,
@@ -74,8 +74,8 @@
   {
     "itemName": "sca_demon_boss_6",
     "imageName": "scales_sca_demon_boss_6.png",
-    "roiFront": "561,432,178,189",
-    "roiBack": "437,401,555,236",
+    "roiFront": "561,480,141,141",
+    "roiBack": "437,402,555,236",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "歌姬"

BIN
tasks/RichMan/mall/scales/scales_sca_demon_boss_1.png


BIN
tasks/RichMan/mall/scales/scales_sca_demon_boss_2.png


BIN
tasks/RichMan/mall/scales/scales_sca_demon_boss_3.png


BIN
tasks/RichMan/mall/scales/scales_sca_demon_boss_4.png


BIN
tasks/RichMan/mall/scales/scales_sca_demon_boss_5.png


BIN
tasks/RichMan/mall/scales/scales_sca_demon_boss_6.png


+ 5 - 5
tasks/RichMan/shrine.py

@@ -25,12 +25,12 @@ class Shrine(GameUi, RichManAssets):
             self.screenshot()
             if self.appear(self.I_S_NEXT_PERIOD):
                 break
-            # if self.click(self.C_C_SHRINE, interval=1):
-            #     continue
-            if self.appear_then_click(self.I_CENTER1, interval=1):
-                continue
-            if self.appear_then_click(self.I_CENTER2, interval=1):
+            if self.click(self.C_C_SHRINE, interval=1):
                 continue
+            # if self.appear_then_click(self.I_CENTER1, interval=1):
+            #     continue
+            # if self.appear_then_click(self.I_CENTER2, interval=1):
+            #     continue
         logger.info('Enter Shrine')
         time.sleep(0.5)
         if con.black_daruma:

+ 1 - 1
tasks/RyouToppa/assets.py

@@ -117,7 +117,7 @@ class RyouToppaAssets:
 
 	# Image Rule Assets
 	# 寮突 
-	I_RYOU_TOPPA = RuleImage(roi_front=(1191,352,78,116), roi_back=(1191,352,78,116), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_ryou_toppa.png")
+	I_RYOU_TOPPA = RuleImage(roi_front=(1191,352,78,116), roi_back=(1161,323,118,193), threshold=0.6, method="Template matching", file="./tasks/RyouToppa/res/res_ryou_toppa.png")
 	# 寮突选择阴阳寮按钮 
 	I_SELECT_RYOU_BUTTON = RuleImage(roi_front=(560,577,156,46), roi_back=(560,577,156,46), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_select_ryou_button.png")
 	# 开始寮突按钮 

+ 2 - 2
tasks/RyouToppa/res/image.json

@@ -3,9 +3,9 @@
     "itemName": "ryou_toppa",
     "imageName": "res_ryou_toppa.png",
     "roiFront": "1191,352,78,116",
-    "roiBack": "1191,352,78,116",
+    "roiBack": "1161,323,118,193",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.6,
     "description": "寮突"
   },
   {

+ 1 - 1
tasks/TrueOrochi/assets.py

@@ -57,6 +57,6 @@ class TrueOrochiAssets:
 	# 60体力创建 
 	I_ST_CREATE_ROOM = RuleImage(roi_front=(528,482,223,62), roi_back=(528,482,223,62), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_create_room.png")
 	# 头像框 
-	I_ST_FRAME = RuleImage(roi_front=(574,441,130,63), roi_back=(574,441,130,63), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_frame.png")
+	I_ST_FRAME = RuleImage(roi_front=(571,442,135,65), roi_back=(571,442,135,65), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_frame.png")
 
 

+ 2 - 1
tasks/TrueOrochi/config.py

@@ -8,6 +8,7 @@ from datetime import datetime, time
 from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.config_base import ConfigBase, TimeDelta
 from tasks.Utils.config_enum import ShikigamiClass
+from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
 
 class GreenMarkType(str, Enum):
     LEFT_1 = 'left_1'
@@ -34,4 +35,4 @@ class TrueOrochiConfig(BaseModel):
 class TrueOrochi(ConfigBase):
     scheduler: TrueOrochiScheduler = Field(default_factory=TrueOrochiScheduler)
     true_orochi_config: TrueOrochiConfig = Field(default_factory=TrueOrochiConfig)
-
+    switch_soul: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)

+ 50 - 24
tasks/TrueOrochi/script_task.py

@@ -14,19 +14,40 @@ from tasks.Component.GeneralInvite.general_invite import GeneralInvite
 from tasks.Component.GeneralRoom.general_room import GeneralRoom
 from tasks.Orochi.script_task import ScriptTask as OrochiScriptTask
 from tasks.Orochi.config import Layer
-from tasks.GameUi.page import page_main, page_soul_zones
+from tasks.GameUi.page import page_main, page_soul_zones, page_shikigami_records
 from tasks.TrueOrochi.assets import TrueOrochiAssets
 
 
 class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
 
     def run(self):
+    
         conf = self.config.true_orochi.true_orochi_config
+
+        # 周一重置真蛇次数
+        now = datetime.now()
+        day_of_week = now.weekday()
+        if day_of_week == 0:
+            conf.current_success = 0
+
         if conf.current_success >= 2:
             # 超过两次就说明这周打完了没有必要再打了
             logger.warning('This week is full')
             self.check_times(True)
             raise TaskEnd('TrueOrochi')
+
+        # 御魂切换方式一
+        if self.config.true_orochi.switch_soul.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(self.config.true_orochi.switch_soul.switch_group_team)
+        # 御魂切换方式二
+        if self.config.true_orochi.switch_soul.enable_switch_by_name:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul_by_name(self.config.true_orochi.switch_soul.group_name,
+                                         self.config.true_orochi.switch_soul.team_name)
+
         self.ui_get_current_page()
         self.ui_goto(page_soul_zones)
         self.orochi_enter()
@@ -34,6 +55,13 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
         if not battle:
             logger.warning('Not find true orochi')
             logger.warning('Try to battle orochi for ten times')
+
+            # 判断是否需要挑战十层触发真蛇
+            if not conf.find_true_orochi:
+                logger.info('Not find_true_orochi_help')
+                self.check_times(False)
+                raise TaskEnd('TrueOrochi')
+
             self.check_layer(Layer.TEN)
             self.check_lock(False)
             count_orochi_ten = 0
@@ -94,10 +122,12 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
             self.screenshot()
             if not self.appear(self.I_BUFF):
                 break
-            if self.appear_then_click(self.I_ST_AUTO_FALSE, interval=0.8):
-                continue
-            if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.8):
+            if self.appear_then_click(self.I_ST_AUTO_FALSE, interval=1.8):
                 continue
+
+            # 下面代码 "点击准备" 会造成,点击了准备打第一层 循环 if not self.appear(self.I_BUFF): 时候跳出while循环,导致真蛇卡在第二层
+            # if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.8):
+            #     continue
         self.device.stuck_record_add('BATTLE_STATUS_S')
         self.device.click_record_clear()
         logger.info("Start battle process")
@@ -133,7 +163,6 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
         self.check_times(battle)
         raise TaskEnd('TrueOrochi')
 
-
     def check_true_orochi(self, screenshot=False) -> bool:
         """
         检查是否出现真蛇(要求当前的界面必须是在御魂挑战的界面)
@@ -150,25 +179,21 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
         :param current_success: 这周的成功次数
         :return:
         """
-        now = datetime.now()
-        now_year, now_week_number, now_weekday = now.isocalendar()
-        if battle:
-            next_run = now + self.config.true_orochi.scheduler.success_interval
-        else:
-            next_run = now + self.config.true_orochi.scheduler.fail_interval
-        next_run_year, next_run_week_number, next_run_weekday = next_run.isocalendar()
-        self.set_next_run(task='TrueOrochi', target=next_run)
-        # 如果下次运行的时间是下一周,那么就重置成功次数
-        if now_week_number != next_run_week_number:
-            self.config.true_orochi.true_orochi_config.current_success = 0
-        else:
-            # 如果不是下一周,那么就加一
-            self.config.true_orochi.true_orochi_config.current_success += 1
-
-
-
-
-
+        # now = datetime.now()
+        # now_year, now_week_number, now_weekday = now.isocalendar()
+        # if battle:
+        #     next_run = now + self.config.true_orochi.scheduler.success_interval
+        # else:
+        #     next_run = now + self.config.true_orochi.scheduler.failure_interval
+        # next_run_year, next_run_week_number, next_run_weekday = next_run.isocalendar()
+        # # 如果下次运行的时间是下一周,那么就重置成功次数
+        # if now_week_number != next_run_week_number:
+        #     self.config.true_orochi.true_orochi_config.current_success = 0
+        # else:
+        #     # 如果不是下一周,那么就加一
+        #     self.config.true_orochi.true_orochi_config.current_success += 1
+        # self.set_next_run(task='TrueOrochi', target=next_run)
+        self.set_next_run('TrueOrochi', finish=True, success=True)
 
     def run_true_orochi(self) -> bool:
         pass
@@ -177,6 +202,7 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
 if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
+
     c = Config('oas1')
     d = Device(c)
     t = ScriptTask(c, d)

+ 2 - 2
tasks/TrueOrochi/st/image.json

@@ -119,8 +119,8 @@
   {
     "itemName": "st_frame",
     "imageName": "st_st_frame.png",
-    "roiFront": "574,441,130,63",
-    "roiBack": "574,441,130,63",
+    "roiFront": "571,442,135,65",
+    "roiBack": "571,442,135,65",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "头像框"

BIN
tasks/TrueOrochi/st/st_st_frame.png


+ 1 - 1
tasks/WantedQuests/assets.py

@@ -79,7 +79,7 @@ class WantedQuestsAssets:
 	# 悬赏封印邀请取消按钮 
 	I_WQ_INVITE_CANCEL = RuleImage(roi_front=(230,540,132,60), roi_back=(230,540,140,65), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/invite/wq_invite_cancel.png")
 	# 邀请好友被选中标记 
-	I_WQ_INVITE_SELECTED = RuleImage(roi_front=(380,185,32,32), roi_back=(380,185,345,350), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/invite/wq_invite_selected.png")
+	I_WQ_INVITE_SELECTED = RuleImage(roi_front=(380,170,32,32), roi_back=(380,170,360,375), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/invite/wq_invite_selected.png")
 	# 邀请同服好友,由于选中与未选中亮度有区别,查找图片可能会出错,建议只使用位置信息 
 	I_WQ_INVITE_SAME_SVR = RuleImage(roi_front=(170,90,60,35), roi_back=(170,90,105,65), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/invite/wq_invite_same_svr.png")
 	# 邀请跨服好友,由于选中与未选中亮度有区别,查找图片可能会出错,建议只使用位置信息 

+ 2 - 2
tasks/WantedQuests/invite/image.json

@@ -92,8 +92,8 @@
   {
     "itemName": "wq_invite_selected",
     "imageName": "wq_invite_selected.png",
-    "roiFront": "380,185,32,32",
-    "roiBack": "380,185,345,350",
+    "roiFront": "380,170,32,32",
+    "roiBack": "380,170,360,375",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "邀请好友被选中标记"