Kaynağa Gözat

fix(RichMan): Nothing to say

huangrunheng 1 yıl önce
ebeveyn
işleme
a655c6a549

+ 3 - 9
tasks/Component/Buy/buy.py

@@ -171,15 +171,9 @@ class Buy(BaseTask, BuyAssets):
             logger.error('Target is not RuleOcr')
             return False
         current = target.ocr(self.device.image)
-        if '万' in current:
-            logger.info('Money is enough')
-            return True
-            # 使用正则表达式提取字符串中的数字
-        else:
-            current = int(current)
-        # if not isinstance(current, int):
-        #     logger.warning('OCR current money failed')
-        #     return False
+        if not isinstance(current, int):
+            logger.warning('OCR current money failed')
+            return False
         if current >= minimum:
             logger.info('Money is enough')
             return True

+ 4 - 1
tasks/DailyTrifles/assets.py

@@ -1,6 +1,9 @@
 from module.atom.image import RuleImage
+from module.atom.click import RuleClick
+from module.atom.long_click import RuleLongClick
+from module.atom.swipe import RuleSwipe
 from module.atom.ocr import RuleOcr
-
+from module.atom.list import RuleList
 
 # This file was automatically generated by ./dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 7 - 7
tasks/RichMan/assets.py

@@ -31,7 +31,7 @@ class RichManAssets:
 
 	# Ocr Rule Assets
 	# 总的功勋 
-	O_GUILD_TOTAL = RuleOcr(roi=(942,16,94,27), area=(942,16,94,27), mode="Single", method="Default", keyword="", name="guild_total")
+	O_GUILD_TOTAL = RuleOcr(roi=(942,16,94,27), area=(942,16,94,27), mode="Quantity", method="Default", keyword="", name="guild_total")
 	# Ocr-description 
 	O_GUILD_NUMBER_BLUE = RuleOcr(roi=(888,269,25,33), area=(888,269,25,33), mode="Digit", method="Default", keyword="", name="guild_number_blue")
 	# Ocr-description 
@@ -198,17 +198,17 @@ class RichManAssets:
 
 	# Ocr Rule Assets
 	# 左数第一个 
-	O_MALL_RESOURCE_1 = RuleOcr(roi=(144,7,100,43), area=(144,7,100,43), mode="Digit", method="Default", keyword="", name="mall_resource_1")
+	O_MALL_RESOURCE_1 = RuleOcr(roi=(144,7,100,43), area=(144,7,100,43), mode="Quantity", method="Default", keyword="", name="mall_resource_1")
 	# 左数第二个 
-	O_MALL_RESOURCE_2 = RuleOcr(roi=(326,8,124,39), area=(326,8,124,39), mode="Digit", method="Default", keyword="", name="mall_resource_2")
+	O_MALL_RESOURCE_2 = RuleOcr(roi=(326,8,124,39), area=(326,8,124,39), mode="Quantity", method="Default", keyword="", name="mall_resource_2")
 	# 左数第二个 
-	O_MALL_RESOURCE_3 = RuleOcr(roi=(533,9,107,38), area=(533,9,107,38), mode="Digit", method="Default", keyword="", name="mall_resource_3")
+	O_MALL_RESOURCE_3 = RuleOcr(roi=(533,9,107,38), area=(533,9,107,38), mode="Quantity", method="Default", keyword="", name="mall_resource_3")
 	# 左数第二个 
-	O_MALL_RESOURCE_4 = RuleOcr(roi=(739,8,100,39), area=(739,8,100,39), mode="Digit", method="Default", keyword="", name="mall_resource_4")
+	O_MALL_RESOURCE_4 = RuleOcr(roi=(739,8,100,39), area=(739,8,100,39), mode="Quantity", method="Default", keyword="", name="mall_resource_4")
 	# 左数第二个 
-	O_MALL_RESOURCE_5 = RuleOcr(roi=(935,11,100,37), area=(935,11,100,37), mode="Digit", method="Default", keyword="", name="mall_resource_5")
+	O_MALL_RESOURCE_5 = RuleOcr(roi=(935,11,100,37), area=(935,11,100,37), mode="Quantity", method="Default", keyword="", name="mall_resource_5")
 	# 左数第二个 
-	O_MALL_RESOURCE_6 = RuleOcr(roi=(1129,6,100,41), area=(1129,6,100,41), mode="Digit", method="Default", keyword="", name="mall_resource_6")
+	O_MALL_RESOURCE_6 = RuleOcr(roi=(1129,6,100,41), area=(1129,6,100,41), mode="Quantity", method="Default", keyword="", name="mall_resource_6")
 
 
 	# Click Rule Assets

+ 1 - 1
tasks/RichMan/guild/ocr.json

@@ -3,7 +3,7 @@
     "itemName": "guild_total",
     "roiFront": "942,16,94,27",
     "roiBack": "942,16,94,27",
-    "mode": "Single",
+    "mode": "Quantity",
     "method": "Default",
     "keyword": "",
     "description": "总的功勋"

+ 6 - 6
tasks/RichMan/mall/bondlings.py

@@ -55,12 +55,12 @@ class Bondlings(Buy, MallNavbar):
             return
         self.screenshot()
 
-        if buy_button.name == 'BONDLINGS_BL_BUY_SOULS':
-            if self.appear(self.I_ME_SOULS_NEW):
-                # 契灵御魂已经买光
-                logger.warning('本周契灵御魂已经买光')
-                return
-        pos = self.O_BL_RES_SOULS_new.ocr_full(self.device.image)
+        # if buy_button.name == 'BONDLINGS_BL_BUY_SOULS':
+        #     if self.appear(self.I_ME_SOULS_NEW):
+        #         # 契灵御魂已经买光
+        #         logger.warning('本周契灵御魂已经买光')
+        #         return
+        # pos = self.O_BL_RES_SOULS_new.ocr_full(self.device.image)
 
         # 检查是否出现了购买按钮
         if not self.appear(buy_button):

+ 9 - 21
tasks/RichMan/mall/friendship_points.py

@@ -27,10 +27,10 @@ class FriendshipPoints(Special):
                               money_ocr=self.O_MALL_RESOURCE_5, buy_money=1000)
         if con.red_daruma != 0:
             self.buy_mall_more(buy_button=self.I_FS_RED, remain_number=False, money_ocr=self.O_MALL_RESOURCE_5,
-                                 buy_number=con.red_daruma, buy_max=99, buy_money=150)
+                               buy_number=con.red_daruma, buy_max=99, buy_money=150)
         if con.broken_amulet != 0:
             self.buy_mall_more(buy_button=self.I_FS_BROKEN, remain_number=False, money_ocr=self.O_MALL_RESOURCE_5,
-                                 buy_number=con.broken_amulet, buy_max=99, buy_money=100)
+                               buy_number=con.broken_amulet, buy_max=99, buy_money=100)
 
     def buy_mall_one(self, buy_button: RuleImage, buy_check: RuleImage, money_ocr: RuleOcr, buy_money: int):
         """
@@ -54,14 +54,9 @@ class FriendshipPoints(Special):
             return False
         # 检查总勋章
         current_money = money_ocr.ocr(self.device.image)
-        if '万' in current_money:
-            # 点击购买
-            return self.buy_one(buy_button, buy_check)
-        else:
-            current_money = int(current_money)
-        # if not isinstance(current_money, int):
-        #     logger.warning('Money ocr failed')
-        #     return False
+        if not isinstance(current_money, int):
+            logger.warning('Money ocr failed')
+            return False
         money_enough = current_money >= buy_money
         if not money_enough:
             logger.warning(f'No enough money {current_money}')
@@ -70,7 +65,7 @@ class FriendshipPoints(Special):
         return self.buy_one(buy_button, buy_check)
 
     def buy_mall_more(self, buy_button: RuleImage, remain_number: bool, money_ocr: RuleOcr,
-                       buy_number: int, buy_max: int, buy_money: int):
+                      buy_number: int, buy_max: int, buy_money: int):
         """
         针对可以买多个的
         :param money_ocr:  检查钱的第几个
@@ -101,16 +96,9 @@ class FriendshipPoints(Special):
                 buy_number = _remain
         # 检查钱够不够
         current_money = money_ocr.ocr(self.device.image)
-        if '万' in current_money:
-            # 使用正则表达式提取字符串中的数字
-            match = re.search(r'\d+', current_money)
-            if match:
-                current_money = int(match.group()) * 10000
-        else:
-            current_money = int(current_money)
-        # if not isinstance(current_money, int):
-        #     logger.warning('Money ocr failed')
-        #     return
+        if not isinstance(current_money, int):
+            logger.warning('Money ocr failed')
+            return
         money_enough = current_money >= buy_money * buy_number
         if not money_enough:
             logger.warning(f'Money is not enough {current_money}')

+ 2 - 2
tasks/RichMan/mall/navbar.py

@@ -107,8 +107,8 @@ class MallNavbar(GameUi, RichManAssets):
         }
         self.screenshot()
         result = match[index].ocr(self.device.image)
-        match = re.search(r'\d+', result)
-        result = int(match.group())
+        # match = re.search(r'\d+', result)
+        # result = int(match.group())
         if not isinstance(result, int):
             logger.warning(f'Get mall resource {index} error, result: {result}')
         if result == 0:

+ 6 - 6
tasks/RichMan/mall/navbar/ocr.json

@@ -3,7 +3,7 @@
     "itemName": "mall_resource_1",
     "roiFront": "144,7,100,43",
     "roiBack": "144,7,100,43",
-    "mode": "Digit",
+    "mode": "Quantity",
     "method": "Default",
     "keyword": "",
     "description": "左数第一个"
@@ -12,7 +12,7 @@
     "itemName": "mall_resource_2",
     "roiFront": "326,8,124,39",
     "roiBack": "326,8,124,39",
-    "mode": "Digit",
+    "mode": "Quantity",
     "method": "Default",
     "keyword": "",
     "description": "左数第二个"
@@ -21,7 +21,7 @@
     "itemName": "mall_resource_3",
     "roiFront": "533,9,107,38",
     "roiBack": "533,9,107,38",
-    "mode": "Digit",
+    "mode": "Quantity",
     "method": "Default",
     "keyword": "",
     "description": "左数第二个"
@@ -30,7 +30,7 @@
     "itemName": "mall_resource_4",
     "roiFront": "739,8,100,39",
     "roiBack": "739,8,100,39",
-    "mode": "Digit",
+    "mode": "Quantity",
     "method": "Default",
     "keyword": "",
     "description": "左数第二个"
@@ -39,7 +39,7 @@
     "itemName": "mall_resource_5",
     "roiFront": "935,11,100,37",
     "roiBack": "935,11,100,37",
-    "mode": "Digit",
+    "mode": "Quantity",
     "method": "Default",
     "keyword": "",
     "description": "左数第二个"
@@ -48,7 +48,7 @@
     "itemName": "mall_resource_6",
     "roiFront": "1129,6,100,41",
     "roiBack": "1129,6,100,41",
-    "mode": "Digit",
+    "mode": "Quantity",
     "method": "Default",
     "keyword": "",
     "description": "左数第二个"

+ 2 - 2
tasks/RichMan/script_task.py

@@ -52,8 +52,8 @@ if __name__ == '__main__':
     d = Device(c)
     t = ScriptTask(c, d)
 
-    # t.run()
-    t.execute_mall()
+    t.run()
+    # t.execute_mall()