use internal vmapping
This commit is contained in:
parent
8089657e3c
commit
aaaa21e04c
2 changed files with 12 additions and 4 deletions
7
cheat.py
7
cheat.py
|
@ -1,5 +1,4 @@
|
||||||
from win32api import GetAsyncKeyState
|
from win32api import GetAsyncKeyState
|
||||||
from win32con import EM_LINEINDEX, LOCKF_PHYSICAL_LOCK, VK_SPACE
|
|
||||||
|
|
||||||
from hack import Hack, sleep
|
from hack import Hack, sleep
|
||||||
from utils import Vec, angle_fixer, calculate_angle, hypot
|
from utils import Vec, angle_fixer, calculate_angle, hypot
|
||||||
|
@ -32,7 +31,7 @@ class Cheat(Hack):
|
||||||
|
|
||||||
def cheat():
|
def cheat():
|
||||||
# Pressing space bar
|
# Pressing space bar
|
||||||
if not GetAsyncKeyState(VK_SPACE):
|
if not GetAsyncKeyState(self.vmap["SPACE"]):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if player is alive
|
# Check if player is alive
|
||||||
|
@ -162,7 +161,7 @@ class Cheat(Hack):
|
||||||
|
|
||||||
def cheat():
|
def cheat():
|
||||||
# Pressing trigger key
|
# Pressing trigger key
|
||||||
if not GetAsyncKeyState(EM_LINEINDEX):
|
if not GetAsyncKeyState(self.vmap["+"]):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if player is alive
|
# Check if player is alive
|
||||||
|
@ -271,7 +270,7 @@ class Cheat(Hack):
|
||||||
|
|
||||||
def cheat():
|
def cheat():
|
||||||
# Pressing left click
|
# Pressing left click
|
||||||
if not GetAsyncKeyState(LOCKF_PHYSICAL_LOCK):
|
if not GetAsyncKeyState(self.vmap["LBUTTON"]):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Where are the eyes
|
# Where are the eyes
|
||||||
|
|
9
hack.py
9
hack.py
|
@ -11,6 +11,7 @@ class Hack():
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
# Loading offsets
|
# Loading offsets
|
||||||
self.offsets = self._find_offsets()
|
self.offsets = self._find_offsets()
|
||||||
|
self.vmap = self._find_keys()
|
||||||
|
|
||||||
self.pm = self._find_process(True)
|
self.pm = self._find_process(True)
|
||||||
|
|
||||||
|
@ -41,6 +42,14 @@ class Hack():
|
||||||
"head_z": 0x2C,
|
"head_z": 0x2C,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _find_keys(self) -> dict[str, int]:
|
||||||
|
"""https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes"""
|
||||||
|
return {
|
||||||
|
"SPACE": 0x20,
|
||||||
|
"+": 0xBB,
|
||||||
|
"LBUTTON": 0x01,
|
||||||
|
}
|
||||||
|
|
||||||
def _find_process(self, verbose: bool = False) -> Pymem:
|
def _find_process(self, verbose: bool = False) -> Pymem:
|
||||||
"""Find game process"""
|
"""Find game process"""
|
||||||
process_found = False
|
process_found = False
|
||||||
|
|
Reference in a new issue