WoW:API UnitGUID: Difference between revisions

→‎Notes: - added information for temporary pets
(→‎Notes: fixed incorrect reference to "EEEEEE" instead of 7 E's)
(→‎Notes: - added information for temporary pets)
Line 30: Line 30:
A GUID can be thought of as being composed of multiple pieces of data. Consider "'''0xAABCCCDDDDEEEEEE'''", where:
A GUID can be thought of as being composed of multiple pieces of data. Consider "'''0xAABCCCDDDDEEEEEE'''", where:
:; AA : unknown.
:; AA : unknown.
:; B : unit type, mask with 0x7 to get: 0 for players, 1 for world objects, 3 for NPCs, 4 for pets, 5 for vehicles.
:; B : unit type, mask with 0x7 to get: 0 for players, 1 for world objects, 3 for NPCs, 4 for permanent pets, 5 for vehicles.  Temporary pets (Treants, Spirit Wolves, Water Elemental, Mirror Images, and Ghouls) are considered NPCs (3), even if talents or glyphs prevent them from expiring.
:; CCC : If the unit is a pet, CCCDDDD forms a unique ID for the pet based on creation order; if a world object, CCCDDDD is the object ID; otherwise unknown.
:; CCC : If the unit is a pet, CCCDDDD forms a unique ID for the pet based on creation order; if a world object, CCCDDDD is the object ID; otherwise unknown.
:; DDDD : If the unit is an NPC, this is the hexadecimal representation of the NPC id.
:; DDDD : If the unit is an NPC, this is the hexadecimal representation of the NPC id.
:; EEEEEE : If the unit is a player, this is a unique identifier based on creation order. Otherwise, this is a spawn counter based on spawn order.
:; EEEEEE : If the unit is a player, this is a unique identifier based on creation order. Otherwise, this is a spawn counter based on spawn order.


=== Example: Determining unit type ===
=== Example: Determining unit type ===
Anonymous user