Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-09-11, 02:19 PM   #1
Lily.Petal
A Molten Giant
 
Lily.Petal's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2010
Posts: 540
KG Panels + Coloring

Posted from Below and from PM's
(Big thanks to Nib!)

Normal Threat:

-- OnLoad
Code:
self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE")
-- OnEvent
Code:
-- Replace unit with "party1" to "party4" for party members. Or ("target", "targettarget") for seeing threat on your target.
local status = UnitThreatSituation(unit)
local color = status and {GetThreatStatusColor(status)} or {0,0,0}
self:SetBackdropBorderColor(unpack(color))
--------------------------------

Personal Colors: (also with extra quirks that doesn't show threat unless you're in group/have pet and won't show in BGs)

-- OnLoad
Code:
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PARTY_MEMBERS_CHANGED")
self:RegisterEvent("UNIT_PET")
self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE")
-- On Event
Code:
--- {R, G, B, A}  - Set A to 0 to hide the panel.
local ThreatStatusColors = {
	[0] = {0, 0, 0, 0},		-- not tanking, lower threat than tank. 
	[1] = {0, 0, 0, 1},		-- not tanking, higher threat than tank. 
	[2] = {0, 0, 0, 1},		-- insecurely tanking, another unit have higher threat but not tanking. 
	[3] = {0, 0, 0, 1},		-- securely tanking, highest threat 
}

local color
local status = UnitThreatSituation(unit)
local _, InstType = IsInInstance()
if ( (status ~= nil) and (UnitExists("pet") or (GetRealNumPartyMembers() > 0) or (GetRealNumRaidMembers() > 1)) and not (InstType == "pvp" or InstType == "arena") ) then
	color = ThreatStatusColors[status]
else
	color = {0,0,0,0}	-- Hide
end
self:SetBackdropBorderColor(unpack(color))
---------------------------
Same as above, but default ThreatColors:

-- OnLoad
Code:
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PARTY_MEMBERS_CHANGED")
self:RegisterEvent("UNIT_PET")
self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE")
-- OnEvent
Code:
local color, status
local _, InstType = IsInInstance()
if ( (UnitExists("pet") or (GetRealNumPartyMembers() > 0) or (GetRealNumRaidMembers() > 1)) and not (InstType == "pvp" or InstType == "arena") ) then
	status = UnitThreatSituation(unit)
	color = status and {GetThreatStatusColor(status)} or {0,0,0,0}	-- Threat colors
else
	color = {0,0,0,0}	-- Hide
end

Last edited by Lily.Petal : 04-30-11 at 05:16 PM.
  Reply With Quote
 

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » KG Panels + Coloring


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off