Explorar el Código

perf(task): update secret

runhey hace 3 años
padre
commit
38c95dae83
Se han modificado 3 ficheros con 17 adiciones y 2 borrados
  1. 2 0
      tasks/Secret/assets.py
  2. 6 2
      tasks/Secret/script_task.py
  3. 9 0
      tasks/Secret/se/ocr.json

+ 2 - 0
tasks/Secret/assets.py

@@ -47,6 +47,8 @@ class SecretAssets:
 	O_SE_NO_PASS_LAST = RuleOcr(roi=(429,381,180,234), area=(429,381,180,234), mode="Full", method="Default", keyword="未通关", name="se_no_pass_last")
 	# 勾玉 
 	O_SE_JADE = RuleOcr(roi=(327,230,23,24), area=(327,230,23,24), mode="Digit", method="Default", keyword="", name="se_jade")
+	# 金币 
+	O_SE_GOLD = RuleOcr(roi=(363,226,48,21), area=(363,226,48,21), mode="Digit", method="Default", keyword="", name="se_gold")
 
 
 	# Swipe Rule Assets

+ 6 - 2
tasks/Secret/script_task.py

@@ -163,7 +163,7 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, SecretAssets):
             :param roi:
             :return:
             """
-            ocr_target.roi[0] = int(roi[0]) - 115
+            ocr_target.roi[0] = int(roi[0]) - 118
             ocr_target.roi[1] = int(roi[1]) + 37
             print(f'检测到的未通过ROI: {roi}')
             print(f'检测到的勾玉数量ROI: {ocr_target.roi}')
@@ -175,7 +175,11 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, SecretAssets):
                 logger.warning(f'OCR failed, try again {jade_num}')
                 return None
             if jade_num < 7:
-                logger.warning(f'OCR failed, try again {jade_num}')
+                # 第一个的时候可能是没有检测到
+                gold_number = self.O_SE_GOLD.ocr(self.device.image)
+                if isinstance(gold_number, int) and gold_number == 10000:
+                    logger.info(f'No find jade number, but find gold number {gold_number}')
+                    return 1
                 return None
             elif jade_num > 70:
                 logger.warning(f'OCR failed, try again {jade_num}')

+ 9 - 0
tasks/Secret/se/ocr.json

@@ -61,5 +61,14 @@
     "method": "Default",
     "keyword": "",
     "description": "勾玉"
+  },
+  {
+    "itemName": "se_gold",
+    "roiFront": "363,226,48,21",
+    "roiBack": "363,226,48,21",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "金币"
   }
 ]