Przeglądaj źródła

Merge branch 'master' of http://1.94.225.168:6602/pcacc/yys_auto

pcacc 5 miesięcy temu
rodzic
commit
d998b3a0a8
2 zmienionych plików z 15 dodań i 12 usunięć
  1. 1 1
      app_dongri.py
  2. 14 11
      scriptBase/comon.py

+ 1 - 1
app_dongri.py

@@ -284,7 +284,7 @@ def add_auto_task(isMaxCollect, isJina, isSimple = False, isAddStrengh = False,
         if times == 10:
             handle_end_game()
             if isAddStrengh:
-                myTimeSleep(random.randint(400, 500), send_status)
+                myTimeSleep(random.randint(350, 400), send_status)
             else:
                 myTimeSleep(random.randint(1000, 2000), send_status)
             handle_restart_game()

+ 14 - 11
scriptBase/comon.py

@@ -269,17 +269,20 @@ def dragAuto(gamestr, positions):
     return True
 
 def ocrAuto(gamestr, positions):
-    tmpRet, tmpPos = find_window_pos(gamestr)
-    if tmpRet == False:
-        return []
-    
-    x1 = positions[0] + tmpPos[0]
-    y1 = positions[1] + tmpPos[1]
-    x2 = positions[2] + tmpPos[0]
-    y2 = positions[3] + tmpPos[1]
-    region = (x1, y1, x2, y2)
-    lineStr = capture_and_ocr(region)
-    print("识别到:", lineStr)
+    try:
+        tmpRet, tmpPos = find_window_pos(gamestr)
+        if tmpRet == False:
+            return []
+        
+        x1 = positions[0] + tmpPos[0]
+        y1 = positions[1] + tmpPos[1]
+        x2 = positions[2] + tmpPos[0]
+        y2 = positions[3] + tmpPos[1]
+        region = (x1, y1, x2, y2)
+        lineStr = capture_and_ocr(region)
+        print("识别到:", lineStr)
+    except:
+        lineStr = ""
     return lineStr
 
 def yys_ocrAuto(positions):