From 49412e3eb81f264f2013314bc559e08469e362bb Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 30 Mar 2023 12:53:37 +0200 Subject: [PATCH] use friendly interface --- main.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 168f432..b4dd3b9 100644 --- a/main.py +++ b/main.py @@ -10,6 +10,14 @@ class Hack(): def __init__(self) -> None: 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: """Find game process""" process_found = False @@ -81,5 +89,25 @@ if __name__ == "__main__": # Cheat c = Hack() - # Bhop - c.bhop() + print("Enter 0 to exit.") + 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])()