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

Merge pull request #1813 from runhey/dev

Automated PR 2026.09.11
github-actions[bot] 2 месяцев назад
Родитель
Сommit
7730f555a1
56 измененных файлов с 466 добавлено и 29 удалено
  1. 1 1
      .github/workflows/auto-create-pr.yaml
  2. 3 1
      .github/workflows/github-mirror.yml
  3. 4 1
      assets/i18n/zh-CN.json
  4. 6 0
      module/ocr/sub_ocr.py
  5. 2 2
      tasks/ActivityShikigami/assets.py
  6. 2 2
      tasks/ActivityShikigami/fire/ocr.json
  7. 13 1
      tasks/Component/Costume/assets.py
  8. 3 2
      tasks/Component/Costume/config.py
  9. 3 3
      tasks/Component/Costume/costume_base.py
  10. 1 1
      tasks/Component/Costume/costume_test_shikigami.py
  11. 47 0
      tasks/Component/Costume/main16/image.json
  12. BIN
      tasks/Component/Costume/main16/main16_check_main_16.png
  13. BIN
      tasks/Component/Costume/main16/main16_main_goto_exploration_16.png
  14. BIN
      tasks/Component/Costume/main16/main16_main_goto_summon_16.png
  15. BIN
      tasks/Component/Costume/main16/main16_main_goto_town_16.png
  16. BIN
      tasks/Component/Costume/main16/main16_pet_house_16.png
  17. 17 0
      tasks/Component/CostumeBattle/assets.py
  18. BIN
      tasks/Component/CostumeBattle/battle15/battle15_battle_info_15.png
  19. BIN
      tasks/Component/CostumeBattle/battle15/battle15_de_win_15.png
  20. BIN
      tasks/Component/CostumeBattle/battle15/battle15_exit_15.png
  21. BIN
      tasks/Component/CostumeBattle/battle15/battle15_false_15.png
  22. BIN
      tasks/Component/CostumeBattle/battle15/battle15_friends_15.png
  23. BIN
      tasks/Component/CostumeBattle/battle15/battle15_local_15.png
  24. BIN
      tasks/Component/CostumeBattle/battle15/battle15_win_15.png
  25. 65 0
      tasks/Component/CostumeBattle/battle15/image.json
  26. 43 0
      tasks/Component/CostumeShikigami/assets.py
  27. 182 0
      tasks/Component/CostumeShikigami/sk12/image.json
  28. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_check_records_12.png
  29. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_record_soul_back_12.png
  30. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_1_12.png
  31. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_2_12.png
  32. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_3_12.png
  33. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_4_12.png
  34. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_5_12.png
  35. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_6_12.png
  36. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_7_12.png
  37. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_check_in_12.png
  38. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_click_present_12.png
  39. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_1_12.png
  40. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_2_12.png
  41. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_3_12.png
  42. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_4_12.png
  43. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_sure_12.png
  44. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_team_present_12.png
  45. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_soul_preset_12.png
  46. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_st_replace_12.png
  47. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_st_souls_12.png
  48. 5 3
      tasks/Component/GeneralBattle/assets.py
  49. 11 4
      tasks/Component/GeneralBattle/battle_wait.py
  50. 37 2
      tasks/Component/GeneralBattle/general_battle.py
  51. 2 2
      tasks/Component/GeneralBattle/gw/click.json
  52. BIN
      tasks/Component/GeneralBattle/gw/gw_end_fix_1.png
  53. BIN
      tasks/Component/GeneralBattle/gw/gw_end_fix_3.png
  54. 12 3
      tasks/Component/GeneralBattle/gw/image.json
  55. 3 0
      tasks/Exploration/base.py
  56. 4 1
      tasks/Exploration/solo.py

+ 1 - 1
.github/workflows/auto-create-pr.yaml

@@ -3,7 +3,7 @@ name: Auto Create PR from dev to master
 on:
   schedule:
     # 每周四北京时间21点触发(UTC时间13点)
-    - cron: '0 13 * * 4'
+    - cron: '7 13 * * 4'
   workflow_dispatch:
 
 jobs:

+ 3 - 1
.github/workflows/github-mirror.yml

@@ -6,6 +6,8 @@ on:
   push:
     branches:
       - master
+      - dev
+  pull_request:
 name: GitHub-Mirrors
 
 jobs:
@@ -62,4 +64,4 @@ jobs:
 
       - name: Print cache path
         run: |
-          ls -la ${{ github.workspace }}/hub-mirror-cache
+          ls -la ${{ github.workspace }}/hub-mirror-cache

+ 4 - 1
assets/i18n/zh-CN.json

@@ -42,6 +42,7 @@
   "emulator_startup_lead_time_help": "在开始运行任务之前提前启动模拟器的时间",
   "exit_four_help": "支持打九退四,保证稳定57级,要求设置好战斗主题,即 脚本->全局配置->游戏装饰自定义->战斗主题",
   "costume_main_15": "茨心乐园",
+  "costume_main_16": "狐栖归处",
   "check_true_orochi_enable": "是否在结束后检测真蛇",
   "check_true_orochi_enable_help": "开启后会在任务结束后检测是否出现真蛇, 若出现则自动拉起真蛇",
   "enable_book_auto": "自动选择",
@@ -134,5 +135,7 @@
   "ap100_green_mark": "100体爬塔绿标位置",
   "ap100_green_mark_help": "100体爬塔绿标位置",
   "enable_ap100_anti_detect": "100体爬塔防检测",
-  "enable_ap100_anti_detect_help": "100体爬塔战斗过程是否随机点击或滑动"
+  "enable_ap100_anti_detect_help": "100体爬塔战斗过程是否随机点击或滑动",
+  "costume_battle_15": "灵狐寄愿",
+  "costume_shikigami_12": "拾光之窗"
 }

+ 6 - 0
module/ocr/sub_ocr.py

@@ -110,6 +110,12 @@ class Digit(Single):
         result = [char for char in result if char.isdigit()]
         result = ''.join(result)
 
+        # 如果结果全部是 '0' 且长度 >= 2,视为 OCR 错误(例如 900 → 00),强制设为 "1"
+        if result and all(ch == '0' for ch in result) and len(result) >= 2:
+            logger.warning(f'OCR [{self.name} {result}] all-zero with length>=2, force set to "1"')
+            result = '1'
+
+
         prev = result
         result = int(result) if result else 0
         if str(result) != prev:

+ 2 - 2
tasks/ActivityShikigami/assets.py

@@ -94,9 +94,9 @@ class ActivityShikigamiAssets:
 	# 挑战 
 	O_FIRE = RuleOcr(roi=(1135,599,85,49), area=(1123,570,106,100), mode="Single", method="Default", keyword="挑战", name="fire")
 	# 体力的数量检测 
-	O_REMAIN_AP = RuleOcr(roi=(584,17,63,27), area=(583,16,63,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
+	O_REMAIN_AP = RuleOcr(roi=(584,17,63,27), area=(583,16,63,30), mode="Digit", method="Default", keyword="", name="remain_ap")
 	# 活动体力的剩余检测 
-	O_REMAIN_PASS = RuleOcr(roi=(791,18,50,29), area=(791,18,49,28), mode="DigitCounter", method="Default", keyword="", name="remain_pass")
+	O_REMAIN_PASS = RuleOcr(roi=(791,18,50,29), area=(791,18,49,28), mode="Digit", method="Default", keyword="", name="remain_pass")
 	# 还有多少次购买体力的机会 
 	O_REMAIN_BUY = RuleOcr(roi=(808,531,39,42), area=(808,531,39,42), mode="DigitCounter", method="Default", keyword="", name="remain_buy")
 	# 活动票数(没有百分比) 

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

@@ -12,7 +12,7 @@
     "itemName": "remain_ap",
     "roiFront": "584,17,63,27",
     "roiBack": "583,16,63,30",
-    "mode": "DigitCounter",
+    "mode": "Digit",
     "method": "Default",
     "keyword": "",
     "description": "体力的数量检测"
@@ -21,7 +21,7 @@
     "itemName": "remain_pass",
     "roiFront": "791,18,50,29",
     "roiBack": "791,18,49,28",
-    "mode": "DigitCounter",
+    "mode": "Digit",
     "method": "Default",
     "keyword": "",
     "description": "活动体力的剩余检测"

+ 13 - 1
tasks/Component/Costume/assets.py

@@ -101,6 +101,19 @@ class CostumeAssets:
 	I_PET_HOUSE_15 = RuleImage(roi_front=(951,383,31,50), roi_back=(900,330,150,150), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main15/main15_pet_house_15.png")
 
 
+	# Image Rule Assets
+	# 狐栖归处庭院判定
+	I_CHECK_MAIN_16 = RuleImage(roi_front=(260,168,80,54), roi_back=(180,100,240,180), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main16/main16_check_main_16.png")
+	# 探索
+	I_MAIN_GOTO_EXPLORATION_16 = RuleImage(roi_front=(729,231,28,52), roi_back=(680,180,130,150), threshold=0.55, method="Template matching", file="./tasks/Component/Costume/main16/main16_main_goto_exploration_16.png")
+	# 召唤屋
+	I_MAIN_GOTO_SUMMON_16 = RuleImage(roi_front=(981,218,28,24), roi_back=(930,170,130,150), threshold=0.55, method="Template matching", file="./tasks/Component/Costume/main16/main16_main_goto_summon_16.png")
+	# 町中
+	I_MAIN_GOTO_TOWN_16 = RuleImage(roi_front=(1014,346,14,34), roi_back=(960,300,100,120), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main16/main16_main_goto_town_16.png")
+	# 宠物屋
+	I_PET_HOUSE_16 = RuleImage(roi_front=(1256,402,20,58), roi_back=(1210,340,70,140), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main16/main16_pet_house_16.png")
+
+
 	# Image Rule Assets
 	# description 
 	I_CHECK_MAIN_2 = RuleImage(roi_front=(1090,146,48,55), roi_back=(880,108,271,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main2/main2_check_main_2.png")
@@ -204,4 +217,3 @@ class CostumeAssets:
 	# description 
 	I_PET_HOUSE_9 = RuleImage(roi_front=(888,327,40,35), roi_back=(730,316,440,57), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main9/main9_pet_house_9.png")
 
-

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

@@ -22,6 +22,7 @@ class MainType(str, Enum):
     COSTUME_MAIN_13 = 'costume_main_13'  # 云景阆苑
     COSTUME_MAIN_14 = 'costume_main_14'  # 雪月华庭
     COSTUME_MAIN_15 = 'costume_main_15'  # 茨心乐园
+    COSTUME_MAIN_16 = 'costume_main_16'  # 狐栖归处
 
 # 结界皮肤
 class RealmType(str, Enum):
@@ -52,6 +53,7 @@ class ShikigamiType(str, Enum):
     COSTUME_SHIKIGAMI_9 = 'costume_shikigami_9'  # 鹿眠之森
     COSTUME_SHIKIGAMI_10 = 'costume_shikigami_10'  # 今宵胧明
     COSTUME_SHIKIGAMI_11 = 'costume_shikigami_11'  # 花札幕台
+    COSTUME_SHIKIGAMI_12 = 'costume_shikigami_12'  # 拾光之窗
 
 # 签到主题
 class SignType(str, Enum):
@@ -74,7 +76,7 @@ class BattleType(str, Enum):
     COSTUME_BATTLE_12 = 'costume_battle_12'  # 招财纳福
     COSTUME_BATTLE_13 = 'costume_battle_13'  # 登云问翠
     COSTUME_BATTLE_14 = 'costume_battle_14'  # 茸茨跃动
-
+    COSTUME_BATTLE_15 = 'costume_battle_15'  # 灵狐寄愿
 
 
 class CostumeConfig(BaseModel):
@@ -101,4 +103,3 @@ class CostumeConfig(BaseModel):
 
 
 
-

+ 3 - 3
tasks/Component/Costume/costume_base.py

@@ -21,7 +21,7 @@ main_costume_model = {
         'I_MAIN_GOTO_SUMMON': f'I_MAIN_GOTO_SUMMON_{i}',
         'I_MAIN_GOTO_TOWN': f'I_MAIN_GOTO_TOWN_{i}',
         'I_PET_HOUSE': f'I_PET_HOUSE_{i}'
-    } for i in range(1, 16)
+    } for i in range(1, 17)
 }
 
 
@@ -46,7 +46,7 @@ battle_theme_model = {
         'I_WIN': f'I_WIN_{i}', # 已知:8,12,13,14
         'I_DE_WIN': f'I_DE_WIN_{i}', # 已知:8,12,13,14
         'I_FALSE': f'I_FALSE_{i}' # 已知:8,12,13,14
-    } for i in range(1, 15)
+    } for i in range(1, 16)
 }
 
 # 幕间主题
@@ -69,7 +69,7 @@ shikigami_costume_model = {
         'I_ST_SOULS': f'I_ST_SOULS_{i}',
         'I_ST_REPLACE': f'I_ST_REPLACE_{i}',
     }
-    for i in range(1, 12)  # 目前支持 COSTUME_SHIKIGAMI_1 到 COSTUME_SHIKIGAMI_10
+    for i in range(1, 13)  # 目前支持 COSTUME_SHIKIGAMI_1 到 COSTUME_SHIKIGAMI_12
 }
 
 class CostumeBase:

+ 1 - 1
tasks/Component/Costume/costume_test_shikigami.py

@@ -162,6 +162,6 @@ if __name__ == '__main__':
     c = Config('oas1')
     d = Device(c)
     t = ScriptTask(c, d)
-    t.set_costume(ShikigamiType.COSTUME_SHIKIGAMI_4)
+    t.set_costume(ShikigamiType.COSTUME_SHIKIGAMI_12)
     # t.set_costume(ShikigamiType.COSTUME_SHIKIGAMI_DEFAULT)
     t.run()

+ 47 - 0
tasks/Component/Costume/main16/image.json

@@ -0,0 +1,47 @@
+[
+  {
+    "itemName": "check_main_16",
+    "imageName": "main16_check_main_16.png",
+    "roiFront": "260,168,80,54",
+    "roiBack": "180,100,240,180",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "狐栖归处庭院判定"
+  },
+  {
+    "itemName": "main_goto_exploration_16",
+    "imageName": "main16_main_goto_exploration_16.png",
+    "roiFront": "729,231,28,52",
+    "roiBack": "680,180,130,150",
+    "method": "Template matching",
+    "threshold": 0.55,
+    "description": "探索"
+  },
+  {
+    "itemName": "main_goto_summon_16",
+    "imageName": "main16_main_goto_summon_16.png",
+    "roiFront": "981,218,28,24",
+    "roiBack": "930,170,130,150",
+    "method": "Template matching",
+    "threshold": 0.55,
+    "description": "召唤屋"
+  },
+  {
+    "itemName": "main_goto_town_16",
+    "imageName": "main16_main_goto_town_16.png",
+    "roiFront": "1014,346,14,34",
+    "roiBack": "960,300,100,120",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "町中"
+  },
+  {
+    "itemName": "pet_house_16",
+    "imageName": "main16_pet_house_16.png",
+    "roiFront": "1256,402,20,58",
+    "roiBack": "1210,340,70,140",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "宠物屋"
+  }
+]

BIN
tasks/Component/Costume/main16/main16_check_main_16.png


BIN
tasks/Component/Costume/main16/main16_main_goto_exploration_16.png


BIN
tasks/Component/Costume/main16/main16_main_goto_summon_16.png


BIN
tasks/Component/Costume/main16/main16_main_goto_town_16.png


BIN
tasks/Component/Costume/main16/main16_pet_house_16.png


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

@@ -94,6 +94,23 @@ class CostumeBattleAssets:
 	I_BATTLE_INFO_14 = RuleImage(roi_front=(234,17,32,32), roi_back=(215,0,142,58), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle14/battle14_battle_info_14.png")
 
 
+	# Image Rule Assets
+	# 左上角退出 
+	I_EXIT_15 = RuleImage(roi_front=(25,20,22,25), roi_back=(10,10,69,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_exit_15.png")
+	# 左上角好友 
+	I_FRIENDS_15 = RuleImage(roi_front=(98,15,22,30), roi_back=(74,10,71,47), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_friends_15.png")
+	# 指针 
+	I_LOCAL_15 = RuleImage(roi_front=(25,561,28,37), roi_back=(9,485,110,121), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_local_15.png")
+	# 战斗胜利 
+	I_WIN_15 = RuleImage(roi_front=(544,190,68,67), roi_back=(390,30,510,290), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_win_15.png")
+	# 针对封魔的特殊 
+	I_DE_WIN_15 = RuleImage(roi_front=(590,152,87,129), roi_back=(390,30,510,290), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_de_win_15.png")
+	# 失败 
+	I_FALSE_15 = RuleImage(roi_front=(597,190,57,66), roi_back=(390,30,510,290), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_false_15.png")
+	# 战斗信息标识 
+	I_BATTLE_INFO_15 = RuleImage(roi_front=(234,17,32,32), roi_back=(215,0,142,58), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle15/battle15_battle_info_15.png")
+
+
 	# Image Rule Assets
 	# description 
 	I_LOCAL_2 = RuleImage(roi_front=(30,569,21,22), roi_back=(30,569,21,22), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle2/battle2_local_2.png")

BIN
tasks/Component/CostumeBattle/battle15/battle15_battle_info_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_de_win_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_exit_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_false_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_friends_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_local_15.png


BIN
tasks/Component/CostumeBattle/battle15/battle15_win_15.png


+ 65 - 0
tasks/Component/CostumeBattle/battle15/image.json

@@ -0,0 +1,65 @@
+[
+  {
+    "itemName": "exit_15",
+    "imageName": "battle15_exit_15.png",
+    "roiFront": "25,20,22,25",
+    "roiBack": "10,10,69,48",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角退出"
+  },
+  {
+    "itemName": "friends_15",
+    "imageName": "battle15_friends_15.png",
+    "roiFront": "98,15,22,30",
+    "roiBack": "74,10,71,47",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友"
+  },
+  {
+    "itemName": "local_15",
+    "imageName": "battle15_local_15.png",
+    "roiFront": "25,561,28,37",
+    "roiBack": "9,485,110,121",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "指针"
+  },
+  {
+    "itemName": "win_15",
+    "imageName": "battle15_win_15.png",
+    "roiFront": "544,190,68,67",
+    "roiBack": "390,30,510,290",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "战斗胜利"
+  },
+  {
+    "itemName": "de_win_15",
+    "imageName": "battle15_de_win_15.png",
+    "roiFront": "590,152,87,129",
+    "roiBack": "390,30,510,290",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "针对封魔的特殊"
+  },
+  {
+    "itemName": "false_15",
+    "imageName": "battle15_false_15.png",
+    "roiFront": "597,190,57,66",
+    "roiBack": "390,30,510,290",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "失败"
+  },
+  {
+    "itemName": "battle_info_15",
+    "imageName": "battle15_battle_info_15.png",
+    "roiFront": "234,17,32,32",
+    "roiBack": "215,0,142,58",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "战斗信息标识"
+  }
+]

+ 43 - 0
tasks/Component/CostumeShikigami/assets.py

@@ -139,6 +139,49 @@ class CostumeShikigamiAssets:
 	I_SOU_CLICK_PRESENT_11 = RuleImage(roi_front=(975,292,34,34), roi_back=(971,134,42,530), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk11/sk11_sou_click_present_11.png")
 
 
+	# Image Rule Assets
+	# description 
+	I_CHECK_RECORDS_12 = RuleImage(roi_front=(276,81,31,36), roi_back=(269,73,44,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_check_records_12.png")
+	# description 
+	I_RECORD_SOUL_BACK_12 = RuleImage(roi_front=(17,13,43,47), roi_back=(12,10,52,55), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_record_soul_back_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_1_12 = RuleImage(roi_front=(1095,83,14,50), roi_back=(1092,81,21,55), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_1_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_2_12 = RuleImage(roi_front=(1095,155,14,39), roi_back=(1092,149,20,51), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_2_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_3_12 = RuleImage(roi_front=(1096,225,8,50), roi_back=(1093,220,17,56), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_3_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_4_12 = RuleImage(roi_front=(1093,295,11,47), roi_back=(1090,293,19,51), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_4_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_5_12 = RuleImage(roi_front=(1096,364,8,49), roi_back=(1092,361,15,55), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_5_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_6_12 = RuleImage(roi_front=(1093,442,11,37), roi_back=(1088,437,20,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_6_12.png")
+	# description 
+	I_SOU_CHECK_GROUP_7_12 = RuleImage(roi_front=(1093,506,6,41), roi_back=(1091,500,13,53), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_7_12.png")
+	# description 
+	I_SOU_SWITCH_1_12 = RuleImage(roi_front=(977,138,32,30), roi_back=(969,129,48,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_1_12.png")
+	# description 
+	I_SOU_SWITCH_2_12 = RuleImage(roi_front=(973,293,37,32), roi_back=(968,287,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_2_12.png")
+	# description 
+	I_SOU_SWITCH_3_12 = RuleImage(roi_front=(981,445,26,35), roi_back=(979,443,32,40), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_3_12.png")
+	# description 
+	I_SOU_SWITCH_4_12 = RuleImage(roi_front=(979,602,28,25), roi_back=(973,598,39,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_4_12.png")
+	# description 
+	I_SOU_TEAM_PRESENT_12 = RuleImage(roi_front=(734,77,100,41), roi_back=(726,71,115,54), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_team_present_12.png")
+	# description 
+	I_SOU_SWITCH_SURE_12 = RuleImage(roi_front=(702,401,116,55), roi_back=(690,399,148,64), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_sure_12.png")
+	# description 
+	I_SOUL_PRESET_12 = RuleImage(roi_front=(342,85,74,31), roi_back=(338,77,83,44), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_soul_preset_12.png")
+	# description 
+	I_ST_REPLACE_12 = RuleImage(roi_front=(884,169,63,67), roi_back=(872,155,86,99), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_st_replace_12.png")
+	# description 
+	I_ST_SOULS_12 = RuleImage(roi_front=(1192,237,40,67), roi_back=(1182,229,59,86), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_st_souls_12.png")
+	# description 
+	I_SOU_CHECK_IN_12 = RuleImage(roi_front=(274,74,43,49), roi_back=(271,69,48,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_check_in_12.png")
+	# description 
+	I_SOU_CLICK_PRESENT_12 = RuleImage(roi_front=(975,292,34,34), roi_back=(971,134,42,530), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_click_present_12.png")
+
+
 	# Image Rule Assets
 	# 用于判断在式神录 
 	I_CHECK_RECORDS_2 = RuleImage(roi_front=(267,76,51,46), roi_back=(265,74,55,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk2/sk2_check_records_2.png")

+ 182 - 0
tasks/Component/CostumeShikigami/sk12/image.json

@@ -0,0 +1,182 @@
+[
+  {
+    "itemName": "check_records_12",
+    "imageName": "sk12_check_records_12.png",
+    "roiFront": "276,81,31,36",
+    "roiBack": "269,73,44,48",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "record_soul_back_12",
+    "imageName": "sk12_record_soul_back_12.png",
+    "roiFront": "17,13,43,47",
+    "roiBack": "12,10,52,55",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_1_12",
+    "imageName": "sk12_sou_check_group_1_12.png",
+    "roiFront": "1095,83,14,50",
+    "roiBack": "1092,81,21,55",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_2_12",
+    "imageName": "sk12_sou_check_group_2_12.png",
+    "roiFront": "1095,155,14,39",
+    "roiBack": "1092,149,20,51",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_3_12",
+    "imageName": "sk12_sou_check_group_3_12.png",
+    "roiFront": "1096,225,8,50",
+    "roiBack": "1093,220,17,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_4_12",
+    "imageName": "sk12_sou_check_group_4_12.png",
+    "roiFront": "1093,295,11,47",
+    "roiBack": "1090,293,19,51",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_5_12",
+    "imageName": "sk12_sou_check_group_5_12.png",
+    "roiFront": "1096,364,8,49",
+    "roiBack": "1092,361,15,55",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_6_12",
+    "imageName": "sk12_sou_check_group_6_12.png",
+    "roiFront": "1093,442,11,37",
+    "roiBack": "1088,437,20,48",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_7_12",
+    "imageName": "sk12_sou_check_group_7_12.png",
+    "roiFront": "1093,506,6,41",
+    "roiBack": "1091,500,13,53",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_1_12",
+    "imageName": "sk12_sou_switch_1_12.png",
+    "roiFront": "977,138,32,30",
+    "roiBack": "969,129,48,50",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_2_12",
+    "imageName": "sk12_sou_switch_2_12.png",
+    "roiFront": "973,293,37,32",
+    "roiBack": "968,287,50,49",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_3_12",
+    "imageName": "sk12_sou_switch_3_12.png",
+    "roiFront": "981,445,26,35",
+    "roiBack": "979,443,32,40",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_4_12",
+    "imageName": "sk12_sou_switch_4_12.png",
+    "roiFront": "979,602,28,25",
+    "roiBack": "973,598,39,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_team_present_12",
+    "imageName": "sk12_sou_team_present_12.png",
+    "roiFront": "734,77,100,41",
+    "roiBack": "726,71,115,54",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_sure_12",
+    "imageName": "sk12_sou_switch_sure_12.png",
+    "roiFront": "702,401,116,55",
+    "roiBack": "690,399,148,64",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "soul_preset_12",
+    "imageName": "sk12_soul_preset_12.png",
+    "roiFront": "342,85,74,31",
+    "roiBack": "338,77,83,44",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_replace_12",
+    "imageName": "sk12_st_replace_12.png",
+    "roiFront": "884,169,63,67",
+    "roiBack": "872,155,86,99",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_souls_12",
+    "imageName": "sk12_st_souls_12.png",
+    "roiFront": "1192,237,40,67",
+    "roiBack": "1182,229,59,86",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_in_12",
+    "imageName": "sk12_sou_check_in_12.png",
+    "roiFront": "274,74,43,49",
+    "roiBack": "271,69,48,61",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_click_present_12",
+    "imageName": "sk12_sou_click_present_12.png",
+    "roiFront": "975,292,34,34",
+    "roiBack": "971,134,42,530",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

BIN
tasks/Component/CostumeShikigami/sk12/sk12_check_records_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_record_soul_back_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_1_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_2_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_3_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_4_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_5_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_6_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_group_7_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_check_in_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_click_present_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_1_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_2_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_3_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_4_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_sure_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_sou_team_present_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_soul_preset_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_st_replace_12.png


BIN
tasks/Component/CostumeShikigami/sk12/sk12_st_souls_12.png


+ 5 - 3
tasks/Component/GeneralBattle/assets.py

@@ -168,7 +168,7 @@ class GeneralBattleAssets:
 
 	# Click Rule Assets
 	# 右上角的聊天信息 
-	C_END_MESSAGE_RIGHT_TOP = RuleClick(roi_front=(846,4,404,34), roi_back=(846,4,404,34), name="end_message_right_top")
+	C_END_MESSAGE_RIGHT_TOP = RuleClick(roi_front=(848,0,399,46), roi_back=(849,0,397,45), name="end_message_right_top")
 	# description 
 	C_END_BUFF_AREA_1 = RuleClick(roi_front=(150,638,295,41), roi_back=(150,638,295,41), name="end_buff_area_1")
 	# description 
@@ -243,8 +243,10 @@ class GeneralBattleAssets:
 
 	# Image Rule Assets
 	# description 
-	I_END_FIX_1 = RuleImage(roi_front=(896,251,218,64), roi_back=(119,66,1136,620), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_1.png")
+	I_END_FIX_1 = RuleImage(roi_front=(721,119,89,58), roi_back=(119,66,1136,620), threshold=0.85, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_1.png")
 	# description 
-	I_END_FIX_2 = RuleImage(roi_front=(800,251,100,33), roi_back=(32,90,1137,547), threshold=0.7, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_2.png")
+	I_END_FIX_2 = RuleImage(roi_front=(800,251,100,33), roi_back=(32,90,1137,547), threshold=0.85, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_2.png")
+	#  
+	I_END_FIX_3 = RuleImage(roi_front=(871,278,150,49), roi_back=(119,66,1136,620), threshold=0.85, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_3.png")
 
 

+ 11 - 4
tasks/Component/GeneralBattle/battle_wait.py

@@ -435,9 +435,12 @@ class BattleWait(BaseTask, GeneralBattleAssets):
         return HookSignal.CONTINUE
 
     def _bw_randomclick_default(self, bw_ctx: BattleWaitContext) -> HookSignal:
+        done = getattr(bw_ctx, '_bw_randomclick_state', False)
+        if done:
+            return HookSignal.CONTINUE
         if not self.is_in_battle(is_screenshot=False):
             return HookSignal.CONTINUE
-        if 0 <= random.randint(0, 500) <= 20:  # 百分之4的概率
+        if random.random() < 0.005 :  # 低概率
             rand_type = random.randint(0, 2)
             match rand_type:
                 case 0:
@@ -446,6 +449,7 @@ class BattleWait(BaseTask, GeneralBattleAssets):
                     self.swipe(self.S_BATTLE_RANDOM_LEFT, interval=20)
                 case 2:
                     self.swipe(self.S_BATTLE_RANDOM_RIGHT, interval=20)
+            setattr(bw_ctx, f'_bw_randomclick_state', True)
             # 重新设置为长战斗
             # self.device.stuck_record_add('BATTLE_STATUS_S')
         else:
@@ -520,8 +524,11 @@ class BattleWait(BaseTask, GeneralBattleAssets):
             self.screenshot()
 
             # 不小心点到了具体的奖励,他会弹出这个物品的详细描述 里面必定包含有“获取途径”
-            if self.appear(self.I_END_FIX_1) or self.appear(self.I_END_FIX_2):
-                self.click(self.C_REWARD_2, interval=1.5)
+            if self.appear(self.I_END_FIX_1) or self.appear(self.I_END_FIX_2) or self.appear(self.I_END_FIX_3):
+                self.screenshot()
+                if self.appear(self.I_END_FIX_1) or self.appear(self.I_END_FIX_2) or self.appear(self.I_END_FIX_3):
+                    self.click(self.C_REWARD_2, interval=2.5)
+                continue
 
             if self.appear(self.I_UI_REWARD):
                 if random.random() < 0.02:
@@ -532,7 +539,7 @@ class BattleWait(BaseTask, GeneralBattleAssets):
                 self.click(self.exclude_click_activity, interval=1.5)
             elif not self.appear(self.I_END_FIX_2):
                 self.screenshot()
-                if self.appear(self.I_UI_REWARD) or self.appear(self.I_END_FIX_2):
+                if any([self.appear(self.I_UI_REWARD), self.appear(self.I_END_FIX_1), self.appear(self.I_END_FIX_2), self.appear(self.I_END_FIX_3)]):
                     continue
                 logger.info('Get all reward')
                 bw_ctx.success = True

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

@@ -38,12 +38,19 @@ class GeneralBattle(BattleWait, GeneralBuff):
         self.current_count += 1
         logger.info(f"Current count: {self.current_count}")
         # 战前设置
-        self.battle_before(buff, config)
+        if not self.battle_before(buff, config):
+            # battle_before 超时未进入战斗: 常见原因是点击"开始战斗"时被预设面板的关闭动画拦截,
+            # 点击未生效。此时画面已经稳定(面板动画已结束), 再识别一次:
+            # 若仍在战斗准备界面则再点击一次开始战斗, 若已进入战斗则直接继续。
+            if not self.retry_prepare_click():
+                logger.warning('battle_before failed: not in real battle within timeout, '
+                               'skip this battle and return False')
+                return False
         # 绿标
         if self.is_in_battle(False):
             self.green_mark(config.green_enable, config.green_mark)
         # 战中设置
-        win = self.battle_wait(config.random_click_swipt_enable)
+        win = self.battle_wait(random_click_swipt_enable=config.random_click_swipt_enable)
         if win:
             return True
         else:
@@ -78,6 +85,34 @@ class GeneralBattle(BattleWait, GeneralBuff):
             sleep(random.uniform(0.4, 0.8))
         return False
 
+    def retry_prepare_click(self, timeout: float = 3) -> bool:
+        """
+        battle_before 超时后的补偿: 再次识别画面并尝试开始战斗。
+        点击"开始战斗"可能被预设面板关闭动画拦截而未生效, 超时返回后画面已稳定,
+        此时若仍在战斗准备界面则再点击一次开始战斗; 若已进入战斗则直接成功。
+        :return: True: 超时内确认已进入真实战斗
+                 False: 超时仍未进入战斗(界面异常, 应由上层按战斗失败处理)
+        """
+        timer = Timer(timeout).start()
+        clicked = False  # 只补点一次, 避免在界面切换/点击延迟期间重复触发开始战斗
+        while not timer.reached():
+            self.screenshot()
+            if self.is_in_real_battle(False):  # 已经进入战斗
+                return True
+            if self.is_in_prepare(False):  # 仍在准备界面
+                if not clicked:
+                    clicked = True  # 只补点一次: 无论本次点击是否成功, 之后仅轮询
+                    if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=0.8):
+                        continue
+                    sleep(0.3)
+                    continue
+                # 已补点过一次, 只轮询等待进入战斗, 不再重复点击
+                sleep(0.3)
+                continue
+            # 未知界面, 等待画面变化
+            sleep(random.uniform(0.4, 0.8))
+        return False
+
     def run_general_battle_back(self, config: GeneralBattleConfig = None, exit_four: bool = False) -> bool:
         """
         进入挑战然后直接返回

+ 2 - 2
tasks/Component/GeneralBattle/gw/click.json

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "end_message_right_top",
-    "roiFront": "846,4,404,34",
-    "roiBack": "846,4,404,34",
+    "roiFront": "848,0,399,46",
+    "roiBack": "849,0,397,45",
     "description": "右上角的聊天信息"
   },
   {

BIN
tasks/Component/GeneralBattle/gw/gw_end_fix_1.png


BIN
tasks/Component/GeneralBattle/gw/gw_end_fix_3.png


+ 12 - 3
tasks/Component/GeneralBattle/gw/image.json

@@ -2,10 +2,10 @@
   {
     "itemName": "end_fix_1",
     "imageName": "gw_end_fix_1.png",
-    "roiFront": "896,251,218,64",
+    "roiFront": "721,119,89,58",
     "roiBack": "119,66,1136,620",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.85,
     "description": "description"
   },
   {
@@ -14,7 +14,16 @@
     "roiFront": "800,251,100,33",
     "roiBack": "32,90,1137,547",
     "method": "Template matching",
-    "threshold": 0.7,
+    "threshold": 0.85,
     "description": "description"
+  },
+  {
+    "itemName": "end_fix_3",
+    "imageName": "gw_end_fix_3.png",
+    "roiFront": "871,278,150,49",
+    "roiBack": "119,66,1136,620",
+    "method": "Template matching",
+    "threshold": 0.85,
+    "description": ""
   }
 ]

+ 3 - 0
tasks/Exploration/base.py

@@ -198,6 +198,9 @@ class BaseExploration(GameUi, GeneralBattle, GeneralRoom, GeneralInvite, Replace
             if self.is_in_battle():
                 logger.warning('Opening settings failed due to now in battle')
                 return
+            if (self.appear_then_click(self.I_UI_CONFIRM, interval=1)
+                    or self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1)):
+                continue
             if self.click(self.C_CLICK_SETTINGS, interval=2):
                 continue
 

+ 4 - 1
tasks/Exploration/solo.py

@@ -87,11 +87,14 @@ class SoloExploration(BaseExploration):
                 if not self.explore_init:
                     if self._config.exploration_config.auto_rotate == AutoRotate.yes:
                         self.enter_settings_and_do_operations()
-                    self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
+                    self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON, timeout=5)
                     self.explore_init = True
                     continue
                 if self._handle_treasure_box():
                     continue
+                if (self.appear_then_click(self.I_UI_CONFIRM, interval=1)
+                        or self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1)):
+                    continue
                 # 小纸人
                 if self.appear(self.I_BATTLE_REWARD):
                     if self.ui_get_reward(self.I_BATTLE_REWARD):