View Single Post
12-06-11, 04:51 PM   #16
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
I'm having problems with the raid aswell.

Using stuff like...
lua Code:
  1. for _, v in pairs({
  2.         CompactUnitFrame_UpdateVisible, CompactUnitFrame_UpdateAll,
  3.     }) do
  4.         v = function() return end
  5.     end
  6.  
  7.     for _, v in pairs({
  8.         _G["CompactRaidFrameContainer"],
  9.         _G["CompactRaidFrameManagerContainerResizeFrame"],
  10.     }) do
  11.         v:UnregisterAllEvents()
  12.         v.Show = function() return end
  13.         v:Hide()
  14.     end

is just bad gives you a taint in combat right away if your raid gets changed infight.

The thing is...I like the CombatRaidFrameManger and I want to keep it.

Using this will make the manager fade in on mouseover.
lua Code:
  1. --add fading to the raidframe manager (code by Alza)
  2.       local listener = CreateFrame("Frame")
  3.       listener.check = function(self, event, addon)
  4.         if(addon~="Blizzard_CompactRaidFrames") then return end
  5.         CompactRaidFrameManagerToggleButton:EnableMouse(false)
  6.         local man = CompactRaidFrameManager
  7.         man:SetAlpha(0)
  8.         man.container:SetParent(UIParent)
  9.         man:SetScript("OnMouseUp", CompactRaidFrameManager_Toggle)
  10.         man:SetScript("OnEnter", function(self)
  11.           if(self.collapsed) then
  12.             UIFrameFadeIn(man, .2, 0, 1)
  13.           end
  14.         end)
  15.         man:SetScript("OnLeave", function(self)
  16.           if(self.collapsed) then
  17.             UIFrameFadeOut(man, .2, 1, 0)
  18.           end
  19.         end)
  20.         self:UnregisterEvent(event)
  21.         self:SetScript("OnEvent", nil)
  22.       end
  23.       if(IsAddOnLoaded("Blizzard_CompactRaidFrames")) then
  24.         listener.check(listener, "ADDON_LOADED", "Blizzard_CompactRaidFrames")
  25.       else
  26.         listener:RegisterEvent("ADDON_LOADED")
  27.         listener:SetScript("OnEvent", listener.check)
  28.       end

Currently the best idea I'm having is to resize the CompactRaidFrame to a tiny little thing and to hide it once we get out of combat.

Basically Hide it by default. Secure hook the Show and if that is called we try to hide it and if we are in combat we just add register the REGEN_ENABLED event and disable the frame once we get out of combat again.

That is the only secure method I can think of.

I'm currently testing this
lua Code:
  1. --check the default raid and make it fade
  2.     local checkRaid = CreateFrame("Frame")
  3.  
  4.     local killRaid = function(self)
  5.       self:Hide()
  6.       self:UnregisterAllEvents()
  7.     end
  8.  
  9.     local hideRaid = function(self)
  10.       if not InCombatLockdown() then
  11.         killRaid(self)
  12.         print("crfc show got called, hide it again")--debug
  13.       else
  14.         print("crfc show got called but cannot hide raid atm, in combat")--debug
  15.         checkRaid:RegisterEvent("PLAYER_REGEN_ENABLED")
  16.       end
  17.     end
  18.  
  19.     checkRaid:RegisterEvent("PLAYER_LOGIN")
  20.     checkRaid:SetScript("OnEvent", function(self,event,...)
  21.       local crfc = _G["CompactRaidFrameContainer"]
  22.       if event == "PLAYER_LOGIN" then
  23.         if crfc then
  24.           crfc:SetScale(0.0001)
  25.           crfc:SetAlpha(0)
  26.           killRaid(crfc)
  27.           hooksecurefunc(crfc, "Show", hideRaid)
  28.         end
  29.       end
  30.       if event == "PLAYER_REGEN_ENABLED" then
  31.         if crfc and crfc:IsShown() then
  32.           killRaid(crfc)
  33.           self:UnregisterEvent("PLAYER_REGEN_ENABLED") --kill the event again
  34.           print("ooc now, hide raid")--debug
  35.         end
  36.       end
  37.     end)

*Edit*
It worked on first try (check chat outputs):

Works in combat aswell. No taint. A big plus is the raid manager which I actually like.

Test:
Code:
/run print(_G["CompactRaidFrameContainer"]:IsShown())
Not sure if I can actually call self:Hide() in the hooksecurefunc while being in combat without tainting.
__________________
| 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 : 12-06-11 at 06:13 PM.
  Reply With Quote