This repository has been archived on 2023-09-02. You can view files and clone it, but cannot push or open issues or pull requests.
csh/cheat.py

38 lines
1.4 KiB
Python
Raw Normal View History

from glob import glob
2023-03-30 23:19:17 +02:00
# Import all cheats
backslash = "\\"
for file in glob("cheats/*.py"):
exec(f"from {file.replace(backslash, '.')[:-3]} import *")
2023-03-30 23:19:17 +02:00
class Cheat(*[child for child in Hack.__subclasses__()]): # type: ignore
2023-04-01 16:11:56 +02:00
"""All cheats are loaded in this class"""
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
2023-03-30 23:19:17 +02:00
self.cheats_list = [func for func in dir(self)
# Function
if callable(getattr(self, func))
# User defined
if not func.startswith("_")
# Hack loop
if not func == "hack_loop"
2023-04-03 01:18:14 +02:00
# Unloaders
if not func.endswith("_unload")
2023-03-30 23:19:17 +02:00
# Utils
if not func.startswith("find_")]
self.incompatible = dict.fromkeys(self.cheats_list, [])
# Incompatible cheats
self.incompatible["aimbot"] = ["norecoil"]
# Builds the implicit list
for cheat, incompatible_cheat_list in self.incompatible.items():
for incompatible_cheat in incompatible_cheat_list:
if not cheat in self.incompatible[incompatible_cheat]:
self.incompatible[incompatible_cheat] = self.incompatible[incompatible_cheat] + [
cheat]