import ctypes
import os
import keyboard
import time
import win32api,win32gui
import mss #ekran görüntüsü alma
import PIL.ImageGrab
import PIL.Image
import winsound
import pyautogui
import threading
from interception import * #interception
from consts import * #interception
S_HEIGHT, S_WIDTH = (PIL.ImageGrab.grab().size)
def approx(r, g ,b):
return 250 - 60 < r < 250 + 60 and 100 - 60 < g < 100 + 60 and 250 - 60 < b < 250 + 60
def aimassist():
global bAimLock
c = interception()
c.set_filter(interception.is_mouse,interception_mouse_state.INTERCEPTION_MOUSE_LEFT_BUTTON_DOWN.value)
while True:
hWnd = win32gui.FindWindow(None,"VALORANT ")
if(hWnd == win32gui.GetForegroundWindow()):
device = c.wait()
stroke = c.receive(device)
img = aimlock_grab()
try:
for x in range(0,40):
for y in range(0,40):
r,g,b = img.getpixel((x,y))
if approx(r,g,b):
raise Found
except Found:
if type(stroke) is mouse_stroke:
if(bAimLock == True):
stroke.y = y
c.send(device,stroke)
else:
device = c.wait()
stroke = c.receive(device)
c.send(device,stroke)
#c._destroy_context()
def aimlock_grab():
with mss.mss() as sct:
box = (950, 530, 990, 570) # box of 20x20 pixel around the crosshair
img = sct.grab(box)
return PIL.Image.frombytes('RGB',img.size,img.bgra,'raw','BGRX')
def grab():
with mss.mss() as sct:
box = (950, 530, 970, 550) # box of 20x20 pixel around the crosshair
img = sct.grab(box)
return PIL.Image.frombytes('RGB',img.size,img.bgra,'raw','BGRX')