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

Merge pull request #882 from runhey/dev

Automated PR 2025.06.05
huangrunheng 1 год назад
Родитель
Сommit
487028ad85
39 измененных файлов с 313 добавлено и 116 удалено
  1. 4 3
      module/config/config_manual.py
  2. BIN
      tasks/ActivityShikigami/as/as_ap.png
  3. BIN
      tasks/ActivityShikigami/as/as_battle.png
  4. BIN
      tasks/ActivityShikigami/as/as_battle_1.png
  5. BIN
      tasks/ActivityShikigami/as/as_fire.png
  6. BIN
      tasks/ActivityShikigami/as/as_lock.png
  7. BIN
      tasks/ActivityShikigami/as/as_unlock.png
  8. 20 11
      tasks/ActivityShikigami/as/image.json
  9. 2 2
      tasks/ActivityShikigami/as/ocr.json
  10. 9 7
      tasks/ActivityShikigami/assets.py
  11. 3 1
      tasks/ActivityShikigami/script_task.py
  12. 1 1
      tasks/CollectiveMissions/assets.py
  13. 2 2
      tasks/CollectiveMissions/cm/image.json
  14. 11 1
      tasks/Component/GeneralBattle/assets.py
  15. BIN
      tasks/Component/GeneralBattle/gb/gb_reward_exp_soul_4.png
  16. BIN
      tasks/Component/GeneralBattle/gb/gb_reward_gold.png
  17. BIN
      tasks/Component/GeneralBattle/gb/gb_reward_gold_snake_skin.png
  18. BIN
      tasks/Component/GeneralBattle/gb/gb_reward_purple_snake_skin.png
  19. BIN
      tasks/Component/GeneralBattle/gb/gb_reward_soul_5.png
  20. BIN
      tasks/Component/GeneralBattle/gb/gb_reward_soul_6.png
  21. 47 2
      tasks/Component/GeneralBattle/gb/image.json
  22. 18 3
      tasks/Component/GeneralBattle/general_battle.py
  23. 6 0
      tasks/DemonEncounter/assets.py
  24. BIN
      tasks/DemonEncounter/boss/boss_boss_done_check.png
  25. BIN
      tasks/DemonEncounter/boss/boss_boss_gather.png
  26. BIN
      tasks/DemonEncounter/boss/boss_boss_wait.png
  27. 18 0
      tasks/DemonEncounter/boss/image.json
  28. 9 0
      tasks/DemonEncounter/boss/ocr.json
  29. 136 62
      tasks/DemonEncounter/script_task.py
  30. 6 5
      tasks/ExperienceYoukai/assets.py
  31. 1 1
      tasks/GameUi/assets.py
  32. BIN
      tasks/GameUi/page/page_check_collection.png
  33. 2 2
      tasks/GameUi/page/page_img_3.json
  34. 3 0
      tasks/Hyakkiyakou/slave/hya_device.py
  35. 1 1
      tasks/MemoryScrolls/config.py
  36. 7 5
      tasks/MemoryScrolls/script_task.py
  37. 1 1
      tasks/Secret/script_task.py
  38. 2 2
      tasks/WeeklyTrifles/assets.py
  39. 4 4
      tasks/WeeklyTrifles/collect/image.json

+ 4 - 3
module/config/config_manual.py

@@ -15,10 +15,11 @@ class ConfigManual:
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea > SixRealms
         > ActivityShikigami > WantedQuests
         > BondlingFairyland > EvoZone > GoryouRealm > HeroTest
-        > TrueOrochi > RichMan
-        > CollectiveMissions
+        > CollectiveMissionsr
         > Pets > TalismanPass > Delegation > Hyakkiyakou
-        > Secret > WeeklyTrifles > MysteryShop > Duel > MetaDemon > FrogBoss > FloatParade > Quiz > KittyShop > DyeTrials
+        > Secret > WeeklyTrifles > MysteryShop > Duel 
+        > TrueOrochi > RichMan
+        > MetaDemon > FrogBoss > FloatParade > Quiz > KittyShop > DyeTrials
         """
 
     DEVICE_OVER_HTTP = False

BIN
tasks/ActivityShikigami/as/as_ap.png


BIN
tasks/ActivityShikigami/as/as_battle.png


BIN
tasks/ActivityShikigami/as/as_battle_1.png


BIN
tasks/ActivityShikigami/as/as_fire.png


BIN
tasks/ActivityShikigami/as/as_lock.png


BIN
tasks/ActivityShikigami/as/as_unlock.png


+ 20 - 11
tasks/ActivityShikigami/as/image.json

@@ -3,7 +3,7 @@
     "itemName": "shi",
     "imageName": "as_shi.png",
     "roiFront": "519,165,33,34",
-    "roiBack": "64,115,1110,427",
+    "roiBack": "507,150,66,67",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "进入活动"
@@ -20,12 +20,21 @@
   {
     "itemName": "battle",
     "imageName": "as_battle.png",
-    "roiFront": "1081,301,35,135",
-    "roiBack": "1042,208,153,315",
+    "roiFront": "937,308,35,135",
+    "roiBack": "892,214,153,315",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "进入爬塔"
   },
+  {
+    "itemName": "battle_1",
+    "imageName": "as_battle_1.png",
+    "roiFront": "541,663,191,26",
+    "roiBack": "506,622,273,96",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "进入爬塔1"
+  },
   {
     "itemName": "drum",
     "imageName": "as_drum.png",
@@ -38,8 +47,8 @@
   {
     "itemName": "lock",
     "imageName": "as_lock.png",
-    "roiFront": "827,655,25,32",
-    "roiBack": "749,592,139,116",
+    "roiFront": "732,613,25,28",
+    "roiBack": "707,592,76,80",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "上锁图标"
@@ -47,8 +56,8 @@
   {
     "itemName": "unlock",
     "imageName": "as_unlock.png",
-    "roiFront": "823,654,28,28",
-    "roiBack": "776,610,112,87",
+    "roiFront": "730,613,28,28",
+    "roiBack": "704,595,78,74",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "还未上锁图片"
@@ -56,8 +65,8 @@
   {
     "itemName": "fire",
     "imageName": "as_fire.png",
-    "roiFront": "1140,583,84,78",
-    "roiBack": "1099,536,150,160",
+    "roiFront": "1052,562,84,46",
+    "roiBack": "1021,521,150,160",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "点击战斗"
@@ -65,8 +74,8 @@
   {
     "itemName": "ap",
     "imageName": "as_ap.png",
-    "roiFront": "1093,667,23,24",
-    "roiBack": "1088,638,103,71",
+    "roiFront": "1065,612,23,24",
+    "roiBack": "1044,589,103,71",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "体力按钮"

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

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "remain_ap",
-    "roiFront": "98,583,42,25",
-    "roiBack": "98,583,42,25",
+    "roiFront": "1102,26,57,26",
+    "roiBack": "1102,26,57,26",
     "mode": "DigitCounter",
     "method": "Default",
     "keyword": "",

+ 9 - 7
tasks/ActivityShikigami/assets.py

@@ -45,21 +45,23 @@ class ActivityShikigamiAssets:
 
 	# Image Rule Assets
 	# 进入活动 
-	I_SHI = RuleImage(roi_front=(519,165,33,34), roi_back=(64,115,1110,427), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
+	I_SHI = RuleImage(roi_front=(519,165,33,34), roi_back=(507,150,66,67), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
 	# 左上角返回 
 	I_BACK_GREEN = RuleImage(roi_front=(27,19,34,38), roi_back=(2,1,170,75), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
 	# 进入爬塔 
-	I_BATTLE = RuleImage(roi_front=(1081,301,35,135), roi_back=(1042,208,153,315), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
+	I_BATTLE = RuleImage(roi_front=(937,308,35,135), roi_back=(892,214,153,315), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
+	# 进入爬塔1 
+	I_BATTLE_1 = RuleImage(roi_front=(541,663,191,26), roi_back=(506,622,273,96), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle_1.png")
 	# 归鹿之途 
 	I_DRUM = RuleImage(roi_front=(327,627,145,28), roi_back=(256,462,301,232), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
 	# 上锁图标 
-	I_LOCK = RuleImage(roi_front=(827,655,25,32), roi_back=(749,592,139,116), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
+	I_LOCK = RuleImage(roi_front=(732,613,25,28), roi_back=(707,592,76,80), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
 	# 还未上锁图片 
-	I_UNLOCK = RuleImage(roi_front=(823,654,28,28), roi_back=(776,610,112,87), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
+	I_UNLOCK = RuleImage(roi_front=(730,613,28,28), roi_back=(704,595,78,74), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
 	# 点击战斗 
-	I_FIRE = RuleImage(roi_front=(1140,583,84,78), roi_back=(1099,536,150,160), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
+	I_FIRE = RuleImage(roi_front=(1052,562,84,46), roi_back=(1021,521,150,160), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
 	# 体力按钮 
-	I_AP = RuleImage(roi_front=(1093,667,23,24), roi_back=(1088,638,103,71), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
+	I_AP = RuleImage(roi_front=(1065,612,23,24), roi_back=(1044,589,103,71), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
 	# 活动体力 
 	I_AP_ACTIVITY = RuleImage(roi_front=(1147,667,21,27), roi_back=(1095,654,84,54), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap_activity.png")
 	# 切换按键 
@@ -74,7 +76,7 @@ class ActivityShikigamiAssets:
 
 	# Ocr Rule Assets
 	# 体力的数量检测 
-	O_REMAIN_AP = RuleOcr(roi=(98,583,42,25), area=(98,583,42,25), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
+	O_REMAIN_AP = RuleOcr(roi=(1102,26,57,26), area=(1102,26,57,26), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
 	# 活动体力的剩余检测 
 	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(715,18,95,28), area=(715,18,95,28), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
 	# 还有多少次购买体力的机会 

+ 3 - 1
tasks/ActivityShikigami/script_task.py

@@ -106,7 +106,7 @@ class ScriptTask(GameUi, BaseActivity, SwitchSoul, ActivityShikigamiAssets):
 
             # 随机休息
             if config.general_climb.random_sleep:
-                random_sleep()
+                random_sleep(probability=0.2)
             # 点击战斗
             logger.info("Click battle")
             while 1:
@@ -153,6 +153,8 @@ class ScriptTask(GameUi, BaseActivity, SwitchSoul, ActivityShikigamiAssets):
                 continue
             if self.appear_then_click(self.I_BATTLE, interval=1):
                 continue
+            if self.appear_then_click(self.I_BATTLE_1, interval=1):
+                continue
 
     def main_home(self) -> bool:
         """

+ 1 - 1
tasks/CollectiveMissions/assets.py

@@ -27,7 +27,7 @@ class CollectiveMissionsAssets:
 	# 提交 
 	I_CM_PRESENT = RuleImage(roi_front=(559,594,160,66), roi_back=(559,594,160,66), threshold=0.8, method="Template matching", file="./tasks/CollectiveMissions/cm/cm_cm_present.png")
 	# 判断是否到达 
-	I_CM_RECORDS = RuleImage(roi_front=(1105,626,54,63), roi_back=(1105,626,54,63), threshold=0.8, method="Template matching", file="./tasks/CollectiveMissions/cm/cm_cm_records.png")
+	I_CM_RECORDS = RuleImage(roi_front=(1032,617,54,63), roi_back=(960,562,193,138), threshold=0.8, method="Template matching", file="./tasks/CollectiveMissions/cm/cm_cm_records.png")
 	# 将材料拉满的按钮,用来判断是否拉满 
 	I_CM_MATTER = RuleImage(roi_front=(860,396,36,37), roi_back=(843,119,66,459), threshold=0.8, method="Template matching", file="./tasks/CollectiveMissions/cm/cm_cm_matter.png")
 	# description 

+ 2 - 2
tasks/CollectiveMissions/cm/image.json

@@ -29,8 +29,8 @@
   {
     "itemName": "cm_records",
     "imageName": "cm_cm_records.png",
-    "roiFront": "1105,626,54,63",
-    "roiBack": "1105,626,54,63",
+    "roiFront": "1032,617,54,63",
+    "roiBack": "960,562,193,138",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "判断是否到达"

+ 11 - 1
tasks/Component/GeneralBattle/assets.py

@@ -108,7 +108,17 @@ class GeneralBattleAssets:
 	# 结算时左下角统计图标 
 	I_REWARD_STATISTICS = RuleImage(roi_front=(51,629,54,59), roi_back=(51,629,54,59), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward_statistics.png")
 	# 结算金币 
-	I_REWARD_GOLD = RuleImage(roi_front=(943,312,97,69), roi_back=(943,312,97,69), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward_gold.png")
+	I_REWARD_GOLD = RuleImage(roi_front=(268,178,97,69), roi_back=(254,163,797,261), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward_gold.png")
+	# 结算紫蛇皮 
+	I_REWARD_PURPLE_SNAKE_SKIN = RuleImage(roi_front=(403,177,97,73), roi_back=(254,163,797,261), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward_purple_snake_skin.png")
+	# 结算金蛇皮 
+	I_REWARD_GOLD_SNAKE_SKIN = RuleImage(roi_front=(537,176,97,75), roi_back=(254,163,797,261), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward_gold_snake_skin.png")
+	# 结算四星青吉鬼 
+	I_REWARD_EXP_SOUL_4 = RuleImage(roi_front=(806,177,97,69), roi_back=(254,163,797,261), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward_exp_soul_4.png")
+	# 结算五星御魂 
+	I_REWARD_SOUL_5 = RuleImage(roi_front=(266,533,97,20), roi_back=(254,163,797,396), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward_soul_5.png")
+	# 结算六星御魂 
+	I_REWARD_SOUL_6 = RuleImage(roi_front=(942,397,97,20), roi_back=(254,163,797,396), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward_soul_6.png")
 	# 针对封魔的特殊 
 	I_DE_WIN = RuleImage(roi_front=(472,49,100,100), roi_back=(239,36,399,133), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_de_win.png")
 	# description 

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


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


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


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


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


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


+ 47 - 2
tasks/Component/GeneralBattle/gb/image.json

@@ -182,12 +182,57 @@
   {
     "itemName": "reward_gold",
     "imageName": "gb_reward_gold.png",
-    "roiFront": "943,312,97,69",
-    "roiBack": "943,312,97,69",
+    "roiFront": "268,178,97,69",
+    "roiBack": "254,163,797,261",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "结算金币"
   },
+  {
+    "itemName": "reward_purple_snake_skin",
+    "imageName": "gb_reward_purple_snake_skin.png",
+    "roiFront": "403,177,97,73",
+    "roiBack": "254,163,797,261",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "结算紫蛇皮"
+  },
+  {
+    "itemName": "reward_gold_snake_skin",
+    "imageName": "gb_reward_gold_snake_skin.png",
+    "roiFront": "537,176,97,75",
+    "roiBack": "254,163,797,261",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "结算金蛇皮"
+  },
+  {
+    "itemName": "reward_exp_soul_4",
+    "imageName": "gb_reward_exp_soul_4.png",
+    "roiFront": "806,177,97,69",
+    "roiBack": "254,163,797,261",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "结算四星青吉鬼"
+  },
+  {
+    "itemName": "reward_soul_5",
+    "imageName": "gb_reward_soul_5.png",
+    "roiFront": "266,533,97,20",
+    "roiBack": "254,163,797,396",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "结算五星御魂"
+  },
+  {
+    "itemName": "reward_soul_6",
+    "imageName": "gb_reward_soul_6.png",
+    "roiFront": "942,397,97,20",
+    "roiBack": "254,163,797,396",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "结算六星御魂"
+  },
   {
     "itemName": "de_win",
     "imageName": "gb_de_win.png",

+ 18 - 3
tasks/Component/GeneralBattle/general_battle.py

@@ -223,10 +223,25 @@ class GeneralBattle(GeneralBuff, GeneralBattleAssets):
             self.screenshot()
             # 如果出现领奖励
             action_click = random.choice([self.C_REWARD_1, self.C_REWARD_2, self.C_REWARD_3])
-            if self.appear_then_click(self.I_REWARD, action=action_click, interval=1.5) or \
-                    self.appear_then_click(self.I_REWARD_GOLD, action=action_click, interval=1.5):
+            if (self.appear_then_click(self.I_REWARD, action=action_click, interval=1.5) or
+                self.appear_then_click(self.I_REWARD_GOLD, action=action_click, interval=1.5)#  or
+                # self.appear_then_click(self.I_REWARD_STATISTICS, action=action_click, interval=1.5) or
+                # self.appear_then_click(self.I_REWARD_PURPLE_SNAKE_SKIN, action=action_click, interval=1.5) or
+                # self.appear_then_click(self.I_REWARD_GOLD_SNAKE_SKIN, action=action_click, interval=1.5) or
+                # self.appear_then_click(self.I_REWARD_EXP_SOUL_4, action=action_click, interval=1.5) or
+                # self.appear_then_click(self.I_REWARD_SOUL_5, action=action_click, interval=1.5) or
+                # self.appear_then_click(self.I_REWARD_SOUL_6, action=action_click, interval=1.5)
+                ):
                 continue
-            if not self.appear(self.I_REWARD) and not self.appear(self.I_REWARD_GOLD):
+            if (not self.appear(self.I_REWARD) and
+                not self.appear(self.I_REWARD_GOLD)#  and
+                # not self.appear(self.I_REWARD_STATISTICS) and
+                # not self.appear(self.I_REWARD_PURPLE_SNAKE_SKIN) and
+                # not self.appear(self.I_REWARD_GOLD_SNAKE_SKIN) and
+                # not self.appear(self.I_REWARD_EXP_SOUL_4) and
+                # not self.appear(self.I_REWARD_SOUL_5) and
+                # not self.appear(self.I_REWARD_SOUL_6)
+                ):
                 break
 
         return win

+ 6 - 0
tasks/DemonEncounter/assets.py

@@ -46,11 +46,17 @@ class DemonEncounterAssets:
 	I_BOSS_KILLED = RuleImage(roi_front=(654,596,35,68), roi_back=(614,537,123,176), threshold=0.8, method="Template matching", file="./tasks/DemonEncounter/boss/boss_boss_killed.png")
 	# 极逢魔集结挑战 
 	I_BEST_BOSS_FIRE = RuleImage(roi_front=(1087,562,100,36), roi_back=(1087,562,100,36), threshold=0.8, method="Template matching", file="./tasks/DemonEncounter/boss/boss_best_boss_fire.png")
+	# 战斗失败-等待界面 
+	I_BOSS_WAIT = RuleImage(roi_front=(490,50,350,150), roi_back=(490,50,350,150), threshold=0.8, method="Template matching", file="./tasks/DemonEncounter/boss/boss_boss_wait.png")
+	# 战斗结束标识,左下角有战绩按钮 
+	I_BOSS_DONE_CHECK = RuleImage(roi_front=(0,450,100,130), roi_back=(0,450,100,130), threshold=0.8, method="Template matching", file="./tasks/DemonEncounter/boss/boss_boss_done_check.png")
 
 
 	# Ocr Rule Assets
 	# 人数 
 	O_DE_BOSS_PEOPLE = RuleOcr(roi=(880,591,100,35), area=(880,591,100,35), mode="DigitCounter", method="Default", keyword="", name="de_boss_people")
+	# Ocr-description 
+	O_DE_BEST_BOSS_PEOPLE = RuleOcr(roi=(902,564,100,31), area=(902,564,100,31), mode="DigitCounter", method="Default", keyword="", name="de_best_boss_people")
 
 
 	# Click Rule Assets

BIN
tasks/DemonEncounter/boss/boss_boss_done_check.png


BIN
tasks/DemonEncounter/boss/boss_boss_gather.png


BIN
tasks/DemonEncounter/boss/boss_boss_wait.png


+ 18 - 0
tasks/DemonEncounter/boss/image.json

@@ -133,5 +133,23 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "极逢魔集结挑战"
+  },
+  {
+    "itemName": "boss_wait",
+    "imageName": "boss_boss_wait.png",
+    "roiFront": "490,50,350,150",
+    "roiBack": "490,50,350,150",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "战斗失败-等待界面"
+  },
+  {
+    "itemName": "boss_done_check",
+    "imageName": "boss_boss_done_check.png",
+    "roiFront": "0,450,100,130",
+    "roiBack": "0,450,100,130",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "战斗结束标识,左下角有战绩按钮"
   }
 ]

+ 9 - 0
tasks/DemonEncounter/boss/ocr.json

@@ -7,5 +7,14 @@
     "method": "Default",
     "keyword": "",
     "description": "人数"
+  },
+  {
+    "itemName": "de_best_boss_people",
+    "roiFront": "902,564,100,31",
+    "roiBack": "902,564,100,31",
+    "mode": "DigitCounter",
+    "method": "Default",
+    "keyword": "",
+    "description": "Ocr-description"
   }
 ]

+ 136 - 62
tasks/DemonEncounter/script_task.py

@@ -2,12 +2,12 @@
 # @author runhey
 # github https://github.com/runhey
 import time
+from time import sleep
 
 from enum import Enum
 from cached_property import cached_property
 from datetime import datetime, timedelta
 
-
 from module.logger import logger
 from module.exception import TaskEnd
 from module.base.timer import Timer
@@ -20,6 +20,7 @@ from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
 from tasks.DemonEncounter.data.answer import Answer
 
+
 class LanternClass(Enum):
     BATTLE = 0  # 打怪  --> 无法判断因为怪的图片不一样,用排除法
     BOX = 1  # 开宝箱
@@ -31,6 +32,7 @@ class LanternClass(Enum):
 
 
 class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
+    best_boss_enable = False
 
     def run(self):
         if not self.check_time():
@@ -50,6 +52,24 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
         self.set_next_run(task='DemonEncounter', success=True, finish=False)
         raise TaskEnd('DemonEncounter')
 
+    def init_best_boss_enable(self):
+        today = datetime.now().weekday()
+        if today == 0:
+            # 鬼灵歌姬
+            self.best_boss_enable = self.config.model.demon_encounter.best_demon_boss_config.best_demon_kiryou_select
+        elif today == 1:
+            # 蜃气楼
+            self.best_boss_enable = self.config.model.demon_encounter.best_demon_boss_config.best_demon_shinkirou_select
+        elif today == 2:
+            # 土蜘蛛
+            self.best_boss_enable = self.config.model.demon_encounter.best_demon_boss_config.best_demon_tsuchigumo_select
+        elif today == 3:
+            # 荒骷髅
+            self.best_boss_enable = self.config.model.demon_encounter.best_demon_boss_config.best_demon_gashadokuro_select
+        elif today == 4:
+            # 地震鲶
+            self.best_boss_enable = self.config.model.demon_encounter.best_demon_boss_config.best_demon_namazu_select
+
     def checkout_soul(self):
         """
         切换御魂
@@ -112,76 +132,133 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
         :return:
         """
         logger.hr('Start boss battle', 1)
-        # 判断今天是周几
-        today = datetime.now().weekday()
+        self.init_best_boss_enable()
 
-        while 1:
-            self.screenshot()
-            if self.appear(self.I_BOSS_FIRE) or self.appear(self.I_BEST_BOSS_FIRE):
-                current, remain, total = self.O_DE_BOSS_PEOPLE.ocr(self.device.image)
-                if total == 300 and current >= 290:
-                    logger.info('Boss battle people is full')
-                    if not self.appear(self.I_UI_BACK_RED):
-                        logger.warning('Boss battle people is full but no red back')
-                        continue
-                    self.ui_click_until_disappear(self.I_UI_BACK_RED)
-                    # 退出重新选一个没人慢的boss
-                    logger.info('Exit and reselect')
+        def find_boss():
+            find_btn_clicked = False
+            timer_find_boss = Timer(10 * 60)
+            timer_find_boss.start()
+            while 1:
+                self.screenshot()
+                if self.appear(self.I_BOSS_FIRE) or self.appear(self.I_BEST_BOSS_FIRE):
+                    break
+                if timer_find_boss.reached():
+                    logger.warning('find boss timeout')
+                    self.set_next_run(task='DemonEncounter', success=False, finish=True, server=False)
+                    raise TaskEnd('DemonEncounter')
+                if self.appear(self.I_JADE_50):
+                    # 没找到boss但地图中央出现宝箱,导致点击宝箱出现50勾玉购买界面
+                    self.ui_click_until_smt_disappear(self.I_DE_FIND, self.I_JADE_50, interval=1)
+                    continue
+                # if self.appear_then_click(self.I_BOSS_NAMAZU, interval=1):
+                #     continue
+                # if self.appear_then_click(self.I_BOSS_SHINKIRO, interval=1):
+                #     continue
+                # if self.appear_then_click(self.I_BOSS_ODOKURO, interval=1):
+                #     continue
+                # if self.appear_then_click(self.I_BOSS_OBOROGURUMA, interval=1):
+                #     continue
+                # if self.appear_then_click(self.I_BOSS_TSUCHIGUMO, interval=1):
+                #     continue
+                # if self.appear_then_click(self.I_BOSS_SONGSTRESS, interval=1):
+                #     continue
+                if find_btn_clicked and self.click(self.C_DM_BOSS_CLICK, interval=5):
+                    find_btn_clicked = False
                     continue
+                if self.best_boss_enable:
+                    self.device.click_record_clear()
+                    if self.appear(self.I_DE_BOSS_BEST) and (not find_btn_clicked):
+                        self.device.click_record_remove(self.I_DE_BOSS_BEST)
+                        if self.click(self.I_DE_BOSS_BEST, interval=4):
+                            logger.info("Finding best boss...")
+                            find_btn_clicked = True
+                        continue
                 else:
-                    logger.info('Boss battle people is not full')
+                    if self.appear(self.I_DE_BOSS) and (not find_btn_clicked):
+                        self.device.click_record_remove(self.I_DE_BOSS)
+                        if self.click(self.I_DE_BOSS, interval=4):
+                            logger.info("Finding normal boss...")
+                            find_btn_clicked = True
+                        continue
+            return True
+
+        def enter_boss():
+            logger.info('trying to enter boss...')
+            # 点击集结挑战
+            boss_fire_count = 0  # 五次没点到就意味着今天已经挑战过了
+            ocr_people_item = self.O_DE_BEST_BOSS_PEOPLE if self.best_boss_enable else self.O_DE_BOSS_PEOPLE
+            while 1:
+                self.screenshot()
+
+                if self.appear(self.I_BOSS_FIRE) or self.appear(self.I_BEST_BOSS_FIRE):
+                    current, remain, total = ocr_people_item.ocr(self.device.image)
+                    if total == 300 and current >= 290:
+                        logger.info('Boss battle people is full')
+                        if not self.appear(self.I_UI_BACK_RED):
+                            logger.warning('Boss battle people is full but no red back')
+                            continue
+                        self.ui_click_until_disappear(self.I_UI_BACK_RED)
+                        # 退出重新选一个没人慢的boss
+                        logger.info('Exit and reselect')
+                        return False
+
+                logger.info('Boss battle people is not full')
+
+                if self.appear(self.I_BOSS_CONFIRM):
+                    self.ui_click(self.I_BOSS_NO_SELECT, self.I_BOSS_SELECTED)
+                    self.ui_click(self.I_BOSS_CONFIRM, self.I_BOSS_GATHER)
+                    break
+                if self.appear(self.I_BOSS_GATHER):
                     break
+                if boss_fire_count >= 5:
+                    logger.warning('Boss battle already done')
+                    self.set_next_run(task='DemonEncounter', success=False, finish=True, server=True)
+                    self.ui_click_until_disappear(self.I_UI_BACK_RED)
+                    raise TaskEnd('DemonEncounter')
 
-            if self.appear_then_click(self.I_BOSS_NAMAZU, interval=1):
-                continue
-            if self.appear_then_click(self.I_BOSS_SHINKIRO, interval=1):
-                continue
-            if self.appear_then_click(self.I_BOSS_ODOKURO, interval=1):
-                continue
-            if self.appear_then_click(self.I_BOSS_OBOROGURUMA, interval=1):
-                continue
-            if self.appear_then_click(self.I_BOSS_TSUCHIGUMO, interval=1):
-                continue
-            if self.appear_then_click(self.I_BOSS_SONGSTRESS, interval=1):
-                continue
-            if self.config.demon_encounter.best_demon_boss_config.enable and today < 5:
-                if self.appear_then_click(self.I_DE_BOSS_BEST, interval=4):
+                if (self.appear_then_click(self.I_BOSS_FIRE, interval=3)
+                        or self.appear_then_click(self.I_BEST_BOSS_FIRE, interval=3)):
+                    boss_fire_count += 1
                     continue
-            else:
-                if self.appear_then_click(self.I_DE_BOSS, interval=4):
-                    continue
-            if self.click(self.C_DM_BOSS_CLICK, interval=1.7):
-                continue
+            return True
 
-        logger.info('Boss battle start')
-        # 点击集结挑战
-        boss_fire_count = 0  # 五次没点到就意味着今天已经挑战过了
-        while 1:
-            self.screenshot()
-            if self.appear(self.I_BOSS_CONFIRM):
-                self.ui_click(self.I_BOSS_NO_SELECT, self.I_BOSS_SELECTED)
-                self.ui_click(self.I_BOSS_CONFIRM, self.I_BOSS_GATHER)
-                break
-            if self.appear(self.I_BOSS_GATHER):
-                break
-            if boss_fire_count >= 5:
-                logger.warning('Boss battle already done')
-                self.ui_click_until_disappear(self.I_UI_BACK_RED)
+        fail_count = 0
+        while True:
+            if fail_count >= 5:
                 return
-            if self.appear_then_click(self.I_BOSS_FIRE, interval=3) or self.appear_then_click(self.I_BEST_BOSS_FIRE, interval=3):
-                boss_fire_count += 1
+            if not find_boss():
                 continue
+            if enter_boss():
+                break
+            fail_count += 1
+
         logger.info('Boss battle confirm and enter')
         # 等待挑战, 5秒也是等
         time.sleep(5)
-        self.device.stuck_record_add('BATTLE_STATUS_S')
-        self.wait_until_disappear(self.I_BOSS_GATHER)
-        self.device.stuck_record_clear()
-        self.device.stuck_record_add('BATTLE_STATUS_S')
         # 延长时间并在战斗结束后改回来
         self.device.stuck_timer_long = Timer(480, count=480).start()
+        #
         config = self.con
-        self.run_general_battle(config)
+        while True:
+            self.screenshot()
+            if self.appear(self.I_BOSS_DONE_CHECK):
+                break
+            if self.appear(self.I_BOSS_GATHER):
+                self.device.stuck_record_clear()
+                self.device.stuck_record_add('BATTLE_STATUS_S')
+                logger.info('Boss Gathering...')
+                sleep(2)
+                continue
+            if self.appear(self.I_BOSS_WAIT):
+                logger.info('Boss battle failed, waiting for 2 seconds...')
+                sleep(2)
+                continue
+            if self.appear(self.I_PREPARE_HIGHLIGHT):
+                self.run_general_battle(config)
+                continue
+            logger.info('Unknown scene Or Boss fight failed.waiting for Prepare_Button appear...')
+            self.wait_until_appear(self.I_PREPARE_HIGHLIGHT, wait_time=2)
+
         self.device.stuck_timer_long = Timer(300, count=300).start()
 
         # 等待回到挑战boss主界面
@@ -256,7 +333,7 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
     def con(self) -> GeneralBattleConfig:
         return GeneralBattleConfig()
 
-    def check_lantern(self, index: int=1):
+    def check_lantern(self, index: int = 1):
         """
         检查灯笼的类型
         :param index: 四个灯笼,从1开始
@@ -363,7 +440,7 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
             if self.click(target_click, interval=1):
                 continue
         logger.info('Question answering Start')
-        for i in range(1,4):
+        for i in range(1, 4):
             # 还未测试题库无法识别的情况
             logger.hr(f'Answer {i}', 3)
             answer_click = answer()
@@ -386,9 +463,7 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
                 if not self.appear(self.I_LETTER_CLOSE):
                     time.sleep(0.5)
                     self.screenshot()
-                    if self.appear(self.I_LETTER_CLOSE):
-                        continue
-                    else:
+                    if not self.appear(self.I_LETTER_CLOSE):
                         logger.warning('Answer finish')
                         return
 
@@ -454,7 +529,6 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
             if self.click(target_click, interval=2.3):
                 continue
 
-
     def check_time(self):
         """
         检查时间是否正确,

+ 6 - 5
tasks/ExperienceYoukai/assets.py

@@ -7,10 +7,11 @@ from module.atom.list import RuleList
 
 # This file was automatically generated by ./dev_tools/assets_extract.py.
 # Don't modify it manually.
-class ExperienceYoukaiAssets:
+class ExperienceYoukaiAssets: 
+
+
+	# Image Rule Assets
+	# 经验妖怪的赢 
+	I_EXP_WIN = RuleImage(roi_front=(380,44,100,100), roi_back=(380,44,100,100), threshold=0.8, method="Template matching", file="./tasks/ExperienceYoukai/ey/ey_exp_win.png")
 
 
-    # Image Rule Assets
-    # 经验妖怪的赢
-	I_EXP_WIN = RuleImage(roi_front=(380, 44, 100, 100), roi_back=(380, 44, 100, 100), threshold=0.8,
-					   method="Template matching", file="./tasks/ExperienceYoukai/ey/ey_exp_win.png")

+ 1 - 1
tasks/GameUi/assets.py

@@ -159,7 +159,7 @@ class GameUiAssets:
 	# description 
 	I_CHECK_TEAM = RuleImage(roi_front=(32,585,82,90), roi_back=(32,585,82,90), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_team.png")
 	# description 
-	I_CHECK_COLLECTION = RuleImage(roi_front=(471,618,100,100), roi_back=(471,618,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_collection.png")
+	I_CHECK_COLLECTION = RuleImage(roi_front=(380,620,100,100), roi_back=(380,620,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_collection.png")
 	# description 
 	I_BACK_Y = RuleImage(roi_front=(15,4,57,52), roi_back=(1,2,100,91), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_back_y.png")
 	# description 

BIN
tasks/GameUi/page/page_check_collection.png


+ 2 - 2
tasks/GameUi/page/page_img_3.json

@@ -137,8 +137,8 @@
   {
     "itemName": "check_collection",
     "imageName": "page_check_collection.png",
-    "roiFront": "471,618,100,100",
-    "roiBack": "471,618,100,100",
+    "roiFront": "380,620,100,100",
+    "roiBack": "380,620,100,100",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"

+ 3 - 0
tasks/Hyakkiyakou/slave/hya_device.py

@@ -1,5 +1,6 @@
 import timeit
 import numpy as np
+from datetime import datetime
 
 from module.base.timer import Timer
 from module.logger import logger
@@ -38,6 +39,8 @@ class HyaDevice(BaseTask):
             logger.error('Fast screenshot check timer reached')
             logger.error('Five minutes have not ended, the game is probably stuck, please check the game')
             raise GameStuckError
+        if self.config.script.error.save_error:
+            self.device.screenshot_deque.append({'time': datetime.now(), 'image': self.device.image})
         return self.device.image
 
     def fast_click(self, x: int, y: int, control_method: ControlMethod = ControlMethod.WINDOW_MESSAGE) -> None:

+ 1 - 1
tasks/MemoryScrolls/config.py

@@ -19,7 +19,7 @@ class ScrollNumber(str, Enum):
 
 class MemoryScrollsConfig(ConfigBase):
     scroll_number: ScrollNumber = Field(default=ScrollNumber.ONE, description='scroll_number_help')
-    auto_delay_exploration: bool = Field(default=True, description='指定绘卷结束后,自动延迟探索任务,避免长时间无意义执行')
+    auto_close_exploration: bool = Field(default=False, description='指定绘卷结束后,自动关闭探索任务,避免长时间无意义执行')
 
 class MemoryScrolls(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)

+ 7 - 5
tasks/MemoryScrolls/script_task.py

@@ -82,11 +82,13 @@ class ScriptTask(GameUi, MemoryScrollsAssets):
         else:
             logger.info(f'Scroll {con.scroll_number.name} is already completed')
             self.set_next_run(task='MemoryScrolls', success=False)
-            if con.auto_delay_exploration:
-                # 自动延迟探索任务
-                logger.info('Auto delay exploration task after Memory Scrolls completion')
-                next_run=datetime.now() + timedelta(days=1)
-                self.set_next_run(task='Exploration', success=False, finish=False, target=next_run)
+            if con.auto_close_exploration:
+                # 自动关闭探索任务
+                logger.info('Auto close exploration task after Memory Scrolls completion')
+                self.config.exploration.scheduler.enable = False
+                self.config.save()
+                # next_run=datetime.now() + timedelta(days=1)
+                # self.set_next_run(task='Exploration', success=False, finish=False, target=next_run)
         # 返回绘卷主界面
         self.ui_click_until_disappear(self.I_MS_CLOSE, interval=1)
         logger.info('Closed Memory Scrolls contribution page')

+ 1 - 1
tasks/Secret/script_task.py

@@ -84,7 +84,7 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, SecretAssets):
                     logger.warning('You have completed the weekly trifles, skip')
                     break
                 text = self.O_SE_TOTAL_TIME.ocr_single(self.device.image)
-                if '总耗时' in text:
+                if '尚未' not in text:
                     logger.warning('You have completed the weekly trifles, skip')
                     break
                 continue

+ 2 - 2
tasks/WeeklyTrifles/assets.py

@@ -51,7 +51,7 @@ class WeeklyTriflesAssets:
 
 	# Image Rule Assets
 	# 点击“式神” 
-	I_WT_SHIKIAGMI = RuleImage(roi_front=(494,650,56,49), roi_back=(494,650,56,49), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_shikiagmi.png")
+	I_WT_SHIKIAGMI = RuleImage(roi_front=(280,620,920,100), roi_back=(280,620,920,100), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_shikiagmi.png")
 	# 点击式神绘卷 
 	I_WT_SCROLL = RuleImage(roi_front=(1128,615,77,67), roi_back=(1128,615,77,67), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_scroll.png")
 	# 点击分享 
@@ -61,7 +61,7 @@ class WeeklyTriflesAssets:
 	# 百妖风物鉴 
 	I_WT_SCROLL_2 = RuleImage(roi_front=(1182,24,24,122), roi_back=(1163,12,63,155), threshold=0.7, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_scroll_2.png")
 	# 微信分享 
-	I_WT_COLLECT_WECHAT = RuleImage(roi_front=(386,619,70,63), roi_back=(386,619,70,63), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_collect_wechat.png")
+	I_WT_COLLECT_WECHAT = RuleImage(roi_front=(280,600,440,100), roi_back=(280,600,440,100), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_collect_wechat.png")
 	# 二维码 
 	I_WT_QR_CODE = RuleImage(roi_front=(473,161,336,96), roi_back=(404,112,483,168), threshold=0.65, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_qr_code.png")
 

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

@@ -2,8 +2,8 @@
   {
     "itemName": "wt_shikiagmi",
     "imageName": "collect_wt_shikiagmi.png",
-    "roiFront": "494,650,56,49",
-    "roiBack": "494,650,56,49",
+    "roiFront": "280,620,920,100",
+    "roiBack": "280,620,920,100",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "点击“式神”"
@@ -47,8 +47,8 @@
   {
     "itemName": "wt_collect_wechat",
     "imageName": "collect_wt_collect_wechat.png",
-    "roiFront": "386,619,70,63",
-    "roiBack": "386,619,70,63",
+    "roiFront": "280,600,440,100",
+    "roiBack": "280,600,440,100",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "微信分享"