Added new plugin to update the comparison window

This commit is contained in:
Tercio Jose
2022-11-26 23:08:49 -03:00
parent e3161ff29c
commit 25cb9e8ffe
11 changed files with 2203 additions and 35 deletions
+61
View File
@@ -662,6 +662,67 @@ function openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId)
end
end
do
--make new namespace
openRaidLib.AuraTracker = {}
function openRaidLib.AuraTracker.ScanCallback(aura)
local unitId = openRaidLib.AuraTracker.CurrentUnitId
local thisUnitAuras = openRaidLib.AuraTracker.CurrentAuras[unitId]
local auraInfo = C_UnitAuras.GetAuraDataByAuraInstanceID(unitId, aura.auraInstanceID)
if (auraInfo) then
local spellId = auraInfo.spellId
if (spellId) then
thisUnitAuras[spellId] = true
openRaidLib.AuraTracker.AurasFoundOnScan[spellId] = true
end
end
end
function openRaidLib.AuraTracker.ScanPlayerAuras(unitId)
local batchCount = nil
local usePackedAura = true
openRaidLib.AuraTracker.CurrentUnitId = unitId
openRaidLib.AuraTracker.AurasFoundOnScan = {}
AuraUtil.ForEachAura(unitId, "HELPFUL", batchCount, openRaidLib.AuraTracker.ScanCallback, usePackedAura)
local thisUnitAuras = openRaidLib.AuraTracker.CurrentAuras[unitId]
for spellId in pairs(thisUnitAuras) do
if (not openRaidLib.AuraTracker.AurasFoundOnScan[spellId]) then
--aura removed
openRaidLib.internalCallback.TriggerEvent("unitAuraRemoved", unitId, spellId)
end
end
end
--run when the open raid lib loads
function openRaidLib.AuraTracker.StartScanUnitAuras(unitId)
openRaidLib.AuraTracker.CurrentAuras = {
[unitId] = {}
}
local auraFrameEvent = CreateFrame("frame")
auraFrameEvent:RegisterUnitEvent("UNIT_AURA", unitId)
auraFrameEvent:SetScript("OnEvent", function()
openRaidLib.AuraTracker.ScanPlayerAuras(unitId)
end)
end
--test case:
local debugModule = {}
function debugModule.AuraRemoved(event, unitId, spellId)
local spellName = GetSpellInfo(spellId)
--print("aura removed:", unitId, spellId, spellName)
end
openRaidLib.internalCallback.RegisterCallback("unitAuraRemoved", debugModule.AuraRemoved)
end
--which is the main attribute of each spec
--1 Intellect
--2 Agility