UnitId

Many of the API functions which act on units in the game world (Players, NPC's, Monsters, etc) refer to the unit in question by an identifier that is related to how the player is accessing the unit. The following values are available (they are not case sensitive):

Base Values

 * "arenaN" : Opposing arena member with index N (1,2,3,4 or 5).


 * "bossN" : The active bosses of the current encounter if available N (1,2,3 or 4). (Added in 3.3.0)


 * "focus" : The current player's focus target as selected by the /focus command. (Added in 2.0.0).


 * "mouseover" : The unit which the mouse is currently (or was most recently) hovering over.


 * "none": A valid unit token that always refers to no unit. UnitName will return "Unknown, nil" for this UnitID. Use to force a macro to not auto self-cast (/cast [target=none] Healing Wave).


 * "partyN" : The Nth party member excluding the player (1,2,3 or 4).


 * "partypetN" : The pet of the Nth party member (N is 1,2,3, or 4) (Added in 1.5.0).


 * "pet" : The current player's pet.


 * "player"</tt> : The current player.


 * "raidN"</tt> : The raid member with raidIndex N (1,2,3,...,40).


 * "raidpetN"</tt> : The pet of the raid member with raidIndex N (1,2,3,...,40) (Added in 1.5.0)


 * "target"</tt> : The currently targeted unit. May be overridden in macros by unit specified as a value of respective Secure Button attribute.


 * "vehicle"</tt> : The current player's vehicle.

Others
The following value also appears in some very specific places (Vendor interactions, for example) or functions.


 * "npc"</tt> : The NPC with which the player is currently interacting. You must be interacting with the NPC for this to work (e.g. the quest, flight path, merchant, gossip, or bank frame is open).


 * player name</tt> : As returned by UnitName, GetGuildRosterInfo, GetFriendInfo, COMBAT LOG EVENT, etc. This must be spelled exactly and will be invalid if the named player is not a part of your party or raid. As with all other UnitIDs, it is not case sensitive.

Targets
You can append the suffix target</tt> to any UnitId to get a UnitId which refers to that unit's target (e.g. "partypet2target"</tt>). This appending can be repeated indefinitely (e.g. "playertargettarget"</tt>), though you will observe an attendant performance hit if you overdo it, as the game engine has to jump from target to target.

If you are using a party or raid member's name as a unit, you need to use hyphens to separate the target chain (e.g. "Cogwheel-target-target"</tt>).

Examples

 * "raid7target"</tt> : Refers to the 7th raid member's target.


 * "party1targettarget"</tt> : Refers to the first party member (not the player, but the first person in the player's party frames)'s target's target.


 * "targettargetpettarget"</tt> : Refers to the player's target's target's pet's target. Will refer to the player's target if the player's target and the player's pet are both targeting the player.


 * "mouseoverpettarget"</tt> : Refers the unit being moused over's pet's target.


 * "playertarget"</tt> : The same as simply using "target". Using "playertarget" is not as efficient as simply using "target".


 * <tt>"Cogwheel"</tt> : Refers to Cogwheel if he is in the player's party/raid.


 * <tt>"Cogwheel-target"</tt> : Refers to Cogwheel's target if he is in the player's party/raid.


 * <tt>"Cogwheel-pet-target"</tt> : Refers to Cogwheel's pet's target if he is in the player's party/raid.