Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
mNo edit summary
Line 24: Line 24:
 
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
 
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
 
<!-- begin code -->
 
<!-- begin code -->
local status = UnitThreatSituation("player", "target"), {"low on threat", "overnuking", "losing threat", "tanking securely"};
+
local status, statustxts = UnitThreatSituation("player", "target"), {"low on threat", "overnuking", "losing threat", "tanking securely"};
 
local r, g, b = GetThreatStatusColor(status);
 
local r, g, b = GetThreatStatusColor(status);
 
ChatFrame1:AddMessage('You are ' .. statustxts[status+1] .. '.', r, g, b);
 
ChatFrame1:AddMessage('You are ' .. statustxts[status+1] .. '.', r, g, b);
Line 35: Line 35:
 
<font color="yellow">You are overnuking.</font>
 
<font color="yellow">You are overnuking.</font>
 
<!-- end code -->
 
<!-- end code -->
 
   
 
== See also ==
 
== See also ==

Revision as of 22:19, 12 October 2008


Returns RGB color values relating to a threat status. New in [Patch 3.0].

r, g, b = GetThreatStatusColor(status)


Parameters

Arguments

status
Integer - the threat status value to get colors for.

Returns

r
Number - Returns a value between 0 and 1 for the red content of the color.
g
Number - Returns a value between 0 and 1 for the green content of the color.
b
Number - Returns a value between 0 and 1 for the blue content of the color.

Example

local status, statustxts = UnitThreatSituation("player", "target"), {"low on threat",  "overnuking", "losing threat", "tanking securely"};
local r, g, b = GetThreatStatusColor(status);
ChatFrame1:AddMessage('You are ' .. statustxts[status+1] .. '.', r, g, b);

Result

Prints a description of the player's threat situation to the chat frame, colored appropriately. e.g.
You are overnuking.

See also

API UnitThreatSituation | API UnitDetailedThreatSituation