Posts tagged lua

Tracking totem mastery duration with WeakAuras

By: Anthony Naddeo - (gaming, wow, lua)

When I start a new character I usually create a WeakAuras dynamic group for tracking its abilities. I ran into an issue while doing this with Totem Mastery on my boosted shaman recently since it gives the player auras with no duration, but I still wanted to track remaining time in a WeakAura. I’ll start by posting the solution, which involves writing a lua function that for a text display in WeakAuras, and go on to explain the weirdness behind it. It all depends on the UnitAura function.

function()
    -- For some reason it alternates between these two. Hopefully they fix this.
    -- If they do, then just remove all of this and use the right one all the time
    local totemTime1, totemTime2 = GetTotemTimeLeft(1), GetTotemTimeLeft(2)
    local effectiveTotemTime1 = totemTime1 > 0 and totemTime1 or nil
    local effectiveTotemTime2 = totemTime2 > 0 and totemTime2 or nil

    local actualTotemTime = effectiveTotemTime1 or effectiveTotemTime2 or ""
    return actualTotemTime
end