The numeric data longer than 1 byte are represented in the big-endian form. The cores provide the conversion (if needed) by the ">>" and "<<" operators.
|Type||Getting it in the core||Description|
|uint8, uint16, uint32, int8, int16, int32||Direct conversion of numbers and enum members to the corresponding type, like uint8(SPELL_FAILED_DONT_REPORT)||Signed and unsigned versions are interchangeable if the representation is correct. Boolean true/false are represented usually as uint8(1), uint8(0) respectively.|
|uint64 (GUID)||Object::GetObjectGuid()||A 8-bytes value, see class ObjectGuid. It is used for nothing but GUIDs, so uint64(0) in the code should be changed to ObjectGuid().|
|PackedGUID||Object::GetPackGUID(), ObjectGuid::ReadAsPacked()||A GUID in the packed form can be 2 to 9 bytes long. A brief description is presented below.|
|C string||string::c_str()||A zero-terminated sequence of characters. Read/write operators for string type ("<< string" so on) provide this conversion, making call to c_str() optional.|
|Raw data||ByteBuffer::contents(), BigNumber::AsByteArray()||An arbitrary sequence of bytes, following the uint8, uint16, or uint32 field which stores the length of the sequence.|
A packed GUID consists of a flag byte followed by the GUID data. This is based on the 1:1 mapping of a bit of the flag byte to the byte in 8-bytes GUID. The flag byte contains only those bits set which correspond to the non-zero bytes of the full GUID. The packed GUID length varies from 2 bytes (the best case for a player with low GUID under 256) and 9 bytes (with the flag byte 0xFF followed by the full GUID). The most saving in size provide player GUIDs since any other GUID contains non-zero data in the highest bytes, at least in the 12 highest bits (see ObjectGuid class for details).