Multiclient Trainshow

11/29/2008 16:38 lolkop#16
i'll add autoupdate :)

found the adress that changes if the dc box appears so i've changed the code to show Disconnected if you dc :)
12/02/2008 06:24 manofsro#17
soo great thnak you soo much
12/18/2008 04:30 ADSŪ#18
umm i was traying to find some file to help you so i found this

Quote:
Originally Posted by _ProcessGetPath
; #FUNCTION# ================================================== =============================
; Name...........: _ProcessGetPath(
; Description ...: Retrieves a process file path
; Syntax.........: _ProcessGetPath($vProcess)
; Parameters ....: $vProcess - PID or name of a process
; Requirements...: kernel32.dll, psapi.dll
; Return values .: Success - A full process path
; @error = 0
; Failure - Empty string
; @error = 1 - Invalid process name/PID
; @error = 2 - kernel32.dll failed to open (wrong version?)
; @error = 3 - Could not OpenProcess
; @error = 4 - psapi.dll failed to open (doesn't exist?)
; @error = 5 - returned path is empty or invalid
; Author ........: JScript, Larry, SmOke_N
; Modified.......: mrRevoked - reformated, error checking
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
; ================================================== ==========================================
Func _ProcessGetPath($vProcess)
Local $i_PID, $hKernel32, $hPsapi, $aProcessHandle, $tDLLStruct, $iError, $sProcessPath

$i_PID = ProcessExists($vProcess)

If Not $i_PID Then Return SetError(1, 0, "");process doesn't exist?

$hKernel32 = DllOpen("Kernel32.dll")
$iError = @error
If $iError Then
DllClose($hKernel32)
Return SetError(2, $iError, ""); dllopen kernell32.dll failed
EndIf

$aProcessHandle = DllCall($hKernel32, "int", "OpenProcess", "int", 0x0400 + 0x0010, "int", 0, "int", $i_PID)
$iError = @error
If $iError Or $aProcessHandle[0] = 0 Then
DllClose($hKernel32)
Return SetError(2, $iError, "");openprocess failed
EndIf

$hPsapi = DllOpen("Psapi.dll")
$iError = @error
If $iError Then
DllClose($hKernel32)
DllClose($hPsapi)
Return SetError(3, $iError, ""); dllopen psapi.dll failed
EndIf

$tDLLStruct = DllStructCreate("char[1000]")

DllCall($hPsapi, "long", "GetModuleFileNameEx", "int", $aProcessHandle[0], "int", 0, "ptr", DllStructGetPtr($tDLLStruct), "long", DllStructGetSize($tDLLStruct))
$iError = @error

DllCall($hKernel32, "int", "CloseHandle", "int", $aProcessHandle[0])
DllClose($hKernel32)
DllClose($hPsapi)

If $iError Then
$tDLLStruct = 0
Return SetError(4, $iError, "");getmodulefilenamex failed
EndIf

$sProcessPath = DllStructGetData($tDLLStruct, 1)
$tDLLStruct = 0

;format the output
If StringLen($sProcessPath) < 2 Then Return SetError(5, 0, "");is empty or non readable
If StringLeft($sProcessPath, 4) = "\??\" Then $sProcessPath = StringReplace($sProcessPath, "\??\", "")
If StringLeft($sProcessPath, 20) = "\SystemRoot\System32" Then $sProcessPath = StringReplace($sProcessPath, "\SystemRoot\System32", @SystemDir)

Return SetError(0, 0, $sProcessPath)
EndFunc;==>_ProcessGetPath
so when you open the statusbar will search the SRO_CLIENT and analysate it as you better know ;)

also you should save that info ( Offsets and file time) in registry so can be read by all the programs that you made since i found very usefull ^^
12/26/2008 02:25 grim_fandang0#19
doesnt work for me:(

will there be update?
12/26/2008 12:13 lolrko#20
great tool , u have my thank. ..
12/27/2008 04:07 Low_Riders#21
@lolrko
how u get it to work ?
for me it doesnt even appear o.o
12/27/2008 08:27 lolkop#22
offsets need to be updated won't work for now
12/27/2008 18:11 krayzie#23
Quote:
Originally Posted by lolkop View Post
offsets need to be updated won't work for now
i love ur product, i'd updated to save u some time but still needed to update the XY
Code:
#NoTrayIcon
Global $base = 0xD1564C
Global $xRegionOffset = 0x7C
Global $yRegionOffset1 = 0x7C
Global $yRegionOffset2 = 0x08
Global $xPositionOffset = 0x78
Global $yPositionOffset = 0x78
Global $posDividerAddress = 0xBF95C0

Dim $old0, $old1, $old2, $old3, $old4, $old5, $old6, $old7, $old8, $clientold

$width = 680
GUICreate("", $width, 23, @DesktopWidth / 2 - $width / 2, 0, 0x80000000, 0x88)
GUISetBkColor(0)
$charlist = GUICtrlCreateList("", 520, 4, 70, 20, 0x3, 0x80)
GUICtrlSetBkColor(-1, 0)
GUICtrlSetColor(-1, 0xFFFFFF)
XpSyleToggle()
$hpbar = GUICtrlCreateProgress(10, 0, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xE14848)
$mpbar = GUICtrlCreateProgress(150, 0, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0x4185C5)
$expbar = GUICtrlCreateProgress(290, 0, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0x4A6B31)
XpSyleToggle(0)
$hp = GUICtrlCreateLabel("", 10, 4, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xFFFFFF)
$mp = GUICtrlCreateLabel("", 150, 4, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xFFFFFF)
$exp = GUICtrlCreateLabel("", 290, 4, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xFFFFFF)
$pos = GUICtrlCreateLabel("", 430, 4, 80, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xAC00A9)
$exit = GUICtrlCreateLabel("Exit", 630, 4, 60, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xEB0018)
$hide = GUICtrlCreateLabel("Hide", 590, 4, 60, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0x30FF05)
$sp = GUICtrlCreateLabel("", 670, 4, 60, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xFFCF08)
GUISetState()

Do
	$client = WinList("[CLASS:CLIENT]")
	If $client[0][0] = 0 Then
		MsgBox(16, "Error", "No Clients Detected")
		Exit
	EndIf
	If $client[0][0] <> $clientold Then
		GUICtrlSetData($charlist, "")
		For $i = 1 To $client[0][0]
			$pid = WinGetProcess($client[$i][1])
			$mid = _MemoryOpen($pid)
			If _MemoryRead(0xD13F08, $mid, "wchar[12]") <> "" Then
				GUICtrlSetData($charlist, _MemoryRead(0xD13F08, $mid, "wchar[12]"))
			EndIf
			_MemoryClose($mid)
		Next
	EndIf
	$msg = GUIGetMsg()
	$mid = _MemoryOpen(GetClient(GUICtrlRead($charlist)))
	If $old1 <> _ReadDynamic($base, 0x458, $mid) Or $old2 <> _ReadDynamic($base, 0x450, $mid) Then
		GUICtrlSetData($hpbar, Round(_ReadDynamic($base, 0x458, $mid) / _ReadDynamic($base, 0x450, $mid) * 100, 2))
		GUICtrlSetData($hp, _ReadDynamic($base, 0x458, $mid) & "/" & _ReadDynamic($base, 0x450, $mid) & " (" & Round(_ReadDynamic($base, 0x458, $mid) / _ReadDynamic($base, 0x450, $mid) * 100, 2) & "%)")
	EndIf
	If $old3 <> _ReadDynamic($base, 0x44C, $mid) Or $old4 <> _ReadDynamic($base, 0x454, $mid) Then
		GUICtrlSetData($mpbar, Round(_ReadDynamic($base, 0x44C, $mid) / _ReadDynamic($base, 0x454, $mid) * 100, 2))
		GUICtrlSetData($mp, _ReadDynamic($base, 0x44C, $mid) & "/" & _ReadDynamic($base, 0x454, $mid) & " (" & Round(_ReadDynamic($base, 0x44C, $mid) / _ReadDynamic($base, 0x454, $mid) * 100, 2) & "%)")
	EndIf
	If $old5 <> _ReadDynamic($base, 0x840, $mid) Or $old6 <> _ReadDynamic($base, 0x838, $mid) Then
		GUICtrlSetData($expbar, Round(_ReadDynamic($base, 0x840, $mid) / LvLExp(_ReadDynamic($base, 0x838, $mid, "byte")) * 100, 2))
		GUICtrlSetData($exp, _ReadDynamic($base, 0x840, $mid) & " (" & Round(_ReadDynamic($base, 0x840, $mid) / LvLExp(_ReadDynamic($base, 0x838, $mid, "byte")) * 100, 2) & "%)")
	EndIf
	If $old7 <> GetPlayerX($mid) Or $old8 <> GetPlayerY($mid) Then
		GUICtrlSetData($pos, GetPos(GetPlayerX($mid), GetPlayerY($mid)))
	EndIf
	
	$old1 = _ReadDynamic($base, 0x458, $mid) ;------Current HP
	$old2 = _ReadDynamic($base, 0x450, $mid) ;------Max HP
	$old3 = _ReadDynamic($base, 0x44C, $mid) ;------Current MP
	$old4 = _ReadDynamic($base, 0x454, $mid) ;------Max MP
	$old5 = _ReadDynamic($base, 0x840, $mid) ;------Current EXP
	$old6 = _ReadDynamic($base, 0x838, $mid) ;------Current Lvl
	$old7 = GetPlayerX($mid)
	$old8 = GetPlayerY($mid)
	_MemoryClose($mid)
	$wHnd = GetClient(GUICtrlRead($charlist), 2)
	If BitAND(WinGetState($wHnd), 2) Then
		If GUICtrlRead($hide) <> "Hide"  Then
			GUICtrlSetData($hide, "Hide")
		EndIf
	Else
		If GUICtrlRead($hide) <> "Show"  Then
			GUICtrlSetData($hide, "Show")
		EndIf
	EndIf
	If $msg = $hide Then
		$wHnd = GetClient(GUICtrlRead($charlist), 2)
		If BitAND(WinGetState($wHnd), 2) Then
			WinSetState($wHnd, "", @SW_MINIMIZE)
			WinSetState($wHnd, "", @SW_HIDE)
		Else
			WinSetState($wHnd, "", @SW_SHOW)
			WinSetState($wHnd, "", @SW_MAXIMIZE)
		EndIf
	EndIf
	$clientold = $client[0][0]
	Sleep(1)
Until $msg = $exit

Func GetClient($char, $type = 1)
	$client = WinList("[CLASS:CLIENT]")
	For $i = 1 To $client[0][0]
		$pid = WinGetProcess($client[$i][1])
		$mid = _MemoryOpen($pid)
		If _MemoryRead(0xD13F08, $mid, "wchar[12]") = $char Then
			If $type = 1 Then
				Return $pid
			ElseIf $type = 2 Then
				Return $client[$i][1]
			EndIf
		EndIf
		_MemoryClose($mid)
	Next
EndFunc   ;==>GetClient

Func LvLExp($lvl)
	If $lvl = 1 Then
		Return 118
	ElseIf $lvl = 2 Then
		Return 470
	ElseIf $lvl = 3 Then
		Return 1058
	ElseIf $lvl = 4 Then
		Return 1880
	ElseIf $lvl = 5 Then
		Return 2938
	ElseIf $lvl = 6 Then
		Return 5640
	ElseIf $lvl = 7 Then
		Return 9048
	ElseIf $lvl = 8 Then
		Return 13160
	ElseIf $lvl = 9 Then
		Return 17978
	ElseIf $lvl = 10 Then
		Return 23500
	ElseIf $lvl = 11 Then
		Return 34898
	ElseIf $lvl = 12 Then
		Return 47940
	ElseIf $lvl = 13 Then
		Return 62628
	ElseIf $lvl = 14 Then
		Return 78960
	ElseIf $lvl = 15 Then
		Return 96938
	ElseIf $lvl = 16 Then
		Return 127840
	ElseIf $lvl = 17 Then
		Return 161798
	ElseIf $lvl = 18 Then
		Return 198810
	ElseIf $lvl = 19 Then
		Return 238878
	ElseIf $lvl = 20 Then
		Return 282000
	ElseIf $lvl = 21 Then
		Return 351231
	ElseIf $lvl = 22 Then
		Return 427755
	ElseIf $lvl = 23 Then
		Return 512196
	ElseIf $lvl = 24 Then
		Return 605232
	ElseIf $lvl = 25 Then
		Return 707587
	ElseIf $lvl = 26 Then
		Return 820046
	ElseIf $lvl = 27 Then
		Return 943453
	ElseIf $lvl = 28 Then
		Return 1078717
	ElseIf $lvl = 29 Then
		Return 1226815
	ElseIf $lvl = 30 Then
		Return 1388803
	ElseIf $lvl = 31 Then
		Return 1595229
	ElseIf $lvl = 32 Then
		Return 1818827
	ElseIf $lvl = 33 Then
		Return 2060796
	ElseIf $lvl = 34 Then
		Return 2322414
	ElseIf $lvl = 35 Then
		Return 2605043
	ElseIf $lvl = 36 Then
		Return 2910129
	ElseIf $lvl = 37 Then
		Return 3239210
	ElseIf $lvl = 38 Then
		Return 3593924
	ElseIf $lvl = 39 Then
		Return 3976012
	ElseIf $lvl = 40 Then
		Return 4387323
	ElseIf $lvl = 41 Then
		Return 4869381
	ElseIf $lvl = 42 Then
		Return 5382982
	ElseIf $lvl = 43 Then
		Return 5929882
	ElseIf $lvl = 44 Then
		Return 6511920
	ElseIf $lvl = 45 Then
		Return 7131034
	ElseIf $lvl = 46 Then
		Return 7789258
	ElseIf $lvl = 47 Then
		Return 8488730
	ElseIf $lvl = 48 Then
		Return 9231697
	ElseIf $lvl = 49 Then
		Return 10020519
	ElseIf $lvl = 50 Then
		Return 10857676
	ElseIf $lvl = 51 Then
		Return 11857343
	ElseIf $lvl = 52 Then
		Return 12913686
	ElseIf $lvl = 53 Then
		Return 14029449
	ElseIf $lvl = 54 Then
		Return 15207495
	ElseIf $lvl = 55 Then
		Return 16450818
	ElseIf $lvl = 56 Then
		Return 17762545
	ElseIf $lvl = 57 Then
		Return 19145941
	ElseIf $lvl = 58 Then
		Return 20604414
	ElseIf $lvl = 59 Then
		Return 22141527
	ElseIf $lvl = 60 Then
		Return 23760997
	ElseIf $lvl = 61 Then
		Return 25933410
	ElseIf $lvl = 62 Then
		Return 28214785
	ElseIf $lvl = 63 Then
		Return 30609702
	ElseIf $lvl = 64 Then
		Return 39747505
	ElseIf $lvl = 65 Then
		Return 51493509
	ElseIf $lvl = 66 Then
		Return 55474876
	ElseIf $lvl = 67 Then
		Return 59648780
	ElseIf $lvl = 68 Then
		Return 64023195
	ElseIf $lvl = 69 Then
		Return 68606389
	ElseIf $lvl = 70 Then
		Return 73406955
	ElseIf $lvl = 71 Then
		Return 79345238
	ElseIf $lvl = 72 Then
		Return 85573753
	ElseIf $lvl = 73 Then
		Return 92104572
	ElseIf $lvl = 74 Then
		Return 98950215
	ElseIf $lvl = 75 Then
		Return 106123703
	ElseIf $lvl = 76 Then
		Return 113638552
	ElseIf $lvl = 77 Then
		Return 121508783
	ElseIf $lvl = 78 Then
		Return 129748946
	ElseIf $lvl = 79 Then
		Return 138374168
	ElseIf $lvl = 80 Then
		Return 147400127
	ElseIf $lvl = 81 Then
		Return 158227752
	ElseIf $lvl = 82 Then
		Return 169572387
	ElseIf $lvl = 83 Then
		Return 181455292
	ElseIf $lvl = 84 Then
		Return 193898546
	ElseIf $lvl = 85 Then
		Return 206925087
	ElseIf $lvl = 86 Then
		Return 220558723
	ElseIf $lvl = 87 Then
		Return 234824141
	ElseIf $lvl = 88 Then
		Return 249746989
	ElseIf $lvl = 89 Then
		Return 265353867
	ElseIf $lvl = 90 Then
		Return 281672373
	ElseIf $lvl = 91 Then
		Return 305888332
	ElseIf $lvl = 92 Then
		Return 331303748
	ElseIf $lvl = 93 Then
		Return 357968787
	ElseIf $lvl = 94 Then
		Return 385935560
	ElseIf $lvl = 95 Then
		Return 415258156
	ElseIf $lvl = 96 Then
		Return 445992756
	ElseIf $lvl = 97 Then
		Return 478197705
	ElseIf $lvl = 98 Then
		Return 511933580
	ElseIf $lvl = 99 Then
		Return 547263228
	ElseIf $lvl = 100 Then
		Return 584251898
	EndIf
EndFunc   ;==>LvLExp

Func GetPlayerX($mid)
	$xRegionFloatAdd = _MemoryRead($base, $mid) + $xRegionOffset
	$xRegionFloat = _MemoryRead($xRegionFloatAdd, $mid, "float")
	$xDivider = _MemoryRead($posDividerAddress, $mid, "double")
	$xRegionFloat /= $xDivider
	$xPositionIntAdd = _MemoryRead($base, $mid) + $xPositionOffset
	$xPositionInt = _MemoryRead($xPositionIntAdd, $mid, "short")
	$xPositionInt = BitAND($xPositionInt, 0xFF)
	$xRegionBase = $xPositionInt + ($xPositionInt * 2) - 0x195
	$xRegionBase = BitShift($xRegionBase, -0x6)
	$xPosition = $xRegionBase - Int($xRegionFloat)
	Return $xPosition
EndFunc   ;==>GetPlayerX

Func GetPlayerY($mid)
	$yRegionFloatAdd = _MemoryRead($base, $mid) + $yRegionOffset1 + $yRegionOffset2
	$yRegionFloat = _MemoryRead($yRegionFloatAdd, $mid, "float")
	$yDivider = _MemoryRead($posDividerAddress, $mid, "double")
	$yRegionFloat /= $yDivider
	$yPositionIntAdd = _MemoryRead($base, $mid) + $yPositionOffset
	$yPositionInt = _MemoryRead($yPositionIntAdd, $mid, "short")
	$yPositionInt = BitShift($yPositionInt, 0x8)
	$yRegionBase = $yPositionInt + ($yPositionInt * 2) - 0x114
	$yRegionBase = BitShift($yRegionBase, -0x6)
	$yPosition = $yRegionBase - Int($yRegionFloat)
	Return $yPosition
EndFunc   ;==>GetPlayerY

Func GetPos($xpos, $ypos)
	If CheckConnect(GetClient(GUICtrlRead($charlist))) = 1 Then
		Return "(Diconnected)"
	ElseIf $xpos > -193 And $xpos < 385 And $ypos > -193 And $ypos < 574 Then
		If $ypos < 0 And $xpos < 0 Then
			Return "(" & $xpos & ", " & $ypos & ")" 
		ElseIf $ypos > 191 And $xpos < 0 Then
			Return "(" & $xpos & ", " & $ypos & ")" 
		Else
			Return "(Hotan)" 
		EndIf
	ElseIf $xpos > 3263 And $xpos < 3648 And $ypos > 1919 And $ypos < 2304 Then
		Return "(Donwhang)" 
	ElseIf $xpos > 6143 And $xpos < 6720 And $ypos > 959 And $ypos < 1344 Then
		Return "(Jangan)" 
	ElseIf $xpos > -5377 And $xpos < -4992 And $ypos > 2687 And $ypos < 3072 Then
		Return "(Samarkand)" 
	ElseIf $xpos > -11137 And $xpos < -10190 And $ypos > 2125 And $ypos < 3072 Then
		Return "(Constantinople)" 
	ElseIf $xpos > -25651 And $xpos < -25609 And $ypos > -42347 And $ypos < -42305 Then
		Return "(Cave Entrance)" 
	Else
		Return "(" & $xpos & ", " & $ypos & ")" 
	EndIf
EndFunc   ;==>GetPos

#Region Memory
Func _ReadDynamic($pointer, $offset, $mid, $type = "dword")
	$newadress = _MemoryRead($pointer, $mid) + $offset
	$result = _MemoryRead($newadress, $mid, $type)
	Return $result
EndFunc   ;==>_ReadDynamic

Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $if_InheritHandle = 1)
	Local $ah_Handle[2] = [DllOpen('kernel32.dll') ]
	Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $if_InheritHandle, 'int', $iv_Pid)
	$ah_Handle[1] = $av_OpenProcess[0]
	Return $ah_Handle
EndFunc   ;==>_MemoryOpen

Func _MemoryRead($iv_Address, $ah_Handle, $sv_Type = 'dword')
	Local $v_Buffer = DllStructCreate($sv_Type)
	DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
	Local $v_Value = DllStructGetData($v_Buffer, 1)
	Return $v_Value
EndFunc   ;==>_MemoryRead

Func _MemoryClose($ah_Handle)
	DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1])
	DllClose($ah_Handle[0])
	Return 1
EndFunc   ;==>_MemoryClose
#EndRegion

Func XpSyleToggle($onoff = 1)
	Local $xs_n
	If Not StringInStr(@OSTYPE, "WIN32_NT") Then Return 0
	If $onoff Then
		$xs_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
		DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
		Return 1
	ElseIf IsArray($xs_n) Then
		DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $xs_n[0])
		$xs_n = ""
		Return 1
	EndIf
	Return 0
EndFunc   ;==>XpSyleToggle

Func CheckConnect($pid)
	$mid = _MemoryOpen($pid)
	Return _MemoryRead(0xCCFB08, $mid)
	_MemoryClose($mid)
EndFunc
Edit: Dont thx me i deserve no credit, thx lolkop
12/27/2008 18:47 grim_fandang0#24
Quote:
Originally Posted by krayzie View Post
i love ur product, i'd updated to save u some time but still needed to update the XY
Code:
#NoTrayIcon
Global $base = 0xD1564C
Global $xRegionOffset = 0x7C
Global $yRegionOffset1 = 0x7C
Global $yRegionOffset2 = 0x08
Global $xPositionOffset = 0x78
Global $yPositionOffset = 0x78
Global $posDividerAddress = 0xBF95C0

Dim $old0, $old1, $old2, $old3, $old4, $old5, $old6, $old7, $old8, $clientold

$width = 680
GUICreate("", $width, 23, @DesktopWidth / 2 - $width / 2, 0, 0x80000000, 0x88)
GUISetBkColor(0)
$charlist = GUICtrlCreateList("", 520, 4, 70, 20, 0x3, 0x80)
GUICtrlSetBkColor(-1, 0)
GUICtrlSetColor(-1, 0xFFFFFF)
XpSyleToggle()
$hpbar = GUICtrlCreateProgress(10, 0, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xE14848)
$mpbar = GUICtrlCreateProgress(150, 0, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0x4185C5)
$expbar = GUICtrlCreateProgress(290, 0, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0x4A6B31)
XpSyleToggle(0)
$hp = GUICtrlCreateLabel("", 10, 4, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xFFFFFF)
$mp = GUICtrlCreateLabel("", 150, 4, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xFFFFFF)
$exp = GUICtrlCreateLabel("", 290, 4, 130, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xFFFFFF)
$pos = GUICtrlCreateLabel("", 430, 4, 80, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xAC00A9)
$exit = GUICtrlCreateLabel("Exit", 630, 4, 60, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xEB0018)
$hide = GUICtrlCreateLabel("Hide", 590, 4, 60, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0x30FF05)
$sp = GUICtrlCreateLabel("", 670, 4, 60, 20, 1)
GUICtrlSetBkColor(-1, -2)
GUICtrlSetColor(-1, 0xFFCF08)
GUISetState()

Do
	$client = WinList("[CLASS:CLIENT]")
	If $client[0][0] = 0 Then
		MsgBox(16, "Error", "No Clients Detected")
		Exit
	EndIf
	If $client[0][0] <> $clientold Then
		GUICtrlSetData($charlist, "")
		For $i = 1 To $client[0][0]
			$pid = WinGetProcess($client[$i][1])
			$mid = _MemoryOpen($pid)
			If _MemoryRead(0xD13F08, $mid, "wchar[12]") <> "" Then
				GUICtrlSetData($charlist, _MemoryRead(0xD13F08, $mid, "wchar[12]"))
			EndIf
			_MemoryClose($mid)
		Next
	EndIf
	$msg = GUIGetMsg()
	$mid = _MemoryOpen(GetClient(GUICtrlRead($charlist)))
	If $old1 <> _ReadDynamic($base, 0x458, $mid) Or $old2 <> _ReadDynamic($base, 0x450, $mid) Then
		GUICtrlSetData($hpbar, Round(_ReadDynamic($base, 0x458, $mid) / _ReadDynamic($base, 0x450, $mid) * 100, 2))
		GUICtrlSetData($hp, _ReadDynamic($base, 0x458, $mid) & "/" & _ReadDynamic($base, 0x450, $mid) & " (" & Round(_ReadDynamic($base, 0x458, $mid) / _ReadDynamic($base, 0x450, $mid) * 100, 2) & "%)")
	EndIf
	If $old3 <> _ReadDynamic($base, 0x44C, $mid) Or $old4 <> _ReadDynamic($base, 0x454, $mid) Then
		GUICtrlSetData($mpbar, Round(_ReadDynamic($base, 0x44C, $mid) / _ReadDynamic($base, 0x454, $mid) * 100, 2))
		GUICtrlSetData($mp, _ReadDynamic($base, 0x44C, $mid) & "/" & _ReadDynamic($base, 0x454, $mid) & " (" & Round(_ReadDynamic($base, 0x44C, $mid) / _ReadDynamic($base, 0x454, $mid) * 100, 2) & "%)")
	EndIf
	If $old5 <> _ReadDynamic($base, 0x840, $mid) Or $old6 <> _ReadDynamic($base, 0x838, $mid) Then
		GUICtrlSetData($expbar, Round(_ReadDynamic($base, 0x840, $mid) / LvLExp(_ReadDynamic($base, 0x838, $mid, "byte")) * 100, 2))
		GUICtrlSetData($exp, _ReadDynamic($base, 0x840, $mid) & " (" & Round(_ReadDynamic($base, 0x840, $mid) / LvLExp(_ReadDynamic($base, 0x838, $mid, "byte")) * 100, 2) & "%)")
	EndIf
	If $old7 <> GetPlayerX($mid) Or $old8 <> GetPlayerY($mid) Then
		GUICtrlSetData($pos, GetPos(GetPlayerX($mid), GetPlayerY($mid)))
	EndIf
	
	$old1 = _ReadDynamic($base, 0x458, $mid) ;------Current HP
	$old2 = _ReadDynamic($base, 0x450, $mid) ;------Max HP
	$old3 = _ReadDynamic($base, 0x44C, $mid) ;------Current MP
	$old4 = _ReadDynamic($base, 0x454, $mid) ;------Max MP
	$old5 = _ReadDynamic($base, 0x840, $mid) ;------Current EXP
	$old6 = _ReadDynamic($base, 0x838, $mid) ;------Current Lvl
	$old7 = GetPlayerX($mid)
	$old8 = GetPlayerY($mid)
	_MemoryClose($mid)
	$wHnd = GetClient(GUICtrlRead($charlist), 2)
	If BitAND(WinGetState($wHnd), 2) Then
		If GUICtrlRead($hide) <> "Hide"  Then
			GUICtrlSetData($hide, "Hide")
		EndIf
	Else
		If GUICtrlRead($hide) <> "Show"  Then
			GUICtrlSetData($hide, "Show")
		EndIf
	EndIf
	If $msg = $hide Then
		$wHnd = GetClient(GUICtrlRead($charlist), 2)
		If BitAND(WinGetState($wHnd), 2) Then
			WinSetState($wHnd, "", @SW_MINIMIZE)
			WinSetState($wHnd, "", @SW_HIDE)
		Else
			WinSetState($wHnd, "", @SW_SHOW)
			WinSetState($wHnd, "", @SW_MAXIMIZE)
		EndIf
	EndIf
	$clientold = $client[0][0]
	Sleep(1)
Until $msg = $exit

Func GetClient($char, $type = 1)
	$client = WinList("[CLASS:CLIENT]")
	For $i = 1 To $client[0][0]
		$pid = WinGetProcess($client[$i][1])
		$mid = _MemoryOpen($pid)
		If _MemoryRead(0xD13F08, $mid, "wchar[12]") = $char Then
			If $type = 1 Then
				Return $pid
			ElseIf $type = 2 Then
				Return $client[$i][1]
			EndIf
		EndIf
		_MemoryClose($mid)
	Next
EndFunc   ;==>GetClient

Func LvLExp($lvl)
	If $lvl = 1 Then
		Return 118
	ElseIf $lvl = 2 Then
		Return 470
	ElseIf $lvl = 3 Then
		Return 1058
	ElseIf $lvl = 4 Then
		Return 1880
	ElseIf $lvl = 5 Then
		Return 2938
	ElseIf $lvl = 6 Then
		Return 5640
	ElseIf $lvl = 7 Then
		Return 9048
	ElseIf $lvl = 8 Then
		Return 13160
	ElseIf $lvl = 9 Then
		Return 17978
	ElseIf $lvl = 10 Then
		Return 23500
	ElseIf $lvl = 11 Then
		Return 34898
	ElseIf $lvl = 12 Then
		Return 47940
	ElseIf $lvl = 13 Then
		Return 62628
	ElseIf $lvl = 14 Then
		Return 78960
	ElseIf $lvl = 15 Then
		Return 96938
	ElseIf $lvl = 16 Then
		Return 127840
	ElseIf $lvl = 17 Then
		Return 161798
	ElseIf $lvl = 18 Then
		Return 198810
	ElseIf $lvl = 19 Then
		Return 238878
	ElseIf $lvl = 20 Then
		Return 282000
	ElseIf $lvl = 21 Then
		Return 351231
	ElseIf $lvl = 22 Then
		Return 427755
	ElseIf $lvl = 23 Then
		Return 512196
	ElseIf $lvl = 24 Then
		Return 605232
	ElseIf $lvl = 25 Then
		Return 707587
	ElseIf $lvl = 26 Then
		Return 820046
	ElseIf $lvl = 27 Then
		Return 943453
	ElseIf $lvl = 28 Then
		Return 1078717
	ElseIf $lvl = 29 Then
		Return 1226815
	ElseIf $lvl = 30 Then
		Return 1388803
	ElseIf $lvl = 31 Then
		Return 1595229
	ElseIf $lvl = 32 Then
		Return 1818827
	ElseIf $lvl = 33 Then
		Return 2060796
	ElseIf $lvl = 34 Then
		Return 2322414
	ElseIf $lvl = 35 Then
		Return 2605043
	ElseIf $lvl = 36 Then
		Return 2910129
	ElseIf $lvl = 37 Then
		Return 3239210
	ElseIf $lvl = 38 Then
		Return 3593924
	ElseIf $lvl = 39 Then
		Return 3976012
	ElseIf $lvl = 40 Then
		Return 4387323
	ElseIf $lvl = 41 Then
		Return 4869381
	ElseIf $lvl = 42 Then
		Return 5382982
	ElseIf $lvl = 43 Then
		Return 5929882
	ElseIf $lvl = 44 Then
		Return 6511920
	ElseIf $lvl = 45 Then
		Return 7131034
	ElseIf $lvl = 46 Then
		Return 7789258
	ElseIf $lvl = 47 Then
		Return 8488730
	ElseIf $lvl = 48 Then
		Return 9231697
	ElseIf $lvl = 49 Then
		Return 10020519
	ElseIf $lvl = 50 Then
		Return 10857676
	ElseIf $lvl = 51 Then
		Return 11857343
	ElseIf $lvl = 52 Then
		Return 12913686
	ElseIf $lvl = 53 Then
		Return 14029449
	ElseIf $lvl = 54 Then
		Return 15207495
	ElseIf $lvl = 55 Then
		Return 16450818
	ElseIf $lvl = 56 Then
		Return 17762545
	ElseIf $lvl = 57 Then
		Return 19145941
	ElseIf $lvl = 58 Then
		Return 20604414
	ElseIf $lvl = 59 Then
		Return 22141527
	ElseIf $lvl = 60 Then
		Return 23760997
	ElseIf $lvl = 61 Then
		Return 25933410
	ElseIf $lvl = 62 Then
		Return 28214785
	ElseIf $lvl = 63 Then
		Return 30609702
	ElseIf $lvl = 64 Then
		Return 39747505
	ElseIf $lvl = 65 Then
		Return 51493509
	ElseIf $lvl = 66 Then
		Return 55474876
	ElseIf $lvl = 67 Then
		Return 59648780
	ElseIf $lvl = 68 Then
		Return 64023195
	ElseIf $lvl = 69 Then
		Return 68606389
	ElseIf $lvl = 70 Then
		Return 73406955
	ElseIf $lvl = 71 Then
		Return 79345238
	ElseIf $lvl = 72 Then
		Return 85573753
	ElseIf $lvl = 73 Then
		Return 92104572
	ElseIf $lvl = 74 Then
		Return 98950215
	ElseIf $lvl = 75 Then
		Return 106123703
	ElseIf $lvl = 76 Then
		Return 113638552
	ElseIf $lvl = 77 Then
		Return 121508783
	ElseIf $lvl = 78 Then
		Return 129748946
	ElseIf $lvl = 79 Then
		Return 138374168
	ElseIf $lvl = 80 Then
		Return 147400127
	ElseIf $lvl = 81 Then
		Return 158227752
	ElseIf $lvl = 82 Then
		Return 169572387
	ElseIf $lvl = 83 Then
		Return 181455292
	ElseIf $lvl = 84 Then
		Return 193898546
	ElseIf $lvl = 85 Then
		Return 206925087
	ElseIf $lvl = 86 Then
		Return 220558723
	ElseIf $lvl = 87 Then
		Return 234824141
	ElseIf $lvl = 88 Then
		Return 249746989
	ElseIf $lvl = 89 Then
		Return 265353867
	ElseIf $lvl = 90 Then
		Return 281672373
	ElseIf $lvl = 91 Then
		Return 305888332
	ElseIf $lvl = 92 Then
		Return 331303748
	ElseIf $lvl = 93 Then
		Return 357968787
	ElseIf $lvl = 94 Then
		Return 385935560
	ElseIf $lvl = 95 Then
		Return 415258156
	ElseIf $lvl = 96 Then
		Return 445992756
	ElseIf $lvl = 97 Then
		Return 478197705
	ElseIf $lvl = 98 Then
		Return 511933580
	ElseIf $lvl = 99 Then
		Return 547263228
	ElseIf $lvl = 100 Then
		Return 584251898
	EndIf
EndFunc   ;==>LvLExp

Func GetPlayerX($mid)
	$xRegionFloatAdd = _MemoryRead($base, $mid) + $xRegionOffset
	$xRegionFloat = _MemoryRead($xRegionFloatAdd, $mid, "float")
	$xDivider = _MemoryRead($posDividerAddress, $mid, "double")
	$xRegionFloat /= $xDivider
	$xPositionIntAdd = _MemoryRead($base, $mid) + $xPositionOffset
	$xPositionInt = _MemoryRead($xPositionIntAdd, $mid, "short")
	$xPositionInt = BitAND($xPositionInt, 0xFF)
	$xRegionBase = $xPositionInt + ($xPositionInt * 2) - 0x195
	$xRegionBase = BitShift($xRegionBase, -0x6)
	$xPosition = $xRegionBase - Int($xRegionFloat)
	Return $xPosition
EndFunc   ;==>GetPlayerX

Func GetPlayerY($mid)
	$yRegionFloatAdd = _MemoryRead($base, $mid) + $yRegionOffset1 + $yRegionOffset2
	$yRegionFloat = _MemoryRead($yRegionFloatAdd, $mid, "float")
	$yDivider = _MemoryRead($posDividerAddress, $mid, "double")
	$yRegionFloat /= $yDivider
	$yPositionIntAdd = _MemoryRead($base, $mid) + $yPositionOffset
	$yPositionInt = _MemoryRead($yPositionIntAdd, $mid, "short")
	$yPositionInt = BitShift($yPositionInt, 0x8)
	$yRegionBase = $yPositionInt + ($yPositionInt * 2) - 0x114
	$yRegionBase = BitShift($yRegionBase, -0x6)
	$yPosition = $yRegionBase - Int($yRegionFloat)
	Return $yPosition
EndFunc   ;==>GetPlayerY

Func GetPos($xpos, $ypos)
	If CheckConnect(GetClient(GUICtrlRead($charlist))) = 1 Then
		Return "(Diconnected)"
	ElseIf $xpos > -193 And $xpos < 385 And $ypos > -193 And $ypos < 574 Then
		If $ypos < 0 And $xpos < 0 Then
			Return "(" & $xpos & ", " & $ypos & ")" 
		ElseIf $ypos > 191 And $xpos < 0 Then
			Return "(" & $xpos & ", " & $ypos & ")" 
		Else
			Return "(Hotan)" 
		EndIf
	ElseIf $xpos > 3263 And $xpos < 3648 And $ypos > 1919 And $ypos < 2304 Then
		Return "(Donwhang)" 
	ElseIf $xpos > 6143 And $xpos < 6720 And $ypos > 959 And $ypos < 1344 Then
		Return "(Jangan)" 
	ElseIf $xpos > -5377 And $xpos < -4992 And $ypos > 2687 And $ypos < 3072 Then
		Return "(Samarkand)" 
	ElseIf $xpos > -11137 And $xpos < -10190 And $ypos > 2125 And $ypos < 3072 Then
		Return "(Constantinople)" 
	ElseIf $xpos > -25651 And $xpos < -25609 And $ypos > -42347 And $ypos < -42305 Then
		Return "(Cave Entrance)" 
	Else
		Return "(" & $xpos & ", " & $ypos & ")" 
	EndIf
EndFunc   ;==>GetPos

#Region Memory
Func _ReadDynamic($pointer, $offset, $mid, $type = "dword")
	$newadress = _MemoryRead($pointer, $mid) + $offset
	$result = _MemoryRead($newadress, $mid, $type)
	Return $result
EndFunc   ;==>_ReadDynamic

Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $if_InheritHandle = 1)
	Local $ah_Handle[2] = [DllOpen('kernel32.dll') ]
	Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $if_InheritHandle, 'int', $iv_Pid)
	$ah_Handle[1] = $av_OpenProcess[0]
	Return $ah_Handle
EndFunc   ;==>_MemoryOpen

Func _MemoryRead($iv_Address, $ah_Handle, $sv_Type = 'dword')
	Local $v_Buffer = DllStructCreate($sv_Type)
	DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
	Local $v_Value = DllStructGetData($v_Buffer, 1)
	Return $v_Value
EndFunc   ;==>_MemoryRead


Func _MemoryClose($ah_Handle)
	DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1])
	DllClose($ah_Handle[0])
	Return 1
EndFunc   ;==>_MemoryClose
#EndRegion

Func XpSyleToggle($onoff = 1)
	Local $xs_n
	If Not StringInStr(@OSTYPE, "WIN32_NT") Then Return 0
	If $onoff Then
		$xs_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
		DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
		Return 1
	ElseIf IsArray($xs_n) Then
		DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $xs_n[0])
		$xs_n = ""
		Return 1
	EndIf
	Return 0
EndFunc   ;==>XpSyleToggle

Func CheckConnect($pid)
	$mid = _MemoryOpen($pid)
	Return _MemoryRead(0xCCFB08, $mid)
	_MemoryClose($mid)
EndFunc
Edit: Dont thx me i deserve no credit, thx lolkop
how did u find exp and other offsets
12/27/2008 20:11 ADSŪ#25
here are most of the offsets including DC state (Picked From Multi-Eye)

Quote:
[Pointer]
xname=$D13F08
xgold=$F34264
xbase=$D1564C
xServer=$D13E08
xGuild=$D14DAC
Divider=$BF95C0
toggle_v=$D15654
dc_state=$CE4B30
xGld1=$36C
xGld1x2=$4
xGld2=$4
xGld3=$8
xGld4=$8
xGld5=$10
xGld6=$7BC
xGld7=$378
xHpx1=$450
xHPx2=$458
xMP1=$454
xMP2=$44C
xSP1=$850
xEXP=$840
XLvl=$838
xInt=$84E
xStr=$84C
xPos=$78
xReg=$7C
yPos=$78
yReg1=$7C
yReg2=$08


[Base]
GuildDispath=0
onwork=1
Also with the Script i Sended to you, you can get Dir of any process, so you don't need to ask the user where is the silkroad folder
12/27/2008 22:35 [Wicked]#26
yo lolkop are u using your autoupdater here again ? :D if ye it will be good ;)
12/27/2008 23:19 lolkop#27
not added yet got no time atm xmas and new year stress :D
12/29/2008 18:52 lolkop#28
sry for dubblepost added autodetection of static and base adresses
since the dynamic calculation values won't change with most updates they won't be read from the client (waste of time)

to do:
still not able to grap the dc adress from the client will be added soon
maybe i'll add it in the next days :)


btw thx for the function ads :)
12/29/2008 19:46 DarkTwilight#29
very very nice. little tiny suggestion.

* Pet hp^^
12/29/2008 20:06 lolkop#30
ok finally added the dc adress detection now it should work untill you need to download a new client for real big updates =)