View Single Post
07-23-16, 04:02 AM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by plopek View Post
Can I make the icon appear only when cooldown/timer starts?
Something like this would probably work.
Lua Code:
  1. local t=CreateFrame("FRAME")
  2. t:SetPoint("CENTER",ParentUI,2,12)
  3. t:SetSize(30,30)
  4. t.c=CreateFrame("Cooldown","cd1")
  5. t.c:SetAllPoints(t)
  6. t.t=t:CreateTexture(nil,"BORDER")
  7. t.t:SetAllPoints()
  8. t.t:SetTexture("Interface\\Icons\\spell_holy_crusaderstrike")
  9. t:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  10.  
  11. t:Hide()
  12. cd1:HookScript('OnHide', function() t:Hide() end)
  13.  
  14. t:SetScript("OnEvent", function(...)
  15.     local b,_,_,e,_,_,_,_,_,_,l = select(4, ...)
  16.     if (e == UnitName("Player") and (b=="SPELL_AURA_APPLIED" or b=="SPELL_AURA_REFRESH")and l==209785) then
  17.         t:Show()
  18.         CooldownFrame_SetTimer(cd1,GetTime(),15,1)
  19.     end
  20. end)