Quantcast
ArenaEnemyFrame buff display - WoWInterface
Thread Tools Display Modes
08-18-15, 11:47 AM   #1
Akiu
A Defias Bandit
Join Date: Aug 2015
Posts: 2
ArenaEnemyFrame buff display

Lua Code:
  1. for i=1,4 do
  2.         local f = _G["PartyMemberFrame"..i]
  3.         f:UnregisterEvent("UNIT_AURA")
  4.         local g = CreateFrame("Frame")
  5.         g:RegisterEvent("UNIT_AURA")
  6.         g:SetScript("OnEvent",function(self,event,a1)
  7.                 if a1 == f.unit then
  8.                         RefreshDebuffs(f,a1,20,nil,1)
  9.                 else
  10.                         if a1 == f.unit.."pet" then
  11.                                 PartyMemberFrame_RefreshPetDebuffs(f)
  12.                         end
  13.                 end
  14.         end)
  15.         local b = _G[f:GetName().."Debuff1"]
  16.         b:ClearAllPoints()
  17.         b:SetPoint("LEFT",f,"RIGHT",-7,5)
  18.         for j=5,20 do
  19.                 local l = f:GetName().."Debuff"
  20.                 local n = l..j
  21.                 local c = CreateFrame("Frame",n,f,"PartyDebuffFrameTemplate")
  22.                 c:SetPoint("LEFT",_G[l..(j-1)],"RIGHT")
  23.         end
  24. end
  25.  
  26. for i=1,4 do
  27.         local f = _G["PartyMemberFrame"..i]
  28.         f:UnregisterEvent("UNIT_AURA")
  29.         local g = CreateFrame("Frame")
  30.         g:RegisterEvent("UNIT_AURA")
  31.         g:SetScript("OnEvent",function(self,event,a1)
  32.                 if a1 == f.unit then
  33.                         RefreshBuffs(f,a1,20,nil,1)
  34.                 end
  35.         end)
  36.         for j=1,20 do
  37.                 local l = f:GetName().."Buff"
  38.                 local n = l..j
  39.                 local c = CreateFrame("Frame",n,f,"TargetBuffFrameTemplate")
  40.                 c:EnableMouse(false)
  41.                 if j == 1 then
  42.                         c:SetPoint("TOPLEFT",48,-32)
  43.                 else
  44.                         c:SetPoint("LEFT",_G[l..(j-1)],"RIGHT",1,0)
  45.                 end
  46.         end
  47. end

So I found this... and it does pretty much what I want it to do, but I want this to be on the ArenaEnemyFrames... I can't figure out how to get it to show for those, I figured changing it to this would work:

Lua Code:
  1. for i=1,4 do
  2.  local f = _G["ArenaEnemyFrame"..i]
  3.  f:UnregisterEvent("UNIT_AURA")
  4.  local g = CreateFrame("Frame")
  5.  g:RegisterEvent("UNIT_AURA")
  6.  g:SetScript("OnEvent",function(self,event,a1)
  7.  if a1 == f.unit then
  8.  RefreshDebuffs(f,a1,20,nil,1)
  9.  else
  10.  if a1 == f.unit.."pet" then
  11.  PartyMemberFrame_RefreshPetDebuffs(f)
  12.  end
  13.  end
  14.  end)
  15.  local b = _G[f:GetName().."Debuff1"]
  16.  b:ClearAllPoints()
  17.  b:SetPoint("LEFT",f,"RIGHT",-7,5)
  18.  for j=5,20 do
  19.  local l = f:GetName().."Debuff"
  20.  local n = l..j
  21.  local c = CreateFrame("Frame",n,f,"PartyDebuffFrameTemplate")
  22.  c:SetPoint("LEFT",_G[l..(j-1)],"RIGHT")
  23.  end
  24. end
  25.  
  26. for i=1,4 do
  27.  local f = _G["ArenaEnemyFrame"..i]
  28.  f:UnregisterEvent("UNIT_AURA")
  29.  local g = CreateFrame("Frame")
  30.  g:RegisterEvent("UNIT_AURA")
  31.  g:SetScript("OnEvent",function(self,event,a1)
  32.  if a1 == f.unit then
  33.  RefreshBuffs(f,a1,20,nil,1)
  34.  end
  35.  end)
  36.  for j=1,20 do
  37.  local l = f:GetName().."Buff"
  38.  local n = l..j
  39.  local c = CreateFrame("Frame",n,f,"TargetBuffFrameTemplate")
  40.  c:EnableMouse(false)
  41.  if j == 1 then
  42.  c:SetPoint("TOPLEFT",48,-32)
  43.  else
  44.  c:SetPoint("LEFT",_G[l..(j-1)],"RIGHT",1,0)
  45.  end
  46.  end
  47. end

But... I just get a lua error that the value for 'b' is nil.

What I don't understand is, if it's using the PartyDebuffFrameTemplate to size the buffs etc... why can't it just attach that to the ArenaEnemyFrame and update when a new AURA happens?

And from my understanding it's pulling the value for B off of

Lua Code:
  1. local f = _G["ArenaEnemyFrame"..i]

...So why would it cause it to be nil?
  Reply With Quote
08-19-15, 05:35 AM   #2
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Because you register every UNIT_AURA event instead of only for the arena units.

Try the change:

Lua Code:
  1. g:RegisterUnitEvent("UNIT_AURA", "arena1", "arena2", "arena3", "arena4", "arena5")

You should also change the for loops to 1 to 5.

Last edited by Resike : 08-19-15 at 05:38 AM.
  Reply With Quote
08-19-15, 12:17 PM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
@Resike:
No, that won't work. RegisterUnitEvent only supports 1 or 2 units. If you want to filter on more than 2 units you have to do it yourself. Also, that's not even relevant; the OP's code was already checking to see if the unit was the frame's assigned unit before doing anything.

@Akiu:
I suspect the real problem is that you're trying to run code on the arena frames that was written to run on the party frames, and the arena frames simply don't have the objects (child frames or textures) that the code expects. Based on the "b is nil" error you describe, I'd guess that the arena frames either don't have debuff icons at all, or their names don't follow the same pattern as the debuff icons on party frames. Likewise, I doubt that calling the "PartyMemberFrame_RefreshPetDebuffs" function will have any effect on any arena frames. You'd need to read through the default UI code that creates and updates the arena frames to figure out what objects they have and which functions they call. If they just don't have the objects you're trying to work with, you'd have to create them yourself.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » ArenaEnemyFrame buff display

Thread Tools
Display Modes

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