Lua Code:
local SPELL_ID = 24275 -- Hammer of Wrath
local SPELL_NAME = GetSpellInfo(SPELL_ID)
local UPDATE_INTERVAL = 0.1
local frame = CreateFrame("Frame", nil, UIParent)
frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
frame:SetSize(64, 64)
frame:Hide()
local texture = frame:CreateTexture()
texture:SetAllPoints(frame)
texture:SetTexture(GetSpellTexture(SPELL_ID))
frame:SetScript("OnEvent", function(self, event, spellID)
if event == "SPELL_ACTIVATION_OVERLAY_GLOW_SHOW" then
if spellID == SPELL_ID then
frame:Show()
end
elseif event == "SPELL_ACTIVATION_OVERLAY_GLOW_HIDE" then
if spellID == SPELL_ID then
frame:Hide()
end
end
end)
frame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW")
frame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_HIDE")
local timer = UPDATE_INTERVAL
frame:SetScript("OnUpdate", function(self, elapsed)
timer = timer + elapsed
if timer < UPDATE_INTERVAL then return end
timer = 0
if IsSpellInRange(SPELL_NAME, "target") == 1 then
frame:SetAlpha(1)
else
frame:SetAlpha(0.5)
end
end)
frame:SetScript("OnHide", function(self)
timer = UPDATE_INTERVAL
end)