forked from Passer1072/RookieAI_yolov8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RookAI_V2.3.3.py
1118 lines (946 loc) · 50.5 KB
/
RookAI_V2.3.3.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 gc
import json
import os
import threading
import time
import sys
import requests
import tkinter as tk
import webbrowser
import bettercam
import psutil
from math import sqrt
from tkinter import filedialog
from PIL import Image, ImageTk
from multiprocessing import Process, freeze_support
import recoil_control
import cv2
import numpy as np
import pyautogui
import win32api
import win32con
import customtkinter as ctk
from mss import mss
from ultralytics import YOLO
model_file = "yolov8n.pt"
sct = mss()
camera = bettercam.create(output_idx=0, output_color="BGR", max_buffer_len=2048)
screenshot_mode = False
screen_width = 640
screen_height = 640
DXcam_screenshot = 360
frame_counter = 0
start_time = time.time()
start_test_time = time.time()
gc_time = time.time()
dxcam_maxFPS = 30
closest_mouse_dist = 100
confidence = 0.65
aimOffset = 0.5
aimOffset_Magnification_x = 0
prediction_factor = 0.1
extra_offset_x = 5
extra_offset_y = 5
_win_width = 350
_win_height = 700
classes = 0
stage1_scope = 55
stage1_intensity = 0.8
stage2_scope = 170
stage2_intensity = 0.4
segmented_aiming_switch = False
test_window_frame = False
test_images_GUI = False
crawl_information = False
loaded_successfully = False
target_mapping = {'enemy': 0, 'friend': 1, 'head': 2}
img = Image.open("body_photo.png")
aimbot_var = None
circle_var = None
lockSpeed_scale = None
triggerType_var = None
arduinoMode_var = None
lockKey_var = None
confidence_scale = None
closest_mouse_dist_scale = None
screen_width_scale = None
screen_height_scale = None
root = None
aimOffset_scale = None
mouse_Side_Button_Witch_var = None
value_label = None
LookSpeed_label_text = None
target_selection = None
target_selection_var = None
target_selection_str = None
method_of_prediction_var = None
readme_content = ""
Thread_to_join = None
restart_thread = False
run_threads = True
draw_center = True
def calculate_screen_monitor(capture_width=640, capture_height=640):
screen_width, screen_height = pyautogui.size()
center_x, center_y = screen_width // 2, screen_height // 2
monitor = {
"top": center_y - capture_height // 2,
"left": center_x - capture_width // 2,
"width": capture_width,
"height": capture_height,
}
return monitor
def calculate_frame_rate(frame_counter, start_time, end_time):
if end_time - start_time != 0:
frame_rate = frame_counter / (end_time - start_time)
frame_counter = 0
start_time = time.time()
else:
frame_rate = 0
return frame_rate, frame_counter, start_time
def update_and_display_fps(frame_, frame_counter, start_time, end_time):
frame_counter += 1
frame_rate, frame_counter, start_time = calculate_frame_rate(frame_counter, start_time, end_time)
cv2.putText(frame_, f"FPS: {frame_rate:.0f}", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 1)
text_fps = "FPS:{:.0f}".format(frame_rate)
image_label_FPSlabel.configure(text=text_fps)
print(f"FPS: {frame_rate:.0f}")
return frame_, frame_counter, start_time
def capture_screen(monitor, sct):
screenshot = sct.grab(monitor)
frame = np.array(screenshot)[:, :, :3]
return frame
def DXcam():
screen_width, screen_height = pyautogui.size()
left, top = (screen_width - DXcam_screenshot) // 2, (screen_height - DXcam_screenshot) // 2
right, bottom = left + DXcam_screenshot, top + DXcam_screenshot
region = (left, top, right, bottom)
camera.start(region=region, video_mode=True, target_fps=dxcam_maxFPS)
def display_debug_window(frame):
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('.'):
cv2.destroyAllWindows()
return True
else:
return False
def get_desired_size(screen_width_1, screen_height_1):
if screen_width_1 == 1920 and screen_height_1 == 1080:
desired_size = (300, 300)
elif screen_width_1 >= 2560 and screen_height_1 >= 1440:
desired_size = (370, 370)
else:
desired_size = (300, 300)
return desired_size
def fetch_readme():
print("Start getting announcements......")
try:
readme_url = "https://raw.githubusercontent.com/Passer1072/RookieAI_yolov8/master/README.md"
response = requests.get(readme_url, timeout=10)
response_text = response.text
print("get success")
update_log_start = response_text.find("Change log:")
if update_log_start == -1:
return response_text
update_log = response_text[update_log_start:]
return update_log
except Exception as e:
print("Failed to obtain:", e)
return "Unable to load latest README file,This may be due to network issues or other unknown errors。"
def fetch_readme_version_number():
print("Start getting version number......")
try:
readme_url = "https://raw.githubusercontent.com/Passer1072/RookieAI_yolov8/master/README.md"
response = requests.get(readme_url)
response_text = response.text
print("get success")
search_str = "Current latest version: "
update_log_start = response_text.find(search_str)
if update_log_start == -1:
return response_text
update_log_start += len(search_str)
update_log = response_text[update_log_start:]
update_log = update_log.strip()
return update_log
except Exception as e:
print("Failed to obtain:", e)
return "Failed to obtain version number"
def crawl_information_by_github():
global readme_content, readme_version
if crawl_information:
readme_content = fetch_readme()
readme_version = fetch_readme_version_number()
def open_web(event):
webbrowser.open('https://github.com/Passer1072/RookieAI_yolov8')
def choose_model():
global model_file
model_file = filedialog.askopenfilename()
model_file_label.config(text=model_file)
def open_settings_config():
os.startfile("settings.json")
def load_model_file():
default_model_file = "yolov8n.pt"
try:
with open('settings.json', 'r') as f:
settings = json.load(f)
model_file = settings.get('model_file', default_model_file)
if not os.path.isfile(model_file):
print("[WARNING] Invalid model file path in settings file; use default model file")
model_file = default_model_file
except FileNotFoundError:
print("[WARNING] Settings file not found; using default model file")
model_file = default_model_file
print("Load model file:", model_file)
return YOLO(model_file) if model_file else None
def create_gui_tkinter():
global aimbot_var, lockSpeed_scale, triggerType_var, arduinoMode_var, lockKey_var, confidence_scale \
, closest_mouse_dist_scale, screen_width_scale, screen_height_scale, root, model_file, model_file_label, aimOffset_scale \
, draw_center_var, mouse_Side_Button_Witch_var, LookSpeed_label_text, lockSpeed_variable, confidence_variable \
, closest_mouse_dist_variable, aimOffset_variable, screen_width_scale_variable, screen_height_scale_variable \
, image_label, image_label_switch, image_label_FPSlabel, target_selection_var, target_mapping, prediction_factor_variable \
, prediction_factor_scale, method_of_prediction_var, extra_offset_x_scale, extra_offset_y_scale, extra_offset_y \
, extra_offset_x, extra_offset_x_variable, extra_offset_y_variable, readme_content, screenshot_mode_var\
, screenshot_mode, segmented_aiming_switch_var, stage1_scope, stage1_scope_scale, stage1_scope_variable\
, stage1_intensity_variable, stage1_intensity, stage1_intensity_scale, stage2_scope_variable\
, stage2_intensity_variable, stage2_scope_scale, stage2_intensity_scale
version_number = "V2.3.3(test)"
root = ctk.CTk()
ctk.set_appearance_mode("dark")
root.withdraw()
top = tk.Toplevel(root)
top.title("starting")
top.attributes('-topmost', 1)
logo_file = "logo-bird.png"
photo = tk.PhotoImage(file=logo_file)
label = tk.Label(top, image=photo)
label.pack()
def end_splash():
top.destroy()
root.deiconify()
root.after(2000, end_splash)
root.attributes('-topmost', 1)
root.update()
root.title("RookieAI")
root.geometry(f"{_win_width}x{_win_height}")
root.protocol("WM_DELETE_WINDOW", stop_program)
root.resizable(False, True)
tab_view = ctk.CTkTabview(root, width=320, height=500)
tab_view.add("Basic")
tab_view.add("Advanced")
tab_view.add("AntiRecoil") # Add Anti Recoil tab here
tab_view.add("Other")
tab_view.add("Test")
tab_view.grid(row=0, column=0, padx=(15, 0), pady=(0, 0))
aimbot_draw_center_frame = ctk.CTkFrame(tab_view.tab("Basic"))
aimbot_draw_center_frame.grid(row=0, column=0, sticky='w', pady=5)
aimbot_var = ctk.BooleanVar(value=aimbot)
aimbot_check = ctk.CTkCheckBox(aimbot_draw_center_frame, text='Aimbot', variable=aimbot_var,
command=update_values, )
aimbot_check.grid(row=0, column=0)
draw_center_var = ctk.BooleanVar(value=False)
draw_center_check = ctk.CTkCheckBox(aimbot_draw_center_frame, text='Display aiming range', variable=draw_center_var,
command=update_values)
draw_center_check.grid(row=0, column=1)
arduinoMode_frame = ctk.CTkFrame(tab_view.tab("Basic"))
arduinoMode_frame.grid(row=1, column=0, sticky='w', pady=5)
arduinoMode_var = ctk.BooleanVar(value=arduinoMode)
arduinoMode_check = ctk.CTkCheckBox(arduinoMode_frame, text='Arduino Mode', variable=arduinoMode_var,
command=update_values, state="DISABLED")
arduinoMode_check.grid(row=0, column=0, sticky="w", pady=(0, 0))
triggerType_var = tk.StringVar(value=triggerType)
triggerType_frame = ctk.CTkFrame(tab_view.tab("Basic"))
triggerType_frame.grid(row=2, column=0, sticky='w', pady=5)
triggerType_label = ctk.CTkLabel(triggerType_frame, text="Trigger method :")
triggerType_label.pack(side='left')
options = ["press", "switch", "shift+press"]
triggerType_option = ctk.CTkOptionMenu(triggerType_frame, variable=triggerType_var, values=options,
command=update_values)
triggerType_option.pack(side='left')
frame = ctk.CTkLabel(tab_view.tab("Basic"))
frame.grid(row=3, column=0, sticky='w', pady=5)
lbl = ctk.CTkLabel(frame, text="The hotkey is :")
lbl.grid(row=0, column=0)
lockKey_var = ctk.StringVar()
lockKey_var.set('Right click')
options = ['left click', 'Right click', 'lower key']
lockKey_menu = ctk.CTkOptionMenu(frame, variable=lockKey_var, values=options, command=update_values)
lockKey_menu.grid(row=0, column=1)
mouse_Side_Button_Witch_frame = ctk.CTkFrame(tab_view.tab("Basic"))
mouse_Side_Button_Witch_frame.grid(row=4, column=0, sticky='w', pady=5)
mouse_Side_Button_Witch_var = ctk.BooleanVar(value=False)
mouse_Side_Button_Witch_check = ctk.CTkCheckBox(mouse_Side_Button_Witch_frame, text='Mouse side button aiming switch',
variable=mouse_Side_Button_Witch_var,
command=update_values)
mouse_Side_Button_Witch_check.grid(row=0, column=0, sticky="w", pady=5)
lockSpeed_variable = tk.StringVar()
lockSpeed_variable.set(str(lockSpeed))
LookSpeed_frame = ctk.CTkFrame(tab_view.tab("Basic"))
LookSpeed_frame.grid(row=6, column=0, sticky='w', pady=2)
LookSpeed_label_0 = ctk.CTkLabel(LookSpeed_frame, text="LockSpeed:")
LookSpeed_label_0.grid(row=0, column=0)
lockSpeed_scale = ctk.CTkSlider(LookSpeed_frame, from_=0, to=1, number_of_steps=100, command=update_values)
lockSpeed_scale.set(lockSpeed)
lockSpeed_scale.grid(row=0, column=1)
LookSpeed_label_text = ctk.CTkLabel(LookSpeed_frame, textvariable=lockSpeed_variable)
LookSpeed_label_text.grid(row=0, column=2)
if segmented_aiming_switch:
ban_LookSpeed_label_0 = ctk.CTkLabel(LookSpeed_frame, text="Disabled", width=200)
ban_LookSpeed_label_0.grid(row=0, column=1, padx=(12, 0))
ban_LookSpeed_label_text = ctk.CTkLabel(LookSpeed_frame, text="", width=25)
ban_LookSpeed_label_text.grid(row=0, column=2)
closest_mouse_dist_variable = tk.StringVar()
closest_mouse_dist_variable.set(str(closest_mouse_dist))
closest_mouse_dist_frame = ctk.CTkFrame(tab_view.tab("Basic"))
closest_mouse_dist_frame.grid(row=7, column=0, sticky='w', pady=2)
closest_mouse_dist_label = ctk.CTkLabel(closest_mouse_dist_frame, text="Aim range:")
closest_mouse_dist_label.grid(row=0, column=1, sticky='w')
closest_mouse_dist_scale = ctk.CTkSlider(closest_mouse_dist_frame, from_=0, to=300, command=update_values)
closest_mouse_dist_scale.set(closest_mouse_dist)
closest_mouse_dist_scale.grid(row=0, column=2, padx=(12, 0))
closest_mouse_dist_text = ctk.CTkLabel(closest_mouse_dist_frame, textvariable=closest_mouse_dist_variable)
closest_mouse_dist_text.grid(row=0, column=3)
if segmented_aiming_switch:
ban_closest_mouse_dist_label = ctk.CTkLabel(closest_mouse_dist_frame, text="Disabled", width=200)
ban_closest_mouse_dist_label.grid(row=0, column=2, padx=(12, 0))
ban_closest_mouse_dist_text = ctk.CTkLabel(closest_mouse_dist_frame, text="", width=30)
ban_closest_mouse_dist_text.grid(row=0, column=3)
frame = ctk.CTkLabel(tab_view.tab("Basic"))
frame.grid(row=8, column=0, sticky='w', pady=5)
lbl = ctk.CTkLabel(frame, text="method of prediction:")
lbl.grid(row=0, column=0)
method_of_prediction_var = ctk.StringVar()
method_of_prediction_var.set('Disable prediction')
options = ['Disable prediction', 'Rate prediction', 'Pixel prediction']
method_of_prediction_menu = ctk.CTkOptionMenu(frame, variable=method_of_prediction_var, values=options,
command=update_values)
method_of_prediction_menu.grid(row=0, column=1)
message_text_frame = ctk.CTkFrame(tab_view.tab("Basic"))
message_text_frame.grid(row=9, column=0, sticky='w', pady=2)
message_text_Label = ctk.CTkLabel(message_text_frame, text="Update announcement")
message_text_Label.grid(row=0, column=1)
message_text_box = ctk.CTkTextbox(message_text_frame, width=300, height=100, corner_radius=5)
message_text_box.grid(row=1, column=1, sticky="nsew")
message_text_box.insert("0.0", readme_content)
target_selection_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
target_selection_frame.grid(row=1, column=0, sticky='w', pady=5)
target_selection_label = ctk.CTkLabel(target_selection_frame, text="The current detection target is:")
target_selection_label.grid(row=0, column=0)
target_selection_var = ctk.StringVar()
target_selection_var.set('enemy')
options = list(target_mapping.keys())
target_selection_option = ctk.CTkOptionMenu(target_selection_frame, variable=target_selection_var, values=options,
command=update_values)
target_selection_option.grid(row=0, column=1)
confidence_variable = tk.StringVar()
confidence_variable.set(str(confidence))
confidence_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
confidence_frame.grid(row=2, column=0, sticky='w', pady=2)
confidence_label = ctk.CTkLabel(confidence_frame, text="Confidence:")
confidence_label.grid(row=0, column=1, sticky='w')
confidence_scale = ctk.CTkSlider(confidence_frame, from_=0, to=1, number_of_steps=100, command=update_values)
confidence_scale.set(confidence)
confidence_scale.grid(row=0, column=2, padx=(25, 0))
confidence_label_text = ctk.CTkLabel(confidence_frame, textvariable=confidence_variable)
confidence_label_text.grid(row=0, column=3)
prediction_factor_variable = tk.StringVar()
prediction_factor_variable.set(str(prediction_factor))
prediction_factor_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
prediction_factor_frame.grid(row=3, column=0, sticky='w', pady=2)
prediction_factor_label = ctk.CTkLabel(prediction_factor_frame, text="Predict rate:")
prediction_factor_label.grid(row=0, column=1, sticky='w')
prediction_factor_scale = ctk.CTkSlider(prediction_factor_frame, from_=0, to=1, number_of_steps=100,
command=update_values)
prediction_factor_scale.set(prediction_factor)
prediction_factor_scale.grid(row=0, column=2, padx=(12, 0))
prediction_factor_text = ctk.CTkLabel(prediction_factor_frame, textvariable=prediction_factor_variable)
prediction_factor_text.grid(row=0, column=3)
extra_offset_x_variable = tk.StringVar()
extra_offset_x_variable.set(str(extra_offset_x))
extra_offset_x_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
extra_offset_x_frame.grid(row=4, column=0, sticky='w', pady=2)
extra_offset_x_label = ctk.CTkLabel(extra_offset_x_frame, text="Predict X:")
extra_offset_x_label.grid(row=0, column=0)
extra_offset_x_scale = ctk.CTkSlider(extra_offset_x_frame, from_=0, to=20, number_of_steps=20,
command=update_values)
extra_offset_x_scale.set(extra_offset_x)
extra_offset_x_scale.grid(row=0, column=1, padx=(4, 0))
extra_offset_x_label_text = ctk.CTkLabel(extra_offset_x_frame, textvariable=extra_offset_x_variable)
extra_offset_x_label_text.grid(row=0, column=2)
extra_offset_y_variable = tk.StringVar()
extra_offset_y_variable.set(str(extra_offset_y))
extra_offset_y_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
extra_offset_y_frame.grid(row=5, column=0, sticky='w', pady=2)
extra_offset_y_label = ctk.CTkLabel(extra_offset_y_frame, text="Predict Y:")
extra_offset_y_label.grid(row=0, column=0)
extra_offset_y_scale = ctk.CTkSlider(extra_offset_y_frame, from_=0, to=20, number_of_steps=20,
command=update_values)
extra_offset_y_scale.set(extra_offset_y)
extra_offset_y_scale.grid(row=0, column=1, padx=(4, 0))
extra_offset_y_label_text = ctk.CTkLabel(extra_offset_y_frame, textvariable=extra_offset_y_variable)
extra_offset_y_label_text.grid(row=0, column=2)
aimOffset_variable = tk.StringVar()
aimOffset_variable.set(str(aimOffset))
aimOffset_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
aimOffset_frame.grid(row=6, column=0, sticky='w', pady=2)
aimOffset_label = ctk.CTkLabel(aimOffset_frame, text="Aim:")
aimOffset_label.grid(row=0, column=1, sticky='w')
aimOffset_scale = ctk.CTkSlider(aimOffset_frame, from_=0, to=1, number_of_steps=100, command=update_values,
orientation="vertical")
aimOffset_scale.set(aimOffset)
aimOffset_scale.grid(row=0, column=2, padx=(12, 0))
aimOffset_label = ctk.CTkLabel(aimOffset_frame, text="Crotch")
aimOffset_label.grid(row=0, column=3, pady=(170, 0))
aimOffset_label = ctk.CTkLabel(aimOffset_frame, text="Abdomen")
aimOffset_label.grid(row=0, column=3, pady=(80, 0))
aimOffset_label = ctk.CTkLabel(aimOffset_frame, text="Chest")
aimOffset_label.grid(row=0, column=3, pady=(0, 5))
aimOffset_label = ctk.CTkLabel(aimOffset_frame, text="Head")
aimOffset_label.grid(row=0, column=3, pady=(0, 170))
aimOffset_label = ctk.CTkLabel(aimOffset_frame, image=ctk.CTkImage(img, size=(150, 200)), text="")
aimOffset_label.grid(row=0, column=4)
aimOffset_text = ctk.CTkLabel(aimOffset_frame, textvariable=aimOffset_variable)
aimOffset_text.grid(row=0, column=5, pady=(0, 0))
screen_width_scale_variable = tk.StringVar()
screen_width_scale_variable.set(str(screen_width))
screen_width_scale_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
screen_width_scale_frame.grid(row=7, column=0, sticky='w', pady=2)
screen_width_scale_label = ctk.CTkLabel(screen_width_scale_frame, text="Width:")
screen_width_scale_label.grid(row=0, column=1, sticky='w')
screen_width_scale = ctk.CTkSlider(screen_width_scale_frame, from_=100, to=2000, number_of_steps=190,
command=update_values)
screen_width_scale.set(screen_width)
screen_width_scale.grid(row=0, column=2, padx=(12, 0))
screen_width_scale_text = ctk.CTkLabel(screen_width_scale_frame, textvariable=screen_width_scale_variable)
screen_width_scale_text.grid(row=0, column=3)
if screenshot_mode:
ban_screen_width_scale = ctk.CTkLabel(screen_width_scale_frame, text="Disabled DXcam enabled", width=200)
ban_screen_width_scale.grid(row=0, column=2, padx=(12, 0))
ban_screen_width_scale_text = ctk.CTkLabel(screen_width_scale_frame, text="", width=30)
ban_screen_width_scale_text.grid(row=0, column=3)
screen_height_scale_variable = tk.StringVar()
screen_height_scale_variable.set(str(screen_height))
screen_height_scale_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
screen_height_scale_frame.grid(row=8, column=0, sticky='w', pady=2)
screen_height_scale_label = ctk.CTkLabel(screen_height_scale_frame, text="Height:")
screen_height_scale_label.grid(row=0, column=1, sticky='w')
screen_height_scale = ctk.CTkSlider(screen_height_scale_frame, from_=100, to=2000, number_of_steps=190,
command=update_values)
screen_height_scale.set(screen_height)
screen_height_scale.grid(row=0, column=2, padx=(12, 0))
screen_height_scale_text = ctk.CTkLabel(screen_height_scale_frame, textvariable=screen_height_scale_variable)
screen_height_scale_text.grid(row=0, column=3)
if screenshot_mode:
ban_screen_height_scale = ctk.CTkLabel(screen_height_scale_frame, text="Disabled DXcam enabled", width=200)
ban_screen_height_scale.grid(row=0, column=2, padx=(12, 0))
ban_screen_height_scale_text = ctk.CTkLabel(screen_height_scale_frame, text="", width=30)
ban_screen_height_scale_text.grid(row=0, column=3)
screenshot_mode_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
screenshot_mode_frame.grid(row=9, column=0, sticky='w', pady=5)
screenshot_mode_var = ctk.BooleanVar(value=screenshot_mode)
screenshot_mode_check = ctk.CTkCheckBox(screenshot_mode_frame, text='Enable DXcam ', variable=screenshot_mode_var,
command=update_values)
screenshot_mode_check.grid(row=0, column=1)
segmented_aiming_switch_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
segmented_aiming_switch_frame.grid(row=10, column=0, sticky='w', pady=5)
segmented_aiming_switch_var = ctk.BooleanVar(value=segmented_aiming_switch)
segmented_aiming_switch_check = ctk.CTkCheckBox(segmented_aiming_switch_frame, text='Enable segmented ', variable=segmented_aiming_switch_var,
command=update_values)
segmented_aiming_switch_check.grid(row=0, column=1)
stage1_scope_variable = tk.StringVar()
stage1_scope_variable.set(str(stage1_scope))
stage1_scope_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
stage1_scope_frame.grid(row=11, column=0, sticky='w', pady=2)
stage1_scope_label = ctk.CTkLabel(stage1_scope_frame, text="Strong range:")
stage1_scope_label.grid(row=0, column=1, sticky='w')
stage1_scope_scale = ctk.CTkSlider(stage1_scope_frame, from_=0, to=300, number_of_steps=300, command=update_values)
stage1_scope_scale.set(stage1_scope)
stage1_scope_scale.grid(row=0, column=2, padx=(12, 0))
stage1_scope_text = ctk.CTkLabel(stage1_scope_frame, textvariable=stage1_scope_variable)
stage1_scope_text.grid(row=0, column=3)
if not segmented_aiming_switch:
ban_screen_height_scale = ctk.CTkLabel(stage1_scope_frame, text="Segmented disabled", width=200)
ban_screen_height_scale.grid(row=0, column=2, padx=(12, 0))
ban_screen_height_scale_text = ctk.CTkLabel(stage1_scope_frame, text="", width=30)
ban_screen_height_scale_text.grid(row=0, column=3)
stage1_intensity_variable = tk.StringVar()
stage1_intensity_variable.set(str(stage1_intensity))
stage1_intensity_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
stage1_intensity_frame.grid(row=12, column=0, sticky='w', pady=2)
stage1_intensity_label = ctk.CTkLabel(stage1_intensity_frame, text="Strong speed:")
stage1_intensity_label.grid(row=0, column=1, sticky='w')
stage1_intensity_scale = ctk.CTkSlider(stage1_intensity_frame, from_=0, to=1, number_of_steps=100, command=update_values)
stage1_intensity_scale.set(stage1_intensity)
stage1_intensity_scale.grid(row=0, column=2, padx=(12, 0))
stage1_intensity_text = ctk.CTkLabel(stage1_intensity_frame, textvariable=stage1_intensity_variable)
stage1_intensity_text.grid(row=0, column=3)
if not segmented_aiming_switch:
ban_stage1_intensity_scale = ctk.CTkLabel(stage1_intensity_frame, text="Segmented disabled", width=200)
ban_stage1_intensity_scale.grid(row=0, column=2, padx=(12, 0))
ban_stage1_intensity_scale = ctk.CTkLabel(stage1_intensity_frame, text="", width=30)
ban_stage1_intensity_scale.grid(row=0, column=3)
stage2_scope_variable = tk.StringVar()
stage2_scope_variable.set(str(stage2_intensity))
stage2_scope_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
stage2_scope_frame.grid(row=13, column=0, sticky='w', pady=2)
stage2_scope_label = ctk.CTkLabel(stage2_scope_frame, text="Soft range:")
stage2_scope_label.grid(row=0, column=1, sticky='w')
stage2_scope_scale = ctk.CTkSlider(stage2_scope_frame, from_=0, to=300, number_of_steps=300, command=update_values)
stage2_scope_scale.set(stage2_scope)
stage2_scope_scale.grid(row=0, column=2, padx=(12, 0))
stage2_scope_text = ctk.CTkLabel(stage2_scope_frame, textvariable=stage2_scope_variable)
stage2_scope_text.grid(row=0, column=3)
if not segmented_aiming_switch:
ban_stage2_scope_scale = ctk.CTkLabel(stage2_scope_frame, text="Segmented disabled", width=200)
ban_stage2_scope_scale.grid(row=0, column=2, padx=(12, 0))
ban_stage2_scope_scale = ctk.CTkLabel(stage2_scope_frame, text="", width=30)
ban_stage2_scope_scale.grid(row=0, column=3)
stage2_intensity_variable = tk.StringVar()
stage2_intensity_variable.set(str(stage2_intensity))
stage2_intensity_frame = ctk.CTkFrame(tab_view.tab("Advanced"))
stage2_intensity_frame.grid(row=14, column=0, sticky='w', pady=2)
stage2_intensity_label = ctk.CTkLabel(stage2_intensity_frame, text="Soft speed:")
stage2_intensity_label.grid(row=0, column=1, sticky='w')
stage2_intensity_scale = ctk.CTkSlider(stage2_intensity_frame, from_=0, to=1, number_of_steps=100, command=update_values)
stage2_intensity_scale.set(stage2_intensity)
stage2_intensity_scale.grid(row=0, column=2, padx=(12, 0))
stage2_intensity_text = ctk.CTkLabel(stage2_intensity_frame, textvariable=stage2_intensity_variable)
stage2_intensity_text.grid(row=0, column=3)
if not segmented_aiming_switch:
ban_stage2_intensity_scale = ctk.CTkLabel(stage2_intensity_frame, text="Segmented disabled", width=200)
ban_stage2_intensity_scale.grid(row=0, column=2, padx=(12, 0))
ban_stage2_intensity_scale = ctk.CTkLabel(stage2_intensity_frame, text="", width=30)
ban_stage2_intensity_scale.grid(row=0, column=3)
setting_frame = ctk.CTkFrame(tab_view.tab("Other"), width=300, height=300)
setting_frame.grid(row=9, column=0, sticky='w', pady=2)
setting_frame.grid_propagate(False)
model_file_label = tk.Label(setting_frame, text="No model ", width=40, anchor='e')
model_file_label.grid(row=0, column=0, sticky="w")
model_file_button = ctk.CTkButton(setting_frame, text="Select model file ",
command=choose_model)
model_file_button.grid(row=1, column=0, padx=(0, 245), pady=(5, 0))
config_file_button = ctk.CTkButton(setting_frame, text="Open the config ",
command=open_settings_config)
config_file_button.grid(row=1, column=0, padx=(55, 0), pady=(5, 0))
save_button = ctk.CTkButton(setting_frame, text='Save settings', width=20, command=save_settings)
save_button.grid(row=2, column=0, padx=(0, 320), pady=(10, 0))
load_button = ctk.CTkButton(setting_frame, text='Load settings', width=20, command=load_settings,
state="DISABLED")
load_button.grid(row=2, column=0, padx=(0, 120), pady=(10, 0))
restart_button = ctk.CTkButton(setting_frame, text='Restart software', width=20, command=restart_program)
restart_button.grid(row=3, column=0, padx=(0, 320), pady=(10, 0))
version_number_text1 = ctk.CTkLabel(setting_frame, text="current version:", width=30)
version_number_text1.bind("<Button-1>", command=open_web)
version_number_text1.grid(row=3, column=0, padx=(10, 0), pady=(120, 0))
version_number1 = ctk.CTkLabel(setting_frame, text=version_number, width=30)
version_number1.bind("<Button-1>", command=open_web)
version_number1.grid(row=3, column=0, padx=(120, 0), pady=(120, 0))
version_number_text2 = ctk.CTkLabel(setting_frame, text="The latest version:", width=30)
version_number_text2.bind("<Button-1>", command=open_web)
version_number_text2.grid(row=4, column=0, padx=(10, 0), pady=(0, 0))
version_number2 = ctk.CTkLabel(setting_frame, text=":(", width=30)
version_number2.bind("<Button-1>", command=open_web)
version_number2.grid(row=4, column=0, padx=(120, 0), pady=(0, 0))
version = fetch_readme_version_number()
version_number2.configure(text=version)
if version == version_number1.cget("text"):
version_number2.configure(text=version, text_color="green")
else:
version_number2.configure(text=version, text_color="red")
image_label_frame = ctk.CTkFrame(tab_view.tab("Test"), height=370, width=305)
image_label_frame.grid(row=1, column=0, sticky='w')
image_label_frame.grid_propagate(False)
image_label_switch = ctk.CTkSwitch(image_label_frame, text="Internal Test (affects performance)", onvalue=True, offvalue=False,
command=update_values)
image_label_switch.grid(row=0, column=0, padx=(0, 0), sticky='w')
image_label = tk.Label(image_label_frame)
image_label.grid(row=1, column=0, padx=(0, 0))
image_label_FPSlabel = ctk.CTkLabel(image_label_frame, text="FPS:", width=40)
image_label_FPSlabel.grid(row=2, column=0, padx=(0, 0), sticky='w')
load_settings()
update_values()
# AntiRecoil Tab
antiRecoil_tab = tab_view.tab("AntiRecoil")
antiRecoil_layout = ctk.CTkFrame(antiRecoil_tab)
antiRecoil_layout.pack(fill="both", expand=True, padx=10, pady=10)
# Instructions Label
instructions = """
Recoil Controls:
- Home: On Off
- Enter: Save current profile.
- Up Arrow: Increase y_movement.
- Down Arrow: Decrease y_movement.
- Right Arrow: Increase x_movement.
- Left Arrow: Decrease x_movement.
- Page Up: Switch to the next profile.
- Page Down: Switch to the previous profile.
"""
instructions_label = ctk.CTkLabel(antiRecoil_layout, text=instructions, anchor="w", justify="left")
instructions_label.grid(row=0, column=0, sticky="w", pady=5)
root.mainloop()
def update_values(*args):
global aimbot, lockSpeed, triggerType, arduinoMode, lockKey, lockKey_var, confidence, closest_mouse_dist \
, closest_mouse_dist_scale, screen_width, screen_height, model_file, aimOffset, draw_center \
, mouse_Side_Button_Witch, lockSpeed_text, LookSpeed_label_1, test_images_GUI, target_selection_str \
, prediction_factor_scale, prediction_factor, method_of_prediction, extra_offset_x, extra_offset_y\
, screenshot_mode, segmented_aiming_switch, stage1_scope, stage1_scope_scale, stage1_intensity\
, stage1_intensity_scale, stage2_scope, stage2_scope_scale, stage2_intensity, stage2_intensity_scale\
, aimOffset_Magnification_x
print("update_values function was called(Configuration has been updated)")
aimbot = aimbot_var.get()
lockSpeed = lockSpeed_scale.get()
triggerType = triggerType_var.get()
arduinoMode = arduinoMode_var.get()
lockKey = lockKey_var.get()
target_selection_str = target_selection_var.get()
mouse_Side_Button_Witch = mouse_Side_Button_Witch_var.get()
confidence = confidence_scale.get()
closest_mouse_dist = closest_mouse_dist_scale.get()
screen_width = int(screen_width_scale.get())
screen_height = int(screen_height_scale.get())
aimOffset = aimOffset_scale.get()
# aimOffset_Magnification_x = aimOffset_Magnification_x_scale.get()
draw_center = draw_center_var.get()
test_images_GUI = image_label_switch.get()
prediction_factor = prediction_factor_scale.get()
method_of_prediction = method_of_prediction_var.get()
extra_offset_x = extra_offset_x_scale.get()
extra_offset_y = extra_offset_y_scale.get()
stage1_scope = stage1_scope_scale.get()
stage1_intensity = stage1_intensity_scale.get()
stage2_scope = stage2_scope_scale.get()
stage2_intensity = stage2_intensity_scale.get()
lockSpeed = round(lockSpeed_scale.get(), 2)
lockSpeed_variable.set(str(lockSpeed))
confidence = round(confidence_scale.get(), 2)
confidence_variable.set(str(confidence))
closest_mouse_dist = int(closest_mouse_dist_scale.get())
closest_mouse_dist_variable.set(str(closest_mouse_dist))
prediction_factor = round(prediction_factor_scale.get(), 2)
prediction_factor_variable.set(str(prediction_factor))
extra_offset_x = round(extra_offset_x_scale.get())
extra_offset_x_variable.set(str(extra_offset_x))
extra_offset_y = round(extra_offset_y_scale.get())
extra_offset_y_variable.set(str(extra_offset_y))
aimOffset = round(aimOffset_scale.get(), 2)
aimOffset_variable.set(str(aimOffset))
screen_width = int(screen_width_scale.get())
screen_width_scale_variable.set(str(screen_width))
screen_height = int(screen_height_scale.get())
screen_height_scale_variable.set(str(screen_height))
stage1_scope = int(stage1_scope_scale.get())
stage1_scope_variable.set(str(stage1_scope))
stage1_intensity = round(stage1_intensity_scale.get(), 2)
stage1_intensity_variable.set(str(stage1_intensity))
stage2_scope = int(stage2_scope_scale.get())
stage2_scope_variable.set(str(stage2_scope))
stage2_intensity = round(stage2_intensity_scale.get(), 2)
stage2_intensity_variable.set(str(stage2_intensity))
key = lockKey_var.get()
if key == 'left click':
lockKey = 0x01
elif key == 'Right click':
lockKey = 0x02
elif key == 'lower key':
lockKey = 0x05
def save_settings():
global model_file
new_settings = {
'aimbot': aimbot_var.get(),
'lockSpeed': lockSpeed_scale.get(),
'triggerType': triggerType_var.get(),
'arduinoMode': arduinoMode_var.get(),
'lockKey': lockKey_var.get(),
'mouse_Side_Button_Witch': mouse_Side_Button_Witch_var.get(),
'confidence': confidence_scale.get(),
'closest_mouse_dist': closest_mouse_dist_scale.get(),
'screen_width': screen_width_scale.get(),
'screen_height': screen_height_scale.get(),
'screenshot_mode': screenshot_mode_var.get(),
'segmented_aiming_switch': segmented_aiming_switch_var.get(),
'aimOffset': aimOffset_scale.get(),
'model_file': model_file,
'prediction_factor': prediction_factor_scale.get(),
'method_of_prediction': method_of_prediction_var.get(),
'extra_offset_x': extra_offset_x_scale.get(),
'extra_offset_y': extra_offset_y_scale.get(),
'stage1_intensity': stage1_intensity_scale.get(),
'stage1_scope': stage1_scope_scale.get(),
'stage2_intensity': stage2_intensity_scale.get(),
'stage2_scope': stage2_scope_scale.get(),
}
try:
with open('settings.json', 'r') as f:
current_settings = json.load(f)
except FileNotFoundError:
current_settings = {}
current_settings.update(new_settings)
with open('settings.json', 'w') as f:
json.dump(current_settings, f, sort_keys=True, indent=4)
def load_prefix_variables():
global model_file, screenshot_mode, segmented_aiming_switch, crawl_information
print('Loading prefix variables...')
try:
with open('settings.json', 'r') as f:
settings = json.load(f)
screenshot_mode = settings.get("screenshot_mode", False)
segmented_aiming_switch = settings.get("segmented_aiming_switch", False)
crawl_information = settings.get("crawl_information", False)
print("Prefix variables loaded successfully!")
except FileNotFoundError:
print('[ERROR] Settings file not found; skipping loading settings')
def load_settings():
global model_file, test_window_frame, screenshot_mode, crawl_information, DXcam_screenshot, dxcam_maxFPS, \
loaded_successfully, stage1_scope, stage1_intensity, stage2_scope, stage2_intensity, segmented_aiming_switch\
, aimOffset_Magnification_x
print('Loading settings...')
try:
with open('settings.json', 'r') as f:
settings = json.load(f)
aimbot_var.set(settings.get('aimbot', True))
lockSpeed_scale.set(settings.get('lockSpeed', 0.7))
triggerType_var.set(settings.get('triggerType', "press"))
arduinoMode_var.set(settings.get('arduinoMode', False))
lockKey_var.set(settings.get('lockKey', "left click"))
mouse_Side_Button_Witch_var.set(settings.get('mouse_Side_Button_Witch', True))
method_of_prediction_var.set(settings.get('method_of_prediction', "Disable prediction"))
confidence_scale.set(settings.get('confidence', 0.5))
extra_offset_x_scale.set(settings.get('extra_offset_x', 5))
extra_offset_y_scale.set(settings.get('extra_offset_y', 5))
prediction_factor_scale.set(settings.get('prediction_factor', 0.5))
closest_mouse_dist_scale.set(settings.get('closest_mouse_dist', 160))
screen_width_scale.set(settings.get('screen_width', 360))
screen_height_scale.set(settings.get('screen_height', 360))
aimOffset_scale.set(settings.get('aimOffset', 0.4))
aimOffset_Magnification_x = settings.get('aimOffset_Magnification_x', 0)
model_file = settings.get('model_file', None)
model_file_label.config(text=model_file or "No model file selected yet")
test_window_frame = settings.get('test_window_frame', False)
crawl_information = settings.get("crawl_information", True)
screenshot_mode = settings.get("screenshot_mode", False)
DXcam_screenshot = settings.get("DXcam_screenshot", 360)
dxcam_maxFPS = settings.get('dxcam_maxFPS', 30)
segmented_aiming_switch = settings.get('segmented_aiming_switch', False)
stage1_scope_scale.set(settings.get('stage1_scope', 50))
stage1_intensity_scale.set(settings.get('stage1_intensity', 0.8))
stage2_scope_scale.set(settings.get('stage2_scope', 170))
stage2_intensity_scale.set(settings.get('stage2_intensity', 0.4))
print("Settings loaded successfully!")
loaded_successfully = True
except FileNotFoundError:
print('[ERROR] Settings file not found; skipping loading settings')
pass
def calculate_distances(
monitor: dict, # A dictionary containing width and height of the monitor
results: list, # A list of object detection results
frame_: np.array, # The current frame to be processed
aimbot: bool, # Whether the aimbot is active or not
lockSpeed: float, # The speed at which the mouse should move towards the object
arduinoMode: bool, # Whether the Arudino mode is active or not
lockKey: int, # Lock Key code
triggerType: str, # Trigger type
):
global boxes, cWidth, cHeight, extra_offset_x, extra_offset_y
minDist = float('inf')
minBox = None
cWidth = monitor["width"] / 2
cHeight = monitor["height"] / 2
if draw_center:
if screenshot_mode:
cWidth = DXcam_screenshot // 2
cHeight = DXcam_screenshot // 2
if segmented_aiming_switch:
cv2.circle(frame_, (int(cWidth), int(cHeight)), int(stage2_scope), (255, 255, 255), 1)
cv2.circle(frame_, (int(cWidth), int(cHeight)), int(stage1_scope), (0, 255, 255), 1)
cv2.circle(frame_, (int(cWidth), int(cHeight)), radius=3, color=(0, 0, 255), thickness=-1)
else:
cv2.circle(frame_, (int(cWidth), int(cHeight)), int(closest_mouse_dist), (0, 255, 0), 1)
cv2.circle(frame_, (int(cWidth), int(cHeight)), radius=3, color=(0, 0, 255), thickness=-1)
for r in results:
boxes = r.boxes.xyxy.cpu().numpy()
print(boxes)
for box in boxes:
x1, y1, x2, y2 = box
centerx = (x1 + x2) / 2
centery = (y1 + y2) / 2
cv2.circle(frame_, (int(centerx), int(centery)), 3, (0, 255, 255), -1)
dist = sqrt((cWidth - centerx) ** 2 + (cHeight - centery) ** 2)
dist = round(dist, 1)
if segmented_aiming_switch:
if dist < minDist and dist < stage2_scope:
minDist = dist
minBox = box
else:
if dist < minDist and dist < closest_mouse_dist:
minDist = dist
minBox = box
location = (int(centerx), int(centery))
cv2.putText(frame_, f'dist: {dist}', location, cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 1)
if minBox is not None:
min_x1, min_y1, min_x2, min_y2 = minBox
cv2.rectangle(frame_, (int(minBox[0]), int(minBox[1])), (int(minBox[2]), int(minBox[3])), (255, 255, 255), 1)
center_text_x = int((minBox[0] + minBox[2]) / 2)
center_text_y = int((minBox[1] + minBox[3]) / 2)
location = (center_text_x, center_text_y)
cv2.putText(frame_, f'dist: {minDist}', location, cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 1)
box_centerx = (min_x1 + min_x2) / 2
box_centery = (min_y1 + min_y2) / 2
distance_to_top_border = box_centery - min_y1
distance_to_left_border = box_centerx - min_x1
aimOffset_y = distance_to_top_border * aimOffset
aimOffset_x = distance_to_left_border * aimOffset_Magnification_x
cv2.circle(frame_, (int(box_centerx - aimOffset_x), int(box_centery - aimOffset_y)), 3, (255, 0, 0), -1)
offset_centerx = box_centerx - aimOffset_x
offset_centery = box_centery - aimOffset_y
centerx = offset_centerx - cWidth
centery = offset_centery - cHeight
offset_dist = sqrt((cWidth - offset_centerx) ** 2 + (cHeight - offset_centery) ** 2)
offset_dist = round(offset_dist, 1)
offset_location = (int(offset_centerx), int(offset_centery))
cv2.putText(frame_, f'offset_dist: {offset_dist}', offset_location, cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 1)
if segmented_aiming_switch:
if offset_dist < stage1_scope:
lockSpeed = stage1_intensity
elif offset_dist < stage2_scope:
lockSpeed = stage2_intensity
if method_of_prediction == "Disable prediction":
print("已Disable prediction")
centerx *= lockSpeed
centery *= lockSpeed
pass
elif method_of_prediction == "Rate prediction":
print("Rate prediction is enabled")
centerx_extra = prediction_factor * centerx
centery_extra = prediction_factor * centery
centerx = (centerx + centerx_extra) * lockSpeed
centery = (centery + centery_extra) * lockSpeed
pass
elif method_of_prediction == "Pixel prediction":
extra_offset_x_result = extra_offset_x if centerx >= 0 else -extra_offset_x
extra_offset_y_result = extra_offset_y if centery >= 0 else -extra_offset_y
centerx = (centerx + extra_offset_x_result) * lockSpeed
centery = (centery + extra_offset_y_result) * lockSpeed
pass
lockKey_pressed = win32api.GetKeyState(lockKey) & 0x8000
shift_pressed = win32api.GetKeyState(win32con.VK_SHIFT) & 0x8000
xbutton2_pressed = win32api.GetKeyState(0x05) & 0x8000
if triggerType == "switch":
print(101)
if aimbot and (win32api.GetKeyState(lockKey) or (mouse_Side_Button_Witch and xbutton2_pressed)):
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(centerx * lockSpeed), int(centery * lockSpeed), 0,
0)
elif triggerType == "press":
print(102)
if aimbot and (lockKey_pressed or (mouse_Side_Button_Witch and xbutton2_pressed)):
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(centerx * lockSpeed), int(centery * lockSpeed), 0,
0)
elif not (lockKey_pressed or (mouse_Side_Button_Witch and xbutton2_pressed)):
pass
elif triggerType == "shift+press":
print(104)
if aimbot and ((lockKey_pressed and shift_pressed) or (mouse_Side_Button_Witch and xbutton2_pressed)):
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(centerx * lockSpeed), int(centery * lockSpeed), 0,
0)
elif not ((lockKey_pressed and shift_pressed) or (mouse_Side_Button_Witch and xbutton2_pressed)):
pass
return frame_
def main_program_loop(model):
global start_time, gc_time, closest_mouse_dist, lockSpeed, triggerType, arduinoMode, lockKey, confidence \
, run_threads, aimbot, image_label, test_images_GUI, target_selection, target_selection_str, target_mapping \
, target_selection_var, prediction_factor, should_break, readme_content
frame_counter = 0
start_time = time.time()
while True:
print("Waiting for loading to complete")
if loaded_successfully:
DXcam()
break