Navigation menu

WoW:API UnitThreatSituation: Difference between revisions

Jump to navigation Jump to search
Add notes regarding the optional omission of the second argument to this function. Also cleaned up some inconsistent formatting, etc.
(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]].


<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
  status = UnitThreatSituation("unit"[, "otherunit"])
Returns brief information about a unit's standing in another unit's threat table.  New in [[Patch 3.0]].
 
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
  status = UnitThreatSituation("unit", "mob")
 


== Parameters ==
== Parameters ==
=== Arguments ===
=== Arguments ===
<!-- List each argument, together with its type -->
:;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 : String - The [[API TYPE UnitId|UnitId]] whose threat to query (e.g. "player", "party2", "pet", etc.)
 
:;mob : String - The [[API TYPE UnitId|UnitId]] of the unit whose threat table to query (e.g. "target", "pettarget" etc.)


=== Returns ===
=== Returns ===
<!-- List each return value, together with its type -->
:;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 : Integer - returns the [[API TYPE ThreatStatus|threat status]] for the unit on the mob, or nil if unit is not on mob's threat table. (3 = securely tanking, 2 = insecurely tanking, 1 = not tanking but higher threat than tank, 0 = not tanking and lower threat than tank)


== Example ==
== Example ==
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
  local status, statustxts = UnitThreatSituation("player", "target"), { "low on threat",  "overnuking", "losing threat", "tanking securely" }
<!-- begin code -->
  print("You are " .. statustxts[status + 1] .. ".")
  local status, statustxts = UnitThreatSituation("player", "target"), {"low on threat",  "overnuking", "losing threat", "tanking securely"};
=== Result ===
  ChatFrame1:AddMessage('You are ' .. statustxts[status+1] .. '.');
<!-- end code -->
 
====Result====
<!-- If it helps, include example results here, though they are not required. You're allowed to cheat liberally since WoW isn't a command line language. -->
: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.
<!-- begin code -->
  You are overnuking.
  You are overnuking.
<!-- end code -->
==Details==
<!-- Details not appropriate for the main description can go here.
    REMOVE the section if you're just going to restate the intro line! -->


* The function will return nil if the unit is not on the mob's threat list or if either unit isn't available.
== 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 ==
Anonymous user