找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 4645|回复: 3

[教程源码] 龙之谷按键坐标写法[直线跑图]

[复制链接]

18

主题

48

回帖

104

积分

按键电脑&手机班学员

紫猫助手

鲜花
0
猫粮
494
QQ
发表于 2019-1-19 20:54:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
本帖最后由 ycploveyu 于 2019-1-19 21:18 编辑

大家分析源码
助大家源码分析过程
1\龙之谷是3D&2D可以自由切换,分析前源码将3D游戏切换成2D
2\龙之谷跑图首先采集每个副本或新手任务地图中的固定坐标
3\通过读取内存的方法读取龙之谷人物坐标
4\通过人物坐标与采集到的坐标用三角函数的方式行走
5\人物行走是是通过右边的转盘来控制,所以需要三角函数得到的方向,来操作转盘的方向
6\到达采集地图中的坐标与内存读取的坐标浮动区间时就停止
7\找到怪物进行攻击
8\本测试准确率达95%
9\有兴趣了解A星算法,结合起来就完美
[按键精灵] 纯文本查看 复制代码
   /*
作者:紫猫学员-1027 QQ822641801
游戏:龙之谷
功能:直线跑图
*/
 /****************定义数组********************/
Dim 怪条1=Array (0,0,0,0,"233DFF","-1|10|233DFF,0|17|233DFF,0|32|233DFF,0|42|233DFF,1|52|233DFF,3|3|213785,3|37|293F93,3|63|1D3480")
Dim Boos=Array (655,551,710,638,"ADECDE","-2|17|359FC2,6|-6|84DBEA,13|34|C9F1FE,-6|-8|394F75,-12|4|576D96")
Dim 三D=Array (556,87,579,119,"FFFFFF","0|5|FFFFFF,-4|6|FFFFFF,-7|5|F9F9FA,-13|6|FFFFFF,-14|2|FFFFFF")
Dim 主城=Array (610,103,680,231,"2FCEED","20|4|DC6100,51|0|523535,22|91|5CE9F9,43|101|452D2D")
Dim 跳过 = Array (653,1166,694,1268,"00C6E6","4|-67|00C3E3,-10|-70|00C2E2,8|-23|00C6E5,-18|-53|000000,10|0|000000")
Dim 在副本中=Array (631,76,686,126,"00FF27","-6|0|26CA00,-18|2|FFC800,-24|1|FF9D00,-30|2|4680A5,3|-10|4B91CB")
Dim 新手副本=Array (100, 54,92, 53,83, 54,58, 54)
    /****************任务********************/
Dim 主线任务=Array (201,11,547,82,"47D469","5|0|47DA6B,-6|0|45C96A,0|21|48DA6A,4|21|47CC68,-4|22|48D76A,-5|-14|48E26C,7|-15|47D86A") 
Dim 主线任务1=Array (201,11,547,82,"8EFFB1","-5|1|8AFFAC,-11|1|87FFA6,2|-14|98FFBC,-10|-14|98FFBC,-1|21|7EFF9F,-5|21|81FFA4,-3|14|82FFA3") 
Dim NPC对话=Array (1,817,223,1024,"26222F","-5|-51|26222F,170|-33|262330,166|100|26232F,191|12|6392BA,192|-13|A4DBF5")
   /****************进入副本********************/
Dim 入场=Array (76,775,177,879,"133196","-5|-10|E6ECF6,-16|-16|3F4050,-41|-23|122074,-52|-7|254474,-50|-42|244576")
Dim 第一个=Array (467,371,519,436,"125681","2|14|13507E,-16|2|3A293A,-8|-22|251425,-8|28|18071C,-3|23|4A5357,1|-22|475050")
Dim 第一个1=Array (467,371,519,436,"1FA7F8","109|-7|1AE0FF,-15|2|776087,-10|-24|5C5171,-3|18|8FA0A3,4|-25|8A9B9B")
/****************副本********************/
Dim 阴影森林=Array (697,1154,716,1230,"719AA6","10|4|9AD1E3,7|7|8EC1D1,7|21|A3DEF1,3|39|9FD7E9,10|43|A6E1F4,8|57|A7E5F7,5|57|A8E7F9,8|64|ABE9FD,5|64|ADEBFF")
Dim 阴影森林XY=Array (79,116,107,104)

Dim xy=Array (102,32,114,47,114,53,59,63)
/*********************************************/
//    TracePrint FindColorS (第一个,1)
//打怪
//    EndScript
//    /*********************************************/

//打怪 
//EndScript
Dim 当前应用包名
当前应用包名 = sys.GetFront()
TracePrint 当前应用包名
Dim addr = "0x0"
Dim tb1 = {"lv":16}
Dim tb2 = {"lv":79,"offset":8} 
Dim tb3 = {"lv":353067044,"offset":8}
Dim tb = {tb1, tb2,tb3}

Dim tb11 = {"lv":8}
Dim tb21 = {"lv":257,"offset":20}
Dim tb31 = {"lv":10,"offset":116}
Dim tb12 = {tb11, tb21, tb31}
Do 
    Dim B2 = Sys.MemorySearch(当前应用包名, True,addr, tb12, "i32",0,1)
    Dim A = Sys.MemorySearch(当前应用包名, True,addr, tb, "i32",0,5)
    Dim B = Sys.MemorySearch(当前应用包名, True,addr, tb, "i32",0,5)
    If B2 <> null and A <> null and b <> null Then 
        Exit Do 
    End If
    Delay 300
Loop 
Dim 等级1地址 = 地址相加(B2(0), 192)
Dim DJ=Sys.MemoryRead(当前应用包名,等级1地址, "i32") '等级


Dim 坐标地址X = 地址相加(A(0),-8)
Dim 坐标地址Y = 地址相加(B(0), -76)
Dim 线程ID = Thread.Start (坐标,当前应用包名,坐标地址X,坐标地址Y)

//TracePrint 判断卡屏()
//EndScript

Do 
    Select Case DJ
    Case "1"
        TracePrint "你输入的是0或者1"
        If FindColorS(主城, 0) = True Then 
            主线
        Else
            跑图(新手副本)
        End If
    Case Else
        TracePrint "请输入0到4这五个数字!"
    End Select
    Delay 100
Loop
Sub 主线()
    Do
        If 判断卡屏() = True Then 
            If FindColorS(主线任务, 1) = True or FindColorS(主线任务1, 1) = True Then 
            ElseIf FindColorS(NPC对话, 1) = True Then
            ElseIf FindColorS(第一个, 1) = True or FindColorS(第一个1, 1) = True Then
            ElseIf FindColorS(入场, 1) = True Then
            ElseIf FindColorS(跳过, 1) = True Then
            ElseIf FindColorS(在副本中, 1) = True Then
                副本
            Else 
                Tap 94,871
            End If
        End If        
    Loop

End Sub
Sub 副本()
    If FindColorS (三D,1)=True 
        Tap 633, 33
    End If 
    If FindColorS(阴影森林, 0) = True Then 
        跑图(阴影森林XY)        
    End If
End Sub


Sub 跑图(ArrMode)
    Dim Arr()=ArrMode
    Dim mode=((UBound (Arr)+1)/2)-1
    TracePrint "坐标一共有:",mode
    TracePrint Arr(0),Arr(1)
    Dim a=0,intX, intY
    Do
        Dim 序号 = FindColor(582,1158,656,1223, "000099", 0, 0.85, intX, intY)
        Delay 100
        If 序号 > -1 or FindColorS(Boos, 0) = True Then 
            打怪
        ElseIf FindColorS(NPC对话, 1) = True or FindColorS(跳过, 1) = True Then
        ElseIf  FindColorS(主城, 0) = True Then 
            Exit Sub 
        ElseIf a = 0 Then
            If mode >= 0 Then
                If XL(Arr(0),Arr(1)) = True Then 
                    a=1
                End If
            End If
        ElseIf a = 1 Then
            If Mode >= 1 Then
                If XL(Arr(2),Arr(3)) = True Then 
                    a = 2
                End If
            End If
        ElseIf a = 2 Then
            If Mode >= 2 Then
                If XL(Arr(4),Arr(5)) = True Then 
                    a=3
                End If
            End If
        ElseIf a = 3 Then
            If mode  >= 3 Then
                If XL(Arr(6),Arr(7)) = True Then 
                    a=4
                End If
            End If
        ElseIf a = 4 Then 
            If mode  >= 4 Then
                If XL(Arr(8),Arr(9)) = True Then 
                    a=5
                End If
            End If
        ElseIf a = 5 Then
            If mode >= 5 Then
                If XL(Arr(10),Arr(11)) = True Then 
                    a=6
                End If
            End If
        End If
        Delay 500
        TracePrint "a的值: ",a
    Loop 
End Sub

Function 判断卡屏()
    判断卡屏=False
    Dim x,y,ab
    Do 
        x = Thread.GetShareVar("Pmx")
        y = Thread.GetShareVar("PmY")
        TracePrint x,y
        Delay 1000
        a=x:b=y        
        If x = a and y = b Then 
            判断卡屏=True
        End If
    Loop Until a <> null
End Function

Sub 打怪()
    TracePrint "打怪"
    Dim 颜色数量
    Dim xy_arr={{35,852,88,902},{32,965,79,1011},{131,973,174,1016},{221,1014,267,1059},{265,1106,307,1150},{269,1206,307,1249}}
    Dim JN_arr={61, 874,54,990,159,991,251,1034,259,1130,291,1210}
    Dim intX, intY, 序号
    Do
        序号 = FindColor(582,1158,656,1223, "000099", 0, 0.85, intX, intY)
        TracePrint "有没有怪",序号
        If 序号 > -1 Then
            For i = 0 To 5
                颜色数量 = GetColorNum(xy_arr(i,0), xy_arr(i,1),xy_arr(i,2),xy_arr(i,3), "F1F1F9|FFFFFF", 0.9)
                If 颜色数量 > 100 Then 
                    For a=0 to 11 Step 1
                        Tap JN_arr(a), JN_arr(a + 1)
                    Next
                Else 
                    Delay 1000
                    Tap 155,1122
                End If
            Next
        Else 
            Exit Sub
        End If
    Loop
End Sub
Sub 坐标(当前应用包名,坐标地址X,坐标地址Y)
    Do
        dim PmX =CLng (Sys.MemoryRead(当前应用包名,坐标地址X, "f32"))
        dim PmY =Clng (Sys.MemoryRead(当前应用包名,坐标地址Y, "f32"))
        Thread.SetShareVar "PmY", PmY
        Thread.SetShareVar "PmX", PmX
        //        TracePrint PmX,PmY
        Delay 50
    Loop
End Sub
 



龙之谷按键坐标写法[直线跑图].mqb

3.79 KB, 阅读权限: 30, 下载次数: 12, 下载积分: 猫粮 -2

龙之谷源码

楼主热帖
承接PC版插件定制,Office办公软件辅助,网页相关[Post,Get]软件定制,网页批量注册或采集功能定制.等,点击我>>>租售网络授权验证系统!

18

主题

48

回帖

104

积分

按键电脑&手机班学员

紫猫助手

鲜花
0
猫粮
494
QQ
 楼主| 发表于 2019-1-19 21:06:24 | 显示全部楼层
本帖最后由 ycploveyu 于 2019-1-19 21:10 编辑

[按键精灵] 纯文本查看 复制代码
Function XL(intx, inty)//重要跑图算法
XL = False 
Dim R=94
Dim x1=146,y1=165
Dim K,H,x,y
Dim N,D,G
Do
x = Thread.GetShareVar("Pmx")
y = Thread.GetShareVar("PmY")
TracePrint x,y
TracePrint intx, inty
If x <> null and x<>0 and y<>0 Then 
Dim a=abs( x-intx),b=abs(y-inty),c=Sqr(a^2+b^2)
// TracePrint a,b
N=sin (a/c)
D= Rad2Ang(ArcSin(N))
// TracePrint D
Delay 300
If D = 0 Then 
D=90
End If
G = 180 - 90 - D
If a <= 1 and b <= 1 Then 
XL = True
Exit Function
ElseIf x-intx < 0 and y-inty = 0 Then
Swipe x1, y1, x1 - R, y1, 500
ElseIf x-intx =0 and y-inty <0 Then
Swipe x1, y1, x1, y1-r, 500
ElseIf x - intx = 0 and y - inty > 1 Then
Swipe x1, y1, x1 , y1+R, 500
ElseIf x-intx >1 and y-inty =0 Then
Swipe x1, y1, x1+R, y1, 500
ElseIf x < intx and y < inty Then 
K=Round (X1-Round ( sin(Ang2Rad(D))*R))
H = Round(y1 - Round(Sin(Ang2Rad(G)) * R))
Swipe x1,y1,K, H,500
ElseIf x > intx and y < inty Then
K=Round (X1+Round ( sin(Ang2Rad(D))*R))
H = Round(y1 - Round(Sin(Ang2Rad(G)) * R))
Swipe x1,y1,K, H,500
ElseIf x > intx and y > inty Then
K=Round (X1+Round ( sin(Ang2Rad(D))*R))
H = Round(y1 + Round(Sin(Ang2Rad(G)) * R))
Swipe x1,y1,K, H,500
ElseIf x < intx and y > inty Then
K=Round (X1-Round ( sin(Ang2Rad(D))*R))
H = Round(y1 + Round(Sin(Ang2Rad(G)) * R))
Swipe x1,y1,K, H,500
End If
Delay 500
End If
Loop
End Function


Function ArcSin(Num)
If Num = 1 Then 
ArcSin = 2 * Atn(1)
ElseIf Num = -1 Then
ArcSin = 6 * Atn(1)
Else 
ArcSin=Atn(Num/(Sqr(1-Num^2)))
End If
End Function
Function Rad2Ang(Num)
Dim pi
pi = 4 * Atn(1)
Rad2Ang=Num*180/pi
End Function
Function Ang2Rad(Num)
Dim pi
pi = 4 * Atn(1)
Ang2Rad=Num*pi/180
End Function


Function FindColorS(数组特征,点击)
Dim arr(),dj,x,y
dj = 点击 : arr = 数组特征
FindColorS = False
KeepCapture
FindMultiColor arr(0), arr(1), arr(2), arr(3), CStr(arr(4)), CStr(arr(5)), 0, 0.9, X, Y
ReleaseCapture 
TracePrint x,y
If x > -1 And y > -1 Then 
FindColorS = true
If dj = 1 Then 
Tap x, y
End If
Else 
FindColorS = False
End If
End Function

Function 地址相加(地址, 偏移)
TracePrint 地址
TracePrint 偏移
Dim A = Right(地址,Len(地址)-2)
Dim B = Clng("0x"&A)
Dim C = B+偏移
Dim D = Hex(C)
Dim E = "0x"&D
地址相加 = E
End Function
承接PC版插件定制,Office办公软件辅助,网页相关[Post,Get]软件定制,网页批量注册或采集功能定制.等,点击我>>>租售网络授权验证系统!
  • 打卡等级:无名新人

0

主题

18

回帖

18

积分

按键电脑&手机班学员

鲜花
0
猫粮
302
发表于 2019-1-20 23:14:49 | 显示全部楼层
可以很强

7

主题

90

回帖

104

积分

按键电脑班学员

鲜花
0
猫粮
485
QQ
发表于 2019-1-25 14:35:10 | 显示全部楼层
师兄,你开发的手机分辨率是多少,我去分析源码
支持紫猫老师,..接单[网页,下注,手游]办公 各种全自动脚本 QQ 330854145
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|紫猫编程学园

GMT+8, 2024-4-18 14:00

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表