WoW:API UnitThreatSituation: Difference between revisions
Jump to navigation
Jump to search
(New page: {{wowapi}} __NOTOC__ <!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> Returns brief information about a unit's standing in another unit's...) |
(Add notes regarding the optional omission of the second argument to this function. Also cleaned up some inconsistent formatting, etc.) |
||
Line 1: | Line 1: | ||
{{wowapi}} __NOTOC__ | {{wowapi}} __NOTOC__ | ||
Returns brief information about a unit's standing in another unit's threat table. Added in [[Patch 3.0]]. | |||
status = UnitThreatSituation("unit"[, "otherunit"]) | |||
status = UnitThreatSituation("unit", " | |||
== Parameters == | == Parameters == | ||
=== Arguments === | === Arguments === | ||
:;unit : string - the [[API TYPE UnitId|unit token]] of the unit whose threat to query (e.g. "player", "party2", "pet", etc.) | |||
:;otherunit : string ''(optional)'' - the [[API TYPE UnitId|unit token]] of the unit whose threat table to query (e.g. "target", "pettarget" etc.) | |||
:;unit : | |||
:; | |||
=== Returns === | === Returns === | ||
:;status : integer - returns the [[API TYPE ThreatStatus|threat status]] for the unit on the second unit, or nil if the unit is not on the second unit's threat table, or a [[API TYPE ThreatStatus|threat status]] or 0 or 3 if the second unit is not specified depending on whether the unit has aggro on anything or not. | |||
:;status : | |||
== Example == | == Example == | ||
local status, statustxts = UnitThreatSituation("player", "target"), { "low on threat", "overnuking", "losing threat", "tanking securely" } | |||
print("You are " .. statustxts[status + 1] .. ".") | |||
local status, statustxts = UnitThreatSituation("player", "target"), {"low on threat", "overnuking", "losing threat", "tanking securely"} | === Result === | ||
:Prints a description of the player's threat situation to the chat frame. e.g. | :Prints a description of the player's threat situation to the chat frame. e.g. | ||
You are overnuking. | You are overnuking. | ||
* | == Details == | ||
* This function will return nil if the unit is not on the second unit's threat list, or if either unit isn't available. | |||
* If the second argument is omitted, this function will return 3 if the unit has aggro on something, or 0 otherwise. ''Needs confirmation/additional testing.'' | |||
* The return value status may be one of: | |||
** 0 = not tanking, lower threat than tank | |||
** 1 = not tanking, higher threat than tank | |||
** 2 = insecurely tanking | |||
** 3 = securely tanking | |||
== See also == | == See also == |
Revision as of 11:45, 5 March 2009
← WoW API < UnitThreatSituation
Returns brief information about a unit's standing in another unit's threat table. Added in Patch 3.0.
status = UnitThreatSituation("unit"[, "otherunit"])
Parameters
Arguments
- unit
- string - the unit token of the unit whose threat to query (e.g. "player", "party2", "pet", etc.)
- otherunit
- string (optional) - the unit token of the unit whose threat table to query (e.g. "target", "pettarget" etc.)
Returns
- status
- integer - returns the threat status for the unit on the second unit, or nil if the unit is not on the second unit's threat table, or a threat status or 0 or 3 if the second unit is not specified depending on whether the unit has aggro on anything or not.
Example
local status, statustxts = UnitThreatSituation("player", "target"), { "low on threat", "overnuking", "losing threat", "tanking securely" } print("You are " .. statustxts[status + 1] .. ".")
Result
- Prints a description of the player's threat situation to the chat frame. e.g.
You are overnuking.
Details
- This function will return nil if the unit is not on the second unit's threat list, or if either unit isn't available.
- If the second argument is omitted, this function will return 3 if the unit has aggro on something, or 0 otherwise. Needs confirmation/additional testing.
- The return value status may be one of:
- 0 = not tanking, lower threat than tank
- 1 = not tanking, higher threat than tank
- 2 = insecurely tanking
- 3 = securely tanking