#Vengeance Tracker for Off- Tanks

1 messages Β· Page 1 of 1 (latest)

brittle shard
#

I'm in the process of modifying an aura where I've combined elements from different ones I like (I'm not good at creating my own) and I need help with the finishing touches πŸ™‚

I'm struggling with modifying a custom trigger that runs the calculations behind my co-tanks' vengeance as well as my own both in terms of value and percentage (of max potential value)

I'm quite certain the problem lies in the ..

  1. Trigger Event(s):

which is currently set to: TRIGGER:2 UNIT_MAXHEALTH:player

and ..

  1. The Custom Trigger:
    if event == "STATUS" or event == "OPTIONS" then
        local _, _, _, _, duration, expirationTime = WA_GetUnitAura("player", 132365, "HELPFUL")
        local data = C_UnitAuras.GetPlayerAuraBySpellID(132365)
        local duration = data and data.duration or 0
        local expirationTime = data and data.expirationTime or 0
        local value = data and data.points and data.points[1] or 0
        local total = UnitHealthMax("player")
        local percent = Round(value/total*100)
        states:Update("", {
                icon = C_Spell.GetSpellTexture(132365),
                value = value,
                total = UnitHealthMax("player"),
                percent = percent,
                duration = duration,
                expirationTime = expirationTime,
                progressType = "static",
        })
    end
    
    if event == "TRIGGER" and states[""] then
        if watched[""] and watched[""].tooltip1 then
            local value = watched[""].tooltip1
            local total = states:Get("", "total")
            local percent = Round(value/total*100)
            states:Update("", {
                    value = value,
                    percent = percent,
                    duration = watched[""].duration,
                    expirationTime = watched[""].expirationTime,
            })
        else
            states:Update("", {
                    value = 0,
                    percent = 0,
                    duration = 0,
                    expirationTime = 0,
            })
        end
    elseif event == "UNIT_MAXHEALTH" and states[""] then
        local value = states:Get("", "value") or 0
        local total = UnitHealthMax("player")
        local percent = Round(value/total*100)
        states:Update("", {
                percent = percent,
                total = total
        })
    end
end

I want the code to run on the unit specified from the dynamic group's 2nd trigger, which are tied to two different child auras.

I hope I've communicated the problem clearly enough for someone to understand what i'm trying to accomplish if you want to help don't hesitate to ping me or reach out directly, thanks πŸ˜„

blazing tusk
#

Just link the aura instead.

brittle shard
blazing tusk
#

On wagon.

brittle shard
#

I'm sure this is a stupid question but is wagon = wago?
also I've modified it heavily so it's not really close to the original that I found online

blazing tusk
#

Yes, that is just a phone autocorrect. You can upload your version to wago to link it.

#

Also you said something about a trigger from your group, groups don't have triggers.

brittle shard
#

yeah i'm not really that experienced with weakauras or the correct terminology so i just tried explaining it to the best of my abilities hope it still makes somewhat sense

upper flower
#

main change that's needed is adding unit instead of "" in states, and making multiple states. try this:

add GROUP_ROSTER_UPDATE into events
add the following custom trigger: (split into 2 messages as message is too long and i can't upload to wago atm myself πŸ˜’ )

function(states, event, hpunit, watched)
    if event == "STATUS" or event == "GROUP_ROSTER_UPDATE" then
        states:RemoveAll()
        
        for unit in WA_IterateGroupMembers() do
            if UnitGUID(unit) ~= UnitGUID("player") then
                local data = C_UnitAuras.GetAuraDataBySpellName(unit,"Vengeance","HELPFUL")
                local duration = data and data.duration or 0
                local expirationTime = data and data.expirationTime or 0
                local value = data and data.points and data.points[1] or 0
                local total = UnitHealthMax(unit)
                local percent = value/total*100
                local class = select(2,UnitClass(unit))
                states:Update(unit, {
                        value = value,
                        total = total,
                        percent = percent,
                        duration = duration,
                        expirationTime = expirationTime,
                        progressType = "static",
                        class = class
                })
            end
        end
#
    elseif event == "TRIGGER" then
        for unit in pairs(states) do
            
            if watched[unit] and watched[unit].tooltip1 then
                local value = watched[unit].tooltip1
                local total = states:Get(unit, "total")
                local percent = value/total*100
                local duration = watched[unit].duration
                local expirationTime = watched[unit].expirationTime
                states:Update(unit, {
                        value = value,
                        percent = percent,
                        duration = duration,
                        expirationTime = expirationTime,
                })
            else
                states:Update(unit, {
                        value = 0,
                        percent = 0,
                        duration = 0,
                        expirationTime = 0,
                })
            end
        end
    elseif event == "UNIT_MAXHEALTH" and states[hpunit] then
        local value = states:Get("", "value") or 0
        local total = UnitHealthMax(hpunit)
        local percent = value/total*100
        states:Update(hpunit, {
                percent = percent,
                total = total
        })
    end
end
#

preferably copy by pressing the button there, ctrl + c on discord code can be wonky

#

then put this into "Custom Variables" below the custom trigger:

{
    class = "string"
}

and remove trigger 3, you should now be able to do this with trigger 1 (make sure class name is capitalized)

#

and in display tab do this for rounding (better than to do it inside code)

#

note that the code is untested so if something goes wrong then grab bugsack + buggrabber and post the errors here + updated link of your aura

zinc marshBOT
#

Bugsack

If you are having errors we need a copy of the entire error's text to be able to help.
See this message #pins message for details on getting detailed Lua errors

upper flower
#

i'd have preferred to just link you the aura but i'm on alpha version of WAs atm which can't link stuff to current version πŸ˜…

stable garden
#

this code looks familiar

#

thieves :(

dark bane
#

Our snippet now

blazing tusk
#

Do it, for the better of the world.

#

Make that stuff vanish.

dark bane
#

Midnight got you covered

blazing tusk
#

It's not about the auras vanishing, it's about translits code vanishing

dark bane
#

Monkeys paw

brittle shard
upper flower
#

i meant add GROUP_ROSTER_UPDATE to the existing events, not replace them πŸ™‚
so should be TRIGGER:2 UNIT_MAXHEALTH:player GROUP_ROSTER_UPDATE

#

i also forgot to mention that you need to enable this at bottom of trigger 2

#

this was also only meant for the off-tanks aura, player aura should have been left as is

brittle shard
#

hmm i tried implementing these changes but it still dosn't work :/

could it be the trigger?

or the way i pasted the code you sent?

    if event == "STATUS" or event == "GROUP_ROSTER_UPDATE" then
        states:RemoveAll()
        
        for unit in WA_IterateGroupMembers() do
            if UnitGUID(unit) ~= UnitGUID("player") then
                local data = C_UnitAuras.GetAuraDataBySpellName(unit,"Vengeance","HELPFUL")
                local duration = data and data.duration or 0
                local expirationTime = data and data.expirationTime or 0
                local value = data and data.points and data.points[1] or 0
                local total = UnitHealthMax(unit)
                local percent = value/total*100
                local class = select(2,UnitClass(unit))
                states:Update(unit, {
                        value = value,
                        total = total,
                        percent = percent,
                        duration = duration,
                        expirationTime = expirationTime,
                        progressType = "static",
                        class = class
                })
            end
        end    
    elseif event == "TRIGGER" then
        for unit in pairs(states) do
            
            if watched[unit] and watched[unit].tooltip1 then
                local value = watched[unit].tooltip1
                local total = states:Get(unit, "total")
                local percent = value/total*100
                local duration = watched[unit].duration
                local expirationTime = watched[unit].expirationTime
                states:Update(unit, {
                        value = value,
                        percent = percent,
                        duration = duration,
                        expirationTime = expirationTime,
                })
            else
                states:Update(unit, {
                        value = 0,
                        percent = 0,
                        duration = 0,
                        expirationTime = 0,
                })
            end
        end
    elseif event == "UNIT_MAXHEALTH" and states[hpunit] then
        local value = states:Get("", "value") or 0
        local total = UnitHealthMax(hpunit)
        local percent = value/total*100
        states:Update(hpunit, {
                percent = percent,
                total = total
        })
    end
end```
upper flower
#

i'll try linking the aura, weakauras posted a new version (5.20.6) so i should no longer have that alpha problem. 5 mins

brittle shard
#

that would be great! thank you so much

upper flower
#

ye i noticed a few errors including that πŸ˜…

stable garden
#

and local value = states:Get("", "value") or 0

upper flower
#

πŸ€¦β€β™‚οΈ didn't notice that one

upper flower
#

now properly credited poggers

#

took more changes than i expected but should hopefully work now, i just consilidated it all into 1 single aura

#

rats that link had another error πŸ™‚ switched it out for a new one

brittle shard
#

I'm not sure why but i get a vengeance bar for each party member where it should only be for people who have the group role of tank ideally how can i do this? πŸ˜„

upper flower
#

oh whoops i know why it's doing that, 1 min

#

edited again, i added player name + class icon too if you want to use those in display tab

brittle shard
#

ah that did the trick nice! i've got two more small things if you don't mind πŸ˜„
how can i make sure my bar is always the top one?
i keep getting this message in chat "0 state made"

upper flower
#

yeah i updated link again that removed the 0 state made message, my bad πŸ™‚

#

i'll check bar indexing in a moment

upper flower
#

updated again, should put you at top & everyone else semi-random placements