It's a bit of a loaded question as it's missing details (most of which probably come with WeakAuras). You could start with something like:
Lua Code:
local spellID, SnDID = 315496 -- S&D
local _, _, icon = GetSpellInfo(spellID)
local f = CreateFrame("Frame", "Kovexpulthul_Buff", PlayerFrame, "AuraButtonArtTemplate")
f:Hide()
f:SetSize(40, 40)
f.Icon:SetTexture(icon)
f:SetPoint("RIGHT", PlayerFrame, "LEFT", 0, 0)
f:RegisterEvent("UNIT_AURA")
f:SetScript("OnEvent", function(self, event, ...)
local unit, auraInfo = ...
local added, updated, removed, full = auraInfo.addedAuras, auraInfo.updatedAuraInstanceIDs, auraInfo.removedAuraInstanceIDs, auraInfo.isFullUpdate
if added then
for k, v in pairs(added) do
if v.spellId == spellID then
SnDID = v.auraInstanceID
self:Show()
break
end
end
end
if removed then
for k, id in pairs(removed) do
if id == SnDID then
SnDID = nil
self:Hide()
break
end
end
end
end)
It's been a while since I looked at auras so there may well be a better way.