WoW:API GetThreatStatusColor: Difference between revisions

m
Move page script moved page API GetThreatStatusColor to WoW:API GetThreatStatusColor without leaving a redirect
(New page: {{wowapi}} __NOTOC__ <!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> Returns RGB color values relating to a threat status. New in [Patc...)
 
m (Move page script moved page API GetThreatStatusColor to WoW:API GetThreatStatusColor without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi|toc=0}}
 
Returns RGB color value corresponding to a threat status returned by [[API UnitThreatSituation|UnitThreatSituation]]Added in Patch 3.0.
 
  r, g, b = GetThreatStatusColor(statusIndex)
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
Returns RGB color values relating to a threat status.  New in [[Patch 3.0]].
 
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
  r, g, b = GetThreatStatusColor([[API TYPE ThreatStatus|status]])
 


== Parameters ==
== Parameters ==
=== Arguments ===
=== Arguments ===
<!-- List each argument, together with its type -->
* status (integer) - the [[API TYPE ThreatStatus|ThreatStatus]] value to get colors for


:;status : Integer - the [[API TYPE ThreatStatus|threat status]] value to get colors for.
=== Returns ===
* r (number) - a value between 0 and 1 for the red content of the color
* g (number) - a value between 0 and 1 for the green content of the color
* b (number) - a value between 0 and 1 for the blue content of the color


=== Returns ===
=== Result ===
<!-- List each return value, together with its type -->
Prints a description of the player's threat situation to the chat frame, colored appropriately. e.g.
:;r : Number - Returns a value between 0 and 1 for the red content of the color.
<font color="AFAFAF">You are low on threat.</font>
:;g : Number - Returns a value between 0 and 1 for the green content of the color.
<font color="FFFF77">You are overnuking.</font>
:;b : Number - Returns a value between 0 and 1 for the blue content of the color.
<font color="FF9900">You are losing threat.</font>
<font color="FF0000">You are tanking securely.</font>


== Example ==
== Examples ==
<!-- 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 -->
  local r, g, b = GetThreatStatusColor(status)
  local status, statustxts = UnitThreatSituation("player", "target"), {"low on threat",  "overnuking", "losing threat", "tanking securely"};
  print("You are " .. statustxts[status + 1] .. ".", r, g, b)
  local r, g, b = GetThreatStatusColor(status);
  ChatFrame1:AddMessage('You are ' .. statustxts[status+1] .. '.', r, g, b);
<!-- end code -->


====Result====
== Notes ==
<!-- 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. -->
As of Patch 3.0.9, the following r, g, b values are returned for each threat level:
:Prints a description of the player's threat situation to the chat frame, colored appropriately. e.g.
* 0: <span style="color: #AFAFAF">0.69, 0.69, 0.69</span>
<!-- begin code -->
* 1: <span style="color: #FFFF77">1, 1, 0.47</span>
<font color="yellow">You are overnuking.</font>
* 2: <span style="color: #FF9900">1, 0.6, 0</span>
<!-- end code -->
* 3: <span style="color: #FF0000">1, 0, 0</span>


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