2023-04-01 16:11:56 +02:00
|
|
|
from sys import argv
|
2023-03-30 21:00:20 +02:00
|
|
|
from threading import Thread
|
2023-03-30 11:26:52 +02:00
|
|
|
|
2023-03-31 02:44:37 +02:00
|
|
|
from cheat import Cheat, sleep
|
2023-03-30 11:26:52 +02:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-04-01 16:11:56 +02:00
|
|
|
c_id = []
|
|
|
|
args = {}
|
|
|
|
|
|
|
|
if (len(argv) > 1):
|
|
|
|
# User wanna use offline offsets
|
|
|
|
if "--offline" in argv:
|
|
|
|
args["offline"] = True
|
|
|
|
|
|
|
|
# User gave a list of cheats
|
|
|
|
# Will bypass the interactive selection
|
|
|
|
c_id = [int(j) for j in [i for i in argv if i.startswith(
|
|
|
|
"--list=")][0][7:].split(",")]
|
|
|
|
|
|
|
|
# Load cheat class
|
|
|
|
c = Cheat(**args)
|
|
|
|
|
|
|
|
# Interactive selection
|
|
|
|
if (c_id == []):
|
|
|
|
# Cheat list
|
|
|
|
print("You can run multiples cheat at once, separate your choices with a space.")
|
|
|
|
print("Available cheats:")
|
|
|
|
for idx, cheat in enumerate(c.cheats_list):
|
|
|
|
print(f"#{idx + 1} - {cheat}")
|
|
|
|
|
|
|
|
while c_id == []:
|
|
|
|
try:
|
2023-04-03 03:05:26 +02:00
|
|
|
response = [int(i) for i in input("Enter ID: ").split(" ")]
|
2023-04-01 16:11:56 +02:00
|
|
|
for i in response:
|
2023-04-01 16:26:55 +02:00
|
|
|
if (i > len(c.cheats_list) or i <= 0):
|
|
|
|
raise IndexError
|
|
|
|
c_id.append(i - 1)
|
2023-04-01 16:11:56 +02:00
|
|
|
except KeyboardInterrupt:
|
2023-04-01 16:26:55 +02:00
|
|
|
print("Bye")
|
2023-04-01 16:11:56 +02:00
|
|
|
exit(1)
|
|
|
|
except:
|
2023-04-01 16:26:55 +02:00
|
|
|
c_id = []
|
2023-04-01 16:11:56 +02:00
|
|
|
print("Invalid ID.")
|
2023-03-30 21:00:20 +02:00
|
|
|
|
|
|
|
# Instanciate and run threads
|
2023-03-30 21:07:52 +02:00
|
|
|
for fn in [c.cheats_list[i] for i in c_id]:
|
|
|
|
print(f"Running {fn}...")
|
2023-03-30 21:00:20 +02:00
|
|
|
t = Thread(target=getattr(c, fn))
|
|
|
|
t.daemon = True
|
|
|
|
t.start()
|
|
|
|
|
2023-03-30 21:07:52 +02:00
|
|
|
# Don't close the main thread as cheats are daemons
|
2023-04-03 01:18:14 +02:00
|
|
|
try:
|
|
|
|
while True:
|
|
|
|
sleep(1000000)
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
for fn in [c.cheats_list[i] for i in c_id]:
|
|
|
|
try:
|
|
|
|
unloader = getattr(c, f"{fn}_unload")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
print(f"Unload {fn}...")
|
|
|
|
unloader()
|