VBSBegin
Dim rec1(3),rec2(3),rec3(3),rec4(3)
'完整区域(220,120,1220,700)
rec1(0)=220
rec1(1)=120
rec1(2)=1220
rec1(3)=700
'任务区域(220,280,430,630)
rec2(0)=220
rec2(1)=320
rec2(2)=430
rec2(3)=630
'对话区域(470,180,1200,630)
rec3(0)=470
rec3(1)=120
rec3(2)=1200
rec3(3)=630
'菜单区域(506,645,1180,700)
rec4(0)=506
rec4(1)=645
rec4(2)=1180
rec4(3)=700
'--------------------------------------
'查找目标
Sub findTarget(rec,bmp,intX,intY)
FindPic rec(0),rec(1),rec(2),rec(3),"Attachment:\"+bmp+".bmp",1,intX,intY
End Sub
'--------------------------------------
'检查目标
Function testTarget(rec,bmp)
findTarget rec,bmp,intX,intY
If intX>0 Then
testTarget=True
Else
testTarget=False
End If
End Function
'--------------------------------------
'点击目标
Sub clickTarget(rec,bmp,done,dx,dy)
findTarget rec,bmp,intX,intY
If intX>0 Then
MoveTo intX+dx,intY+dy
Delay 20
LeftClick 0
waitLoading
done=True
Else
done=False
End If
End Sub
'---------------------------------------
'切换到任务追踪
Sub clickRWZZ
MoveTo 282,297
Delay 20
LeftClick 0
waitLoading
Delay 200
End Sub
'---------------------------------------
'切换到可接任务
Sub clickKJRW
MoveTo 354,297
Delay 20
LeftClick 0
waitLoading
Delay 200
End Sub
'---------------------------------------
'等待数据加载
Sub waitLoading
Do
Delay 200
findTarget rec3,"正在请求数据",intX,intY
Loop While intX>0
End Sub
'---------------------------------------
'等待对话
Sub waitTalk
Do
Delay 200
findTarget rec3,"对话泡泡-大",intX,intY
Loop While intX<=0
End Sub
'---------------------------------------
'等待战斗
Sub waitFight
Do
Delay 200
findTarget rec3,"人物位置",intX,intY
FindColor intX+10,intY-30,intX+70,intY,"4C7FF3",x,y
Loop While x<=0
End Sub
'---------------------------------------
'执行对话操作
Sub startTalk
Dim doneCount
Do
doneCount=0
'
clickTarget rec3,"确定",done,5,5
doneCount=doneCount-CInt(done)
'
clickTarget rec3,"对话泡泡-大",done,0,20
doneCount=doneCount-CInt(done)
'
clickTarget rec3,"对话泡泡-小",done,70,10
doneCount=doneCount-CInt(done)
'
clickTarget rec3,"链接-黄",done,5,-5
doneCount=doneCount-CInt(done)
'
clickTarget rec3,"银两刷新",done,5,5
doneCount=doneCount-CInt(done)
'
clickTarget rec3,"接受",done,5,5
doneCount=doneCount-CInt(done)
'
Loop While doneCount>0
End Sub
'----------------------------------------
'执行青色任务
Sub execMissionCyan
Do
clickTarget rec2,"链接-青",done,5,-5
If done Then
waitTalk
startTalk
End If
'探测是否还有青色链接
Dim k
clickRWZZ
k=testTarget(rec2,"链接-青")
If Not k Then
execMissionOrange
clickKJRW
k=testTarget(rec2,"链接-青")
End If
Loop While k
End Sub
'----------------------------------------
'执行橙色任务
Sub execMissionOrange
Do
clickTarget rec2,"链接-橙",done,5,-5
If done Then
Delay 15000
waitFight
clickTarget rec3,"人物位置",done,0,0
'循环战斗次数
Dim n
n=1
'判断是否是山谷剿匪任务
findTarget rec3,"人物位置",x,y
ReDim rec(3)
rec(0)=x
rec(1)=y-50
rec(2)=x+150
rec(3)=y+30
If testTarget(rec,"山谷") Or testTarget(rec,"大同江") Then
n=10
End If
Delay 500
'循环战斗n次
Dim i
i=0
Do
clickTarget rec3,"人物位置",done,0,0
Delay 500
waitFight
i=i+1
Loop While i<n
End If
'探测是否还有橙色链接
Dim k
clickRWZZ
k=testTarget(rec2,"链接-橙")
Loop While k
End Sub
'----------------------------------------
'等待闯关
Sub waitBarrier
Do
Delay 200
findTarget rec3,"继续挑战",intX,intY
Loop While intX<=0
waitLoading
End Sub
'----------------------------------------
'补兵
Sub supplySoldiers
If Not testTarget(rec3,"自动补充") Then
clickTarget rec4,"配兵",done,0,0
End If
clickTarget rec3,"自动补充",done,0,0
clickTarget rec4,"配兵",done,0,0
End Sub
'----------------------------------------
'使用恢复符
Sub useRenew
clickTarget rec4,"背包",done,0,0
clickTarget rec3,"恢复符",done,0,0
clickTarget rec3,"使用",done,0,0
clickTarget rec3,"确定使用",done,0,0
clickTarget rec4,"背包",done,0,0
End Sub
'----------------------------------------
'闯关
Sub execMissionBarrier
clickTarget rec3,"开始挑战",done,5,5
clickTarget rec3,"继续挑战",done,5,5
waitBarrier
Do
If testTarget(rec3,"第70关") Then
useRenew
End If
supplySoldiers
clickTarget rec3,"继续挑战",done,5,5
MoveTo 20,50
waitBarrier
Loop While Not testTarget(rec3,"重生机会-0")
clickTarget rec3,"结束挑战",done,5,5
End Sub
'----------------------------------------
'主程序
Sub Main
Dim num
num=InputBox("输入对应编号: 1-循环任务 2-自动闯关","选择执行","1")
If num="2" Then
execMissionBarrier
Else
execMissionCyan
execMissionCyan
execMissionCyan
End If
End Sub
'----------------------------------------
'执行主程序
Main
'useRenew
'MsgBox testTarget(rec3,"第70关")
VBSEnd
回复Comments
作者:
{commentrecontent}