Thread Tools Display Modes
02-10-16, 01:39 PM   #1
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
SecurePartyHeaderTemplate

Is it possible to create a party frame with this template which always shows your group?
I have tried to mess around with the attributes, but no luck so far.

I would need something like this but securely:

Lua Code:
  1. local playerGroup
  2. for i = 1, GetNumGroupMembers() do
  3.     local name, _, subgroup = GetRaidRosterInfo(i)
  4.     if (name == UnitName("player")) then
  5.         playerGroup = subgroup
  6.         break
  7.     end
  8. end
  9.  
  10. self.header:SetAttribute("groupFilter", tostring(playerGroup))

Last edited by Resike : 02-10-16 at 02:26 PM.
  Reply With Quote
02-10-16, 04:03 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
I could be wrong, but don't the PartyX UnitIDs point to raid members in your group?
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
02-10-16, 04:08 PM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by SDPhantom View Post
I could be wrong, but don't the PartyX UnitIDs point to raid members in your group?
Yeah, they do. But the main issue here is that if you don't filter the header, then it's gonna start from index 1, and it will always show the first party while in raid.

I managed to hack in to the initialConfigFunction like this:

Lua Code:
  1. self.header:SetAttribute("initialConfigFunction", [[
  2.         local header = self:GetParent()
  3.  
  4.         self:SetAttribute("unit", "party"..strmatch(self:GetName(), "UnitButton(%d)"))
  5.  
  6.         self:SetFrameStrata("Low")
  7.  
  8.         self:SetHeight(header:GetAttribute("style-height"))
  9.         self:SetWidth(header:GetAttribute("style-width"))
  10.         self:SetScale(header:GetAttribute("style-scale"))
  11.  
  12.         self:SetAttribute("maxColumns", 1)
  13.         self:SetAttribute("unitsPerColumn", 5)
  14.         self:SetAttribute("toggleForVehicle", true)
  15.  
  16.         self:SetAttribute("*type1", "target")
  17.         self:SetAttribute("type2", "togglemenu")
  18.  
  19.         self:SetAttribute("isHeaderDriven", true)
  20.  
  21.         header:CallMethod("initialConfigFunction", self:GetName())
  22.     ]])

I'm just not sure how valid is this solution, still testing.

The main goal would be to properly show the player's party when in raid too.

Last edited by Resike : 02-10-16 at 04:26 PM.
  Reply With Quote
02-10-16, 06:00 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
The easiest way I can think of is to just create a static number of party frames. Changing the UnitFrame's unit after it's created may cause problems as the SecureGroupHeader will still create frames and rearrange them based on its own settings.

There is a quirk that I spotted looking at Blizzard's code. They use IsInGroup() to check if the player is in a party and from what I can dig up, should return true if in a raid as well. They don't have any seperate check in the same section to see if you're in a raid. This means if you only set the showParty attribute, it should pop up with your group in raid.

This is all in theory, don't be surprised if it doesn't work.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
02-10-16, 07:01 PM   #5
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by SDPhantom View Post
The easiest way I can think of is to just create a static number of party frames. Changing the UnitFrame's unit after it's created may cause problems as the SecureGroupHeader will still create frames and rearrange them based on its own settings.

There is a quirk that I spotted looking at Blizzard's code. They use IsInGroup() to check if the player is in a party and from what I can dig up, should return true if in a raid as well. They don't have any seperate check in the same section to see if you're in a raid. This means if you only set the showParty attribute, it should pop up with your group in raid.

This is all in theory, don't be surprised if it doesn't work.
It's weird but it works. Tho i have to control the header's visibility manually after i force set the unit attribute, but thats not a biggy. But everything else works fine. The reason that i would like to keep the party as a secure header too, because it's much easier to arrange the frames colums/rows, horizontal/vertical party and stuff like that. Also all the other sorting method works fine like sort by name/role/class etc, which would be a pain in the ass to code with normal secure frames.

If i only use the showParty attribute the party header works fine, because it only shows up in a party and while in a party there is only one group. But i would like to give the user an option to keep the party frame shown even while in raid.

IsInGroup() could work perfectly fine if there is an IsInRaid() before it in a if-else/or statement.

Last edited by Resike : 02-10-16 at 07:09 PM.
  Reply With Quote
02-11-16, 09:30 AM   #6
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
The intresting part is that i might be able to also create arena and boss frames with this method too.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SecurePartyHeaderTemplate


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