use friendly interface

This commit is contained in:
Mylloon 2023-03-30 12:53:37 +02:00
parent d0baf6f0ae
commit 49412e3eb8
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

32
main.py
View file

@ -10,6 +10,14 @@ class Hack():
def __init__(self) -> None: def __init__(self) -> None:
self.running = False self.running = False
self.cheats_list = [func for func in dir(self)
# Function
if callable(getattr(self, func))
# User defined
if not (func.startswith("__") and func.endswith("__"))
# Blacklist
if func not in ["find_process"]]
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
@ -81,5 +89,25 @@ if __name__ == "__main__":
# Cheat # Cheat
c = Hack() c = Hack()
# Bhop print("Enter 0 to exit.")
c.bhop() print("Available cheats:")
for idx, cheat in enumerate(c.cheats_list):
print(f"#{idx + 1} - {cheat}")
# Select cheat
c_id = None
while c_id == None:
try:
match int(input("Enter ID: #")):
case 0:
exit(0)
case i if i > len(c.cheats_list):
raise IndexError
case _ as i:
c_id = i - 1
except:
print("Invalid ID.")
pass
# Run cheat
getattr(c, c.cheats_list[c_id])()