Quantcast
WoWInterface - View Single Post - Help on calling a switch function
View Single Post
04-03-15, 01:15 AM   #2
gmarco
A Frostmaul Preserver
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 290
For complete information I have tried also a more minimalist approach.

The relevant part of the code is this one:

Lua Code:
  1. local UnitAffectingCombat, InCombatLockdown = UnitAffectingCombat, InCombatLockdown
  2.  
  3. local function hide(self)
  4.         self:Hide()
  5. end
  6.  
  7. local function show(self)
  8.         self:Show()
  9. end
  10.  
  11.  
  12. local f = CreateFrame("Frame")
  13. f:SetScript("OnEvent", function ()
  14.  
  15.     if (UnitAffectingCombat("player") or UnitAffectingCombat("pet") or InCombatLockdown()) then
  16.                 hooksecurefunc(GameTooltip, "SetAction", hide)
  17.     else
  18.                 hooksecurefunc(GameTooltip, "SetAction", show);
  19.     end
  20.  
  21. end)
  22. f:RegisterEvent("ACTIONBAR_UPDATE_STATE")

but it correctly remove tooltips when I enter in combat but never put them back :-) when I exit from it :-)

Thanks again :-)
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote