Q语言-[帝王三国送将辅助]

纯属自己写的, 玩同一个游戏的朋友,需要送将的, 把需要送的将改名为送, 然后启动辅助即可

本辅助只支持1024x576 191dpi

附上源码

//本源码初始化分辨率1024x576[夏天]
Dim longX="1024"
Dim longY="576"
//本源码初始化分辨率1024x576[夏天]
//////////////////////获取屏幕分辨率[strat]//////////////////////
Dim MaxX, MaxY
MaxX = GetScreenX()
MaxY = GetScreenY()

eg 
Function eg
	//使用于720*1280分辨率
	Dim longX="720"
	Dim longY="1280"
	
	Dim MaxX, MaxY
	MaxX = GetScreenX()
	MaxY = GetScreenY()
	
	//TracePrint MaxX, MaxY
	
	//360,239
	Dim lianX, lianY
	lianX = MaxX / (longX / 360)
	lianY = MaxY / (longY / 239)
	
	//TracePrint "获取到联系人图标"
	//TracePrint lianX,lianY
	//点击
	Tap lianX,lianY
End Function
//////////////////////获取屏幕分辨率[end]////////////////////////

Dim time100="100"
Dim time300="300"
Dim time500="500"
Dim time1000="1000"
Dim time1500="1500"
Dim time2000="2000"

Function test()
	//点击进入浏览器
	Touch 216,237, 100
	Delay 2000
	//点击输入框
	Touch 183,77, 100
	Delay time300
	//循环
	For 5
		KeyPress "del"
		Delay 50
	Next
	//填入兵种
	InputText ReadUIConfig("Barbarian")
	Delay time300
	//X坐标
	TracePrint ReadUIConfig("x-coordinate")
	Delay time300
	//Y坐标
	TracePrint ReadUIConfig("y-coordinate")
	Delay time300
	//兵种
	TracePrint ReadUIConfig("Barbarian")
	Delay time300

End Function

//进入将领列表
Function 开始运作()
	Dim JingLingX, JingLingY
    ShowMessage "进入将领列表"
    Delay time300
    JingLingX = MaxX / (longX / 851)
    JingLingY = MaxY / (longY / 542)
    //Touch 851,542, 100
    Touch JingLingX,JingLingY, 100
    Delay time300
End Function



///////////////////////////////////////////////////////////////测试开始//////////////////////////////////////////////////////////////////
//筛选带有[送]字的将领[白色]
Function 大筛选()
    Dim intX,intY
    FindPic 0,0,0,0,"Attachment:送-白色2.png","000000",1,0.9,intX,intY
    If intX > -1 And intY > -1 Then
        TracePrint intX
        TracePrint intY
        ShowMessage "找到优良类型"
        TracePrint "找到优良类型"
        Delay time300
        //选中
        Touch intX, intY, 100
        Delay time300
        //配兵
        Call 配兵()
        Delay time300
        Call 调整()
        Delay time300
    End If
    //筛选带有[送]字的将领[白色2]
    Dim intA,intB
    FindPic 0,0,0,0,"Attachment:送-白色.png","000000",1,0.9,intA,intB
    If intA > -1 And intB > -1 Then
        TracePrint intA
        TracePrint intB
        ShowMessage "找到优良类型"
        TracePrint "找到优良类型"
        Delay time300
        //选中
        Touch intA, intB, 100
        Delay time300
        //配兵
        Call 配兵()
        Delay time300
        Call 调整()
        Delay time300
    End If
    //筛选带有[送]字的将领[黄色]
    Dim intC,intD
    FindPic 0,0,0,0,"Attachment:送-黄色2.png","000000",1,0.9,intC,intD
    If intC > -1 And intD > -1 Then
        TracePrint intC
        TracePrint intD
        ShowMessage "找到成长80-84类型"
        TracePrint "找到成长80-84类型"
        Delay time300
        //选中
        Touch intC, intD, 100
        Delay time300
        //配兵
        Call 配兵()
        Delay time300
        Call 调整()
        Delay time300
    End If
    //筛选带有[送]字的将领[黄色2]
    Dim intE,intF
    FindPic 0,0,0,0,"Attachment:送-黄色.png","000000",1,0.9,intE,intF
    If intE > -1 And intF > -1 Then
        TracePrint intE
        TracePrint intF
        ShowMessage "找到成长80-84类型"
        TracePrint "找到成长80-84类型"
        Delay time300
        //选中
        Touch intE, intF, 100
        Delay time300
        //配兵
        Call 配兵()
        Delay time300
        Call 调整()
        Delay time300
    End If
    //筛选带有[送]字的将领[红色]
    Dim intH,intI
    FindPic 0,0,0,0,"Attachment:送-红色2.png","000000",1,0.9,intH,intI
    If intH > -1 And intI > -1 Then
        TracePrint intH
        TracePrint intI
        ShowMessage "找到成长85-89类型"
        TracePrint "找到成长85-89类型"
        Delay time300
        //选中
        Touch intH, intI, 100
        Delay time300
        //配兵
        Call 配兵()
        Delay time300
        Call 调整()
        Delay time300
    End If
    //筛选带有[送]字的将领[红色2]
    Dim intJ,intK
    FindPic 0,0,0,0,"Attachment:送-红色.png","000000",1,0.9,intJ,intK
    If intJ > -1 And intK > -1 Then
        TracePrint intJ
        TracePrint intK
        ShowMessage "找到成长85-89类型"
        TracePrint "找到成长85-89类型"
        Delay time300
        //选中
        Touch intJ, intK, 100
        Delay time300
        //配兵
        Call 配兵()
        Delay time300
        Call 调整()
        Delay time300
    Else
        TracePrint "Error!"
    End If
End Function
///////////////////////////////////////////////////////////////测试结束//////////////////////////////////////////////////////////////////

//出征带有[送]字的将领[白色]
Function 大出征()
    //默认出征编队5这一组
    Dim FineX,FineY
    FineX = MaxX / (longX / 805)
    FineY = MaxY / (longY / 153)
    ShowMessage "选中第五编队"
    Delay time300
    Touch FineX, FineY, 100
    Delay time100
    //805,153
End Function

//关闭将领列表窗口
Function 关闭将领列表窗口()
	Dim CloseX,CloseY
	CloseX = MaxX / (longX / 840)
	CloseY = MaxY / (longY / 69)
	//840,69
	Touch CloseX, CloseY, 100
	Delay time100
End Function

//////////////////////////////////配置调用[start]////////////////////////////////////
//配兵
Function 配兵()
	Dim PeiBingX, PeiBingY
	//点击配兵
    //Touch 678, 152, 100
    PeiBingX = MaxX / (longX / 678)
    PeiBingY = MaxY / (longY / 152)
    Touch PeiBingX, PeiBingY, 100
    Delay time300
    //选择兵种 
    Call 总兵种()
    Delay time100
End Function

//调整
Function 调整()
	Dim TiaoZhengX, TiaoZhengY
	TiaoZhengX = MaxX / (longX / 627)
	TiaoZhengY = MaxY / (longY / 285)
	//Touch 627,285, 100
	Touch TiaoZhengX, TiaoZhengY, 100
    Delay time300
    //点击兵力
    Dim DianJiBingliX,DianJiBingliY
    DianJiBingliX = MaxX / (longX / 481)
    DianJiBingliY = MaxY / (longY / 354)
    //Touch 481, 354, 100
    Touch DianJiBingliX, DianJiBingliY, 100
    Delay time500
    //输入兵力
    For 5
		KeyPress "del"
		Delay 50
	Next
	ShowMessage "输入兵力1"
    InputText "1"
    //点击确定
    Dim QueDingX,QueDingY
    QueDingX = MaxX / (longX / 477)
    QueDingY = MaxY / (longY / 107)
    Touch QueDingX, QueDingY, 100
    //Touch 477, 107, 100
    Delay time300
    //再次确定
    Dim ZaiCiQueDingX,ZaiCiQueDingY
    ZaiCiQueDingX = MaxX / (longX / 337)
    ZaiCiQueDingY = MaxY / (longY / 488)
    //Touch 337, 488, 100
    Touch ZaiCiQueDingX, ZaiCiQueDingY, 100
    Delay time1500
    ShowMessage "配兵完成"
End Function

//向下翻页
Function 向下翻页()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:向下翻页.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		ShowMessage "下翻"
		Touch intX, intY, 100
		Delay time100
	End If
End Function

//向上翻页
Function 向上翻页()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:向上翻页.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		ShowMessage "上翻"
		Touch intX, intY, 100
		Delay time100
	End If
End Function
//////////////////////////////////配置调用[end]//////////////////////////////////////

//////////////////////////////////兵种调用[start]////////////////////////////////////
//轻骑兵
Function 轻骑兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:轻骑兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		ShowMessage "找到轻骑兵"
		TracePrint "找到轻骑兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//重骑兵
Function 重骑兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:重骑兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		ShowMessage "找到重骑兵"
		TracePrint "找到重骑兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//铁骑兵
Function 铁骑兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:铁骑兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		ShowMessage "找到铁骑兵"
		TracePrint "找到铁骑兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//骁骑兵
Function 骁骑兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:骁骑兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		ShowMessage "找到骁骑兵"
		TracePrint "找到骁骑兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//弓兵
Function 弓兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:弓兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		TracePrint "找到弓兵"
		ShowMessage "找到弓兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//弩兵
Function 弩兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:弩兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		TracePrint "找到弩兵"
		ShowMessage "找到弩兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//强弩兵
Function 强弩兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:强弩兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		TracePrint "找到强弩兵"
		ShowMessage "找到强弩兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//弩骑兵
Function 弩骑兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:弩骑兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		TracePrint "找到弩骑兵"
		ShowMessage "找到弩骑兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//民兵
Function 民兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:民兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		TracePrint "找到民兵"
		ShowMessage "找到民兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//轻步兵
Function 轻步兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:轻步兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		TracePrint "找到轻步兵"
		ShowMessage "找到轻步兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//重步兵
Function 重步兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:重步兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		TracePrint "找到重步兵"
		ShowMessage "找到重步兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//近卫兵
Function 近卫兵()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:近卫兵.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		TracePrint "找到近卫兵"
		ShowMessage "找到近卫兵"
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//////////////////////////////////兵种调用[end]//////////////////////////////////////

//出征资点
Function 出征按钮()
	Dim ChuZhengX,ChuZhengY
	ChuZhengX = MaxX / (longX / 786)
	ChuZhengY = MaxY / (longY / 48)
	Touch ChuZhengX, ChuZhengY, 100
	Delay time100
	//786,48
	
End Function
//占领资源点按钮
Function 占领资源点按钮()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:占领资源点按钮.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		Touch intX, intY, 100
		Delay time100
	End If
End Function
//查找按钮
Function 查找()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:查找按钮.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		Touch intX, intY, 100
		Delay time100
	End If
End Function
//坐标输入
Function 资点坐标()
	//点击X坐标输入框
	Dim ZiDianZuoBiaoX,ZiDianZuoBiaoY
	ZiDianZuoBiaoX = MaxX / (longX / 378)
	ZiDianZuoBiaoY = MaxY / (longY / 192)
	//Touch 378, 192, 100
	Touch ZiDianZuoBiaoX, ZiDianZuoBiaoY, 100
	Delay time500
	//删除原有数字
	For 5
		KeyPress "del"
		Delay 50
	Next
	//填入新X坐标
	ShowMessage "输入X坐标"
	Delay time500
    InputText ReadUIConfig("x-coordinate")
    Delay time1500
    /////////////////////////////////完美分割线////////////////////////////////////
    Call 确定坐标()
    Delay time100
    /////////////////////////////////完美分割线////////////////////////////////////
    //点击Y坐标输入框
    Dim ZiDianZuoBiao2X,ZiDianZuoBiao2Y
	ZiDianZuoBiao2X = MaxX / (longX / 546)
	ZiDianZuoBiao2Y = MaxY / (longY / 192)
    //Touch 546, 192, 100
    Touch ZiDianZuoBiao2X, ZiDianZuoBiao2Y, 100
    Delay time500
    //删除原有数字
	For 5
		KeyPress "del"
		Delay 50
	Next
	//填入新Y坐标
	ShowMessage "输入Y坐标"
	Delay time500
    InputText ReadUIConfig("y-coordinate")
    Delay time1500
    /////////////////////////////////完美分割线////////////////////////////////////
    Call 确定坐标()
    Delay time100
    /////////////////////////////////完美分割线////////////////////////////////////
End Function
//确定坐标按钮
Function 确定坐标()
	Dim OkX,OkY
	OkX = MaxX / (longX / 480)
	OkY = MaxY / (longY / 108)
	//480,108
	Touch OkX, OkY, 100
	Delay time100
End Function

//资点输入完成确定按钮
Function 资点确定()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:资点确定按钮.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//占领按钮
Function 占领()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:占领按钮.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		ShowMessage "占领"
		Delay time500
		Touch intX, intY, 100
		Delay time1000
	End If
End Function
//////////////////////////////////////////////////////////////////////////////////

//滑动!!!!!!!!!!有待测试
Function 滑动()
	//用300毫秒的时间,从点100,100划动到点200,200
	Dim XiaX,XiaY,ShangX,ShangY
	XiaX = MaxX / (longX / 649)
	XiaY = MaxY / (longY / 439)
	ShangX = MaxX / (longX / 666)
	ShangY = MaxY / (longY / 206)
	//Swipe 649,439,666,206,300
	Swipe XiaX, XiaY, ShangX, ShangY, 300
	Delay time500
End Function

//资点出征按钮
Function 出征按钮2()
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:出征按钮2.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		ShowMessage "出征"
		Delay time300
		Touch intX, intY, 100
        Delay time500
	End If
End Function
//关闭资点窗口
Function 关闭资点窗口()
	Dim GuanBiX,GuanBiY
	GuanBiX = MaxX / (longX / 726)
	GuanBiY = MaxY / (longY / 107)
	//726,107
	Touch GuanBiX, GuanBiY, 100
	Delay time100
End Function

Function 总兵种()
	//Dim iname=0
	Dim iname=ReadUIConfig("Barbarian")

	Select Case iname
	Case 0
    	TracePrint "轻骑兵"
    	Call 轻骑兵()
    	Delay time100
	Case 1
    	TracePrint "重骑兵" 
    	Call 重骑兵()
    	Delay time100
	Case 2
    	TracePrint "铁骑兵" 
    	Call 铁骑兵()
    	Delay time100
	Case 3
    	TracePrint "骁骑兵" 
    	Call 骁骑兵()
    	Delay time100
	Case 4
    	TracePrint "弓兵" 
    	Call 弓兵()
    	Delay time100
	Case 5
    	TracePrint "弩兵" 
    	Call 弩兵()
    	Delay time100
	Case 6
    	TracePrint "强弩兵" 
    	Call 强弩兵()
    	Delay time100
	Case 7
    	TracePrint "弩骑兵" 
    	Call 弩骑兵()
    	Delay time100
	Case 8
    	TracePrint "民兵"
    	Call 民兵()
    	Delay time100
	Case 9
    	TracePrint "轻步兵"
    	Call 轻步兵()
    	Delay time100
	Case 10
    	TracePrint "重步兵"
    	Call 重步兵()
    	Delay time100
	Case 11
    	TracePrint "近卫兵"
    	Call 近卫兵()
    	Delay time100
	Case Else
    	TracePrint "选择错误!即将退出,请重新选择!!"
    	//强制停止脚本运行
    	EndScript
	End Select
	
End Function
//检测将领出征状态
Function 出征状态()
	//打开军情
	Dim JunQingX,JunQingY
	JunQingX = MaxX / (longX / 25)
	JunQingY = MaxY / (longY / 347)
	//25,347
	Touch JunQingX, JunQingY, 100
	Delay time2000
	//////////////////////////////华丽分割线//////////////////////////////
	Dim intX,intY
	FindPic 0,0,0,0,"Attachment:送攻占.png","000000",1,0.9,intX,intY
	If intX > -1 And intY > -1 Then
		TracePrint intX
		TracePrint intY
		TracePrint "出征状态"
		ShowMessage "将领属于出征状态,等待返回"
		Delay time300
		Call 刷新军情()
		Delay time1000
	Else 
		//测试是否是返回状态
		Call 返回状态()
		Delay time1000
	End If
End Function
//检测将领返回状态
Function 返回状态()
    Dim intE,intF
    FindPic 0,0,0,0,"Attachment:送返回.png","000000",1,0.9,intE,intF
    If intE > -1 And intF > -1 Then
        TracePrint intE
        TracePrint intF
        TracePrint "返回状态"
        ShowMessage "将领属于返回状态,等待返回"
        Delay time300
        Call 刷新军情()
        Delay time1000
	Else
		TracePrint "悠闲状态"
		ShowMessage "将领属于悠闲状态,开始重新配兵出征"
		Delay time300
		Call 关闭军情()
		Delay time100
		//调用主程序
		Call Main()
		Delay time300
    End If
End Function

//关闭军情窗口
Function 关闭军情
	Dim CloseJQX,CloseJQY
	CloseJQX = MaxX / (longX / 839)
	CloseJQY = MaxY / (longY / 69)
	//839,69
	Touch CloseJQX, CloseJQY, 100
	Delay time100
End Function
//刷新军情状态
Function 刷新军情()
	Dim ShuaiXinJQX,ShuaiXinJQY
	ShuaiXinJQX = MaxX / (longX / 220)
	ShuaiXinJQY = MaxY / (longY / 491)
	ShowMessage "刷新军情状态"
	Delay time300
	//220,491
	Touch ShuaiXinJQX, ShuaiXinJQY, 100
	Delay time2000
End Function

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////Main Thread Start//////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Function Main()
	//开始
	Call 开始运作()
	Delay time300
	//配兵
	For 4
		Call 大筛选()
		Delay time100
		Call 向下翻页()
		Delay time300
	Next
	ShowMessage "到尽头了..."
	//关闭将领列表窗口
	Call 关闭将领列表窗口()
	Delay time300
	//出征
	Call 出征按钮()
	Delay time300
	//进入资点
	Call 占领资源点按钮()
	Delay time2000
	//查找
	Call 查找()
	Delay time300
	//输入X和Y坐标
	Call 资点坐标()
	Delay time1000
	//确定资点
	Call 资点确定()
	Delay time300
	//占领按钮
	Call 占领()
	Delay time300
	//出征第五编队
	Call 大出征()
	Delay time300
	//出征攻打
	Call 出征按钮2()
	Delay time300
	//再次确定出征
	Call 资点确定()
	Delay time2000
	//关闭窗口
	Call 关闭资点窗口()
	Delay time300

End Function

Do
	//检测将领状态
	Call 出征状态()
	Delay 10000
Loop

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////Main Thread End////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

附上apk

链接:https://pan.baidu.com/s/1BGn0icX5Fe-fyCKylz34Tg
提取码:t2mf

你可能感兴趣的:(Q语言-[帝王三国送将辅助])