From 5090e0df285628ee532925c47c0985a89086a078 Mon Sep 17 00:00:00 2001 From: abunai Date: Fri, 27 Sep 2024 14:55:19 +0000 Subject: [PATCH] Cataclysm Classic support for AuraSlots --- src/AuraTable/AuraTable.lua | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/AuraTable/AuraTable.lua b/src/AuraTable/AuraTable.lua index f43efee..9a05160 100644 --- a/src/AuraTable/AuraTable.lua +++ b/src/AuraTable/AuraTable.lua @@ -118,7 +118,7 @@ end -- Get a units buffs ---@return nil function AuraTable:GetUnitBuffs() - if Tinkr.classic or Tinkr.era then + if Tinkr.era then for i = 1, 40 do local aura = Bastion.Aura:New(self.unit, i, 'HELPFUL') @@ -145,6 +145,22 @@ function AuraTable:GetUnitBuffs() return end + -- Update to support Cataclysm Classic (the above no longer works as intended in some cases) + if Tinkr.classic then + local args = { C_UnitAuras.GetAuraSlots(self.unit:GetOMToken(), "HELPFUL") } + + for i = 2, #args do + local aura_data = C_UnitAuras.GetAuraDataBySlot(self.unit:GetOMToken(), args[i]) + + local aura = Caffeine.Aura:CreateFromUnitAuraInfo(aura_data) + + if aura:IsValid() then + self:AddOrUpdateAuraInstanceID(aura:GetAuraInstanceID(), aura) + end + end + return + end + AuraUtil_ForEachAura(self.unit:GetOMToken(), 'HELPFUL', nil, function(a) local aura = Bastion.Aura:CreateFromUnitAuraInfo(a) @@ -157,7 +173,7 @@ end -- Get a units debuffs ---@return nil function AuraTable:GetUnitDebuffs() - if Tinkr.classic or Tinkr.era then + if Tinkr.era then for i = 1, 40 do local aura = Bastion.Aura:New(self.unit, i, 'HARMFUL') @@ -184,6 +200,21 @@ function AuraTable:GetUnitDebuffs() return end + if Tinkr.classic then + local args = { C_UnitAuras.GetAuraSlots(self.unit:GetOMToken(), "HARMFUL") } + + for i = 2, #args do + local aura_data = C_UnitAuras.GetAuraDataBySlot(self.unit:GetOMToken(), args[i]) + + local aura = Caffeine.Aura:CreateFromUnitAuraInfo(aura_data) + + if aura:IsValid() then + self:AddOrUpdateAuraInstanceID(aura:GetAuraInstanceID(), aura) + end + end + return + end + AuraUtil_ForEachAura(self.unit:GetOMToken(), 'HARMFUL', nil, function(a) local aura = Bastion.Aura:CreateFromUnitAuraInfo(a)