Wend








/*  
 *@Fun   restart run application software 
 *@arg2  every application  software install path
 *@retun null
 **/
Function reStartApp()
	Call Lib.系统.结束进程("DNFchina.exe")
	Delay 8000
	Call dnfLogin(whichQQ)
End Function

/*-------------------Dnf 登录—————————--------------*/
Function dnfLogin(num)
	Call runDnf(dnfPath)
	Delay 500
	temp1 = getQQIdAndPassword(num, qqPath)
	Delay 2000
	If temp1 = 1 Then 
	 	Call selectService()
	 Else 
	 	MessageBox "文本设置有误!请检查"
	 	EndScript
	End If
End Function

/*  
 *@Fun   run application software
 *@arg2  every application  software install path
 *@retun null
 **/
Function runDnf(path)
	RunApp path
End Function
/*  
 *@Fun   read  text of  QQ  log info
 *@arg1  whilch one  QQ  
 *@arg2  text file  path
 *@retun null
 **/
Function getQQIdAndPassword(i,txtPath)
	//下面这句是读取一个配置文件参数(小节名:"Command" 键值名:"Val")得到内容(Text )
	loginConten = Plugin.File.ReadINI("Command", i, txtPath)
	//Msgbox "得到一个配置文件键值为:" & Text
	TracePrint loginConten
	If loginConten = "" Then 
		QQNum = ""
		QQpass = ""
		region = ""
		services = ""
		CH = ""
		getQQIdAndPassword = 0
	Else 
		tempStr = Split(loginConten, "----")
		QQNum = tempStr(0)
		QQpass = tempStr(1)
		region = tempStr(2)
		services = tempStr(3)
		CH = tempStr(4)
		getQQIdAndPassword = 1
	End If
End Function

 /*-------------------选择服服务器—————————--------------*/
 Function selectService()
 	Hwnd = Plugin.Window.Find("#32770", "地下城与勇士")
 	If Hwnd <> 0 Then 
 		sRect = Plugin.Window.GetClientRect(Hwnd)
 		MyArray = Split(sRect, "|")
 		X = Clng(MyArray(0))
 		Y = Clng(MyArray(1))
 		//MessageBox X+100 &" "& Y+150 &" "& X+610 &" "& Y+230
 		Call searchSection(X+100, Y+110, X+610, Y+230, region, 1)
 		Delay 2000
 		//MessageBox X+100 &" "& Y+360 &" "& X+610 &" "& Y+480
 		Call searchSection(X + 100, Y + 370, X + 610, Y + 480, services, 2)
 		Call inputQQNumAndPaw()
	Else 
		MessageBox "没有所选服务器!"
		Call reStartApp()
 	End If
 End Function
 /*  
 *@Fun   search every  region
 *@arg1  start x coordinate
 *@arg2  start y coordinate
 *@arg3  end x coordinate
 *@arg4  end y coordinate
 *@arg5  need to find dmp
 *@arg6  temp  variable
 *@arg7  similarity
 *@retun if success return  1  else  return  0