Global $GlobalPlayerUnit = 0x6FBCC3D0
Func _D2Mem_GetStat($PStat, $window)
$pid = WinGetProcess($window, "")
If $pid = -1 Then
SetError(1)
Else
Local $Buffer = DllStructCreate('dword')
Local $dll[2] = [DllOpen('kernel32.dll')]
Local $Open = DllCall($dll[0], 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', 0, 'int', $pid)
$dll[1] = $Open[0]
DllCall($dll[0], 'int', 'ReadProcessMemory', 'int', $dll[1], 'int', $GlobalPlayerUnit, 'ptr', DllStructGetPtr($Buffer), 'int', 4, 'int', '')
$Pointer1 = '0x' & Hex(DllStructGetData($Buffer, 1) + 92)
DllCall($dll[0], 'int', 'ReadProcessMemory', 'int', $dll[1], 'int', $Pointer1, 'ptr', DllStructGetPtr($Buffer), 'int', 4, 'int', '')
$Pointer2 = '0x' & Hex(DllStructGetData($Buffer, 1) + 36)
DllCall($dll[0], 'int', 'ReadProcessMemory', 'int', $dll[1], 'int', $Pointer2, 'ptr', DllStructGetPtr($Buffer), 'int', 4, 'int', '')
$Pointer3 = '0x' & Hex(DllStructGetData($Buffer, 1) + $PStat + 31)
DllCall($dll[0], 'int', 'ReadProcessMemory', 'int', $dll[1], 'int', $Pointer3, 'ptr', DllStructGetPtr($Buffer), 'int', 4, 'int', '')
$Value = DllStructGetData($Buffer, 1)
DllClose($dll[0])
Return $Value
EndIf
EndFunc ;==>GetStat
===============================================
Func _D2Mem_IsInGame($window)
If WinExists($window, "") Then
If _D2Mem_GetStat(46, $window) > 0 Or _D2Mem_GetStat(38, $window) > 0 Or _D2Mem_GetStat(61, $window) > 0 Then
Return 1
Else
Return 0
EndIf
Else
SetError(1)
EndIf
EndFunc ;==>_IsInGame
Func _D2Mem_GetStat($PStat, $window)
$pid = WinGetProcess($window, "")
If $pid = -1 Then
SetError(1)
Else
Local $Buffer = DllStructCreate('dword')
Local $dll[2] = [DllOpen('kernel32.dll')]
Local $Open = DllCall($dll[0], 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', 0, 'int', $pid)
$dll[1] = $Open[0]
DllCall($dll[0], 'int', 'ReadProcessMemory', 'int', $dll[1], 'int', $GlobalPlayerUnit, 'ptr', DllStructGetPtr($Buffer), 'int', 4, 'int', '')
$Pointer1 = '0x' & Hex(DllStructGetData($Buffer, 1) + 92)
DllCall($dll[0], 'int', 'ReadProcessMemory', 'int', $dll[1], 'int', $Pointer1, 'ptr', DllStructGetPtr($Buffer), 'int', 4, 'int', '')
$Pointer2 = '0x' & Hex(DllStructGetData($Buffer, 1) + 36)
DllCall($dll[0], 'int', 'ReadProcessMemory', 'int', $dll[1], 'int', $Pointer2, 'ptr', DllStructGetPtr($Buffer), 'int', 4, 'int', '')
$Pointer3 = '0x' & Hex(DllStructGetData($Buffer, 1) + $PStat + 31)
DllCall($dll[0], 'int', 'ReadProcessMemory', 'int', $dll[1], 'int', $Pointer3, 'ptr', DllStructGetPtr($Buffer), 'int', 4, 'int', '')
$Value = DllStructGetData($Buffer, 1)
DllClose($dll[0])
Return $Value
EndIf
EndFunc ;==>GetStat
===============================================
Func _D2Mem_IsInGame($window)
If WinExists($window, "") Then
If _D2Mem_GetStat(46, $window) > 0 Or _D2Mem_GetStat(38, $window) > 0 Or _D2Mem_GetStat(61, $window) > 0 Then
Return 1
Else
Return 0
EndIf
Else
SetError(1)
EndIf
EndFunc ;==>_IsInGame