-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI.py
150 lines (133 loc) · 6.5 KB
/
GUI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import tkinter
import numpy as np, SAVEthetime as s, tkinter as tk, Communicae
Comms = Communicae.Communicae()
window = tk.Tk()
# displays a help menu
def helpstt():
GUIpopup("USAGE INFORMATION: SAVEthetime is a Limbus Company Bot made to complete Easy Mirror Dungeons "
"and luxifications\n"
"REQUIREMENTS: Main Screen Resolution must be in 1920 x 1080, Screen Resolution must be on Full Screen,"
"Windowed \n"
"REQUIREMENTS: Tessoract-OCR must be installed for this program to work, Language must be set to"
" English\n"
"In the main window, there are multiple entry boxes placed next to the names of each sinner. "
"Within each entrybox "
"place the selection order, 1 for first selection, 2 for second, ect.\n"
"Once the sinners are selected, hit the button to start the bot and select the game to make it "
"active\n"
"For just luxification, Make sure to start the luxification, and then hit the button, no sinners need"
" to be selected\n"
"IMPORTANT NOTE: On the first battle of the dungeon, unless the sinner checkbox is marked, you"
"will be prompted to make sure unwanted sinners reamin unselected\n"
"IMPORTANT NOTE: Currently there is no Autoshop feature, all actioned related to shopping or upgrading"
" will need to be done manually.", "Help")
# this def collects sinners from the entires and loads them into SAVEthetime, throws an altert if bad values
def loadsinners(entries) -> bool:
global Comms
end = False
sinners = [0] * 6 # these are the inital six sinners we want to use
bacsin = [-1] * 6 # these are back up sinners that we use if the initial six expire.
for cnt in range(6):
for i in range(12):
val = entries[i].get()
print("cal is " + str(cnt))
print("val is " + str(val))
if val != "" and int(val) - 1 == cnt:
sinners[cnt] = i
break
elif i == 11: # no solo missions if you wanna use the GUI
GUIpopup("Please make sure enough sinners are selected\n"
"at least 6 boxes must have a number from 1 - 6.\n"
"7-12 can be selected for backup if desired", "Bad Input")
return False
# sinner backups, to do later
# for cnt in range(6): # back up sinners load in, less important, no fail
# for i in range(12):
# val = entries[i].get()
# print("cal is " + str(cnt))
# print("val is " + str(val))
# if int(val) - 1 == cnt + 6:
# bacsin[cnt] = i
# break
# elif i == 11: # no solo missions if you wanna use the GUI
# end = True
# if end:
# break
s.sinnerintake(sinners)
return True
# handles general popup protocol for the GUI
def GUIpopup(text: str, Title: str):
if Comms.isopen(Title):
pop = Comms.getwin(Title)
pop.attributes("-topmost", True) # forces the popup to the top where it can't be missed
pop.attributes("-topmost", False) # we don't care what happens as long as the user sees the popup
else:
s.openapopup(text, False, title=Title) # creates a new window since one doesn't already exist
# main behavior for starting the bot
def START(sel: int, entries=None, var=None, othervar=None):
#GUIpopup("STARTING THE BOT IN 5 SECONDS\n"
#"MAKE SURE THE GAME IS FULLSCREEN WINDOWED, ACTIVE, AND ON THE MAIN MONITOR\n", "STARTING")
match sel:
case 1:
s.setinGUI(True) # done once
if not var.get(): # sinners not already selected
print("Check unmarked")
s.sinselected = False
if not loadsinners(entries):
return
else:
print("sinselected set to true")
s.sinselected = True
if finvar:
s.finalWAIT = True
else:
s.finalWAIT = False
s.mainbot()
case 2:
s.dolux()
# this is a value verificiation def, throws false if not good, test is input type, text is current value
def valent(text, test):
global window, Comms
print("text is " + text + " test is " + test)
if int(test) == 1 or int(test) == 0: # if inserting into text
print("Past insert")
if str(text).isdigit() and -1 < int(text) < 13 or text == "":
print("here")
return True
GUIpopup("Invalid input, numbers from 1-12 only", "Invalid Input")
return False
return True
sinnames = ["1. Yi Sang:", "2. Faust:", "3. Don Quixote:",
"4. Ryoshu:", "5. Meursault:", "6. Hong Lu:", "7.Heathcliffe:",
"8. Ishmael:", "9. Rodion:", "10. Sinclair:", "11. Outis:", "12. Gregor:"]
s.setCommunicae(Comms) # links the comms between STT and GUI
finvar = tk.BooleanVar() # var for waiting at final floor EGO gift
var = tk.BooleanVar()
window.title("SAVEthetime")
window.resizable(False, False)
Instruction = tk.Label(text="Input numbers in order of sinner selection (1 to select first, ect.)")
checkme = tk.Checkbutton(window, text="Sinners already selected?", variable=var)
checkmetoo = tk.Checkbutton(window, text="Manually select final floor EGO gift?", variable=finvar)
button = [0 for i in range(3)]
Instruction.grid(row=0, column=0, columnspan=10, padx=100)
entries = [0 for i in range(12)]
labels = [0 for i in range(12)]
valid = (window.register(valent), '%P', '%d')
for i in range(12): # label and entry setup
labels[i] = tk.Label(window, text=sinnames[i])
entries[i] = tk.Entry(window, width=5, validate='all', validatecommand=valid)
sin = 0
for i in range(4):
for j in range(3):
labels[sin].grid(row=j + 2, column=(i * 2))
entries[sin].grid(row=j + 2, column=(i * 2) + 1)
sin = sin + 1
button[0] = tk.Button(window, text="Help", command=lambda: helpstt())
button[1] = tk.Button(window, text="Start Bot", command=lambda: START(1, entries, var, finvar))
button[2] = tk.Button(window, text="Do Lux", command=lambda: START(2))
checkme.grid(row=5, column=0, columnspan=3)
checkmetoo.grid(row=5, column=3, columnspan=4)
button[0].grid(row=6, column=2)
button[1].grid(row=6, column=3)
button[2].grid(row=6, column=4)
window.mainloop()