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/main.py

47 lines
1.2 KiB
Python
Raw Normal View History

2023-03-30 21:00:20 +02:00
from threading import Thread
2023-03-30 11:26:52 +02:00
from time import sleep
2023-03-30 23:19:17 +02:00
from cheat import Cheat
2023-03-30 11:26:52 +02:00
if __name__ == "__main__":
# Cheat
2023-03-30 13:14:24 +02:00
c = Cheat()
2023-03-30 21:07:52 +02:00
# Cheat list
print("Enter 0 to exit.")
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}")
# Select cheat
c_id = None
while c_id == None:
try:
response = [int(i) for i in input("Enter ID: ").split(" ")]
c_id = []
for i in response:
match i:
case 0:
exit(0)
case j if j > len(c.cheats_list):
raise IndexError
case _:
c_id.append(i - 1)
except KeyboardInterrupt:
print("??\nBye.")
exit(1)
except:
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-03-30 21:00:20 +02:00
while True:
sleep(1000000)