#Optimizing Cursor-Based Weak Auras for Frost Mage Rotation

29 messages · Page 1 of 1 (latest)

violet forum
#

I'm developing a cursor-based WeakAuras package for Frost Mages, with plans to expand to all classes and specs eventually.

Current Issue:
My Blizzard trigger uses a custom trigger that scans enemy nameplates to count engaged targets (>3). This works but uses an "every frame" trigger, which I know is inefficient.

Request:
Looking for advice on how to optimize this nameplate scanning process while maintaining functionality.

Has anyone solved scanning for multi target using nameplates more efficiently?

https://wago.io/mxDKMGJxe
https://media.wago.io/screenshots/mxDKMGJxe/67fe627a8b0e9666664aacf6.png

A minimal fire/frost mage cursor-anchored display showing: - Icicles (blue orbs circling cursor) - Major cooldowns (col

dull oracle
#

no

#

that is the only realistic way.

#

you should throttle your code to something reasonable though, like 5 times a second is more than enough

violet forum
#

Will the simple throttle in the snippets suffice?

dull oracle
#

yes

violet forum
#

Ill try and post code here with snippets and let you know if I run into any issues.

Where can I donate to you guys. I love what you guys do and want to support

dull oracle
violet forum
#

Code:

-- Trigger: Status - COMBAT
function()
    local enemyCount = 0
    
    if not aura_env.last or aura_env.last < GetTime() - 1 then
        aura_env.last = GetTime()
        
    end
    
    for i = 1, 15 do
        local unitID = "nameplate" .. i
        
        if UnitExists(unitID) then
            local inCombat = UnitAffectingCombat(unitID)
            local canAttack = UnitCanAttack("player", unitID)
            local isNotPlayer = not UnitIsPlayer(unitID)
            
            if inCombat and canAttack and isNotPlayer then
                enemyCount = enemyCount + 1
                if enemyCount >= 2 then
                    return true
                end
            end
        end
    end
    
    return false
end

I am guessing this would be sufficient?

dull oracle
#

you need to put your code inside the throttle snippet

violet forum
#
-- Trigger: Status - COMBAT
function()
    local enemyCount = 0
    
    if not aura_env.last or aura_env.last < GetTime() - 1 then
        aura_env.last = GetTime()
        
        for i = 1, 15 do
            local unitID = "nameplate" .. i
            
            if UnitExists(unitID) then
                local inCombat = UnitAffectingCombat(unitID)
                local canAttack = UnitCanAttack("player", unitID)
                local isNotPlayer = not UnitIsPlayer(unitID)
                
                if inCombat and canAttack and isNotPlayer then
                    enemyCount = enemyCount + 1
                    if enemyCount >= 2 then
                        return true
                    end
                end
            end
        end
        
        return false
        
    end
    
    
end
dull oracle
#
function()
    if not aura_env.last or aura_env.last < GetTime() - 0.2 then
        aura_env.last = GetTime()
        
        local enemyCount = 0
        
        for i = 1, 15 do
            local unitID = "nameplate" .. i
            
            if UnitExists(unitID) then
                local inCombat = UnitAffectingCombat(unitID)
                local canAttack = UnitCanAttack("player", unitID)
                local isNotPlayer = not UnitIsPlayer(unitID)
                
                if inCombat and canAttack and isNotPlayer then
                    enemyCount = enemyCount + 1
                end
            end
        end
        aura_env.show = enemyCount >= 2    
    end    
    
    return aura_env.show
end
violet forum
#

Interesting, so you must return "aura_en.show"

dull oracle
#

the trigger function gets called every frame.
but it only enters the nameplate counting every 0.2s (due to the throttle)

every other time it calls the function but does not do the whole nameplate counting, you still want to return something. if you just return false there, then it'd flicker on and off. like this it returns the last result

#

I edited it a bit more just now, forgot smth

#

also, I hope you're aware that there is a generic inbuilt "enemy nameplates in range X" condition available for all auras:

#

if you can do what you want to do via conditions

violet forum
violet forum
dull oracle
#

glow 1 is just an example

#

and no, conditions can't hide auras

#

you can turn the alpha of the aura to 0 via a condition, but it's still there

violet forum
#

Got it, it sounds to me like custom lua coding is a better option here since the WA is part of a "dynamic group"

dull oracle
#

instead of iterating through an arbitrary number of nameplate unit Ids (15 in your case), you can just grab all visible non-friendly nameplates with C_NamePlate.GetNamePlates(false)

#

and then do work on that

#

the amount of enemies you're in combat with is exposed as stacks, which you can use for display or condition purposes if you want

#

in the custom options, you can enable that it should only trigger on X enemies in combat, and how big X is

violet forum
#

You are a champion, a scholar, and a Weak Aura Wizard!