Thread Tools Display Modes
02-25-10, 12:30 PM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Party frames in arena

Is there an obvious reason why my party frames do not show up in arenas?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
02-25-10, 01:22 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Do you have them set to hide when in raid?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-26-10, 09:50 AM   #3
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
i have party frames set to hide in raid. Well actually... my code checks to see what the blizzard option is set to to decide that... but i always have mine checked to hide them in raid. When you are in the arena it thinks you are in a raid?

My party frames have some issues with hiding and showing properly all the time in general. like for some reason when you queue for wintersgrasp it does not hide the party frames like its supposed to. You have to /reload to get it to register but yet if you are in a party and the party leader shifts it to a raid it changes up just fine. I have PLAYER_ENTERING_WORLD set as one of the events to check against so i would think it would fire when entering wintersgrasp and fix the party frames. But it does not...

I had a problem with the party frames not showing up after being in a raid and everyone dropping from a dungeon. I think i fixed that although im sure if you were to drop raid while in combat it would fire taint since my fix was not secure code.

Also have a funny issue with the party leader icons, if you go to a random with a friend and you finish the random if you both stay partied and everyone else drops and you leave the dungeon it for some reason thinks you are both the party leader and the leader icon gets stuck. Only does this for party member 1. The other ones seem to function right when this same scenario is recreated.

IE having 3 friends... its only partyframe 1 that gets the leader icon stuck. partyframe 2's leader icon functions proper.

I would post my partyframes code but..... i wouldnt expect anyone to look through it its almost 12000 lines... - edit: i take that back its about 6000 lines and thats with most of the 2nd layout missing and no petframes for either layout....
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 02-26-10 at 09:58 AM.
  Reply With Quote
02-26-10, 09:55 AM   #4
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
partyframes

i weeded out the parts that deal with the hiding/showing

lua Code:
  1. -----------------------------------------
  2. ---- hide party frames in raid Start ----
  3. -----------------------------------------
  4.  
  5. local RaidPartyHandler = CreateFrame("Frame", "RaidPartyHandler", UIParent, "SecureHandlerStateTemplate");
  6. SecureHandler_OnLoad(RaidPartyHandler);
  7. GrimUI.RaidPartyHandler = RaidPartyHandler
  8.  
  9. GrimPartyMain = CreateFrame("Frame", nil, RaidPartyHandler);
  10. GrimUI.GrimPartyMain = GrimPartyMain
  11.  
  12.  
  13. RaidPartyHandler:SetFrameRef("GrimPartyMain", GrimPartyMain);
  14.  
  15. RaidPartyHandler:Execute([[
  16. GrimPartyMain = self:GetFrameRef("GrimPartyMain");
  17. ]]);
  18.  
  19. RaidPartyHandler:Execute("raidhideparty = " .. tostring(GetCVar("hidePartyInRaid"))); -- hook to Blizzard option for party raid hide frames
  20.  
  21.  
  22. RaidPartyHandler:SetAttribute("_onstate-unitexists", [[
  23.     if raidhideparty == 1 and newstate then
  24.     GrimPartyMain:Hide()
  25.     end
  26.     if raidhideparty ~= 1 and newstate then
  27.     GrimPartyMain:Show()
  28.     end
  29. ]]);
  30.  
  31. RaidPartyHandler:SetAttribute("unit", "raid1");
  32. RegisterUnitWatch(RaidPartyHandler, true);
  33.  
  34.  
  35.  
  36. RaidPartyHandler:SetAttribute("state-unitexists", UnitExists("raid1"));
  37.  
  38. -----------------------------------------
  39. ---- hide party frames in raid End   ----
  40. -----------------------------------------
  41.  
  42. ---------------------------------------
  43. -- show them again when you leave it heh....
  44. ----------------------------------------------
  45. local ReshowPartyFrames = CreateFrame("Frame", nil, UIParent)
  46. ReshowPartyFrames:RegisterEvent("RAID_ROSTER_UPDATE")
  47. ReshowPartyFrames:RegisterEvent("PLAYER_ENTERING_WORLD")
  48.  
  49. GrimUI.ReshowPartyFrames = ReshowPartyFrames
  50.  
  51. ReshowPartyFrames:SetScript("OnEvent", function(self)
  52.    
  53.     local StillInRaid = UnitExists("raid1")
  54.    
  55.     if event == "PLAYER_ENTERING_WORLD" and StillInRaid ~= 1 then
  56.     GrimPartyMain:Show()
  57.     end
  58.    
  59.    
  60.     if StillInRaid ~= 1 then
  61.     GrimPartyMain:Show()
  62.     end
  63.  
  64. end)
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
02-26-10, 03:46 PM   #5
Shadowed
...
Premium Member
Featured
Join Date: Feb 2006
Posts: 387
There's a simpler way of doing it. You don't need to muck around with the secure system as much: partyFrame is the secure header that shows the party frame.

lua Code:
  1. local stateMonitor = CreateFrame("Frame", nil, nil, "SecureHandlerBaseTemplate")
  2.         stateMonitor:SetFrameRef("partyHeader", partyFrame)
  3.         stateMonitor:WrapScript(stateMonitor, "OnAttributeChanged", [[
  4.             if( name ~= "state-raidmonitor" ) then return end
  5.            
  6.             if( self:GetAttribute("state-raidmonitor") == "raid" ) then
  7.                 self:GetFrameRef("partyHeader"):Hide()
  8.             else
  9.                 self:GetFrameRef("partyHeader"):Show()
  10.             end
  11.         ]])
  12.         RegisterStateDriver(stateMonitor, "raidmonitor", "[target=raid1, exists] raid; none")

That is a simplified version of what Shadowed Unit Frames does, https://gist.github.com/6323ba8bb2a9a4365413 is the full version which let's me do things like modify the stateMonitors attributes to decide whether or not I want the feature enabled.

You have to WrapScript before you call RegisterStateDriver, because as soon as you call RegisterStateDriver it's going to check the state and it'll switch to raid (or none) before your attribute event is setup.
  Reply With Quote
02-26-10, 05:15 PM   #6
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
so wait what your saying is i can hook my party frames to partyFrame? and use that stateheader to control the party frames? and it will register the bliz option as well?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
02-26-10, 05:27 PM   #7
Shadowed
...
Premium Member
Featured
Join Date: Feb 2006
Posts: 387
lua Code:
  1. -- Create our party frame header
  2. local headerFrame = CreateFrame("Frame", "FooBarHeader", UIParent, "SecureGroupHeaderTemplate")
  3. -- Create our state monitor
  4. local stateMonitor = CreateFrame("Frame", nil, nil, "SecureHandlerBaseTemplate")
  5. -- Set a frame ref so the state monitor can access the party frames
  6. stateMonitor:SetFrameRef("partyHeader", partyFrame)
  7. -- Wrap a bit of secure code around OnAttributeChanged so we can execute the code below while in combat, without causing errors
  8. stateMonitor:WrapScript(stateMonitor, "OnAttributeChanged", [[
  9.     -- If any other attributes fired this event, don't go any further, we don't care about them
  10.     if( name ~= "state-raidmonitor" and name ~= "disable-hide" ) then return end
  11.  
  12.     -- If the player is in a raid and the auto hiding isn't disabled, hide the party frames
  13.     if( self:GetAttribute("state-raidmonitor") == "raid" and not self:GetAttribute("disable-hide") ) then
  14.         self:GetFrameRef("partyHeader"):Hide()
  15.     -- If the player player is not in a raid, or party frames shouldn't be hidden while in a raid, show the party frames   
  16.     else
  17.         self:GetFrameRef("partyHeader"):Show()
  18.     end]])
  19. -- Setup a state driver that will set the "state-raidmonitor" attribute based on if we are in a raid (raid1 exists).
  20. RegisterStateDriver(stateMonitor, "raidmonitor", "[target=raid1, exists] raid; none")

If you wanted to disable hiding the party frames in a raid, you would do stateMonitor:SetAttribute("disable-hide", true) this would also handle reshowing the party frames.
  Reply With Quote
02-27-10, 04:48 AM   #8
Dayve
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 15
Originally Posted by Shadowed View Post
There's a simpler way of doing it. You don't need to muck around with the secure system as much: partyFrame is the secure header that shows the party frame.
Both versions use secure code to respond to a state attribute change, but Grimsin's method (which is my old method that I told him about) uses UnitWatch to set the state while yours uses a state driver. What is simpler is this method which I started using recently:
lua Code:
  1. RegisterStateDriver(partyFrame, "visibility", "[@raid1,exists]hide;show");
That will enable in-raid hiding on partyFrame, no other code required. And to disable it after having been enabled:
lua Code:
  1. UnregisterStateDriver(partyFrame, "visibility");
  2. partyFrame:Show();
  Reply With Quote
02-27-10, 05:27 AM   #9
Shadowed
...
Premium Member
Featured
Join Date: Feb 2006
Posts: 387
Mmm, I'd have to dig through comments. Pretty sure there was a reason why I used a unit watch over visibility thought. But that would also work.

Last edited by Shadowed : 02-27-10 at 05:30 AM.
  Reply With Quote
02-28-10, 02:42 PM   #10
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
im confused...

So both of those methods should show/hide partyframes in raid according to the blizzard option selected? and of course reshow them after leaving a raid?

And would either and/or fix the fact partyframes do not show up in arenas?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
02-28-10, 09:45 PM   #11
Dayve
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 15
The problem you had with the party frames not reshowing was due to a logic error:
lua Code:
  1. RaidPartyHandler:SetAttribute("_onstate-unitexists", [[
  2.     if raidhideparty == 1 and newstate then
  3.     GrimPartyMain:Hide()
  4.     end
  5.     if raidhideparty ~= 1 and newstate then
  6.     GrimPartyMain:Show()
  7.     end
  8. ]]);
Should be:
lua Code:
  1. RaidPartyHandler:SetAttribute("_onstate-unitexists", [[
  2.     if raidhideparty == 1 and newstate then
  3.         GrimPartyMain:Hide()
  4.     else
  5.         GrimPartyMain:Show()
  6.     end
  7. ]]);
If you want to use the other method I posted just now, then you only need to create 'GrimPartyMain' and then use this to apply the user setting:
lua Code:
  1. if GetCVarBool("hidePartyInRaid") then
  2.     RegisterStateDriver(GrimPartyMain, "visibility", "[@raid1,exists]hide;show");
  3. else
  4.     UnregisterStateDriver(GrimPartyMain, "visibility");
  5.     GrimPartyMain:Show();
  6. end
As for the arena problem, the reason the party frames are hiding is because when you are in an arena you really are in a raid, so there's really no bug occurring there. If you wish the party frames to remain shown you need to force the hiding behavior off when entering an arena instance and reapply the user setting when leaving; try watching for PLAYER_ENTERING_WORLD and grab instance type with IsInInstance().
  Reply With Quote
03-01-10, 09:48 AM   #12
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
well im sure im going to try the other method you posted since what i had at first even with the change you just posted has issues. like if i change the logic, which btw the logic change you posted now is how i had it at first, then it does not show back up when leaving a raid. Also the way i did it had other problems like the one when queuing for winters grasp when it loaded you to WG and formed the raid the party frames got stuck no mater what. When dropping from a raid the party frames would not show back up either. Not with out that unsecure code i added which is a problem in itself. OOH and almost forgot to mention... my method requires a reload once you get into the raid sometimes....for some reason....
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-01-10, 10:28 AM   #13
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
oh another issue i forgot about... if you select the show/hide party frames in raid option in the bliz options it requires a reload to register it with my code...
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-01-10, 10:36 AM   #14
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Okay trying your method just noticed an issue, the get cvar that has to have something to say is = to or not = to on it since doing the getcvar on that will return a number? i think im still confused to, so your saying i only need to do the createframe for "GrimPartyMain" and i can ditch the rest of the code? i still need a setattrib on something with something for it to run the if statement from right? some sort of event?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-01-10, 11:47 AM   #15
Dayve
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 15
Originally Posted by Grimsin View Post
Okay trying your method just noticed an issue, the get cvar that has to have something to say is = to or not = to on it since doing the getcvar on that will return a number?
GetCVarBool() returns either 1 or nil which evaluate to true and false respectively, so it can be used directly in an 'if' statement.
Originally Posted by Grimsin View Post
i think im still confused to, so your saying i only need to do the createframe for "GrimPartyMain" and i can ditch the rest of the code?
Yes.
Originally Posted by Grimsin View Post
i still need a setattrib on something with something for it to run the if statement from right? some sort of event?
No. The state driver code will automatically show/hide 'GrimPartyMain'.

The requirement for a UI reload comes about because you are only checking the CVar value while the addon is loading; to reflect the user option in real time you need to watch for CVar changes and reapply the setting when "hidePartyInRaid" changes.
  Reply With Quote
03-01-10, 11:59 AM   #16
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
The response to cvar changes would then also need to be in secure code correct? in case someone does it in combat....

hmm or are the bliz options locked down in combat?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 03-01-10 at 12:06 PM.
  Reply With Quote
03-01-10, 12:31 PM   #17
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Well assuming the cvars lock down in combat and assuming you cant go into an arena while in combat... this all appears to be working so far.

lua Code:
  1. GrimPartyMain = CreateFrame("Frame", "GrimPartyMain", UIParent, "SecureHandlerStateTemplate");
  2. GrimUI.GrimPartyMain = GrimPartyMain
  3.  
  4.  
  5. if GetCVarBool("hidePartyInRaid") then
  6.  
  7. RegisterStateDriver(GrimPartyMain, "visibility", "[@raid1,exists]hide;show");
  8.  
  9. else
  10.  
  11. UnregisterStateDriver(GrimPartyMain, "visibility");
  12. GrimPartyMain:Show();
  13. end
  14.  
  15. ShowArenaParty = CreateFrame("Frame", "ShowArenaParty", UIParent, "SecureHandlerStateTemplate");
  16. GrimUI.ShowArenaParty = ShowArenaParty
  17. ShowArenaParty:RegisterEvent("PLAYER_ENTERING_WORLD")
  18. ShowArenaParty:SetScript("OnEvent", function(self)
  19.     local inInstance, instanceType = IsInInstance()
  20.     if inInstance == 1 and instanceType == "arena" then
  21.     GrimPartyMain:Show();
  22.     end
  23. end)
  24.  
  25. UpdatePartyCVar = CreateFrame("Frame", "UpdatePartyCVar", UIParent, "SecureHandlerStateTemplate");
  26. UpdatePartyCVar:RegisterEvent("CVAR_UPDATE")
  27. UpdatePartyCVar:SetScript("OnEvent", function(self)
  28.  
  29.     if GetCVarBool("hidePartyInRaid") then
  30.  
  31.     RegisterStateDriver(GrimPartyMain, "visibility", "[@raid1,exists]hide;show");
  32.  
  33.     else
  34.  
  35.     UnregisterStateDriver(GrimPartyMain, "visibility");
  36.     GrimPartyMain:Show();
  37.     end
  38. end)
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-02-10, 12:56 AM   #18
Dayve
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 15
CVars are not secure in any way; consequently they can change in combat and there is no way for you to write secure code to respond to it. Check InCombatLockdown() when you get CVAR_UPDATE; if in combat then delay response until combat ends.
  Reply With Quote
03-02-10, 06:14 AM   #19
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
hmm how would you delay until combat ends though? use the Regen enabled event?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-02-10, 06:44 AM   #20
Dayve
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 15
Yes, that should work.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Party frames in arena


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