Code:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <NomadMemory.au3>
#include <Array.au3>
Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled
$hGui = GUICreate("PWI Simple target info by dumbfck", 330, 100)
$lblMobId = GUICtrlCreateLabel("NPC / Mob ID: ", 10, 15, 130, 15)
$lblMobName = GUICtrlCreateLabel("NPC / Mob Name: ", 10, 35, 130, 15)
$lblMobMaxHp = GUICtrlCreateLabel("NPC / Mob Max HP: ", 10, 55, 130, 15)
$lblMobHp = GUICtrlCreateLabel("NPC / Mob HP: ", 10, 75, 130, 15)
$lblMobIdVal = GUICtrlCreateLabel("", 150, 15, 130, 15)
$lblMobNameVal = GUICtrlCreateLabel("", 150, 35, 130, 15)
$lblMobMaxHpVal = GUICtrlCreateLabel("", 150, 55, 130, 15)
$lblMobHpVal = GUICtrlCreateLabel("", 150, 75, 130, 15)
GUISetOnEvent(-3, "_Quit")
Global $kernel32 = DllOpen('kernel32.dll')
Global $procName = "elementclient.exe"
Global $processes
Global $pid
Global $pHandle
; Are assigned in constructOffsets()
Global $baseCall = 0xB28AC4
Global $baseAddress
Global $offsetTargetId = 0xB68
Global $targetIndex, $targetId, $prevTargetId = 0
GUISetState(@SW_SHOW, $hGui)
$processes = ProcessList($procName)
If UBound($processes) < 2 Then ; first entry is always empty
MsgBox(16, 'Error', 'No elementclients found')
Exit
Else
$pid = $processes[1][1] ; [x][1] = PID of process
$pHandle = _MemoryOpen($pid)
EndIf
; Loop forever
While 1
getTargetIndex();
if not $targetId = 0 Then
Local $aryNpc[7] = [0x00, 0x1C, 0x1C, 0x24, 0x50, $targetIndex * 4, 0x11C]
$id = _MemoryPointerRead($baseCall, $pHandle, $aryNpc)
GUICtrlSetData($lblMobIdVal, Hex($id[1]))
$aryNpc[6] = 0x12C
$maxHp = _MemoryPointerRead($baseCall, $pHandle, $aryNpc)
GUICtrlSetData($lblMobHpVal, $maxHp[1])
$aryNpc[6] = 0x16C
$hp = _MemoryPointerRead($baseCall, $pHandle, $aryNpc)
GUICtrlSetData($lblMobMaxHpVal, $hp[1])
Local $aryName[8] = [0x00, 0x1C, 0x1C, 0x24, 0x50, $targetIndex * 4, 0x254, 0x00]
$name = _MemoryPointerRead($baseCall, $pHandle, $aryName, 'wchar[30]')
GUICtrlSetData($lblMobNameVal, $name[1])
Else
GUICtrlSetData($lblMobMaxHpVal, "")
GUICtrlSetData($lblMobMaxHpVal, "")
GUICtrlSetData($lblMobMaxHpVal, "")
GUICtrlSetData($lblMobMaxHpVal, "")
EndIf
Sleep(200)
WEnd
Func getTargetIndex()
Local $aryTargetId[4] = [0x00, 0x1C, 0x34, $offsetTargetId]
Local $i, $npcId, $found = false
$targetId = _MemoryPointerRead($baseCall, $pHandle, $aryTargetId)
$targetId = $targetId[1]
if not $targetId = 0 Then
Local $aryNpcCount[5] = [0x00, 0x1C, 0x1C, 0x24, 0x14]
$npcCount = _MemoryPointerRead($baseCall, $pHandle, $aryNpcCount)
$npcCount = $npcCount[1]
Local $aryNpcId[7] = [0x00, 0x1C, 0x1C, 0x24, 0x50, 0x00, 0x11C]
;ConsoleWrite('NPC count ' & $npcCount & @CRLF)
For $i = 0 to $npcCount
$aryNpcId[5] = $i * 4
$npcId = _MemoryPointerRead($baseCall, $pHandle, $aryNpcId)
$npcId = $npcId[1]
;ConsoleWrite($i & ' ' & Hex($npcId) & @CRLF)
If $npcId = $targetId Then
;ConsoleWrite('Found ' & Hex($npcId) & @CRLF)
$found = true
ExitLoop
EndIf
Next
if $found Then
$targetId = $npcId
$targetIndex = $i
Else
$targetId = 0
$targetIndex = 0
EndIf
EndIf
$prevTargetId = $targetId
EndFunc
Func _Quit()
Exit
EndFunc ;==>_Quit