Skip to content

Commit 37a3082

Browse files
authored
Update ApexFarmer.py to v.2.2
1 parent 8b90a91 commit 37a3082

File tree

1 file changed

+71
-10
lines changed

1 file changed

+71
-10
lines changed

ApexFarmer.py

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181

8282
exp_read=0
8383
matchmaking=0
84+
gamemode_set=0
8485
timer_matchmaking=0
8586
timer_matchmaking_end=0
8687
timer_matchmaking_start=0
@@ -98,11 +99,16 @@
9899
coords_boost=[849,566,153,62]
99100
coords_no_boost=[807,551,194,62]
100101
team_coords=[24,521,409,189]
102+
gamemode_coords=[20,700,423,217]
101103
xp_hour=0
102104
x=0
103105
y=0
104106
coords_auto_fill_x=0
105107
coords_auto_fill_y=0
108+
coords_gamemode_x=0
109+
coords_gamemode_y=0
110+
coords_gamemode_select_x=0
111+
coords_gamemode_select_y=0
106112
champ_list=["Bloodhound","Gibraltar","Lifeline","Pathfinder","Wraith","Bangalore","Caustic","Mirage","Octane","Wattson","Crypto","Revenant","Loba","Rampart","Horizon","Fuse","Valkyrie","Seer","Ash","MadMaggie","Newcastle","Vantage","Catalyst","Ballistic","Conduit"]
107113
champ_string=r'legends\\'+champion+'.png'
108114
friend_region=[[573,265,284,34],(573,365,284,34),(573,465,284,34),(573,565,284,34),(573,665,284,34),(573,765,284,34),(573,865,284,34),(573,965,284,34)]
@@ -255,18 +261,45 @@ def process_exists(process_name):
255261
time.sleep(np.random.uniform(0.3,0.8))
256262
keyboard.press_and_release('esc')
257263

258-
if pyautogui.locateOnScreen(resource_path('ss\\team.png'), region=(team_coords), grayscale=True, confidence=0.9) != None:
264+
if pyautogui.locateOnScreen(resource_path('ss\\trios.png'), region=(gamemode_coords), grayscale=True, confidence=0.9) != None:
265+
gamemode_set=1
259266
apex_hwnd = win32gui.FindWindow(None,'Apex Legends')
260267
if apex_hwnd != 0:
261268
time.sleep(1)
262269
pyautogui.press("alt")
263270
win32gui.SetForegroundWindow(apex_hwnd)
264271
win32gui.SetActiveWindow(apex_hwnd)
272+
while gamemode_set==1:
273+
274+
try:
275+
coords_gamemode_x, coords_gamemode_y = pyautogui.locateCenterOnScreen(resource_path('ss\\trios.png'),region=(gamemode_coords),confidence=0.9)
276+
except TypeError:
277+
coords_gamemode_x=0
278+
coords_gamemode_y=0
279+
if (coords_gamemode_x!=0) and (coords_gamemode_y!=0):
280+
pyautogui.moveTo(coords_gamemode_x,coords_gamemode_y)
281+
pyautogui.click(coords_gamemode_x,coords_gamemode_y)
282+
time.sleep(2)
283+
pyautogui.moveTo(200,100)
284+
if pyautogui.locateOnScreen(resource_path('ss\\duoselect.png'), region=(44,275,461,582), grayscale=True, confidence=0.9) != None:
285+
try:
286+
coords_gamemode_select_x, coords_gamemode_select_y = pyautogui.locateCenterOnScreen(resource_path('ss\\duoselect.png'),region=(44,275,461,582),confidence=0.9)
287+
except TypeError:
288+
coords_gamemode_select_x=0
289+
coords_gamemode_select_y=0
290+
if (coords_gamemode_select_x!=0) and (coords_gamemode_select_y!=0):
291+
pyautogui.moveTo(coords_gamemode_select_x,coords_gamemode_select_y)
292+
pyautogui.click(coords_gamemode_select_x,coords_gamemode_select_y)
293+
time.sleep(2)
294+
pyautogui.moveTo(200,100)
295+
gamemode_set=0
296+
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):
265298
try:
266299
coords_auto_fill_x, coords_auto_fill_y = pyautogui.locateCenterOnScreen(resource_path('ss\\team.png'),region=(team_coords),confidence=0.9)
267300
except TypeError:
268-
x=0
269-
y=0
301+
coords_auto_fill_x=0
302+
coords_auto_fill_y=0
270303
if (coords_auto_fill_x!=0) and (coords_auto_fill_y!=0):
271304
pyautogui.moveTo(coords_auto_fill_x,coords_auto_fill_y)
272305
pyautogui.click(coords_auto_fill_x,coords_auto_fill_y)
@@ -285,12 +318,45 @@ def process_exists(process_name):
285318

286319
#program loop
287320
while mod == 3:
321+
if pyautogui.locateOnScreen(resource_path('ss\\trios.png'), region=(gamemode_coords), grayscale=True, confidence=0.9) != None:
322+
gamemode_set=1
323+
apex_hwnd = win32gui.FindWindow(None,'Apex Legends')
324+
if apex_hwnd != 0:
325+
time.sleep(1)
326+
pyautogui.press("alt")
327+
win32gui.SetForegroundWindow(apex_hwnd)
328+
win32gui.SetActiveWindow(apex_hwnd)
329+
while gamemode_set==1:
330+
331+
try:
332+
coords_gamemode_x, coords_gamemode_y = pyautogui.locateCenterOnScreen(resource_path('ss\\trios.png'),region=(gamemode_coords),confidence=0.9)
333+
except TypeError:
334+
coords_gamemode_x=0
335+
coords_gamemode_y=0
336+
if (coords_gamemode_x!=0) and (coords_gamemode_y!=0):
337+
pyautogui.moveTo(coords_gamemode_x,coords_gamemode_y)
338+
pyautogui.click(coords_gamemode_x,coords_gamemode_y)
339+
time.sleep(2)
340+
pyautogui.moveTo(200,100)
341+
if pyautogui.locateOnScreen(resource_path('ss\\duoselect.png'), region=(44,275,461,582), grayscale=True, confidence=0.9) != None:
342+
try:
343+
coords_gamemode_select_x, coords_gamemode_select_y = pyautogui.locateCenterOnScreen(resource_path('ss\\duoselect.png'),region=(44,275,461,582),confidence=0.9)
344+
except TypeError:
345+
coords_gamemode_select_x=0
346+
coords_gamemode_select_y=0
347+
if (coords_gamemode_select_x!=0) and (coords_gamemode_select_y!=0):
348+
pyautogui.moveTo(coords_gamemode_select_x,coords_gamemode_select_y)
349+
pyautogui.click(coords_gamemode_select_x,coords_gamemode_select_y)
350+
time.sleep(2)
351+
pyautogui.moveTo(200,100)
352+
gamemode_set=0
353+
288354
if pyautogui.locateOnScreen(resource_path('ss\\team.png'), region=(team_coords), grayscale=True, confidence=0.9) != None:
289355
try:
290356
coords_auto_fill_x, coords_auto_fill_y = pyautogui.locateCenterOnScreen(resource_path('ss\\team.png'),region=(team_coords),confidence=0.9)
291357
except TypeError:
292-
x=0
293-
y=0
358+
coords_auto_fill_x=0
359+
coords_auto_fill_y=0
294360
time.sleep(0.5)
295361
pyautogui.press("alt")
296362
win32gui.SetForegroundWindow(apex_hwnd)
@@ -804,9 +870,4 @@ def process_exists(process_name):
804870

805871

806872

807-
808-
809-
810-
811-
812873

0 commit comments

Comments
 (0)