Last active
October 25, 2017 09:03
-
-
Save Gateswong/884f58b1333abb920a53f5e45d8e9cad to your computer and use it in GitHub Desktop.
钓鱼脚本 2015年末版
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LogStart "D:\keyLog\WOW_Fishing.log" | |
// Cursors (光标值,需要自己用按键精灵找,设置中需要打开“硬件指针”) | |
Dim csLure, csDefault | |
csLure = 1053591638 | |
csDefault = 965986689 | |
// Key Mapping (钓鱼放到热键上) | |
Dim kFish | |
kFish = "1" | |
// Timing Robust | |
Function timerExpired(pBegin, pRunTime) | |
Dim tNow | |
tNow = Now | |
timerExpired = (DateDiff ("s", pBegin, tNow) > pRunTime) | |
End Function | |
// Fishing | |
Dim beginX, beginY, dX, dY, endX, endY | |
beginX = 400 | |
beginY = 335 | |
endX = 900 | |
endY = 336 | |
dX = 15 | |
dY = 40 | |
cMeterValue = "C5C5C3"// Win 10 VU Meter | |
Function findLure | |
x = beginX | |
y = beginY | |
While y < endY | |
While x < endX | |
Delay 50 | |
MoveTo x, y | |
If GetCursorShape(0) = csLure Then | |
findLure = True | |
Exit Function | |
End If | |
x = x + dX | |
Wend | |
x = beginX | |
y = y + dY | |
Wend | |
findLure = False | |
Exit Function | |
End Function | |
// 判断鱼上钩的位置,使用的是Win 10的音量指示器 (Volume Mixer) | |
Dim harvX, harvY | |
harvX = 1830 | |
harvY = 936 | |
Function canHarvest | |
FindColor harvX, harvY, harvX + 2, harvY + 2,cMeterValue,intX,intY | |
canHarvest = intX > 0 And intY > 0 | |
End Function | |
Dim tLureTime | |
tLureTime = 0 | |
Function attachLure | |
If timerExpired(tLureTime, 10 * 60) Then | |
Delay 1000 | |
KeyPress "5", 1 | |
Delay 4000 | |
tLureTime = Now | |
End If | |
End Function | |
Function doFish | |
MoveTo beginX, beginY | |
Call attachLure | |
KeyPress "4", 1 | |
Delay 250 | |
KeyPress "1", 1 | |
Delay 1000 | |
Dim tBeginFish | |
tBeginFish = Now | |
TracePrint "doFish: " & tBeginFish | |
If findLure Then | |
While Not timerExpired(tBeginFish, 20) | |
If canHarvest Then | |
RightClick 1 | |
TracePrint "Time cost: " & DateDiff("s", tBeginFish, Now) | |
Delay 1000 | |
Exit Function | |
End If | |
Wend | |
End If | |
End Function | |
Function main(pRunTime) | |
Dim tBegin | |
tBegin = Now | |
While true | |
If timerExpired(tBegin, pRunTime) Then | |
Exit Function | |
End If | |
doFish | |
Wend | |
End Function | |
Call main(60 * 60 * 10) | |
LogStop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment