Explorar el Código

fix(WantedQuests): Adaptation exploration

ryland hace 2 años
padre
commit
e424b54c06

+ 3 - 3
dev_tools/assets_test.py

@@ -34,10 +34,10 @@ def detect_ocr(file: str, target: RuleOcr):
 
 
 # 图片文件路径 可以是相对路径
-IMAGE_FILE = r"C:\Users\萌萌哒\Desktop\379738421-b29c0114-7f25-4d89-a32a-20f06cd4b77c.png"
+IMAGE_FILE = r"D:\Project\OnmyojiAutoScript\log\error\1731668941132\2024-11-15_19-09-00-887294.png"
 if __name__ == '__main__':
-    from tasks.Duel.assets import DuelAssets
-    targe = DuelAssets.I_D_TEAM
+    from tasks.WantedQuests.assets import WantedQuestsAssets
+    targe = WantedQuestsAssets.I_WQ_BOX
     print(detect_image(IMAGE_FILE, targe))
 
     # ocr demo

+ 4 - 0
tasks/WantedQuests/assets.py

@@ -157,5 +157,9 @@ class WantedQuestsAssets:
 	# Image Rule Assets
 	# 奇怪了之前的不能用 
 	I_WQSE_FIRE = RuleImage(roi_front=(1041,556,100,100), roi_back=(1016,534,147,138), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/wq/wq_wqse_fire.png")
+	# 妖气封印 
+	I_WQ_D1111 = RuleImage(roi_front=(20,171,99,105), roi_back=(6,148,150,299), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/wq/wq_wq_d1111.png")
+	# 年兽 
+	I_WQ_NIAN = RuleImage(roi_front=(19,176,100,100), roi_back=(0,153,166,273), threshold=0.8, method="Template matching", file="./tasks/WantedQuests/wq/wq_wq_nian.png")
 
 

+ 9 - 0
tasks/WantedQuests/script_task.py

@@ -58,6 +58,9 @@ class ScriptTask(WQExplore, SecretScriptTask, WantedQuestsAssets):
             if self.appear(self.I_WQ_BOX):
                 self.ui_get_reward(self.I_WQ_BOX)
                 continue
+            if self.appear(self.I_TREASURE_BOX_CLICK):
+                self.ui_get_reward(self.I_TREASURE_BOX_CLICK)
+                continue
             if ocr_error_count > 10:
                 logger.warning('OCR failed too many times, exit')
                 break
@@ -92,6 +95,12 @@ class ScriptTask(WQExplore, SecretScriptTask, WantedQuestsAssets):
                     self.execute_mission(self.O_WQ_TEXT_2, min(total, 20), number_challenge)
                 continue
 
+            # 妖气封印或者年兽,那就四分钟后继续
+            if self.appear(self.I_WQ_D1111) or self.appear(self.I_WQ_NIAN):
+                logger.warning('Tiger is in the way, wait for 4 minutes')
+                logger.info('Time to wait for 4 minutes')
+                self.set_next_run('WantedQuests', target=datetime.now() + timedelta(minutes=4))
+                raise TaskEnd('WantedQuests')
             if self.appear(self.I_WQ_CHECK_TASK):
                 continue
             sleep(1.5)

+ 18 - 0
tasks/WantedQuests/wq/se_image.json

@@ -7,5 +7,23 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "奇怪了之前的不能用"
+  },
+  {
+    "itemName": "wq_d1111",
+    "imageName": "wq_wq_d1111.png",
+    "roiFront": "20,171,99,105",
+    "roiBack": "6,148,150,299",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "妖气封印"
+  },
+  {
+    "itemName": "wq_nian",
+    "imageName": "wq_wq_nian.png",
+    "roiFront": "19,176,100,100",
+    "roiBack": "0,153,166,273",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "年兽"
   }
 ]

BIN
tasks/WantedQuests/wq/wq_wq_d1111.png


BIN
tasks/WantedQuests/wq/wq_wq_nian.png