//时间记录 如果超过20秒没有操作,进行报警
//时间有问题
//增加 寻路中状态 ,还是在点任务
//增加 攻击 判断 和进行攻击
//首个任务无法完成 去第二个任务,第二个任务无法完成。。没有处理
qqxjHand = Lib.API.查找窗口句柄("SWT_Window0","KEmulator Lite v0.9.8")
Call Plugin.Window.Move(qqxjHand, 0, 0)


sDate1 = Plugin.Sys.GetDateTime()

 total=0//两次执行一次 用任务栏操作
While True
total = total + 1
finded = 0

Delay 500
FindPic 0,0,1024,768,"Attachment:\选择.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then 
Call 鼠标移动点击()
End If

FindPic 0,0,1024,768,"Attachment:\确定.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then 
Call 鼠标移动点击()
End If

FindPic 0,0,1024,768,"Attachment:\接受.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then 
Call 鼠标移动点击()
End If



FindPic 0,0,1024,768,"Attachment:\寻路.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then 
Call 鼠标移动点击()
End If

FindPic 0,0,1024,768,"Attachment:\升级.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then 
Call 鼠标移动点击()
End If
FindPic 0,0,1024,768,"Attachment:\战斗.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then 
Call 鼠标移动点击()
End If
FindPic 0,0,1024,768,"Attachment:\操作.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then 
Call 鼠标移动点击()
End If

Call 学习()
Delay 2000
If finded = 0 Then 
Call 过地图后()
End If
//重复操作三次不可完成的任务,2没有任务,切换 已接受 可接受
Call 第二个任务()
Wend
//第一个任务不可完成 做第二个任务
Sub 第二个任务
	If finded = 0 Then 
	sDate2 = Plugin.Sys.GetDateTime()
	times = DateDiff("s", sDate1, sDate2)
	Call Plugin.Msg.Tips(times)
    Delay 3000
	If times > 50 Then //寻路过程中 
		//Call 切换可接已接()
		FindPic 0,0,1024,768,"Attachment:\返回.bmp",0.9,intX,intY//没有任务
		If intX > 0 And intY > 0 Then 
		MoveTo intX, intY
		Delay 1000
		LeftClick 1
		Delay 100
		MoveTo intX - 80, intY - 239//第二个任务
		Delay 2000
		LeftClick 1
		Delay 100
		End If
	End If
	If times > 80 Then 
	Call Plugin.Media.Play("C:\Documents and Settings\songhh\桌面\新建文件夹\Alarm.mp3")
	Delay 5000
	End If
End If
End Sub


Sub 过地图后
FindPic 0,0,1024,768,"Attachment:\任务图标.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then 
Call 鼠标移动点击()
Delay 1000
End If

FindPic 0,0,1024,768,"Attachment:\查看.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then
Call 鼠标移动点击()
End If