From 6a32145b790f4647a82dff47a7f726992c2e5f76 Mon Sep 17 00:00:00 2001 From: Aleksi Blinnikka Date: Sat, 16 Nov 2019 19:27:37 +0200 Subject: [PATCH 1/1] Update aura state on combat start and all bars update --- kehys/auras.lua | 25 ++++++++++++++++++++++++- kehys/events.lua | 8 +++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/kehys/auras.lua b/kehys/auras.lua index 42afc12..641e128 100644 --- a/kehys/auras.lua +++ b/kehys/auras.lua @@ -95,13 +95,36 @@ end auraEvents.SPELL_AURA_BROKEN_SPELL = auraEvents.SPELL_AURA_BROKEN; local counter = 0; -local function clog(ts, event, _, source, _, _, _, dest, _, flags, _, spellid, ...) +local function clog(ts, event, _, source, _, _, _, dest, _, _, _, spellid, ...) if auraEvents[event] and watchedAuras[spellid] and guids[dest] then auraEvents[event](guids[dest], spellid, source, ...); end end addon.Events.Clog = clog; +local types = {["HELPFUL"] = "BUFF", ["HARMFUL"] = "DEBUFF"}; +local function setAuras(unit, guid) + local name; + local spellid, count, source; + for filter, atype in pairs(types) do + local i = 1; + while true do + name, _, count, _, _, _, source, _, _, spellid = UnitAura(unit, i, filter); + if not spellid then break end + if count == 0 then count = nil end + if source ~= nil then + clog(0, "SPELL_AURA_APPLIED", nil, UnitGUID(source), nil, nil, nil, + guid, nil, nil, nil, spellid, nil, nil, atype, count); + elseif filter == "HARMFUL" then + clog(0, "SPELL_AURA_APPLIED", nil, nil, nil, nil, nil, + guid, nil, nil, nil, spellid, nil, nil, atype, count); + end + i = i + 1; + end + end +end +addon.SetAuras = setAuras; + local frame = CreateFrame("Frame"); frame:Hide(); frame:SetScript("OnEvent", function() diff --git a/kehys/events.lua b/kehys/events.lua index 97f56da..b194192 100644 --- a/kehys/events.lua +++ b/kehys/events.lua @@ -167,6 +167,7 @@ local eventFuncs = { frame.stacks = {}; frame.heal = {}; frame.buff1 = {}; + addon.SetAuras(frame.unit, frame.guid); end, ["UPDATE_ALL_BARS"] = function(frame) updateRole(frame, frame.unit); @@ -183,7 +184,12 @@ local eventFuncs = { if frame.guid then guids[frame.guid] = frame; end - -- TODO update initial aura state + frame.tankcd = {}; + frame.alert = {}; + frame.stacks = {}; + frame.heal = {}; + frame.buff1 = {}; + addon.SetAuras(frame.unit, frame.guid); end, }; eventFuncs["READY_CHECK_CONFIRM"] = eventFuncs["READY_CHECK"]; -- 2.39.5