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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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

For some reason, Blizzard modeled this spell as a single totem that rotates between the first and second “totem” slots. You’ll also notice that it rotates positions between the first and second slots in your class bar if you’re using ElvUI and you keep casting it. This might mean that they did this to get it working for Legion and they’ll do it right later on (and probably break this script), but this works for now. I’ll update this if they break it on me. I simplified the logic so people can adapt it if they need to. You can paste this snippet into the the custom function for the display, as seen in the following screenshot.

And finally, here is the WeakAura if you want to play around with it.

dqu1MaGibvLljOsmkLu6uQQWSuvrDlLuTlLe1WuGJbQwMQONPkmnfkxtHSnfuFtvvnoLKoNskADkjY8eujDpvvQ9PQsoiOyHQkpKOqxeuInsu0hfuPgPscNujfwPcvZeuQBsuYoLQ(PcYqjk1sfuXtHMQixvqv1xvvr2l1FvIbROdtyXckpgKjlkxg1MvL(mrgTu50iwnrbVwvvMns3wP2Te)gy4cSCHEUktN01LY2fKVlQgpOKopr16fuL9lPnCNmkCYQXZ4Zv(5kpyLHBCBmZyMtgZiNm0kqkjeBuqPgH1HEFpwTmx)))hBWOrdp2Aoy1hpwZNJ531hBmJrwIakj5bSXm5fXMajfbTaJYh699y1YC0Qdgng8185y)d))hdpgC)U(yJzuaPKq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