View Single Post
07-10-10, 03:37 PM   #38
Monolit
A Black Drake
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 81
Originally Posted by Dawn View Post
...
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:
  1. if not IsAddOnLoaded("Gladius") then
  2.         local arena = {}
  3.             for i = 1, 5 do
  4.                 arena[i] = self:Spawn("arena"..i, "oUF_Arena"..i)
  5.                 if i == 1 then
  6.                     arena[i]:SetPoint("BOTTOMRIGHT", UIParent, "RIGHT", -90, -100)
  7.                 else
  8.                     arena[i]:SetPoint("BOTTOM", arena[i-1], "TOP", 0, 8)
  9.                 end
  10.             end
  11.         local arenatarget = {}
  12.             for i = 1, 5 do
  13.                 arenatarget[i] = self:Spawn("arena"..i.."target", "oUF_Arena"..i.."target")
  14.                 if i == 1 then
  15.                     arenatarget[i]:SetPoint("TOPRIGHT", arena[i], "TOPLEFT", 4, 0)
  16.                 else
  17.                     arenatarget[i]:SetPoint("BOTTOM", arenatarget[i-1], "TOP", 0, 8)
  18.                 end
  19.             end
  20.     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:
  1. if not (unit and (unit:find('partypet%d') or unit:find('arena%dtarget'))) then
  2. --if i don't specify unit:find('arena%dtarget') here then it will inherit unit:find('arena%d')
  3. --attributes and spawn buffs/debuffs on arenatarget frames (what we obviously don't want)
  4.                 self.Buffs:...
  5.                 self.Debuffs:...
  6.             if unit=="player" then
  7.                 self.Buffs:...
  8.                 self.Debuffs:...
  9.             elseif (self:GetParent():GetName():match"oUF_Party") then
  10.                 self.Buffs:...
  11.                 self.Debuffs:...
  12.             elseif (unit and unit:find('arena%d')) then -- there you go, our buffs/debuffs for arena frames
  13.                 self.Buffs:...
  14.                 self.Debuffs:...
  15.             end
  16.         end

so basically you can address that kind of frames from anywhere given that function provides us with unit, e.g.
lua Code:
  1. local function OverrideUpdateName(self, unit)
  2.     if(self.unit ~= unit or not self.Name) then return end
  3.     local uName = UnitName(unit) or 'Unknown'
  4.     if(unit == 'player') then
  5.         self.Name:Hide()
  6.     elseif(unit == 'target') then
  7.         self.Name:SetFormattedText(utf8sub(uName, 18, true))
  8.     elseif unit and unit:find('arena%dtarget') then
  9.         self.Name:SetFormattedText(utf8sub(uName, 2))
  10.     elseif (unit == 'pet' and uName == 'Unknown') then
  11.         self.Name:SetText('Pet')
  12.     elseif unit and unit:find('boss%d') then
  13.         self.Name:SetText(uName)
  14.         self.Name:SetWidth(75)
  15.         self.Name:SetHeight(15)
  16.     else
  17.         self.Name:SetFormattedText(utf8sub(uName, 10, true))
  18.     end
  19. 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

Last edited by Monolit : 07-10-10 at 07:12 PM.
  Reply With Quote