49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
from win32api import GetAsyncKeyState
|
|
|
|
from hack import Hack
|
|
|
|
|
|
class Fov(Hack):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
|
|
self.__fov = None
|
|
self.__factor = 5
|
|
|
|
def fov(self) -> None:
|
|
# Aliases
|
|
mem = self.pm
|
|
offset = self.offsets
|
|
|
|
# Get module addresses
|
|
client = self.find_module("client")
|
|
|
|
# Get local player
|
|
local_player = self.find_uint(client, offset["dwLocalPlayer"])
|
|
|
|
# Get FOV
|
|
self.__fov = self.find_uint(local_player, offset["m_iDefaultFOV"])
|
|
|
|
def cheat():
|
|
if self.__fov == None:
|
|
raise ValueError("FOV isn't defined.")
|
|
fov = self.__fov
|
|
|
|
# Reset FOV
|
|
if GetAsyncKeyState(self.vmap["END"]):
|
|
self.__fov = 90
|
|
|
|
# Increase FOV
|
|
elif GetAsyncKeyState(self.vmap["PAGE_DOWN"]) and self.__fov < 130:
|
|
self.__fov += self.__factor
|
|
|
|
# Decrease FOV
|
|
elif GetAsyncKeyState(self.vmap["PAGE_UP"]) and self.__fov > 50:
|
|
self.__fov -= self.__factor
|
|
|
|
# If modified
|
|
if fov != self.__fov:
|
|
mem.write_int(
|
|
local_player + offset["m_iDefaultFOV"], self.__fov)
|
|
|
|
self.hack_loop(cheat)
|