Explorar o código

fix(task): Support celeb PVP in duel

runhey %!s(int64=3) %!d(string=hai) anos
pai
achega
d6b445a5d6

+ 5 - 1
tasks/Duel/assets.py

@@ -33,7 +33,7 @@ class DuelAssets:
 	# 手动,弃用 
 	I_D_HAND = RuleImage(roi_front=(34,635,55,55), roi_back=(34,635,55,55), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_hand.png")
 	# 主界面的感叹号 
-	I_D_HELP = RuleImage(roi_front=(715,436,32,30), roi_back=(715,436,32,30), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_help.png")
+	I_D_HELP = RuleImage(roi_front=(719,434,32,30), roi_back=(708,397,49,78), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_help.png")
 	# 准备 
 	I_D_PREPARE = RuleImage(roi_front=(1127,541,100,100), roi_back=(1127,541,100,100), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_prepare.png")
 	# 准备完毕 
@@ -46,6 +46,10 @@ class DuelAssets:
 	I_D_FAIL = RuleImage(roi_front=(422,66,100,100), roi_back=(422,66,100,100), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_fail.png")
 	# 战 
 	I_D_WORD_BATTLE = RuleImage(roi_front=(612,41,54,54), roi_back=(612,41,54,54), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_word_battle.png")
+	# 名士的星星 
+	I_D_CELEB_STAR = RuleImage(roi_front=(586,456,30,32), roi_back=(574,444,53,54), threshold=0.75, method="Template matching", file="./tasks/Duel/duel/duel_d_celeb_star.png")
+	# 名士专属 
+	I_D_CELEB_HONOR = RuleImage(roi_front=(665,531,25,30), roi_back=(652,517,52,53), threshold=0.75, method="Template matching", file="./tasks/Duel/duel/duel_d_celeb_honor.png")
 
 
 	# Ocr Rule Assets

BIN=BIN
tasks/Duel/duel/duel_d_celeb_honor.png


BIN=BIN
tasks/Duel/duel/duel_d_celeb_star.png


+ 20 - 2
tasks/Duel/duel/image.json

@@ -74,8 +74,8 @@
   {
     "itemName": "d_help",
     "imageName": "duel_d_help.png",
-    "roiFront": "715,436,32,30",
-    "roiBack": "715,436,32,30",
+    "roiFront": "719,434,32,30",
+    "roiBack": "708,397,49,78",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "主界面的感叹号"
@@ -133,5 +133,23 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "战"
+  },
+  {
+    "itemName": "d_celeb_star",
+    "imageName": "duel_d_celeb_star.png",
+    "roiFront": "586,456,30,32",
+    "roiBack": "574,444,53,54",
+    "method": "Template matching",
+    "threshold": 0.75,
+    "description": "名士的星星"
+  },
+  {
+    "itemName": "d_celeb_honor",
+    "imageName": "duel_d_celeb_honor.png",
+    "roiFront": "665,531,25,30",
+    "roiBack": "652,517,52,53",
+    "method": "Template matching",
+    "threshold": 0.75,
+    "description": "名士专属"
   }
 ]

+ 3 - 0
tasks/Duel/script_task.py

@@ -101,6 +101,9 @@ class ScriptTask(GameUi, GeneralBattle, DuelAssets):
         """
         while 1:
             self.screenshot()
+            if self.appear(self.I_D_CELEB_STAR) or self.appear(self.I_D_CELEB_HONOR):
+                logger.info('You are already a celeb')
+                return None
             current_score = self.O_D_SCORE.ocr(self.device.image)
             if current_score < 1200 or current_score > 3000:
                 continue