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

Merge pull request #1224 from BluettDream/dev_richman

RichMan
huangrunheng 1 год назад
Родитель
Сommit
68656b70b0

+ 2 - 0
tasks/Component/Buy/assets.py

@@ -28,6 +28,8 @@ class BuyAssets:
 	I_BUY_SUB = RuleImage(roi_front=(467,429,50,48), roi_back=(452,412,85,147), threshold=0.8, method="Template matching", file="./tasks/Component/Buy/buy/buy_buy_sub.png")
 	# 出现用魂玉购买 
 	I_BUY_RMB = RuleImage(roi_front=(610,532,35,32), roi_back=(548,483,178,119), threshold=0.8, method="Template matching", file="./tasks/Component/Buy/buy/buy_buy_rmb.png")
+	# 购买成功 
+	I_BUY_SUCCESS = RuleImage(roi_front=(512,53,261,44), roi_back=(449,0,405,167), threshold=0.8, method="Template matching", file="./tasks/Component/Buy/buy/buy_buy_success.png")
 
 
 	# Ocr Rule Assets

+ 5 - 1
tasks/Component/Buy/buy.py

@@ -3,6 +3,7 @@
 # github https://github.com/runhey
 import time
 
+from tasks.GameUi.page import random_click
 from typing import Union
 
 from module.atom.image import RuleImage
@@ -53,6 +54,10 @@ class Buy(BaseTask, BuyAssets):
                         continue
                 return False
 
+            if self.appear(self.I_BUY_SUCCESS):
+                self.ui_click_until_smt_disappear(random_click(), self.I_BUY_SUCCESS, interval=0.8)
+                logger.info('Get reward success')
+                break
 
             if self.ui_reward_appear_click():
                 while 1:
@@ -71,7 +76,6 @@ class Buy(BaseTask, BuyAssets):
 
         return True
 
-
     def buy_more(self, start_click: Union[RuleImage, RuleOcr, RuleClick],
                  number: int = None):
         """

BIN
tasks/Component/Buy/buy/buy_buy_success.png


+ 9 - 0
tasks/Component/Buy/buy/image.json

@@ -34,5 +34,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "出现用魂玉购买"
+  },
+  {
+    "itemName": "buy_success",
+    "imageName": "buy_buy_success.png",
+    "roiFront": "512,53,261,44",
+    "roiBack": "449,0,405,167",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "购买成功"
   }
 ]

+ 2 - 4
tasks/RichMan/mall/medal.py

@@ -37,9 +37,8 @@ class Medal(FriendshipPoints):
                               money_ocr=self.O_MALL_RESOURCE_3, buy_money=120)
         # 随机御魂
         if con.random_soul:
-            pass
-            # self.buy_mall_one(buy_button=self.I_ME_SOULS, buy_check=self.I_ME_CHECK_SOULS,
-            #                   money_ocr=self.O_MALL_RESOURCE_5, buy_money=320)
+            self.buy_mall_one(buy_button=self.I_ME_SOULS, buy_check=self.I_ME_CHECK_SOULS,
+                              money_ocr=self.O_MALL_RESOURCE_5, buy_money=320)
         # 两颗白蛋
         if con.white_daruma:
             self.buy_mall_more(buy_button=self.I_ME_WHITE, remain_number=True, money_ocr=self.O_MALL_RESOURCE_3,
@@ -62,7 +61,6 @@ class Medal(FriendshipPoints):
         time.sleep(1)
 
 
-
 if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device

+ 0 - 11
tasks/RichMan/script_task.py

@@ -34,17 +34,6 @@ class ScriptTask(Mall, Guild, ThousandThings, Shrine):
         raise TaskEnd('RichMan')
 
 
-
-
-
-
-
-
-
-
-
-
-
 if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device