local windowList = findWindowList("Drakensang Online"); local charname = "Your Char" if( #windowList == 0 ) then print("You need to run DS first!"); return 0; end function getWin() if( __WIN == nil ) then local chars = {} for i = 2,#windowList do local foundadresse = false; _GAMEBASE = getModuleAddress(findProcessByWindow(windowList[i]), "drakensangonline.exe") printf("Memory Base: 0x%x \n",_GAMEBASE) if _GAMEBASE ~= 0 then for loopadresse = 0xAA0000, 0xAAFFFF, 0x00001 do local base = memoryReadIntPtr(openProcess(findProcessByWindow(windowList[i])),_GAMEBASE + loopadresse, addresses.playerbase1) if base then --printf("PointerBase: 0x%x \n",base) addresses.playerbase = addresses.playerbase1 addresses.base = loopadresse addresses.coordsbase = addresses.coordsbase1 local playerbasen = memoryReadIntPtr(openProcess(findProcessByWindow(windowList[i])),_GAMEBASE + addresses.base, addresses.playerbase) if(playerbasen)then --printf("PlayerBase Base: 0x%x \n",playerbasen) local name = memoryReadRepeat("string",openProcess(findProcessByWindow(windowList[i])),playerbasen + addresses.playername) if(name == charname)then foundadresse = true; break; end end end if not base or foundadresse == false then local base = memoryReadIntPtr(openProcess(findProcessByWindow(windowList[i])),_GAMEBASE + loopadresse, addresses.playerbase2) if base then --printf("PointerBase: 0x%x \n",base) addresses.playerbase = addresses.playerbase2 addresses.base = loopadresse addresses.coordsbase = addresses.coordsbase2 local playerbasen = memoryReadIntPtr(openProcess(findProcessByWindow(windowList[i])),_GAMEBASE + addresses.base, addresses.playerbase) if(playerbasen)then --printf("PlayerBase Base: 0x%x \n",playerbasen) local name = memoryReadRepeat("string",openProcess(findProcessByWindow(windowList[i])),playerbasen + addresses.playername) if(name == charname)then foundadresse = true; break; end end end end end if(foundadresse)then local playerbase = memoryReadIntPtr(openProcess(findProcessByWindow(windowList[i])),_GAMEBASE + addresses.base, addresses.playerbase) if playerbase then local name = memoryReadRepeat("string",openProcess(findProcessByWindow(windowList[i])),playerbase + addresses.playername) printf("Memory Base: 0x%x \nCharacters name: %s\n",_GAMEBASE,name) table.insert(chars,{Name = name,window = windowList[i]}) end else print("Sry no luck"); end __WIN = windowList[i] end end keyboardBufferClear(); io.stdin:flush(); table.print(chars) print("Enter number for char>") local wind = tonumber(io.stdin:read()) __WIN = chars[wind].window end return __WIN; end function getProc() if( __PROC == nil or not windowValid(__WIN) ) then if( __PROC ) then closeProcess(__PROC) end; __PROC = openProcess( findProcessByWindow(getWin()) ); end return __PROC; end function getGameBase() if __GAMEBASE == nil or __GAMEBASE == 0 then __GAMEBASE = getModuleAddress(findProcessByWindow(getWin()), "drakensangonline.exe"); end return __GAMEBASE end function memoryReadRepeat(_type, proc, address, offset) local readfunc; local ptr = false; local val; if( type(proc) ~= "userdata" ) then error("Invalid proc", 2); end if( type(address) ~= "number" ) then error("Invalid address", 2); end if( _type == "int" ) then readfunc = memoryReadInt; elseif( _type == "uint" ) then readfunc = memoryReadUInt; elseif( _type == "float" ) then readfunc = memoryReadFloat; elseif( _type == "byte" ) then readfunc = memoryReadByte; elseif( _type == "string" ) then readfunc = memoryReadString; elseif( _type == "ustring" ) then readfunc = memoryReadUString; elseif( _type == "intptr" ) then readfunc = memoryReadIntPtr; ptr = true; elseif( _type == "uintptr" ) then readfunc = memoryReadUIntPtr; ptr = true; elseif( _type == "byteptr" ) then readfunc = memoryReadBytePtr; ptr = true; elseif( _type == "floatptr" ) then readfunc = memoryReadFloatPtr; ptr = true; else return nil; end for i = 1, 10 do showWarnings(false); if( ptr ) then val = readfunc(proc, address, offset); else val = readfunc(proc, address); end showWarnings(false); if( val ) then i = 11; end; -- Get out of loop end if( val == nil ) then local info = debug.getinfo(2); local name; if( info.name ) then name = info.name .. '()'; else name = ''; end -- logger:log('debug', "Error reading memory in %s from %s:%d", name, info.short_src, info.currentline or 0); -- no logger available at the time of using that local msg = sprintf("Error reading memory in %s from %s:%d", name, info.short_src, info.currentline or 0); -- error(msg, 2) end return val end