#WA desyncs
22 messages · Page 1 of 1 (latest)
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
ye that I understand, I meant the initState and the aura_env.counter
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
ah
so wipe > new combat = old counter
so the subEvent was the root cause of all issues
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
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```
this is wrong btw
you have function(allstates, event, ...) but typed if Event == "ENCOUNTER_START" with capital E
yeah realized, and adjusted
can get rid of a aura_env.counter as i showed and just adjust state value