In-memory inventory

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
VoidMain
Posts: 187
Joined: Wed Apr 21, 2010 12:21 pm

In-memory inventory

#1 Post by VoidMain » Thu Jul 08, 2010 7:47 am

Well i managed to get a hold to the inventory table in memory, working on an update function, the only problem i see with it is that is no sorted by slot order it is like is said here: http://www.theromwiki.com/API:GetBagItemLink. So, i was wondering if its not faster anyway to use it for the inventory:update function, this will be alot faster than the method used right now, and we can still be using the existing functions for individual slots because those are not "that" slow...

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: In-memory inventory

#2 Post by rock5 » Thu Jul 08, 2010 7:56 am

VoidMain wrote:Well i managed to get a hold to the inventory table in memory, working on an update function, the only problem i see with it is that is no sorted by slot order it is like is said here: http://www.theromwiki.com/API:GetBagItemLink. So, i was wondering if its not faster anyway to use it for the inventory:update function, this will be alot faster than the method used right now, and we can still be using the existing functions for individual slots because those are not "that" slow...
The more we move to memory addresses the better, I say.

Who know, maybe one day we'll be able to get rid of the ingame macro altogether. :)
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: In-memory inventory

#3 Post by Administrator » Thu Jul 08, 2010 8:04 am

VoidMain, nice work yet again. I'm curious, though, what method are you using to find these addresses? I tend to have a lot of trouble finding these arrays for some reason.

VoidMain
Posts: 187
Joined: Wed Apr 21, 2010 12:21 pm

Re: In-memory inventory

#4 Post by VoidMain » Thu Jul 08, 2010 9:09 am

Administrator wrote:VoidMain, nice work yet again. I'm curious, though, what method are you using to find these addresses? I tend to have a lot of trouble finding these arrays for some reason.
Thanks ^^
I'll say "brute force" started with a number of some item stacked in mi inv, searched for that, filtered several times for "unchanged value" to get only a few results and then exchanged that stack with another with different number and saw the address changing then browsed that memory region to get the start of the list, that wasn't that difficult, but i had problems because i was in the believe that the list should be ordererd by slot number, took me a while to discover it wasn't and then readed in the wiki that an ingame function gets those unordered too, well then is not "my" problem i said, is the game that stores it that way, i'm sure there is a table of pointers ordered but i'm unable to find it yet... In the inventory table we have very little info tho, only item id and ammount, but the good news is that the database of items is in a fixed address, so we can search for names and so in there, another interesting discovery i made is the table of buffs and debuffs but i think i'll need help breaking that up, because is not only unordered too it is also very strange... Skills database is another finding, that is a good one because we can read wich skills are really available and we can get rid of skill names translation, the names of skills in user locale are there, as soon as i have more "serious" info i'll be posting it...

VoidMain
Posts: 187
Joined: Wed Apr 21, 2010 12:21 pm

Re: In-memory inventory

#5 Post by VoidMain » Thu Jul 08, 2010 9:53 am

O, BTW, the address to inv start is 9B8948 it seems to be 56 bytes long each slot, not ordered but i can't find more than item id and ammount there, we need to get a pointer to objects table so we can get names or maybe we dont need those...?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: In-memory inventory

#6 Post by rock5 » Thu Jul 08, 2010 11:15 am

VoidMain wrote:O, BTW, the address to inv start is 9B8948 it seems to be 56 bytes long each slot, not ordered but i can't find more than item id and ammount there, we need to get a pointer to objects table so we can get names or maybe we dont need those...?
I think we need more than names. Actually I think you would need to reproduce most if not all the item classes values eg. BagId, Name, Color, ItemLink. Some functions require that extra info.

I also found it easy to find the list of quest ids you currently have but it's just a list of ids. All we could use that for is to see if we have a quest, not if it is complete. I could find where the info about the quests were, ie. goals, number for each goal etc. but I couldn't find the pointer for it. Then, to know if the goals were complete I'd have to look up the goal items in the items table to see if I had enough. Too many step. Way out of my league.

Actually, when looking at the items table it looked huge. I also have an addon called ItemPreview that groups all items, quests, skills etc in 1 big list. Maybe that's how they are stored in memory. If we could find a way of looking up items in that list, it would help not only your inventory changes but my quests changes too, as well as other changes in the future I suspect.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

VoidMain
Posts: 187
Joined: Wed Apr 21, 2010 12:21 pm

Re: In-memory inventory

#7 Post by VoidMain » Fri Jul 09, 2010 3:02 pm

Rock, can you confirm if you objects db starts at 0x7C20000 for objects between 200000 and 201435 (seems to be "storable" obejcts) i found other addresses too but i want to confirm if this one is static, doesnt appear green on CE but i restarted game and PC several times and the addres didnt change...
And on the other hand one possible explanation for the lack of a pointer to it would be that it is static...

Thanks in advance ^^

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: In-memory inventory

#8 Post by rock5 » Fri Jul 09, 2010 10:13 pm

VoidMain wrote:Rock, can you confirm if you objects db starts at 0x7C20000 for objects between 200000 and 201435 (seems to be "storable" obejcts) i found other addresses too but i want to confirm if this one is static, doesnt appear green on CE but i restarted game and PC several times and the addres didnt change...
And on the other hand one possible explanation for the lack of a pointer to it would be that it is static...

Thanks in advance ^^
Nothing in that memory region for me except '??'s.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

RoMain
Posts: 10
Joined: Wed Apr 21, 2010 8:49 pm

Re: In-memory inventory

#9 Post by RoMain » Sat Jul 10, 2010 4:08 am

Maybe you should have a look at this http://code.google.com/p/rombot/source/ ... c/include/
the pointers are from the last patch but the structure is documentet very well

VoidMain
Posts: 187
Joined: Wed Apr 21, 2010 12:21 pm

Re: In-memory inventory

#10 Post by VoidMain » Sat Jul 10, 2010 7:51 pm

RoMain wrote:Maybe you should have a look at this http://code.google.com/p/rombot/source/ ... c/include/
the pointers are from the last patch but the structure is documentet very well
Thanks :) I already have the structures figured, also for buffs and skills, the problem is not that, the problem is i dont know a way to get the info from items, neither that bot, we need a pointer to different dbs (there are actually 27) but i can't find a pointer, probably because i'm looking at the wrong places, i can find where tables for different dbs start but i can't find any pointer to it... for the time being, i'm using the info i have (inventory) to get the count of items by id, mainly to harvest chickens and cows, to knwo if i have enough grass or already filled all the cubes or if i have enough eggs to finnish the quest, with this method i managed to get the bot running for 30+ hours, 4 instances of the game and no hangs on any of the clients...
Until we get DBs pointers i'm afraid the info is not that usefull...
Another interesting findig i made accidentaly is movement flag, if we set bits in an adress we can send movement orders without keyboard, i like that ;)

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: In-memory inventory

#11 Post by rock5 » Sat Jul 10, 2010 10:28 pm

VoidMain wrote:Another interesting findig i made accidentaly is movement flag, if we set bits in an adress we can send movement orders without keyboard, i like that ;)
Oooo... I think Administrator would be interested in that. I'd say the most sent commands to the macro would be movement commands. With those I'd say nearly all of the basic functions are done by memory addresses. All that's really left is attack ie. 'UseSkill(1,1)'. If we could figure that one out we could probably run a basic bot without the macro. You'd only need to add it if you plan to execute some RoMScript commands.

No wait, we'd still need RoMScript to execute skills.

Anyway we are making good progress. :)
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

RoMain
Posts: 10
Joined: Wed Apr 21, 2010 8:49 pm

Re: In-memory inventory

#12 Post by RoMain » Sun Jul 11, 2010 5:08 am

I found that along time ago^^

the link i posted says its base_pointer + 0xA3C but it has changed to base_pointer + 0xA6C

http://code.google.com/p/rombot/source/ ... e/object.h there you can find info about moving states.

VoidMain
Posts: 187
Joined: Wed Apr 21, 2010 12:21 pm

Re: In-memory inventory

#13 Post by VoidMain » Sun Jul 11, 2010 11:45 pm

Hell yeah! finally got that damn pointer to DBs!!!
Most of data structures figured out, probably i'll get something to start to scratch very soon, for now on i can get info from inventory without problems, can get name, ammount, value, amx stackable amount, working on quality right now...

EDIT: So exited that i forgot to post the pointer:P
Static address is: 9CC224, offset 0x28 an that points to a pointer, no offset on second.
There you can found the table of tables and works this way:
Each address points to a pointer, the address pointed by that pointer holds the address to the start of the table in the offset 0x124.
The table starts 32 bytes before (the address you get is the head) and each item is 32 bytes long, tables are ordered ascending from bottom to top, so basically you have to traverse it backwards, ok the juicy part, the info of the items:
In the table wo will find, as i sayd, 32 bytes structures, the first 12 bytes are self references to next, previous and a pointer that i have no clue what holds, at offset 12 you have the id and at 16 the address with info about that item.
In that address you will find almost nothing but at offset 8 you have a pointer to the adress with instance info (no clue yet on how to get info about objects not instantiated, no idea if that would be needed, i'll say no for inventory at least).
And there, at offset 12 you have name, at 16 plural name, at 28 maximum stack amount, at 32 the note string, 36 type string (subtitle on tooltip i believe) at 88 required lvl and thats about what i found so far...
Not easy if you look at how are those things organized, yeah, its easier now that i know how it goes but wasn't an easy job figuring that out ;)

For now i have a working function to update inv with that data and it takes alot less than updating via script, oh and you can do it 300K times in a row without hanging the client (tryed that)

Any help will be much apreciated, thanks ^^

VoidMain
Posts: 187
Joined: Wed Apr 21, 2010 12:21 pm

Re: In-memory inventory

#14 Post by VoidMain » Mon Jul 12, 2010 3:48 pm

Ok, here goes some quick and dirty test to make, here takes 1.5s to index the tables (only doing that once of course) and then 16ms to update inventory, of course we need more data than the scarse info i'm getting but i hope you will see the point...

Still working on a better way to index tables, tables are not lineal those bitches are fragmentated into blocks (yes the tables are huge) i managed to connect all blocks but i'm using some "brute force" to get pointers to the next part when is not in the last item (in most cases it is) well i'll let the code speak for itself, i see alot of potential here...

P.S.: Some strings and some function names in spanish, old habit of writing in english will be, i hope, good for you to read because most of it is in english...

Code: Select all

include("addresses.lua");
include("functions.lua");

local inventarioBase = 0x9B8948;
local tablasBase = 0x9CC224;
local tablasBaseOffset = 0x28;
local idOffset = 0;
local cantidadOffset = 0x10;
local itemInfoOffset = 0x10;
local skillsBase = 0x9C58E0;
local punteroTabla;
local punteroTablaFinal;
local proc = getProc();
local tablas = {};

CTRange = class(
	function(self, _start, _end, startAddress)
		self.Start = _start;
		self.End = _end;
		self.StartAddress = startAddress;
	end
);


CTDef = class(
	function (self, ptr)
		self.Address = ptr;
		self.EnAddress = 0;
		self.StartId = 0;
		self.EndId = 0;
		self.Name = "<UNKNOWN>";
		self.Ranges = {};
		
		if( self.Address ~= nil and self.Address ~= 0 ) then self:Update(); end;
	end
);

function CTDef:Update()
	self.StartId = memoryReadInt(proc, self.Address + 0xC );
	-- self.Name = memoryReadString(proc, self.Address + 36);
	local lastId = self.StartId;
	local currId;
	local lastStartId = self.StartId;
	local lastStartDir = self.Address;
	local currItemDir = self.Address;
	local lastItemDir = self.Address;
	local tryNumber = 1;

	-- printf("Tabla comienza con id: %d\t\t Dir: %X\n", self.StartId, self.Address);

	while ( lastId ~= nil and lastId ~= 0 ) do
		currItemDir = currItemDir - 32; -- Descontamos 32 bytes para pasar al siguiente.
		currId = debugAssert(memoryReadInt(proc, currItemDir + 0xC ), "[GetInfoItem] No se pudo leer el id"); -- 12 bytes offset del id de objeto
		self.EndId = currId;
		if ( currId == nil or currId == 0 or ( ( currId > (lastId + 2) ) or ( currId < (lastId - 2) ) ) ) then
			-- Primero que nada agregamos el rango encontrado, si hace falta...
			local found = false;
			for _, _table in ipairs(tablas) do
				if ( lastStartId >= _table.StartId and lastId <= _table.EndId ) then
					found = true;
					break;
				end;
			end;
			for _, _range in ipairs(self.Ranges) do
				if ( lastStartId >= _range.Start and lastId <= _range.End ) then
					found = true;
					break;
				end;
			end;
			
			if ( found == false ) then
				table.insert(self.Ranges, CTRange(lastStartId, lastId, lastStartDir));
				cprintf( cli.yellow, "Agregando rango. Inicio: %d\tFin: %d\tDir: %X\tTabla: %d\n", lastStartId, lastId, lastStartDir, #tablas );
			end;
			self.EndId = lastId;

			currItemDir = GetNextTableAddress( lastItemDir, tryNumber );

			if ( currItemDir ~= nil ) then
				currId = debugAssert(memoryReadInt(proc, currItemDir + 0xC ), "No se pudo leer el id en la tabla continuada"); -- 12 bytes offset del id de objeto
				if ( currId == nil or currId == 0 or ( ( currId > (lastId + 2) ) or ( currId < (lastId - 2) ) ) ) then
					-- currItemDir = lastItemDir;
					break;
				else
					tryNumber = 1;
					self.EndId = currId;
					lastStartId = currId;
					lastStartDir = currItemDir;
				end;
			else
				break;
			end;
		end;

		lastId = currId;
		lastItemDir = currItemDir;
	end;
end;

CItem = class(
	function (self, ptr)
		self.Address = ptr;
		self.Id = 0;
		self.Name = "<UNKNOWN>";
		
		if( self.Address ~= nil and self.Address ~= 0 ) then self:Update(); end;
	end
);

function CItem:Update()
	local _oldAddress = self.Address;
	self.Address = memoryReadIntPtr(proc, self.Address + 0x10, 0x8);
	self.Id = debugAssert(memoryReadInt(proc, self.Address ), "No se pudo leer el id");
	
	-- Caso especial para las cartas
	if ( self.Id >= 770000 and self.Id <= 771000 ) then
		self.Name = "<CARD>";
	else
		local nameAddress = debugAssert(memoryReadInt(proc, self.Address + 0xC), "No se pudo leer puntero de nombre"); -- 12 bytes offset del nombre
		if( nameAddress == nil or nameAddress == 0 ) then
			tmp = nil;
		else
			tmp = debugAssert(memoryReadString(proc, nameAddress), "No se pudo leer el nombre");
		end;

		if tmp ~= nil then
			self.Name = tmp;
		else
			self.Name = "<UNKNOWN>";
		end;
	end;	
end;

function ObtenerPunterosTablas()
	local dirPunteroTabla = memoryReadIntPtr(proc, tablasBase, tablasBaseOffset);
	punteroTabla = dirPunteroTabla;
	punteroTablaFinal = memoryReadInt(proc, dirPunteroTabla + 0x4);
	cprintf(cli.yellow, "Dir tablas: %x \t Final: %x\n\n\n", punteroTabla, punteroTablaFinal);
end;

function GetNextTableAddress( ptr, try )
	local _address;
	
	_address = memoryReadInt( proc, ptr + 0x4 );
	
	if _address == nil or ( memoryReadInt( proc, _address + 0x4 ) ~= ptr and memoryReadInt( proc, _address ) ~= ptr ) then
		_address = memoryReadInt( proc, ptr + 0x8 );
		if _address == nil or ( memoryReadInt( proc, _address + 0x4 ) ~= ptr and memoryReadInt( proc, _address ) ~= ptr ) then
			local lastId = memoryReadInt( proc,  ptr + 0xC ); -- 12 bytes offset del id
			local found = false;
			for i = 1, 10 do -- 10 lineas deberían ser suficientes...
				_address = memoryReadInt( proc, ( ptr + ( i * 32 ) ) + 0x4 ); -- Retrocedemos de a una línea para ver si encontramos la dir que buscamos
				tmpID = memoryReadInt( proc,  _address + 0xC ); -- 12 bytes offset del id
				-- printf("Leimos: %d\n", tmpID);
				if ( tmpID == lastId + 1 and _address ~= ptr ) then
					-- Lo encontramos, podemos salir del bucle y devolver la dir.
					found = true;
					print("Encontrado por fuerza bruta\n");
					break;
				end;
			end;
			if not found then
				_address = nil;
			end;
		end;
	end;
	
	-- cprintf( cli.red, "Recibido: %X\tDevolviendo: %X\n" ,ptr, _address or 0 );
	return _address;
end;

-- Guardar las tablas
function GuardarTablas()
	local punteroTablaReal = memoryReadInt(proc, punteroTabla);
	local punteroTablaDatos;
	
	local i = 0;
	while ( i < 28 ) do
		local nombre = memoryReadString(proc, punteroTablaReal + 38);
		-- printf("Nombre: %s\n", nombre);
		local punteroDatosTemporal = memoryReadIntPtr(proc, punteroTablaReal, 0x124);
		if punteroDatosTemporal ~= nil then
			local punteroDatos = memoryReadInt(proc, punteroDatosTemporal + 0x28);
			-- Descontamos los 32 bytes de la línea del nombre
			punteroDatos = punteroDatos - 32;
			local primerId = memoryReadInt(proc, punteroDatos + 0xC ); -- 12 bytes offset del id de objeto
			local tabla = CTDef(punteroDatos);
			tabla.Name = nombre;
			table.insert( tablas, tabla);
		end;
		i = i + 1;
		punteroTablaReal = memoryReadInt(proc, punteroTabla + ( i * 4 ) );
	end;
end;

function RecorrerInventario()
	local intemOffset = 0;
	local id, cantidad;
	local itemDir = inventarioBase;
	local itemInfo;
	-- local timeStart = getTime();
	
	for i = 0, 60 do 
		itemDir = inventarioBase + (68 * i); -- 68 bytes tamaño de estructura por item en el inventario
		id = memoryReadInt(proc, itemDir + idOffset );
		if id ~= nil and id ~= 0 then
			cantidad = memoryReadInt(proc, itemDir + cantidadOffset );
			itemInfo = GetInfoItem(id);
			if itemInfo then
				 printf( "ID: %d\tNombre: %s\t\t\tCantidad: %d\n", id, itemInfo.Name , cantidad );
			end;
		end;
	end;
	-- printf( "Tardamos en recorrer el inventario: %d\n", deltaTime( getTime(), timeStart ) );	
end;

function GetInfoItem( id )
	local _address = GetItemAddress( id );
	
	if _address ~= nil and _address ~= 0 then
		return CItem( _address );
	end;
	printf( "Devolviendo nulo para ID: %d\n", id );
	return nil;
end;

function GetTableForID( id )

	for _, _table in ipairs( tablas ) do
		if ( id >= _table.StartId and id <= _table.EndId ) then
			return _table;
		end;
	end;
	
	printf( "Tabla no encontrada para ID: %d\n", id );
	return nil;
end;

function GetItemAddress( id )
	local _table = GetTableForID( id );
	local _address;
	if _table ~= nil then
		for _, _range in ipairs( _table.Ranges ) do
			if ( id >= _range.Start and id <= _range.End ) then
				-- _address = _rango.StartAddress;
				tmp = id - _range.Start;
				-- Restamos 32 bytes por el número de items de diferencia que hay entre el primer id del rango y el id que nos pasaron
				_address = _range.StartAddress - ( tmp * 32 );
				-- Comprobamos que sea esta, hay items cruzados, no tengo muy claro porqué pero es asi...
				local tmpAddress = memoryReadIntPtr(proc, _address + 0x10, 0x8);
				if ( id ~= memoryReadInt( proc, tmpAddress ) ) then
					-- Lo buscamos uno después...
					_address = _range.StartAddress - ( ( tmp - 1 ) * 32 );
					tmpAddress = memoryReadIntPtr(proc, _address + 0x10, 0x8);
					if ( id ~= memoryReadInt( proc, tmpAddress ) ) then
						-- Lo buscamos uno antes...
						_address = _range.StartAddress - ( ( tmp + 1 ) * 32 );
						tmpAddress = memoryReadIntPtr(proc, _address + 0x10, 0x8);
						if ( id ~= memoryReadInt( proc, tmpAddress ) ) then
							-- No pudimos encontrarlo, nos damos por vencidos...
							_address = nil;
						end;
					end;
				end;
			end;
		end;
	end;
	return _address;
end;

function EnumerarSkills()
	local currSkillId = memoryReadInt( proc, skillsBase );
	local i = 0;
	local skillInfo;
	
	while currSkillId ~= -1 do
		if ( currSkillId ~= 0 ) then
			skillInfo = GetInfoItem( currSkillId );
			if skillInfo ~= nil then
				printf("ID: %d\tDir: %X\tNombre: %s\n", skillInfo.Id, skillInfo.Address, skillInfo.Name);
			else
				printf("Error al obtener el skill con ID: %d\n", currSkillId);
			end;
		end;
		i = i + 1;
		currSkillId = memoryReadInt( proc, skillsBase + ( i * 4 ) );
	end;	
end;

-- 491587 Esencia de Magia
function main()
	local timeStart = getTime();
	ObtenerPunterosTablas();
	-- printf("Una: %X\n", memoryReadIntPtr(proc, 0x1854920, 0x124));
	GuardarTablas();
	printf( "Tardamos en enumerar las tablas: %d\n", deltaTime( getTime(), timeStart ) );
	timeStart = getTime();
	RecorrerInventario();
	printf( "Tardamos en enumerar el inventario: %d\n", deltaTime( getTime(), timeStart ) );
	timeStart = getTime();
	EnumerarSkills();
	printf( "Tardamos en enumerar los skills: %d\n", deltaTime( getTime(), timeStart ) );
end;

startMacro(main, true);

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: In-memory inventory

#15 Post by rock5 » Mon Jul 12, 2010 11:28 pm

VoidMain wrote:a pointer that i have no clue what holds
Maybe it hold the tooltip info? That has to be kept somewhere and you'll need that info.

Btw, great work!
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

VoidMain
Posts: 187
Joined: Wed Apr 21, 2010 12:21 pm

Re: In-memory inventory

#16 Post by VoidMain » Tue Jul 13, 2010 1:07 pm

rock5 wrote:
VoidMain wrote:a pointer that i have no clue what holds
Maybe it hold the tooltip info? That has to be kept somewhere and you'll need that info.

Btw, great work!
Nono, Tooltip info is dinamically generated each time, i debugged that...
Now i know what that pointer is, is self reference to the head of the table definition, not data, definition.
Why do wee need Tooltip info if we can get all that info from memory?
We (my brother and I), found more interesting things about inventory, We found dura, stats and runes, tier, plus, and quality, what else do we need?
The only thing that i'm missing at this time is the name of cards, those doesn't even exist... Cards names are NPC names with just the prefix "Card - ", we need to find what points to the NPC represented, maybe an id, maybe a pointer...

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: In-memory inventory

#17 Post by rock5 » Tue Jul 13, 2010 2:19 pm

VoidMain wrote:We (my brother and I), found more interesting things about inventory, We found dura, stats and runes, tier, plus, and quality, what else do we need?
Take a look at the item class. Probably a couple of things we don't need but we probably do need BagId and ItemCount. It's not currently available but some people have requested the 'worth' of items too. That would be nice if you can find it.
VoidMain wrote:The only thing that i'm missing at this time is the name of cards, those doesn't even exist... Cards names are NPC names with just the prefix "Card - ", we need to find what points to the NPC represented, maybe an id, maybe a pointer...
Cards are items, they have their own ids. Can't you use those? They also have a description and bonus stats.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

VoidMain
Posts: 187
Joined: Wed Apr 21, 2010 12:21 pm

Re: In-memory inventory

#18 Post by VoidMain » Tue Jul 13, 2010 3:05 pm

rock5 wrote:
VoidMain wrote:We (my brother and I), found more interesting things about inventory, We found dura, stats and runes, tier, plus, and quality, what else do we need?
Take a look at the item class. Probably a couple of things we don't need but we probably do need BagId and ItemCount. It's not currently available but some people have requested the 'worth' of items too. That would be nice if you can find it.
I have worth :)
BagID? What do we need that for? I dont know really, we can use items by name... Or you mean for ingame selling? That is done with the IGF addon i beilieve so is not really needed for inventory functions...
rock5 wrote:
VoidMain wrote:The only thing that i'm missing at this time is the name of cards, those doesn't even exist... Cards names are NPC names with just the prefix "Card - ", we need to find what points to the NPC represented, maybe an id, maybe a pointer...
Cards are items, they have their own ids. Can't you use those? They also have a description and bonus stats.
The card does have an id, but the info struct is not filled with name or description pointers because those are from the NPC that the card represents.
Nvm that, i found the NPC id on the card so now i know how to get the name... I still need to find bonus stat, but thats just to know, not really usefull for the bot itself...
Found equipment address to, nice to have because we can check dura to know if we need to repair ;)

Gonna have a look at item struct again to see what i'm missing...

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: In-memory inventory

#19 Post by rock5 » Tue Jul 13, 2010 5:05 pm

VoidMain wrote:I have worth :)
BagID? What do we need that for? I dont know really, we can use items by name... Or you mean for ingame selling? That is done with the IGF addon i beilieve so is not really needed for inventory functions...
If anyone wants to use any in-game functions that require bagid then they will need the bag id. For example GetBagItemLink, and PickupBagItem etc.
VoidMain wrote:The card does have an id, but the info struct is not filled with name or description pointers because those are from the NPC that the card represents.
Nvm that, i found the NPC id on the card so now i know how to get the name... I still need to find bonus stat, but thats just to know, not really usefull for the bot itself...
You're right, don't need stats. You probably still need the color of the card though (for autosell filter).

In the end what we need is an inventory:update() that replaces the current function but uses memory addresses and is a lot faster. It needs to provide all the same information or nearly so. Any extra useful information you add is bonus but what you need to concentrate on is matching the information the item class currently provides.

Keep up the good work.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

VoidMain
Posts: 187
Joined: Wed Apr 21, 2010 12:21 pm

Re: In-memory inventory

#20 Post by VoidMain » Tue Jul 13, 2010 9:04 pm

rock5 wrote:
VoidMain wrote:I have worth :)
BagID? What do we need that for? I dont know really, we can use items by name... Or you mean for ingame selling? That is done with the IGF addon i beilieve so is not really needed for inventory functions...
If anyone wants to use any in-game functions that require bagid then they will need the bag id. For example GetBagItemLink, and PickupBagItem etc.
I stil don't realize why we need that for our inventory update, i meaan: We need to know wich objects we have, and i have all that info, item id, type, quality (with queality we don't need to get the color), stats, worth, even the flag of "in use" so we don't try to use a potion on CD...
The functions that use BagID are mostly client functions, if anyone wants to use those functios can still use GetBagItemInfo to get the bag id and problema solved, to use a potion via script we can call UseItemByName, remember that we are getting those names from the current client locale so we dont need to worry about correct locale names...
rock5 wrote:
VoidMain wrote:The card does have an id, but the info struct is not filled with name or description pointers because those are from the NPC that the card represents.
Nvm that, i found the NPC id on the card so now i know how to get the name... I still need to find bonus stat, but thats just to know, not really usefull for the bot itself...
You're right, don't need stats. You probably still need the color of the card though (for autosell filter).
Again, the autosell is handled by IGF, and we dont have any problems getting that info in game...

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 49 guests