Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Sam authored and Matt Sam committed Jul 25, 2021
1 parent 900fbeb commit 373a208
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
11 changes: 6 additions & 5 deletions AI_M_BOT(opencv+yolo)/AI_M_BOT_X1.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def control_mouse(a, b, fps_var, ranges, rate, go_fire, win_class, move_rx, move
if enhanced_holdback[1]:
win32gui.SystemParametersInfo(SPI_SETMOUSE, [0, 0, 0], 0)

if fps_var and guide_to_target[0]:
if fps_var and arr[17]:
if move_range > 5 * ranges:
b = uniform(0.7 * b, 1.3 * b)
a /= DPI_Var
Expand Down Expand Up @@ -428,9 +428,9 @@ def check_status(exit0, mouse):
mouse = 0
arr[15] = 0
if GetAsyncKeyState(0x46): # F
guide_to_target[0] = True
arr[17] = 1
if GetAsyncKeyState(0x4A): # J
guide_to_target[0] = False
arr[17] = 0
if GetAsyncKeyState(VK_MENU) and platform != 'win32': # Alt
win_cap.update_window_info()
if GetAsyncKeyState(0x50): # P
Expand Down Expand Up @@ -461,7 +461,7 @@ def show_frames(output_pipe, array):
show_str1 = 'Detected ' + str('{:02.0f}'.format(array[11])) + ' targets'
show_str2 = 'Aiming at ' + fire_target_show[array[12]] + ' position'
show_str3 = 'Fire rate is at ' + str('{:02.0f}'.format((10000 / (array[13] + 306)))) + ' RPS'
show_str4 = 'Please enjoy coding ^_^'
show_str4 = 'Please enjoy coding ^_^' if array[17] else 'Please enjoy coding @_@'
if show_img.any():
show_img = cv2.resize(show_img, (array[5], array[5]))
img_ex = cv2.resize(img_ex, (array[5], int(array[5] / 2)))
Expand Down Expand Up @@ -558,7 +558,6 @@ def detection2(que, array):
test_win = [False]
move_record_x = []
move_record_y = []
guide_to_target = [True]

# 如果文件不存在则退出
check_file('yolov4-tiny')
Expand All @@ -583,6 +582,7 @@ def detection2(que, array):
14 敌人近否
15 所持武器
16 指向身体
17 自瞄自火
'''

show_proc = Process(target=show_frames, args=(frame_output, arr,))
Expand All @@ -601,6 +601,7 @@ def detection2(que, array):
arr[14] = 0 # 敌人近否
arr[15] = 0 # 所持武器(0无1主2副)
arr[16] = 0 # 指向身体
arr[17] = 1 # 自瞄/自火
detect1_proc = Process(target=detection1, args=(queue, arr, frame_input,))
if not MP_setting:
detect2_proc = Process(target=detection2, args=(queue, arr,))
Expand Down
11 changes: 6 additions & 5 deletions AI_M_BOT(opencv+yolo)/AI_M_BOT_X2.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def control_mouse(a, b, fps_var, ranges, rate, go_fire, win_class, move_rx, move
if enhanced_holdback[1]:
win32gui.SystemParametersInfo(SPI_SETMOUSE, [0, 0, 0], 0)

if fps_var and guide_to_target[0]:
if fps_var and arr[17]:
if move_range > 5 * ranges:
b = uniform(0.7 * b, 1.3 * b)
a /= DPI_Var
Expand Down Expand Up @@ -451,9 +451,9 @@ def check_status(exit0, mouse):
mouse = 0
arr[15] = 0
if GetAsyncKeyState(0x46): # F
guide_to_target[0] = True
arr[17] = 1
if GetAsyncKeyState(0x4A): # J
guide_to_target[0] = False
arr[17] = 0
if GetAsyncKeyState(VK_MENU) and platform != 'win32': # Alt
win_cap.update_window_info()
if GetAsyncKeyState(0x50): # P
Expand Down Expand Up @@ -484,7 +484,7 @@ def show_frames(output_pipe, array):
show_str1 = 'Detected ' + str('{:02.0f}'.format(array[11])) + ' targets'
show_str2 = 'Aiming at ' + fire_target_show[array[12]] + ' position'
show_str3 = 'Fire rate is at ' + str('{:02.0f}'.format((10000 / (array[13] + 306)))) + ' RPS'
show_str4 = 'Please enjoy coding ^_^'
show_str4 = 'Please enjoy coding ^_^' if array[17] else 'Please enjoy coding @_@'
if show_img.any():
show_img = cv2.resize(show_img, (array[5], array[5]))
img_ex = cv2.resize(img_ex, (array[5], int(array[5] / 2)))
Expand Down Expand Up @@ -581,7 +581,6 @@ def detection2(que, array):
test_win = [False]
move_record_x = []
move_record_y = []
guide_to_target = [True]

# 如果文件不存在则退出
check_file('yolov4-tiny')
Expand All @@ -606,6 +605,7 @@ def detection2(que, array):
14 敌人近否
15 所持武器
16 指向身体
17 自瞄自火
'''

show_proc = Process(target=show_frames, args=(frame_output, arr,))
Expand All @@ -624,6 +624,7 @@ def detection2(que, array):
arr[14] = 0 # 敌人近否
arr[15] = 0 # 所持武器(0无1主2副)
arr[16] = 0 # 指向身体
arr[17] = 1 # 自瞄/自火
detect1_proc = Process(target=detection1, args=(queue, arr, frame_input,))
if not MP_setting:
detect2_proc = Process(target=detection2, args=(queue, arr,))
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
* 脚本正常工作时桌面左上角会显示截屏识别区域小视频![image](PDF_Images/自瞄显示图像.png)
* 按"1"/"2"键保持自瞄状态并控制鼠标
* 按"3"/"4"键保持自瞄状态但不控制鼠标
* 按"j"开启自动开火模式(不控制鼠标移动)
* 按"f"恢复自瞄模式
* 按"p"键重启程序
* 按"END"结束程序
* 自瞄只截屏识别准星附近区域,对于16:9的CF游戏窗口识别区域大小为(高=游戏窗口高*3/5,宽=高*4/3)
Expand Down
Binary file modified README.pdf
Binary file not shown.

0 comments on commit 373a208

Please sign in to comment.