#WA_DELAYED_PLAYER_ENTERING_WORLD stop working

4 messages · Page 1 of 1 (latest)

pastel sparrow
#

This is the second the time that this has happened. The first time this happened, I had to remake the aura. Was hoping maybe a fresh set of eyes could potentially help see the issue.

THE ISSUE
• In trigger #1's custom trigger code, aura_env.saved.maelstromSpent isn't being reset to 0 like I want it to.

DISPLAY TAB

Text 1
Display Text: %c
Custom Function:

function()
    return aura_env.saved.maelstromSpent or 0
end

TRIGGER TAB

Required for Activation: Any Triggers
Dynamic Information: First Active Trigger

Trigger #1
Type: Custom
Event Type: Event
Event(s): CLEU:SPELL_CAST_SUCCESS,WA_DELAYED_PLAYER_ENTERING_WORLD

Custom Trigger:

function(event,...)
    if (event == "WA_DELAYED_PLAYER_ENTERING_WORLD") then
        local isInitLogin = ...
        
        -- When a player initially logs into the game, the backend maelstrom
        -- counter begins at 0. So we need our maelstromSpent to do the same.
        if (isInitLogin) then
            aura_env.saved.maelstromSpent = 0 
        end
        
        return true
    elseif (event == "COMBAT_LOG_EVENT_UNFILTERED") then
        local _,subevent,_,srcGUID,_,_,_,_,_,_,_,_,_,spellID = ...
        
        if (srcGUID == UnitGUID("player") and subevent == "SPELL_CAST_SUCCESS" and aura_env.validSpells[spellID]) then
            local cost = C_Spell.GetSpellPowerCost(spellID)
            
            cost = cost[#cost].cost
            
            local maelstromSpent = 0
            local currentMaelstrom = aura_env.saved.maelstromSpent
            local newMaelstromSpent = currentMaelstrom + cost
            
            -- When our maelstromSpent variable exceeds 300, we need to roll it over
            if (newMaelstromSpent >= 300) then
                maelstromSpent = newMaelstromSpent - 300 
            else
                maelstromSpent = newMaelstromSpent
            end
            
            aura_env.saved.maelstromSpent = maelstromSpent
            return true
        end
    elseif (event == "OPTIONS" and not aura_env.isNeedUpdate) then
        aura_env.isNeedUpdate = true
    end
    
    -- When we close WeakAuras' options, an update needs to occur.
    -- This will allow our progress bar to resume the value is had before we opened the options.
    if (not WeakAuras.IsOptionsOpen() and aura_env.isNeedUpdate) then
        aura_env.isNeedUpdate = false
        
        return true 
    end
end

Duration Info:

function()
    return aura_env.saved.maelstromSpent, 300, true
end

Trigger #2
Type: Player/Unit Info
Sub-Type: Conditions
Checked: Always active trigger

CONDITIONS TAB

Condition #1
If Type: Custom Check
Additional Events: PLAYER_TARGET_CHANGED
Custom Check:

function(states)
    local state = states[-1]
    
    -- We only want this code to run when the player is not in combat
    if (not state.incombat) then
        if (state.hastarget) then
            -- If you have a target, we only want this code to run if:
            -- • The target is not hostile
            -- • The target is dead
            -- • The target is not attackable
            if (UnitIsFriend("target","player") or UnitIsDead("target") or not state.attackabletarget)  then
                return true 
            end
        elseif (not state.hastarget) then
            return true    
        end
    end 
end

ACTIONS TAB
Custom On Init

aura_env.isNeedUpdate = true

aura_env.validSpells = {
    [8042]   = true, -- Earth Shock
    [462620] = true, -- Earthquake (@target)
    [61882]  = true, -- Earthquake (@cursor)
    [117014] = true  -- Elemental Blast
}

if (not aura_env.saved) then
    aura_env.saved = {}
end
pastel sparrow
#

UPDATE: I made a new WeakAura and it's still not working. I even changed Trigger #1 to the following and "EVENT: WA_DELAYED_PLAYER_ENTERING_WORLD" doesn't print upon loading into the game.

function(event,...)
    print("EVENT:",event)
end

However, doing the same idea with a brand new aura works fine. Hmm 🤔

pastel sparrow
#

UPDATE: I found the issue!

Selecting the Tempest Hero Talent in the Load Tab prevented WA_DELAYED_PLAYER_ENTERING_WORLD from firing. Instead checking if spell 454009 is known worked.

Gonna submit these findings to the WeakAura github.