Thread Tools Display Modes
11-28-15, 12:56 PM   #1
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
SecureGroupHeaders

I would like to create a standard 8x5 raid frame with secure headers which keeps the groups together instread of filling the missing buttons.
I know it is possible with the default raid frame, however i could not find how does it works. It is a special atrribute i need to apply or do i need to create a new group header for every group?
Any help would come handy.
  Reply With Quote
11-28-15, 01:25 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
This page lists group header attributes, you're probably interested in setting "groupBy" to "GROUP".
  Reply With Quote
11-28-15, 04:10 PM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by semlar View Post
This page lists group header attributes, you're probably interested in setting "groupBy" to "GROUP".
Thats sadly only for sorting, i would like to keep the empty spaces between the frames if they are not in the same group.
  Reply With Quote
11-28-15, 04:18 PM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Resike View Post
Thats sadly only for sorting, i would like to keep the empty spaces between the frames if they are not in the same group.
Make multiple headers, filter each by group, only showing one group per header.
  Reply With Quote
11-28-15, 08:25 PM   #5
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by p3lim View Post
Make multiple headers, filter each by group, only showing one group per header.
Yeah, that was i was afraid, i hoped i could just apply a simple attribte to auto do this.
  Reply With Quote
11-28-15, 09:19 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Not "auto do" but couldn't you use:

Header:SetAttribute("sortMethod", "NAMELIST")

("NAMELIST" isn't mentioned on the wowProgramming page as a "sortMethod" option)

Sort YourNameList by group with spaces in the appropriate places.

Header:SetAttribute("nameList", YourNameList)

I haven't tried it (the spaces/blank names/"").

Just a thought.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 11-29-15 at 01:58 AM.
  Reply With Quote
11-29-15, 08:53 PM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Fizzlemizz View Post
Not "auto do" but couldn't you use:

Header:SetAttribute("sortMethod", "NAMELIST")

("NAMELIST" isn't mentioned on the wowProgramming page as a "sortMethod" option)

Sort YourNameList by group with spaces in the appropriate places.

Header:SetAttribute("nameList", YourNameList)

I haven't tried it (the spaces/blank names/"").

Just a thought.
I don't think it would do what i need, seems like this is just a custom sorting method.
  Reply With Quote
11-30-15, 12:59 AM   #8
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Originally Posted by Resike View Post
I don't think it would do what i need, seems like this is just a custom sorting method.
That it is.

I asumed if Blizzard didn't provide what you wanted out of the box and multiple group headers weren't your ideal either, a custom sorting option might be what you're looking for.

As I said, just a thought. More qualified minds might have better ideas.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 11-30-15 at 02:24 AM.
  Reply With Quote
11-30-15, 04:42 AM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Fizzlemizz View Post
That it is.

I asumed if Blizzard didn't provide what you wanted out of the box and multiple group headers weren't your ideal either, a custom sorting option might be what you're looking for.

As I said, just a thought. More qualified minds might have better ideas.
Yeah, thanks, seems like i need to go with the multiple headers. But this method is usable too, if you want to exclude everyone in the raid who has "swag" in their name.
  Reply With Quote
11-30-15, 09:58 AM   #10
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
The problem with name thingy I believe, is that you need to then update the attribute as the group roster changes, which you can't do in combat.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
11-30-15, 01:07 PM   #11
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
I have tried to do the seperate header thing, however the header is still filling the empty spaces in the groups for some reason:



Here is my full work in progress code:

Lua Code:
  1. local Raid = { }
  2.  
  3. local roleColors = {
  4.     TANK    = {0.2, 0.2, 0.8},
  5.     HEALER  = {0, 0.7, 0},
  6.     DAMAGER = {0.7, 0, 0},
  7.     NONE    = {0.7, 0.7, 0.7},
  8. }
  9.  
  10. local function CreateUnitFrame(header, frameName)
  11.     local frame = _G[frameName]
  12.  
  13.     frame:RegisterForClicks("AnyUp")
  14.  
  15.     frame.bg = frame.bg or frame:CreateTexture(nil, "BACKGROUND")
  16.     frame.bg:SetAllPoints()
  17.     frame.role = frame.role or frame:CreateTexture()
  18.     frame.role:SetSize(8, 8)
  19.     frame.role:SetPoint("TOPLEFT")
  20.  
  21.     frame:SetScript("OnAttributeChanged", function(self, name, value)
  22.         if name == "unit" then
  23.             if value then
  24.                 Raid:UpdateDisplay(self)
  25.             end
  26.         end
  27.     end)
  28.  
  29.     --[[frame:SetScript("OnEvent", function(self)
  30.        
  31.     end)]]
  32.  
  33.     frame:SetScript("OnEnter", function(self)
  34.         GameTooltip:SetOwner(self, "ANCHOR_LEFT")
  35.         if self.unit then
  36.             GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
  37.             GameTooltip:SetUnit(self.unit)
  38.             if UnitIsPlayer(self.unit) then
  39.                 local class, classFileName = UnitClass(self.unit)
  40.                 local color = RAID_CLASS_COLORS[classFileName]
  41.                 GameTooltipTextLeft1:SetTextColor(color.r, color.g, color.b, 1)
  42.             else
  43.                 local r, g, b, a = UnitSelectionColor(unit)
  44.                 GameTooltipTextLeft1:SetTextColor(r, g, b, 1)
  45.             end
  46.             GameTooltip:Show()
  47.         end
  48.     end)
  49.     frame:SetScript("OnLeave", GameTooltip_Hide)
  50.  
  51.     --[[frame:HookScript("OnShow", function(self)
  52.        
  53.     end)
  54.     frame:HookScript("OnHide", function(self)
  55.        
  56.     end)]]
  57.  
  58.     return frame
  59. end
  60.  
  61. function Raid:OnLoad()
  62.     self.events = CreateFrame("Frame")
  63.     self.events:SetScript("OnEvent", function(self, event, ...)
  64.         --print(event, ...)
  65.         Raid[event](Raid, ...)
  66.     end)
  67.  
  68.     --[[self.update = CreateFrame("Frame")
  69.     self.update:SetScript("OnUpdate", function(self, elapsed)
  70.         Raid:OnUpdate(self, elapsed)
  71.     end)]]
  72.  
  73.     self.headers = { }
  74.  
  75.     local start = 1
  76.     for i = 1, 8 do
  77.         self.headers[i] = CreateFrame("Frame", "ZPerl2RaidGroup"..i, UIParent, "SecureRaidGroupHeaderTemplate")
  78.         if i == 1 then
  79.             self.headers[i]:SetPoint("Left", UIParent, "Left", 20, 0)
  80.         else
  81.             self.headers[i]:SetPoint("TopLeft", self.headers[i - 1], "TopRight", 0, 0)
  82.         end
  83.  
  84.         self.headers[i]:SetAttribute("showRaid", true)
  85.         if i == 1 then
  86.             self.headers[i]:SetAttribute("showParty", true)
  87.             self.headers[i]:SetAttribute("showPlayer", true)
  88.         end
  89.         --self.headers[i]:SetAttribute("useparent-unit", true)
  90.         --self.headers[i]:SetAttribute("strictFiltering", nil)
  91.         self.headers[i]:SetAttribute("startingIndex", start)
  92.         self.headers[i]:SetAttribute("maxColumns", 1)
  93.         self.headers[i]:SetAttribute("unitsPerColumn", 5)
  94.  
  95.         self.headers[i]:SetAttribute("sortMethod", nil)
  96.  
  97.         self.headers[i]:SetAttribute("minWidth", 0)
  98.         self.headers[i]:SetAttribute("minHeight", 0)
  99.  
  100.         self.headers[i]:SetAttribute("xOffset", 0)
  101.         self.headers[i]:SetAttribute("yOffset", 0)
  102.         self.headers[i]:SetAttribute("point", "TOP")
  103.  
  104.         self.headers[i]:SetAttribute("columnSpacing", 1)
  105.         self.headers[i]:SetAttribute("columnAnchorPoint", "LEFT")
  106.  
  107.         --self.headers[i]:SetAttribute("groupBy", "ASSIGNEDROLE")
  108.         --self.headers[i]:SetAttribute("groupingOrder", "TANK,HEALER,DAMAGER,NONE")
  109.         self.headers[i]:SetAttribute("groupBy", "GROUP")
  110.         self.headers[i]:SetAttribute("groupingOrder", "1,2,3,4,5,6,7,8")
  111.  
  112.         self.headers[i]:SetAttribute("template", "SecureUnitButtonTemplate")
  113.  
  114.         self.headers[i]:SetAttribute("initial-unitWatch", true)
  115.  
  116.         self.headers[i]:SetAttribute("style-width", 50)
  117.         self.headers[i]:SetAttribute("style-height", 25)
  118.         self.headers[i]:SetAttribute("style-scale", 1)
  119.  
  120.         self.headers[i]:SetID(i)
  121.  
  122.         self.headers[i]:SetAttribute("initialConfigFunction", [[
  123.             local header = self:GetParent()
  124.  
  125.             self:SetHeight(header:GetAttribute("style-height"))
  126.             self:SetWidth(header:GetAttribute("style-width"))
  127.             self:SetScale(header:GetAttribute("style-scale"))
  128.  
  129.             self:SetAttribute("maxColumns", 1)
  130.             self:SetAttribute("unitsPerColumn", 5)
  131.             self:SetAttribute("toggleForVehicle", true)
  132.  
  133.             self:SetAttribute("*type1", "target")
  134.             self:SetAttribute("type2", "togglemenu")
  135.  
  136.             self:SetAttribute("isHeaderDriven", true)
  137.  
  138.             header:CallMethod("initialConfigFunction", self:GetName())
  139.         ]])
  140.  
  141.         self.headers[i].initialConfigFunction = CreateUnitFrame
  142.  
  143.         self.headers[i]:Show()
  144.  
  145.         start = start + 5
  146.     end
  147.  
  148.     self:RegisterEvents()
  149. end
  150.  
  151. function Raid:RegisterEvents()
  152.     local events = {
  153.         "PLAYER_ENTERING_WORLD",
  154.         --"GROUP_ROSTER_UPDATE",
  155.         "ROLE_CHANGED_INFORM",
  156.     }
  157.  
  158.     for i = 1, #events do
  159.         local event = events[i]
  160.         self.events:RegisterEvent(event)
  161.     end
  162. end
  163.  
  164. function Raid:PLAYER_ENTERING_WORLD()
  165.     self:UpdateDisplayAll()
  166. end
  167.  
  168. function Raid:GROUP_ROSTER_UPDATE()
  169.     self:UpdateDisplayAll()
  170. end
  171.  
  172. function Raid:GUILD_PARTY_STATE_UPDATED()
  173.     self:UpdateDisplayAll()
  174. end
  175.  
  176. function Raid:ROLE_CHANGED_INFORM()
  177.     self:UpdateDisplayAll()
  178. end
  179.  
  180. function Raid:UpdateDisplay(frame)
  181.     local unit = frame:GetAttribute("unit")
  182.     if unit then
  183.         local guid = UnitGUID(unit)
  184.         --if guid ~= frame.guid then
  185.             frame.unit = unit
  186.             frame.guid = guid
  187.             if unit then
  188.                 local _, class = UnitClass(unit)
  189.                 local classColor = RAID_CLASS_COLORS[class]
  190.                 if classColor then
  191.                     frame.bg:SetTexture(classColor.r, classColor.g, classColor.b)
  192.                 end
  193.                 frame.role:SetTexture(unpack(roleColors[UnitGroupRolesAssigned(unit)]))
  194.             end
  195.         --end
  196.     end
  197. end
  198.  
  199. function Raid:UpdateDisplayAll()
  200.     for i = 1, 8 do
  201.         for _, frame in ipairs(self.headers[i]) do
  202.         --for j = 1, 5 do
  203.             --local frame = self.headers[i]:GetAttribute("child"..j)
  204.             if frame then
  205.                 local unit = frame:GetAttribute("unit")
  206.                 frame.unit = unit
  207.                 --local guid = UnitGUID(unit)
  208.                 --frame.guid = guid
  209.                 if unit then
  210.                     local _, class = UnitClass(unit)
  211.                     local classColor = RAID_CLASS_COLORS[class]
  212.                     if classColor then
  213.                         frame.bg:SetTexture(classColor.r, classColor.g, classColor.b)
  214.                     end
  215.                     frame.role:SetTexture(unpack(roleColors[UnitGroupRolesAssigned(unit)]))
  216.                 end
  217.             end
  218.         end
  219.     end
  220. end
  221.  
  222. Raid:OnLoad()

Last edited by Resike : 11-30-15 at 01:10 PM.
  Reply With Quote
11-30-15, 01:20 PM   #12
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
I think you should be setting "groupFilter" to "1" through "8", so it knows you only want to display players from that group.
  Reply With Quote
11-30-15, 04:29 PM   #13
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by semlar View Post
I think you should be setting "groupFilter" to "1" through "8", so it knows you only want to display players from that group.
I have tried this and it's seems to be working for the first header, however the other ones are not showing up at all.

Lua Code:
  1. self.headers[i]:SetAttribute("groupFilter", tostring(i))

Edit: I got it now, startingIndex needs to be 1 for all the headers when a groupFilter is applied.

Last edited by Resike : 11-30-15 at 04:33 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SecureGroupHeaders

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