Skip to content

Commit 07eba83

Browse files
committed
removed features, better performance
1 parent 934b987 commit 07eba83

File tree

2 files changed

+43
-83
lines changed

2 files changed

+43
-83
lines changed

grabber.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import clr
1313
# change this to wherever your built DLL is
14-
clr.AddReference('location\\DLL\\ClassLibrary1\\ClassLibrary1.dll')
14+
clr.AddReference('CHANGE THIS TO THE REST OF THE PATH OF YOUR DIRECTORY\\DLL\\ClassLibrary1\\ClassLibrary1.dll')
1515
from ClassLibrary1 import Class1
1616
ud_mouse = Class1()
1717
ud_mouse.Run_Me()
@@ -80,7 +80,6 @@ def detect_contours(self, frame, minimum_size):
8080
return large_contours
8181

8282
def scale_contour(self,cnt, scale:float):
83-
"""Calculates an hitbox for the triggerbot."""
8483
M = cv2.moments(cnt)
8584
x = int(M['m10']/M['m00'])
8685
y = int(M['m01']/M['m00'])
@@ -93,7 +92,6 @@ def scale_contour(self,cnt, scale:float):
9392
return cnt_scaled
9493

9594
def on_target(self, contour, hitbox):
96-
"""Calculates if the crosshair is on the trigger hitbox."""
9795
for c in contour:
9896
cont = self.scale_contour(c, hitbox)
9997
test = cv2.pointPolygonTest(cont,( self.box_middle, self.box_middle),False)
@@ -124,38 +122,34 @@ def compute_centroid(self, contour):
124122

125123

126124
def is_activated(self, key_code) -> bool:
127-
"""listens for hotkeys."""
128125
return ud_mouse.is_activated(key_code)
129126

130-
131-
# functions below communicate with the wrapper for interception which handles the inputs
132-
133127
def move_mouse(self, x, y):
134128
threading.Thread(target=self._move_mouse, args=[x, y, self.x_multiplier, self.y_multiplier, self.y_difference]).start()
135129

136130
def _move_mouse(self, x, y, x_multiplier, y_multiplier, y_difference):
137131
ud_mouse.move_mouse(x, y, self.box_size, x_multiplier, y_multiplier, y_difference)
138132

139-
def shift(self):
140-
threading.Thread(target= self._shift).start()
133+
#def shift(self):
134+
# threading.Thread(target= self._shift).start()
141135

142-
def _shift(self):
143-
ud_mouse.simulate_shift()
144-
time.sleep(self.sleep)
136+
#def _shift(self):
137+
# ud_mouse.simulate_shift()
138+
# time.sleep(self.sleep)
145139

146-
def E(self):
147-
threading.Thread(target= self._E).start()
140+
#def E(self):
141+
# threading.Thread(target= self._E).start()
148142

149-
def _E(self):
150-
ud_mouse.simulate_E()
151-
time.sleep(self.sleep)
143+
#def _E(self):
144+
# ud_mouse.simulate_E()
145+
# time.sleep(self.sleep)
152146

153147
def mouse_right(self):
154148
threading.Thread(target= self._mouse_right).start()
155149

156150
def _mouse_right(self):
157151
ud_mouse.rclick_mouse()
158-
time.sleep(self.sleep)
152+
#time.sleep(self.sleep)
159153

160154
def click(self):
161155
threading.Thread(target=self._click).start()

main.py

Lines changed: 31 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
from grabber import *
23
import time
34
from os import system
@@ -7,69 +8,62 @@
78
import os
89
import cv2
910
import threading
11+
#from settings import *
1012
#from predict import *
1113
#from overlay import *
1214

1315
# fov, over 290 will break shit,
1416
fov = 160
1517
# lower to get more fps but worse performance
16-
fps = 144
17-
18+
fps = 72
1819
# list of virtual keys: https://learn.microsoft.com/windows/win32/inputdev/virtual-key-codes
19-
2020
# default = mouse1
2121
aim_key = 0x01
2222

23-
#shoots if enemies are detected inside the crosshair
24-
trigger_key = 0x39
23+
# default = v
24+
trigger_key = 0x12
2525

26-
27-
# hitbox size for the triggerbots
2826
hitbox_size = 0.6
2927

30-
# sleep for the triggerbots
31-
sleep = 0
3228

33-
# aim assist on the triggerbot
34-
trigger_magnet = True
29+
# DO NOT SET THIS TO 0 YOU LL HAVE MASSIVE FRAME DROPS
30+
sleep = 1
3531

36-
# speed of the aim assist on triggerbot (x_multiplies*magnet_accel, y_multiplies*(magnet_accel/2))
37-
magnet_accel = 2
32+
magnet_accel = 1.2
3833

39-
# triggerbot and magnet settings for different abilities
40-
right_click_key = 0x56
34+
right_click_key = 0x12
4135
right_click_magnet = True
4236

4337
shift_key = 0
4438
shift_magnet = False
4539

46-
47-
E_key = 0
40+
E_key = None
4841
E_magnet = False
4942

5043
grabber = Grabber(
5144
# x and y accel. higher = faster
52-
x_multiplier = 0.22,
53-
y_multiplier = 0.08,
54-
# delta of the y axis, change this in order to shoot higher/ lower
45+
x_multiplier = 0.60,
46+
y_multiplier = 0.14,
47+
# idk this shit is supposed to set the height of where u aim but I think its broken
5548
y_difference = 6,
56-
5749
trigger_sleep = sleep
5850

5951
)
6052

6153

54+
#################################################################################################
55+
#################################################################################################
56+
#################################################################################################
6257
#################################################################################################
6358

6459
#obj_flow = Prediction()
6560
#prediction.screen_size(fov)
6661

67-
# creates a camera of the specified size (fov = 150 then camera will be 150x150 pixels)
6862
left, top = (1920 - fov) // 2, (1080 - fov) // 2
6963
right, bottom = left + fov, top + fov
7064
region = (left, top, right, bottom)
7165
time.sleep(1)
72-
camera = dxcam.create(region=region, output_color="BGR", max_buffer_len=60)
66+
camera = dxcam.create(region=region, output_color="BGR")
7367
camera.start(target_fps=fps)
7468

7569

@@ -88,50 +82,22 @@
8882

8983
Dababy = True
9084
PID = os.getpid()
85+
count = 0
9186

92-
93-
# main loop, processes new frames, if enemies are detected listens to hotkeys
94-
# to perform related features
9587
while True:
96-
88+
9789
og = np.array(camera.get_latest_frame())
98-
frame = grabber.process_frame(og)
99-
contours = grabber.detect_contours(frame, 900)
90+
if grabber.is_activated(aim_key):
91+
frame = grabber.process_frame(og)
92+
contours = grabber.detect_contours(frame, 100)
93+
if contours:
94+
rec, x, y = grabber.compute_centroid(contours)
10095

101-
if contours:
102-
rec, x, y = grabber.compute_centroid(contours)
103-
if grabber.is_activated(aim_key):
10496
grabber.move_mouse(x, y)
105-
106-
107-
if grabber.is_activated(trigger_key):
108-
if trigger_magnet:
109-
grabber.move_mouse(x*magnet_accel, y*(magnet_accel/2))
110-
if grabber.on_target(contours, hitbox_size):
111-
grabber.trigger()
112-
113-
114-
if grabber.is_activated(shift_key):
115-
if shift_magnet:
116-
grabber.move_mouse(x*magnet_accel, y*(magnet_accel/2))
117-
if grabber.on_target(contours, hitbox_size):
118-
grabber.shift()
119-
120-
121-
if grabber.is_activated(E_key):
122-
if shift_magnet:
123-
grabber.move_mouse(x*magnet_accel, y*(magnet_accel/2))
124-
125-
if grabber.on_target(contours, hitbox_size):
126-
grabber.E()
127-
128-
129-
if grabber.is_activated(right_click_key):
130-
if right_click_magnet:
131-
grabber.move_mouse(x*magnet_accel, y*(magnet_accel/2))
132-
if grabber.on_target(contours, hitbox_size):
133-
grabber.mouse_right()
134-
135-
136-
137-
97+
98+
if grabber.is_activated(trigger_key):
99+
frame = grabber.process_frame(og)
100+
contours = grabber.detect_contours(frame, 100)
101+
if contours:
102+
if grabber.on_target(contours, hitbox_size):
103+
grabber.trigger()

0 commit comments

Comments
 (0)