Skip to content

Commit 2692bdd

Browse files
authored
Update ApexFarmer.py to v1.5
1 parent c766ad5 commit 2692bdd

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

ApexFarmer.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ def process_exists(process_name):
235235

236236
if pyautogui.locateOnScreen(resource_path('ss\\dead.png'), region=(441,19,1017,304), grayscale=True, confidence=0.6) or pyautogui.locateOnScreen(resource_path('ss\\2ndplace.png'), region=(441,19,1017,304), confidence=0.6) != None:
237237
#print("dead")
238-
time.sleep(np.random.uniform(1,2))
238+
time.sleep(np.random.uniform(0.3,0.5))
239239
keyboard.press_and_release('space')
240-
time.sleep(np.random.uniform(1,2))
240+
time.sleep(np.random.uniform(0.3,0.7))
241241
while True:
242242
if pyautogui.locateOnScreen(resource_path('ss\\yes.png'), region=(506,550,912,304), grayscale=True, confidence=0.6) != None:
243243
#print('yes')
@@ -268,28 +268,52 @@ def process_exists(process_name):
268268
imagenp2 = np.array(image2)
269269
gray2 = cv2.cvtColor(imagenp2, cv2.COLOR_BGR2GRAY)
270270
invert2 = 255 - gray2
271+
272+
image3=pyautogui.screenshot(region=(807,551,194,62))
273+
imagenp3 = np.array(image3)
274+
gray3 = cv2.cvtColor(imagenp3, cv2.COLOR_BGR2GRAY)
275+
invert3 = 255 - gray3
276+
271277
if OCR_debug == 1:
272-
pyautogui.screenshot("saved_without"+str(n)+".png")
273-
#pyautogui.screenshot("ocrscan1_"+str(n)+".png",region=(445,231,80,37))
274-
#pyautogui.screenshot("ocrscan2_"+str(n)+".png",region=(439,272,84,34))
275-
exp_new1 = pytesseract.image_to_string(invert1,lang='eng', config='--psm 12 -c tessedit_char_whitelist=0123456789')
278+
pyautogui.screenshot("saved_without_exp"+str(n)+".png")
279+
280+
exp_new3 = int(pytesseract.image_to_string(invert3,lang='eng', config='--psm 6 -c tessedit_char_whitelist=0123456789'))
281+
exp_new1 = pytesseract.image_to_string(invert1,lang='eng', config='--psm 6 -c tessedit_char_whitelist=0123456789')
276282
try:
277-
exp_new2 = pytesseract.image_to_string(invert2,lang='eng', config='--psm 12 -c tessedit_char_whitelist=0123456789')
283+
exp_new2 = pytesseract.image_to_string(invert2,lang='eng', config='--psm 6 -c tessedit_char_whitelist=0123456789')
278284
except ValueError:
279285
exp_new2 = 0
280286
pass
287+
288+
281289
if len(exp_new1) == 6 and exp_new1[0] == '4':
282290
exp_new1=int(exp_new1[1:])
283291
#print('EXP1 - 5 CHAR DETECTED')
284292
if len(exp_new2) == 6 and int(exp_new2[0]) == '4':
285293
exp_new2=int(exp_new2[1:])
286294
#print('EXP2 - 5 CHAR DETECTED')
295+
296+
287297
exp_new1 = int(exp_new1)
288298
try:
289299
exp_new2 = int(exp_new2)
290300
except ValueError:
291301
exp_new2 = 0
292302
exp_new=exp_new1+exp_new2
303+
304+
exp_new=str(exp_new)
305+
if exp_new[0]=='4' and exp_new[1]=='4' and len(exp_new)==4:
306+
exp_new=exp_new[1:]
307+
308+
exp_new = int(exp_new)
309+
310+
if exp_new == exp_new3:
311+
pass
312+
if exp_new > 4000:
313+
exp_new=exp_new3
314+
elif len(str(exp_new))==3 and len(str(exp_new3))==4:
315+
exp_new=exp_new3
316+
293317
exp=exp+exp_new
294318
if OCR_debug == 1:
295319
pyautogui.screenshot("saved_exp" +str(exp_new)+".png")

0 commit comments

Comments
 (0)