How do I prevent a frame from showing during combat
Currently, I have an addon that directly modifies the behavior of Blizzard's Spellbook to filter what spells are shown. Due to nature of operation, I can't avoid tainting it.
I have gotten around most problems trying to match the normal Spellbook's operation while providing a filtered spell list. The only problem left is if the spellbook is open during combat. After some trial and error, the simplest solution is to close the spellbook at the start of combat (done) and keep it from opening during combat.
Right now, I don't know how to keep SpellBookFrame from showing during combat if requested to show.
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.
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.
And this is the minimizebutton_onclick function showing how the auto command works.
I will try the "nop()" method first. I prefer simple solutions. If that doesn't stop the spellbook from opening during combat, then I will have to disable keybindings and the Blizzard button.
I already tried having "self:Hide()" in the "OnShow" script. The spellbook still shows after the script is ran.
I found a method that works, after a little epiphany...
First, I can't reassign the function for Show() for the specific frame. It became a script error, probably due to the nature of the function.
Trying to Hook a Script or modify the OnShow script to hide the frame, the OnShow Script and the HookScript() attachment run prior to setting the frame to show, so the frame will show.
I didn't try disabling the WoW UI button to open the Spellbook. The reason is that I will also have to disable the key binding, which involves a protected function that I doubt works in a restricted environment.
What I forgot, if the parent frame is hidden, the child frames are hidden regardless if shown. Therefore, I have a blank frame that will always stay hidden set to be SpellBookFrame's parent when PLAYER_REGEN_DISABLED and then restore SpellBookFrame's parent to UIParent when PLAYER_REGEN_ENABLED. This works.
|All times are GMT -6. The time now is 10:36 PM.|
vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI