From 379478569ee94d9af8499592da3457713eee0e47 Mon Sep 17 00:00:00 2001 From: d87 Date: Tue, 16 Nov 2021 18:39:24 +0700 Subject: [PATCH] Mainline classic era compatibility --- Aptechka-Classic.toc | 5 +-- Aptechka.lua | 77 +++++++++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/Aptechka-Classic.toc b/Aptechka-Classic.toc index a1ba223..8e70ffa 100644 --- a/Aptechka-Classic.toc +++ b/Aptechka-Classic.toc @@ -1,4 +1,4 @@ -## Interface: 11307 +## Interface: 11401 ## Title: Aptechka ## Notes: Raid Frames ## Version: @project-version@ @@ -15,6 +15,7 @@ Libs\LibStub\LibStub.lua Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua Libs\AceDB-3.0\AceDB-3.0.xml +Libs\LibClassicDurations\LibClassicDurations.xml Libs\LibCombatLogHealth-1.0\LibCombatLogHealth-1.0.lua Libs\LibCustomGlow\LibCustomGlow-1.0.xml Libs\LibSharedMedia-3.0\lib.xml @@ -31,7 +32,7 @@ Libs\LibClassicDurations\LibClassicDurations.xml helpers.lua config.lua -config.tbc.lua +config.classic.lua Aptechka.lua migrations.lua frame.lua diff --git a/Aptechka.lua b/Aptechka.lua index c9d3a7e..4a0be6f 100644 --- a/Aptechka.lua +++ b/Aptechka.lua @@ -365,37 +365,6 @@ function Aptechka.PLAYER_LOGIN(self,event,arg1) LibClassicDurations:RegisterFrame(self) UnitAura = LibClassicDurations.UnitAuraWrapper Aptechka:UpdateSpellNameToIDTable() - - local spellNameBasedCategories = { "traces" } - function Aptechka:UpdateSpellNameToIDTable() - local mergedConfig = AptechkaConfigMerged - local visited = {} - - for _, catName in ipairs(spellNameBasedCategories) do - local category = mergedConfig[catName] - if category then - for spellID, opts in pairs(category) do - if not visited[opts] then - local lastRankID - local clones = opts.clones - if clones and next(clones)then - lastRankID = spellID - for sid in pairs(clones) do - if lastRankID < sid then - lastRankID = sid - end - end - else - lastRankID = spellID - end - helpers.AddSpellNameRecognition(lastRankID) - - visited[opts] = true - end - end - end - end - end end if apiLevel <= 2 then function Aptechka:SetClassicClickcastAttributes(f) @@ -726,6 +695,11 @@ function Aptechka:GenerateMergedConfig() config.GLOBAL = nil config[class] = nil + if apiLevel == 1 then + Aptechka.spellNameToID = helpers.spellNameToID + Aptechka:UpdateSpellNameToIDTable() + end + -- Template application helpers.UnwrapConfigTemplates(AptechkaConfigMerged.traces) helpers.UnwrapConfigTemplates(AptechkaConfigMerged.auras) @@ -1243,16 +1217,19 @@ function Aptechka:COMBAT_LOG_EVENT_UNFILTERED(event) dstGUID, dstName, dstFlags, dstFlags2, spellID, spellName, spellSchool, amount, overhealing, absorbed, critical = CombatLogGetCurrentEventInfo() if enableTraceheals and bit_band(srcFlags, COMBATLOG_OBJECT_AFFILIATION_MINE) == COMBATLOG_OBJECT_AFFILIATION_MINE then + local traceSpellID -- separate var so it wouldn't interfere with aura events below if spellID == 0 then - spellID = spellNameToID[spellName] + traceSpellID = spellNameToID[spellName] + else + traceSpellID = spellID end - local opts = traceheals[spellID] + local opts = traceheals[traceSpellID] if opts and eventType == "SPELL_HEAL" then if guidMap[dstGUID] and not opts.disabled then local minamount = opts.minamount if not minamount or amount > minamount then local unit = guidMap[dstGUID] - Aptechka:ForEachUnitFrame(unit, FrameStartTrace, opts, spellID) + Aptechka:ForEachUnitFrame(unit, FrameStartTrace, opts, traceSpellID) end end end @@ -2914,6 +2891,38 @@ local function SetDebuffIcon(frame, unit, index, debuffType, expirationTime, dur end if apiLevel == 1 then + local spellNameBasedCategories = { "traces" } + function Aptechka:UpdateSpellNameToIDTable() + local mergedConfig = AptechkaConfigMerged + local visited = {} + + for _, catName in ipairs(spellNameBasedCategories) do + local category = mergedConfig[catName] + if category then + for spellID, opts in pairs(category) do + if not visited[opts] then + local lastRankID + local clones = opts.clones + if clones and next(clones)then + lastRankID = spellID + for sid in pairs(clones) do + if lastRankID < sid then + lastRankID = sid + end + end + else + lastRankID = spellID + end + helpers.AddSpellNameRecognition(lastRankID) + + visited[opts] = true + end + end + end + end + end + + SetDebuffIcon = function (frame, unit, index, debuffType, expirationTime, duration, icon, count, isBossAura, spellID, spellName) local iconFrame = frame.debuffIcons[index] if debuffType == false then