Originally Posted by haste
What you do:
Code:
-- This goes in the main scope of your layout:
local MyPvPUpdate = function(self, event, unit)
if(unit ~= self.unit) then return end
local pvp = self.MyPvP
if(pvp) then
local factionGroup = UnitFactionGroup(unit)
-- FFA!
if(UnitIsPVPFreeForAll(unit)) then
pvp:SetTexture(0, 0, 1)
pvp:Show()
elseif(UnitIsPVP(unit) and factionGroup) then
if(factionGroup == 'Horde') then
pvp:SetTexture(1, 0, 0)
else
pvp:SetTexture(0, 1, 0)
end
pvp:Show()
else
pvp:Hide()
end
end
end
-- This goes in your layout style function:
local pvp = self.Health:CreateTexture(nil, "OVERLAY")
pvp:SetTexture(1, 0, 0)
pvp:SetHeight(18)
pvp:SetWidth(18)
pvp:SetPoint("BOTTOMLEFT", -13, -13)
self.MyPvP = pvp
-- This makes oUF update the information.
self:RegisterEvent("UNIT_FACTION", MyPvPUpdate)
-- This makes oUF update the information on forced updates.
table.insert(self.__elements, MyPvPUpdate)
|
Hi Back again
The above works great I'm just trying to tweak it a little to show a different color for my pvp square on a horde DK.
Code:
-- This goes in the main scope of your layout:
local MyPvPUpdate = function(self, event, unit)
if(unit ~= self.unit) then return end
local pvp = self.MyPvP
if(pvp) then
local factionGroup = UnitFactionGroup(unit)
-- FFA!
if(UnitIsPVPFreeForAll(unit)) then
pvp:SetTexture(1, 1, 1)
pvp:Show()
elseif(UnitIsPVP(unit) and factionGroup) then
if(factionGroup == 'Horde' and Class =="DEATHKNIGHT") then
pvp:SetTexture(0.294118, 0, 0.509804) -- DK Horde Colour
elseif(factionGroup == 'Horde') then
pvp:SetTexture(0.545098, 0, 0) -- Horde Colour
else
pvp:SetTexture(0.25, 0.4, 0.9) -- Alliance Colour
end
pvp:Show()
else
pvp:Hide()
end
end
end
Am i doing this right? have i even put it in the right place? should i be making the changes in the function?
Sorry for all the stupid question, thanks in advance for helping a nub