Originally Posted by Dawn
...
|
I know that partypets can be done via xml easily, but my problem is arena frames/targets, pre oUF 1.4 I used to spawn them like this:
from my old oUF layout:
lua Code:
if not IsAddOnLoaded("Gladius") then
local arena = {}
for i = 1, 5 do
arena[i] = self:Spawn("arena"..i, "oUF_Arena"..i)
if i == 1 then
arena[i]:SetPoint("BOTTOMRIGHT", UIParent, "RIGHT", -90, -100)
else
arena[i]:SetPoint("BOTTOM", arena[i-1], "TOP", 0, 8)
end
end
local arenatarget = {}
for i = 1, 5 do
arenatarget[i] = self:Spawn("arena"..i.."target", "oUF_Arena"..i.."target")
if i == 1 then
arenatarget[i]:SetPoint("TOPRIGHT", arena[i], "TOPLEFT", 4, 0)
else
arenatarget[i]:SetPoint("BOTTOM", arenatarget[i-1], "TOP", 0, 8)
end
end
end
I used to have 1 shared style function, so that's how I addressed to stuff like arenaN/arenaNtarget/partypetN (using buffs/debuffs as example):
lua Code:
if not (unit and (unit:find('partypet%d') or unit:find('arena%dtarget'))) then
--if i don't specify unit:find('arena%dtarget') here then it will inherit unit:find('arena%d')
--attributes and spawn buffs/debuffs on arenatarget frames (what we obviously don't want)
self.Buffs:...
self.Debuffs:...
if unit=="player" then
self.Buffs:...
self.Debuffs:...
elseif (self:GetParent():GetName():match"oUF_Party") then
self.Buffs:...
self.Debuffs:...
elseif (unit and unit:find('arena%d')) then -- there you go, our buffs/debuffs for arena frames
self.Buffs:...
self.Debuffs:...
end
end
so basically you can address that kind of frames from anywhere given that function provides us with unit, e.g.
lua Code:
local function OverrideUpdateName(self, unit)
if(self.unit ~= unit or not self.Name) then return end
local uName = UnitName(unit) or 'Unknown'
if(unit == 'player') then
self.Name:Hide()
elseif(unit == 'target') then
self.Name:SetFormattedText(utf8sub(uName, 18, true))
elseif unit and unit:find('arena%dtarget') then
self.Name:SetFormattedText(utf8sub(uName, 2))
elseif (unit == 'pet' and uName == 'Unknown') then
self.Name:SetText('Pet')
elseif unit and unit:find('boss%d') then
self.Name:SetText(uName)
self.Name:SetWidth(75)
self.Name:SetHeight(15)
else
self.Name:SetFormattedText(utf8sub(uName, 10, true))
end
end
Actually I've just tested my old layout (using oUF 1.3.28) and it seems to be working apart of few minor flaws here and there:
So I just don't have a slight clue about what's wrong and why I can't get arena frames to spawn using oUF 1.4
.
I'd appreciate any advice or ideas
.
[OFF] P.S. Android owns :] [/OFF]
EDIT: I think I found the solution, will post after some testing