Add unloaders (fov, noflash, chams)
This commit is contained in:
parent
c60da06989
commit
0f5f9538bb
3 changed files with 85 additions and 12 deletions
|
@ -8,16 +8,21 @@ class Chams(Hack):
|
|||
def __init__(self, **kwargs) -> None:
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.__color = Color3i(255, 255, 0)
|
||||
self.__color = (Color3i(255, 255, 0), 5.)
|
||||
self.__default_color = None
|
||||
|
||||
def chams(self) -> None:
|
||||
# Aliases
|
||||
mem = self.pm
|
||||
offset = self.offsets
|
||||
color = self.__color[0]
|
||||
brightness = self.__color[1]
|
||||
|
||||
# Get module addresses
|
||||
client = self.find_module("client")
|
||||
engine = self.find_module("engine")
|
||||
self.__client = self.find_module("client")
|
||||
self.__engine = self.find_module("engine")
|
||||
client = self.__client
|
||||
engine = self.__engine
|
||||
|
||||
# Get local player
|
||||
local_player = self.find_uint(client, offset["dwLocalPlayer"])
|
||||
|
@ -40,20 +45,32 @@ class Chams(Hack):
|
|||
i = mem.read_int(
|
||||
entity + offset["m_iGlowIndex"]) * offset["glow_obj_size"]
|
||||
|
||||
if not self.__default_color:
|
||||
self.__default_color = (
|
||||
Color3i(
|
||||
mem.read_uint(
|
||||
entity + offset["m_clrRender"] + offset["render_R"]),
|
||||
mem.read_uint(
|
||||
entity + offset["m_clrRender"] + offset["render_G"]),
|
||||
mem.read_uint(
|
||||
entity + offset["m_clrRender"] + offset["render_B"])
|
||||
),
|
||||
mem.read_int(engine + offset["model_ambient_min"])
|
||||
)
|
||||
|
||||
# Change color
|
||||
if self.__color.r > 0:
|
||||
if color.r > 0:
|
||||
mem.write_uint(
|
||||
entity + offset["m_clrRender"] + offset["render_R"], self.__color.r)
|
||||
if self.__color.g > 0:
|
||||
entity + offset["m_clrRender"] + offset["render_R"], color.r)
|
||||
if color.g > 0:
|
||||
mem.write_uint(
|
||||
entity + offset["m_clrRender"] + offset["render_G"], self.__color.g)
|
||||
if self.__color.b > 0:
|
||||
entity + offset["m_clrRender"] + offset["render_G"], color.g)
|
||||
if color.b > 0:
|
||||
mem.write_uint(
|
||||
entity + offset["m_clrRender"] + offset["render_B"], self.__color.b)
|
||||
entity + offset["m_clrRender"] + offset["render_B"], color.b)
|
||||
|
||||
# Override the brightness of models by increasing
|
||||
# the minimal brightness value
|
||||
brightness = 5.
|
||||
mem.write_int(
|
||||
engine + offset["model_ambient_min"],
|
||||
int.from_bytes(pack("f", brightness), byteorder='little') ^ (
|
||||
|
@ -61,3 +78,34 @@ class Chams(Hack):
|
|||
)
|
||||
|
||||
self.hack_loop(cheat)
|
||||
|
||||
def chams_unload(self):
|
||||
# Aliases
|
||||
mem = self.pm
|
||||
offset = self.offsets
|
||||
color = self.__default_color[0]
|
||||
brightness = self.__default_color[1]
|
||||
client = self.__client
|
||||
engine = self.__engine
|
||||
|
||||
# Loop all entities
|
||||
for i in range(1, 32): # 0 is world
|
||||
entity = mem.read_uint(
|
||||
client + offset["dwEntityList"] + i * offset["entity_size"])
|
||||
|
||||
# Ignore if entity doesn't exist
|
||||
if not entity:
|
||||
continue
|
||||
|
||||
# Reset to default value if needed
|
||||
if color.r > 0:
|
||||
mem.write_uint(
|
||||
entity + offset["m_clrRender"] + offset["render_R"], color.r)
|
||||
if color.g > 0:
|
||||
mem.write_uint(
|
||||
entity + offset["m_clrRender"] + offset["render_G"], color.g)
|
||||
if color.b > 0:
|
||||
mem.write_uint(
|
||||
entity + offset["m_clrRender"] + offset["render_B"], color.b)
|
||||
|
||||
mem.write_int(engine + offset["model_ambient_min"], brightness)
|
||||
|
|
|
@ -9,6 +9,7 @@ class Fov(Hack):
|
|||
|
||||
self.__fov = None
|
||||
self.__factor = 5
|
||||
self.__default_fov = 90
|
||||
|
||||
def fov(self) -> None:
|
||||
# Aliases
|
||||
|
@ -19,7 +20,8 @@ class Fov(Hack):
|
|||
client = self.find_module("client")
|
||||
|
||||
# Get local player
|
||||
local_player = self.find_uint(client, offset["dwLocalPlayer"])
|
||||
self.__local_player = self.find_uint(client, offset["dwLocalPlayer"])
|
||||
local_player = self.local_player
|
||||
|
||||
# Get FOV
|
||||
self.__fov = self.find_uint(local_player, offset["m_iDefaultFOV"])
|
||||
|
@ -48,3 +50,14 @@ class Fov(Hack):
|
|||
local_player + offset["m_iDefaultFOV"], self.__fov)
|
||||
|
||||
self.hack_loop(cheat)
|
||||
|
||||
def fov_unload(self):
|
||||
# Aliases
|
||||
mem = self.pm
|
||||
offset = self.offsets
|
||||
local_player = self.__local_player
|
||||
|
||||
# Reset to default value if changed
|
||||
if self.__fov not in [None, self.__default_fov]:
|
||||
mem.write_int(
|
||||
local_player + offset["m_iDefaultFOV"], self.__default_fov)
|
||||
|
|
|
@ -6,6 +6,7 @@ class Noflash(Hack):
|
|||
super().__init__(**kwargs)
|
||||
|
||||
self.__brightness = 30.
|
||||
self.__default_brightness = 255.
|
||||
|
||||
def noflash(self) -> None:
|
||||
# Aliases
|
||||
|
@ -16,7 +17,8 @@ class Noflash(Hack):
|
|||
client = self.find_module("client")
|
||||
|
||||
# Get local player
|
||||
local_player = self.find_uint(client, offset["dwLocalPlayer"])
|
||||
self.__local_player = self.find_uint(client, offset["dwLocalPlayer"])
|
||||
local_player = self.__local_player
|
||||
|
||||
def cheat():
|
||||
# Override the brightness value
|
||||
|
@ -27,3 +29,13 @@ class Noflash(Hack):
|
|||
sleep(10)
|
||||
|
||||
self.hack_loop(cheat)
|
||||
|
||||
def noflash_unload(self):
|
||||
# Aliases
|
||||
mem = self.pm
|
||||
offset = self.offsets
|
||||
local_player = self.__local_player
|
||||
|
||||
# Reset to default value
|
||||
mem.write_float(
|
||||
local_player + offset["m_flFlashMaxAlpha"], self.__default_brightness)
|
||||
|
|
Reference in a new issue