-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path暗黑3 “老沙”按键助手.AHK
3559 lines (3400 loc) · 134 KB
/
暗黑3 “老沙”按键助手.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
; =================================================================
; 暗黑3 “老沙”按键助手 (MIT License)
; Designed by Oldsand
; 转载请注明原作者
;
;
; 查看最新更新:https://github.com/WeijieH/D3keyHelper
; 欢迎提交bug,PR
; =================================================================
;@Ahk2Exe-IgnoreBegin
AHK_MIN_VERSION:="1.1.33.00"
if (A_AhkVersion < AHK_MIN_VERSION)
MsgBox, 0x40, 若遇到错误请升级AHK软件!, % Format("本按键助手基于AHK v{:s}开发。`n你的AHK版本为:v{:s}。", AHK_MIN_VERSION, A_AhkVersion)
;@Ahk2Exe-IgnoreEnd
#SingleInstance Force
#NoEnv
#InstallKeybdHook
#InstallMouseHook
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
Thread, interrupt, 0
CoordMode, Pixel, Client
CoordMode, Mouse, Client
Process, Priority, , High
VERSION:=220913
MainWindowW:=900
MainWindowH:=550
CompactWindowW:=551
TitleBarHight:=25
;@Ahk2Exe-Obey U_Y, U_Y := A_YYYY
;@Ahk2Exe-Obey U_M, U_M := A_MM
;@Ahk2Exe-Obey U_D, U_D := A_DD
;@Ahk2Exe-SetFileVersion 1.4.%U_Y%.%U_M%%U_D%
;@Ahk2Exe-SetLanguage 0x0804
;@Ahk2Exe-SetDescription 暗黑3技能连点器
;@Ahk2Exe-SetProductName D3keyHelper
;@Ahk2Exe-SetCopyright Oldsand
;@Ahk2Exe-Bin Unicode 64-bit.bin
; ========================================来自配置文件的全局变量===================================================
currentProfile:=ReadCfgFile("d3oldsand.ini", tabs, combats, others, generals)
SendMode, % generals.sendmode
tabsarray:=StrSplit(tabs, "`|")
tabslen:=ObjCount(tabsarray)
safezone:={}
isCompact:= generals.compactmode
runOnStart:= generals.runonstart
d3only:= generals.d3only
maxreforge:= (generals.maxreforge)?generals.maxreforge:10
TitleString:=(d3only)? "暗黑3技能连点器":"鼠标键盘连点器"
TITLE:=Format(TitleString " v1.4.{:d} by Oldsand", VERSION)
helperMouseSpeed:= generals.helpermousespeed
helperAnimationDelay:= generals.helperanimationdelay
gameResolution:= InStr(generals.gameresolution, "x")? generals.gameresolution:"Auto"
hBMPButtonLeft_Normal := isCompact? hBMPButtonExpand_Normal:hBMPButtonBack_Normal
hBMPButtonLeft_Hover := isCompact? hBMPButtonExpand_Hover:hBMPButtonBack_Hover
hBMPButtonLeft_Pressed := isCompact? hBMPButtonExpand_Pressed:hBMPButtonBack_Pressed
Loop, Parse, % generals.safezone, CSV
{
safezone[A_LoopField]:=1
}
#If WinActive((d3only)?"ahk_class D3 Main Window Class":"A")
gameGamma:=(generals.gamegamma>=0.5 and generals.gamegamma<=1.5)? generals.gamegamma:1
buffpercent:=(generals.buffpercent>=0 and generals.buffpercent<=1)? generals.buffpercent:0.05
; ==============================================================================================================
GuiCreate()
SetTrayMenu()
StartUp()
showMainWindow(isCompact? CompactWindowW:MainWindowW, MainWindowH)
OnExit("OnUnload")
Return
; =================================== User Functions =====================================
/*
在程序载入时执行的一些初始化
参数:
无
返回:
无
*/
OnLoad(){
Global
Static Init := OnLoad() ; 在所有语句之前运行
; ============================================全局变量===========================================================
vRunning:=False
vPausing:=False
vFront:=True
helperDelay:=100
mouseDelay:=2
helperRunning:=False
helperBreak:=False
profileKeybinding:={}
keysOnHold:={}
DblClickTime:=DllCall("GetDoubleClickTime", "UInt")
RightButtonState:=0
LeftButtonState:=0
_CloseButtonNormal := "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAZCAYAAAAmNZ4aAAAAM0lEQVRIiWMYBaNgFIyCUUAsYCSkrnLe2v/khGZ7UjBes5lGo2gUjIJRMApGAVbAwMAAAMjYBAQ0LnL/AAAAAElFTkSuQmCC"
_CloseButtonHover := "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAZCAYAAAAmNZ4aAAAARklEQVRIiWN8Iaj8n2EAANNAWMowavGoxaMWj1pMCWAhpFfi/V2yjH8hqIxXfvD6mJDLyQWjqXrU4lGLRy0etZg4wMDAAACGJAZtrV+pPwAAAABJRU5ErkJggg=="
_CloseButtonPressed := "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAZCAYAAAAmNZ4aAAAARklEQVRIiWO85B32n2EAANNAWMowavGoxaMWj1pMCWAhpNftwjGyjN9lYIVXfvD6mJDLyQWjqXrU4lGLRy0etZg4wMDAAACzuwbMPgoPPgAAAABJRU5ErkJggg=="
_BackButtonNormal := "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAZCAYAAAAmNZ4aAAAAr0lEQVRIie2UwQ3CMAwA7Sa0ZhJGYAOWoCswDSuUJdiAFViEtIkw8gMJEKiOan4+KY9Iji+2nIDjOFagJs/xfHnb853345gGItoA4vUz/rDbzuZsagsQaUq3IYQA36RaqsRPaYwRVm2r6tYv1GJLKWjF1lIhaoJkkJgZcs6yWHFk9nIqcddRb12xqtXY4Ilo3ZdSIE+TpmIb8T/kVc/JUl79gbzKZdqXyB3HWQ4APACzI1jSHwESAQAAAABJRU5ErkJggg=="
_BackButtonHover := "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAZCAYAAAAmNZ4aAAAAn0lEQVRIiWOUbL31n2EAANNAWMowavGoxYPO4j/XdzK8qFFn+Pf+Ef0sBln6ekkuAzMLCwOToBx9LIZZysLKyiDacJVsS0mymJqWEm0xtS0FAaLKalBC+v+f+CJdsvUWQTUsxBgkEj2J6j4mKqhZNN0ZRGMmM/z5/ZvhdYM2/SymheUkZSdqWk5yAYJsOSi1kwtGWyCjFo9aTB3AwMAAAPFsSKyupuluAAAAAElFTkSuQmCC"
_BackButtonPressed := "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAZCAYAAAAmNZ4aAAAAn0lEQVRIiWM0nnz/P8MAAKaBsJRh1OJRiwedxZ8v7WA4l6fE8OvtI/pZDLL01uxMBmYWFgY2YTn6WAyzlIWVlUG/7xbZlpJkMTUtJdpialsKAkSV1aCE9P8/8UW68eT7BNWwEGOQaso0qvuYqKDm1fNgUEudzvDn92+Gi0Vq9LOYFpaTlJ2oaTnJBQiy5aDUTi4YbYGMWjxqMXUAAwMDALPRSRXM0WlaAAAAAElFTkSuQmCC"
_ExpandButtonNormal := "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAZCAYAAAAmNZ4aAAAAVUlEQVRIiWMYBaOAVoCRkLmV89b+J8fu9qRgvGYzDVSUEvTx//9keZiBkRG/0QPm45FnMQshBVXz15EXyQTSz2iqphsYTdUYYNil6lEwCoYZYGBgAACe2A+sakz0agAAAABJRU5ErkJggg=="
_ExpandButtonHover := "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAZCAYAAAAmNZ4aAAAASklEQVRIiWOUbL31n2EAANNAWMowajE9AQshu55Xq5HlHMnWW0PUx4RcTi4YzU50A6OpGgOMpuohb/FoqsYAo6l61OKhZTEDAwMAZw0QHWhren8AAAAASUVORK5CYII="
_ExpandButtonPressed := "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAZCAYAAAAmNZ4aAAAASklEQVRIiWM0nnz/P8MAAKaBsJRh1GJ6AhZCdp3NVSTLOcaT7w9RHxNyOblgNDvRDYymagwwmqqHvMWjqRoDjKbqUYuHlsUMDAwASU0Q0fLg6gAAAAAASUVORK5CYII="
DllCall("LoadLibrary", "Str", "Crypt32.dll")
DllCall("LoadLibrary", "Str", "Shlwapi.dll")
DllCall("LoadLibrary", "Str", "Gdiplus.dll")
VarSetCapacity(GdiplusStartupInput, (A_PtrSize = 8 ? 24 : 16), 0) ; GdiplusStartupInput structure
NumPut(1, GdiplusStartupInput, 0, "UInt") ; GdiplusVersion
DllCall("Gdiplus.dll\GdiplusStartup", "PtrP", pToken, "Ptr", &GdiplusStartupInput, "Ptr", 0) ; Initialize GDI+
hBMPButtonClose_Normal := GdipCreateFromBase64(_CloseButtonNormal)
hBMPButtonClose_Hover := GdipCreateFromBase64(_CloseButtonHover)
hBMPButtonClose_Pressed := GdipCreateFromBase64(_CloseButtonPressed)
hBMPButtonBack_Normal := GdipCreateFromBase64(_BackButtonNormal)
hBMPButtonBack_Hover := GdipCreateFromBase64(_BackButtonHover)
hBMPButtonBack_Pressed := GdipCreateFromBase64(_BackButtonPressed)
hBMPButtonExpand_Normal := GdipCreateFromBase64(_ExpandButtonNormal)
hBMPButtonExpand_Hover := GdipCreateFromBase64(_ExpandButtonHover)
hBMPButtonExpand_Pressed := GdipCreateFromBase64(_ExpandButtonPressed)
}
/*
在程序退出时执行的清理工作
参数:
无
返回:
无
*/
OnUnload(ExitReason, ExitCode){
Global ; Assume-Global mode
; Clean up resources used by GDI+
DllCall("GdiplusShutdown", "Ptr", pToken)
DllCall("DeregisterShellHookWindow", "Ptr", A_ScriptHwnd)
if (hHookMouse){
DllCall("UnhookWindowsHookEx", "Uint", hHookMouse)
}
}
/*
创建图形界面
参数:
无
返回:
无
*/
GuiCreate(){
Global
local tabw:=MainWindowW-357
local tabh:=MainWindowH-35-TitleBarHight
local helperSettingGroupx:=MainWindowW-345
Gui Font, s11, Segoe UI
Gui -MaximizeBox -MinimizeBox +Owner +DPIScale +LastFound -Caption -Border
Gui, Margin, 5, % TitleBarHight+10
; SS_BITMAP:=0x40
; SS_REALSIZECONTROL:=0x0E
; 0x4E=SS_BITMAP|SS_REALSIZECONTROL
Gui, Add, Picture, % "x1 y1 w" MainWindowW-2 " h" TitleBarHight " +0x4E hwndTitlebarID vTitlebar"
Gui, Add, Picture, % "x1 y+0 w" MainWindowW-2 " h1 +0x4E hwndTitlebarLineID"
Gui, Add, Picture, % "x0 y0 w" MainWindowW " h1 +0x4E hwndBorderTopID vBorderTop"
Gui, Add, Picture, % "x0 y" MainWindowH-1 " w" MainWindowW " h1 +0x4E hwndBorderBottomID vBorderBottom"
Gui, Add, Picture, % "x0 y1 w1 h" MainWindowH-2 " +0x4E hwndBorderLeftID vBorderLeft"
Gui, Add, Picture, % "x" MainWindowW-1 " y1 w1 h" MainWindowH-2 " +0x4E hwndBorderRightID vBorderRight"
Gui, Add, Text, % "x1 y1 h" TitleBarHight " hwndTitleBarTextID vTitleBarText +BackgroundTrans +0x200", %TITLE%
Gui, Add, Picture, % "x" MainWindowW-31 " y1 w-1 h" TitleBarHight " hwndUIRightButtonID vUIRightButton gdummyFunction +BackgroundTrans", % "HBITMAP:*" hBMPButtonClose_Normal
AddToolTip(UIRightButtonID, "左键:保存设置并最小化窗口至右下角`n右键:保存设置并退出程序")
Gui, Add, Picture, % "x" 1 " y1 w-1 h" TitleBarHight " hwndUILeftButtonID vUILeftButton gdummyFunction +BackgroundTrans", % "HBITMAP:*" hBMPButtonLeft_Normal
AddToolTip(UILeftButtonID, "点击以在完整,紧凑布局中切换")
GuiControlGet, TitleBarSize, Pos , TitleBarText
Gui Add, Tab3, xm ym w%tabw% h%tabh% vActiveTab gSetTabFocus AltSubmit, %tabs%
Gui Font, s9, Segoe UI
local skillLabels:=["技能一:", "技能二:", "技能三:", "技能四:", "左键技能:", "右键技能:"]
Loop, parse, tabs, `|
{
local currentTab:=A_Index
Gui Tab, %currentTab%
Gui Add, Hotkey, x0 y0 w0 w0
Gui Add, GroupBox, xm+10 ym+40 w520 h260 section, 按键宏设置
Gui Add, Text, xs+90 ys+20 w60 center section, 快捷键
Gui Add, Text, x+10 w80 center, 策略
Gui Add, Text, x+15 w110 center, 执行间隔(毫秒)
Gui Add, Text, x+5 w90 center, 延迟(毫秒)
Gui Add, Text, x+0 center, 延迟随机
Loop, 6
{
Gui Add, Text, xs-75 w70 yp+34 center, % skillLabels[A_Index]
local ac:=combats[currentTab][A_Index]["action"]
local rd:=combats[currentTab][A_Index]["random"]
switch A_Index
{
case 1,2,3,4:
Gui Add, Hotkey, x+5 yp-2 w60 vskillset%currentTab%s%A_Index%hotkey, % combats[currentTab][A_Index]["hotkey"]
case 5:
Gui Add, Edit, x+5 yp-2 w60 vskillset%currentTab%s%A_Index%hotkey +Disabled, LButton
case 6:
Gui Add, Edit, x+5 yp-2 w60 vskillset%currentTab%s%A_Index%hotkey +Disabled, RButton
}
Gui Add, DropDownList, x+10 w80 AltSubmit Choose%ac% gSetSkillsetDropdown vskillset%currentTab%s%A_Index%dropdown, 禁用||按住不放||连点||保持Buff
Gui Add, Edit, vskillset%currentTab%s%A_Index%edit x+20 w90 Number
Gui Add, Updown, vskillset%currentTab%s%A_Index%updown gSetSkillQueueWarning Range20-60000, % combats[currentTab][A_Index]["interval"]
Gui Add, Edit, vskillset%currentTab%s%A_Index%delayedit hwndskillset%currentTab%s%A_Index%delayeditID x+25 w70
Gui Add, Updown, vskillset%currentTab%s%A_Index%delayupdown Range-30000-30000, % combats[currentTab][A_Index]["delay"]
AddToolTip(skillset%currentTab%s%A_Index%delayeditID, "正数代表策略延后执行,负数代表策略提前执行,设为0可以关闭延迟")
Gui Add, Checkbox, x+35 yp+2 Checked%rd% vskillset%currentTab%s%A_Index%randomckbox hwndskillset%currentTab%s%A_Index%randomckboxID
AddToolTip(skillset%currentTab%s%A_Index%randomckboxID, "勾选后,每次策略执行时的实际延迟为0至设置值之间的随机数")
}
Gui Add, GroupBox, xm+10 yp+45 w520 h170 section, 额外设置
Gui Add, Text, xs+20 ys+30, 快速切换至本配置:
Gui Add, DropDownList, % "x+5 yp-3 w90 AltSubmit Choose" others[currentTab].profilemethod " vskillset" currentTab "profilekeybindingdropdown gSetProfileKeybinding", 无||鼠标中键||滚轮向上||滚轮向下||侧键1||侧键2||键盘按键
Gui Add, Hotkey, x+15 w100 vskillset%currentTab%profilekeybindinghkbox gSetProfileKeybinding, % others[currentTab].profilehotkey
Gui Add, Checkbox, % "x+15 yp+3 Checked" others[currentTab].autostartmarco " vskillset" currentTab "autostartmarcockbox hwndskillset" currentTab "autostartmarcockboxID", 切换后自动启动宏
AddToolTip(skillset%currentTab%autostartmarcockboxID, "开启后,以懒人模式启动的战斗宏可以在运行中无缝切换")
Gui Add, Text, xs+20 yp+37, 走位辅助:
Gui Add, DropDownList, % "x+5 yp-3 w150 AltSubmit Choose" pfmv:=others[currentTab].movingmethod " vskillset" currentTab "movingdropdown gSetMovingHelper", 无||强制站立||强制走位(按住不放)||强制走位(连点)
Gui Add, Text, vskillset%currentTab%movingtext x+10 yp+3, 间隔(毫秒):
Gui Add, Edit, vskillset%currentTab%movingedit x+5 yp-3 w60 Number
Gui Add, Updown, vskillset%currentTab%movingupdown Range20-3000, % others[currentTab].movinginterval
Gui Add, Text, xs+20 yp+40, 宏启动方式:
Gui Add, DropDownList, % "x+5 yp-3 w90 AltSubmit Choose" others[currentTab].lazymode " hwndprofileStartModeDropdown" currentTab "ID vskillset" currentTab "profilestartmodedropdown gSetStartMode", 懒人模式||仅按下时||仅按一次
AddToolTip(profileStartModeDropdown%currentTab%ID, "懒人模式:按下战斗宏快捷键时开启宏,再按一下关闭宏`n仅按下时:仅在战斗宏快捷键被压下时启动宏`n仅按一次:按下战斗宏快捷键即按下所有“按住不放”的技能键一次")
Gui Add, Checkbox, % "x+20 yp+3 Checked" others[currentTab].useskillqueue " hwnduseskillqueueckbox" currentTab "ID vskillset" currentTab "useskillqueueckbox gSetSkillQueue", 使用单线程按键队列(毫秒):
AddToolTip(useskillqueueckbox%currentTab%ID, "开启后按键不会被立刻按下而是存储至一个按键队列中`n连点会使技能加入队列头部,保持buff会使技能加入队列尾部`n并且连点时会自动按下强制站立")
Gui Add, Edit, vskillset%currentTab%useskillqueueedit hwnduseskillqueueedit%currentTab%ID x+0 yp-3 w50 Number
Gui Add, Updown, vskillset%currentTab%useskillqueueupdown gSetSkillQueueWarning Range50-1000, % others[currentTab].useskillqueueinterval
AddToolTip(useskillqueueedit%currentTab%ID, "按键队列中的连点按键会以此间隔一一发送至游戏窗口")
Gui Add, Text, x+8 yp+3 vskillset%currentTab%skillqueuewarningtext hwndskillset%currentTab%skillqueuewarningtextID gdummyFunction +cRed +Hidden, % "注意!"
AddToolTip(skillset%currentTab%skillqueuewarningtextID, "按键队列功能设置有误")
Gui Add, Checkbox, % "xs+20 yp+37 Checked" others[currentTab].enablequickpause " vskillset" currentTab "clickpauseckbox gSetQuickPause", 快速暂停:
Gui Add, DropDownList, % "x+0 yp-3 w50 AltSubmit Choose" others[currentTab].quickpausemethod1 " vskillset" currentTab "clickpausedropdown1 gSetQuickPause", 双击||单击||压住
Gui Add, DropDownList, % "x+5 yp w75 AltSubmit Choose" others[currentTab].quickpausemethod2 " vskillset" currentTab "clickpausedropdown2 gSetQuickPause", 鼠标左键||鼠标右键||鼠标中键||侧键1||侧键2
Gui Add, Text, x+5 yp+3 vskillset%currentTab%clickpausetext1, 则
Gui Add, DropDownList, % "x+5 yp-3 w140 AltSubmit Choose" others[currentTab].quickpausemethod3 " vskillset" currentTab "clickpausedropdown3", 暂停按键宏||暂停宏且连点左键
Gui Add, Edit, vskillset%currentTab%clickpauseedit x+5 yp w60 Number
Gui Add, Updown, vskillset%currentTab%clickpauseupdown Range500-5000, % others[currentTab].quickpausedelay
Gui Add, Text, x+5 yp+3 vskillset%currentTab%clickpausetext2, 毫秒
}
Gui Tab
GuiControl, Choose, ActiveTab, % currentProfile
Gui Add, GroupBox, x%helperSettingGroupx% ym+40 w338 h450 section, 辅助功能
oldsandhelperhk:=generals.oldsandhelperhk
Gui Font,s10
Gui Add, Text, xs+20 ys+30 +cRed, 助手宏启动快捷键:
Gui Font,s9
Gui Add, DropDownList, % "x+0 yp-3 w75 vhelperKeybindingdropdown gSetHelperKeybinding AltSubmit Choose" generals.oldsandhelpermethod, 无||鼠标中键||滚轮向上||滚轮向下||侧键1||侧键2||键盘按键
Gui Add, Hotkey, x+5 w70 vhelperKeybindingHK gSetHelperKeybinding, %oldsandhelperhk%
Gui Add, Text, xs+20 yp+40 hwndhelperSpeedTextID gdummyFunction, 助手宏动画速度:
AddToolTip(helperSpeedTextID, "当网络延迟较高时,适当降低动画速度可以减少宏出错的概率")
Gui Add, DropDownList, % "x+5 yp-3 w90 vhelperAnimationSpeedDropdown hwndhelperAnimationSpeedDropdownID AltSubmit Choose" generals.helperspeed, 非常快||快速||中等||慢速||自定义
AddToolTip(helperAnimationSpeedDropdownID, "非常快:鼠标速度0,动画延迟50`n快速:鼠标速度1,动画延迟100`n中等:鼠标速度2,动画延迟150`n慢速:鼠标速度3,动画延迟200`n自定义:使用配置文件中的预设值")
Gui Add, Text, x+20 yp+4 w80 hwndhelperSafeZoneTextID vhelperSafeZoneText gdummyFunction
AddToolTip(helperSafeZoneTextID, "修改配置文件中Generals区块下的safezone值来设置安全格`n格式为英文逗号连接的格子编号`n左上角格子编号为1,右上角为10,左下角为51,右下角为60")
Gui Add, CheckBox, % "xs+20 yp+35 hwndextraGambleHelperCKboxID vextraGambleHelperCKbox gSetGambleHelper Checked" generals.enablegamblehelper, 血岩赌博助手:
AddToolTip(extraGambleHelperCKboxID, "赌博时按下助手快捷键可以自动点击右键")
Gui Add, Text, vextraGambleHelperText x+5 yp, 发送右键次数
Gui Add, Edit, vextraGambleHelperEdit x+10 yp-4 w60 Number
Gui Add, Updown, vextraGambleHelperUpdown Range2-60, % generals.gamblehelpertimes
Gui Add, CheckBox, % "xs+20 yp+40 hwndextraLootHelperCkboxID vextraLootHelperCkbox gSetLootHelper Checked" generals.enableloothelper, 快速拾取助手:
AddToolTip(extraLootHelperCkboxID, "拾取装备时按下助手快捷键可以自动点击左键")
Gui Add, Text, vextraLootHelperText x+5 yp, 发送左键次数
Gui Add, Edit, vextraLootHelperEdit x+10 yp-4 w60 Number
Gui Add, Updown, vextraLootHelperUpdown Range2-99, % generals.loothelpertimes
Gui Add, CheckBox, % "xs+20 yp+40 hwndextraSalvageHelperCkboxID vextraSalvageHelperCkbox gSetSalvageHelper Checked" generals.enablesalvagehelper, 铁匠分解助手:
Gui Add, DropDownList, % "x+5 yp-4 w180 AltSubmit hwndextraSalvageHelperDropdownID vextraSalvageHelperDropdown gSetSalvageHelper Choose" generals.salvagehelpermethod, 快速分解||一键分解||智能分解||智能分解(留神圣,太古)||智能分解(只留太古)
AddToolTip(extraSalvageHelperCkboxID, "分解装备时按下助手快捷键可以自动执行所选择的策略")
AddToolTip(extraSalvageHelperDropdownID, "快速分解:按下快捷键即等同于点击鼠标左键+回车`n一键分解:一键分解背包内所有非安全格的装备`n智能分解:同一键分解,但会跳过远古,神圣,太古`n智能分解(留神圣,太古):只保留神圣,太古装备`n智能分解(只留太古):只保留太古装备")
Gui Add, CheckBox, % "xs+20 yp+40 hwndextraReforgeHelperCkboxID vextraReforgeHelperCkbox gSetReforgeHelper Checked" generals.enablereforgehelper, 魔盒重铸助手:
Gui Add, DropDownList, % "x+5 yp-4 w180 AltSubmit hwndextraReforgeHelperDropdownID vextraReforgeHelperDropdown Choose" generals.reforgehelpermethod, 重铸一次||重铸直到远古,太古||重铸直到太古
AddToolTip(extraReforgeHelperCkboxID, "当魔盒打开且在重铸页面时,按下助手快捷键可以自动执行所选择的重铸策略`n***最大重铸次数可以通过配置文件中的maxreforge变量修改***")
local strMaxReforge1:= "不停重铸鼠标指针处的装备,直到变为远古或者太古装备,最多重铸" maxreforge "次"
local strMaxReforge2:= "不停重铸鼠标指针处的装备,直到变成太古装备,最多重铸" maxreforge "次"
AddToolTip(extraReforgeHelperDropdownID, "重铸一次:重铸鼠标指针处的装备一次`n重铸直到远古,太古:" strMaxReforge1 "`n重铸直到太古:" strMaxReforge2 "`n***重铸过程中再次按下助手快捷键可以打断宏!***")
Gui Add, CheckBox, % "xs+20 yp+40 hwndextraUpgradeHelperCkboxID vextraUpgradeHelperCkbox gSetSalvageHelper Checked" generals.enableupgradehelper, 魔盒升级助手
AddToolTip(extraUpgradeHelperCkboxID, "当魔盒打开且在升级页面时,按下助手快捷键即自动升级所有非安全格内的稀有(黄色)装备")
Gui Add, CheckBox, % "x+20 yp+0 hwndextraConvertHelperCkboxID vextraConvertHelperCkbox gSetSalvageHelper Checked" generals.enableconverthelper, 魔盒转化助手
AddToolTip(extraConvertHelperCkboxID, "当魔盒打开且在转化材料页面时,按下助手快捷键即自动使用所有非安全格内的装备进行材料转化")
Gui Add, CheckBox, % "xs+20 yp+36 hwndextraAbandonHelperCkboxID vextraAbandonHelperCkbox gSetSalvageHelper Checked" generals.enableabandonhelper, 一键丢装助手
AddToolTip(extraAbandonHelperCkboxID, "当背包栏打开且鼠标指针位于背包栏内时,按下助手快捷键即自动丢弃所有非安全格的物品`n若储物箱(银行)打开且鼠标位于银行格子内时,宏会存储所有非安全格内的物品至储物箱")
Gui Add, CheckBox, % "xs+20 yp+65 vextraSoundonProfileSwitch Checked" generals.enablesoundplay, 快捷键切换配置成功时播放声音
Gui Add, CheckBox, % "x+20 yp+0 hwndextraSmartPauseID vextraSmartPause Checked" generals.enablesmartpause, 智能暂停
AddToolTip(extraSmartPauseID, "开启后,游戏中按tab键可以暂停宏`n回车键,M键,T键会停止宏")
Gui Add, CheckBox, % "xs+20 yp+35 vextraCustomStanding gSetCustomStanding Checked" generals.customstanding, 使用自定义强制站立按键:
Gui Add, Hotkey, x+5 yp-3 w70 vextraCustomStandingHK gSetCustomStanding, % generals.customstandinghk
Gui Add, CheckBox, % "xs+20 yp+35 vextraCustomMoving gSetCustomMoving Checked" generals.custommoving, 使用自定义强制移动按键:
Gui Add, Hotkey, x+5 yp-3 w70 Limit14 vextraCustomMovingHK gSetCustomMoving, % generals.custommovinghk
startRunHK:=generals.starthotkey
Gui Font, s10
Gui Add, Text, x570 ym+3 +cRed, 战斗宏启动快捷键:
Gui Font, s9
Gui Add, DropDownList, % "x+5 yp-3 w90 vStartRunDropdown gSetStartRun AltSubmit Choose" generals.startmethod, 鼠标右键||鼠标中键||滚轮向上||滚轮向下||侧键1||侧键2||键盘按键
Gui Add, Hotkey, x+5 yp w70 vStartRunHKinput gSetStartRun, %startRunHK%
Gui Add, Text, % "x10 y" MainWindowH-20 " section", 当前激活配置:
Gui Font, s11
Gui Add, Text, x+5 ys-4 w300 +cRed vStatuesSkillsetText, % tabsarray[currentProfile]
Gui Add, Text, x505 yp +cRed hwndCurrentmodeTextID gdummyFunction, % A_SendMode
Gui Font, s9
Gui Add, Text, xp-95 ys hwndSendmodeTextID gdummyFunction, 按键发送模式:
AddToolTip(SendmodeTextID, "修改配置文件General区块下的sendmode值来设置按键发送模式")
AddToolTip(CurrentmodeTextID, "Event:默认模式,最佳兼容性`nInput:推荐模式,最佳速度但可能会被一些杀毒防护软件屏蔽干扰")
Gui Add, Link, x570 ys hwndAboutLinkID, 本项目开源在:<a href="https://github.com/WeijieH/D3keyHelper">https://github.com/WeijieH/D3keyHelper</a>
AddToolTip(AboutLinkID, "别忘了给我一个star哟~ ╰(*°▽°*)╯")
Return
}
/*
在Gui创建完成后行的一些初始化
参数:
无
返回:
无
*/
StartUp(){
Global
Gosub, SetSkillsetDropdown
Gosub, SetStartRun
Gosub, SetProfileKeybinding
Gosub, SetMovingHelper
Gosub, SetHelperKeybinding
Gosub, SetQuickPause
SetGambleHelper()
SetLootHelper()
SetReforgeHelper()
SetSalvageHelper()
SetCustomStanding()
SetCustomMoving()
SetSkillQueue()
SetStartMode()
DllCall("RegisterShellHookWindow", "Ptr", A_ScriptHwnd)
hHookMouse:=0
OnMessage(DllCall("RegisterWindowMessage", "Str", "SHELLHOOK"), "Watchdog")
Watchdog(4, 0)
}
/*
设置右下角图标菜单
参数:
无
返回:
无
*/
SetTrayMenu(){
Global
Menu, Tray, NoStandard
Menu, Tray, Add, 设置, GuiShowMainWindow
Menu, Tray, Add, 退出, GuiExit
Menu, Tray, Default, 设置
Menu, Tray, Click, 1
Menu, Tray, Tip, %TITLE%
Menu, Tray, Icon, , , 1
}
/*
读取配置文件,无配置文件则返回默认设置
参数:
cfgFileName:文件名
tabs:ByRef String,存储由竖线“|”分隔的配置名,用于初始化Tab控件
combats:ByRef Array,存储战斗宏相关配置
others:ByRef Array,存储额外配置
generals:ByRef Array,存储一些通用配置
返回:
上次退出时激活的配置编号,用于初始化Tab控件
*/
ReadCfgFile(cfgFileName, ByRef tabs, ByRef combats, ByRef others, ByRef generals){
local
Global VERSION
if FileExist(cfgFileName)
{
generals:={}
IniRead, ver, %cfgFileName%, General, version
if (VERSION != ver)
{
MsgBox, 配置文件版本不匹配,如有错误请删除配置文件并手动配置。
}
IniRead, currentProfile, %cfgFileName%, General, activatedprofile, 1
IniRead, oldsandhelperhk, %cfgFileName%, General, oldsandhelperhk, F5
IniRead, oldsandhelpermethod, %cfgFileName%, General, oldsandhelpermethod, 7
IniRead, enablegamblehelper, %cfgFileName%, General, enablegamblehelper, 1
IniRead, gamblehelpertimes, %cfgFileName%, General, gamblehelpertimes, 15
IniRead, enablesalvagehelper, %cfgFileName%, General, enablesalvagehelper, 0
IniRead, salvagehelpermethod, %cfgFileName%, General, salvagehelpermethod, 1
IniRead, reforgehelpermethod, %cfgFileName%, General, reforgehelpermethod, 1
IniRead, enablereforgehelper, %cfgFileName%, General, enablereforgehelper, 0
IniRead, enableconverthelper, %cfgFileName%, General, enableconverthelper, 0
IniRead, enableupgradehelper, %cfgFileName%, General, enableupgradehelper, 0
IniRead, enablesmartpause, %cfgFileName%, General, enablesmartpause, 0
IniRead, enablesoundplay, %cfgFileName%, General, enablesoundplay, 1
IniRead, enableabandonhelper, %cfgFileName%, General, enableabandonhelper, 0
IniRead, startmethod, %cfgFileName%, General, startmethod, 7
IniRead, starthotkey, %cfgFileName%, General, starthotkey, F2
IniRead, custommoving, %cfgFileName%, General, custommoving, 0
IniRead, custommovinghk, %cfgFileName%, General, custommovinghk, e
IniRead, customstanding, %cfgFileName%, General, customstanding, 0
IniRead, customstandinghk, %cfgFileName%, General, customstandinghk, LShift
IniRead, safezone, %cfgFileName%, General, safezone, "61,62,63"
IniRead, helperspeed, %cfgFileName%, General, helperspeed, 3
IniRead, gamegamma, %cfgFileName%, General, gamegamma, 1.000000
IniRead, sendmode, %cfgFileName%, General, sendmode, "Event"
IniRead, buffpercent, %cfgFileName%, General, buffpercent, 0.050000
IniRead, compactmode, %cfgFileName%, General, compactmode, 0
IniRead, runonstart, %cfgFileName%, General, runonstart, 1
IniRead, gameresolution, %cfgFileName%, General, gameresolution, "Auto"
IniRead, enableloothelper, %cfgFileName%, General, enableloothelper, 0
IniRead, loothelpertimes, %cfgFileName%, General, loothelpertimes, 30
IniRead, helpermousespeed, %cfgFileName%, General, helpermousespeed, 2
IniRead, helperanimationdelay, %cfgFileName%, General, helperanimationdelay, 150
IniRead, d3only, %cfgFileName%, General, d3only, 1
IniRead, maxreforge, %cfgFileName%, General, maxreforge, 10
generals:={"oldsandhelpermethod":oldsandhelpermethod, "oldsandhelperhk":oldsandhelperhk, "maxreforge":maxreforge
, "enablesalvagehelper":enablesalvagehelper, "salvagehelpermethod":salvagehelpermethod, "reforgehelpermethod":reforgehelpermethod
, "d3only":d3only, "enablereforgehelper":enablereforgehelper, "runonstart":runonstart, "gameresolution":gameresolution
, "enablegamblehelper":enablegamblehelper, "gamblehelpertimes":gamblehelpertimes, "helpermousespeed":helpermousespeed
, "startmethod":startmethod, "starthotkey":starthotkey, "enableupgradehelper":enableupgradehelper, "helperanimationdelay":helperanimationdelay
, "enablesmartpause":enablesmartpause, "enablesoundplay":enablesoundplay, "enableconverthelper":enableconverthelper, "enableabandonhelper":enableabandonhelper
, "custommoving":custommoving, "custommovinghk":custommovinghk, "customstanding":customstanding, "customstandinghk":customstandinghk
, "safezone":safezone, "helperspeed":helperspeed, "gamegamma":gamegamma, "sendmode":sendmode, "buffpercent":buffpercent
, "enableloothelper":enableloothelper, "loothelpertimes":loothelpertimes, "compactmode":compactmode}
IniRead, tabs, %cfgFileName%
tabs:=StrReplace(StrReplace(tabs, "`n", "`|"), "General|", "")
combats:=[]
others:=[]
Loop, parse, tabs, `|
{
cSection:=A_LoopField
trow:=[]
tos:={}
Loop, 6
{
IniRead, hk, %cfgFileName%, %cSection%, skill_%A_Index%, %A_Index%
IniRead, ac, %cfgFileName%, %cSection%, action_%A_Index%, 1
IniRead, iv, %cfgFileName%, %cSection%, interval_%A_Index%, 300
IniRead, dy, %cfgFileName%, %cSection%, delay_%A_Index%, 10
IniRead, rd, %cfgFileName%, %cSection%, random_%A_Index%, 1
IniRead, pr, %cfgFileName%, %cSection%, priority_%A_Index%, 1
trow.Push({"hotkey":hk, "action":ac, "interval":iv, "delay":dy, "random": rd, "priority": pr})
}
combats.Push(trow)
IniRead, pfmd, %cfgFileName%, %cSection%, profilehkmethod, 1
IniRead, pfhk, %cfgFileName%, %cSection%, profilehkkey
IniRead, pfmv, %cfgFileName%, %cSection%, movingmethod, 1
IniRead, pfmi, %cfgFileName%, %cSection%, movinginterval, 100
IniRead, pflm, %cfgFileName%, %cSection%, lazymode, 1
IniRead, pfqp, %cfgFileName%, %cSection%, enablequickpause, 0
IniRead, pfqpm1, %cfgFileName%, %cSection%, quickpausemethod1, 1
IniRead, pfqpm2, %cfgFileName%, %cSection%, quickpausemethod2, 1
IniRead, pfqpm3, %cfgFileName%, %cSection%, quickpausemethod3, 1
IniRead, pfqpdy, %cfgFileName%, %cSection%, quickpausedelay, 1500
IniRead, pfusq, %cfgFileName%, %cSection%, useskillqueue, 0
IniRead, pfusqiv, %cfgFileName%, %cSection%, useskillqueueinterval, 200
IniRead, pfasm, %cfgFileName%, %cSection%, autostartmarco, 0
tos:={"profilemethod":pfmd, "profilehotkey":pfhk, "movingmethod":pfmv, "movinginterval":pfmi, "lazymode":pflm
, "enablequickpause":pfqp, "quickpausemethod1":pfqpm1, "quickpausemethod2":pfqpm2, "quickpausemethod3":pfqpm3
, "quickpausedelay":pfqpdy, "useskillqueue":pfusq, "useskillqueueinterval":pfusqiv, "autostartmarco":pfasm}
others.Push(tos)
}
}
Else
{
tabs=配置1|配置2|配置3|配置4
currentProfile:=1
combats:=[]
others:=[]
hks:="1,2,3,4,LButton,RButton"
Loop, parse, tabs, `|
{
crow:=[]
loop, parse, hks, CSV
{
crow.Push({"hotkey":A_LoopField, "action":1, "interval":300, "delay":10, "random": 1, "priority":1})
}
combats.Push(crow)
others.Push({"profilemethod":1, "profilehotkey":"", "movingmethod":1, "movinginterval":100, "lazymode":1
, "enablequickpause":0, "quickpausemethod1":1, "quickpausemethod2":1, "quickpausemethod3":1, "quickpausedelay":1500
, "useskillqueue":0, "useskillqueueinterval":200, "autostartmarco":0})
}
generals:={"enablegamblehelper":1 ,"gamblehelpertimes":15, "oldsandhelperhk":"F5", "d3only":1, "maxreforge":10
, "startmethod":7, "starthotkey":"F2", "enablesmartpause":1, "salvagehelpermethod":1, "reforgehelpermethod":1
, "oldsandhelpermethod":7, "enablesalvagehelper":0, "enablesoundplay":1, "enableconverthelper":0
, "enablereforgehelper":0, "enableupgradehelper":0, "enableabandonhelper":0, "runonstart":1
, "custommoving":0, "custommovinghk":"e", "customstanding":0, "customstandinghk":"LShift", "helpermousespeed":2
, "safezone":"61,62,63", "helperspeed":3, "gamegamma":1.000000, "sendmode":"Event", "helperanimationdelay":150
, "buffpercent":0.050000, "enableloothelper":0, "loothelpertimes":30, "compactmode":0, "gameresolution":"Auto"}
}
Return currentProfile
}
/*
保存配置文件
参数:
cfgFileName:文件名
tabs:String,由竖线“|”分隔的配置名
currentProfile:int, 当前激活的配置页面编号
safezone: Array,安全区域的配置int
VERSION:int,版本
返回:
无
*/
SaveCfgFile(cfgFileName, tabs, currentProfile, safezone, VERSION){
createOrTruncateFile(cfgFileName)
GuiControlGet, extraGambleHelperCKbox
GuiControlGet, extraGambleHelperUpdown
GuiControlGet, helperKeybindingdropdown
GuiControlGet, helperKeybindingHK
GuiControlGet, extraLootHelperCkbox
GuiControlGet, extraLootHelperUpdown
GuiControlGet, extraSmartPause
GuiControlGet, extraSalvageHelperCkbox
GuiControlGet, extraSalvageHelperDropdown
GuiControlGet, extraReforgeHelperCkbox
GuiControlGet, extraReforgeHelperDropdown
GuiControlGet, extraConvertHelperCkbox
GuiControlGet, extraUpgradeHelperCkbox
GuiControlGet, extraSoundonProfileSwitch
GuiControlGet, extraAbandonHelperCkbox
GuiControlGet, extraCustomMoving
GuiControlGet, extraCustomMovingHK
GuiControlGet, extraCustomStanding
GuiControlGet, extraCustomStandingHK
GuiControlGet, helperAnimationSpeedDropdown
IniWrite, %VERSION%, %cfgFileName%, General, version
IniWrite, %currentProfile%, %cfgFileName%, General, activatedprofile
IniWrite, %extraGambleHelperCKbox%, %cfgFileName%, General, enablegamblehelper
IniWrite, %extraGambleHelperUpdown%, %cfgFileName%, General, gamblehelpertimes
IniWrite, %extraSmartPause%, %cfgFileName%, General, enablesmartpause
IniWrite, %extraSalvageHelperCkbox%, %cfgFileName%, General, enablesalvagehelper
IniWrite, %extraSalvageHelperDropdown%, %cfgFileName%, General, salvagehelpermethod
IniWrite, %extraReforgeHelperCkbox%, %cfgFileName%, General, enablereforgehelper
IniWrite, %extraReforgeHelperDropdown%, %cfgFileName%, General, reforgehelpermethod
Global maxreforge
IniWrite, %maxreforge%, %cfgFileName%, General, maxreforge
IniWrite, %extraUpgradeHelperCkbox%, %cfgFileName%, General, enableupgradehelper
IniWrite, %extraConvertHelperCkbox%, %cfgFileName%, General, enableconverthelper
IniWrite, %extraAbandonHelperCkbox%, %cfgFileName%, General, enableabandonhelper
IniWrite, %extraLootHelperCkbox%, %cfgFileName%, General, enableloothelper
IniWrite, %extraLootHelperUpdown%, %cfgFileName%, General, loothelpertimes
IniWrite, %extraSoundonProfileSwitch%, %cfgFileName%, General, enablesoundplay
IniWrite, %helperKeybindingHK%, %cfgFileName%, General, oldsandhelperhk
IniWrite, %helperKeybindingdropdown%, %cfgFileName%, General, oldsandhelpermethod
IniWrite, %extraCustomMoving%, %cfgFileName%, General, custommoving
IniWrite, %extraCustomMovingHK%, %cfgFileName%, General, custommovinghk
IniWrite, %extraCustomStanding%, %cfgFileName%, General, customstanding
IniWrite, %extraCustomStandingHK%, %cfgFileName%, General, customstandinghk
IniWrite, %helperAnimationSpeedDropdown%, %cfgFileName%, General, helperspeed
safezone:=keyJoin(",", safezone)
IniWrite, %safezone%, %cfgFileName%, General, safezone
Global gameGamma, buffpercent, isCompact, runOnStart, gameResolution, helperAnimationDelay, helperMouseSpeed, d3only
IniWrite, %d3only%, %cfgFileName%, General, d3only
IniWrite, %gameGamma%, %cfgFileName%, General, gamegamma
IniWrite, %A_SendMode%, %cfgFileName%, General, sendmode
IniWrite, %buffpercent%, %cfgFileName%, General, buffpercent
IniWrite, %isCompact%, %cfgFileName%, General, compactmode
IniWrite, %runOnStart%, %cfgFileName%, General, runonstart
IniWrite, %gameResolution%, %cfgFileName%, General, gameresolution
IniWrite, %helperAnimationDelay%, %cfgFileName%, General, helperanimationdelay
IniWrite, %helperMouseSpeed%, %cfgFileName%, General, helpermousespeed
GuiControlGet, StartRunDropdown
GuiControlGet, StartRunHKInput
IniWrite, %StartRunDropdown%, %cfgFileName%, General, startmethod
IniWrite, %StartRunHKInput%, %cfgFileName%, General, starthotkey
global combats
Loop, parse, tabs, `|
{
cSection:=A_Index
nSction:=A_LoopField
Loop, 6
{
GuiControlGet, skillset%cSection%s%A_Index%hotkey
GuiControlGet, skillset%cSection%s%A_Index%dropdown
GuiControlGet, skillset%cSection%s%A_Index%updown
GuiControlGet, skillset%cSection%s%A_Index%delayupdown
GuiControlGet, skillset%cSection%s%A_Index%randomckbox
pr:=combats[cSection][A_Index]["priority"]
IniWrite, % skillset%cSection%s%A_Index%dropdown, %cfgFileName%, %nSction%, action_%A_Index%
IniWrite, % skillset%cSection%s%A_Index%updown, %cfgFileName%, %nSction%, interval_%A_Index%
IniWrite, % skillset%cSection%s%A_Index%delayupdown, %cfgFileName%, %nSction%, delay_%A_Index%
IniWrite, % skillset%cSection%s%A_Index%randomckbox, %cfgFileName%, %nSction%, random_%A_Index%
IniWrite, % pr, %cfgFileName%, %nSction%, priority_%A_Index%
if (A_Index < 5)
{
IniWrite, % skillset%cSection%s%A_Index%hotkey, %cfgFileName%, %nSction%, skill_%A_Index%
}
}
GuiControlGet, skillset%cSection%profilekeybindingdropdown
GuiControlGet, skillset%cSection%profilekeybindinghkbox
IniWrite, % skillset%cSection%profilekeybindingdropdown, %cfgFileName%, %nSction%, profilehkmethod
IniWrite, % skillset%cSection%profilekeybindinghkbox, %cfgFileName%, %nSction%, profilehkkey
GuiControlGet, skillset%cSection%movingdropdown
GuiControlGet, skillset%cSection%movingupdown
IniWrite, % skillset%cSection%movingdropdown, %cfgFileName%, %nSction%, movingmethod
IniWrite, % skillset%cSection%movingupdown, %cfgFileName%, %nSction%, movinginterval
GuiControlGet, skillset%cSection%profilestartmodedropdown
IniWrite, % skillset%cSection%profilestartmodedropdown, %cfgFileName%, %nSction%, lazymode
GuiControlGet, skillset%cSection%clickpauseckbox
IniWrite, % skillset%cSection%clickpauseckbox, %cfgFileName%, %nSction%, enablequickpause
GuiControlGet, skillset%cSection%clickpausedropdown1
IniWrite, % skillset%cSection%clickpausedropdown1, %cfgFileName%, %nSction%, quickpausemethod1
GuiControlGet, skillset%cSection%clickpausedropdown2
IniWrite, % skillset%cSection%clickpausedropdown2, %cfgFileName%, %nSction%, quickpausemethod2
GuiControlGet, skillset%cSection%clickpausedropdown3
IniWrite, % skillset%cSection%clickpausedropdown3, %cfgFileName%, %nSction%, quickpausemethod3
GuiControlGet, skillset%cSection%clickpauseupdown
IniWrite, % skillset%cSection%clickpauseupdown, %cfgFileName%, %nSction%, quickpausedelay
GuiControlGet, skillset%cSection%useskillqueueckbox
IniWrite, % skillset%cSection%useskillqueueckbox, %cfgFileName%, %nSction%, useskillqueue
GuiControlGet, skillset%cSection%useskillqueueedit
IniWrite, % skillset%cSection%useskillqueueedit, %cfgFileName%, %nSction%, useskillqueueinterval
GuiControlGet, skillset%cSection%autostartmarcockbox
IniWrite, % skillset%cSection%autostartmarcockbox, %cfgFileName%, %nSction%, autostartmarco
}
Return
}
/*
计算当前分辨率下技能buff条最左边像素的坐标
参数:
D3W:int,窗口区域的宽度
D3H:int,窗口区域的高度
buttonID:int,按钮的ID,最左为1,最右(鼠标右键)为6
percent: float,从左计算,取样点在Buff条上位置的百分比
返回:
[x坐标,y坐标]
*/
getSkillButtonBuffPos(D3W, D3H, buttonID, percent){
static x:=[1288, 1377, 1465, 1554, 1647, 1734]
static w:=63
y:=1328*D3H/1440
Return [Round(D3W/2-(3440/2-x[buttonID]-percent*w)*D3H/1440), Round(y)]
}
/*
将16进制的颜色标签转化为RGB array。 FFFFFF -> [255, 255, 255]
当游戏gamma不为1时,会尝试进行gamma修正。
参数:
vthiscolor:16进制的RGB颜色标签,PixelGetColor直出
返回:
[R,G,B]
*/
splitRGB(vthiscolor){
local
Global gameGamma
vblue:=(vthiscolor & 0xFF)
vgreen:=((vthiscolor & 0xFF00) >> 8)
vred:=((vthiscolor & 0xFF0000) >> 16)
if (Abs(gameGamma-1)>=0.01)
{
vblue:=((vblue / 255) ** (1.75*gameGamma-0.75)) * 255
vgreen:=((vgreen / 255) ** (1.9*gameGamma-0.9)) * 255
vred:=((vred / 255) ** (1.9*gameGamma-0.9)) * 255
}
Return [vred, vgreen, vblue]
}
/*
负责发送技能按键
参数:
currentProfile:int,当前激活的配置编号
nskill: int, 技能按钮编号 1-6
D3W:int,窗口区域的宽度
D3H:int,窗口区域的高度
forceStandingKey:强制站立按键
useSkillQueue:Bool,是否使用技能列表
返回:
无
*/
skillKey(currentProfile, nskill, D3W, D3H, forceStandingKey, useSkillQueue){
local
Global vPausing, vRunning, skillQueue, buffpercent, gameX, gameY, syncTimer, syncDelay
global combats
GuiControlGet, skillset%currentProfile%s%nskill%hotkey
GuiControlGet, skillset%currentProfile%s%nskill%delayupdown
GuiControlGet, skillset%currentProfile%s%nskill%randomckbox
GuiControlGet, skillset%currentProfile%s%nskill%updown
Loop, 6
{
GuiControlGet, skillset%currentProfile%s%A_Index%dropdown
; 循环检查其他按键的策略选择
if (A_Index = nskill){
Continue
}
; 如果有其他按键策略为保持buff,且优先级更高
if (skillset%currentProfile%s%A_Index%dropdown = 4 and combats[currentProfile][A_Index]["priority"]>combats[currentProfile][nskill]["priority"])
{
; 检查其buff是否激活
magicXY:=getSkillButtonBuffPos(D3W, D3H, A_Index, buffpercent)
crgb:=getPixelRGB(magicXY)
; 如果已激活,直接返回
if (crgb[2]>=95) {
Return
}
}
}
k:=skillset%currentProfile%s%nskill%hotkey
switch skillset%currentProfile%s%nskill%dropdown
{
; 连点
case 3:
if !(vPausing) and vRunning
{
if (abs(skillset%currentProfile%s%nskill%delayupdown)>20)
{
if (skillset%currentProfile%s%nskill%randomckbox)
{
Random, delay, 10, abs(skillset%currentProfile%s%nskill%delayupdown)
}
Else
{
delay:=abs(skillset%currentProfile%s%nskill%delayupdown)
}
syncDelay[nskill]:=delay
if (skillset%currentProfile%s%nskill%delayupdown<0)
{
syncDelay[nskill]:=skillset%currentProfile%s%nskill%updown - delay
}
syncTimer[nskill]:=A_TickCount
while (A_TickCount - syncTimer[nskill] <= syncDelay[nskill])
{
sleep 10
}
}
if useSkillQueue
{
; 当技能列表大于1000时什么都不做,防止占用过多内存
if (skillQueue.Count() < 1000){
; 按键加入技能列表头部
; [k, 3] k是具体按键,3代表因为连点加入
skillQueue.InsertAt(1, [k, 3])
}
}
Else
{
Send {Blind}{%k%}
}
}
; 保持buff
case 4:
if !(vPausing) and vRunning
{
; 获得对应按键buff条最左侧坐标
magicXY:=getSkillButtonBuffPos(D3W, D3H, nskill, buffpercent)
crgb:=getPixelRGB(magicXY)
; 具体判断是否需要补buff
if (crgb[2]<95)
{
switch nskill
{
case 5:
; 判断按键是否是左键
if useSkillQueue
{
if (skillQueue.Count() < 1000){
; 4代表因为补buff加入
skillQueue.Push([k, 4])
}
}
Else
{
; 判断是否需要强制站立再点击左键
if GetKeyState(forceStandingKey)
{
Send {Blind}{%k%}
}
Else
{
Send {Blind}{%forceStandingKey% down}{%k% down}
Send {Blind}{%k% up}{%forceStandingKey% up}
}
}
Default:
if useSkillQueue
{
if (skillQueue.Count() < 1000){
skillQueue.Push([k, 4])
}
}
Else
{
Send {Blind}{%k%}
}
}
}
}
}
Return
}
/*
清空配置文件,并写入默认的文件头
参数:
FileName:配置文件名
返回:
无
*/
createOrTruncateFile(FileName){
if (FileName = "")
{
return
}
file:=FileOpen(FileName, "w", "UTF-16")
if !IsObject(file)
{
MsgBox 无法创建或写入文件:"%FileName%"
return
}
file.Write("; ===============================================`r`n")
file.Write("; 欢迎来到“老沙”D3按键宏的配置文件。`r`n")
file.Write("; 每个非General区块都对应一套按键配置,可以自由增删。`r`n")
file.Write("; ===============================================`r`n")
file.Close()
}
/*
负责开启助手宏
参数:
无
返回:
无
*/
oldsandHelper(){
local
Global helperRunning, helperBreak, helperDelay, mouseDelay, vRunning, helperAnimationDelay, helperMouseSpeed, gameX, gameY
if helperRunning{
; 防止过快连按
; 宏在执行中再按可以打断
helperBreak:=True
helperRunning:=False
Sleep, 200
Return
}
; 如果战斗宏开启或者无法获取游戏分辨率,则返回
if (vRunning or !getGameResulution(D3W, D3H)){
Return
}
gameXY:=getGameXYonScreen(0,0)
gameX:=gameXY[1]
gameY:=gameXY[2]
helperRunning:=True
helperBreak:=False
GuiControlGet, extraGambleHelperCKbox
GuiControlGet, extraLootHelperCkbox
GuiControlGet, extraSalvageHelperCkbox
GuiControlGet, extraReforgeHelperCkbox
GuiControlGet, extraUpgradeHelperCkbox
GuiControlGet, extraConvertHelperCkbox
GuiControlGet, extraAbandonHelperCkbox
GuiControlGet, extraSalvageHelperDropdown
GuiControlGet, helperAnimationSpeedDropdown
MouseGetPos, xpos, ypos ; 当前鼠标位置,用于宏结束后返回
; 载入预设动画速度
switch helperAnimationSpeedDropdown
{
case 1:
mouseDelay:=0
helperDelay:=50
case 2:
mouseDelay:=1
helperDelay:=100
case 3:
mouseDelay:=2
helperDelay:=150
case 4:
mouseDelay:=3
helperDelay:=200
Default:
mouseDelay:=helperMouseSpeed
helperDelay:=helperAnimationDelay
}
SetDefaultMouseSpeed, mouseDelay
; 鼠标位置。1:位于背包栏。2:位于储物栏(银行)。-1:其他
mousePosition:=-1
if (xpos>D3W-(3440-2740)*D3H/1440 and ypos>730*D3H/1440 and ypos<1150*D3H/1440)
{
mousePosition:=1
}
else if (xpos>65*D3H/1440 and xpos<640*D3H/1440 and ypos>275*D3H/1440 and ypos<1150*D3H/1440)
{
mousePosition:=2
}
; 当鼠标在左侧
if (xpos<680*D3H/1440)
{
if (extraGambleHelperCKbox and isGambleOpen(D3W, D3H))
{
; 赌博助手
SetTimer, gambleHelper, -1
Return
}
}
; 分解助手逻辑
if (extraSalvageHelperCkbox)
{
; 判断分解页面是否打开
r:=isSalvagePageOpen(D3W, D3H)
switch r[1]
{
; 铁匠页面打开且分解页面打开
case 2:
if(extraSalvageHelperDropdown=1) ;选择了快速分解
{
; 当鼠标在背包栏内
if(mousePosition = 1)
{
; 执行快速分解
quickSalvageHelper(D3W, D3H, helperDelay)
helperRunning:=False
}
}
Else ;选择其他分解选项
{
salvageIconXY:=getSalvageIconXY(D3W, D3H, "center")
MouseMove, salvageIconXY[1][1], salvageIconXY[1][2]
; 判断拆解按钮是否已经按下
if (r[2][3]<10 and r[2][1]+r[2][2]>400)
{
if helperBreak
{
helperRunning:=False
Return
}
; 分解按钮已经按下,右键取消然后重新获得颜色信息
Click, Right
Sleep, helperDelay
p:=getSalvageIconXY(D3W, D3H, "edge")
r[3]:=getPixelRGB(p[2])
r[4]:=getPixelRGB(p[3])
r[5]:=getPixelRGB(p[4])
}
; [黄分解条件,蓝分解条件,白/灰分解条件]
_wait:=-1
for i, _c in [r[5][1]>50, r[4][3]>65, r[3][1]>65]
{
if _c
{
if helperBreak
{
helperRunning:=False
Return
}
; 启动一键分解前等待装备消失
_wait:=-helperDelay-50
MouseMove, salvageIconXY[5-i][1], salvageIconXY[5-i][2]
Click
Sleep, helperDelay
Send {Enter}
}
}
; 点击分解按钮
MouseMove, salvageIconXY[1][1], salvageIconXY[1][2]
Sleep, helperDelay//2
Click
if helperBreak
{
helperRunning:=False
Return
}
Sleep, helperDelay//2
; 执行一键分解
fn:=Func("oneButtonSalvageHelper").Bind(D3W, D3H, xpos, ypos)
SetTimer, %fn%, %_wait%
}
Return
case 1:
; 铁匠页面打开但是不在分解页面
helperRunning:=False
Return
Default:
; 铁匠页面未打卡
}
}
; 卡奈魔盒助手
if (extraReforgeHelperCkbox or extraUpgradeHelperCkbox or extraConvertHelperCkbox)