Skip to content

Commit c9b86a1

Browse files
authored
Update ApexFarmer.py to v.2.3
1 parent 84dcc20 commit c9b86a1

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

ApexFarmer.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
'ApexDir': r'C:\Program Files\EA Games\Apex\\r5apex.exe',
3232
'OCR_debug': '0',
3333
'show_exp': '1',
34+
'Gamemode': 'Trios',
3435
'Champion': 'Lifeline'}
3536
config['KEYBINDS'] = {'Crouch_Key': 'c',
3637
'Heal_Key': '4',
@@ -54,6 +55,7 @@
5455
OCR_debug = int(config.get('CONFIG', 'OCR_debug'))
5556
show_exp = int(config.get('CONFIG', 'show_exp'))
5657
champion = str(config.get('CONFIG', 'Champion'))
58+
gamemode = str(config.get('CONFIG', 'Gamemode'))
5759

5860
crouch_key = str(config.get('KEYBINDS', 'Crouch_Key'))
5961
heal_key = str(config.get('KEYBINDS', 'Heal_Key'))
@@ -153,13 +155,15 @@
153155
print("CONFIG: -> | Apex Directory: | >>>", apexdir)
154156
print("CONFIG: -> | Show earned XP: | >>>", show_exp)
155157
print("CONFIG: -> | Champion | >>>", champion)
158+
print("CONFIG: -> | Gamemode | >>>", gamemode)
156159
print("CONFIG: -> | DEBUG MODE: | >>>", OCR_debug)
157160
print(" ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ ")
158161
print('')
159162
print('')
160163
print('')
161164
print('')
162165
print('')
166+
print('')
163167
print("Press any key to continue if settings are correct")
164168
msvcrt.getch()
165169
print(UP, end=CLEAR)
@@ -269,7 +273,7 @@ def process_exists(process_name):
269273
pyautogui.press("alt")
270274
win32gui.SetForegroundWindow(apex_hwnd)
271275
win32gui.SetActiveWindow(apex_hwnd)
272-
while gamemode_set==1:
276+
while (gamemode_set==1) and (gamemode=='Duos'):
273277

274278
try:
275279
coords_gamemode_x, coords_gamemode_y = pyautogui.locateCenterOnScreen(resource_path('ss\\trios.png'),region=(gamemode_coords),confidence=0.9)
@@ -294,7 +298,18 @@ def process_exists(process_name):
294298
pyautogui.moveTo(200,100)
295299
gamemode_set=0
296300

297-
if (pyautogui.locateOnScreen(resource_path('ss\\team.png'), region=(team_coords), grayscale=True, confidence=0.9) != None) and (pyautogui.locateOnScreen(resource_path('ss\\duos.png'), region=(gamemode_coords), grayscale=True, confidence=0.9) != None):
301+
if (pyautogui.locateOnScreen(resource_path('ss\\team.png'), region=(team_coords), grayscale=True, confidence=0.9) != None) and (pyautogui.locateOnScreen(resource_path('ss\\duos.png'), region=(gamemode_coords), grayscale=True, confidence=0.7) != None):
302+
try:
303+
coords_auto_fill_x, coords_auto_fill_y = pyautogui.locateCenterOnScreen(resource_path('ss\\team.png'),region=(team_coords),confidence=0.9)
304+
except TypeError:
305+
coords_auto_fill_x=0
306+
coords_auto_fill_y=0
307+
if (coords_auto_fill_x!=0) and (coords_auto_fill_y!=0):
308+
pyautogui.moveTo(coords_auto_fill_x,coords_auto_fill_y)
309+
pyautogui.click(coords_auto_fill_x,coords_auto_fill_y)
310+
time.sleep(2)
311+
pyautogui.moveTo(200,100)
312+
elif (pyautogui.locateOnScreen(resource_path('ss\\team.png'), region=(team_coords), grayscale=True, confidence=0.9) != None) and (pyautogui.locateOnScreen(resource_path('ss\\trios.png'), region=(gamemode_coords), grayscale=True, confidence=0.7) != None):
298313
try:
299314
coords_auto_fill_x, coords_auto_fill_y = pyautogui.locateCenterOnScreen(resource_path('ss\\team.png'),region=(team_coords),confidence=0.9)
300315
except TypeError:
@@ -318,15 +333,15 @@ def process_exists(process_name):
318333

319334
#program loop
320335
while mod == 3:
321-
if pyautogui.locateOnScreen(resource_path('ss\\trios.png'), region=(gamemode_coords), grayscale=True, confidence=0.9) != None:
336+
if pyautogui.locateOnScreen(resource_path('ss\\trios.png'), region=(gamemode_coords), grayscale=True, confidence=0.7) != None:
322337
gamemode_set=1
323338
apex_hwnd = win32gui.FindWindow(None,'Apex Legends')
324339
if apex_hwnd != 0:
325340
time.sleep(1)
326341
pyautogui.press("alt")
327342
win32gui.SetForegroundWindow(apex_hwnd)
328343
win32gui.SetActiveWindow(apex_hwnd)
329-
while gamemode_set==1:
344+
while (gamemode_set==1) and (gamemode=='Duos'):
330345

331346
try:
332347
coords_gamemode_x, coords_gamemode_y = pyautogui.locateCenterOnScreen(resource_path('ss\\trios.png'),region=(gamemode_coords),confidence=0.9)
@@ -867,7 +882,3 @@ def process_exists(process_name):
867882
if (pyautogui.locateOnScreen(resource_path('ss\\leader.png'), region=(398,140,334,71), confidence=0.8) != None) or (pyautogui.locateOnScreen(resource_path('ss\\leader.png'), region=(1187,147,244,95), confidence=0.8) != None):
868883
mod=3
869884

870-
871-
872-
873-

0 commit comments

Comments
 (0)