-
Notifications
You must be signed in to change notification settings - Fork 0
/
botIDK.py
1099 lines (978 loc) · 31.9 KB
/
botIDK.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import pyautogui as pyA
import time
import cv2
from datetime import datetime
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client
#load me into tft matches all night if pyautogui.locateOnScreen('/Users/edmond/Desktop/ROTMGBot#1/notread.png', confidence = 0.75) != None:
def getIntoFirstGame():
time.sleep(3)
pic1 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/TFTtab2.png', confidence = 0.75)
if pic1 != None:
#print("Pic found!")
pic1 = pyA.center(pic1)
pic1X, pic1Y = pic1
time.sleep(1)
pyA.click(pic1X, pic1Y)
pyA.mouseDown()
pyA.mouseUp()
else:
#print("Did not find first TFT Tab")
return
time.sleep(3)
pic2 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/playbutton.PNG', confidence = 0.75)
pic22 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/partybutton.PNG', confidence = 0.75)
if pic2 != None:
#print("Pic found!")
pic2 = pyA.center(pic2)
pic2X, pic2Y = pic2
time.sleep(1)
pyA.click(pic2X, pic2Y)
pyA.mouseDown()
pyA.mouseUp()
elif pic22 != None:
#print("Pic found!")
pic22 = pyA.center(pic22)
pic22X, pic22Y = pic22
time.sleep(1)
pyA.click(pic22X, pic22Y)
pyA.mouseDown()
pyA.mouseUp()
else:
#print("Did not find play button")
return
time.sleep(3)
pic3 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/teamfighttab.PNG', confidence = 0.75)
if pic3 != None:
#print("Pic found!")
pic3 = pyA.center(pic3)
pic3X, pic3Y = pic3
time.sleep(1)
pyA.click(pic3X, pic3Y)
pyA.mouseDown()
pyA.mouseUp()
else:
#print("Did not find team fight tab")
return
time.sleep(3)
pic4 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/confirmbutton.PNG', confidence = 0.75)
if pic4 != None:
#print("Pic found!")
pic4 = pyA.center(pic4)
pic4X, pic4Y = pic4
time.sleep(1)
pyA.click(pic4X, pic4Y)
pyA.mouseDown()
pyA.mouseUp()
else:
#print("Did not find the confirm button")
return
time.sleep(4)
pic5 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/findMatchbutton.PNG', confidence = 0.75)
if pic5 != None:
#print("Pic found!")
pic5 = pyA.center(pic5)
pic5X, pic5Y = pic5
time.sleep(1)
pyA.click(pic5X, pic5Y)
pyA.mouseDown()
pyA.mouseUp()
else:
#print("Did not find the find match button")
return
time.sleep(3)
notinGame = True
while notinGame:
pic6 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/Accept2.PNG', confidence = 0.9)
if pic6 != None:
#print("Pic found!")
pic6 = pyA.center(pic6)
pic6X, pic6Y = pic6
time.sleep(1)
pyA.click(pic6X, pic6Y)
pyA.mouseDown()
pyA.mouseUp()
else:
pass
#print("Did not find the match accepted button. Trying again")
time.sleep(5)
#Check if I am in the match
if (pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/TFTTab2.PNG', confidence = 0.75)) == None:
notinGame = False
#print("i am now in game")
#print("end of getIntofirstgame script")
#print(datetime.now())
def surrender():
time.sleep(3)
pyA.hotkey('esc')
s1 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/surrenderButton.PNG', confidence = 0.75)
if s1 != None:
print("Pic found!")
s1 = pyA.center(s1)
s1X, s1Y = s1
time.sleep(1)
pyA.click(s1X, s1Y)
pyA.click(s1X, s1Y)
pyA.mouseDown()
pyA.mouseUp()
else:
print("Did not find the surrender1 button")
return
time.sleep(3)
s2 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/surrender2Button.PNG', confidence = 0.75)
if s2 != None:
print("Pic found!")
s2 = pyA.center(s2)
s2X, s2Y = s2
time.sleep(1)
pyA.click(s2X, s2Y)
pyA.click(s2X, s2Y)
pyA.mouseDown()
pyA.mouseUp()
else:
print("Did not find the surrender2 button")
return
time.sleep(2)
def exitGame():
time.sleep(3)
ex = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/exitButton.PNG', confidence = 0.75)
if ex != None:
#print("Pic found!")
ex = pyA.center(ex)
exX, exY = ex
time.sleep(1)
pyA.click(exX, exY) #this click does not work and does not take me out of the game
pyA.click(exX, exY) #double clicking does not work either
pyA.mouseDown()
pyA.mouseUp()
pyA.mouseDown()
pyA.mouseUp()
#print('exit now button clicked')
#print(datetime.now())
return 10
else:
#print("Did not find the exit button")
#print(datetime.now())
if pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/gameIsOver.PNG') != None:
#print("I proabbly got first becaues the game exited by itself lol!")
#print(datetime.now())
return 10
elif pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/okButt.PNG') != None:
#print("I proabbly got first becaues the game exited by itself lol!")
#print(datetime.now())
return 10
elif pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/playagainbutton.PNG') != None:
#print("I proabbly got first or second becaues the game exited by itself lol!")
#print(datetime.now())
return 10
else:
return 2
def reEnter():
okButton = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/okButt.PNG', confidence = 0.75)
if okButton != None:
okButton = pyA.center(okButton)
okButtonX, okButtonY = okButton
time.sleep(1)
pyA.click(okButtonX, okButtonY)
pyA.mouseDown()
pyA.mouseUp()
#print('finished quest ok button clicked')
#print(datetime.now())
time.sleep(3)
okButton = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/okButt.PNG', confidence = 0.75)
if okButton != None:
okButton = pyA.center(okButton)
okButtonX, okButtonY = okButton
time.sleep(1)
pyA.click(okButtonX, okButtonY)
pyA.mouseDown()
pyA.mouseUp()
#print('finished quest ok button clicked')
#print(datetime.now())
time.sleep(3)
okButton = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/okButt.PNG', confidence = 0.75)
if okButton != None:
okButton = pyA.center(okButton)
okButtonX, okButtonY = okButton
time.sleep(1)
pyA.click(okButtonX, okButtonY)
pyA.mouseDown()
pyA.mouseUp()
#print('finished quest ok button clicked')
#print(datetime.now())
time.sleep(3)
okButton = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/okButt.PNG', confidence = 0.75)
if okButton != None:
okButton = pyA.center(okButton)
okButtonX, okButtonY = okButton
time.sleep(1)
pyA.click(okButtonX, okButtonY)
pyA.mouseDown()
pyA.mouseUp()
#print('finished quest ok button clicked')
#print(datetime.now())
time.sleep(3)
okButton = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/okButt.PNG', confidence = 0.75)
if okButton != None:
okButton = pyA.center(okButton)
okButtonX, okButtonY = okButton
time.sleep(1)
pyA.click(okButtonX, okButtonY)
pyA.mouseDown()
pyA.mouseUp()
#print('finished quest ok button clicked')
#print(datetime.now())
time.sleep(4)
playAgain = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/playagainbutton.PNG', confidence = 0.75)
if playAgain != None:
#print("Pic found!")
playAgain = pyA.center(playAgain)
playAgainX, playAgainY = playAgain
time.sleep(1)
pyA.click(playAgainX, playAgainY)
pyA.mouseDown()
pyA.mouseUp()
#print('playagain button clicked')
#print(datetime.now())
else:
#print("Did not find the play again button")
#print(datetime.now())
return 12
time.sleep(4)
pic5 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/findMatchbutton.PNG', confidence = 0.75)
if pic5 != None:
pic5 = pyA.center(pic5)
pic5X, pic5Y = pic5
time.sleep(1)
pyA.click(pic5X, pic5Y)
pyA.mouseDown()
pyA.mouseUp()
#print('found the re find match button for next game')
#print(datetime.now())
else:
#print("Did not find the re-find match button")
#print(datetime.now())
return 6
time.sleep(3)
z = 0
notinGame = True
while notinGame:
pic6 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/Accept2.PNG', confidence = 0.9)
if pic6 != None:
pic6 = pyA.center(pic6)
pic6X, pic6Y = pic6
time.sleep(1)
pyA.click(pic6X, pic6Y)
pyA.mouseDown()
pyA.mouseUp()
#print('found the match accepted button for the next match')
#print(datetime.now())
else:
#print("Did not find the match accepted button. Trying again")
#print(datetime.now())
z += 1
if z > 80: #should be 80
print("the error has been found. fk")
restart()
getIntoFirstGame()
return 12
time.sleep(5)
#Check if I am in the match
if (pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/TFTTab2.PNG', confidence = 0.75)) == None:
notinGame = False
#print("i am now in game")
#print(datetime.now())
#print("re enter script done")
#print(datetime.now())
def positionChecker():
pos = pyA.position()
return pos
def reset():
pass
def loadingScreen():
notinGame = True
while notinGame:
time.sleep(30)
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/loadingIN.PNG', confidence = 0.9)
if re == None:
#print('match has finished loading and I am now in planning phase')
#print(datetime.now())
notinGame = False
else:
#print("Match still loading screen")
pass
def placeDownChamps():
notinGame = True
while notinGame:
time.sleep(6)
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/refresh.PNG', confidence = 0.9)
if re != None:
print('match has finished loading and I am now in planning phase')
print(datetime.now())
notinGame = False
else:
print("Match still loading screen, refresh not found")
dragChamp()
print('hopefully those champs were dragged in')
def placeDownChamps2():
notinGame = True
while notinGame:
time.sleep(6)
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/refresh.PNG', confidence = 0.9)
if re != None:
print('match has finished loading and I am now in planning phase')
print(datetime.now())
notinGame = False
else:
print("planning phase not found for dragging champs 2")
dragChamp2()
print('hopefully those champs were dragged in')
def buyXP():
notinGame = True
while notinGame:
time.sleep(6)
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/buyXP.PNG', confidence = 0.9)
if re != None:
dragChamp2()
re = pyA.center(re)
reX, reY = re
time.sleep(1)
pyA.click(reX, reY)
print('buying xp now')
print(datetime.now())
x = 0
while x < 20:
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
x+=1
#time.sleep(0.25)
notinGame = False
else:
print("xp not found (planning phase not found)")
def buyXP22(): #Work in progress
notinGame = True
while notinGame:
time.sleep(6)
lvl3 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/lvl3.PNG', confidence = 0.9)
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/buyXP.PNG', confidence = 0.9)
if lvl3 != None:
re = pyA.center(re)
reX, reY = re
time.sleep(1)
pyA.click(reX, reY)
print('buying xp now')
print(datetime.now())
x = 0
while x < 14:
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
if (x % 3 == 0):
lvl7 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/lvl7.PNG', confidence = 0.9)
if lvl7 != None:
x = 100
x+=1
#time.sleep(0.25)
notinGame = False
else:
print("xp not found (planning phase not found)")
dragGoodChamp()
def buyXP2():
y = 0
notinGame = True
while notinGame:
time.sleep(10)
#lvl5 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/lvl5.PNG', confidence = 0.9)
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/buyXP.PNG', confidence = 0.9)
if re != None:
re = pyA.center(re)
reX, reY = re
time.sleep(1)
pyA.click(reX, reY)
#print('buying xp now')
#print(datetime.now())
x = 0
while x < 14:
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
if (x % 2 == 0):
lvl7 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/lvl7.PNG', confidence = 0.9)
if lvl7 != None:
x = 100
x+=1
#time.sleep(0.25)
notinGame = False
else:
#print("xp not found (planning phase not found)")
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/exitButton.PNG', confidence = 0.9)
re2 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/playagainbutton.PNG', confidence = 0.9)
if re != None or re2 != None:
return
dragGoodChampsLate()
def buyXP2Early():
notinGame = True
while notinGame:
time.sleep(10)
lvl5 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/lvl5.PNG', confidence = 0.9)
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/buyXP.PNG', confidence = 0.9)
if lvl5 != None and re != None:
re = pyA.center(re)
reX, reY = re
time.sleep(1)
pyA.click(reX, reY)
#print('buying xp now')
#print(datetime.now())
x = 0
while x < 6:
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
x+=1
notinGame = False
else:
print("lvl 5 not found for first round of champ buying")
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/exitButton.PNG', confidence = 0.9)
re2 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/playagainbutton.PNG', confidence = 0.9)
if re != None or re2 != None:
return
dragGoodChampEarly()
def dragGoodChamp():
champs = 0
checking = True
while checking and champs < 10:
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/refresh.PNG', confidence = 0.9)
g1 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/4Champ.PNG', confidence = 0.9)
g2 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/bigChamp.PNG', confidence = 0.8)
g3 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/5champ.PNG', confidence = 0.8)
g4 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/9champ.PNG', confidence = 0.8)
if g4 != None:
g4 = pyA.center(g4)
g4X, g4Y = g4
pyA.click(g4X, g4Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
champs +=1
if g3 != None:
g3 = pyA.center(g3)
g3X, g3Y = g3
pyA.click(g3X, g3Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
champs +=1
if g2 != None:
g2 = pyA.center(g2)
g2X, g2Y = g2
pyA.click(g2X, g2Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
champs +=1
if g1 != None:
g1 = pyA.center(g1)
g1X, g1Y = g1
pyA.click(g1X, g1Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
champs +=1
elif re != None:
re = pyA.center(re)
reX, reY = re
pyA.click(reX, reY)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
time.sleep(1)
champs +=1
if re == None:
checking = False
time.sleep(1)
pyA.click(700,400)
time.sleep(1)
def dragGoodChampsLate():
checking = 0
rerolls = 0
while checking < 18:
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/refresh.PNG', confidence = 0.9)
g1 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/4Champ.PNG', confidence = 0.9)
g2 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/bigChamp.PNG', confidence = 0.8)
g3 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/5champ.PNG', confidence = 0.8)
g4 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/9champ.PNG', confidence = 0.8)
if g4 != None:
g4 = pyA.center(g4)
g4X, g4Y = g4
pyA.click(g4X, g4Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
checking += 2
if g3 != None:
g3 = pyA.center(g3)
g3X, g3Y = g3
pyA.click(g3X, g3Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
checking +=2
if g2 != None:
g2 = pyA.center(g2)
g2X, g2Y = g2
pyA.click(g2X, g2Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
checking +=2
if g1 != None:
g1 = pyA.center(g1)
g1X, g1Y = g1
pyA.click(g1X, g1Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
checking +=2
elif re != None:
re = pyA.center(re)
reX, reY = re
pyA.click(reX, reY)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
time.sleep(1)
if re == None:
checking += 100
time.sleep(1)
def dragGoodChampEarly():
checking = 0
rerolls = 0
while checking < 10 and rerolls < 12:
re = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/refresh.PNG', confidence = 0.9)
g1 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/4Champ.PNG', confidence = 0.9)
g2 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/bigChamp.PNG', confidence = 0.8)
g3 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/5champ.PNG', confidence = 0.8)
g4 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/9champ.PNG', confidence = 0.8)
if g4 != None:
g4 = pyA.center(g4)
g4X, g4Y = g4
pyA.click(g4X, g4Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
checking += 2
if g3 != None:
g3 = pyA.center(g3)
g3X, g3Y = g3
pyA.click(g3X, g3Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
checking +=2
if g2 != None:
g2 = pyA.center(g2)
g2X, g2Y = g2
pyA.click(g2X, g2Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
checking +=2
if g1 != None:
g1 = pyA.center(g1)
g1X, g1Y = g1
pyA.click(g1X, g1Y)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
checking +=2
elif re != None:
re = pyA.center(re)
reX, reY = re
pyA.click(reX, reY)
pyA.mouseDown()
time.sleep(0.2)
pyA.mouseUp()
time.sleep(1)
rerolls +=1
time.sleep(1)
def dragChamp():
x1 = 573
y = 1003
x2 = 828
x11 = 423
x22 = 547
yy = 782
pyA.mouseDown(x1,y)
time.sleep(0.5)
pyA.mouseUp(x1,y)
time.sleep(1)
pyA.mouseDown(x2,y)
time.sleep(0.5)
pyA.mouseUp(x2,y)
time.sleep(1)
'''
pyA.mouseDown(x11,yy)
time.sleep(0.5)
pyA.moveTo(700,600,1)
time.sleep(0.5)
pyA.mouseUp()
time.sleep(1)
pyA.mouseDown(x22,yy)
time.sleep(0.5)
pyA.moveTo(780,600,1)
time.sleep(0.5)
pyA.mouseUp()
time.sleep(1) '''
def dragChamp2():
x1 = 573
y = 1003
x2 = 1000
x11 = 423
x22 = 547
yy = 782
pyA.mouseDown(x1,y)
time.sleep(0.5)
pyA.mouseUp(x1,y)
time.sleep(1)
pyA.mouseDown(x2,y)
time.sleep(0.5)
pyA.mouseUp(x2,y)
time.sleep(1)
'''
pyA.mouseDown(x11,yy)
time.sleep(0.5)
pyA.moveTo(700,600,1)
time.sleep(0.5)
pyA.mouseUp()
time.sleep(1)
pyA.mouseDown(x22,yy)
time.sleep(0.5)
pyA.moveTo(780,600,1)
time.sleep(0.5)
pyA.mouseUp()
time.sleep(1) '''
def restart():
X = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/leagueExit.PNG', confidence = 0.7)
if X != None:
X = pyA.center(X)
XX, XY = X
time.sleep(1)
pyA.click(XX, XY)
pyA.mouseDown()
pyA.mouseUp()
time.sleep(3)
X2 = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/leagueExit2.PNG', confidence = 0.7)
if X2 != None:
X2 = pyA.center(X2)
X2X, X2Y = X2
time.sleep(1)
pyA.click(X2X, X2Y)
pyA.mouseDown()
pyA.mouseUp()
time.sleep(240) #should be 240
league = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/leagueIcon.PNG', confidence = 0.7)
if league != None:
league = pyA.center(league)
leagueX, leagueY = league
time.sleep(1)
pyA.click(leagueX, leagueY)
pyA.mouseDown()
pyA.mouseUp()
time.sleep(60)
def inGame():
inGame = True
while inGame:
planning = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/planningphase2.PNG', confidence = 0.7)
if planning != None:
cultist = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/cultist.PNG', confidence = 0.7)
keeper = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/keeper.PNG', confidence = 0.7)
if cultist != None:
cultist = pyA.center(cultist)
cultistX, cultistY = cultist
time.sleep(1)
pyA.click(cultistX, cultistY)
pyA.mouseDown()
pyA.mouseUp()
elif keeper != None:
keeper = pyA.center(keeper)
keeperX, keeperY = keeper
time.sleep(1)
pyA.click(keeperX, keeperY)
pyA.mouseDown()
pyA.mouseUp()
else:
buyXP = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/buyXP.PNG', confidence = 0.9)
if buyXP != None:
buyXP = pyA.center(buyXP)
buyXPX, buyXPY = buyXP
time.sleep(1)
pyA.click(buyXPX, buyXPY)
pyA.mouseDown()
pyA.mouseUp()
refresh = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/refresh.PNG', confidence = 0.9)
if refresh != None:
refresh = pyA.center(refresh)
refreshX, refreshY = refresh
time.sleep(1)
pyA.click(refreshX, refreshY)
pyA.mouseDown()
pyA.mouseUp()
def ff():
pyA.hotkey('esc')
pyA.hotkey('esc')
buyXP = pyA.locateOnScreen('/Users/edmon/Desktop/League/tftBot/surrenderButton.PNG', confidence = 0.9)
if buyXP != None:
buyXP = pyA.center(buyXP)
buyXPX, buyXPY = buyXP
time.sleep(1)
pyA.click(buyXPX, buyXPY)
pyA.mouseDown()
pyA.mouseUp()
def altTab():
time.sleep(1)
pyA.hotkey('alt', 'tab')
time.sleep(1)
pyA.click(700,400)
time.sleep(2)
def main():
getIntoFirstGame()
keepGoing = True
while keepGoing:
time.sleep(1000)
surrender()
exitGame()
reEnter()
def main2():
getIntoFirstGame()
keepGoing = True
while keepGoing:
time.sleep(600)
print(" 5 min left ")
time.sleep(120)
print('3 minute left')
time.sleep(120)
print('One minute left')
time.sleep(60)
x = 3
while x < 5:
time.sleep(20)
x = exitGame()
print(x)
print('recognized game finished!')
time.sleep(7)
if reEnter() == 6:
print('program is stopping')
break
def main25():
getIntoFirstGame()
keepGoing = True
while keepGoing:
placeDownChamps()
time.sleep(240)
#placeDownChamps()
time.sleep(180)
print(" 5 min left ")
time.sleep(120)
print('3 minute left')
time.sleep(120)
print('One minute left')
time.sleep(60)
x = 3
while x < 5:
time.sleep(20)
x = exitGame()
print(x)
print('recognized game finished!')
time.sleep(7)
if reEnter() == 6:
print('program is stopping')
break
def main3():
getIntoFirstGame()
keepGoing = True
while keepGoing:
placeDownChamps()
time.sleep(240)
#placeDownChamps()
time.sleep(180)
print(" 5 min left ")
time.sleep(120)
print('3 minute left')
buyXP()
time.sleep(120)
print('One minute left')
time.sleep(60)
x = 3
while x < 5:
time.sleep(20)
x = exitGame()
print(x)
print('recognized game finished!')
time.sleep(7)
if reEnter() == 6:
print('program is stopping')
break
def main4():
getIntoFirstGame()
keepGoing = True
while keepGoing:
#placeDownChamps()
time.sleep(240) #4
#placeDownChamps()
time.sleep(180)#3
print("4 min left before buyxp")
time.sleep(120)#2
print('2 minute left before buyxp')
time.sleep(120)#2
time.sleep(180)#3
buyXP2()
time.sleep(300)#5
print('1 min left')
time.sleep(60)#1
x = 3
while x < 5:
time.sleep(20)
x = exitGame()
print(x)
print('recognized game finished!')
time.sleep(7)
if reEnter() == 6:
print('program is stopping')
break
#load in, 6 mins after load in buy first round of champs (max of 3 refreshes) ---- after another 6 minutes upgrade to level 7 if not already
#and spend rest of money buying champions --- after another 6 minutes check to exit the game
def tftWinner():
getIntoFirstGame()
keepGoing = True
while keepGoing:
time.sleep(10)
loadingScreen()
altTab()
time.sleep(480) #8
print('one min until buying champs at level 5 maxreroll 3 times')
time.sleep(60) #1
altTab()
buyXP2Early()
altTab()
time.sleep(180) #3
print('one min until upgrading to level 7 and buying champs until no gold left')
time.sleep(60)
altTab()
buyXP2()
altTab()
time.sleep(120)#2
print('1 min left')
time.sleep(60)#1
x = 3
while x < 5:
time.sleep(30)
y = exitGame()
if y > 5:
break
altTab()
time.sleep(2)
x = exitGame()
time.sleep(2)
if x < 5:
altTab()
#print(x)
print('recognized game finished!')
if reEnter() == 6:
#print('program is stopping')
break
def tftAFK():
getIntoFirstGame()
keepGoing = True
while keepGoing:
time.sleep(10)
loadingScreen()