file:///C:/DOCUME%7E1/alan/LOCALS%7E1/Temp/moz-screenshot.jpg
大部份源碼都在廣海聯合國可找到..經本人改進了可歷編所有怪...但是選怪call 和 普攻還是不會做有大大提供一下
研究中所以沒整理好..版面不好看請見諒.. 大部份碼是 virginlin 大大先放上來的 http://bbs.wgun.net/thread-270449-1-2.html
本人改用 timer 隔時間去素描 .改 timer1.時間..
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32.dll" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByRef lpBuffer As Any, ByVal nSize As Long, ByRef lpNumberOfBytesWritten As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Const PROCESS_ALL_ACCESS = &H1F0FFF
Dim proc As Long
Dim pid As Long
Const PW_Base = &H97B33C
Dim W2I_DYNAMIC_BASE_ADDR As Long
Dim W2I_ROLE_BASE_ADDR As Long
Dim hp As Long, mp As Long, maxhp As Long, maxmp As Long, genki As Long
Dim name_temp As Long
Dim name_temp1 As Long
Dim pplname(32) As Byte
Dim GroupName(64) As Byte
Dim group_temp As Long
Dim hProcess As Long
Dim W2I_BASE_ADDR As Long
Dim W2I_ENVIRON_BASE_ADDR As Long ':Cardinal ;// (*(DWORD *)(W2I_DYNAMIC_BASE_ADDR+0x8)) //周圍環境基址
Dim W2I_MONSTER_BASE_ADDR As Long '怪物基址
Dim W2I_MONSTER_COUNT As Long '怪物數量
Dim W2I_MONSTER_MAXCOUNT As Long '怪物數組的最大值 (MAX =769)
Dim W2I_MONSTER_ADDR As Long '怪物列表的首地址
Dim W2I_ENV_MONSTER_ADDR As Long
Dim W2I_ENV_MONSTER_OBJ As Long
Dim W2I_ENV_MONSTER_NAME_ADDR As Long
Dim W2I_ENV_MONSTER_NAME As Long
Dim W2I_MONSTER_NUM As Long
Dim i As Long '用於?圈
Dim ii As Long
'==============================
'Dim hwnd 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 '怪物X坐標
Dim GwY As Single '怪物Y坐標
Dim GwJl As Single
Dim GwClass As Long
Dim GwId As Long
Dim GwName As String '怪物名字
'Dim GroupName As String '盟名稱
Dim GwZl As Long
Dim GwNameb(63) As Byte
Dim group(63) As Byte
'=================================
Private Sub Command1_Click()
Timer1.Enabled = True
proc = FindWindow(vbNullString, Text3.Text)
If proc > 0 Then
GetWindowThreadProcessId proc, pid
Else
MsgBox "遊戲未啟動"
Exit Sub
End If
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If hProcess = 0 Then
MsgBox "not found"
Exit Sub
End If
ReadProcessMemory hProcess, ByVal PW_Base, W2I_DYNAMIC_BASE_ADDR, 4, 0& '一級基址 PW_Base = &H97B33C
ReadProcessMemory hProcess, ByVal W2I_DYNAMIC_BASE_ADDR + &H20, W2I_ROLE_BASE_ADDR, 4, 0& '人物基址
ReadProcessMemory hProcess, ByVal W2I_ROLE_BASE_ADDR + &H5F4, name_temp, 4, 0& '得到角色名
ReadProcessMemory hProcess, ByVal name_temp, pplname(0), 32, 0&
Form1.Caption = pplname
ReadProcessMemory hProcess, ByVal W2I_ROLE_BASE_ADDR + &H6DC, group_temp, 4, 0& '得到角色名
ReadProcessMemory hProcess, ByVal group_temp, GroupName(0), 64, 0& '得到幫會名'6a4 ,6dc
' 幫會名還在研究中
GroupName1 = (Trim(Left$(GroupName, 64)))
' mem = StrConv(GroupName1, vbFromUnicode)
' Big 5 to gb
tStr = StrConv(GroupName1, vbFromUnicode, &H804)
GBBIG5 = StrConv(tStr, vbUnicode, &H404)
Form1.Caption = GBBIG5
'GB to Big5
tStr = StrConv(GroupName1, vbFromUnicode, &H404)
GBBIG5 = StrConv(tStr, vbUnicode, &H804)
Form1.Caption = GBBIG5
'mem = StrConv(GroupName, vbFromUnicode, &H404)
' `再?Unicode????GBK??
'mem = StrConv(mem, vbFromUnicode, &H804)
Form1.Caption = GroupName1
'Form1.Caption = mem
'----------------------
ReadProcessMemory hProcess, ByVal W2I_ROLE_BASE_ADDR + &H464, hp, 4, 0&
ReadProcessMemory hProcess, ByVal W2I_ROLE_BASE_ADDR + &H468, mp, 4, 0&
ReadProcessMemory hProcess, ByVal W2I_ROLE_BASE_ADDR + &H494, maxhp, 4, 0&
ReadProcessMemory hProcess, ByVal W2I_ROLE_BASE_ADDR + &H498, maxmp, 4, 0&
ReadProcessMemory hProcess, ByVal W2I_ROLE_BASE_ADDR + &H478, genki, 4, 0&
' Form1.Caption = GroupName
'GroupName1 = Trim(Left$(pplname, 64))
'GwName = Left$(GwNameb, 64)
' GwName = Trim(GwName)
' Form1.Caption = name_temp
'Form1.Caption = GroupName
' temp1_name = Form1.Caption
lbHP.Caption = hp & " / " & maxhp
lbMP.Caption = mp & " / " & maxmp
End Sub
Private Sub Timer1_Timer()
Const W2I_Base = &H97B33C '完美基址v116
ListView1.ListItems.Clear
Timer1.Enabled = False
ReadProcessMemory hProcess, ByVal W2I_Base, W2I_BASE_ADDR, 4, 0
' ReadProcessMemory hProcess, ByVal W2I_BASE_ADDR + &H1C, W2I_DYNAMIC_BASE_ADDR, 4, 0
ReadProcessMemory hProcess, ByVal W2I_DYNAMIC_BASE_ADDR + &H8, W2I_ENVIRON_BASE_ADDR, 4, 0 '//得到周圍環境地址
ReadProcessMemory hProcess, ByVal W2I_ENVIRON_BASE_ADDR + &H24, W2I_MONSTER_BASE_ADDR, 4, 0 '//得到怪物 基地址 '讀2級基址
ReadProcessMemory hProcess, ByVal W2I_MONSTER_BASE_ADDR + &H14, W2I_MONSTER_COUNT, 4, 0 '//讀出怪物數量
ReadProcessMemory hProcess, ByVal W2I_MONSTER_BASE_ADDR + &H24, tmp1, 4, 0 '讀出怪物數組的最大值
ReadProcessMemory hProcess, ByVal W2I_MONSTER_BASE_ADDR + &H18, tmp2, 4, 0 '讀出怪物列表的首地址
Do While (i < 768)
ReadProcessMemory hProcess, ByVal tmp2 + 4 * i, W2I_MONSTER_BASE_ADDR, 4, 0 '讀取怪物偏移
If W2I_MONSTER_BASE_ADDR > 0 Then
ReadProcessMemory hProcess, ByVal W2I_MONSTER_BASE_ADDR + &H4, W2I_ENV_MONSTER_OBJ, 4, 0 '讀取怪物資料位址指針
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &H3C, GwX, 4, 0 '怪物X坐標
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &H44, GwY, 4, 0 '怪物Y坐標
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &HB4, GwZl, 4, 0 '怪物種類 6=怪 7=npc
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &H120, GwClass, 4, 0 '怪物類別
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &H124, GwLv, 2, 0 '怪物等級
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &H12C, GwHP, 4, 0 '怪物當前血值
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &H15C, GwHPMAX, 4, 0 '怪物血值上限
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &H254, GwJl, 2, 0 '人與怪物距離
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &H11C, GwId, 4, 0 '怪物ID
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &HE8, W2I_MONSTER_NUM, 4, 0 '相對編號(用處不大)
'---怪物名稱------------------------------
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_OBJ + &H23C, W2I_ENV_MONSTER_NAME_ADDR, 4, 0 '讀取怪物名稱首地址
ReadProcessMemory hProcess, ByVal W2I_ENV_MONSTER_NAME_ADDR, GwNameb(0), 64, 0 '怪物名稱
GwName = Left$(GwNameb, 64)
GwName = Trim(GwName)
'------------------------------------------
If GwZl = 6 Then ' 6=怪 7=npc
' Form1.Caption = pplname
Set Item = ListView1.ListItems.Add(, "ID" & CStr(i), GwName)
Item.SubItems(1) = GwJl
Item.SubI●嚴禁張貼私服●) = GwLv
Item.SubItems(3) = CStr(Int(400 + (GwX / 10))) & "/" & CStr(Int(550 + (GwY / 10)))
Item.SubItems(4) = GwHP & "/" & GwHPMAX
'Item.SubItems(4) = CStr(Int(GwJl / 10))
'Item.SubItems(5) = W2I_MONSTER_NUM
Item.SubItems(5) = GwId
End If
End If
i = i + 1
If i >= tmp1 Then Exit Do
Loop
i = 0
Timer1.Enabled = True
Exit Sub
End Sub
Private Sub Command2_Click()
pid = 0
lbHP.Caption = "0 / 0"
lbMP.Caption = "0 / 0"
Timer1.Enabled = False
HPTimer.Enabled = False
MPTimer.Enabled = False
ListView1.ListItems.Clear
i = 0
CloseHandle hProcess
CloseHandle pro
End Sub
'End Sub
Private Sub Timer1_Time()
Timer1_Time.Interval = 10 * 100000
End Sub
Private Sub HPTime_Change()
HPTimer.Interval = HPTime.Text * 1000
End Sub
Private Sub MPTime_Change()
MPTimer.Interval = MPTime.Text * 1000
End Sub
Private Sub HPTimer_Timer()
Dim percent As Integer
'Error here if maxhp <=0
If maxhp <= 0 Then
Exit Sub
End If
percent = CInt(hp / maxhp * 100)
If chkFixKeyHP.Value = 1 And percent <= txtHP.Text Then 'trigger
Call SendKey(FixKeyHP.Text) '送出卡鍵
End If
End Sub
Private Sub MPTimer_Timer()
Dim percent As Integer
'Error here if maxhp <=0
If maxmp <= 0 Then
Exit Sub
End If
percent = CInt(mp / maxmp * 100)
If chkFixKeyMP.Value = 1 And percent <= txtMP.Text Then 'trigger
Call SendKey(FixKeyMP.Text) '送出卡鍵
End If
End Sub
End Sub
[ 本帖最後由 sl25 於 2009-7-6 00:36 編輯 ] |