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

Merge remote-tracking branch 'origin/dev' into dev

runhey 3 лет назад
Родитель
Сommit
883cfe0665

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

@@ -103,6 +103,10 @@ class GeneralBattleAssets:
 	I_EXIT_ENSURE = RuleImage(roi_front=(674,388,135,63), roi_back=(674,388,135,63), 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")
+	# 结算时左下角统计图标 
+	I_REWARD_STATISTICS = RuleImage(roi_front=(51,629,54,59), roi_back=(51,629,54,59), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward_statistics.png")
+	# 结算金币 
+	I_REWARD_GOLD = RuleImage(roi_front=(943,312,97,69), roi_back=(943,312,97,69), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_reward_gold.png")
 
 
 	# Image Rule Assets

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


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


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

@@ -169,5 +169,23 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "左上角好友图标"
+  },
+  {
+    "itemName": "reward_statistics",
+    "imageName": "gb_reward_statistics.png",
+    "roiFront": "51,629,54,59",
+    "roiBack": "51,629,54,59",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "结算时左下角统计图标"
+  },
+  {
+    "itemName": "reward_gold",
+    "imageName": "gb_reward_gold.png",
+    "roiFront": "943,312,97,69",
+    "roiBack": "943,312,97,69",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "结算金币"
   }
 ]

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

@@ -174,6 +174,11 @@ class GeneralBattle(BaseTask, GeneralBattleAssets):
             if self.appear(self.I_REWARD, threshold=0.6):
                 win = True
                 break
+
+            # 如果领奖励出现金币
+            if self.appear(self.I_REWARD_GOLD, threshold=0.8):
+                win = True
+                break
             # 如果开启战斗过程随机滑动
             if random_click_swipt_enable:
                 self.random_click_swipt()
@@ -203,9 +208,10 @@ class GeneralBattle(BaseTask, GeneralBattleAssets):
             self.screenshot()
             # 如果出现领奖励
             action_click = random.choice([self.C_REWARD_1, self.C_REWARD_2, self.C_REWARD_3])
-            if self.appear_then_click(self.I_REWARD, action=action_click ,interval=1.5):
+            if self.appear_then_click(self.I_REWARD, action=action_click ,interval=1.5) or \
+                    self.appear_then_click(self.I_REWARD_GOLD, action=action_click ,interval=1.5):
                 continue
-            if not self.appear(self.I_REWARD):
+            if not self.appear(self.I_REWARD) and not self.appear(self.I_REWARD_GOLD):
                 break
 
         return win