WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Track Missing Buffs (https://www.wowinterface.com/forums/showthread.php?t=35278)

Elendhriel 10-05-10 10:53 AM

Track Missing Buffs
 
I am looking for a code snippet to use and learn from how to track missing personal Buffs. In Cataclysm every time I die I lose Righteous Fury and sometimes I forget to rebuff it which doesn't help when tanking :)

Guardix 10-05-10 11:17 AM

You can use UnitAura(unit, spell)
unit would then be "player" and spell "Righteous Fury"

If the function returns nil, you can display some frame to notice yourself
Documentation here:
http://www.wowwiki.com/API_UnitAura

d87 10-05-10 11:24 AM

Code:

local f = CreateFrame("Frame",nil,UIParent)
f:SetWidth(60); f:SetHeight(60)
local t = f:CreateTexture(nil, "ARTWORK")
t:SetAllPoints(f)
f.tex = t
f:Hide()
f:SetPoint("CENTER",UIParent,"CENTER",0,0)

local spellID = <Righteous Fury id>
f.tex:SetTexture(select(3,GetSpellInfo(spellID)))

f:RegisterEvent("UNIT_AURA")
f:SetScript("OnEvent",function(self,event,unit)
    if unit ~= "player" then return end
    if UnitAura(unit,GetSpellInfo(spellID),nil,"HELPFUL") then
        self:Show()
    else self:Hide() end
end)


Elendhriel 10-05-10 06:40 PM

Thanks that code really helped could change / extend it to my needs :)


All times are GMT -6. The time now is 03:37 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI