API UnitThreatSituation

Returns the threat status of one unit against another. status = UnitThreatSituation(unit [, mobUnit])

Arguments

 * unit : string - UnitId of the player or pet whose threat to request.
 * mobUnit : string ? - UnitId of the NPC whose threat table to query.
 * If omitted, returned values reflect whichever NPC unit the player unit has the highest threat against.

Returns

 * status : number |nil - the threat status of the unit on the mobUnit.

Details

 * Threat information for a pair of units is only returned if the player has threat against the NPC unit in question. (For example, no threat data is provided if the player's pet is attacking an NPC but the player himself has taken no action, even though the pet has threat against the NPC.)

Example
Prints your threat status for your target if it exists. If the target does not exist or the player is not on the target's threat table, prints your threat status for any other units. local statusText = { [0] = "(0) low on threat", [1] = "(1) overaggroing", [2] = "(2) tanking but not on top of threat", [3] = "(3) tanking and highest on threat", } local statusTarget = UnitThreatSituation("player", "target") if UnitExists("target") then local msg = statusText[statusTarget] or "not on the target's threat table" print("Your threat situation for target unit: "..msg) end if not statusTarget then -- not in any target unit's threat table, look if on other threat tables local statusAny = UnitThreatSituation("player") local msg = statusText[statusAny] or "not on any threat table" print("Your threat situation for any unit: "..msg) end

> Your threat situation for target unit: (3) tanking and highest on threat