-
Notifications
You must be signed in to change notification settings - Fork 6
/
Gui.ahk
349 lines (328 loc) · 11.7 KB
/
Gui.ahk
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
#Include XGraph.ahk
#Include config.ahk
toggle :=false
trampRunning :=false
global gardening := false
;TEST
FileCreateDir,%A_AppData%\TTR-Tools\
FileInstall, README.html, %A_AppData%\TTR-Tools\README.html,1
FileInstall, style.html, %A_AppData%\TTR-Tools\style.html,1
FileCreateDir,%A_AppData%\TTR-Tools\assets
FileCreateDir,%A_AppData%\TTR-Tools\assets\css
FileCreateDir,%A_AppData%\TTR-Tools\assets\js
FileCreateDir,%A_AppData%\TTR-Tools\assets\fonts
FileCreateDir,%A_AppData%\TTR-Tools\assets\fonts\roboto
FileInstall, assets\css\main.css, %A_AppData%\TTR-Tools\assets\css\main.css,1
FileInstall, assets\css\materialize.min.css, %A_AppData%\TTR-Tools\assets\css\materialize.min.css,1
FileInstall, assets\css\materialize.css, %A_AppData%\TTR-Tools\assets\css\materialize.css,1
FileInstall, assets\css\github-markdown.css, %A_AppData%\TTR-Tools\assets\css\github-markdown.css,1
FileInstall, assets\js\app.js, %A_AppData%\TTR-Tools\assets\js\app.js,1
FileInstall, assets\js\chart.js, %A_AppData%\TTR-Tools\assets\js\chart.js,1
FileInstall, assets\js\materialize.min.js, %A_AppData%\TTR-Tools\assets\js\materialize.min.js,1
FileInstall assets\fonts\roboto\Roboto-Bold.eot, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Bold.eot
FileInstall assets\fonts\roboto\Roboto-Bold.ttf, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Bold.ttf
FileInstall assets\fonts\roboto\Roboto-Bold.woff, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Bold.woff
FileInstall assets\fonts\roboto\Roboto-Bold.woff2, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Bold.woff2
FileInstall assets\fonts\roboto\Roboto-Light.eot, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Light.eot
FileInstall assets\fonts\roboto\Roboto-Light.ttf, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Light.ttf
FileInstall assets\fonts\roboto\Roboto-Light.woff, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Light.woff
FileInstall assets\fonts\roboto\Roboto-Light.woff2, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Light.woff2
FileInstall assets\fonts\roboto\Roboto-Medium.eot, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Medium.eot
FileInstall assets\fonts\roboto\Roboto-Medium.ttf, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Medium.ttf
FileInstall assets\fonts\roboto\Roboto-Medium.woff, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Medium.woff
FileInstall assets\fonts\roboto\Roboto-Medium.woff2, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Medium.woff2
FileInstall assets\fonts\roboto\Roboto-Regular.eot, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Regular.eot
FileInstall assets\fonts\roboto\Roboto-Regular.ttf, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Regular.ttf
FileInstall assets\fonts\roboto\Roboto-Regular.woff, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Regular.woff
FileInstall assets\fonts\roboto\Roboto-Regular.woff2, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Regular.woff2
FileInstall assets\fonts\roboto\Roboto-Thin.eot, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Thin.eot
FileInstall assets\fonts\roboto\Roboto-Thin.ttf, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Thin.ttf
FileInstall assets\fonts\roboto\Roboto-Thin.woff, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Thin.woff
FileInstall assets\fonts\roboto\Roboto-Thin.woff2, %A_AppData%\TTR-Tools\assets\fonts\roboto\Roboto-Thin.woff2
FileInstall, index.html, %A_AppData%\TTR-Tools\index.html,1
FileInstall, webapp.json, %A_AppData%\TTR-Tools\webapp.json,1
FileInstall, def.ico, %A_AppData%\TTR-Tools\def.ico,0
FileInstall, antiafk.ico, %A_AppData%\TTR-Tools\antiafk.ico,0
FileInstall, gardening.ico, %A_AppData%\TTR-Tools\gardening.ico,0
FileInstall, tramp.ico, %A_AppData%\TTR-Tools\tramp.ico,0
if A_IsCompiled
{
;Menu, Tray, Icon, %A_ScriptFullPath%, -159
Menu, Tray, Icon, %A_AppData%\TTR-Tools\def.ico
}
else
{
Menu, Tray, Icon, %A_AppData%\TTR-Tools\def.ico
Run, "C:\Program Files (x86)\Pandoc\pandoc.exe" README.md -o README.html
}
#include webGui.ahk
SetWorkingDir %A_ScriptDir%
webappShown := true
;Gui __Webapp_:Hide
SendMode Input
small := 7*(96/A_ScreenDPI)
standard := 8*(96/A_ScreenDPI)
if(A_ScreenDPI != 96)
TrayTip, TTR-Tools, "Please set your screen DPI scaling to normal for TTR-Tools to work correctly."
Gui, TTRTools:+AlwaysOnTop
Gui, TTRTools:-DPIScale
Gui, TTRTools:Margin, 0, 0
Gui, TTRTools:font, s%standard%
Gui, TTRTools:Add, Text,h12 y5, Welcome to TTR Tools %version%
Gui, TTRTools:font, s%small%
Gui, TTRTools:Add, Button, x+2 y0 vhelpBtn ghelp, Help
Gui, TTRTools:Add, Button, x+2 y0 gopenConfig, Config
Gui, TTRTools:Add, Button, x+2 y0 gopenWeb, Beta GUI
Gui, TTRTools:font, s%standard%
if(enableFeatureAFK || enableFeatureTrampoline || enableFeatureGarden)
{
Gui, TTRTools:Add, Text, h15 x0, ALT+SHIFT+
if(enableFeatureAFK)
Gui, TTRTools:Add, Text,vtxt2 h15 x+0, (1-AntiAFK)
if(enableFeatureTrampoline)
Gui, TTRTools:Add, Text, vtxt3 h15 x+0, (2/3-Trampoline)
if(enableFeatureGarden)
Gui, TTRTools:Add, Text, vtxt4 h15 x+0, (4/5-Garden--Num1-5)
}
if(enableFeatureAFK || enableFeatureTrampoline || enableFeatureGarden)
{
Gui, TTRTools:font,bold
Gui, TTRTools:Add, Text, x0 vstatusLabel, Status:
Gui, TTRTools:font
Gui, TTRTools:font, s%standard%
if(enableFeatureAFK)
Gui, TTRTools:Add, Text,x+3 vstatus, AntiAFK %toggle% |
if(enableFeatureTrampoline)
Gui, TTRTools:Add, Text,x+3 vstatus2, Trampoline %trampRunning% |
if(enableFeatureGarden)
Gui, TTRTools:Add, Text,x+3 vstatus3, Garden %gardening% |
}
if(enableFeatureAFK || enableFeatureTrampoline || enableFeatureGarden)
{
Gui, TTRTools:font,bold
Gui, TTRTools:Add, Text, x0 vopts, Opts:
Gui, TTRTools:font
Gui, TTRTools:font, s%standard%
if(enableFeatureTrampoline)
{
;Gui, TTRTools:Add, checkbox,x+3 vspeedy gSave, Lagfix (>40)
if(iniRep == 1)
Gui, TTRTools:Add, checkbox,x+3 vrepeat Checked gSave, Repeat Trampoline
else if(iniRep== 0)
Gui, TTRTools:Add, checkbox,x+3 vrepeat gSave, Repeat Trampoline
else
Gui, TTRTools:Add, checkbox,x+3 vrepeat Checked gSave, Repeat Trampoline
}
if(enableFeatureAFK)
{
Gui, TTRTools:Add, Text, x+0 vtextAFK,| AFK Time (mins):
if(!iniAFKMins)
{
Gui, TTRTools:Add, Edit, h16 x+3 w35 vtimeAFK gSave number, 4
Gui, TTRTools:Add, UpDown, vtimeAFKUD Range1-11, 4
}
else
{
Gui, TTRTools:Add, Edit, h16 x+3 w35 vtimeAFK gSave number, %iniAFKMins%
Gui, TTRTools:Add, UpDown, vtimeAFKUD Range1-11, %iniAFKMins%
sendJS("updateValue('#interval','" . %iniAFKMins% . "');")
}
}
if(enableFeatureGarden)
{
Gui, TTRTools:font,bold
Gui, TTRTools:Add, Text, x0 vgopts, Garden:
Gui, TTRTools:font
Gui, TTRTools:font, s%standard%
if(iniReplant == 1)
Gui, TTRTools:Add, checkbox,x+0 vreplant Checked gSave,Pick+Replant
else if(iniReplant == 0)
Gui, TTRTools:Add, checkbox,x+0 vreplant gSave,Pick+Replant
else
Gui, TTRTools:Add, checkbox,x+0 vreplant Checked gSave,Pick+Replant
Gui, TTRTools:Add, Text, x+0 vtextWater,| Times to Water (0-5):
if(!iniTimesToWater)
{
Gui, TTRTools:Add, Edit, h16 x+0 w30 vtimesToWater gSave number, 2
Gui, TTRTools:Add, UpDown, vtimesToWaterUD Range0-5, 2
}
else
{
Gui, TTRTools:Add, Edit, h16 x+0 w30 vtimesToWater gSave number, %iniTimesToWater%
Gui, TTRTools:Add, UpDown, vtimesToWaterUD Range0-5, %iniTimesToWater%
sendJS("updateValue('#water','" . %iniTimesToWater% . "');")
}
}
}
if(enableFeatureAFK || enableFeatureTrampoline || enableFeatureGarden)
{
Gui, TTRTools:Add, Text,x0 vtxt w300 h15,Trampoline bot graph will plot when running
if(!enableFeatureTrampoline)
GuiControl, TTRTools:, txt, Enable a bot
}
if(enableFeatureAFK || enableFeatureTrampoline)
{
if(enableFeatureTrampoline)
{
Gui, TTRTools:Add, Text, x0 w300 h310 hwndhGraph vGraph
pGraph := XGraph( hGraph, 0x55daba, 5, "0,0,0,0", 0x649e90,5 )
}
Gui, TTRTools:Add, Text, x0 w300 h40 hwndvGraphv vvGraph
vGraph := XGraph( vGraphv, 0x688443, 5, "0,0,0,0", 0x649e90,1 )
}
Gui, TTRTools:Show,, TTR Tools
if(!enableFeatureTrampoline){
sendJS("disableFeature('ttab')")
}
;if AFK label is created in current file (ie: if included in TTR-Tools)
AfkLabel = Afk
if(enableFeatureAFK)
{
timeMS := timeAFK*60000
SetTimer %AfkLabel%, %timeMS%
}
return
guiText(controlVar, controlText, guiName:="TTRTools:",showTime:=true)
{
;OutputDebug GuiControl,%guiName%,%controlVar%,%ControlText%
GuiControl,%guiName%,%controlVar%,%ControlText%
global trampRunning
global gardening
global toggle
StringReplace, controlText, controlText, ',, All
/*
\"(.*?\'.*)\"
*/
regex := RegExMatch(controlText, "(.*?\'.*)")
if((regex != "" && regex != "0") || regex)
{
OutputDebug REGEX Returned %regex%
guiText("txt", "Regex Returned: " . regex)
}
if(controlVar == "txt")
{
FormatTime, TimeString,, h:mm:ss
if(showTime)
{
if(trampRunning)
sendJS("updateConsole('[" . TimeString . "] " . controlText . "')")
else if(gardening)
sendJS("updateConsole('[" . TimeString . "] " . controlText . "', '#garden-console')")
else if(toggle)
sendJS("updateConsole('[" . TimeString . "] " . controlText . "', '#afk-console')")
else
sendJS("updateConsole('[" . TimeString . "][unknown-task] " . controlText . "', '#error-console')")
}
else{
if(trampRunning)
sendJS("updateConsole('" . controlText . "')")
else if(gardening)
sendJS("updateConsole('" . controlText . "', '#garden-console')")
else if(toggle)
sendJS("updateConsole('" . controlText . "', '#afk-console')")
else
sendJS("updateConsole('[" . TimeString . "][unknown-task] " . controlText . "', '#error-console')")
}
}
}
Help::
Gui , help:Destroy
if A_IsCompiled
{
FileRead,fileContents,%A_AppData%\TTR-Tools\README.html
FileRead,htmlpage,%A_AppData%\TTR-Tools\style.html
}
else
{
FileRead,fileContents,README.html
FileRead,htmlpage,style.html
}
Gui help:+AlwaysOnTop
Gui, help:Margin, 0, 0
htmlpage.=fileContents
htmlpage.="</body></html>"
Gui, help:add,ActiveX,vpage w1000 h750 +BackgroundTrans, HTMLFile
page.silent := true
page.write(htmlpage)
Gui, help:Show, , TTR Tools Help
ComObjConnect(page, "IE_")
return
openConfig(){
gosub, openConfig
}
openConfig:
Run, %ini%
return
openWeb:
if(webappShown)
Gui __Webapp_:Hide
else
Gui __Webapp_:Show, w%__Webapp_Width% h%__Webapp_height%, %__Webapp_Name%
webappShown := !webappShown
return
Save:
Gui, TTRTools:Submit, NoHide
; config.ahk update
IniWrite, %repeat%, %ini%,Trampoline, repeat
IniWrite, %timeAFK%, %ini%, AFK, afkMins
IniWrite, %timesToWater%, %ini%, Garden, timesToWater
IniWrite, %replant%, %ini%, Garden, replant
/* doesn't seem to work */
/*sendJS("updateValue('#water','" . %iniTimesToWater% . "');")
sendJS("updateValue('interval','" . %timeAFK% . "');")
*/
; end config.ahk update
if(enableFeatureAFK)
{
if(timeAFK*60000 != timeMS)
{
AfkLabel = Afk
timeMS := timeAFK*60000
SetTimer %AfkLabel%, %timeMS%
plotAFKLabel= plotAFK
if(isLabel(plotAFKLabel))
{
if(toggle)
{
plotAFKTime := Round(timeMS/300)
SetTimer %plotAFKLabel%, %plotAFKTime%
}
}
}
}
return
setStatus:
global gardening
global toggle
global trampRunning
if(enableFeatureAFK)
GuiText("status","AntiAFK " . toggle . " |")
if(enableFeatureTrampoline)
GuiText("status2","Trampoline " . trampRunning . " |")
if(enableFeatureGarden)
GuiText("status3","Garden " . gardening . " |")
sleep, 250
updateToggles(toggle,trampRunning,gardening)
if(gardening)
Menu, Tray, Icon, %A_AppData%\TTR-Tools\gardening.ico
else if(toggle)
Menu, Tray, Icon, %A_AppData%\TTR-Tools\antiafk.ico
else if(trampRunning)
Menu, Tray, Icon, %A_AppData%\TTR-Tools\tramp.ico
else
Menu, Tray, Icon, %A_AppData%\TTR-Tools\def.ico
return
;Debug information
^!+Ins::
MouseMove, 726, 593
return
^!+Home::
ListVars
return
helpGuiEscape:
helpGuiClose:
Gui , help:Destroy
return
TTRToolsGuiClose: ;close Gui to Exit
ExitApp
return