WoW:API UnitThreatSituation: Difference between revisions

From AddOn Studio
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...)
 
m (Move page script moved page API UnitThreatSituation to API UnitThreatSituation without leaving a redirect)
 
(5 intermediate revisions by 4 users not shown)
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"])


== Parameters ==
=== 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.)


<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
=== Returns ===
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")


;status : integer - returns the threat status for the unit:


== Parameters ==
:;With otherunit specified
=== Arguments ===
<!-- List each argument, together with its type -->


:;unit : String - The [[API TYPE UnitId|UnitId]] whose threat to query (e.g. "player", "party2", "pet", etc.)
::* nil = unit is not on otherunit's threat table.
::* 0 = not tanking, lower threat than tank.
::* 1 = not tanking, higher threat than tank.
::* 2 = insecurely tanking, another unit have higher threat but not tanking.
::* 3 = securely tanking, highest threat


:;mob : String - The [[API TYPE UnitId|UnitId]] of the unit whose threat table to query (e.g. "target", "pettarget" etc.)
:;Without otherunit specified


=== Returns ===
::* nil = unit is not on any other unit's threat table.
<!-- List each return value, together with its type -->
::* 0 = not tanking anything.
:;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)
::* 1 = not tanking anything, but have higher threat than tank on at least one unit.
::* 2 = insecurely tanking at least one unit, but not securely tanking anything.
::* 3 = securely tanking at least one unit.


== 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] .. '.');
Prints a description of the player's threat situation to the chat frame. e.g.
<!-- 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.
<!-- 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.


== See also ==
== See also ==
 
* [[API UnitDetailedThreatSituation]]
[[API UnitDetailedThreatSituation]] | [[API GetThreatStatusColor]]
* [[API GetThreatStatusColor]]
 
[[Category:Interface customization]]
[[Category:World of Warcraft API]]

Latest revision as of 04:47, 15 August 2023

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[edit]

Arguments[edit]

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[edit]

status
integer - returns the threat status for the unit:
With otherunit specified
  • nil = unit is not on otherunit's threat table.
  • 0 = not tanking, lower threat than tank.
  • 1 = not tanking, higher threat than tank.
  • 2 = insecurely tanking, another unit have higher threat but not tanking.
  • 3 = securely tanking, highest threat
Without otherunit specified
  • nil = unit is not on any other unit's threat table.
  • 0 = not tanking anything.
  • 1 = not tanking anything, but have higher threat than tank on at least one unit.
  • 2 = insecurely tanking at least one unit, but not securely tanking anything.
  • 3 = securely tanking at least one unit.

Example[edit]

local status, statustxts = UnitThreatSituation("player", "target"), { "low on threat",  "overnuking", "losing threat", "tanking securely" }
print("You are " .. statustxts[status + 1] .. ".")

Result[edit]

Prints a description of the player's threat situation to the chat frame. e.g.

You are overnuking.

Details[edit]

  • This function will return nil if the unit is not on the second unit's threat list, or if either unit isn't available.

See also[edit]