找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 258|回复: 0

wmdg

[复制链接]

1793

主题

457

回帖

0

积分

管理员

积分
0
发表于 2013-9-5 07:45:50 | 显示全部楼层 |阅读模式

VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
   BorderStyle     =   1  'Fixed Single
   Caption         =   "自动打怪例子(学员作品)www.9dkjw.cn"
   ClientHeight    =   6285
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   8520
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   6285
   ScaleWidth      =   8520
   StartUpPosition =   2  '屏幕中心
   Begin VB.CheckBox Check8
      Caption         =   "自动选怪"
      Height          =   255
      Left            =   5880
      TabIndex        =   21
      Top             =   3720
      Width           =   1095
   End
   Begin VB.Timer Timer2
      Enabled         =   0   'False
      Interval        =   500
      Left            =   8040
      Top             =   3300
   End
   Begin VB.TextBox Text6
      Height          =   270
      Left            =   5880
      TabIndex        =   20
      Top             =   3360
      Width           =   1995
   End
   Begin VB.ComboBox Combo6
      Height          =   300
      ItemData        =   "Form1.frx":0000
      Left            =   7080
      List            =   "Form1.frx":002E
      TabIndex        =   19
      Text            =   "F2"
      Top             =   2760
      Width           =   735
   End
   Begin VB.TextBox Text5
      Height          =   270
      Left            =   6240
      TabIndex        =   18
      Text            =   "1000"
      Top             =   2760
      Width           =   735
   End
   Begin VB.CheckBox Check7
      Caption         =   "Check7"
      Height          =   255
      Left            =   5880
      TabIndex        =   17
      Top             =   2760
      Value           =   1  'Checked
      Width           =   255
   End
   Begin VB.CheckBox Check6
      Caption         =   "Check6"
      Height          =   255
      Left            =   5880
      TabIndex        =   16
      Top             =   2280
      Value           =   1  'Checked
      Width           =   255
   End
   Begin VB.CheckBox Check5
      Caption         =   "Check5"
      Height          =   255
      Left            =   5880
      TabIndex        =   15
      Top             =   1800
      Value           =   1  'Checked
      Width           =   255
   End
   Begin VB.CheckBox Check4
      Caption         =   "Check4"
      Height          =   255
      Left            =   5880
      TabIndex        =   14
      Top             =   1320
      Value           =   1  'Checked
      Width           =   255
   End
   Begin VB.CheckBox Check3
      Caption         =   "Check3"
      Height          =   255
      Left            =   5880
      TabIndex        =   13
      Top             =   840
      Value           =   1  'Checked
      Width           =   255
   End
   Begin VB.TextBox Text4
      Height          =   270
      Left            =   6240
      TabIndex        =   12
      Text            =   "1000"
      Top             =   2280
      Width           =   735
   End
   Begin VB.TextBox Text3
      Height          =   270
      Left            =   6240
      TabIndex        =   11
      Text            =   "1000"
      Top             =   1800
      Width           =   735
   End
   Begin VB.TextBox Text2
      Height          =   270
      Left            =   6240
      TabIndex        =   10
      Text            =   "1000"
      Top             =   1320
      Width           =   735
   End
   Begin VB.ComboBox Combo5
      Height          =   300
      ItemData        =   "Form1.frx":0064
      Left            =   7080
      List            =   "Form1.frx":0092
      TabIndex        =   9
      Text            =   "F1"
      Top             =   2280
      Width           =   735
   End
   Begin VB.ComboBox Combo4
      Height          =   300
      ItemData        =   "Form1.frx":00C8
      Left            =   7080
      List            =   "Form1.frx":00F6
      TabIndex        =   8
      Text            =   "F1"
      Top             =   1800
      Width           =   735
   End
   Begin VB.ComboBox Combo3
      Height          =   300
      ItemData        =   "Form1.frx":012C
      Left            =   7080
      List            =   "Form1.frx":015A
      TabIndex        =   7
      Text            =   "F1"
      Top             =   1320
      Width           =   735
   End
   Begin VB.ComboBox Combo2
      Height          =   300
      ItemData        =   "Form1.frx":0190
      Left            =   7080
      List            =   "Form1.frx":01BE
      TabIndex        =   6
      Text            =   "F2"
      Top             =   840
      Width           =   735
   End
   Begin VB.TextBox Text1
      Height          =   270
      Left            =   6240
      TabIndex        =   5
      Text            =   "500"
      Top             =   840
      Width           =   735
   End
   Begin VB.ComboBox Combo1
      Height          =   300
      ItemData        =   "Form1.frx":01F4
      Left            =   6600
      List            =   "Form1.frx":0228
      TabIndex        =   4
      Text            =   "F4"
      Top             =   240
      Width           =   735
   End
   Begin VB.CheckBox Check2
      Caption         =   "捡物"
      Height          =   255
      Left            =   5880
      TabIndex        =   3
      Top             =   240
      Value           =   1  'Checked
      Width           =   735
   End
   Begin MSComctlLib.ListView ListView1
      Height          =   5415
      Left            =   0
      TabIndex        =   2
      Top             =   60
      Width           =   5835
      _ExtentX        =   10292
      _ExtentY        =   9551
      View            =   3
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   0   'False
      AllowReorder    =   -1  'True
      FullRowSelect   =   -1  'True
      GridLines       =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      Appearance      =   1
      NumItems        =   4
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
         Text            =   "名称"
         Object.Width           =   3069
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
         SubItemIndex    =   1
         Text            =   "等级"
         Object.Width           =   1129
      EndProperty
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
         SubItemIndex    =   2
         Text            =   "坐标"
         Object.Width           =   3528
      EndProperty
      BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
         SubItemIndex    =   3
         Text            =   "距离"
         Object.Width           =   1588
      EndProperty
   End
   Begin VB.Timer Timer1
      Enabled         =   0   'False
      Interval        =   500
      Left            =   120
      Top             =   5520
   End
   Begin VB.CheckBox Check1
      Caption         =   "自动刷新"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   5880
      Width           =   1035
   End
   Begin VB.CommandButton Command1
      Caption         =   "刷新"
      Height          =   495
      Left            =   1680
      TabIndex        =   0
      Top             =   5640
      Width           =   1215
   End
   Begin VB.Label Label2
      AutoSize        =   -1  'True
      Caption         =   "目前选中怪物ID:"
      Height          =   180
      Left            =   5880
      TabIndex        =   23
      Top             =   3120
      Width           =   1350
   End
   Begin VB.Label Label1
      AutoSize        =   -1  'True
      Caption         =   "注意:请最少放一个技能攻击!"
      Height          =   180
      Left            =   5880
      TabIndex        =   22
      Top             =   4200
      Width           =   2340
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const W2i_Base = &H8F161C    '完美基址,扫描怪是成功了,希望大家帮助我们新手添加修改出打怪的代码,谢谢
Dim item As ListItem

Private Sub Check1_Click()
    If Check1.Value = 1 Then
        Timer1.Enabled = True
    Else
        Timer1.Enabled = False
    End If
End Sub

Private Sub Check8_Click()
    If Check8.Value = 1 Then
        Check1.Value = 1 '钩上自动刷新
        Timer2.Enabled = True '打开循环读取怪物ID
    Else
        Timer2.Enabled = False
    End If
End Sub

Private Sub Command1_Click()
    Dim i As Long
    Dim GwNameb(63) As Byte          'www.9dkjw.cn
    Dim hwnd As Long
    Dim pid As Long
    Dim hProcess As Long
    Dim ECXI As Long
    Dim eax As Long
    Dim tmp1 As Long
    Dim tmp2 As Long
    Dim GwSL As Long
    Dim GwHP As Long
    Dim GwHPMAX As Long
    Dim GwLv As Long
    Dim GwX As Single
    Dim GwY As Single
    Dim GwZ As Single
    Dim GwJl As Single
    Dim GwClass As Long
    Dim GwId As Long
    Dim GwName As String
    Dim GwZl As Long
    Dim ii As Long
    hwnd = FindWindow("ElementClient Window", "Element Client")
    GetWindowThreadProcessId hwnd, pid
    hProcess = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, 0, pid)
    If hProcess = 0 Then
        Exit Sub
    End If
    '----怪物信息---------------------------------------------
    ReadProcessMemory hProcess, ByVal W2i_Base, ECXI, 4, 0
    ReadProcessMemory hProcess, ByVal ECXI + &H8, eax, 4, 0
    ReadProcessMemory hProcess, ByVal eax + &H24, ECXI, 4, 0   '怪物指针
    ReadProcessMemory hProcess, ByVal ECXI + &H14, GwSL, 4, 0  '读出怪物数量
    ReadProcessMemory hProcess, ByVal ECXI + &H24, tmp1, 4, 0  '读出怪物数组的最大值
    ReadProcessMemory hProcess, ByVal ECXI + &H18, tmp2, 4, 0  '读出怪物列表的首地址
    '---------------------------------------------------------
   
    ListView1.ListItems.Clear '清空ListView
    Do While (i < 768)
        
        ReadProcessMemory hProcess, ByVal tmp2 + 4 * i, eax, 4, 0           &#39;读取怪物偏移
        
        If eax > 0 Then
            ReadProcessMemory hProcess, ByVal eax + &H4, eax, 4, 0          &#39;读取怪物信息指针
            ReadProcessMemory hProcess, ByVal eax + &H134, GwHP, 4, 0       &#39;怪物当前血值
            ReadProcessMemory hProcess, ByVal eax + &H14C, GwHPMAX, 4, 0    &#39;怪物血值上限
            ReadProcessMemory hProcess, ByVal eax + &H124, GwLv, 2, 0       &#39;怪物等级
            ReadProcessMemory hProcess, ByVal eax + &H3C, GwX, 4, 0         &#39;怪物X坐标
            ReadProcessMemory hProcess, ByVal eax + &H44, GwY, 4, 0         &#39;怪物Y坐标
            ReadProcessMemory hProcess, ByVal eax + &H40, GwZ, 4, 0         &#39;怪物Z坐标
            ReadProcessMemory hProcess, ByVal eax + &H254, GwJl, 4, 0       &#39;人与怪物距离
            ReadProcessMemory hProcess, ByVal eax + &H120, GwClass, 4, 0    &#39;怪物类别
            ReadProcessMemory hProcess, ByVal eax + &HB4, GwZl, 4, 0        &#39;怪物种类  6为怪,7为NPC,9为宠物 A为GM
            ReadProcessMemory hProcess, ByVal eax + &H11C, GwId, 4, 0       &#39;怪物ID
            &#39;----怪物名称------------------------------
            ReadProcessMemory hProcess, ByVal eax + &H230, ECXI, 4, 0       &#39;读取怪物名称首地址
            ReadProcessMemory hProcess, ByVal ECXI, GwNameb(0), 64, 0       &#39;怪物名称
            GwName = Left$(GwNameb, 64)
            GwName = KillChr0(Trim(GwName))
            &#39;------------------------------------------
            Me.Caption = "周围怪物数量:" & CStr(GwSL)
            If GwLv <> 0 Then
                If GwZl = 6 Then
                    Set item = ListView1.ListItems.Add(, "ID" & CStr(i), GwName) &#39;写入表格
                    item.SubItems(1) = GwLv
                    item.SubItems(2) = CStr(Int(400 + (GwX / 10))) & " / " & CStr(Int(550 + (GwY / 10))) & " ↑ " & CStr(Int(GwZ / 10))
                    item.SubItems(3) = CStr(GwJl) &#39;CStr(Int(GwJl / 10))
                    If Check8.Value = 1 Then
                        &#39;If GwName = "荒坟鬼火" Then &#39;匹配名称 &#39;注释掉就是随机打
                            If Int(GwJl) < 50 Then &#39;打距离小于50米的怪
                                Call KillGw(GwId) &#39;调用选怪函数
                            End If
                        &#39;End If
                    End If
                End If
            End If
        End If
        i = i + 1
        If i >= tmp1 Then Exit Do
        
    Loop
    CloseHandle (hProcess)
End Sub

Private Sub Timer1_Timer() &#39;循环执行刷新怪物列表
    If Check1.Value = 1 Then
        Command1_Click
    End If
End Sub

Public Sub KillGw(Ans As Long)
    Dim i As Long
    Dim hwnd As Long
    Dim pid As Long                &#39;www.9dkjw.cn
    Dim pHandle As Long
    Dim MemAddr As Long
    Dim GuaiWuID As Long
    Dim mont_temp As Long
    hwnd = FindWindow("ElementClient Window", "Element Client")
    GetWindowThreadProcessId hwnd, pid
    pHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, 0, pid)
    If pHandle Then
        ReadProcessMemory pHandle, W2i_Base, ByVal VarPtr(MemAddr), 4, 0&    &#39;读基址
        ReadProcessMemory pHandle, MemAddr + &H20, ByVal VarPtr(MemAddr), 4, 0&    &#39;读2级基址
        ReadProcessMemory pHandle, MemAddr + &HA00, GuaiWuID, 4, 0&    &#39;读内存得到怪物ID
        &#39;得到目标ID存放地址
        If GuaiWuID = 0 Then
            If Check2.Value = 1 Then  &#39;打怪前也捡一下  要效率的可以去掉这段
                SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                Delay (200)
                SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                Delay (200)
                SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                Delay (200)
                SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                Delay (200)
                SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                Delay (200)
                SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
            End If
            Form1.Caption = "选怪中..."
            WriteProcessMemory pHandle, MemAddr + &HA00, Ans, 4, 0&
            Delay (100)
        End If
        ReadProcessMemory pHandle, MemAddr + &HA00, GuaiWuID, 4, 0&    &#39;读内存得到怪物ID
        Do While GuaiWuID <> 0 &#39;进入循环 怪物ID为0就是死了 退出!
            DoEvents
            If Check8.Value = 0 Then &#39;取消选怪
                Exit Do &#39;退出循环
            End If
            ReadProcessMemory pHandle, MemAddr + &HA00, GuaiWuID, 4, 0&    &#39;读内存得到怪物ID
            If GuaiWuID = 0 Then &#39;怪死了就按5下捡物
                If Check2.Value = 1 Then
                    SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                    SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                    Delay (200)
                    SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                    SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                    Delay (200)
                    SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                    SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                    Delay (200)
                    SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                    SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                    Delay (200)
                    SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                    SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                    Delay (200)
                    SendMessage hwnd, &H100, GetKeys(Combo1), 0&    &#39;按住捡物
                    SendMessage hwnd, &H101, GetKeys(Combo1), 0&    &#39;松开捡物
                End If
                Form1.Caption = "继续下一个选怪循环...-__-!"
            Else
                For i = 1 To 5 &#39;5个技能循环打
                    If i = 1 Then
                        If Check8.Value = 1 Then &#39;判断选怪是否钩上了
                            If Check3.Value = 1 Then &#39;判断自己是否选上
                                If Text6.Text = 0 Then &#39;目标ID为空 怪死了退出循环
                                    Exit For &#39;退出循环
                                Else
                                    SendMessage hwnd, &H100, GetKeys(Combo2), 0&    &#39;按住
                                    SendMessage hwnd, &H101, GetKeys(Combo2), 0&    &#39;松开
                                    Delay (CLng(Text1)) &#39;延迟函数
                                End If
                            End If
                        End If
                    ElseIf i = 2 Then
                        If Check8.Value = 1 Then
                            If Check4.Value = 1 Then
                                If Text6.Text = 0 Then
                                    Exit For
                                Else
                                    SendMessage hwnd, &H100, GetKeys(Combo3), 0&    &#39;按住
                                    SendMessage hwnd, &H101, GetKeys(Combo3), 0&    &#39;松开
                                    Delay (CLng(Text2))
                                End If
                            End If
                        End If
                    ElseIf i = 3 Then
                        If Check8.Value = 1 Then
                            If Check5.Value = 1 Then
                                If Text6.Text = 0 Then
                                    Exit For
                                Else
                                    SendMessage hwnd, &H100, GetKeys(Combo4), 0&    &#39;按住
                                    SendMessage hwnd, &H101, GetKeys(Combo4), 0&    &#39;松开
                                    Delay (CLng(Text3))
                                End If
                            End If
                        End If
                    ElseIf i = 4 Then
                        If Check8.Value = 1 Then
                            If Check6.Value = 1 Then
                                If Text6.Text = 0 Then
                                    Exit For
                                Else
                                    SendMessage hwnd, &H100, GetKeys(Combo5), 0&    &#39;按住
                                    SendMessage hwnd, &H101, GetKeys(Combo5), 0&    &#39;松开
                                    Delay (CLng(Text4))
                                End If
                            End If
                        End If
                    ElseIf i = 5 Then
                        If Check8.Value = 1 Then
                            If Check7.Value = 1 Then
                                If Text6.Text = 0 Then
                                    Exit For
                                Else
                                    SendMessage hwnd, &H100, GetKeys(Combo6), 0&    &#39;按住
                                    SendMessage hwnd, &H101, GetKeys(Combo6), 0&    &#39;松开
                                    Delay (CLng(Text5))
                                End If
                            End If
                        End If
                    End If
                    Form1.Caption = "选中怪ID" & GuaiWuID & "^__^!!!"
                Next i
            End If
        Loop
        CloseHandle (pHandle)
    Else
        Form1.Caption = "游戏状态:未加载."
    End If
End Sub

Private Sub Timer2_Timer()  &#39;读取目前选中怪物ID
    Dim hwnd As Long
    Dim pid As Long
    Dim pHandle As Long             &#39;www.9dkjw.cn
    Dim MemAddr As Long
    Dim GuaiWuID As Long
    If Check8.Value = 1 Then
    hwnd = FindWindow("ElementClient Window", "Element Client")
    GetWindowThreadProcessId hwnd, pid
    pHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, 0, pid)
    If pHandle = 0 Then
        Exit Sub
    End If
    ReadProcessMemory pHandle, W2i_Base, MemAddr, 4, 0&    &#39;读基址
    ReadProcessMemory pHandle, MemAddr + &H20, MemAddr, 4, 0&    &#39;读2级基址
    ReadProcessMemory pHandle, MemAddr + &HA00, MemAddr, 4, 0&    &#39;读内存得到怪物ID
    Text6.Text = MemAddr
    CloseHandle (pHandle)
    End If
End Sub

http://yunpan.cn/QXhZtbZRJEFdm
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

果子博客
扫码关注微信公众号

Archiver|手机版|小黑屋|风叶林

GMT+8, 2026-2-1 15:10 , Processed in 0.202708 second(s), 21 queries .

Powered by 风叶林

© 2001-2026 Discuz! Team.

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