Quantcast
Sacred Shield Tag - WoWInterface
Thread Tools Display Modes
12-13-14, 10:51 AM   #1
nin
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 213
Sacred Shield Tag[SOLVED]

Hey guys!

Im using a tag for oUF that looks like this

Code:
spells["Sacred Shield"] = GetSpellInfo(148039)
Code:
oUF.Tags.Methods['SS'] = function(u) 
    local name, _,_,_,_,_, expirationTime, fromwho = UnitAura(u, spells["Sacred Shield"])
    if(fromwho == "player") then
        local spellTimer = (expirationTime-GetTime())
		local TimeLeft =  numberize(spellTimer)
        if spellTimer > 0 then
            return "|cffFFAB00"..TimeLeft.."|r"
        end
    end
end
oUF.Tags.Events['SS'] = "UNIT_AURA"
Can anyone help me understand or edit this so i can track the 30sec duration buff from sacred shield(looked through the ID's and pretty sure im using the right one). now i only get the 5 sec actual shield showing.

thanks!

Last edited by nin : 12-14-14 at 03:02 PM.
  Reply With Quote
12-13-14, 11:56 AM   #2
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
UnitAura(unit, spellName) returns information for the first aura with the specified name, so it's unreliable when you need to distinguish between two auras with the same name. You'll need to iterate through the unit's auras using UnitAura(unit, index) until you find the one with the right spellID and then return the appropriate string for that aura.

Lua Code:
  1. oUF.Tags.Methods['SS'] = function(u)
  2.     local i = 0
  3.  
  4.     local name, _, expirationTime, unitCaster, spellID = ""
  5.  
  6.     while name and i <= 40 do
  7.         i = i + 1
  8.         name, _, _, _, _, _, expirationTime, unitCaster, _, _, spellID = UnitBuff(u, i, "PLAYER|CANCELABLE") -- Only look at cancelable buffs cast by the player
  9.  
  10.         if spellID == 148039 then
  11.             local spellTimer = (expirationTime-GetTime())
  12.             if spellTimer > 0 then
  13.                 return "|cffFFAB00" .. numberize(spellTimer) .. "|r"
  14.             end
  15.         end
  16.     end
  17. end
  18. oUF.Tags.Events['SS'] = "UNIT_AURA"

Last edited by Choonstertwo : 12-13-14 at 12:00 PM.
  Reply With Quote
12-13-14, 06:56 PM   #3
nin
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 213
Worked perfect!

Thank you so much, i really appreciate it.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Sacred Shield Tag

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off