浏览代码

feat(rich man): add medal store

runhey 3 年之前
父节点
当前提交
097dd61c8c

+ 36 - 0
tasks/RichMan/assets.py

@@ -67,6 +67,15 @@ class RichManAssets:
 	O_BL_CHECK_MONEY = RuleOcr(roi=(1123,12,127,33), area=(1123,12,127,33), mode="DigitCounter", method="Default", keyword="", name="bl_check_money")
 
 
+	# Image Rule Assets
+	# 蓝票 
+	I_CH_BLUE = RuleImage(roi_front=(623,142,145,111), roi_back=(161,112,844,462), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/charisma/charisma_ch_blue.png")
+	# description 
+	I_CH_BLACK = RuleImage(roi_front=(848,393,141,110), roi_back=(137,94,895,486), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/charisma/charisma_ch_black.png")
+	# 蓝票购买确认 
+	I_CH_CHECK_BLUE = RuleImage(roi_front=(451,230,100,100), roi_back=(451,230,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/charisma/charisma_ch_check_blue.png")
+
+
 	# Image Rule Assets
 	# 进入寄售屋 
 	I_CON_ENTER_CHECK = RuleImage(roi_front=(660,485,393,100), roi_back=(660,485,393,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/consignment/consignment_con_enter_check.png")
@@ -110,6 +119,33 @@ class RichManAssets:
 	O_HONOR_WHITE = RuleOcr(roi=(527,359,25,28), area=(527,359,25,28), mode="Digit", method="Default", keyword="", name="honor_white")
 
 
+	# Image Rule Assets
+	# 黑蛋 
+	I_ME_BLACK = RuleImage(roi_front=(631,152,130,120), roi_back=(165,121,859,431), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_black.png")
+	# 蓝票 
+	I_ME_BLUE = RuleImage(roi_front=(176,148,138,126), roi_back=(139,115,887,464), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_blue.png")
+	# 体力 
+	I_ME_AP = RuleImage(roi_front=(842,395,145,123), roi_back=(156,111,862,454), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_ap.png")
+	# 随机御魂 
+	I_ME_SOULS = RuleImage(roi_front=(173,391,148,133), roi_back=(121,116,898,476), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_souls.png")
+	# 白蛋 
+	I_ME_WHITE = RuleImage(roi_front=(399,391,142,131), roi_back=(115,114,908,452), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_white.png")
+	# 御灵挑战券 
+	I_ME_CHALLENGE_PASS = RuleImage(roi_front=(618,390,146,129), roi_back=(114,102,914,478), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_challenge_pass.png")
+	# 红蛋 
+	I_ME_RED = RuleImage(roi_front=(847,146,137,129), roi_back=(141,129,864,454), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_red.png")
+	# 破碎的咒符 
+	I_ME_BROKEN = RuleImage(roi_front=(398,144,143,116), roi_back=(146,116,866,475), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_broken.png")
+	# 购买检查 
+	I_ME_CHECK_BLACK = RuleImage(roi_front=(452,231,100,100), roi_back=(452,231,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_black.png")
+	# 购买检查 
+	I_ME_CHECK_BLUE = RuleImage(roi_front=(448,232,100,100), roi_back=(448,232,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_blue.png")
+	# 购买检查 
+	I_ME_CHECK_AP = RuleImage(roi_front=(453,227,100,100), roi_back=(453,227,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_ap.png")
+	# 购买检查 
+	I_ME_CHECK_SOULS = RuleImage(roi_front=(453,235,100,100), roi_back=(453,235,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_souls.png")
+
+
 	# Image Rule Assets
 	# 寄售屋 
 	I_MALL_CONSIGNMENT = RuleImage(roi_front=(192,629,63,72), roi_back=(192,629,63,72), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_consignment.png")

二进制
tasks/RichMan/mall/charisma/charisma_ch_black.png


二进制
tasks/RichMan/mall/charisma/charisma_ch_blue.png


二进制
tasks/RichMan/mall/charisma/charisma_ch_check_blue.png


+ 29 - 0
tasks/RichMan/mall/charisma/image.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "ch_blue",
+    "imageName": "charisma_ch_blue.png",
+    "roiFront": "623,142,145,111",
+    "roiBack": "161,112,844,462",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "蓝票"
+  },
+  {
+    "itemName": "ch_black",
+    "imageName": "charisma_ch_black.png",
+    "roiFront": "848,393,141,110",
+    "roiBack": "137,94,895,486",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "ch_check_blue",
+    "imageName": "charisma_ch_check_blue.png",
+    "roiFront": "451,230,100,100",
+    "roiBack": "451,230,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "蓝票购买确认"
+  }
+]

+ 0 - 1
tasks/RichMan/mall/friendship_points.py

@@ -26,7 +26,6 @@ class FriendshipPoints(Special):
             self.buy_mall_one(buy_button=self.I_FS_WHITE_CLICK, buy_check=self.I_FS_WHITE_CHECK,
                               money_ocr=self.O_MALL_RESOURCE_5, buy_money=1000)
         if con.red_daruma != 0:
-            logger.warning('进入')
             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)
         if con.broken_amulet != 0:

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

@@ -10,12 +10,56 @@ from tasks.GameUi.game_ui import GameUi
 from tasks.Component.Buy.buy import Buy
 from tasks.RichMan.assets import RichManAssets
 from tasks.RichMan.config import MedalRoom
+from tasks.RichMan.mall.friendship_points import FriendshipPoints
 
 
-class Medal(GameUi, Buy, RichManAssets):
+class Medal(FriendshipPoints):
 
     def execute_medal(self, con: MedalRoom = None):
-        pass
+        if not con:
+            con = self.config.rich_man.medal_room
+        if not con.enable:
+            logger.info('Medal is not enable')
+            return
+        self._enter_medal()
+
+        # 黑蛋
+        if con.black_daruma:
+            self.buy_mall_one(buy_button=self.I_ME_BLACK, buy_check=self.I_ME_CHECK_BLACK,
+                              money_ocr=self.O_MALL_RESOURCE_5, buy_money=480)
+        # 蓝票
+        if con.mystery_amulet:
+            self.buy_mall_one(buy_button=self.I_ME_BLUE, buy_check=self.I_ME_CHECK_BLUE,
+                              money_ocr=self.O_MALL_RESOURCE_5, buy_money=180)
+        # 体力100
+        if con.ap_100:
+            self.buy_mall_one(buy_button=self.I_ME_AP, buy_check=self.I_ME_CHECK_AP,
+                              money_ocr=self.O_MALL_RESOURCE_5, buy_money=120)
+        # 随机御魂
+        if con.random_soul:
+            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_5,
+                               buy_number=2, buy_max=2, buy_money=100)
+        # 十张挑战券
+        if con.challenge_pass:
+            self.buy_mall_more(buy_button=self.I_ME_CHALLENGE_PASS, remain_number=True, money_ocr=self.O_MALL_RESOURCE_5,
+                               buy_number=con.challenge_pass, buy_max=10, buy_money=30)
+        # 红蛋
+        if con.red_daruma:
+            self.buy_mall_more(buy_button=self.I_ME_RED, remain_number=False,
+                               money_ocr=self.O_MALL_RESOURCE_5,
+                               buy_number=con.red_daruma, buy_max=99, buy_money=30)
+        # 破碎的咒符
+        if con.broken_amulet:
+            self.buy_mall_more(buy_button=self.I_ME_BROKEN, remain_number=False,
+                               money_ocr=self.O_MALL_RESOURCE_5,
+                               buy_number=con.broken_amulet, buy_max=99, buy_money=20)
+
+        time.sleep(1)
+
 
 
 if __name__ == '__main__':

+ 110 - 0
tasks/RichMan/mall/medal/image.json

@@ -0,0 +1,110 @@
+[
+  {
+    "itemName": "me_black",
+    "imageName": "medal_me_black.png",
+    "roiFront": "631,152,130,120",
+    "roiBack": "165,121,859,431",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "黑蛋"
+  },
+  {
+    "itemName": "me_blue",
+    "imageName": "medal_me_blue.png",
+    "roiFront": "176,148,138,126",
+    "roiBack": "139,115,887,464",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "蓝票"
+  },
+  {
+    "itemName": "me_ap",
+    "imageName": "medal_me_ap.png",
+    "roiFront": "842,395,145,123",
+    "roiBack": "156,111,862,454",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "体力"
+  },
+  {
+    "itemName": "me_souls",
+    "imageName": "medal_me_souls.png",
+    "roiFront": "173,391,148,133",
+    "roiBack": "121,116,898,476",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "随机御魂"
+  },
+  {
+    "itemName": "me_white",
+    "imageName": "medal_me_white.png",
+    "roiFront": "399,391,142,131",
+    "roiBack": "115,114,908,452",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "白蛋"
+  },
+  {
+    "itemName": "me_challenge_pass",
+    "imageName": "medal_me_challenge_pass.png",
+    "roiFront": "618,390,146,129",
+    "roiBack": "114,102,914,478",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "御灵挑战券"
+  },
+  {
+    "itemName": "me_red",
+    "imageName": "medal_me_red.png",
+    "roiFront": "847,146,137,129",
+    "roiBack": "141,129,864,454",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "红蛋"
+  },
+  {
+    "itemName": "me_broken",
+    "imageName": "medal_me_broken.png",
+    "roiFront": "398,144,143,116",
+    "roiBack": "146,116,866,475",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "破碎的咒符"
+  },
+  {
+    "itemName": "me_check_black",
+    "imageName": "medal_me_check_black.png",
+    "roiFront": "452,231,100,100",
+    "roiBack": "452,231,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "购买检查"
+  },
+  {
+    "itemName": "me_check_blue",
+    "imageName": "medal_me_check_blue.png",
+    "roiFront": "448,232,100,100",
+    "roiBack": "448,232,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "购买检查"
+  },
+  {
+    "itemName": "me_check_ap",
+    "imageName": "medal_me_check_ap.png",
+    "roiFront": "453,227,100,100",
+    "roiBack": "453,227,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "购买检查"
+  },
+  {
+    "itemName": "me_check_souls",
+    "imageName": "medal_me_check_souls.png",
+    "roiFront": "453,235,100,100",
+    "roiBack": "453,235,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "购买检查"
+  }
+]

二进制
tasks/RichMan/mall/medal/medal_me_ap.png


二进制
tasks/RichMan/mall/medal/medal_me_black.png


二进制
tasks/RichMan/mall/medal/medal_me_blue.png


二进制
tasks/RichMan/mall/medal/medal_me_broken.png


二进制
tasks/RichMan/mall/medal/medal_me_challenge_pass.png


二进制
tasks/RichMan/mall/medal/medal_me_check_ap.png


二进制
tasks/RichMan/mall/medal/medal_me_check_black.png


二进制
tasks/RichMan/mall/medal/medal_me_check_blue.png


二进制
tasks/RichMan/mall/medal/medal_me_check_souls.png


二进制
tasks/RichMan/mall/medal/medal_me_red.png


二进制
tasks/RichMan/mall/medal/medal_me_souls.png


二进制
tasks/RichMan/mall/medal/medal_me_white.png