→Determine if it's a player, pet or NPC
m (Clarification on the hex prefix being "part of the string".) |
|||
| Line 22: | Line 22: | ||
* It's a pet if the upper bits masked with 0x00f = 0x004 | * It's a pet if the upper bits masked with 0x00f = 0x004 | ||
* It's a vehicle (carries others) if the upper bits masked with 0x00f = 0x005 | * It's a vehicle (carries others) if the upper bits masked with 0x00f = 0x005 | ||
Since, as explained below, attempting to convert a GUID to a number in Lua results in garbage, it may be easier to use substrings than actually converting to a number and masking, as in this example: | |||
myGUID = "0xF530004D2B008852" -- the example used below | |||
myUnitType = myGUID:sub(5,5) | |||
The value you get will be either 0, 3, 4, or 5 corresponding to players, creatures, pets and vehicles respectively. | |||
=== Format for players === | === Format for players === | ||