-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacro.ahk
1265 lines (1142 loc) · 36 KB
/
macro.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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; made by /u/lutcikaur
; As always, test the logout before you run into hardcore.
; If you find some errors, the list is at the bottom. Search for the error code.
; GUI's in use : 1, 2, 3, 4
#NoEnv
#SingleInstance force
FileEncoding , UTF-8
SendMode Input
SetTitleMatchMode, 3
macroVersion := 133ffsdfdsf
If (A_AhkVersion <= "1.1.23")
{
msgbox, You need AutoHotkey v1.1.23 or later to run this script. `n`nPlease go to http://ahkscript.org/download and download a recent version.
ExitApp
}
IfNotExist %A_MyDocuments%\AutoHotKey
{
FileCreateDir, %A_MyDocuments%\AutoHotKey
}
SetWorkingDir %A_MyDocuments%\AutoHotKey
elog := A_Now . " " . A_AhkVersion . " " . macroVersion "`n"
FileAppend, %elog% , error.txt, UTF-16
UrlDownloadToFile, http://lutbot.com/ahk/version.html, version.html
if ErrorLevel
error("ED06")
FileRead, newestVersion, version.html
if ( macroVersion < newestVersion ) {
UrlDownloadToFile, http://lutbot.com/ahk/changelog.txt, changelog.txt
if ErrorLevel
error("ED08")
Gui, 4:Add, Text,, Update Available.`nYoure running version %macroVersion%. The newest is version %newestVersion%`nI either messed something up in this version, or I added something new.`nCan I download it for you? It will only take a moment, and the script will automatically restart.
FileRead, changelog, changelog.txt
Gui, 4:Add, Edit, w600 h200 +ReadOnly, %changelog%
Gui, 4:Add, Button, section default grunUpdate, Update
Gui, 4:Add, Button, ys gdontUpdate, Skip Update
Gui, 4:Show
}
If !A_IsAdmin {
Run *RunAs "%A_ScriptFullPath%"
ExitApp
}
GetTable := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Iphlpapi.dll", "Ptr"), Astr, "GetExtendedTcpTable", "Ptr")
SetEntry := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Iphlpapi.dll", "Ptr"), Astr, "SetTcpEntry", "Ptr")
EnumProcesses := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Psapi.dll", "Ptr"), Astr, "EnumProcesses", "Ptr")
preloadPsapi := DllCall("LoadLibrary", "Str", "Psapi.dll", "Ptr")
OpenProcessToken := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Advapi32.dll", "Ptr"), Astr, "OpenProcessToken", "Ptr")
LookupPrivilegeValue := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Advapi32.dll", "Ptr"), Astr, "LookupPrivilegeValue", "Ptr")
AdjustTokenPrivileges := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Advapi32.dll", "Ptr"), Astr, "AdjustTokenPrivileges", "Ptr")
IfNotExist, Lib
{
FileCreateDir, Lib
}
FileDelete, Lib\QDL.ahk
str := "#NoTrayIcon`nSetWorkingDir %A_MyDocuments%\AutoHotKey`nUrlDownloadToFile,%1%,%2%`nIfNotExist, %2%`n{`nFileAppend,ERROR,%2%`n}"
FileAppend, %str%, Lib\QDL.ahk
IfNotExist, cports.exe
{
UrlDownloadToFile, http://lutbot.com/ahk/cports.exe, cports.exe
if ErrorLevel
msgbox, We couldn't download cports.exe, this is used as a fallback to the normal logout method. The logout functionality may not work until this is resolved. Please download cports.exe from http://lutbot.com/ahk/cports.exe and place it in %A_MyDocuments%\AutoHotKey.
UrlDownloadToFile, http://lutbot.com/ahk/cports.chm, cports.chm
if ErrorLevel
error("ED03")
UrlDownloadToFile, http://lutbot.com/ahk/readme.txt, readme.txt
if ErrorLevel
error("ED04")
}
IfNotExist, settings.ini
{
defaultIni := "[variables]`n"
defaultIni .= "CharacterName=BTOneMonthLut`n"
defaultIni .= "League=standard`n"
defaultIni .= "PoeSteam=0`n"
defaultIni .= "UpdateTimer=1000`n"
defaultIni .= "XOffset=0`n"
defaultIni .= "YOffset=0`n"
defaultIni .= "MonitorWhispers=0`n"
defaultIni .= "MonitorWhispersDelay=10000`n"
defaultIni .= "LogFileLocation=ERROR PLEASE SELECT LOG FILE`n"
defaultIni .= "OverlayToggle=0`n"
defaultIni .= "SoundSelector=*-1`n"
defaultIni .= "Beta=1`n"
defaultIni .= "Diablo2=0`n"
defaultIni .= "[whisperMessages]`n"
defaultIni .= "wm1=One moment, I'm in a map.`n"
defaultIni .= "wm2=Sorry, That item has already been sold.`n"
defaultIni .= "wm3=Type a sentence here`n"
defaultIni .= "wm4=Type a sentence here`n"
defaultIni .= "wm5=Type a sentence here`n"
defaultIni .= "[partyMessages]`n"
defaultIni .= "pm1=Watch for corrupting blood!`n"
defaultIni .= "pm2=Type a sentence here`n"
defaultIni .= "pm3=Dangerous exile!`n"
defaultIni .= "pm4=Minion Instability / Iceblood!`n"
defaultIni .= "pm5=Type a sentence here`n"
defaultIni .= "[hotkeys]`n"
defaultIni .= "logout=```n"
defaultIni .= "superLogout=F12`n"
defaultIni .= "oos=F2`n"
defaultIni .= "remaining=F3`n"
defaultIni .= "itemLevel=F4`n"
defaultIni .= "hideout=F5`n"
defaultIni .= "invite=F6`n"
defaultIni .= "toggleOverlay=F9`n"
defaultIni .= "options=F10`n"
defaultIni .= "wm1=^1`n"
defaultIni .= "wm2=^2`n"
defaultIni .= "wm3=^3`n"
defaultIni .= "wm4=^4`n"
defaultIni .= "wm5=^5`n"
defaultIni .= "pm1=!1`n"
defaultIni .= "pm4324=!2`n"
defaultIni .= "pm3=!3`n"
defaultIni .= "pm4=!4`n"
defaultIni .= "pm5=!5"
FileAppend, %defaultIni%, settings.ini, UTF-16
}
getLeagueListing()
readFromFile()
current := 0
phase := 0
lastWhisperTimeRecieved := 0
;timers
updateTrackingTimer := 50000 ; 50 seconds
baseUpdateTrackingTimer := 300000 ; 5 minutes
overlayTimer := 0
baseOverlayTimer := sleepTime
updateTrackingTimerActive := true
overlayTimerActive := true
lastUpdated := 1
preloadCportsTimer := 0
basePreloadCportsTimer := 180000 ; 3 minutes
preloadCportsCall := "cports.exe /stext TEMP"
;Ranking Overlay
Gui, 1:+ToolWindow
Gui, 1:Font, s8
Gui, 1:Add, Text, x3 y2 vguiErr, Working
Gui, 1:Add, Text, x3 y17, Settings:F10
Gui, 1:Font, s14
Gui, 1:Add, Text, x67 y4 w120 vguiRank, Rank: N/A
Gui, 1:Add, Text, x175 y4 w55 vguiMovedRanks, N/A
Gui, 1:Font, s7
Gui, 1:Add, Text, x3 y32, Ranks, Class:
Gui, 1:Add, Text, x72 y32 w33 vguiClassRank, N/A
Gui, 1:Add, Text, x115 y32, Alive:
Gui, 1:Add, Text, x145 y32 w33 vguiAliveRank, N/A
Gui, 1:Add, Text, x3 y47, Exp Above :
Gui, 1:Add, Text, x3 y62, Exp Below :
Gui, 1:Add, Text, x66 y47 w66 vguiAbove1, N/A
Gui, 1:Add, Text, x135 y47 w66 vguiAbove2, N/A
Gui, 1:Add, Text, x66 y62 w66 vguiBelow1, N/A
Gui, 1:Add, Text, x135 y62 w66 vguiBelow2, N/A
Gui, 1:Font, s14
Gui, 1:Show, x0 y0 w225 h37, poeGUI
Gui, 1:-Caption +AlwaysOnTop +Disabled +E0x20 +LastFound
Winset,TransColor, 0xFFFFFF
;Menu
Gui, 2:Add, Text,, CharacterName:
Gui, 2:Add, Text,, Char's League:
Gui, 2:Add, Text,, Steam Client:
Gui, 2:Add, Text,, UpdateTimer(ms):
Gui, 2:Add, Text,, Overlay X Offset:
Gui, 2:Add, Text,, Overlay Y Offset:
Gui, 2:Add, Text,, Beta version:
Gui, 2:Add, Text,h34, D2 logout?:
Gui, 2:Add, Text,, Logout:
Gui, 2:Add, Text,, ForceLogout:
Gui, 2:Add, Text,, /Oos:
Gui, 2:Add, Text,, /Remaining :
Gui, 2:Add, Text,, /ItemLevel :
Gui, 2:Add, Text,, Travel to Hideout :
Gui, 2:Add, Text,, Invite Player :
Gui, 2:Add, Text,, Toggle Overlay Size:
Gui, 2:Add, Text,, Options (This GUI) :
Gui, 2:Add, Edit, vguiChar ym w100 h20, %charName%
Gui, 2:Add, DropDownList, vguiLeague w100, %leagueString%
;GuiControl, 2:ChooseString, guiLeague, %league%
Gui, 2:Add, Checkbox, vguiSteam w100 h20 Checked%steam%
Gui, 2:Add, Edit, vguiUpdate w100 h20, %sleepTime%
Gui, 2:Add, Edit, vguiXOffset w100 h20, %xOffset%
Gui, 2:Add, Edit, vguiYOffset w100 h20, %yOffset%
Gui, 2:Add, Checkbox, vguibeta h20 Checked%beta%
Gui, 2:Add, Checkbox, vguidiablo2 h20 Checked%diablo2%
Gui, 2:Add, Text, w100 h20, Hotkey:
Gui, 2:Add, Hotkey, w100 h20 vguihotkeyLogout , %hotkeyLogout%
Gui, 2:Add, Hotkey, w100 h20 vguihotkeySuperLogout , %hotkeySuperLogout%
Gui, 2:Add, Hotkey, w100 h20 vguihotkeyOos , %hotkeyOos%
Gui, 2:Add, Hotkey, w100 h20 vguihotkeyRemaining , %hotkeyRemaining%
Gui, 2:Add, Hotkey, w100 h20 vguihotkeyItemLevel , %hotkeyItemLevel%
Gui, 2:Add, Hotkey, w100 h20 vguihotkeyHideout , %hotkeyHideout%
Gui, 2:Add, Hotkey, w100 h20 vguihotkeyInvite , %hotkeyInvite%
Gui, 2:Add, Hotkey, w100 h20 vguihotkeyToggleOverlay , %hotkeyToggleOverlay%
Gui, 2:Add, Hotkey, w100 h20 vguihotkeyOptions , %hotkeyOptions%
Gui, 2:Add, Text, ym, Whisper Hotkey:
Gui, 2:Add, Hotkey, vguihotkeywm1 w100 h20 , %hotkeywm1%
Gui, 2:Add, Hotkey, vguihotkeywm2 w100 h20 , %hotkeywm2%
Gui, 2:Add, Hotkey, vguihotkeywm3 w100 h20 , %hotkeywm3%
Gui, 2:Add, Hotkey, vguihotkeywm4 w100 h20 , %hotkeywm4%
Gui, 2:Add, Hotkey, vguihotkeywm5 w100 h20 , %hotkeywm5%
Gui, 2:Add, Text,, Party Hotkey:
Gui, 2:Add, Hotkey, vguihotkeypm1 w100 h20 , %hotkeypm1%
Gui, 2:Add, Hotkey, vguihotkeypm2 w100 h20 , %hotkeypm2%
Gui, 2:Add, Hotkey, vguihotkeypm3 w100 h20 , %hotkeypm3%
Gui, 2:Add, Hotkey, vguihotkeypm4 w100 h20 , %hotkeypm4%
Gui, 2:Add, Hotkey, vguihotkeypm5 w100 h20 , %hotkeypm5%
Gui, 2:Add, Text,, Questions? Comments?
Gui, 2:Add, Text, ym w200, Whisper Message Text:
Gui, 2:Add, Edit, vguiwm1 w200 h20, %wm1%
Gui, 2:Add, Edit, vguiwm2 w200 h20, %wm2%
Gui, 2:Add, Edit, vguiwm3 w200 h20, %wm3%
Gui, 2:Add, Edit, vguiwm4 w200 h20, %wm4%
Gui, 2:Add, Edit, vguiwm5 w200 h20, %wm5%
Gui, 2:Add, Text, w200, Party Message Text:
Gui, 2:Add, Edit, vguipm1 w200 h20, %pm1%
Gui, 2:Add, Edit, vguipm2 w200 h20, %pm2%
Gui, 2:Add, Edit, vguipm3 w200 h20, %pm3%
Gui, 2:Add, Edit, vguipm4 w200 h20, %pm4%
Gui, 2:Add, Edit, vguipm5 w200 h20, %pm5%
Gui, 2:Add, Text,, @Lutcikaur ingame or /u/lutcikaur on reddit
Gui, 2:Add, Text,, Let me know if it errors
Gui, 2:Add, Text, xm section, Monitor Whispers:
Gui, 2:Add, Checkbox, ys vguiMonitorWhispers h20 Checked%monitorWhispers%
Gui, 2:Add, Text, ys, Check Delay (ms):
Gui, 2:Add, Edit, ys vguiMonitorWhispersDelay w100 h20, %monitorWhispersDelay%
Gui, 2:Add, Button, ys gchangelogGui, Changelog
Gui, 2:Add, Button, ys default gupdateHotkeys, Okay
Gui, 2:Add, Button, section xm gbrowseForLogFile , Browse for Log File
Gui, 2:Add, Text, ys, Whisper Notification Sound:
Gui, 2:Add, DropDownList, ys vguiSoundSelector w50, None|*-1|*16|*32|*48|*64
GuiControl, 2:ChooseString, guiSoundSelector, %soundSelector%
Gui, 2:Add, Button, ys gplaySound, TestPlay Sound
Gui, 2:Add, Text, w380 xs vguiLogFileLocation, %logFileLocation%
; some fucking initializers. Put these together later.
toggle--
toggleOverlay()
;start the main loop. Gotta be last
loopTimers()
getLeagueListing() {
global
;Get league listing
SetTimer, loadLeague, 1000
run "Lib\QDL.ahk" "http://api.exiletools.com/ladder?activeleagues=1" "leagues.json"
return
loadLeague:
IfExist, leagues.json
{
SetTimer, loadLeague, off
FileRead, leagues, leagues.json
JSON_obj_leagues := json_toobj(leagues)
leagueString := JSON_obj_leagues[0]
while JSON_obj_leagues[a_index] != ""
{
leagueString .= "|" . JSON_obj_leagues[a_index]
}
leagueString .= "|SSF"
GuiControl,2:, guiLeague, %leagueString%
GuiControl,2:ChooseString, guiLeague, %league%
}
return
}
superLogoutCommand(){
superLogoutCommand:
logoutCommand()
return
}
logoutCommand(){
logoutCommand:
logout()
return
}
cportsLogout(){
global cportsCommand, lastlogout
start := A_TickCount
ltime := lastlogout + 1000
if ( ltime < A_TickCount ) {
RunWait, %cportsCommand%
lastlogout := A_TickCount
}
Sleep 10
error("nb:" . A_TickCount - start)
return
}
logout(){
global executable, GetTable, SetEntry, EnumProcesses, OpenProcessToken, LookupPrivilegeValue, AdjustTokenPrivileges, loadedPsapi
start := A_TickCount
poePID := Object()
s := 4096
Process, Exist
h := DllCall("OpenProcess", "UInt", 0x0400, "Int", false, "UInt", ErrorLevel, "Ptr")
DllCall(OpenProcessToken, "Ptr", h, "UInt", 32, "PtrP", t)
VarSetCapacity(ti, 16, 0)
NumPut(1, ti, 0, "UInt")
DllCall(LookupPrivilegeValue, "Ptr", 0, "Str", "SeDebugPrivilege", "Int64P", luid)
NumPut(luid, ti, 4, "Int64")
NumPut(2, ti, 12, "UInt")
r := DllCall(AdjustTokenPrivileges, "Ptr", t, "Int", false, "Ptr", &ti, "UInt", 0, "Ptr", 0, "Ptr", 0)
DllCall("CloseHandle", "Ptr", t)
DllCall("CloseHandle", "Ptr", h)
s := VarSetCapacity(a, s)
c := 0
DllCall(EnumProcesses, "Ptr", &a, "UInt", s, "UIntP", r)
Loop, % r // 4
{
id := NumGet(a, A_Index * 4, "UInt")
h := DllCall("OpenProcess", "UInt", 0x0010 | 0x0400, "Int", false, "UInt", id, "Ptr")
if !h
continue
VarSetCapacity(n, s, 0)
e := DllCall("Psapi\GetModuleBaseName", "Ptr", h, "Ptr", 0, "Str", n, "UInt", A_IsUnicode ? s//2 : s)
if !e
if e := DllCall("Psapi\GetProcessImageFileName", "Ptr", h, "Str", n, "UInt", A_IsUnicode ? s//2 : s)
SplitPath n, n
DllCall("CloseHandle", "Ptr", h)
if (n && e)
if (n == executable) {
poePID.Insert(id)
}
}
l := poePID.Length()
if ( l = 0 ) {
Process, wait, %executable%, 0.2
if ( ErrorLevel > 0 ) {
poePID.Insert(ErrorLevel)
}
}
VarSetCapacity(dwSize, 4, 0)
result := DllCall(GetTable, UInt, &TcpTable, UInt, &dwSize, UInt, 0, UInt, 2, UInt, 5, UInt, 0)
VarSetCapacity(TcpTable, NumGet(dwSize), 0)
result := DllCall(GetTable, UInt, &TcpTable, UInt, &dwSize, UInt, 0, UInt, 2, UInt, 5, UInt, 0)
num := NumGet(&TcpTable,0,"UInt")
IfEqual, num, 0
{
cportsLogout()
error("ED11",num,l,executable)
return
}
out := 0
Loop %num%
{
cutby := a_index - 1
cutby *= 24
ownerPID := NumGet(&TcpTable,cutby+24,"UInt")
for index, element in poePID {
if ( ownerPID = element )
{
VarSetCapacity(newEntry, 20, 0)
NumPut(12,&newEntry,0,"UInt")
NumPut(NumGet(&TcpTable,cutby+8,"UInt"),&newEntry,4,"UInt")
NumPut(NumGet(&TcpTable,cutby+12,"UInt"),&newEntry,8,"UInt")
NumPut(NumGet(&TcpTable,cutby+16,"UInt"),&newEntry,12,"UInt")
NumPut(NumGet(&TcpTable,cutby+20,"UInt"),&newEntry,16,"UInt")
result := DllCall(SetEntry, UInt, &newEntry)
IfNotEqual, result, 0
{
cportsLogout()
error("TCP" . result,out,result,l,executable)
return
}
out++
}
}
}
if ( out = 0 ) {
cportsLogout()
error("ED10",out,l,executable)
} else {
error(l . ":" . A_TickCount - start,out,l,executable)
}
return
}
error(var,var2:="",var3:="",var4:="",var5:="",var6:="",var7:="") {
GuiControl,1:, guiErr, %var%
print := A_Now . "," . var . "," . var2 . "," . var3 . "," . var4 . "," . var5 . "," . var6 . "," . var7 . "`n"
FileAppend, %print%, error.txt, UTF-16
return
}
invite(){
inviteCommand:
BlockInput On
Send ^{Enter}{Home}{Delete}/invite {Enter}
BlockInput Off
return
}
oosCommand(){
oosCommand:
BlockInput On
SendInput, {enter}
Sleep 2
SendInput, {/}oos
SendInput, {enter}
BlockInput Off
return
}
remaining(){
remainingCommand:
BlockInput On
SendInput, {enter}
Sleep 2
SendInput, {/}remaining
SendInput, {enter}
BlockInput Off
return
}
itemlevel(){
itemLevelCommand:
BlockInput On
SendInput, {Enter}
Sleep 2
SendInput, {/}itemlevel
SendInput, {Enter}
Sleep 75
BlockInput Off
return
}
hideout(){
hideoutCommand:
BlockInput On
SendInput, {Enter}
Sleep 2
SendInput, {/}hideout
SendInput, {Enter}
BlockInput Off
return
}
whisperCommand1:
BlockInput On
Sleep 2
SendInput ^{Enter}
SendInput %wm1%
SendInput {Enter}
BlockInput Off
return
whisperCommand2:
BlockInput On
Sleep 2
SendInput ^{Enter}
SendInput %wm2%
SendInput {Enter}
BlockInput Off
return
whisperCommand3:
BlockInput On
Sleep 2
SendInput ^{Enter}
SendInput %wm3%
SendInput {Enter}
BlockInput Off
return
whisperCommand4:
BlockInput On
Sleep 2
SendInput ^{Enter}
SendInput %wm4%
SendInput {Enter}
BlockInput Off
return
whisperCommand5:
BlockInput On
Sleep 2
SendInput ^{Enter}
SendInput %wm5%
SendInput {Enter}
BlockInput Off
return
partyCommand1:
BlockInput On
Sleep 2
SendInput {Enter}
SendInput `%
SendInput %pm1%
SendInput {Enter}
BlockInput Off
return
partyCommand2:
BlockInput On
Sleep 2
SendInput {Enter}
SendInput `%
SendInput %pm2%
SendInput {Enter}
BlockInput Off
return
partyCommand3:
BlockInput On
Sleep 2
SendInput {Enter}
SendInput `%
SendInput %pm3%
SendInput {Enter}
BlockInput Off
return
partyCommand4:
BlockInput On
Sleep 2
SendInput {Enter}
SendInput `%
SendInput %pm4%
SendInput {Enter}
BlockInput Off
return
partyCommand5:
BlockInput On
Sleep 2
SendInput {Enter}
SendInput `%
SendInput %pm5%
SendInput {Enter}
BlockInput Off
return
browseForLogFile:
FileSelectFile, logFileLocation,, , Navigate to C:\Program Files (x86)\Grinding Gear Games\Path of Exile\logs, Text Documents (*.txt; *.log)
GuiControl,2:, guiLogFileLocation, %logFileLocation%
return
changelogGui(){
changelogGui:
FileRead, changelog, changelog.txt
Gui, 3:Add, Edit, w600 h200 +ReadOnly, %changelog%
Gui, 3:Show
return
}
playSound:
Gui, 2:Submit, nohide
SoundPlay, %guiSoundSelector%
return
toggleOverlay(){
toggleOverlayCommand:
global toggle
toggle++
if toggle > 1
toggle := -1
if toggle = -1
{
Gui, 1:Hide
}
if toggle = 0
{
Gui, 1:Show, h75 NA
}
if toggle = 1
{
Gui, 1:Show, h46 NA
}
return
}
preloadCports(){
global preloadCportsTimer, basePreloadCportsTimer, preloadCportsCall
Run, %preloadCportsCall%
preloadCportsTimer := basePreloadCportsTimer
}
checkOverlay(){
global overlayTimer, baseOverlayTimer, toggle, xOffset, yOffset
if toggle != -1
{
IfWinActive Path of Exile
{
WinGetActiveStats,name,width,height,x,y
width += x
width += xOffset
hh := y
hh += yOffset
if toggle = 2
{
width /= 2
width -= 295
height /= 2
height -= 325
Gui, 5:Show, y%height% x%width% NA
}
if ( toggle = 1 ) || ( toggle = 0 )
{
width -= 231
Gui, 1:Show, y%hh% x%width% NA
}
} else {
Gui, 1:Hide
Gui, 5:Hide
}
}
overlayTimer := baseOverlayTimer
return
}
runUpdate(){
runUpdate:
UrlDownloadToFile, http://lutbot.com/ahk/macro.ahk, %A_ScriptFullPath%
if ErrorLevel
error("ED07")
else
Run "%A_ScriptFullPath%"
Sleep 5000 ;This shouldn't ever hit.
dontUpdate:
Gui, 4:Destroy
return
}
checkForWhispers(){
global logFileLocation, lastWhisperTimeRecieved, monitorWhispersTimer, monitorWhispersDelay, soundSelector
FileRead, BIGFILE, %logFileLocation%
StringGetPos, last25Location, BIGFILE,`n, R75
StringTrimLeft, smallfile, BIGFILE, %last25Location%
regexLocation := 1
arrayCount := 0
newStart := 0
While regexLocation
{
regexLocation := RegExMatch( smallfile, "(\d\d\d\d.\d\d.\d\d \d\d:\d\d:\d\d)(?:.*)\[INFO Client \d+\] \@(.*)", regexString, regexLocation+1)
if regexLocation != 0
{
time%arrayCount% := regexString1
s%arrayCount% := regexString2
arrayCount++
}
}
loopCounter := 0
lnum := arrayCount-1
displayStart := arrayCount
d = :::
while loopCounter < arrayCount
{
if ( time%loopCounter% > lastWhisperTimeRecieved )
{
displayStart := loopCounter
goto breakWhisperTimes
}
loopCounter++
}
breakWhisperTimes:
if( lnum < 0)
lnum := 0
lastWhisperTimeRecieved := time%lnum%
displayString := ""
iterations := arrayCount - displayStart
loopCounter := arrayCount
while loopCounter > displayStart
{
loopCounter--
displayString .= s%loopCounter% . "`n"
}
IfWinNotActive Path of Exile
if iterations > 0
{
TrayTip, New Messages: `(%iterations%`), %displayString%
SoundPlay, %soundSelector%
}
monitorWhispersTimer := monitorWhispersDelay
return
}
loopTimers(){
global
Loop {
if ( overlayTimerActive = true )
overlayTimer -= sleepTime
if ( updateTrackingTimerActive = true )
updateTrackingTimer -= sleepTime
if ( monitorWhispers )
monitorWhispersTimer -= sleepTime
if ( !beta )
preloadCportsTimer -= sleepTime
if ( overlayTimer <= 0 ) && ( overlayTimerActive = true )
{
checkOverlay()
}
if ( updateTrackingTimer <= 0 ) && ( updateTrackingTimerActive = true )
{
IfWinExist, Path of Exile
updateTracking()
else
updateTrackingTimer := 60000
}
if ( monitorWhispersTimer <= 0 ) && ( monitorWhispers )
{
IfWinExist, Path of Exile
checkForWhispers()
}
if ( preloadCportsTimer <= 0 )
{
IfWinExist, Path of Exile
preloadCports()
else
preloadCportsTimer := basePreloadCportsTimer
}
Sleep sleepTime
}
return
}
updateTracking(){
global charName, league, updateTrackingTimer, baseUpdateTrackingTimer, lastUpdated
updateTrackingTimer := baseUpdateTrackingTimer ; Wait the base time
rank := "No Rank"
if ( league == "SSF" ) {
url := "http://ssf.poeladder.com/players/" . charName . ""
SetTimer, loadSSF, 1000
FileDelete, ladder.json
run "Lib\QDL.ahk" %url% "ladder.json"
return
loadSSF:
IfExist, ladder.json
{
SetTimer, loadSSF, off
FileRead, ladderString, ladder.json
JSON_obj := json_toobj(ladderString)
r := "rank"
rank := JSON_obj[r]
if ( rank == "" )
{
rank := "Rank: N/A"
} else {
rank := "Rank: " . rank
}
GuiControl,1:, guiRank, %rank%
GuiControl,1:, guiMovedRanks
return
} else {
return
}
} else {
url := "http://exiletools.com/api/ladder?league=" . league . "&char=" . charName . ""
url2 := "http://api.exiletools.com/class-rank?league=" . league . "&char=" . charName . "&format=json"
SetTimer, loadLadder, 1000
FileDelete, ladder.jsonFileDelete, classLadder.json
run "Lib\QDL.ahk" %url% "ladder.json"
run "Lib\QDL.ahk" %url2% "classLadder.json"
return
loadLadder:
IfExist, ladder.json
{
IfExist, classLadder.json
{
SetTimer, loadLadder, off
FileRead, ladderString, ladder.json
JSON_obj := json_toobj(ladderString)
For key, value in JSON_obj
combined := key
updated := JSON_obj[combined].updated
if ( updated = lastUpdated )
{
updateTrackingTimer := 60000 ; Wait one minute to check again
return
}
lastUpdated := updated
rank := JSON_obj[combined].rank
if ( !rank ) {
rank := "Min Lv:"
FileDelete, league.json
url := "http://exiletools.com/api/ladder?league=" . league . "&status=1"
SetTimer, loadMin, 1000
run "Lib\QDL.ahk" %url% "league.json"
return
loadMin:
IfExist, league.json
{
SetTimer, loadMin, off
FileRead, leagueString, league.json
leagueObj := json_toobj(leagueString)
movedRanks := leagueObj[league].toGetOnLadder.level
above1 = N/A
above2 = N/A
below1 = N/A
below2 = N/A
GuiControl,1:,guiAbove1, %above1%
GuiControl,1:,guiAbove2, %above2%
GuiControl,1:,guiBelow1, %below1%
GuiControl,1:,guiBelow2, %below2%
GuiControl,1:, guiRank, %rank%
GuiControl,1:, guiMovedRanks, %movedRanks%
return
} else {
return
}
} else {
r2 := 0
FileRead, classLadderString, classLadder.json
ClassLadderJSON := json_toobj(classLadderString)
for k, v in ClassLadderJSON {
for k2, v2 in ClassLadderJSON[k] {
if ( k2 = "total" ) {
r2 = %v2%
}
}
}
movedRanks := JSON_obj[combined].movedRanks
above1 := JSON_obj[combined].xp_to_rank_above[rank-1]
above1 := RegExReplace(above1, "(\d)(?=(?:\d{3})+(?:\.|$))", "$1,")
above2 := JSON_obj[combined].xp_to_rank_above[rank-2]
above2 := RegExReplace(above2, "(\d)(?=(?:\d{3})+(?:\.|$))", "$1,")
below1 := JSON_obj[combined].xp_to_rank_below[rank+1]
below1 := RegExReplace(below1, "(\d)(?=(?:\d{3})+(?:\.|$))", "$1,")
below2 := JSON_obj[combined].xp_to_rank_below[rank+2]
below2 := RegExReplace(below2, "(\d)(?=(?:\d{3})+(?:\.|$))", "$1,")
aliveRank := JSON_obj[combined].aliveRank
rank := "Rank: " . rank
if ( movedRanks < 0 ) {
Gui, 1:Font, cRed
GuiControl, 1:Font, guiMovedRanks
}
if ( movedRanks > 0 ) {
Gui, 1:Font, cGreen
GuiControl, 1:Font, guiMovedRanks
}
GuiControl,1:,guiAbove1, %above1%
GuiControl,1:,guiAbove2, %above2%
GuiControl,1:,guiBelow1, %below1%
GuiControl,1:,guiBelow2, %below2%
GuiControl,1:, guiRank, %rank%
GuiControl,1:, guiMovedRanks, %movedRanks%
GuiControl,1:, guiAliveRank, %aliveRank%
GuiControl,1:, guiClassRank, %r2%
}
return
} else {
return
}
} else {
return
}
}
return
}
hotkeys(){
optionsCommand:
global
Gui, 2:Show,, Macro Settings Version %macroVersion% :: AHK Version %A_AhkVersion%
return
}
submit(){
updateHotkeys:
global
Gui, 2:Submit
updsettings := "[variables]`n"
updsettings .= "CharacterName=" . guiChar . "`n"
updsettings .= "League=" . guiLeague . "`n"
updsettings .= "PoeSteam=" . guiSteam . "`n"
updsettings .= "UpdateTimer=" . guiUpdate . "`n"
updsettings .= "XOffset=" . guiXOffset . "`n"
updsettings .= "YOffset=" . guiYOffset . "`n"
updsettings .= "MonitorWhispers=" . guiMonitorWhispers . "`n"
updsettings .= "MonitorWhispersDelay=" . guiMonitorWhispersDelay . "`n"
updsettings .= "LogFileLocation=" . logFileLocation . "`n"
updsettings .= "OverlayToggle=" . toggle . "`n"
updsettings .= "SoundSelector=" . guiSoundSelector . "`n"
updsettings .= "Beta=" . guibeta . "`n"
updsettings .= "Diablo2=" . guidiablo2 . "`n"
updsettings .= "[whisperMessages]`n"
updsettings .= "wm1=" . guiwm1 . "`n"
updsettings .= "wm2=" . guiwm2 . "`n"
updsettings .= "wm3=" . guiwm3 . "`n"
updsettings .= "wm4=" . guiwm4 . "`n"
updsettings .= "wm5=" . guiwm5 . "`n"
updsettings .= "[partyMessages]`n"
updsettings .= "pm1=" . guipm1 . "`n"
updsettings .= "pm2=" . guipm2 . "`n"
updsettings .= "pm3=" . guipm3 . "`n"
updsettings .= "pm4=" . guipm4 . "`n"
updsettings .= "pm5=" . guipm5 . "`n"
updsettings .= "[hotkeys]`n"
updsettings .= "logout=" . guihotkeyLogout . "`n"
updsettings .= "superLogout=" . guihotkeySuperLogout . "`n"
updsettings .= "oos=" . guihotkeyOos . "`n"
updsettings .= "remaining=" . guihotkeyRemaining . "`n"
updsettings .= "itemLevel=" . guihotkeyItemLevel . "`n"
updsettings .= "hideout=" . guihotkeyHideout . "`n"
updsettings .= "invite=" . guihotkeyInvite . "`n"
updsettings .= "toggleOverlay=" . guihotkeyToggleOverlay . "`n"
updsettings .= "options=" . guihotkeyOptions . "`n"
updsettings .= "wm1=" . guihotkeywm1 . "`n"
updsettings .= "wm2=" . guihotkeywm2 . "`n"
updsettings .= "wm3=" . guihotkeywm3 . "`n"
updsettings .= "wm4=" . guihotkeywm4 . "`n"
updsettings .= "wm5=" . guihotkeywm5 . "`n"
updsettings .= "pm1=" . guihotkeypm1 . "`n"
updsettings .= "pm2=" . guihotkeypm2 . "`n"
updsettings .= "pm3=" . guihotkeypm3 . "`n"
updsettings .= "pm4=" . guihotkeypm4 . "`n"
updsettings .= "pm5=" . guihotkeypm5
FileDelete settings.ini
FileAppend, %updsettings%, settings.ini, UTF-16
readFromFile()
return
}
updateFiles(){
}
readFromFile(){
global
;reset hotkeys ughh.
Hotkey, IfWinActive, Path of Exile
If hotkeyLogout
Hotkey,% hotkeyLogout, logoutCommand, Off
If hotkeyOos
Hotkey,% hotkeyOos, oosCommand, Off
If hotkeyRemaining
Hotkey,% hotkeyRemaining, remainingCommand, Off
If hotkeyItemLevel
Hotkey,% hotkeyItemLevel, itemLevelCommand, Off
If hotkeyHideout
Hotkey,% hotkeyHideout, hideoutCommand, Off
If hotkeyInvite
Hotkey,% hotkeyInvite, inviteCommand, Off
If hotkeyToggleOverlay
Hotkey,% hotkeyToggleOverlay, toggleOverlayCommand, Off
If hotkeywm1
Hotkey,% hotkeywm1, whisperCommand1, Off
If hotkeywm2
Hotkey,% hotkeywm2, whisperCommand1, Off
If hotkeywm3
Hotkey,% hotkeywm3, whisperCommand1, Off
If hotkeywm4