TEMP: Run all cheats

This commit is contained in:
Mylloon 2023-03-30 21:00:20 +02:00
parent 2119d6d8ab
commit fe14f5f094
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

55
main.py
View file

@ -1,4 +1,5 @@
from json import loads from json import loads
from threading import Thread
from time import sleep from time import sleep
from pymem import Pymem from pymem import Pymem
@ -335,6 +336,7 @@ class Cheat(Hack):
else: else:
# Not spraying # Not spraying
# TODO: Reset to middle?
self.nr__old_punch_x = 0. self.nr__old_punch_x = 0.
self.nr__old_punch_y = 0. self.nr__old_punch_y = 0.
@ -359,28 +361,37 @@ if __name__ == "__main__":
# Cheat # Cheat
c = Cheat() c = Cheat()
# Cheat list # # Cheat list
print("Enter 0 to exit.") # print("Enter 0 to exit.")
print("Available cheats:") # print("Available cheats:")
for idx, cheat in enumerate(c.cheats_list): # for idx, cheat in enumerate(c.cheats_list):
print(f"#{idx + 1} - {cheat}") # print(f"#{idx + 1} - {cheat}")
# Select cheat # # Select cheat
c_id = None # c_id = None
while c_id == None: # while c_id == None:
try: # try:
match int(input("Enter ID: #")): # match int(input("Enter ID: #")):
case 0: # case 0:
exit(0) # exit(0)
case i if i > len(c.cheats_list): # case i if i > len(c.cheats_list):
raise IndexError # raise IndexError
case _ as i: # case _ as i:
c_id = i - 1 # c_id = i - 1
except KeyboardInterrupt: # except KeyboardInterrupt:
print("??\nBye.") # print("??\nBye.")
exit(1) # exit(1)
except: # except:
print("Invalid ID.") # print("Invalid ID.")
# Run cheat # Run cheat
getattr(c, c.cheats_list[c_id])() # getattr(c, c.cheats_list[c_id])()
# Instanciate and run threads
for fn in c.cheats_list:
t = Thread(target=getattr(c, fn))
t.daemon = True
t.start()
while True:
sleep(1000000)