ITEMINFO Structure (work in progress)

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

ITEMINFO Structure (work in progress)

Post by Amadeus » Fri May 09, 2003 8:17 am

Ok....so, 7 hours later and this is what I have come up with so far in regards to the ITEMINFO structure (I figured I'd try one that hadn't been posted yet). I am going to work on it more tomorrow and try to fill in as many of the gaps as I can; however, I tested it on quite a few of the items in my inventory and bank and it seems to check out so far with what I have labeled.

I'm mostly curious if I learned this correctly more than anything else ..hehe.

Oh..and the names of some of the fields I got from Lucy when I was double checking on raw data.

Code: Select all

#define ITEM_NAME_LEN         64
#define LORE_NAME_LEN         80

typedef struct _ITEMINFO { 
/*0x0*/    BYTE      Unknown0000; //placeholder 
/*0x1*/    BYTE      Weight; 
/*0x2*/    BYTE      NoRent; 
/*0x3*/    BYTE      NoDrop; 
/*0x4*/    BYTE      Size; 
/*0x5*/    BYTE      Type; 
/*0x6*/    BYTE      Unknown0006[10]; 
/*0x10*/   CHAR      IDFile[30]; 
/*0x2e*/   CHAR      LoreName[LORE_NAME_LEN]; 
/*0x7e*/   BYTE      Unknown0126[14]; 
/*0x8c*/   DWORD     Cost; 
/*0x90*/   CHAR      Name[ITEM_NAME_LEN]; 
/*0xd0*/   DWORD	  IconNumber;
/*0xd4*/   DWORD	  Unknown0212;
/*0xd8*/   DWORD	  Unknown0216;			
/*0xdc*/   DWORD	  Unknown0220;	// -1 ?			
/*0xe0*/   DWORD	  Unknown0224;	// -1 ?			 
/*0xe4*/   DWORD	  Unknown0228;				
/*0xe8*/   DWORD	  Unknown0232;				
/*0xec*/   DWORD     ItemID; //was called itemnumber but ItemID is a better decsription for this value... 
         union   { 
/*0xf0*/   COMMON    Common; 
/*0xf0*/   CONTAINER Container; 
/*0xf0*/   BOOK      Book; 
               }; 
} ITEMINFO, *PITEMINFO; 
EDIT 1: Modified structure as per eqmule's latest wisdom!
Last edited by Amadeus on Fri May 09, 2003 3:28 pm, edited 1 time in total.

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Fri May 09, 2003 8:53 am

good job considering that you just learned about this ;)

anyway I have it posted if you need to compare yours... http://macroquest2.com/phpBB2/viewtopic.php?t=2209

There is one thing you need to consider though when working with that structure:

Code: Select all

/*0238*/   DWORD      ItemNumber; // ItemID would be a better description but then I need to change code in eqlib.cpp and im not a dev... 
         union   { 
/*0242*/   COMMON    Common; 
/*0242*/   CONTAINER Container; 
/*0242*/   BOOK      Book; 
               }; 

the structure _ITEMINFO contains a Union...

a union means that at that point on, the structure can change into different parts, what I mean is, that if the .type is a bag for example, the CONTAINER structure will be used, if its a sword, the COMMON structure goes there. So if you are gonna complete your ITEMINFO structure you need to use a Union or else it will not work when you compile... I still havent had time to do the COMMON structure, but I will look some at it later I think...
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Fri May 09, 2003 2:37 pm

Thanks! That explains much.

Hmm...I'm wondering if different compilers/debuggers give different offsets? In your structure you list:

Code: Select all

/*0046*/   CHAR      LoreName[LORE_NAME_LEN]; 
/*0128*/   DWORD      Unknown0128[3]; 
However, using the LORE_NAME_LEN as 80 (perhaps this is incorrect), the next offset would have to be at 0126, right?

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Fri May 09, 2003 7:27 pm

Code: Select all

/*0046*/
/*0128*/
numbers shmumbers... offsets... schmoffsets

hehe well Im not good at documenting my structures, I miscount all the time, but the "layout" of what I do is usually correct, so yes in this case it should be 0126, you are totally right there.

different compilers dont "give" different offsets btw... I am the one that manually typed the "/*blabla*/" in most of the structures posted, but as i said, I suck at counting...
hmm after looking some more at it I think the

Code: Select all

#define LORE_NAME_LEN         82
should be 82...
and that would make my count add up, but let me doublecheck that...
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Sat May 10, 2003 5:48 am

thought I should mention that when I do structures I just 'do' them , and afterwards i count bytes... i.e DWORD=4 bytes FLOAT=4 bytes BYTE=1 WORD=2 bytes

thoose are easy, but the problem occures when counting for example _SPELLBUFF , then I need to know how many bytes that structure is(16) and multiply it by how many of them is in the structure, for example _SPELLBUFF Buff[15] would be 15*16 ...

allright just thought i should mention that... anyway that is the reason, my structures holds water, but the count does not... maybe I should stop putting thoose /*blabla*/ things in, I think im gonna do that after next patch... ;)
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.