Thread Tools Display Modes
09-23-10, 09:18 PM   #1
Dankz
A Defias Bandit
AddOn Compiler - Click to view compilations
Join Date: Jul 2009
Posts: 2
LUA Clas Color + Aggro Borders

Simply trying to get KGPanels to be class colored unless the until has aggro, then red.

I'm using
Code:
local _, class = UnitClass("player");
if class == "WARRIOR" then
self:SetBackdropBorderColor(0.95, 0.23, 0.23, 0.50)
elseif class == "PRIEST" then
self:SetBackdropBorderColor(1, 0.96, 0.98, 0.50)
elseif class == "MAGE" then
self:SetBackdropBorderColor(0.00, 1, 1, 0.50)
elseif class == "DRUID" then
self:SetBackdropBorderColor(1, 0.49, 0.04, 0.50)
elseif class == "PALADIN" then
self:SetBackdropBorderColor(0.92, 0.22, 0.46, 0.50)
elseif class == "HUNTER" then
self:SetBackdropBorderColor(0.33, 0.86, 0.00, 0.50)
elseif class == "ROGUE" then
self:SetBackdropBorderColor(1, 0.94, 0.16, 0.50)
elseif class == "SHAMAN" then
self:SetBackdropBorderColor(0.13, 0.42, 1, 0.50)
elseif class == "WARLOCK" then
self:SetBackdropBorderColor(0.36, 0.18, 1, 0.50)
elseif class == "DEATHKNIGHT" then
self:SetBackdropBorderColor(0.77, 0.12, 0.23, 0.50)
end
for the class colored, simply want to add aggro indicator to it.
  Reply With Quote
09-23-10, 09:45 PM   #2
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Originally Posted by Dankz View Post
Simply trying to get KGPanels to be class colored unless the until has aggro, then red.

I'm using
Code:
local _, class = UnitClass("player");
if class == "WARRIOR" then
self:SetBackdropBorderColor(0.95, 0.23, 0.23, 0.50)
elseif class == "PRIEST" then
self:SetBackdropBorderColor(1, 0.96, 0.98, 0.50)
elseif class == "MAGE" then
self:SetBackdropBorderColor(0.00, 1, 1, 0.50)
elseif class == "DRUID" then
self:SetBackdropBorderColor(1, 0.49, 0.04, 0.50)
elseif class == "PALADIN" then
self:SetBackdropBorderColor(0.92, 0.22, 0.46, 0.50)
elseif class == "HUNTER" then
self:SetBackdropBorderColor(0.33, 0.86, 0.00, 0.50)
elseif class == "ROGUE" then
self:SetBackdropBorderColor(1, 0.94, 0.16, 0.50)
elseif class == "SHAMAN" then
self:SetBackdropBorderColor(0.13, 0.42, 1, 0.50)
elseif class == "WARLOCK" then
self:SetBackdropBorderColor(0.36, 0.18, 1, 0.50)
elseif class == "DEATHKNIGHT" then
self:SetBackdropBorderColor(0.77, 0.12, 0.23, 0.50)
end
for the class colored, simply want to add aggro indicator to it.
I'm not sure about the aggro color, but you need an onEvent check for target changed and check if that name is == your name.

However, there is an easier way to color with the class colors.

Code:
color = RAID_CLASS_COLORS[select(2, UnitClass("player"))]
self:SetBackDropBorderColor(color.r, color.g, color.b)
__________________

  Reply With Quote
09-23-10, 11:35 PM   #3
Taryble
A Molten Giant
 
Taryble's Avatar
Join Date: Jan 2009
Posts: 811
I was actually about to reply with the shorter version too. :-)
__________________
-- Taryble
  Reply With Quote
09-24-10, 01:47 AM   #4
Dankz
A Defias Bandit
AddOn Compiler - Click to view compilations
Join Date: Jul 2009
Posts: 2
Cheers, for the code cleanup, but I didn't like blizzards default class colors. The mage is more teal then baby blue, and dint match my UI. But thanks for the input.

Still looking for someway to add Aggro color to the frames.
  Reply With Quote
09-24-10, 04:44 PM   #5
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
local color = RAID_CLASS_COLORS
color.MAGE.r, color.MAGE.g, color.MAGE.b = 0, 1, 1
...

Think you can that way edit the mage color right before it's used. ofc I recommend storing these colors at addon load so it's not called each time you want to set a background color.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » LUA Clas Color + Aggro Borders


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