Jump to content
Sign in to follow this  
terrorio

Difference between GetObjectGuid and GetPackGUID

Recommended Posts

GetObjectGuid return normal guid as uint64 wrapped into object.

GetPackGUID return packed ( :) ) guid representation in form: byte with bit-mask with bit set for non-0 bytes in guid and follow non-0 bytes from original guid only.

Share this post


Link to post
Share on other sites

Does it make a difference if I use GetObjectGuid in sending packet data?

data << m_caster->GetPackGUID();

or

data << m_caster->GetObjectGuid();

Does it have a big impact on anything?

Share this post


Link to post
Share on other sites

yes, a normal guid is always 8bytes while a packed one is between 1 and 9 (I think?). Meaning that it can break the whole packet if you use the wrong one

Share this post


Link to post
Share on other sites

Object GUID is always 64 bits.

Packed GUID is 8 to 72 bits.

Packed GUID consists of:

[8 bits (mask)] + [8*n bits (data) (n = 'on' bit count in mask)]

Packed GUID is used to reduce GUID size for less data usage over network.

Take bit from mask, if it's 0 put 0x00 in your GUID, if it's 1 put next two bytes of data and put in your guid.

Example of packed GUID vs GUID:

GUID= 0x0000000012345678 (player guid, because high part is 0x0000)

Packed GUID:

-mask (binary): 00001111 (0x0F)

-data: 0x12345678

-together: 0x0F12345678

GUID= 0x0012003400560078

Packed GUID:

-mask (binary): 01010101 (0x55)

-data: 0x12345678

-together: 0x5512345678

Share this post


Link to post
Share on other sites

Is the increased data usage notable?

I was experimenting with some packets and the problem is that some packets only work with data GetObjectGuid(); and not with GetPackGUID();

So I assume it's safe to use GetObjectGuid(); where needed, right?

Share this post


Link to post
Share on other sites

you _must_ use the guid format that is expected to be sent by the client.

If you chose the wrong one, the client will either crash (most likely) or produce total crap..

Edit: To be clear: This is a choice that was made by blizzard developers, and if you want to talk to the client, you must use the 'language' the client understands. This is nothing where you can chose.

  • Like 1

Share this post


Link to post
Share on other sites
Sign in to follow this  

Contact Us

To contact us click here
You can also email us at [email protected]

Privacy Policy | Terms & Conditions

Repositories

The Link to the master list
of MaNGOS repositories:
Copyright © getMaNGOS. All rights Reserved.

This website is in no way associated with or endorsed by Blizzard Entertainment®
×