View Single Post
04-03-15, 08:40 AM   #5
sticklord
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 57
When you repeatedly call hooksecurefunc you will hook the function alot of times, it doesn't overwrite the earlier hooks. I'm not sure what order they're called in but it isn't a good way to do it anyways. I'd do something like:

Lua Code:
  1. local IN_COMBAT
  2.  
  3. hooksecurefunc(GameTooltip, "SetAction", function(self)
  4.     if (IN_COMBAT) then
  5.         self:Hide()
  6.     end
  7. end)
  8.  
  9. local f = CreateFrame("Frame")
  10. f:SetScript("OnEvent", function(self, event, ...)
  11.     if event == "PLAYER_REGEN_DISABLED" then
  12.         IN_COMBAT = true
  13.     elseif event == "PLAYER_REGEN_ENABLED" then    
  14.         IN_COMBAT = false
  15.     end
  16. end)
  17. f:RegisterEvent("PLAYER_REGEN_DISABLED")
  18. f:RegisterEvent("PLAYER_REGEN_ENABLED")
  Reply With Quote