View Single Post
03-25-14, 02:56 AM   #7
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Here is what I do for now:
Lua Code:
  1. if cfg.units.raid.show then
  2.  
  3.     --register style
  4.     oUF:RegisterStyle("diablo:raid", createStyle)
  5.     oUF:SetActiveStyle("diablo:raid")
  6.  
  7.     local attr = cfg.units.raid.attributes
  8.  
  9.     local raidDragFrame = CreateFrame("Frame", "oUF_DiabloRaidDragFrame", UIParent)
  10.     raidDragFrame:SetSize(50,50)
  11.     raidDragFrame:SetPoint(cfg.units.raid.pos.a1,cfg.units.raid.pos.af,cfg.units.raid.pos.a2,cfg.units.raid.pos.x,cfg.units.raid.pos.y)
  12.     func.applyDragFunctionality(raidDragFrame)
  13.     table.insert(oUF_Diablo_Units,"oUF_DiabloRaidDragFrame") --add frames to the slash command function
  14.  
  15.     local groups, group = {}, nil
  16.    
  17.     for i=1, NUM_RAID_GROUPS do
  18.       local name = "oUF_DiabloRaidGroup"..i
  19.       group = oUF:SpawnHeader(
  20.         name,
  21.         nil,
  22.         attr.visibility,
  23.         "showPlayer",         attr.showPlayer,
  24.         "showSolo",           attr.showSolo,
  25.         "showParty",          attr.showParty,
  26.         "showRaid",           attr.showRaid,
  27.         "point",              attr.point,
  28.         "yOffset",            attr.yOffset,
  29.         "xoffset",            attr.xoffset,
  30.         "groupFilter",        tostring(i),
  31.         "unitsPerColumn",     5,
  32.         --"unitsPerColumn",     attr.unitsPerColumn,
  33.         --"columnSpacing",      attr.columnSpacing,
  34.         --"columnAnchorPoint",  attr.columnAnchorPoint,
  35.         "oUF-initialConfigFunction", ([[
  36.           self:SetWidth(%d)
  37.           self:SetHeight(%d)
  38.         ]]):format(128, 64)
  39.       )
  40.       if i == 1 then
  41.         group:SetPoint("TOPLEFT",raidDragFrame,0,0)
  42.       else
  43.         if attr.columnAnchorPoint == "TOP" then
  44.           group:SetPoint("TOPLEFT", groups[i-1], "BOTTOMLEFT", 0, attr.columnSpacing)
  45.         elseif attr.columnAnchorPoint == "BOTTOM" then
  46.           group:SetPoint("BOTTOMLEFT", groups[i-1], "TOPLEFT", 0, attr.columnSpacing)
  47.         elseif attr.columnAnchorPoint == "LEFT" then
  48.           group:SetPoint("TOPLEFT", groups[i-1], "TOPRIGHT", attr.columnSpacing, 0)
  49.         else
  50.           group:SetPoint("TOPRIGHT", groups[i-1], "TOPLEFT", attr.columnSpacing, 0)
  51.         end
  52.       end
  53.       groups[i] = group
  54.     end
  55.  
  56.     local updateRaidScale = CreateFrame("Frame")
  57.     updateRaidScale:RegisterEvent("GROUP_ROSTER_UPDATE")
  58.     updateRaidScale:RegisterEvent("PLAYER_ENTERING_WORLD")
  59.     updateRaidScale:SetScript("OnEvent", function(self)
  60.       if(InCombatLockdown()) then
  61.         self:RegisterEvent("PLAYER_REGEN_ENABLED")
  62.       else
  63.         self:UnregisterEvent("PLAYER_REGEN_ENABLED")
  64.         local num = GetNumGroupMembers()
  65.         local scale = (100-num)/100*cfg.units.raid.scale
  66.         for idx, group in pairs(groups) do
  67.           if group then
  68.             group:SetScale(scale)
  69.           end
  70.         end
  71.       end
  72.     end)    
  73.    
  74.   end

So I check for out of combat and do my adjustments if needed.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 03-25-14 at 03:05 AM.
  Reply With Quote