Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
wissemzidi authored Aug 8, 2023
1 parent 423a0c8 commit 2ba7d23
Show file tree
Hide file tree
Showing 7 changed files with 453 additions and 0 deletions.
126 changes: 126 additions & 0 deletions ACV.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
from pynput.keyboard import Listener as keyboardListener
from pynput.mouse import Controller, Button
from PyQt5.QtWidgets import QApplication
from pyautogui import screenshot
from os import startfile, path
from PyQt5.uic import loadUi
from threading import Thread
from time import sleep
from sys import exit
import json


def keyPress(key):
if str(key) == "<67>":
main()
listener.stop()


def main():
mouse = Controller()
if not path.exists("./champ.txt"):
open("./champ.txt", "w").write("champNameHere")
startfile("champ.txt")
exit()

with open("./champ.txt", "r") as f:
fav_champ = str(f.readline().strip()).lower()

lockBtnPos = (950, 800) # old (770, 655)
newPos = (0, 0)
basePos = (540, 925)
squareXDiff = 85
squareYDiff = 65

if fav_champ in allAgents:
agentsLineOrder = len(allAgents) // 2
newPos = (
540 + (allAgents.index(fav_champ) % agentsLineOrder) * squareXDiff,
925 + (allAgents.index(fav_champ) // agentsLineOrder) * squareYDiff,
)

if newPos != (0, 0):
sleep(0.1)
mouse.position = newPos
mouse.click(Button.left, 2)
sleep(0.1)
mouse.position = lockBtnPos
sleep(0.1)
mouse.click(Button.left, 1)
else:
startfile("champ.txt")
exit()


def initScreenListenerThread():
global screenListenerThread
screenListenerThread = Thread(target=initialiseScreenListener, daemon=True).start()


def initialiseScreenListener():
while True:
im = screenshot()
validPixels = 1
for i in range(pixelsPositions.__len__()):
pixelColor = im.getpixel(pixelsPositions[i])
if pixelsColors[i] == pixelColor:
validPixels += 1
else:
break
if validPixels == 4:
listener.stop()
main()
break
exit()
sleep(0.05)


def changeAgent():
newAgent = fen.agentName.text()
if newAgent in allAgents and path.exists("./champ.txt"):
with open("./champ.txt", "w") as f:
f.write(fen.agentName.text())
else:
fen.agentName.setText("agent not valid !")


############## Main Program ##############


App = QApplication([])
fen = loadUi("userInterface.ui")

global allAgents
# get config data from "config.json"
with open("config.json", "r") as f:
data = json.loads(f.read())
allAgents = data["agents"]
agentsPreferredMap = data["preferredAgentMap"]
mapsPixelsColors = data["mapsPixelsColors"]
pixelsPositions = list(tuple(pointPos) for pointPos in data["pointsPos"])
maps = list(agentsPreferredMap.keys())
print(pixelsPositions)

exit()

if path.exists("./champ.txt"):
with open("./champ.txt", "r") as f:
fav_champ = str(f.readline().strip()).lower()
if len(fav_champ) > 0:
fen.agentName.setText(fav_champ)

fen.initialiseBtn.clicked.connect(initScreenListenerThread)
fen.selectBtn.clicked.connect(changeAgent)
fen.exitBtn.clicked.connect(exit)


pixelsPositions = [(0, 100), (0, 200), (0, 300), (0, 400)]
pixelsColors = [(55, 168, 227), (68, 174, 226), (89, 178, 227), (106, 177, 222)]

global listener
listener = keyboardListener(on_press=keyPress)
listener.start()


fen.show()
App.exec()
81 changes: 81 additions & 0 deletions build.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"version": "auto-py-to-exe-configuration_v1",
"pyinstallerOptions": [
{
"optionDest": "noconfirm",
"value": true
},
{
"optionDest": "filenames",
"value": "D:/code/projects/auto champ (valorant) selector/source_code/ACV.py"
},
{
"optionDest": "onefile",
"value": false
},
{
"optionDest": "console",
"value": true
},
{
"optionDest": "icon_file",
"value": "D:/code/projects/auto champ (valorant) selector/source_code/icon.ico"
},
{
"optionDest": "ascii",
"value": false
},
{
"optionDest": "clean_build",
"value": false
},
{
"optionDest": "strip",
"value": false
},
{
"optionDest": "noupx",
"value": false
},
{
"optionDest": "disable_windowed_traceback",
"value": false
},
{
"optionDest": "embed_manifest",
"value": true
},
{
"optionDest": "uac_admin",
"value": false
},
{
"optionDest": "uac_uiaccess",
"value": false
},
{
"optionDest": "win_private_assemblies",
"value": false
},
{
"optionDest": "win_no_prefer_redirects",
"value": false
},
{
"optionDest": "bootloader_ignore_signals",
"value": false
},
{
"optionDest": "argv_emulation",
"value": false
},
{
"optionDest": "datas",
"value": "D:/code/projects/auto champ (valorant) selector/source_code/champ.txt;."
}
],
"nonPyinstallerOptions": {
"increaseRecursionLimit": true,
"manualArguments": ""
}
}
1 change: 1 addition & 0 deletions champ.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kay/o
61 changes: 61 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"preferredAgentMap": {
"Ascent": "astra",
"Bind": "breach",
"Breeze": "brimstone",
"Fracture": "",
"Haven": "",
"Icebox": "",
"Pearl": "",
"Split": ""
},

"pointsPos": [
[0, 100],
[0, 200],
[0, 300],
[0, 400]
],

"mapsPixelsColors": {
"Ascent": [
[55, 168, 227],
[68, 174, 226],
[89, 178, 227],
[106, 177, 222],
[0, 0, 0]
],
"Bind": [],
"Breeze": [],
"Fracture": [],
"Haven": [],
"Icebox": [],
"Pearl": [],
"Split": []
},

"agents": [
"astra",
"breach",
"brimstone",
"chamber",
"cypher",
"deadlock",
"fade",
"gekko",
"harbor",
"jett",
"kay/o",
"killjoy",
"neon",
"omen",
"phoenix",
"raze",
"reyna",
"sage",
"skye",
"sova",
"viper",
"yoru"
]
}
Binary file added icon.ico
Binary file not shown.
17 changes: 17 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from pynput.mouse import Controller, Button
from time import sleep


sleep(2)
mouse = Controller()

mouse.position = (770, 655)
# mouse.position = (435 + 65 + 65, 740 + 65)
# mouse.position = (435 + 65 + 65, 740 + 65)
exit()

i = 1
while True:
print(f"{i} : ", mouse.position)
i += 1
sleep(1)
Loading

0 comments on commit 2ba7d23

Please sign in to comment.