Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2009, 04:32 PM
Windcatcher
Demi-God
 
Join Date: Jan 2002
Posts: 1,175
Default Code for serializing items?

I've been working on getting SimpleClient to understand the new netcode in EQEmu 0.6.1 and newer, but I've run into a snag. I can get through character creation and selection on the world server, but to take the next step I need to get SimpleClient able to understand how items are serialized as they are passed from the zone server. I looked in the 0.6.1 code and did a quick search in the 0.7.0 code and I couldn't see anything that tells me how items are serialized.

I'm not going to be able to proceed without this, not to mention that if I want to be able to port my existing database up to 0.6.1 and newer it means that I'll have to add item serialization capability to the admin tool. Can anyone point me to some code that shows how items get serialized in newer EQEmu versions?

Thanks,

Wind
Reply With Quote
  #2  
Old 01-11-2009, 04:41 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Look at common/patches/Client62.cpp and common/patches/Titanium.cpp at function char *SerializeItem(const ItemInst *inst, sint16 slot_id, uint32 *length, uint8 depth).

There is an article in the Wiki that describes serialization as well.

Edit: Wiki article: http://www.eqemulator.net/wiki/wikka...=ItemStructure

Last edited by Derision; 01-12-2009 at 12:43 AM..
Reply With Quote
  #3  
Old 01-11-2009, 05:27 PM
Windcatcher
Demi-God
 
Join Date: Jan 2002
Posts: 1,175
Default

Thanks a lot. I'm a bit concerned about the Wiki as it doesn't mention what EQEmu version it refers to (I could presume that it's the current version, but when it comes to Wikis in general you never know). From what I've seen when building SimpleClient, Item serialization has tended to change for every EQEmu version as it has kept up with live. I think this will help a lot, though.

WC
Reply With Quote
  #4  
Old 01-11-2009, 10:29 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Thanks for the wiki page link, Derision. I hadn't seen that one before lol. It is really useful for my work on SoF. Now that I understand the breakdown of how the serialization works a little better, I think I know what I need to do to get it working right for SoF. I am still not clear on the item instance/merchant slot stuff, but hopefully I can get it working without knowing what that is exactly.

Windcatcher, it is just a guess, but from looking at the edit dates on that Wiki page, I am pretty sure that the page was written for the Titanium client. It seems to line up with the Titanium client serialization accept for 1 part I can't figure out.

Here is the instancing info and the beginning of the item info from the example on that wiki page:

Code:
1|0|4|0|0|12688|0|-1|0|"0|Signet of the Arcane|Raw power flows into your body|IT63|16257|15|255|0|0|18|1|548|
And here is what titanium.cpp shows for the item instance section:

Code:
	MakeAnyLenString(&instance,
		"%i|%i|%i|%i|%i|%i|%i|%i|%i|%i|%i|",
		stackable ? charges : 0,
		0,
		(merchant_slot==0) ? slot_id : merchant_slot,
		inst->GetPrice(),
		(merchant_slot==0) ? 1 : inst->GetMerchantCount(),
		0,
		merchant_slot,	//instance ID, bullshit for now
		inst->IsInstNoDrop() ? 1 : 0,		//not sure where this field is
		(stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? 1 : 0) : charges),
		0,
		0
	);
Judging by what titanium.cpp shows, it seems like there should be more fields in the instancing section from the example on the wiki page. I see there are 11 fields used for item instancing in titanium.cpp, but there are only 9 fields used in the wiki page example as far as I can tell.

I think this is the item instance part from the wiki example:
Code:
1|0|4|0|0|12688|0|-1|0|
But, there is an extra 0 in the field after that as seen here:
Code:
1|0|4|0|0|12688|0|-1|0|"0|
Though, that last 0 has a quote before it, which if I understand correctly, means that it is part of the actual item fields from the Titanium_itemfields.h. When looking at the actual itemfields for titanium, it looks like they start with the item name, so maybe that first 0 inside the quotes is actually the last 0 from the item instancing section. That is my guess anyway. So, that brings the wiki page example up to 10 fields for item instancing, but it is still 1 short from what titanium.cpp shows.

Here is what I think the Titanium.cpp serialization breaks down to:
Code:
1|0|MerchSlot|Price|MerchCount|0|InstanceID|instnodrop|charges|0|0|
I don't see anything that looks like an actual price in the wiki page example, so maybe this field:
Code:
inst->GetPrice(),
in the titanium.cpp isn't actually being used. I think either one of the fields isn't being used, or maybe it just isn't used in this particular example and would add in an extra field if it is used. But, I don't think the serialization has variable field numbers, which means that one of the 11 probably isn't used. It would have to be one of these:

Code:
		(merchant_slot==0) ? slot_id : merchant_slot,
		inst->GetPrice(),
		(merchant_slot==0) ? 1 : inst->GetMerchantCount(),
Because, all of the other fields line up with the example.

Once I figure out that part, I think the rest of what I need for SoF is just to add in a bunch of 0 fields to finish the item instancing part. The serialization section for EQLive is 16 fields long, and I am pretty sure that SoF is as well, or at least close to that.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #5  
Old 01-12-2009, 03:23 AM
EvoZak
Sarnak
 
Join Date: May 2008
Location: Midwest
Posts: 72
Default

I can verify that at least for titanium client that it isn't necessary to send equipment in any fashion in order to zone into the game.

I think zeroed out the equipment slots in the pp and didn't have a problem.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:37 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3