Explorar el Código

Merge upstream dev while preserving local fixes

Merge runhey/OnmyojiAutoScript dev at 582d8f5b (15 commits, including
three merge commits). Adopt MemoryScrolls contribution limits, Duel MVP
share detection, activity navigation, shared UI assets, circular-back
recovery, and bounded battle completion clicks.

Keep the local cropped confirm/cancel templates and expand their search
regions. Preserve exit-dialog priority, scene-chest recognition, mail
collection, raid ticket recovery/counting, chapter scrolling, repeated
realm failure handling, and context-local battle strategies. Remove only
obsolete duplicate assets and retain both reward-title variants through
the existing multi-image matcher.

Handle both activity result styles, wait for the correct boss/main return
screen, and use click rules for the five occupation choices whose upstream
image definitions are missing or stale. Update regression replays for the
shared assets and cover bounded completion and contribution loops.

Validation: 279 pytest tests passed (tests plus FrogBoss unit tests).
Changed Python modules import successfully; Python/JSON syntax, PNGs,
asset metadata/references, and git diff checks passed. No emulator run.
unknown hace 1 mes
padre
commit
3289033f7e
Se han modificado 96 ficheros con 529 adiciones y 458 borrados
  1. 2 2
      tasks/AbyssShadows/script_task.py
  2. BIN
      tasks/ActivityShikigami/as/as_lock.png
  3. BIN
      tasks/ActivityShikigami/as/as_shi.png
  4. BIN
      tasks/ActivityShikigami/as/as_to_battle_main.png
  5. BIN
      tasks/ActivityShikigami/as/as_to_battle_main_2.png
  6. 1 1
      tasks/ActivityShikigami/as/image.json
  7. 4 4
      tasks/ActivityShikigami/as/pages.json
  8. 14 20
      tasks/ActivityShikigami/assets.py
  9. 32 0
      tasks/ActivityShikigami/fire/click.json
  10. BIN
      tasks/ActivityShikigami/fire/fire_pass_1.png
  11. BIN
      tasks/ActivityShikigami/fire/fire_pass_2.png
  12. BIN
      tasks/ActivityShikigami/fire/fire_pass_3.png
  13. BIN
      tasks/ActivityShikigami/fire/fire_pass_4.png
  14. 9 54
      tasks/ActivityShikigami/fire/image.json
  15. 4 4
      tasks/ActivityShikigami/fire/ocr.json
  16. 1 1
      tasks/ActivityShikigami/page.py
  17. 84 12
      tasks/ActivityShikigami/script_task.py
  18. 13 13
      tasks/BondlingFairyland/general_invite.py
  19. 3 3
      tasks/BondlingFairyland/script_task.py
  20. 0 1
      tasks/Component/Costume/costume_base.py
  21. 1 1
      tasks/Component/Costume/costume_test_shikigami.py
  22. 0 26
      tasks/Component/CostumeShikigami/assets.py
  23. 1 10
      tasks/Component/CostumeShikigami/sk1/image.json
  24. BIN
      tasks/Component/CostumeShikigami/sk1/sk1_sou_switch_sure_1.png
  25. 1 10
      tasks/Component/CostumeShikigami/sk10/image.json
  26. BIN
      tasks/Component/CostumeShikigami/sk10/sk10_sou_switch_sure_10.png
  27. 1 10
      tasks/Component/CostumeShikigami/sk11/image.json
  28. BIN
      tasks/Component/CostumeShikigami/sk11/sk11_sou_switch_sure_11.png
  29. 1 10
      tasks/Component/CostumeShikigami/sk12/image.json
  30. BIN
      tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_sure_12.png
  31. 1 10
      tasks/Component/CostumeShikigami/sk2/image.json
  32. BIN
      tasks/Component/CostumeShikigami/sk2/sk2_sou_switch_sure_2.png
  33. 1 10
      tasks/Component/CostumeShikigami/sk3/image.json
  34. BIN
      tasks/Component/CostumeShikigami/sk3/sk3_sou_switch_sure_3.png
  35. 1 10
      tasks/Component/CostumeShikigami/sk4/image.json
  36. BIN
      tasks/Component/CostumeShikigami/sk4/sk4_sou_switch_sure_4.png
  37. 1 10
      tasks/Component/CostumeShikigami/sk5/image.json
  38. BIN
      tasks/Component/CostumeShikigami/sk5/sk5_sou_switch_sure_5.png
  39. 1 10
      tasks/Component/CostumeShikigami/sk6/image.json
  40. BIN
      tasks/Component/CostumeShikigami/sk6/sk6_sou_switch_sure_6.png
  41. 1 10
      tasks/Component/CostumeShikigami/sk7/image.json
  42. BIN
      tasks/Component/CostumeShikigami/sk7/sk7_sou_switch_sure_7.png
  43. 1 10
      tasks/Component/CostumeShikigami/sk8/image.json
  44. BIN
      tasks/Component/CostumeShikigami/sk8/sk8_sou_switch_sure_8.png
  45. 1 10
      tasks/Component/CostumeShikigami/sk9/image.json
  46. BIN
      tasks/Component/CostumeShikigami/sk9/sk9_sou_switch_sure_9.png
  47. 1 2
      tasks/Component/GeneralBattle/assets.py
  48. 30 19
      tasks/Component/GeneralBattle/battle_wait.py
  49. BIN
      tasks/Component/GeneralBattle/gb/gb_exit_ensure.png
  50. 0 9
      tasks/Component/GeneralBattle/gb/image.json
  51. 5 5
      tasks/Component/GeneralBattle/general_battle.py
  52. 6 0
      tasks/Component/GeneralBattle/gw/click2.json
  53. 0 10
      tasks/Component/GeneralInvite/assets.py
  54. 21 21
      tasks/Component/GeneralInvite/general_invite.py
  55. BIN
      tasks/Component/GeneralInvite/gi/gi_cancel.png
  56. BIN
      tasks/Component/GeneralInvite/gi/gi_default_invite.png
  57. BIN
      tasks/Component/GeneralInvite/gi/gi_default_no.png
  58. BIN
      tasks/Component/GeneralInvite/gi/gi_gi_sure.png
  59. BIN
      tasks/Component/GeneralInvite/gi/gi_i_default.png
  60. BIN
      tasks/Component/GeneralInvite/gi/gi_i_no_default.png
  61. 0 36
      tasks/Component/GeneralInvite/gi/image.json
  62. 0 4
      tasks/Component/SwitchSoul/assets.py
  63. 1 10
      tasks/Component/SwitchSoul/ss/image.json
  64. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_switch_sure.png
  65. 5 5
      tasks/Component/SwitchSoul/switch_soul.py
  66. 1 1
      tasks/Duel/assets.py
  67. BIN
      tasks/Duel/duel/duel_d_victory_share.png
  68. BIN
      tasks/Duel/duel/duel_d_victory_share_mask.png
  69. 9 0
      tasks/Duel/duel/image.json
  70. 3 2
      tasks/Duel/script_task.py
  71. 1 1
      tasks/EternitySea/script_task.py
  72. 0 2
      tasks/Exploration/assets.py
  73. 0 9
      tasks/Exploration/res/image.json
  74. BIN
      tasks/Exploration/res/res_get_reward.png
  75. 2 1
      tasks/GameUi/default_pages.py
  76. 1 0
      tasks/GameUi/navigator.py
  77. 6 3
      tasks/GlobalGame/assets.py
  78. 14 0
      tasks/GlobalGame/global_game.py
  79. 30 3
      tasks/GlobalGame/ui/image.json
  80. BIN
      tasks/GlobalGame/ui/ui_ui_cancel_old.png
  81. BIN
      tasks/GlobalGame/ui/ui_ui_confirm_old.png
  82. BIN
      tasks/GlobalGame/ui/ui_ui_reward_alt.png
  83. BIN
      tasks/GlobalGame/ui/ui_ui_rewards.png
  84. 3 1
      tasks/MemoryScrolls/assets.py
  85. 18 0
      tasks/MemoryScrolls/ms/click.json
  86. 14 6
      tasks/MemoryScrolls/script_task.py
  87. 0 4
      tasks/RealmRaid/assets.py
  88. 1 10
      tasks/RealmRaid/res/image.json
  89. BIN
      tasks/RealmRaid/res/res_fresh_ensure.png
  90. 10 10
      tasks/RealmRaid/script_task.py
  91. 2 2
      tasks/base_task.py
  92. 31 5
      tests/tasks/ActivityShikigami/test_battle_integration.py
  93. 5 5
      tests/tasks/Component/GeneralBattle/test_battle_exit.py
  94. 38 0
      tests/tasks/Component/GeneralBattle/test_battle_wait.py
  95. 17 10
      tests/tasks/Exploration/test_treasure_reward.py
  96. 74 0
      tests/tasks/MemoryScrolls/test_contribution.py

+ 2 - 2
tasks/AbyssShadows/script_task.py

@@ -547,13 +547,13 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
             self.screenshot()
             if self.appear_then_click(self.I_EXIT, interval=2):
                 continue
-            if self.appear_then_click(self.I_EXIT_ENSURE, interval=2):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=2):
                 continue
             if self.appear_then_click(self.I_WIN, interval=2):
                 continue
             if self.appear(self.I_ABYSS_NAVIGATION):
                 break
-        logger.info(f"Click {self.I_EXIT_ENSURE.name}")
+        logger.info(f"Click {self.I_UI_CONFIRM.name}")
 
         return True
 

BIN
tasks/ActivityShikigami/as/as_lock.png


BIN
tasks/ActivityShikigami/as/as_shi.png


BIN
tasks/ActivityShikigami/as/as_to_battle_main.png


BIN
tasks/ActivityShikigami/as/as_to_battle_main_2.png


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

@@ -4,7 +4,7 @@
     "imageName": "as_lock.png",
     "roiFront": "825,657,28,25",
     "roiBack": "739,432,440,266",
-    "method": "Template matching",
+    "method": "Multi-scale template matching",
     "threshold": 0.5,
     "description": "上锁图标"
   },

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

@@ -38,8 +38,8 @@
   {
     "itemName": "to_battle_main",
     "imageName": "as_to_battle_main.png",
-    "roiFront": "302,178,98,111",
-    "roiBack": "223,110,238,269",
+    "roiFront": "220,247,97,44",
+    "roiBack": "172,122,238,269",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "进入主要的战斗界面"
@@ -83,8 +83,8 @@
   {
     "itemName": "to_battle_main_2",
     "imageName": "as_to_battle_main_2.png",
-    "roiFront": "15,94,247,38",
-    "roiBack": "2,68,311,100",
+    "roiFront": "819,458,103,33",
+    "roiBack": "799,431,142,87",
     "method": "Template matching",
     "threshold": 0.65,
     "description": "description"

+ 14 - 20
tasks/ActivityShikigami/assets.py

@@ -25,7 +25,7 @@ class ActivityShikigamiAssets:
 
 	# Image Rule Assets
 	# 上锁图标 
-	I_LOCK = RuleImage(roi_front=(825,657,28,25), roi_back=(739,432,440,266), threshold=0.5, method="Template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
+	I_LOCK = RuleImage(roi_front=(825,657,28,25), roi_back=(739,432,440,266), threshold=0.5, method="Multi-scale template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
 	# 还未上锁图片 
 	I_UNLOCK = RuleImage(roi_front=(884,648,28,25), roi_back=(733,426,444,276), threshold=0.5, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
 	# 活动爬塔标志 
@@ -46,7 +46,7 @@ class ActivityShikigamiAssets:
 	# 红色退出 
 	I_RED_EXIT = RuleImage(roi_front=(1162,96,39,38), roi_back=(1120,49,110,135), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_red_exit.png")
 	# 进入主要的战斗界面 
-	I_TO_BATTLE_MAIN = RuleImage(roi_front=(302,178,98,111), roi_back=(223,110,238,269), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_to_battle_main.png")
+	I_TO_BATTLE_MAIN = RuleImage(roi_front=(220,247,97,44), roi_back=(172,122,238,269), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_to_battle_main.png")
 	# 点击进入boss战斗页面 
 	I_TO_BATTLE_BOSS = RuleImage(roi_front=(1111,248,37,136), roi_back=(979,142,234,327), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_to_battle_boss.png")
 	# description 
@@ -56,30 +56,20 @@ class ActivityShikigamiAssets:
 	# 从main进入到式神录 
 	I_BATTLE_MAIN_TO_RECORDS = RuleImage(roi_front=(1001,558,39,42), roi_back=(966,534,140,100), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle_main_to_records.png")
 	# description 
-	I_TO_BATTLE_MAIN_2 = RuleImage(roi_front=(15,94,247,38), roi_back=(2,68,311,100), threshold=0.65, method="Template matching", file="./tasks/ActivityShikigami/as/as_to_battle_main_2.png")
+	I_TO_BATTLE_MAIN_2 = RuleImage(roi_front=(819,458,103,33), roi_back=(799,431,142,87), threshold=0.65, method="Template matching", file="./tasks/ActivityShikigami/as/as_to_battle_main_2.png")
 	# 确认跳过 
 	I_CONFIRM_SKIP = RuleImage(roi_front=(707,442,137,38), roi_back=(656,397,231,124), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_confirm_skip.png")
 
 
 	# Image Rule Assets
 	# description 
-	I_PASS_1 = RuleImage(roi_front=(359,295,100,53), roi_back=(68,203,1138,369), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_1.png")
+	I_PASS_1 = RuleImage(roi_front=(594,330,37,58), roi_back=(462,310,337,91), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_1.png")
 	# description 
-	I_PASS_2 = RuleImage(roi_front=(645,224,92,57), roi_back=(98,205,1076,366), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_2.png")
+	I_PASS_2 = RuleImage(roi_front=(625,335,31,44), roi_back=(562,326,182,66), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_2.png")
 	# description 
-	I_PASS_3 = RuleImage(roi_front=(648,227,91,55), roi_back=(103,162,1077,416), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_3.png")
+	I_PASS_3 = RuleImage(roi_front=(1178,620,71,61), roi_back=(1149,606,111,92), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_3.png")
 	# description 
-	I_PASS_4 = RuleImage(roi_front=(586,424,100,58), roi_back=(99,194,1080,398), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_4.png")
-	# 箱子 
-	I_PASS_5 = RuleImage(roi_front=(946,415,65,48), roi_back=(97,194,1036,398), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_5.png")
-	# 印记 
-	I_PASS_6 = RuleImage(roi_front=(668,221,54,50), roi_back=(107,159,1012,394), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_6.png")
-	# description 
-	I_PASS_7 = RuleImage(roi_front=(329,233,51,51), roi_back=(95,180,1056,394), threshold=0.65, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_7.png")
-	# 印记选中间的 
-	I_PASS_8 = RuleImage(roi_front=(579,276,100,100), roi_back=(577,296,100,100), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_8.png")
-	# description 
-	I_PASS_9 = RuleImage(roi_front=(558,643,160,44), roi_back=(480,601,306,100), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_9.png")
+	I_PASS_4 = RuleImage(roi_front=(482,499,58,54), roi_back=(346,431,575,146), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_4.png")
 	# 印记选左边的 
 	I_PASS_10 = RuleImage(roi_front=(279,309,100,100), roi_back=(291,305,100,100), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_10.png")
 	# 印记选右边的 
@@ -94,9 +84,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="Digit", method="Default", keyword="", name="remain_ap")
+	O_REMAIN_AP = RuleOcr(roi=(777,16,63,27), area=(776,15,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="Digit", method="Default", keyword="", name="remain_pass")
+	O_REMAIN_PASS = RuleOcr(roi=(1153,24,50,29), area=(1153,26,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")
 	# 活动票数(没有百分比) 
@@ -108,4 +98,8 @@ class ActivityShikigamiAssets:
 	# 进入100体活动标识 
 	O_ENTER_AP100 = RuleOcr(roi=(73,98,95,32), area=(5,79,256,108), mode="Single", method="Default", keyword="将魂试炼", name="enter_ap100")
 
-
+	C_PASS_5 = RuleClick(roi_front=(421,286,65,48), roi_back=(419,287,69,51), name="pass_5")
+	C_PASS_6 = RuleClick(roi_front=(548,333,54,50), roi_back=(547,335,58,52), name="pass_6")
+	C_PASS_7 = RuleClick(roi_front=(672,381,51,51), roi_back=(668,377,59,60), name="pass_7")
+	C_PASS_8 = RuleClick(roi_front=(794,333,62,63), roi_back=(791,334,70,67), name="pass_8")
+	C_PASS_9 = RuleClick(roi_front=(929,285,50,40), roi_back=(921,278,70,56), name="pass_9")

+ 32 - 0
tasks/ActivityShikigami/fire/click.json

@@ -0,0 +1,32 @@
+[
+  {
+    "itemName": "pass_5",
+    "roiFront": "421,286,65,48",
+    "roiBack": "419,287,69,51",
+    "description": "第一个"
+  },
+  {
+    "itemName": "pass_6",
+    "roiFront": "548,333,54,50",
+    "roiBack": "547,335,58,52",
+    "description": "印记"
+  },
+  {
+    "itemName": "pass_7",
+    "roiFront": "672,381,51,51",
+    "roiBack": "668,377,59,60",
+    "description": "description"
+  },
+  {
+    "itemName": "pass_8",
+    "roiFront": "794,333,62,63",
+    "roiBack": "791,334,70,67",
+    "description": "印记选中间的"
+  },
+  {
+    "itemName": "pass_9",
+    "roiFront": "929,285,50,40",
+    "roiBack": "921,278,70,56",
+    "description": "第五个"
+  }
+]

BIN
tasks/ActivityShikigami/fire/fire_pass_1.png


BIN
tasks/ActivityShikigami/fire/fire_pass_2.png


BIN
tasks/ActivityShikigami/fire/fire_pass_3.png


BIN
tasks/ActivityShikigami/fire/fire_pass_4.png


+ 9 - 54
tasks/ActivityShikigami/fire/image.json

@@ -2,8 +2,8 @@
   {
     "itemName": "pass_1",
     "imageName": "fire_pass_1.png",
-    "roiFront": "359,295,100,53",
-    "roiBack": "68,203,1138,369",
+    "roiFront": "594,330,37,58",
+    "roiBack": "462,310,337,91",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -11,8 +11,8 @@
   {
     "itemName": "pass_2",
     "imageName": "fire_pass_2.png",
-    "roiFront": "645,224,92,57",
-    "roiBack": "98,205,1076,366",
+    "roiFront": "625,335,31,44",
+    "roiBack": "562,326,182,66",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -20,8 +20,8 @@
   {
     "itemName": "pass_3",
     "imageName": "fire_pass_3.png",
-    "roiFront": "648,227,91,55",
-    "roiBack": "103,162,1077,416",
+    "roiFront": "1178,620,71,61",
+    "roiBack": "1149,606,111,92",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -29,53 +29,8 @@
   {
     "itemName": "pass_4",
     "imageName": "fire_pass_4.png",
-    "roiFront": "586,424,100,58",
-    "roiBack": "99,194,1080,398",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
-  {
-    "itemName": "pass_5",
-    "imageName": "fire_pass_5.png",
-    "roiFront": "946,415,65,48",
-    "roiBack": "97,194,1036,398",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "箱子"
-  },
-  {
-    "itemName": "pass_6",
-    "imageName": "fire_pass_6.png",
-    "roiFront": "668,221,54,50",
-    "roiBack": "107,159,1012,394",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "印记"
-  },
-  {
-    "itemName": "pass_7",
-    "imageName": "fire_pass_7.png",
-    "roiFront": "329,233,51,51",
-    "roiBack": "95,180,1056,394",
-    "method": "Template matching",
-    "threshold": 0.65,
-    "description": "description"
-  },
-  {
-    "itemName": "pass_8",
-    "imageName": "fire_pass_8.png",
-    "roiFront": "579,276,100,100",
-    "roiBack": "577,296,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "印记选中间的"
-  },
-  {
-    "itemName": "pass_9",
-    "imageName": "fire_pass_9.png",
-    "roiFront": "558,643,160,44",
-    "roiBack": "480,601,306,100",
+    "roiFront": "482,499,58,54",
+    "roiBack": "346,431,575,146",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -116,4 +71,4 @@
     "threshold": 0.8,
     "description": "魇兽将的战斗图片"
   }
-]
+]

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

@@ -10,8 +10,8 @@
   },
   {
     "itemName": "remain_ap",
-    "roiFront": "584,17,63,27",
-    "roiBack": "583,16,63,30",
+    "roiFront": "777,16,63,27",
+    "roiBack": "776,15,63,30",
     "mode": "Digit",
     "method": "Default",
     "keyword": "",
@@ -19,8 +19,8 @@
   },
   {
     "itemName": "remain_pass",
-    "roiFront": "791,18,50,29",
-    "roiBack": "791,18,49,28",
+    "roiFront": "1153,24,50,29",
+    "roiBack": "1153,26,49,28",
     "mode": "Digit",
     "method": "Default",
     "keyword": "",

+ 1 - 1
tasks/ActivityShikigami/page.py

@@ -1,6 +1,6 @@
 from tasks.ActivityShikigami.assets import ActivityShikigamiAssets as asa
 from tasks.GameUi.page import Page, page_main
-from tasks.GlobalGame.assets import GlobalGameAssets as gga
+from tasks.GlobalGame.global_game import GlobalGame as gga
 from tasks.GameUi.assets import GameUiAssets as G
 from tasks.Component.RightActivity.assets import RightActivityAssets as RAA
 from tasks.base_task import BaseTask as BT

+ 84 - 12
tasks/ActivityShikigami/script_task.py

@@ -158,7 +158,16 @@ class ScriptTask(StateMachine, GameUi, Battle, BaseActivity, SwitchSoul, Activit
                 method_func = getattr(self, f'_run_{climb_type}')
                 method_func()
             except LimitCountOut as e:
-                self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_MAIN, interval=2.8)
+                while 1:
+                    self.screenshot()
+                    if self.appear(self.I_TO_BATTLE_MAIN):
+                        break
+                    if self.appear_then_click(self.I_UI_BACK_CIRCLE, interval=1.5):
+                        continue
+                    if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=2.5):
+                        continue
+                    if self.appear_then_click(self.I_UI_BACK_RED, interval=1.5):
+                        continue
             except LimitTimeOut as e:
                 break
             finally:
@@ -178,10 +187,50 @@ class ScriptTask(StateMachine, GameUi, Battle, BaseActivity, SwitchSoul, Activit
             更新前请先看 ./README.md
         """
         logger.hr(f'Start run climb type PASS', 1)
-        self.ui_clicks([self.I_TO_BATTLE_MAIN, self.I_TO_BATTLE_MAIN_2],
-                       stop=self.I_CHECK_BATTLE_MAIN, interval=1)
+        # self.ui_clicks([self.I_TO_BATTLE_MAIN_2],
+        #                stop=self.I_CHECK_BATTLE_MAIN, interval=1)
+        #
+        center_click_cnt = 0
+        while 1:
+            self.screenshot()
+
+            if self.appear(self.I_UI_BACK_RED) and self.appear(self.I_PASS_4):
+                break
+            if self.appear(self.I_CHECK_BATTLE_MAIN):
+                break
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=0.5):
+                continue
+            if self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=0.5):
+                continue
+            if self.appear_then_click(self.I_TO_BATTLE_MAIN_2, interval=1.5):
+                continue
+            if not self.appear(self.I_PASS_3):
+                continue
+            if self.appear_then_click(self.I_PASS_1, interval=1.5):
+                continue
+            if self.appear_then_click(self.I_PASS_2, interval=1.5):
+                continue
+            center = RuleClick(roi_front=(630,360,10,10), roi_back=(630,360,10,10), name="random_all")
+            if center_click_cnt <= 5 and self.click(center, interval=3.5):
+                center_click_cnt += 1
+                continue
+        logger.info('Enter occupation reward screen')  # 进入到占领奖励
+        index = 0
+        clicks = [self.C_PASS_5, self.C_PASS_6, self.C_PASS_7, self.C_PASS_8, self.C_PASS_9]
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_CHECK_BATTLE_MAIN):
+                break
+            if self.click(clicks[index], interval=1.5):
+                sleep(1)
+            index = (index + 1) % len(clicks)
+        logger.info('Enter challenge screen')  # 正式进入挑战界面
+
+
+
+
         self.switch_soul(self.I_BATTLE_MAIN_TO_RECORDS, self.I_CHECK_BATTLE_MAIN)
-        self.switch_climb_mode_in_game('pass')
+        # self.switch_climb_mode_in_game('pass')
 
         ocr_limit_timer = Timer(1).start()
         click_limit_timer = Timer(4).start()
@@ -209,17 +258,23 @@ class ScriptTask(StateMachine, GameUi, Battle, BaseActivity, SwitchSoul, Activit
             if self.start_battle():
                 continue
 
-        self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_MAIN, interval=4.5)
+        # self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_MAIN, interval=4.5)
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_TO_BATTLE_MAIN):
+                break
+            if self.appear(self.I_CHECK_BATTLE_MAIN) and self.appear_then_click(self.I_UI_BACK_YELLOW, interval=2.5):
+                continue
 
     def _run_ap(self):
         """
             更新前请先看 ./README.md
         """
         logger.hr(f'Start run climb type AP')
-        self.ui_clicks([self.I_TO_BATTLE_MAIN, self.I_TO_BATTLE_MAIN_2],
+        self.ui_clicks([self.I_TO_BATTLE_MAIN],
                        stop=self.I_CHECK_BATTLE_MAIN, interval=1)
         self.switch_soul(self.I_BATTLE_MAIN_TO_RECORDS, self.I_CHECK_BATTLE_MAIN)
-        self.switch_climb_mode_in_game('ap')
+        # self.switch_climb_mode_in_game('ap')
 
         ocr_limit_timer = Timer(1).start()
         while 1:
@@ -242,7 +297,19 @@ class ScriptTask(StateMachine, GameUi, Battle, BaseActivity, SwitchSoul, Activit
             if self.start_battle():
                 continue
 
-        self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_MAIN, interval=4.5)
+        # self.ui_click(self.I_UI_BACK_YELLOW, stop=self.I_TO_BATTLE_MAIN, interval=3.5, timeout=10)
+        while 1:
+            self.screenshot()
+
+            if self.appear(self.I_TO_BATTLE_MAIN):
+                break
+            if self.appear_then_click(self.I_UI_BACK_CIRCLE, interval=1.5):
+                continue
+            if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=2.5):
+                continue
+            if self.appear_then_click(self.I_UI_BACK_RED, interval=1.5):
+                continue
+
 
     def _run_boss(self):
         """
@@ -294,7 +361,9 @@ class ScriptTask(StateMachine, GameUi, Battle, BaseActivity, SwitchSoul, Activit
                 continue
         # 运行战斗
         strategies, options = self.loadout_from_config(self.get_general_battle_conf())
-        strategies['success'] = 'activity'
+        options['completion'].check_imgs = [
+            self.I_CHECK_BATTLE_BOSS if self.climb_type == 'boss' else self.I_CHECK_BATTLE_MAIN,
+        ]
         self.loadout_show((strategies, options))
         self.state_show()
         with battle_wait_strategy(**strategies), battle_wait_options(**options):
@@ -305,9 +374,12 @@ class ScriptTask(StateMachine, GameUi, Battle, BaseActivity, SwitchSoul, Activit
             logger.info(f'Count {self.climb_type}: {self.count_map[self.climb_type]}')
         return win
 
-    # @battle_wait_strategy(success='activity')
-    # def battle_wait(self, *args, **kwargs):
-    #     return self.battle_wait_with_strategy(*args, **kwargs)
+    def _bw_success_default(self, pub, pri):
+        # Activity rewards can use either the standard result screen or a popup.
+        if self.appear(self.I_UI_REWARD):
+            return self._bw_success_activity()
+        return super()._bw_success_default()
+
 
     def switch_soul(self, enter_button: RuleImage, cur_img: RuleImage):
         conf = self.conf.switch_soul_config

+ 13 - 13
tasks/BondlingFairyland/general_invite.py

@@ -74,7 +74,7 @@ class GeneralInvite(BaseTask, BondlingFairylandAssets, GeneralInviteAssets):
                 logger.warning('Timeout, now is no room')
                 return False
 
-            if self.appear(self.I_INVITE_ENSURE) or self.appear(self.I_GI_CANCEL):
+            if self.appear(self.I_INVITE_ENSURE) or self.appear(self.I_UI_CANCEL):
                 logger.warning('Invite page is still open, close it before checking room status')
                 self.close_invite_page()
                 continue
@@ -114,9 +114,9 @@ class GeneralInvite(BaseTask, BondlingFairylandAssets, GeneralInviteAssets):
         closed = False
         while not timer.reached():
             self.screenshot()
-            if not self.appear(self.I_INVITE_ENSURE) and not self.appear(self.I_GI_CANCEL):
+            if not self.appear(self.I_INVITE_ENSURE) and not self.appear(self.I_UI_CANCEL):
                 return closed
-            if self.appear_then_click(self.I_GI_CANCEL, interval=0.8):
+            if self.appear_then_click(self.I_UI_CANCEL, interval=0.8):
                 closed = True
                 continue
             if self.appear_then_click(self.I_INVITE_ENSURE, interval=0.8):
@@ -174,13 +174,13 @@ class GeneralInvite(BaseTask, BondlingFairylandAssets, GeneralInviteAssets):
         while 1:
             self.screenshot()
             if not self.is_in_room() and \
-                    not self.appear_then_click(self.I_GI_SURE, interval=0.8) and \
+                    not self.appear_then_click(self.I_UI_CONFIRM, interval=0.8) and \
                     not self.appear(self.I_BACK_YELLOW):
                 break
-            if self.appear_then_click(self.I_GI_SURE, interval=0.5):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=0.5):
                 continue
-            if not self.appear(self.I_GI_SURE) and self.appear_then_click(self.I_BACK_YELLOW, interval=0.8):
-                self.wait_until_appear(self.I_GI_SURE, wait_time=0.8)
+            if not self.appear(self.I_UI_CONFIRM) and self.appear_then_click(self.I_BACK_YELLOW, interval=0.8):
+                self.wait_until_appear(self.I_UI_CONFIRM, wait_time=0.8)
                 continue
         return True
 
@@ -461,25 +461,25 @@ class GeneralInvite(BaseTask, BondlingFairylandAssets, GeneralInviteAssets):
         :param default_invite:
         :return:
         """
-        if not self.appear(self.I_GI_SURE, interval=1.5):
+        if not self.appear(self.I_UI_CONFIRM, interval=1.5):
             return False
 
         if default_invite:
             # 有可能是挑战失败的
-            if self.appear(self.I_I_DEFAULT) or self.appear(self.I_I_NO_DEFAULT):
+            if self.appear(self.I_UI_CHECK) or self.appear(self.I_UI_UNCHECK):
                 logger.info('Click default invite')
                 while 1:
                     self.screenshot()
-                    if self.appear(self.I_I_DEFAULT):
+                    if self.appear(self.I_UI_CHECK):
                         break
-                    if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):
+                    if self.appear_then_click(self.I_UI_UNCHECK, interval=1):
                         continue
         # 点击确认
         while 1:
             self.screenshot()
-            if not self.appear(self.I_GI_SURE):
+            if not self.appear(self.I_UI_CONFIRM):
                 break
-            if self.appear_then_click(self.I_GI_SURE, interval=1):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
                 continue
 
         return True

+ 3 - 3
tasks/BondlingFairyland/script_task.py

@@ -350,7 +350,7 @@ class ScriptTask(GameUi, GeneralInvite, GeneralRoom, BondlingBattle, SwitchSoul,
             for i in range(3):
                 if self.appear_then_click(self.I_BUY_PLUS, interval=1):
                     sleep(0.5)
-            if self.appear_then_click(self.I_GI_SURE, interval=1):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
                 continue
             if self.appear_then_click(self.I_STONE_SURE, interval=2):
                 continue
@@ -769,9 +769,9 @@ class ScriptTask(GameUi, GeneralInvite, GeneralRoom, BondlingBattle, SwitchSoul,
             if self.appear(GeneralBattleAssets.I_EXIT):
                 logger.info("已经在战斗场景中")
                 return False
-            if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):
+            if self.appear_then_click(self.I_UI_UNCHECK, interval=1):
                 continue
-            if self.appear_then_click(self.I_GI_SURE, interval=1):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
                 continue
             if self.appear_then_click(self.I_I_ACCEPT_DEFAULT, interval=1):
                 continue

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

@@ -91,7 +91,6 @@ shikigami_costume_model = {
         'I_SOU_CHECK_IN': f'I_SOU_CHECK_IN_{i}',
         'I_SOU_TEAM_PRESENT': f'I_SOU_TEAM_PRESENT_{i}',
         'I_SOU_CLICK_PRESENT': f'I_SOU_CLICK_PRESENT_{i}',
-        'I_SOU_SWITCH_SURE': f'I_SOU_SWITCH_SURE_{i}',
         # SwitchSoul 分组相关 (1-7组)
         **{f'I_SOU_CHECK_GROUP_{g}': f'I_SOU_CHECK_GROUP_{g}_{i}' for g in range(1, 8)},
         # SwitchSoul 队伍相关 (1-4队)

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

@@ -36,7 +36,7 @@ class ScriptTask(GameUi, SwitchSoul, SwitchSoulAssets, SoulsTidyAssets):
             [self.I_SOU_SWITCH_2, 0],
             [self.I_SOU_SWITCH_3, 0],
             [self.I_SOU_SWITCH_4, 0],
-            [self.I_SOU_SWITCH_SURE, 0],
+            [self.I_UI_CONFIRM, 0],
             # SoulsTidy - 御魂页面关键元素
             [self.I_ST_SOULS, 0],
             [self.I_ST_REPLACE, 0],

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

@@ -25,8 +25,6 @@ class CostumeShikigamiAssets:
 	I_SOU_SWITCH_3_1 = RuleImage(roi_front=(977,448,32,32), roi_back=(962,442,52,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk1/sk1_sou_switch_3_1.png")
 	# description 
 	I_SOU_SWITCH_4_1 = RuleImage(roi_front=(977,603,33,20), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk1/sk1_sou_switch_4_1.png")
-	# description 
-	I_SOU_SWITCH_SURE_1 = RuleImage(roi_front=(718,424,69,30), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk1/sk1_sou_switch_sure_1.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN_1 = RuleImage(roi_front=(269,69,50,49), roi_back=(269,69,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk1/sk1_sou_check_in_1.png")
 	# 检查是否为第一组 
@@ -68,8 +66,6 @@ class CostumeShikigamiAssets:
 	I_SOU_SWITCH_3_10 = RuleImage(roi_front=(980,450,25,27), roi_back=(960,442,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk10/sk10_sou_switch_3_10.png")
 	# 第四组切换 
 	I_SOU_SWITCH_4_10 = RuleImage(roi_front=(979,602,25,27), roi_back=(960,592,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk10/sk10_sou_switch_4_10.png")
-	# 确认切换 
-	I_SOU_SWITCH_SURE_10 = RuleImage(roi_front=(718,424,69,30), roi_back=(669,401,190,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk10/sk10_sou_switch_sure_10.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN_10 = RuleImage(roi_front=(277,79,34,36), roi_back=(265,71,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk10/sk10_sou_check_in_10.png")
 	# 检查是否为第一组 
@@ -126,8 +122,6 @@ class CostumeShikigamiAssets:
 	# description 
 	I_SOU_TEAM_PRESENT_11 = RuleImage(roi_front=(734,77,100,41), roi_back=(726,71,115,54), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk11/sk11_sou_team_present_11.png")
 	# description 
-	I_SOU_SWITCH_SURE_11 = RuleImage(roi_front=(718,424,69,30), roi_back=(690,399,148,64), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk11/sk11_sou_switch_sure_11.png")
-	# description 
 	I_SOUL_PRESET_11 = RuleImage(roi_front=(342,85,74,31), roi_back=(338,77,83,44), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk11/sk11_soul_preset_11.png")
 	# description 
 	I_ST_REPLACE_11 = RuleImage(roi_front=(884,169,63,67), roi_back=(872,155,86,99), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk11/sk11_st_replace_11.png")
@@ -169,8 +163,6 @@ class CostumeShikigamiAssets:
 	# 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=(718,424,69,30), 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")
@@ -197,8 +189,6 @@ class CostumeShikigamiAssets:
 	I_SOU_SWITCH_3_2 = RuleImage(roi_front=(977,448,32,30), roi_back=(962,442,52,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk2/sk2_sou_switch_3_2.png")
 	# description 
 	I_SOU_SWITCH_4_2 = RuleImage(roi_front=(977,603,32,21), roi_back=(962,592,56,40), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk2/sk2_sou_switch_4_2.png")
-	# description 
-	I_SOU_SWITCH_SURE_2 = RuleImage(roi_front=(718,424,69,30), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk2/sk2_sou_switch_sure_2.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN_2 = RuleImage(roi_front=(268,74,50,49), roi_back=(268,74,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk2/sk2_sou_check_in_2.png")
 	# 检查是否为第一组 
@@ -240,8 +230,6 @@ class CostumeShikigamiAssets:
 	I_SOU_SWITCH_3_3 = RuleImage(roi_front=(979,448,29,30), roi_back=(962,442,52,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk3/sk3_sou_switch_3_3.png")
 	# description 
 	I_SOU_SWITCH_4_3 = RuleImage(roi_front=(978,603,31,19), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk3/sk3_sou_switch_4_3.png")
-	# description 
-	I_SOU_SWITCH_SURE_3 = RuleImage(roi_front=(718,424,69,30), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk3/sk3_sou_switch_sure_3.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN_3 = RuleImage(roi_front=(268,74,50,49), roi_back=(268,74,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk3/sk3_sou_check_in_3.png")
 	# 检查是否为第一组 
@@ -283,8 +271,6 @@ class CostumeShikigamiAssets:
 	I_SOU_SWITCH_3_4 = RuleImage(roi_front=(978,449,28,29), roi_back=(962,442,52,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk4/sk4_sou_switch_3_4.png")
 	# description 
 	I_SOU_SWITCH_4_4 = RuleImage(roi_front=(978,602,31,20), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk4/sk4_sou_switch_4_4.png")
-	# description 
-	I_SOU_SWITCH_SURE_4 = RuleImage(roi_front=(718,424,69,30), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk4/sk4_sou_switch_sure_4.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN_4 = RuleImage(roi_front=(268,74,50,49), roi_back=(268,74,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk4/sk4_sou_check_in_4.png")
 	# 检查是否为第一组 
@@ -326,8 +312,6 @@ class CostumeShikigamiAssets:
 	I_SOU_SWITCH_3_5 = RuleImage(roi_front=(980,453,29,29), roi_back=(962,442,52,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk5/sk5_sou_switch_3_5.png")
 	# description 
 	I_SOU_SWITCH_4_5 = RuleImage(roi_front=(978,602,31,20), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk5/sk5_sou_switch_4_5.png")
-	# description 
-	I_SOU_SWITCH_SURE_5 = RuleImage(roi_front=(718,424,69,30), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk5/sk5_sou_switch_sure_5.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN_5 = RuleImage(roi_front=(268,74,50,49), roi_back=(268,74,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk5/sk5_sou_check_in_5.png")
 	# 检查是否为第一组 
@@ -369,8 +353,6 @@ class CostumeShikigamiAssets:
 	I_SOU_SWITCH_3_6 = RuleImage(roi_front=(978,448,31,30), roi_back=(962,442,52,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk6/sk6_sou_switch_3_6.png")
 	# description 
 	I_SOU_SWITCH_4_6 = RuleImage(roi_front=(977,601,32,21), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk6/sk6_sou_switch_4_6.png")
-	# description 
-	I_SOU_SWITCH_SURE_6 = RuleImage(roi_front=(718,424,69,30), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk6/sk6_sou_switch_sure_6.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN_6 = RuleImage(roi_front=(269,69,50,49), roi_back=(269,69,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk6/sk6_sou_check_in_6.png")
 	# 检查是否为第一组 
@@ -412,8 +394,6 @@ class CostumeShikigamiAssets:
 	I_SOU_SWITCH_3_7 = RuleImage(roi_front=(977,448,32,29), roi_back=(959,430,69,63), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk7/sk7_sou_switch_3_7.png")
 	# description 
 	I_SOU_SWITCH_4_7 = RuleImage(roi_front=(975,604,37,23), roi_back=(963,589,61,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk7/sk7_sou_switch_4_7.png")
-	# description 
-	I_SOU_SWITCH_SURE_7 = RuleImage(roi_front=(718,424,69,30), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk7/sk7_sou_switch_sure_7.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN_7 = RuleImage(roi_front=(268,74,50,49), roi_back=(268,74,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk7/sk7_sou_check_in_7.png")
 	# 检查是否为第一组 
@@ -455,8 +435,6 @@ class CostumeShikigamiAssets:
 	I_SOU_SWITCH_3_8 = RuleImage(roi_front=(980,449,25,27), roi_back=(960,442,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk8/sk8_sou_switch_3_8.png")
 	# 第四组切换 
 	I_SOU_SWITCH_4_8 = RuleImage(roi_front=(981,603,25,27), roi_back=(960,592,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk8/sk8_sou_switch_4_8.png")
-	# 确认切换 
-	I_SOU_SWITCH_SURE_8 = RuleImage(roi_front=(718,424,69,30), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk8/sk8_sou_switch_sure_8.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN_8 = RuleImage(roi_front=(265,71,34,36), roi_back=(265,71,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk8/sk8_sou_check_in_8.png")
 	# 检查是否为第一组 
@@ -498,8 +476,6 @@ class CostumeShikigamiAssets:
 	I_SOU_SWITCH_3_9 = RuleImage(roi_front=(980,450,25,27), roi_back=(960,442,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk9/sk9_sou_switch_3_9.png")
 	# 第四组切换 
 	I_SOU_SWITCH_4_9 = RuleImage(roi_front=(979,602,25,27), roi_back=(960,592,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk9/sk9_sou_switch_4_9.png")
-	# 确认切换 
-	I_SOU_SWITCH_SURE_9 = RuleImage(roi_front=(718,424,69,30), roi_back=(669,401,190,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk9/sk9_sou_switch_sure_9.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN_9 = RuleImage(roi_front=(277,79,34,36), roi_back=(265,71,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk9/sk9_sou_check_in_9.png")
 	# 检查是否为第一组 
@@ -524,5 +500,3 @@ class CostumeShikigamiAssets:
 	I_ST_SOULS_9 = RuleImage(roi_front=(1196,234,33,65), roi_back=(1170,220,70,90), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk9/sk9_st_souls_9.png")
 	# 更换 
 	I_ST_REPLACE_9 = RuleImage(roi_front=(878,224,63,39), roi_back=(855,175,110,130), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk9/sk9_st_replace_9.png")
-
-

+ 1 - 10
tasks/Component/CostumeShikigami/sk1/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "sou_switch_sure_1",
-    "imageName": "sk1_sou_switch_sure_1.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "668,401,180,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "sou_check_in_1",
     "imageName": "sk1_sou_check_in_1.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "更换"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk1/sk1_sou_switch_sure_1.png


+ 1 - 10
tasks/Component/CostumeShikigami/sk10/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "description": "第四组切换"
   },
-  {
-    "itemName": "sou_switch_sure_10",
-    "imageName": "sk10_sou_switch_sure_10.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "669,401,190,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "确认切换"
-  },
   {
     "itemName": "sou_check_in_10",
     "imageName": "sk10_sou_check_in_10.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "更换"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk10/sk10_sou_switch_sure_10.png


+ 1 - 10
tasks/Component/CostumeShikigami/sk11/image.json

@@ -125,15 +125,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "sou_switch_sure_11",
-    "imageName": "sk11_sou_switch_sure_11.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "690,399,148,64",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "soul_preset_11",
     "imageName": "sk11_soul_preset_11.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "description"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk11/sk11_sou_switch_sure_11.png


+ 1 - 10
tasks/Component/CostumeShikigami/sk12/image.json

@@ -125,15 +125,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "sou_switch_sure_12",
-    "imageName": "sk12_sou_switch_sure_12.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "690,399,148,64",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "soul_preset_12",
     "imageName": "sk12_soul_preset_12.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "description"
   }
-]
+]

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


+ 1 - 10
tasks/Component/CostumeShikigami/sk2/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "sou_switch_sure_2",
-    "imageName": "sk2_sou_switch_sure_2.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "668,401,180,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "sou_check_in_2",
     "imageName": "sk2_sou_check_in_2.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "更换"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk2/sk2_sou_switch_sure_2.png


+ 1 - 10
tasks/Component/CostumeShikigami/sk3/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "sou_switch_sure_3",
-    "imageName": "sk3_sou_switch_sure_3.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "668,401,180,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "sou_check_in_3",
     "imageName": "sk3_sou_check_in_3.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "更换"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk3/sk3_sou_switch_sure_3.png


+ 1 - 10
tasks/Component/CostumeShikigami/sk4/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "sou_switch_sure_4",
-    "imageName": "sk4_sou_switch_sure_4.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "668,401,180,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "sou_check_in_4",
     "imageName": "sk4_sou_check_in_4.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "更换"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk4/sk4_sou_switch_sure_4.png


+ 1 - 10
tasks/Component/CostumeShikigami/sk5/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "sou_switch_sure_5",
-    "imageName": "sk5_sou_switch_sure_5.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "668,401,180,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "sou_check_in_5",
     "imageName": "sk5_sou_check_in_5.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "更换"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk5/sk5_sou_switch_sure_5.png


+ 1 - 10
tasks/Component/CostumeShikigami/sk6/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "sou_switch_sure_6",
-    "imageName": "sk6_sou_switch_sure_6.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "668,401,180,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "sou_check_in_6",
     "imageName": "sk6_sou_check_in_6.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "更换"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk6/sk6_sou_switch_sure_6.png


+ 1 - 10
tasks/Component/CostumeShikigami/sk7/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "sou_switch_sure_7",
-    "imageName": "sk7_sou_switch_sure_7.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "668,401,180,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "sou_check_in_7",
     "imageName": "sk7_sou_check_in_7.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "更换"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk7/sk7_sou_switch_sure_7.png


+ 1 - 10
tasks/Component/CostumeShikigami/sk8/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "description": "第四组切换"
   },
-  {
-    "itemName": "sou_switch_sure_8",
-    "imageName": "sk8_sou_switch_sure_8.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "668,401,180,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "确认切换"
-  },
   {
     "itemName": "sou_check_in_8",
     "imageName": "sk8_sou_check_in_8.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "更换"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk8/sk8_sou_switch_sure_8.png


+ 1 - 10
tasks/Component/CostumeShikigami/sk9/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "description": "第四组切换"
   },
-  {
-    "itemName": "sou_switch_sure_9",
-    "imageName": "sk9_sou_switch_sure_9.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "669,401,190,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "确认切换"
-  },
   {
     "itemName": "sou_check_in_9",
     "imageName": "sk9_sou_check_in_9.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "更换"
   }
-]
+]

BIN
tasks/Component/CostumeShikigami/sk9/sk9_sou_switch_sure_9.png


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

@@ -109,8 +109,6 @@ class GeneralBattleAssets:
 	I_STATISTICS = RuleImage(roi_front=(70,630,33,28), roi_back=(35,28,411,661), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_statistics.png")
 	# 左上角的退出 
 	I_EXIT = RuleImage(roi_front=(14,12,43,41), roi_back=(14,12,43,41), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_exit.png")
-	# 退出确认 
-	I_EXIT_ENSURE = RuleImage(roi_front=(718,424,69,30), roi_back=(667,398,179,66), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_exit_ensure.png")
 	# 左上角好友图标 
 	I_FRIENDS = RuleImage(roi_front=(89,14,36,36), roi_back=(89,14,36,36), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_friends.png")
 	# 结算时左下角统计图标 
@@ -252,6 +250,7 @@ class GeneralBattleAssets:
 	C_END_3_6 = RuleClick(roi_front=(0,0,100,100), roi_back=(0,0,100,100), name="end_3_6")
 	# 其实贪吃鬼这个点了也是没事儿 
 	C_END_GREED = RuleClick(roi_front=(138,16,512,93), roi_back=(138,16,512,93), name="end_greed")
+	C_END_MASTER = RuleClick(roi_front=(251,145,811,530), roi_back=(248,143,815,535), name="end_master")
 
 
 	# Click Rule Assets

+ 30 - 19
tasks/Component/GeneralBattle/battle_wait.py

@@ -141,14 +141,6 @@ class OptionSetupDefault:
     excludes: list | None = None
 
 
-@dataclass
-class OptionCompletionDefault:
-    # 这里是为了, 确认结束战斗后退回到 “fire” 的界面
-    check_imgs: list[RuleImage] = None
-    # 兜底:check_imgs 都检测不到时,间隔点击的排除位
-    excludes: list[str] = field(default_factory=list)
-
-
 @dataclass
 class OptionInterruptDefault:
     pass
@@ -170,6 +162,18 @@ class OptionSuccessDefault:
     ])
 
 
+@dataclass
+class OptionCompletionDefault:
+    # 这里是为了, 确认结束战斗后退回到 “fire” 的界面
+    check_imgs: list[RuleImage] | None = None
+    # 兜底:check_imgs 都检测不到时,间隔点击的排除位
+    excludes: list[str] = field(default_factory=lambda:
+    [
+        'C_END_MESSAGE_RIGHT_TOP', 'C_END_BUFF_AREA_1',
+        'C_END_BUFF_AREA_2', 'C_END_SOUL_RECORD', 'C_END_SOUL_DETAILS',
+        'C_END_MASTER',
+    ])
+
 @dataclass
 class OptionFailureDefault:
     pass
@@ -367,8 +371,9 @@ class PerBattleSetup:
 @dataclass
 class PerBattleCompletion:
     click_stage_2: RuleClickExclude | None = None
-    # 兜底点击节拍器:进入 completion 起算,满 8s 才首次点击,之后每 8s 一次
+    # 兜底点击节拍器:进入 completion 起算,满 3s 才首次点击,之后每 3s 一次
     fallback_timer: Timer | None = None
+    fallback_cnt: int = 0
 
 
 @dataclass
@@ -914,8 +919,8 @@ def randomclick_gate(func: Callable) -> Callable:
     @wraps(func)
     def wrapper(self, pub: PublicContext, pri: PrivateContext) -> HookSignal:
         options = pub.options.get('randomclick')
-        state_battle = pri.per_battle
-        state_task = pri.per_task
+        state_battle: PerBattleRandomclick = pri.per_battle
+        state_task: PerTaskRandomclick = pri.per_task
         if not isinstance(options, OptionRandomclickDefault):
             raise TypeError(f"randomclick options must be OptionRandomclickDefault, got {type(options)!r}")
         if not isinstance(state_battle, PerBattleRandomclick):
@@ -1075,8 +1080,8 @@ class BattleWait(BaseTask, GeneralBattleAssets):
 
     def _bw_completion_default(self, pub: PublicContext, pri: PrivateContext) -> HookSignal:
         logger.info('Battle completion process')
-        state = pri.per_battle
-        options = pri.options
+        state: PerBattleCompletion = pri.per_battle
+        options: OptionCompletionDefault = pri.options
         if not isinstance(state, PerBattleCompletion) or not isinstance(options, OptionCompletionDefault):
             raise
         if options.check_imgs is None:
@@ -1091,9 +1096,13 @@ class BattleWait(BaseTask, GeneralBattleAssets):
             pub.per_task.count += 1
             # self.current_count += 1  # 兼容旧的计数
             return HookSignal.DONE
-        # check_imgs 全没出现 → 兜底点击回退界面:进入 completion 满 8s 才首次点击,之后每 8s 一次
+        # check_imgs 全没出现 → 兜底点击回退界面:进入 completion 满 3s 才首次点击,之后每 3s 一次
         if state.fallback_timer is None:
-            state.fallback_timer = Timer(8).start()
+            state.fallback_timer = Timer(3).start()
+        if state.fallback_cnt >= 5:
+            pub.per_task.count += 1
+            logger.info('Fallback timer expired')
+            return HookSignal.DONE
         if not isinstance(state.fallback_timer, Timer):
             raise
         if not state.fallback_timer.reached():
@@ -1101,8 +1110,10 @@ class BattleWait(BaseTask, GeneralBattleAssets):
         state.fallback_timer.reset()
         if state.click_stage_2 is None:
             state.click_stage_2 = PerBattleSuccess.reward_exclude_click(self, options.excludes, name='completion_exclude_click')
-        x, y = state.click_stage_2.coord()
-        self.device.click(x=x, y=y, control_name='completion_exclude_click')
+        if self.click(state.click_stage_2, interval=1.5):
+            state.fallback_cnt += 1
+        # x, y = state.click_stage_2.coord()
+        # self.device.click(x=x, y=y, control_name='completion_exclude_click')
         return HookSignal.CONTINUE
 
     def _bw_interrupt_default(self, pub: PublicContext, pri: PrivateContext) -> HookSignal:
@@ -1110,8 +1121,8 @@ class BattleWait(BaseTask, GeneralBattleAssets):
         return HookSignal.CONTINUE
 
     def _bw_success_default(self, pub: PublicContext, pri: PrivateContext) -> HookSignal:
-        state = pri.per_battle
-        options = pri.options
+        state: PerBattleSuccess = pri.per_battle
+        options: OptionSuccessDefault = pri.options
         if not isinstance(state, PerBattleSuccess) or not isinstance(options, OptionSuccessDefault):
             raise
         if state.click_stage_1 is None:

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


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

@@ -152,15 +152,6 @@
     "threshold": 0.8,
     "description": "左上角的退出"
   },
-  {
-    "itemName": "exit_ensure",
-    "imageName": "gb_exit_ensure.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "667,398,179,66",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "退出确认"
-  },
   {
     "itemName": "friends",
     "imageName": "gb_friends.png",

+ 5 - 5
tasks/Component/GeneralBattle/general_battle.py

@@ -106,7 +106,7 @@ class GeneralBattle(BattleWait, GeneralBuff):
         while 1:
             self.screenshot()
             # 弹窗后方的返回图标仍能匹配,先处理确认框,避免反复点击背景。
-            if self.appear(self.I_EXIT_ENSURE):
+            if self.appear(self.I_UI_CONFIRM):
                 break
             if self.appear_then_click(self.I_EXIT, interval=1.5):
                 continue
@@ -115,11 +115,11 @@ class GeneralBattle(BattleWait, GeneralBuff):
         # 点击返回确认
         while 1:
             self.screenshot()
-            if self.appear_then_click(self.I_EXIT_ENSURE, interval=1.5):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=1.5):
                 continue
             if self.appear(self.I_FALSE):
                 break
-        logger.info(f"Click {self.I_EXIT_ENSURE.name}")
+        logger.info(f"Click {self.I_UI_CONFIRM.name}")
 
         # 点击失败确认
         self.wait_until_appear(self.I_FALSE)
@@ -148,7 +148,7 @@ class GeneralBattle(BattleWait, GeneralBuff):
         logger.info(f"Click {self.I_EXIT.name}")
         while 1:
             self.screenshot()
-            if self.appear(self.I_EXIT_ENSURE):
+            if self.appear(self.I_UI_CONFIRM):
                 break
             if self.appear_then_click(self.I_EXIT, interval=1.5):
                 continue
@@ -156,7 +156,7 @@ class GeneralBattle(BattleWait, GeneralBuff):
         # 点击返回确认
         while 1:
             self.screenshot()
-            if self.appear_then_click(self.I_EXIT_ENSURE, interval=1.5):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=1.5):
                 continue
             if self.appear_then_click(self.I_FALSE, interval=1.5):
                 continue

+ 6 - 0
tasks/Component/GeneralBattle/gw/click2.json

@@ -112,5 +112,11 @@
     "roiFront": "138,16,512,93",
     "roiBack": "138,16,512,93",
     "description": "其实贪吃鬼这个点了也是没事儿"
+  },
+  {
+    "itemName": "end_master",
+    "roiFront": "251,145,811,530",
+    "roiBack": "248,143,815,535",
+    "description": "中间的一堆奖励直接忽略。上面的end_1_1到end_3_6会容易UI变化失效"
   }
 ]

+ 0 - 10
tasks/Component/GeneralInvite/assets.py

@@ -79,14 +79,6 @@ class GeneralInviteAssets:
 	I_I_ACCEPT = RuleImage(roi_front=(113,225,63,72), roi_back=(113,225,63,280), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_i_accept.png")
 	# 队员默认接受邀请 
 	I_I_ACCEPT_DEFAULT = RuleImage(roi_front=(205,223,61,68), roi_back=(205,223,61,297), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_i_accept_default.png")
-	# 不勾选 默认邀请 
-	I_I_NO_DEFAULT = RuleImage(roi_front=(545,345,33,33), roi_back=(530,330,90,60), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_i_no_default.png")
-	# 勾选 默认邀请 
-	I_I_DEFAULT = RuleImage(roi_front=(545,345,33,33), roi_back=(530,330,90,60), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_i_default.png")
-	# description 
-	I_GI_CANCEL = RuleImage(roi_front=(492,424,71,30), roi_back=(438,407,171,55), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_cancel.png")
-	# 队长邀请 确定 
-	I_GI_SURE = RuleImage(roi_front=(718,424,69,30), roi_back=(670,402,175,60), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_sure.png")
 	# 所有的组队界面都有加成 
 	I_GI_BUFF = RuleImage(roi_front=(794,38,46,42), roi_back=(794,38,46,42), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_buff.png")
 	# 三人御魂组队左上角的协站队伍 
@@ -129,5 +121,3 @@ class GeneralInviteAssets:
 	O_FRIEND_NAME_2 = RuleOcr(roi=(729,184,196,346), area=(729,184,196,346), mode="Full", method="Default", keyword="", name="friend_name_2")
 	# Ocr-description 
 	O_ONLINE = RuleOcr(roi=(790,102,124,42), area=(0,0,100,100), mode="Single", method="Default", keyword="", name="online")
-
-

+ 21 - 21
tasks/Component/GeneralInvite/general_invite.py

@@ -183,16 +183,16 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
         while 1:
             self.screenshot()
             if not self.is_in_room() and \
-                    not self.appear_then_click(self.I_GI_SURE, interval=0.8) and \
+                    not self.appear_then_click(self.I_UI_CONFIRM, interval=0.8) and \
                     not self.appear(self.I_BACK_YELLOW):
                 break
-            if self.appear_then_click(self.I_GI_SURE, interval=0.5):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=0.5):
                 continue
-            if not self.appear(self.I_GI_SURE) and self.appear_then_click(self.I_BACK_YELLOW, interval=0.8):
-                self.wait_until_appear(self.I_GI_SURE, wait_time=0.8)
+            if not self.appear(self.I_UI_CONFIRM) and self.appear_then_click(self.I_BACK_YELLOW, interval=0.8):
+                self.wait_until_appear(self.I_UI_CONFIRM, wait_time=0.8)
                 continue
-            if not self.appear(self.I_GI_SURE) and self.appear_then_click(self.I_BACK_YELLOW_SEA, interval=0.8):
-                self.wait_until_appear(self.I_GI_SURE, wait_time=0.8)
+            if not self.appear(self.I_UI_CONFIRM) and self.appear_then_click(self.I_BACK_YELLOW_SEA, interval=0.8):
+                self.wait_until_appear(self.I_UI_CONFIRM, wait_time=0.8)
                 continue
         return True
 
@@ -496,33 +496,33 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
         # 判断是否进入界面
         while 1:
             self.screenshot()
-            if self.appear(self.I_GI_SURE):
+            if self.appear(self.I_UI_CONFIRM):
                 break
         # 如果勾选了默认邀请
         if default_invite:
             logger.info('Click default invite')
             while 1:
                 self.screenshot()
-                if self.appear(self.I_I_DEFAULT):
+                if self.appear(self.I_UI_CHECK):
                     break
-                if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):
+                if self.appear_then_click(self.I_UI_UNCHECK, interval=1):
                     continue
         else:
             logger.info('Click no default invite')
             while 1:
                 self.screenshot()
-                if self.appear(self.I_I_NO_DEFAULT):
+                if self.appear(self.I_UI_UNCHECK):
                     break
-                if self.appear_then_click(self.I_I_DEFAULT, interval=1):
+                if self.appear_then_click(self.I_UI_CHECK, interval=1):
                     continue
 
         # 点击确认
         logger.info('Click invite ensure')
         while 1:
             self.screenshot()
-            if not self.appear(self.I_GI_SURE):
+            if not self.appear(self.I_UI_CONFIRM):
                 break
-            if self.appear_then_click(self.I_GI_SURE):
+            if self.appear_then_click(self.I_UI_CONFIRM):
                 continue
 
     def check_and_invite(self, default_invite: bool=True) -> bool:
@@ -531,25 +531,25 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
         :param default_invite:
         :return:
         """
-        if not self.appear(self.I_GI_SURE):
+        if not self.appear(self.I_UI_CONFIRM):
             return False
 
         if default_invite:
             # 有可能是挑战失败的
-            if self.appear(self.I_I_DEFAULT) or self.appear(self.I_I_NO_DEFAULT):
+            if self.appear(self.I_UI_CHECK) or self.appear(self.I_UI_UNCHECK):
                 logger.info('Click default invite')
                 while 1:
                     self.screenshot()
-                    if self.appear(self.I_I_DEFAULT):
+                    if self.appear(self.I_UI_CHECK):
                         break
-                    if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):
+                    if self.appear_then_click(self.I_UI_UNCHECK, interval=1):
                         continue
         # 点击确认
         while 1:
             self.screenshot()
-            if not self.appear(self.I_GI_SURE):
+            if not self.appear(self.I_UI_CONFIRM):
                 break
-            if self.appear_then_click(self.I_GI_SURE, interval=1):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
                 continue
 
         return True
@@ -570,9 +570,9 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
             # https://github.com/runhey/OnmyojiAutoScript/issues/230
             if self.appear(GeneralBattleAssets.I_EXIT):
                 return False
-            if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):
+            if self.appear_then_click(self.I_UI_UNCHECK, interval=1):
                 continue
-            if self.appear_then_click(self.I_GI_SURE, interval=1):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
                 continue
             if self.appear_then_click(self.I_I_ACCEPT_DEFAULT, interval=1):
                 continue

BIN
tasks/Component/GeneralInvite/gi/gi_cancel.png


BIN
tasks/Component/GeneralInvite/gi/gi_default_invite.png


BIN
tasks/Component/GeneralInvite/gi/gi_default_no.png


BIN
tasks/Component/GeneralInvite/gi/gi_gi_sure.png


BIN
tasks/Component/GeneralInvite/gi/gi_i_default.png


BIN
tasks/Component/GeneralInvite/gi/gi_i_no_default.png


+ 0 - 36
tasks/Component/GeneralInvite/gi/image.json

@@ -305,42 +305,6 @@
     "threshold": 0.8,
     "description": "队员默认接受邀请"
   },
-  {
-    "itemName": "i_no_default",
-    "imageName": "gi_i_no_default.png",
-    "roiFront": "545,345,33,33",
-    "roiBack": "530,330,90,60",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "不勾选 默认邀请"
-  },
-  {
-    "itemName": "i_default",
-    "imageName": "gi_i_default.png",
-    "roiFront": "545,345,33,33",
-    "roiBack": "530,330,90,60",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "勾选 默认邀请"
-  },
-  {
-    "itemName": "gi_cancel",
-    "imageName": "gi_cancel.png",
-    "roiFront": "492,424,71,30",
-    "roiBack": "438,407,171,55",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
-  {
-    "itemName": "gi_sure",
-    "imageName": "gi_gi_sure.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "670,402,175,60",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "队长邀请 确定"
-  },
   {
     "itemName": "gi_buff",
     "imageName": "gi_gi_buff.png",

+ 0 - 4
tasks/Component/SwitchSoul/assets.py

@@ -42,8 +42,6 @@ class SwitchSoulAssets:
 	I_SOU_SWITCH_3 = RuleImage(roi_front=(978,455,25,26), roi_back=(962,442,52,48), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_3.png")
 	# description 
 	I_SOU_SWITCH_4 = RuleImage(roi_front=(978,603,25,22), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_4.png")
-	# description 
-	I_SOU_SWITCH_SURE = RuleImage(roi_front=(718,424,69,30), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_sure.png")
 	# 用于判断是否在式神录里面 
 	I_SOU_CHECK_IN = RuleImage(roi_front=(269,69,50,49), roi_back=(269,69,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_check_in.png")
 	# description 
@@ -86,5 +84,3 @@ class SwitchSoulAssets:
 	S_SS_TEAM_SWIPE_UP = RuleSwipe(roi_front=(720,439,21,21), roi_back=(717,308,21,21), mode="default", name="ss_team_swipe_up")
 	# 阵容向上滑动 
 	S_SS_TEAM_SWIPE_DOWN = RuleSwipe(roi_front=(709,308,21,21), roi_back=(709,449,21,21), mode="default", name="ss_team_swipe_down")
-
-

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

@@ -53,15 +53,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "sou_switch_sure",
-    "imageName": "ss_sou_switch_sure.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "668,401,180,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "sou_check_in",
     "imageName": "ss_sou_check_in.png",
@@ -170,4 +161,4 @@
     "threshold": 0.8,
     "description": "通用进入式神录"
   }
-]
+]

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


+ 5 - 5
tasks/Component/SwitchSoul/switch_soul.py

@@ -154,19 +154,19 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
         for i in range(3):
             sleep(0.8)
             self.screenshot()
-            if self.appear(self.I_SOU_SWITCH_SURE):
+            if self.appear(self.I_UI_CONFIRM):
                 while 1:
-                    self.click(self.I_SOU_SWITCH_SURE, 3)
+                    self.click(self.I_UI_CONFIRM, 3)
                     self.screenshot()
                     if self.appear_then_click(self.I_CHECK_BLOCK, 3):
                         continue
-                    if not self.appear(self.I_SOU_SWITCH_SURE):
+                    if not self.appear(self.I_UI_CONFIRM):
                         break
                 continue
             if not self.appear_then_click(target_team, interval=3):
                 logger.warning(f'Click team {team} failed in group {group}')
         # 兜底若还出现确认按钮则点击
-        self.ui_click_until_disappear(self.I_SOU_SWITCH_SURE)
+        self.ui_click_until_disappear(self.I_UI_CONFIRM)
         logger.info(f'Switch soul_one group {group} team {team}')
 
     def switch_souls(self, target: tuple or list[tuple]) -> None:
@@ -275,7 +275,7 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
             self.screenshot()
             if cnt_click >= 4:
                 break
-            if self.appear_then_click(self.I_SOU_SWITCH_SURE, interval=0.8):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=0.8):
                 continue
             if self.ocr_appear_click_by_rule(self.O_SS_TEAM_NAME, self.I_SOU_CLICK_PRESENT, interval=1.5):
                 cnt_click += 1

+ 1 - 1
tasks/Duel/assets.py

@@ -34,6 +34,7 @@ class DuelAssets:
 	I_D_PREPARE = RuleImage(roi_front=(1127,541,100,100), roi_back=(1127,541,100,100), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_prepare.png")
 	# 胜利 
 	I_D_VICTORY = RuleImage(roi_front=(433,76,100,100), roi_back=(433,76,100,100), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_victory.png")
+	I_D_VICTORY_SHARE = RuleImage(roi_front=(1100,580,90,120), roi_back=(1080,560,130,160), threshold=0.8, method="Masked template matching", file="./tasks/Duel/duel/duel_d_victory_share.png")
 	# 失败 
 	I_D_FAIL = RuleImage(roi_front=(422,66,100,100), roi_back=(422,66,100,100), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_fail.png")
 	# 战 
@@ -76,4 +77,3 @@ class DuelAssets:
 	# 被办式神名称 
 	O_D_BAN_NAME = RuleOcr(roi=(92,97,82,25), area=(92,97,82,25), mode="Single", method="Default", keyword="", name="d_ban_name")
 
-

BIN
tasks/Duel/duel/duel_d_victory_share.png


BIN
tasks/Duel/duel/duel_d_victory_share_mask.png


+ 9 - 0
tasks/Duel/duel/image.json

@@ -187,5 +187,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "队伍试用"
+  },
+  {
+    "itemName": "d_victory_share",
+    "imageName": "duel_d_victory_share.png",
+    "roiFront": "1100,580,90,120",
+    "roiBack": "1080,560,130,160",
+    "method": "Masked template matching",
+    "threshold": 0.8,
+    "description": "斗技胜利MVP分享页右下分享按钮"
   }
 ]

+ 3 - 2
tasks/Duel/script_task.py

@@ -207,7 +207,7 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, DuelAssets, SwitchOnmyoji):
             self.screenshot()
             if self.appear(self.I_D_FAIL) or self.appear(self.I_FALSE):
                 return
-            if self.appear_then_click(self.I_EXIT_ENSURE):
+            if self.appear_then_click(self.I_UI_CONFIRM):
                 continue
             # 选式神界面退出或战斗内退出
             if self.appear_then_click(self.I_DUEL_EXIT, interval=1) or self.appear_then_click(self.I_EXIT, interval=1):
@@ -303,7 +303,8 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, DuelAssets, SwitchOnmyoji):
             self.appear(self.I_D_CHECK_BAN)
 
     def is_battle_win(self) -> bool:
-        return self.appear(self.I_WIN) or self.appear(self.I_D_VICTORY)
+        return self.appear(self.I_WIN) or self.appear(self.I_D_VICTORY) or \
+            self.appear(self.I_D_VICTORY_SHARE)
 
     def is_battle_lose(self) -> bool:
         return self.appear(self.I_FALSE) or self.appear(self.I_D_FAIL)

+ 1 - 1
tasks/EternitySea/script_task.py

@@ -165,7 +165,7 @@ class ScriptTask(
             self.screenshot()
             if self.match_page_once(page_soul_zones):
                 return
-            if self.appear_then_click(self.I_GI_SURE, interval=1):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
                 continue
             if self.appear_then_click(self.I_BACK_YELLOW, interval=1):
                 continue

+ 0 - 2
tasks/Exploration/assets.py

@@ -108,8 +108,6 @@ class ExplorationAssets:
 	# description 
 	I_BATTLE_START = RuleImage(roi_front=(555,688,39,27.5), roi_back=(221,677,561,41), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_battle_start.png")
 	# description 
-	I_GET_REWARD = RuleImage(roi_front=(514,206,255,70), roi_back=(450,130,390,200), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_get_reward.png")
-	# description 
 	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")

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

@@ -143,15 +143,6 @@
     "threshold": 0.8,
     "description": "description"
   },
-  {
-    "itemName": "get_reward",
-    "imageName": "res_get_reward.png",
-    "roiFront": "514,206,255,70",
-    "roiBack": "450,130,390,200",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "red_close",
     "imageName": "res_red_close.png",

BIN
tasks/Exploration/res/res_get_reward.png


+ 2 - 1
tasks/GameUi/default_pages.py

@@ -15,6 +15,7 @@ import random
 from module.atom.click import RuleClick
 from tasks.Component.GeneralBattle.assets import GeneralBattleAssets
 from tasks.GlobalGame.assets import GlobalGameAssets
+from tasks.GlobalGame.global_game import GlobalGame
 from tasks.GameUi.assets import GameUiAssets
 from tasks.GameUi.matcher import any_of, all_of
 from tasks.GameUi.page_definition import Page
@@ -347,7 +348,7 @@ page_reward = Page(
         GeneralBattleAssets.I_REWARD_PURPLE_SNAKE_SKIN,
         GeneralBattleAssets.I_REWARD_SOUL_5,
         GeneralBattleAssets.I_REWARD_SOUL_6,
-        GlobalGameAssets.I_UI_REWARD,
+        GlobalGame.I_UI_REWARD,
     ),
     category="global",
     priority=25

+ 1 - 0
tasks/GameUi/navigator.py

@@ -50,6 +50,7 @@ class GameUi(BaseTask, GameUiAssets):
         GlobalGameAssets.I_UI_BACK_YELLOW,
         SixRealmsAssets.I_EXIT_SIXREALMS,
         GlobalGameAssets.I_UI_BACK_BLUE,
+        GlobalGameAssets.I_UI_BACK_CIRCLE,
     ]
 
     def __init__(self, config, device):

+ 6 - 3
tasks/GlobalGame/assets.py

@@ -40,11 +40,14 @@ class GlobalGameAssets:
 
 	# Image Rule Assets
 	# 长一点的确认 
-	I_UI_CONFIRM = RuleImage(roi_front=(718,424,69,30), roi_back=(667,398,179,66), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_confirm.png")
+	I_UI_CONFIRM = RuleImage(roi_front=(718,424,69,30), roi_back=(643,389,216,95), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_confirm.png")
+	I_UI_CONFIRM_OLD = RuleImage(roi_front=(685,376,179,66), roi_back=(663,334,232,193), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_confirm_old.png")
 	# 长一点的取消 
-	I_UI_CANCEL = RuleImage(roi_front=(492,424,71,30), roi_back=(432,403,177,62), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel.png")
+	I_UI_CANCEL = RuleImage(roi_front=(492,424,71,30), roi_back=(356,384,276,125), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel.png")
+	I_UI_CANCEL_OLD = RuleImage(roi_front=(417,368,177,62), roi_back=(366,349,261,173), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel_old.png")
 	# '获得奖励' 四个大字 
-	I_UI_REWARD = RuleImage(roi_front=(514,206,255,70), roi_back=(450,130,390,200), threshold=0.73, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_reward.png")
+	I_UI_REWARD = RuleImage(roi_front=(514,206,255,70), roi_back=(450,69,390,303), threshold=0.73, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_reward.png")
+	I_UI_REWARD_ALT = RuleImage(roi_front=(530,126,211,66), roi_back=(450,69,390,303), threshold=0.73, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_reward_alt.png")
 	# description 
 	I_UI_BACK_RED = RuleImage(roi_front=(1041,111,34,38), roi_back=(877,15,383,254), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_back_red.png")
 	# description 

+ 14 - 0
tasks/GlobalGame/global_game.py

@@ -0,0 +1,14 @@
+from copy import deepcopy
+
+from module.atom.gif import RuleGif
+from tasks.GlobalGame.assets import GlobalGameAssets
+
+
+class GlobalGame(GlobalGameAssets):
+    """Combine UI variants while keeping generated image definitions independent."""
+
+    I_UI_REWARD = deepcopy(GlobalGameAssets.I_UI_REWARD)
+    RuleGif.attach_to(I_UI_REWARD, [
+        deepcopy(GlobalGameAssets.I_UI_REWARD),
+        deepcopy(GlobalGameAssets.I_UI_REWARD_ALT),
+    ])

+ 30 - 3
tasks/GlobalGame/ui/image.json

@@ -3,7 +3,7 @@
     "itemName": "ui_confirm",
     "imageName": "ui_ui_confirm.png",
     "roiFront": "718,424,69,30",
-    "roiBack": "667,398,179,66",
+    "roiBack": "643,389,216,95",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "长一点的确认"
@@ -12,7 +12,7 @@
     "itemName": "ui_cancel",
     "imageName": "ui_ui_cancel.png",
     "roiFront": "492,424,71,30",
-    "roiBack": "432,403,177,62",
+    "roiBack": "356,384,276,125",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "长一点的取消"
@@ -21,7 +21,7 @@
     "itemName": "ui_reward",
     "imageName": "ui_ui_reward.png",
     "roiFront": "514,206,255,70",
-    "roiBack": "450,130,390,200",
+    "roiBack": "450,69,390,303",
     "method": "Template matching",
     "threshold": 0.73,
     "description": "'获得奖励' 四个大字"
@@ -115,5 +115,32 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "圆形返回按钮(移植自mine)"
+  },
+  {
+    "itemName": "ui_confirm_old",
+    "imageName": "ui_ui_confirm_old.png",
+    "roiFront": "685,376,179,66",
+    "roiBack": "663,334,232,193",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "长一点的确认(旧)"
+  },
+  {
+    "itemName": "ui_cancel_old",
+    "imageName": "ui_ui_cancel_old.png",
+    "roiFront": "417,368,177,62",
+    "roiBack": "366,349,261,173",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "长一点的取消(旧)"
+  },
+  {
+    "itemName": "ui_reward_alt",
+    "imageName": "ui_ui_reward_alt.png",
+    "roiFront": "530,126,211,66",
+    "roiBack": "450,69,390,303",
+    "method": "Template matching",
+    "threshold": 0.73,
+    "description": "Alternate reward title"
   }
 ]

BIN
tasks/GlobalGame/ui/ui_ui_cancel_old.png


BIN
tasks/GlobalGame/ui/ui_ui_confirm_old.png


BIN
tasks/GlobalGame/ui/ui_ui_reward_alt.png


BIN
tasks/GlobalGame/ui/ui_ui_rewards.png


+ 3 - 1
tasks/MemoryScrolls/assets.py

@@ -25,6 +25,9 @@ class MemoryScrollsAssets:
 	C_MS_SCROLL_6 = RuleClick(roi_front=(838,408,277,185), roi_back=(838,408,277,185), name="ms_scroll_6")
 	# 贡献完成跳结算 
 	C_MS_CONTRIBUTED = RuleClick(roi_front=(108,509,993,190), roi_back=(108,509,993,190), name="ms_contributed")
+	C_MS_MAX_S = RuleClick(roi_front=(1106,116,36,36), roi_back=(1106,116,36,36), name="ms_max_s")
+	C_MS_MAX_M = RuleClick(roi_front=(1106,258,36,36), roi_back=(1106,258,36,36), name="ms_max_m")
+	C_MS_MAX_L = RuleClick(roi_front=(1106,398,36,36), roi_back=(1106,398,36,36), name="ms_max_l")
 	# 双绘卷之二 
 	C_MS_DOUBLE_SCROLLS_2 = RuleClick(roi_front=(714,128,464,397), roi_back=(714,128,464,397), name="ms_double_scrolls_2")
 
@@ -66,4 +69,3 @@ class MemoryScrollsAssets:
 	# 大碎片拉满 
 	S_MS_SWIPE_L = RuleSwipe(roi_front=(854,465,34,25), roi_back=(1131,440,43,77), mode="default", name="ms_swipe_l")
 
-

+ 18 - 0
tasks/MemoryScrolls/ms/click.json

@@ -46,5 +46,23 @@
     "roiFront": "714,128,464,397",
     "roiBack": "714,128,464,397",
     "description": "双绘卷之二"
+  },
+  {
+    "itemName": "ms_max_s",
+    "roiFront": "1106,116,36,36",
+    "roiBack": "1106,116,36,36",
+    "description": "小绘卷最大按钮"
+  },
+  {
+    "itemName": "ms_max_m",
+    "roiFront": "1106,258,36,36",
+    "roiBack": "1106,258,36,36",
+    "description": "中绘卷最大按钮"
+  },
+  {
+    "itemName": "ms_max_l",
+    "roiFront": "1106,398,36,36",
+    "roiBack": "1106,398,36,36",
+    "description": "大绘卷最大按钮"
   }
 ]

+ 14 - 6
tasks/MemoryScrolls/script_task.py

@@ -131,25 +131,33 @@ class ScriptTask(GameUi, MemoryScrollsAssets):
     def contribute_memoryscrolls(self):
         """
         捐献碎片
+        最多捐献 10 轮,避免素材识别异常时无限循环(一轮捐一次,剩余碎片留到下次运行)
         :return: None
         """
-        while 1:
+        max_rounds = 10
+        for i in range(1, max_rounds + 1):
             self.screenshot()
             if self.appear(self.I_MS_ZERO_S) and self.appear(self.I_MS_ZERO_M) and self.appear(self.I_MS_ZERO_L):
                 logger.info('Memory Scrolls contribution is already completed')
                 return
-            self.swipe(self.S_MS_SWIPE_S, interval=1)
-            self.swipe(self.S_MS_SWIPE_M, interval=1)
-            self.swipe(self.S_MS_SWIPE_L, interval=1)
+            # 用每行的“最大”按钮代替滑动:小/中/大各点两次,等价于把数量条拉满
+            for max_button in (self.C_MS_MAX_S, self.C_MS_MAX_M, self.C_MS_MAX_L):
+                for _ in range(2):
+                    self.click(max_button)
+                    sleep(0.3)
             if self.appear_then_click(self.I_MS_CONTRIBUTE, interval=3):
-                logger.info('Contributed Memory Scrolls')
+                logger.info(f'Contributed Memory Scrolls ({i}/{max_rounds})')
                 # 等待捐献动画结束
-                while 1:
+                for _ in range(max_rounds):
                     self.screenshot()
                     if self.wait_until_appear(self.I_MS_CONTRIBUTED, wait_time=5):
                         self.click(self.C_MS_CONTRIBUTED, interval=1)
                     else:
                         break
+                else:
+                    logger.warning('Wait for MS_MS_CONTRIBUTED too many times')
+        logger.warning(f'Memory Scrolls contribution reached the round limit ({max_rounds}), '
+                       f'give up this run to avoid getting stuck')
     
 
 

+ 0 - 4
tasks/RealmRaid/assets.py

@@ -39,8 +39,6 @@ class RealmRaidAssets:
 	I_FIRE = RuleImage(roi_front=(982,494,136,63), roi_back=(140,129,1024,584), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_fire.png")
 	# 打完个后出现的领取奖励 
 	I_SOUL_RAID = RuleImage(roi_front=(577,502,100,100), roi_back=(577,502,100,100), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_soul_raid.png")
-	# 刷新确认 
-	I_FRESH_ENSURE = RuleImage(roi_front=(718,424,69,30), roi_back=(672,403,173,59), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_fresh_ensure.png")
 	# 没有锁图片,适配呱太入侵 
 	I_UNLOCK_2 = RuleImage(roi_front=(1002,643,30,41), roi_back=(1002,643,30,41), threshold=0.9, method="Template matching", file="./tasks/RealmRaid/res/res_unlock_2.png")
 	# 以锁图片,适配呱太 
@@ -110,5 +108,3 @@ class RealmRaidAssets:
 	C_PARTITION_8 = RuleClick(roi_front=(567,413,230,124), roi_back=(567,413,230,124), name="partition_8")
 	# 用来分割不同的挑战位置 
 	C_PARTITION_9 = RuleClick(roi_front=(900,418,222,116), roi_back=(900,418,222,116), name="partition_9")
-
-

+ 1 - 10
tasks/RealmRaid/res/image.json

@@ -125,15 +125,6 @@
     "threshold": 0.8,
     "description": "打完个后出现的领取奖励"
   },
-  {
-    "itemName": "fresh_ensure",
-    "imageName": "res_fresh_ensure.png",
-    "roiFront": "718,424,69,30",
-    "roiBack": "672,403,173,59",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "刷新确认"
-  },
   {
     "itemName": "unlock_2",
     "imageName": "res_unlock_2.png",
@@ -179,4 +170,4 @@
     "threshold": 0.8,
     "description": "description"
   }
-]
+]

BIN
tasks/RealmRaid/res/res_fresh_ensure.png


+ 10 - 10
tasks/RealmRaid/script_task.py

@@ -150,9 +150,9 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
         while 1:
             self.screenshot()
             #看到弹窗点掉,不然会卡死
-            if self.appear(self.I_FRESH_ENSURE):
+            if self.appear(self.I_UI_CONFIRM):
                 logger.info("Pop-up detected: Refresh Confirmation. Clicking Confirm.")
-                self.appear_then_click(self.I_FRESH_ENSURE, interval=1.5)
+                self.appear_then_click(self.I_UI_CONFIRM, interval=1.5)
                 continue
             # 检查票数,同时确认奖励已领取且已返回突破列表。
             if not self.check_ticket(con.raid_config.number_base):
@@ -175,10 +175,10 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
                 else:
                     logger.info('No one can attack, break')
                     # 检查是否有“刷新确认”弹窗挡路
-                    if self.appear(self.I_FRESH_ENSURE):
+                    if self.appear(self.I_UI_CONFIRM):
                         logger.info("Closing obstructing refresh dialog (Click Ensure)...")
                         # 点击“确定”来完成刷新(或者你可以改成点取消)
-                        self.appear_then_click(self.I_FRESH_ENSURE, interval=2)
+                        self.appear_then_click(self.I_UI_CONFIRM, interval=2)
                     success = False
                     break
             # 判断是不是左上角第一个
@@ -456,15 +456,15 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
             return False
         while 1:
             self.screenshot()
-            if self.appear(self.I_FRESH_ENSURE):
+            if self.appear(self.I_UI_CONFIRM):
                 break
             if self.appear_then_click(self.I_FRESH, interval=1):
                 continue
         while 1:
             self.screenshot()
-            if not self.appear(self.I_FRESH_ENSURE):
+            if not self.appear(self.I_UI_CONFIRM):
                 return True
-            if self.appear_then_click(self.I_FRESH_ENSURE, interval=1):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
                 continue
 
     def fire(self, order: int):
@@ -480,8 +480,8 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
             
             logger.info("Title not found! Checking for popups or rewards...")
             
-            # 如果看到了“刷新确认”弹窗 (I_FRESH_ENSURE 是右边的确定)
-            if self.appear(self.I_FRESH_ENSURE):
+            # 如果看到了“刷新确认”弹窗 (self.I_UI_CONFIRM 是右边的确定)
+            if self.appear(self.I_UI_CONFIRM):
                 logger.info("Refresh popup detected! Clicking CANCEL (Red Button).")
                 # 点击“取消”按钮的坐标 (基于1280x720分辨率)
                 self.device.click(x=530, y=460) 
@@ -503,7 +503,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
             self.screenshot()
             
             # 双重保险:如果在进攻阶段又弹出了窗口,也把它关掉
-            if self.appear(self.I_FRESH_ENSURE):
+            if self.appear(self.I_UI_CONFIRM):
                 logger.info("Refresh popup blocking attack! Clicking CANCEL.")
                 self.device.click(x=530, y=460) # 点取消
                 time.sleep(1.0)

+ 2 - 2
tasks/base_task.py

@@ -27,12 +27,12 @@ from module.ocr.base_ocr import OcrMode
 
 from tasks.Component.Costume.costume_base import CostumeBase
 from tasks.Component.config_base import Time
-from tasks.GlobalGame.assets import GlobalGameAssets
+from tasks.GlobalGame.global_game import GlobalGame
 from tasks.GlobalGame.config_emergency import FriendInvitation
 
 
 
-class BaseTask(GlobalGameAssets, CostumeBase):
+class BaseTask(GlobalGame, CostumeBase):
     config: Config = None
     device: Device = None
 

+ 31 - 5
tests/tasks/ActivityShikigami/test_battle_integration.py

@@ -19,13 +19,16 @@ def isolated_runtime(monkeypatch):
 class ActivityReplay(ScriptTask):
     """Exercise the real activity entry point and battle hooks without a device."""
 
-    def __init__(self):
+    def __init__(self, *, reward_style='popup', return_delay=0):
         self.conf = ActivityShikigami()
         self.conf.general_climb.run_sequence = 'pass,ap'
         self.run_idx = 0
         self.frames = 0
         self.result_visible = True
         self.win = True
+        self.reward_style = reward_style
+        self.return_delay = return_delay
+        self.return_frames = 0
         self.clicks = []
         self.device = SimpleNamespace(
             stuck_record_add=lambda name: None,
@@ -35,6 +38,10 @@ class ActivityReplay(ScriptTask):
     def screenshot(self):
         self.frames += 1
         assert self.frames < 40, 'Activity battle did not settle'
+        if not self.result_visible:
+            self.return_frames += 1
+            if self.return_frames <= self.return_delay:
+                assert not self.battle_count_reached(1)
 
     def is_in_battle(self, is_screenshot=True):
         return True
@@ -43,7 +50,12 @@ class ActivityReplay(ScriptTask):
         return False
 
     def appear(self, asset, **kwargs):
-        result = self.I_UI_REWARD if self.win else self.I_FALSE
+        result = self.I_UI_REWARD if self.reward_style == 'popup' else self.I_REWARD
+        if not self.win:
+            result = self.I_FALSE
+        if not self.result_visible and self.return_frames > self.return_delay:
+            challenge = self.I_CHECK_BATTLE_BOSS if self.climb_type == 'boss' else self.I_CHECK_BATTLE_MAIN
+            return asset.name == challenge.name
         return self.result_visible and asset is result
 
     def appear_then_click(self, asset, **kwargs):
@@ -52,6 +64,7 @@ class ActivityReplay(ScriptTask):
     def click(self, asset, **kwargs):
         self.clicks.append(asset.name)
         self.result_visible = False
+        return True
 
     def ui_click_until_disappear(self, asset, **kwargs):
         self.click(asset)
@@ -64,8 +77,9 @@ class ActivityReplay(ScriptTask):
 
 
 @pytest.mark.parametrize('win', [True, False])
-def test_activity_entry_uses_its_reward_strategy_and_counts_success_only(win):
-    task = ActivityReplay()
+@pytest.mark.parametrize('reward_style', ['popup', 'standard'])
+def test_activity_entry_handles_both_reward_styles_and_counts_success_only(win, reward_style):
+    task = ActivityReplay(reward_style=reward_style)
     task.win = win
     # Decorating another task later must not replace Activity's selected hooks.
     battle_wait_strategy(success='default')(lambda owner, **kwargs: None)
@@ -74,10 +88,22 @@ def test_activity_entry_uses_its_reward_strategy_and_counts_success_only(win):
     assert task.start_battle() is win
     assert task.count_map == {'pass': int(win), 'ap': 0}
     assert task.battle_count_reached(1)
-    assert task.clicks == ['exclude_click_activity' if win else task.I_FALSE.name]
+    reward_click = 'exclude_click_activity' if reward_style == 'popup' else 'reward_exclude_click_2'
+    assert task.clicks == [reward_click if win else task.I_FALSE.name]
     assert battle_wait_strategy._context.get() is None
 
 
+@pytest.mark.parametrize('climb_type', ['pass', 'ap', 'boss'])
+def test_completion_waits_for_the_current_challenge_screen(climb_type):
+    task = ActivityReplay(return_delay=4)
+    task.conf.general_climb.run_sequence = climb_type
+
+    assert task.start_battle() is True
+    assert task.return_frames > task.return_delay
+    assert task.count_map == {climb_type: 1}
+    assert task.clicks == ['exclude_click_activity']
+
+
 def test_switching_climb_type_preserves_counts_and_resets_battle_state():
     task = ActivityReplay()
     assert task.start_battle() is True

+ 5 - 5
tests/tasks/Component/GeneralBattle/test_battle_exit.py

@@ -22,7 +22,7 @@ class BattleExitReplay(GeneralBattle):
             return self.screen == 'battle' or (
                 self.screen == 'confirm' and self.background_exit_visible
             )
-        if asset is self.I_EXIT_ENSURE:
+        if asset is self.I_UI_CONFIRM:
             return self.screen == 'confirm'
         if asset is self.I_FALSE:
             return self.screen == 'defeat'
@@ -34,7 +34,7 @@ class BattleExitReplay(GeneralBattle):
         self.clicks.append(asset.name)
         if asset is self.I_EXIT:
             self.screen = 'confirm'
-        elif asset is self.I_EXIT_ENSURE:
+        elif asset is self.I_UI_CONFIRM:
             if self.ignored_confirms:
                 self.ignored_confirms -= 1
             else:
@@ -62,7 +62,7 @@ def test_exit_confirms_dialog_before_clicking_the_background(method, background_
 
     assert task.run_exit(method) is True
     assert task.screen == 'finished'
-    assert task.clicks == [task.I_EXIT.name, task.I_EXIT_ENSURE.name, task.I_FALSE.name]
+    assert task.clicks == [task.I_EXIT.name, task.I_UI_CONFIRM.name, task.I_FALSE.name]
 
 
 @pytest.mark.parametrize('method', ['run_general_battle_back', 'exit_battle'])
@@ -71,7 +71,7 @@ def test_already_open_exit_dialog_is_confirmed_without_reopening_it(method):
 
     assert task.run_exit(method) is True
     assert task.screen == 'finished'
-    assert task.clicks == [task.I_EXIT_ENSURE.name, task.I_FALSE.name]
+    assert task.clicks == [task.I_UI_CONFIRM.name, task.I_FALSE.name]
 
 
 def test_exit_battle_ignores_confirmation_without_a_battle_anchor():
@@ -88,7 +88,7 @@ def test_ignored_confirmation_click_retries_the_dialog_not_the_background(method
     assert task.run_exit(method) is True
     assert task.screen == 'finished'
     assert task.clicks == [
-        task.I_EXIT.name, task.I_EXIT_ENSURE.name, task.I_EXIT_ENSURE.name, task.I_FALSE.name,
+        task.I_EXIT.name, task.I_UI_CONFIRM.name, task.I_UI_CONFIRM.name, task.I_FALSE.name,
     ]
 
 

+ 38 - 0
tests/tasks/Component/GeneralBattle/test_battle_wait.py

@@ -3,6 +3,7 @@ from types import SimpleNamespace
 
 import pytest
 
+from module.base import timer
 from tasks.Component.GeneralBattle.battle_wait import (
     BattleResult,
     BattleWait,
@@ -55,6 +56,43 @@ def test_default_plan_contains_default_hooks_and_sequence():
     assert plan.function_setup_name == '_bw_setup_default'
 
 
+def test_completion_fallback_avoids_rewards_and_stops_after_five_clicks(monkeypatch):
+    now = [100.0]
+    monkeypatch.setattr(timer, 'time', SimpleNamespace(time=lambda: now[0]))
+
+    class CompletionReplay(BattleWait):
+        def __init__(self):
+            self.clicks = []
+
+        def appear(self, asset, **kwargs):
+            return False
+
+        def click(self, asset, **kwargs):
+            point = asset.coord()
+            # The large central panel opens item details when clicked.
+            x, y = point
+            assert not (248 <= x < 1063 and 143 <= y < 678)
+            self.clicks.append(point)
+            return True
+
+    task = CompletionReplay()
+    runtime.update_options(
+        {'completion': OptionCompletionDefault(check_imgs=[task.I_EXIT])},
+        plan=BattleWaitPlan(),
+    )
+
+    assert task._bw_completion_default() == HookSignal.CONTINUE
+    now[0] += 2.9
+    assert task._bw_completion_default() == HookSignal.CONTINUE
+    assert task.clicks == []
+    for _ in range(5):
+        now[0] += 3.1
+        assert task._bw_completion_default() == HookSignal.CONTINUE
+    assert task._bw_completion_default() == HookSignal.DONE
+    assert len(task.clicks) == 5
+    assert runtime.pub_ctx.per_task.count == 1
+
+
 def test_decorator_passes_its_plan_to_the_wrapped_function():
     strategy = battle_wait_strategy('reserve_default', 'idle_default', failure='custom')
     plan, _ = strategy(capture)(object())

+ 17 - 10
tests/tasks/Exploration/test_treasure_reward.py

@@ -8,6 +8,8 @@ import numpy as np
 import pytest
 
 from tasks.Exploration.assets import ExplorationAssets
+from tasks.GlobalGame.assets import GlobalGameAssets
+from tasks.GlobalGame.global_game import GlobalGame
 from tasks.Exploration.base import Scene
 from tasks.Exploration.solo import SoloExploration
 
@@ -28,11 +30,14 @@ def scene_with_chest(crop, x=500, y=340):
     return image
 
 
-def reward_popup():
+def reward_popup(variant='local'):
     image = np.zeros((720, 1280, 3), dtype=np.uint8)
-    title = ExplorationAssets.I_GET_REWARD.image
+    asset = (GlobalGameAssets.I_UI_REWARD if variant == 'local'
+             else GlobalGameAssets.I_UI_REWARD_ALT)
+    title = asset.image
+    x, y = asset.roi_front[:2]
     height, width = title.shape[:2]
-    image[206:206 + height, 514:514 + width] = title
+    image[y:y + height, x:x + width] = title
     return image
 
 
@@ -48,10 +53,11 @@ def test_scene_chest_is_found_at_different_map_positions(chest_crop, position):
     assert y + 69 <= click_y < y + 90
 
 
-def test_reward_popup_is_not_an_unopened_chest():
-    image = reward_popup()
+@pytest.mark.parametrize('variant', ['local', 'upstream'])
+def test_reward_popup_is_not_an_unopened_chest(variant):
+    image = reward_popup(variant)
 
-    assert deepcopy(ExplorationAssets.I_GET_REWARD).match(image)
+    assert deepcopy(GlobalGame.I_UI_REWARD).match(image)
     assert not deepcopy(ExplorationAssets.I_BATTLE_REWARD).match(image)
 
 
@@ -60,7 +66,7 @@ class RewardCollected(Exception):
 
 
 class ExplorationRewardReplay(SoloExploration):
-    def __init__(self, chest_crop):
+    def __init__(self, chest_crop, variant='local'):
         self.explore_init = True
         self.interval_timer = {}
         self.screen = 'chest'
@@ -68,7 +74,7 @@ class ExplorationRewardReplay(SoloExploration):
         self.clicks = []
         self.images = {
             'chest': scene_with_chest(chest_crop),
-            'reward': reward_popup(),
+            'reward': reward_popup(variant),
             'done': np.zeros((720, 1280, 3), dtype=np.uint8),
         }
         self.device = SimpleNamespace(image=self.images[self.screen], click=self.record_click)
@@ -104,9 +110,10 @@ class ExplorationRewardReplay(SoloExploration):
 
 
 @pytest.mark.parametrize('mode', ['run_solo', 'run_leader', 'run_member'])
-def test_all_exploration_modes_open_the_chest_and_collect_rewards(chest_crop, monkeypatch, mode):
+@pytest.mark.parametrize('variant', ['local', 'upstream'])
+def test_all_exploration_modes_open_the_chest_and_collect_rewards(chest_crop, monkeypatch, mode, variant):
     monkeypatch.setattr('tasks.base_task.sleep', lambda _: None)
-    task = ExplorationRewardReplay(chest_crop)
+    task = ExplorationRewardReplay(chest_crop, variant)
 
     with pytest.raises(RewardCollected):
         getattr(task, mode)()

+ 74 - 0
tests/tasks/MemoryScrolls/test_contribution.py

@@ -0,0 +1,74 @@
+import pytest
+
+from tasks.MemoryScrolls.script_task import ScriptTask
+
+
+class ContributionReplay(ScriptTask):
+    def __init__(self, *, empty=False, stuck=False, popup=False):
+        self.empty = empty
+        self.stuck = stuck
+        self.popup = popup
+        self.frames = 0
+        self.clicks = []
+        self.contributions = 0
+
+    def screenshot(self):
+        self.frames += 1
+        assert self.frames <= 120, 'Contribution did not stop on a stuck screen'
+
+    def appear(self, asset, **kwargs):
+        return self.empty and asset in (self.I_MS_ZERO_S, self.I_MS_ZERO_M, self.I_MS_ZERO_L)
+
+    def appear_then_click(self, asset, **kwargs):
+        assert asset is self.I_MS_CONTRIBUTE
+        self.contributions += 1
+        self.empty = not self.stuck
+        return True
+
+    def wait_until_appear(self, asset, **kwargs):
+        assert asset is self.I_MS_CONTRIBUTED
+        return self.popup
+
+    def click(self, asset, **kwargs):
+        self.clicks.append(asset.name)
+        return True
+
+    def swipe(self, *args, **kwargs):
+        pytest.fail('Contribution must use the maximum buttons on the new UI')
+
+
+@pytest.fixture(autouse=True)
+def skip_animation_delays(monkeypatch):
+    monkeypatch.setattr('tasks.MemoryScrolls.script_task.sleep', lambda _: None)
+
+
+def test_empty_inventory_does_not_contribute():
+    task = ContributionReplay(empty=True)
+
+    task.contribute_memoryscrolls()
+
+    assert task.contributions == 0
+    assert task.clicks == []
+
+
+def test_contribution_selects_all_sizes_and_stops_when_empty():
+    task = ContributionReplay()
+
+    task.contribute_memoryscrolls()
+
+    assert task.contributions == 1
+    assert task.clicks == [
+        task.C_MS_MAX_S.name, task.C_MS_MAX_S.name,
+        task.C_MS_MAX_M.name, task.C_MS_MAX_M.name,
+        task.C_MS_MAX_L.name, task.C_MS_MAX_L.name,
+    ]
+
+
+@pytest.mark.parametrize('popup', [False, True])
+def test_stuck_inventory_and_reward_popup_are_bounded(popup):
+    task = ContributionReplay(stuck=True, popup=popup)
+
+    task.contribute_memoryscrolls()
+
+    assert task.contributions == 10
+    assert task.clicks.count(task.C_MS_CONTRIBUTED.name) == (100 if popup else 0)