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,313
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,313
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
02-11-16, 12:31 PM   #7
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
ArenaFrames, maybe since the sides are always balanced. BossFrames on the other hand would have a problem with people going into older raids solo or duo depending on the encounter. For example, if 2 people start an encounter that shows 5 BossFrames, only 2 frames would be created since the header is still looking at the size of the raid group instead the number of BossFrames needed for an encounter.

Another problem is that the buttons themselves aren't shuffled around. The header builds a sorting list from its configuration and reassigns the unit for each button according to its list. This means UnitButton1 would be assigned the first in the list, UnitButton2 would be the second on the list, and so on. This would end up overwriting your initial configuration immediately and every time the group composition changes. Even if this were handled with a SecureHandlerAttributeTemplate watching the unit attribute, sorting would be completely disabled and filter settings may truncate the list occasionally.

This info is from looking at SecureGroupHeader_Update() and its local helper function configureChildren().
__________________
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)

Last edited by SDPhantom : 02-11-16 at 12:46 PM.
  Reply With Quote
02-11-16, 03:28 PM   #8
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by SDPhantom View Post
ArenaFrames, maybe since the sides are always balanced. BossFrames on the other hand would have a problem with people going into older raids solo or duo depending on the encounter. For example, if 2 people start an encounter that shows 5 BossFrames, only 2 frames would be created since the header is still looking at the size of the raid group instead the number of BossFrames needed for an encounter.

Another problem is that the buttons themselves aren't shuffled around. The header builds a sorting list from its configuration and reassigns the unit for each button according to its list. This means UnitButton1 would be assigned the first in the list, UnitButton2 would be the second on the list, and so on. This would end up overwriting your initial configuration immediately and every time the group composition changes. Even if this were handled with a SecureHandlerAttributeTemplate watching the unit attribute, sorting would be completely disabled and filter settings may truncate the list occasionally.

This info is from looking at SecureGroupHeader_Update() and its local helper function configureChildren().
For me it's seems like if you override the unit attribute the frame is always gonna handle that overwritten unit, and show/hide when the unit exists/nonexists just like the RegisterUnitWatch. The only win with this headers like this is that you can use a bunch of other useful attribues to sort/anchor/posotion/gap size the whole group without any hassle.

The sorting seems to be handled with the initially registered unit attribute, so it works properly even with the overridden units.

You can test it by yourself: https://github.com/Resike/Z-Perl2
Just overwrite this variable to true: https://github.com/Resike/Z-Perl2/bl...ZPerl2.lua#L58

If you also uncomment this line: https://github.com/Resike/Z-Perl2/bl...arty.lua#L1240
Then you have a alphabetically sorted party frame.

I written the party module yesterday, so there could be some possible flaws still.

Last edited by Resike : 02-11-16 at 03:39 PM.
  Reply With Quote
02-11-16, 06:42 PM   #9
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
I honestly don't have any way to test this in a raid environment. Hence why I've been going off how Blizzard's code would react to the suggested changes.

As the title of the topic said SecurePartyHeaderTemplate, I assumed you meant SecureGroupHeaderTemplate. Looking at your code, the only header template I see is SecureAuraHeaderTemplate.
__________________
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-12-16, 06:27 AM   #10
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by SDPhantom View Post
I honestly don't have any way to test this in a raid environment. Hence why I've been going off how Blizzard's code would react to the suggested changes.

As the title of the topic said SecurePartyHeaderTemplate, I assumed you meant SecureGroupHeaderTemplate. Looking at your code, the only header template I see is SecureAuraHeaderTemplate.
Each module is built up individually:
https://github.com/Resike/Z-Perl2/bl...arty.lua#L1225

Last edited by Resike : 02-12-16 at 06:29 AM.
  Reply With Quote
02-12-16, 12:22 PM   #11
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
I still don't see how it can work, but if you got it to, then there isn't much to be done. Without any way to stress test it, there's no way to tell how it'll fail even if it would. In order to put the code through its paces, we'll need to build up a raid of people and test moving people through different groups and mixed role settings (some set, some not). Unfortunately, I don't have access to enough people that'll be willing to stand around for hours on end while I debug code.
__________________
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-12-16, 05:08 PM   #12
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by SDPhantom View Post
I still don't see how it can work, but if you got it to, then there isn't much to be done. Without any way to stress test it, there's no way to tell how it'll fail even if it would. In order to put the code through its paces, we'll need to build up a raid of people and test moving people through different groups and mixed role settings (some set, some not). Unfortunately, I don't have access to enough people that'll be willing to stand around for hours on end while I debug code.
I did not test every scenario of course, but moving people around works at least. Also since OnAttributeChanged keeps the initially set unit (or nil) that means that all the sorting method should work without issues. I might do a deeper test when i'll have have more "testers" online.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SecurePartyHeaderTemplate

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