Quantcast
WoWInterface - View Single Post - How do I prevent a frame from showing during combat
View Single Post
10-21-19, 11:35 AM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,928
Originally Posted by LBXZero View Post
Right now, I don't know how to keep SpellBookFrame from showing during combat if requested to show.
You can use InCombatLockdown() to determine if protected frames are locked due to being in combat.
Code:
SpellBookFrame:HookScript("OnShow",function(self)
	if InCombatLockdown() then self:Hide(); end
end);
Alternatively, you can temporarily replace the frame:Show() and frame:SetShown() methods to nop() to catch and disable any attempt to show the spellbook and set them to nil afterward to restore functions. This works because the original functions are in the frame's metatable and are only accessed if the corresponding entry in the frame's own table doesn't exist.
__________________
ESOUI AddOns | 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