Преглед изворни кода

fix(Hunt): Improve kirin challenge flow and toppa record detection

Neptine пре 5 месеци
родитељ
комит
e51abc1e93

+ 2 - 0
tasks/Hunt/assets.py

@@ -29,6 +29,8 @@ class HuntAssets:
 	I_KIRIN_GATHER = RuleImage(roi_front=(28,480,75,64), roi_back=(28,480,75,64), threshold=0.8, method="Template matching", file="./tasks/Hunt/kirin/kirin_kirin_gather.png")
 	# 麒麟已挑战 
 	I_KIRIN_END = RuleImage(roi_front=(1126,601,104,44), roi_back=(1126,601,104,44), threshold=0.8, method="Template matching", file="./tasks/Hunt/kirin/kirin_kirin_end.png")
+	# 寮管理开启挑战 
+	I_KIRIN_START_CHALLAGE = RuleImage(roi_front=(1141,576,80,98), roi_back=(1092,545,172,166), threshold=0.7, method="Template matching", file="./tasks/Hunt/kirin/kirin_kirin_start_challage.png")
 
 
 	# Image Rule Assets

+ 9 - 0
tasks/Hunt/kirin/image.json

@@ -25,5 +25,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "麒麟已挑战"
+  },
+  {
+    "itemName": "kirin_start_challage",
+    "imageName": "kirin_kirin_start_challage.png",
+    "roiFront": "1141,576,80,98",
+    "roiBack": "1092,545,172,166",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "寮管理开启挑战"
   }
 ]

BIN
tasks/Hunt/kirin/kirin_kirin_start_challage.png


+ 4 - 1
tasks/Hunt/script_task.py

@@ -108,10 +108,13 @@ class ScriptTask(GameUi, GeneralBattle, GeneralInvite, SwitchSoul, HuntAssets):
             self.screenshot()
             if self.appear(self.I_PREPARE_HIGHLIGHT):
                 break
-            if self.appear_then_click(self.I_UI_CONFIRM, interval=0.9):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=0.9)\
+                    or self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=0.9):
                 continue
             if self.appear_then_click(self.I_KIRIN_CHALLAGE, interval=1.5):
                 continue
+            if self.appear_then_click(self.I_KIRIN_START_CHALLAGE, interval=2.5):
+                continue
             if self.appear(self.I_KIRIN_END):
                 # 今日已挑战
                 logger.warning('Today have already challenged the Kirin')

+ 1 - 1
tasks/RyouToppa/assets.py

@@ -103,7 +103,7 @@ class RyouToppaAssets:
 
 	# Image Rule Assets
 	# description 
-	I_TOPPA_RECORD = RuleImage(roi_front=(66,628,64,39), roi_back=(66,628,64,39), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/dev/res_toppa_record.png")
+	I_TOPPA_RECORD = RuleImage(roi_front=(66,633,64,39), roi_back=(40,606,119,89), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/dev/res_toppa_record.png")
 	# description 
 	I_TOPPA_LOCK_TEAM = RuleImage(roi_front=(203,602,26,32), roi_back=(203,602,26,32), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/dev/dev_toppa_lock_team.png")
 	# description 

+ 2 - 2
tasks/RyouToppa/dev/image.json

@@ -2,8 +2,8 @@
   {
     "itemName": "toppa_record",
     "imageName": "res_toppa_record.png",
-    "roiFront": "66,628,64,39",
-    "roiBack": "66,628,64,39",
+    "roiFront": "66,633,64,39",
+    "roiBack": "40,606,119,89",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"

+ 3 - 0
tasks/RyouToppa/script_task.py

@@ -159,6 +159,9 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RyouToppaAssets):
         area_index = 0
         success = True
         while 1:
+            self.screenshot()
+            if not self.appear(self.I_TOPPA_RECORD, threshold=0.6):
+                continue
             # 设置长任务标志,用来寻找寮突可进攻的目标
             self.device.stuck_record_add('PREPARE_BEFORE_BATTLE')
             if not self.has_ticket():