-
Notifications
You must be signed in to change notification settings - Fork 15
/
原神.ahk
381 lines (357 loc) · 7 KB
/
原神.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
; https://stackoverflow.com/questions/43298908/how-to-add-administrator-privileges-to-autohotkey-script
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
try ; leads to having the script re-launching itself as administrator
{
if A_IsCompiled
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
I_Icon = klee.ico
IfExist, %I_Icon%
Menu, Tray, Icon, %I_Icon%
#IfWinActive ahk_exe YuanShen.exe
F1::l
F2::o
RCtrl::LCtrl
LCtrl::MButton
; 鼠标侧键 1 等于前进,连按两下等于按住 w
XButton1::
Send {w down}
KeyWait, XButton1, T0.3
If Not ErrorLevel
{
Send {w up}
KeyWait, XButton1, D T0.2
If Not ErrorLevel
{
Send {w down}
}
}
Else
{
KeyWait, XButton1
Send {w up}
}
Return
; 鼠标侧键 2 等于 F 键,按住等于按住 Alt 键显示鼠标
XButton2::
KeyWait, XButton2, T0.2
If ErrorLevel
{
Send, {LAlt down}
KeyWait, XButton2
Send, {LAlt up}
}
else
{
Send f
}
Return
; 按住鼠标中键等于狂按左键(攻击或者跳过对话)
MButton::
Loop
{
Click
KeyWait, MButton, T0.1
If Not ErrorLevel
{
Break
}
}
Return
; 按住空格等于狂按空格(按住 1.3 秒之后才触发,因为离开浪船需要按住空格)
~*Space::
KeyWait, Space, T1.3
If Not ErrorLevel
{
PixelGetColor, color, 700, 1020
If (color == 0xD8E5EC)
{
BlockInput, MouseMove
MouseMove, 700, 1020
Click
BlockInput, MouseMoveOff
Return
}
PixelGetColor, color, 1130, 880
If (color == 0x66534A)
{
BlockInput, MouseMove
MouseGetPos, xpos, ypos
MouseMove, 1130, 880
Click
MouseMove, %xpos%, %ypos%
BlockInput, MouseMoveOff
Return
}
Return
}
Loop
{
Send, {Space}
KeyWait, Space, T0.05
If Not ErrorLevel
{
Break
}
}
Return
; 按住 f 等于狂按 f
*f::
Loop
{
Send, {Blind}f
KeyWait, f, T0.1
If Not ErrorLevel
{
Break
}
}
Return
; 点两下 w 按住 w
~w::
KeyWait, w, T0.3
If Not ErrorLevel
{
KeyWait, w, D T0.2
If Not ErrorLevel
{
KeyWait, w
Send {w down}
}
}
Return
; 释放按住的 w
~s::
If Not GetKeyState("w", "P")
{
Send {w up}
}
Return
; 队伍切换界面左右
~a::
PixelGetColor, color, 64, 538
If (color == 0xD8E5EC)
{
BlockInput, MouseMove
MouseMove, 64, 538
Click
BlockInput, MouseMoveOff
}
Return
~d::
PixelGetColor, color, 1853, 538
If (color == 0xD8E5EC)
{
BlockInput, MouseMove
MouseMove, 1853, 538
Click
BlockInput, MouseMoveOff
}
Return
; 对话选项
Selection(n) {
xpos := 1298
choices := 0
Loop, 8
{
ypos := 810 - 74 * choices
PixelGetColor, color, %xpos%, %ypos%
If (color != 0xFFFFFF)
{
Break
}
choices += 1
}
if (choices == 0)
{
Return False
}
ypos := 810 - 74 * choices + 74 * n
BlockInput, MouseMove
MouseMove, %xpos%, %ypos%
Click
BlockInput, MouseMoveOff
Return True
}
~1::
PixelGetColor, color, 64, 538
If (color == 0xD8E5EC)
{
BlockInput, MouseMove
MouseMove, 350, 490
Click
BlockInput, MouseMoveOff
Return
}
If (Selection(1))
{
Return
}
Return
~2::
PixelGetColor, color, 64, 538
If (color == 0xD8E5EC)
{
BlockInput, MouseMove
MouseMove, 760, 490
Click
BlockInput, MouseMoveOff
Return
}
If (Selection(2))
{
Return
}
Return
~3::
PixelGetColor, color, 64, 538
If (color == 0xD8E5EC)
{
BlockInput, MouseMove
MouseMove, 1170, 490
Click
BlockInput, MouseMoveOff
Return
}
If (Selection(3))
{
Return
}
Return
~4::
PixelGetColor, color, 64, 538
If (color == 0xD8E5EC)
{
BlockInput, MouseMove
MouseMove, 1590, 490
Click
BlockInput, MouseMoveOff
Return
}
If (Selection(4))
{
Return
}
Return
~5::
If (Selection(5))
{
Return
}
Return
~6::
If (Selection(6))
{
Return
}
Return
~7::
If (Selection(7))
{
Return
}
Return
; 替换圣遗物、领取任务奖励
`::
BlockInput, MouseMove
MouseGetPos, xpos, ypos
MouseMove, 1600, 1000
Click
Sleep 100
MouseMove, 1200, 760
Click
Sleep 100
MouseMove, %xpos%, %ypos%
BlockInput, MouseMoveOff
Return
; 强化圣遗物、领取任务奖励
F8::
BlockInput, MouseMove
MouseGetPos, xpos, ypos
xpos2 := xpos
ypos2 := ypos
Loop, 6
{
Click
xpos2 += 142
If (xpos2 > 1142)
{
xpos2 -= 8 * 142
ypos2 += 168
}
MouseMove %xpos2%, %ypos2%
}
Send {Esc}
Sleep 100
MouseMove, 1600, 1000
Click
MouseMove, 130, 150
Click
MouseMove, 130, 225
Click
MouseMove, 1250, 870
Click
MouseMove, %xpos%, %ypos%
BlockInput, MouseMoveOff
Return
; 点击右下角的确定
Tab::
KeyWait, Tab, T0.3
If ErrorLevel
{
Loop
{
Click
KeyWait, Tab, T0.6
If Not ErrorLevel
{
Break
}
}
}
else
{
BlockInput, MouseMove
MouseGetPos, xpos, ypos
MouseMove, 1650, 1000
Click
MouseMove, %xpos%, %ypos%
BlockInput, MouseMoveOff
}
Return
; 5个探索派遣
Expedition(x1, y1, x2, y2, x3, y3) {
BlockInput, MouseMove
MouseMove, x1, y1
Sleep 50
Click
MouseMove, x2, y2
Sleep 50
Click
MouseMove, 1650, 1000
Click
Sleep 250
Click
Sleep 250
Click
MouseMove, x3, y3
Sleep 50
Click
BlockInput, MouseMoveOff
}
F9::
; 蒙德
Expedition(150, 165, 1063, 333, 300, 150)
Expedition(150, 165, 1176, 659, 300, 300)
; 璃月
Expedition(150, 230, 724, 333, 300, 150)
Expedition(150, 230, 961, 454, 300, 300)
; 稻妻
Expedition(150, 300, 1101, 283, 300, 150)
Return