Thread Tools Display Modes
03-04-11, 02:14 PM   #1
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
trying to create glow for debuffhighlight.

So i'm trying to create a glow function, for oUF, that it glows around my borders on my unitframes should look like this:



but instead of purple it should glow in the debuffs types color.


Code:
	self.DebuffHighlightBackdrop = self.debuffhighlightglow
	self.DebuffHighlightFilter = false
	self.DebuffHighlight = self.debuffhighlightglow
	
	self.debuffhighlightglow = {}
	
	if AftermathhUI.config.debuffhiglightglow == true then
	
        for i = 1, 8 do
            self.debuffhighlightglow[i] = self:CreateTexture(nil, 'BACKGROUND')
            self.debuffhighlightglow[i]:SetParent(self)
            self.debuffhighlightglow[i]:SetTexture(borderbg)
            self.debuffhighlightglow[i]:SetWidth(20) 
            self.debuffhighlightglow[i]:SetHeight(20)
			self.debuffhighlightglow[i]:SetVertexColor(1, 0, 1)
        end
        
        self.debuffhighlightglow[1]:SetTexCoord(0, 1/3, 0, 1/3) 
        self.debuffhighlightglow[1]:SetPoint('TOPLEFT', self, -10, 10)
	
        self.debuffhighlightglow[2]:SetTexCoord(2/3, 1, 0, 1/3)
        self.debuffhighlightglow[2]:SetPoint('TOPRIGHT', self, 10, 10)
	
        self.debuffhighlightglow[3]:SetTexCoord(0, 1/3, 2/3, 1)
        self.debuffhighlightglow[3]:SetPoint('BOTTOMLEFT', self, -10, -10)
		
        self.debuffhighlightglow[4]:SetTexCoord(2/3, 1, 2/3, 1)
        self.debuffhighlightglow[4]:SetPoint('BOTTOMRIGHT', self, 10, -10)
		
        self.debuffhighlightglow[5]:SetTexCoord(1/3, 2/3, 0, 1/3)
        self.debuffhighlightglow[5]:SetPoint('TOPLEFT', self.debuffhighlightglow[1], 'TOPRIGHT')
        self.debuffhighlightglow[5]:SetPoint('TOPRIGHT', self.debuffhighlightglow[2], 'TOPLEFT')
		
        self.debuffhighlightglow[6]:SetTexCoord(1/3, 2/3, 2/3, 1)
        self.debuffhighlightglow[6]:SetPoint('BOTTOMLEFT', self.debuffhighlightglow[3], 'BOTTOMRIGHT')
        self.debuffhighlightglow[6]:SetPoint('BOTTOMRIGHT', self.debuffhighlightglow[4], 'BOTTOMLEFT')
		
        self.debuffhighlightglow[7]:SetTexCoord(0, 1/3, 1/3, 2/3)
        self.debuffhighlightglow[7]:SetPoint('TOPLEFT', self.debuffhighlightglow[1], 'BOTTOMLEFT')
        self.debuffhighlightglow[7]:SetPoint('BOTTOMLEFT', self.debuffhighlightglow[3], 'TOPLEFT')
	
        self.debuffhighlightglow[8]:SetTexCoord(2/3, 1, 1/3, 2/3)
        self.debuffhighlightglow[8]:SetPoint('TOPRIGHT', self.debuffhighlightglow[2], 'BOTTOMRIGHT')
        self.debuffhighlightglow[8]:SetPoint('BOTTOMRIGHT', self.debuffhighlightglow[4], 'TOPRIGHT')
    end

Last edited by Aftermathhqt : 03-04-11 at 02:30 PM.
  Reply With Quote
03-08-11, 04:41 AM   #2
gagou
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 16
I'm doing something almost similar in my personal layout, except that I color by debuff type color I can dispell.

the 'RAID|HARMFUL' filter in the UnitAura call will filter the debuff type I can dispell, magic debuff filtering is a little buggy as for paladin, druid, shaman it's now a talent, and for warlock it's a pet spell, so I made a workaround to check if you can dispell it.

it the code below there is a function UpdateMagicDispell which will check if you can dispell magic, this function should be called by PLAYER_TALENT_UPDATE and SPELLS_CHANGED events.
SetCureableDebuff will update the color of the based on the debuff type you can dispell, it should be called by UNIT_AURA event.

I only post the code relevant to the debuff coloring as this is part to a personal element that is managing all my own indicators.

Code:
local UpdateMagicDispell, SetCureableDebuff
do
	local GetTalentInfo, IsSpellKnown = _G.GetTalentInfo, _G.IsSpellKnown
	local canDispellMagic
	local function checkTalent(tab, index)
		return (select(5, GetTalentInfo(tab, index)) or 0) >= 1
	end

	function UpdateMagicDispell()
		if playerClass == 'PALADIN' then
			canDispellMagic = checkTalent(1, 14) and true or nil
		elseif playerClass == 'DRUID' then
			canDispellMagic = checkTalent(3, 17) and true or nil
		elseif playerClass == 'SHAMAN' then
			canDispellMagic = checkTalent(3, 12) and true or nil
		elseif playerClass == 'WARLOCK' then
			canDispellMagic = IsSpellKnown(89808, true) and true or nil
		else
			canDispellMagic = nil
		end
	end

	function SetCureableDebuff(self, unit)
		local i = 0
		while true do
			i = i + 1
			local _, _, texture, _, debuffType = UnitAura(unit, i, 'RAID|HARMFUL')
			if texture then
				if debuffType ~= 'Magic' or canDispellMagic then
					local color = DebuffTypeColor[debuffType or 'none']
					self.CurrDebuff:SetVertexColor(color.r, color.g, color.b)
				end
			else
				self.CurrDebuff:SetVertexColor(0, 0, 0)
			end
		end
	end
end
  Reply With Quote
03-09-11, 12:26 PM   #3
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by gagou View Post
I'm doing something almost similar in my personal layout, except that I color by debuff type color I can dispell.

the 'RAID|HARMFUL' filter in the UnitAura call will filter the debuff type I can dispell, magic debuff filtering is a little buggy as for paladin, druid, shaman it's now a talent, and for warlock it's a pet spell, so I made a workaround to check if you can dispell it.

it the code below there is a function UpdateMagicDispell which will check if you can dispell magic, this function should be called by PLAYER_TALENT_UPDATE and SPELLS_CHANGED events.
SetCureableDebuff will update the color of the based on the debuff type you can dispell, it should be called by UNIT_AURA event.

I only post the code relevant to the debuff coloring as this is part to a personal element that is managing all my own indicators.

Code:
local UpdateMagicDispell, SetCureableDebuff
do
	local GetTalentInfo, IsSpellKnown = _G.GetTalentInfo, _G.IsSpellKnown
	local canDispellMagic
	local function checkTalent(tab, index)
		return (select(5, GetTalentInfo(tab, index)) or 0) >= 1
	end

	function UpdateMagicDispell()
		if playerClass == 'PALADIN' then
			canDispellMagic = checkTalent(1, 14) and true or nil
		elseif playerClass == 'DRUID' then
			canDispellMagic = checkTalent(3, 17) and true or nil
		elseif playerClass == 'SHAMAN' then
			canDispellMagic = checkTalent(3, 12) and true or nil
		elseif playerClass == 'WARLOCK' then
			canDispellMagic = IsSpellKnown(89808, true) and true or nil
		else
			canDispellMagic = nil
		end
	end

	function SetCureableDebuff(self, unit)
		local i = 0
		while true do
			i = i + 1
			local _, _, texture, _, debuffType = UnitAura(unit, i, 'RAID|HARMFUL')
			if texture then
				if debuffType ~= 'Magic' or canDispellMagic then
					local color = DebuffTypeColor[debuffType or 'none']
					self.CurrDebuff:SetVertexColor(color.r, color.g, color.b)
				end
			else
				self.CurrDebuff:SetVertexColor(0, 0, 0)
			end
		end
	end
end
Anyways i've got it to work, but not the way i wanted :/ thanks for help anyways.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » trying to create glow for debuffhighlight.


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