WoW:API UnitDetailedThreatSituation: 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 information about a unit's standing in another unit's threa...)
 
m (Move page script moved page API UnitDetailedThreatSituation to API UnitDetailedThreatSituation without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi}}
 
 
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
Returns detailed information about a unit's standing in another unit's threat table.  New in [[Patch 3.0]].
Returns detailed information about a unit's standing in another unit's threat table.  New in [[Patch 3.0]].
Line 19: Line 17:
=== Returns ===
=== Returns ===
<!-- List each return value, together with its type -->
<!-- List each return value, together with its type -->
:;isTanking : Integer - returns 1 if the unit is primary threat target of the mob (is tanking), or nil otherwise.
:;isTanking : Boolean - returns true if the unit is primary threat target of the mob (is tanking), or false otherwise.
:;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)
:;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)
:;threatpct : Number - returns the unit's threat on the mob as a percentage of the amount required to pull aggro, scaled according to the unit's range from the mob.  At 100 the unit will pull aggro.  Returns 100 if the unit is tanking and nil if the unit is not on the mob's threat list.
:;threatpct : Number - returns the unit's threat on the mob as a percentage of the amount required to pull aggro, scaled according to the unit's range from the mob.  At 100 the unit will pull aggro.  Returns 100 if the unit is tanking and nil if the unit is not on the mob's threat list.
Line 52: Line 50:


== See also ==
== See also ==
 
* {{api|UnitThreatSituation}}
[[API UnitThreatSituation]]
 
[[Category:Interface customization]]
[[Category:World of Warcraft API]]

Latest revision as of 04:47, 15 August 2023

WoW API < UnitDetailedThreatSituation

Returns detailed information about a unit's standing in another unit's threat table. New in Patch 3.0.

isTanking, status, threatpct, rawthreatpct, threatvalue = UnitDetailedThreatSituation("unit", "mob")


Parameters[edit]

Arguments[edit]

unit
String - The UnitId whose threat to query (e.g. "player", "party2", "pet", etc.)
mob
String - The UnitId of the unit whose threat table to query (e.g. "target", "pettarget" etc.)

Returns[edit]

isTanking
Boolean - returns true if the unit is primary threat target of the mob (is tanking), or false otherwise.
status
Integer - returns the 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)
threatpct
Number - returns the unit's threat on the mob as a percentage of the amount required to pull aggro, scaled according to the unit's range from the mob. At 100 the unit will pull aggro. Returns 100 if the unit is tanking and nil if the unit is not on the mob's threat list.
rawthreatpct
Number - returns the unit's threat as a percentage of the tank's current threat. Returns nil if the unit is not on the mob's threat list.
threatvalue
Number - returns the unit's total threat on the mob.

Example[edit]

local _,_,threatpct,_,_ = UnitDetailedThreatSituation("player", "target");
ChatFrame1:AddMessage('You are ' .. tostring(threatpct) .. '% towards aggro.');

Result[edit]

Prints the player's evaluated threat% to the chat frame. e.g.
You are 80.189041098141% towards aggro.


Details[edit]

  • The function will return all nil values if the unit is not on the mob's threat list or if either unit isn't available.


Notes[edit]

  • When mobs are socially pulled (ie they aggro indirectly, as a result of another nearby mob being pulled), 'status' often sets to 0 instead of 3, despite the player having aggro.

See also[edit]