#WA desyncs

22 messages · Page 1 of 1 (latest)

dusty steeple
#
elseif subEvent == "ENCOUNTER_START" then / subEvent == "ENCOUNTER_END"```
#

its event not subEvent

#

aura_env.initState never fired on ENCOUNTER_START but on SPELL_CAST_START instead
Also in case of wipe aura_env.counter never resets thats why desync

kindred ginkgo
#

Able to show how would that look?

#

Thanks for your help so far!

dusty steeple
kindred ginkgo
#

ye that I understand, I meant the initState and the aura_env.counter

dusty steeple
#

part with aura_env.counter = 1 never fired in current state of WA and increased in aura_env.updateState from aura_env.counter = (aura_env.counter % aura_env.config["TemsInterrupt"]) + 1

kindred ginkgo
#

ah

dusty steeple
#

so wipe > new combat = old counter

kindred ginkgo
#

so the subEvent was the root cause of all issues

dusty steeple
#

no need for ENCOUNTER_END at all since if you load WA in the specific encounter id it will never fire anyway

#

also no need for aura_env.counter at all too

kindred ginkgo
#

ENCOUNTER_START doesn't need to be listed under Event(s) tho on top?

dusty steeple
#

doesn't matter

#
aura_env.initState = function(allstates)
    allstates[""] = {
        show = true,
        changed = true,
        autoHide = false,
        progressType = "timed",
        yourTurn = false,
        interruptGrp = 1,
    }
end

aura_env.updateState = function(allstates)
    allstates[""].yourTurn = false
    allstates[""].interruptGrp = (allstates[""].interruptGrp % aura_env.config["TemsInterrupt"]) + 1
    allstates[""].duration = nil
    allstates[""].expirationTime = nil
    allstates[""].changed = true
end```
#
function(allstates, event, ...)
    local subEvent = select(2, ...)
    if subEvent == "SPELL_CAST_START" then
        local spellName = select(13, ...)
        local sourceGUID = select(4, ...)
        local npcID = select(6, strsplit("-", sourceGUID))
        if spellName == aura_env.fbName and npcID == aura_env.gvNpcID then
            if not allstates[""] then aura_env.initState(allstates) end
            allstates[""].duration = 2
            allstates[""].expirationTime = GetTime() + 2
            allstates[""].changed = true
            if aura_env.config.group == allstates[""].interruptGrp  then
                allstates[""].yourTurn = true
            end
            return true
        end
    elseif subEvent == "SPELL_CAST_SUCCESS" then
        local spellName = select(13, ...)
        local sourceGUID = select(4, ...)
        local npcID = select(6, strsplit("-", sourceGUID))
        if spellName == aura_env.fbName and npcID == aura_env.gvNpcID then
            aura_env.updateState(allstates)
            return true
        end
    elseif subEvent == "SPELL_INTERRUPT" then
        local spellInterrupted = select(16, ...)
        if spellInterrupted == aura_env.fbName then
            aura_env.updateState(allstates)
            return true
        end
    elseif event == "ENCOUNTER_START" then
        aura_env.initState(allstates)
    end
end```
dusty steeple
#

you have function(allstates, event, ...) but typed if Event == "ENCOUNTER_START" with capital E

kindred ginkgo
#

yeah realized, and adjusted

dusty steeple
#

can get rid of a aura_env.counter as i showed and just adjust state value