Edit: Although, I just noticed that you had got to the preventative measure but now need to control blizzards button.. best guess is to disbale the button before combat starts and restore it afterwards, similar to how I use my frames minimize button. Hopefully doing that minor change to blizzards button won't cause an issue.
I use the events that monitor regen ability and lock windows in place at that point that I don;t want being interacted with.
frame:RegisterEvent("PLAYER_REGEN_ENABLED")
frame:RegisterEvent("PLAYER_REGEN_DISABLED")
When regen is enabled, combat is finished and normal interaction is allowed, the opposite with disabled status.
When disabled I disable interactive buttons and enable them when regen is enabled again.
I also have an auto minimize/hide and maximize/show functionality that will change the frame to a more combat friendly shape and visibility and restore it back to its original status .. handy if you were in the middle of something and you were attacked.
This is an example from my MagePortals addon.
Lua Code:
frame:SetScript("OnEvent",function(self,event,...)
local args = { ... }
if event == "PLAYER_ENTERING_WORLD" then
frame:RegisterEvent("PLAYER_REGEN_ENABLED")
frame:RegisterEvent("PLAYER_REGEN_DISABLED")
elseif event == "PLAYER_REGEN_DISABLED" then
XMP_MinimizeButton_OnClick(frame.MinimizeButton,true)
XMP_Header.MinimizeButton:Disable()
XMP_Header.CloseButton:Disable()
elseif event == "PLAYER_REGEN_ENABLED" then
XMP_MinimizeButton_OnClick(frame.MinimizeButton,true)
XMP_Header.MinimizeButton:Enable()
XMP_Header.CloseButton:Enable()
end
end)
And this is the minimizebutton_onclick function showing how the auto command works.
Lua Code:
function XMP_MinimizeButton_OnClick(frame, auto)
-- Grab a local copy of the frame as we are using it alot here
local h = XMP_Header
-- If we are auto collapsing/expanding due to combat then check which action to do
if auto then
autoExecuted = false
-- If we are back after auto minimizing then maximize the frames
if h.autoMinimized then
XMP_Maximize(frame)
autoExecuted = true
-- Otherwise we are auto minimizing if it is maximized
elseif not h.isMinimized then
XMP_Minimize(frame)
autoExecuted = true
end
else
-- Handle manual collapse/expand
PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON);
if h.isMinimized then
XMP_Maximize(frame)
else
XMP_Minimize(frame)
end
end
h.autoMinimized = (auto and autoExecuted and h.isMinimized and true) or false
end