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

fix(GeneralBattle): Improve reward detail popup detection
- add a third reward detail popup template and update template regions
- raise matching thresholds for reward popup assets
- retry closing detected popups before completing reward collection

neptine 2 месяцев назад
Родитель
Сommit
eff4872725

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

@@ -243,8 +243,9 @@ class GeneralBattleAssets:
 
 	# Image Rule Assets
 	# description 
-	I_END_FIX_1 = RuleImage(roi_front=(896,251,218,64), roi_back=(119,66,1136,620), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_1.png")
+	I_END_FIX_1 = RuleImage(roi_front=(721,119,89,58), roi_back=(119,66,1136,620), threshold=0.85, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_1.png")
 	# description 
-	I_END_FIX_2 = RuleImage(roi_front=(800,251,100,33), roi_back=(32,90,1137,547), threshold=0.7, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_2.png")
-
+	I_END_FIX_2 = RuleImage(roi_front=(800,251,100,33), roi_back=(32,90,1137,547), threshold=0.85, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_2.png")
+	#
+	I_END_FIX_3 = RuleImage(roi_front=(871,278,150,49), roi_back=(119,66,1136,620), threshold=0.85, method="Template matching", file="./tasks/Component/GeneralBattle/gw/gw_end_fix_3.png")
 

+ 3 - 3
tasks/Component/GeneralBattle/battle_wait.py

@@ -520,8 +520,8 @@ class BattleWait(BaseTask, GeneralBattleAssets):
             self.screenshot()
 
             # 不小心点到了具体的奖励,他会弹出这个物品的详细描述 里面必定包含有“获取途径”
-            if self.appear(self.I_END_FIX_1) or self.appear(self.I_END_FIX_2):
-                self.click(self.C_REWARD_2, interval=1.5)
+            if self.appear(self.I_END_FIX_1) or self.appear(self.I_END_FIX_2) or self.appear(self.I_END_FIX_3):
+                self.click(self.C_REWARD_2, interval=2.5)
                 continue
 
             if self.appear(self.I_UI_REWARD):
@@ -533,7 +533,7 @@ class BattleWait(BaseTask, GeneralBattleAssets):
                 self.click(self.exclude_click_activity, interval=1.5)
             elif not self.appear(self.I_END_FIX_2):
                 self.screenshot()
-                if self.appear(self.I_UI_REWARD) or self.appear(self.I_END_FIX_2):
+                if any([self.appear(self.I_UI_REWARD), self.appear(self.I_END_FIX_1), self.appear(self.I_END_FIX_2), self.appear(self.I_END_FIX_3)]):
                     continue
                 logger.info('Get all reward')
                 bw_ctx.success = True

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


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


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

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