diff --git a/Chocobo.lua b/Chocobo.lua index 421eadf..62d012d 100644 --- a/Chocobo.lua +++ b/Chocobo.lua @@ -212,7 +212,13 @@ function C:CheckMount() local found = false local index = 1 repeat - local name = UnitBuff("player", index, "PLAYER CANCELABLE") + local name + if WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC then + name = UnitBuff("player", index, "PLAYER CANCELABLE") + else + local aura = C_UnitAuras.GetBuffDataByIndex("player", index, "PLAYER CANCELABLE") + name = aura and aura.name + end if not name then break end -- No more buffs to check if self.Global["CUSTOM"][name:lower()] then self:PlayRandomMusic(name) diff --git a/libs/ChocoboLib/ChocoboLib.lua b/libs/ChocoboLib/ChocoboLib.lua index bea6663..413f252 100644 --- a/libs/ChocoboLib/ChocoboLib.lua +++ b/libs/ChocoboLib/ChocoboLib.lua @@ -59,10 +59,26 @@ end --[[ChocoboLib Specific Functions]]-- -- Buff/Aura functions +local G_UnitBuff = _G.UnitBuff +local UnitBuff + +if WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC then + UnitBuff = function(unit, index, filter) + local name, _, _, _, _, _, _, _, _, id = G_UnitBuff(unit, index, filter) + return name, id + end +else + UnitBuff = function(unit, index, filter) + local aura = C_UnitAuras.GetBuffDataByIndex(unit, index, filter) + if not aura then return nil, nil end + return aura.name, aura.spellId + end +end + local function GetBuffs() local buffs = {} for i=1,40 do -- Loop through all 40 possible buff indexes - local name, _, _, _, _, _, _, _, _, id = UnitBuff("player", i, "PLAYER CANCELABLE") -- Get buff on index i + local name, id = UnitBuff("player", i, "PLAYER CANCELABLE") -- Get buff on index i -- Insert it into the buffs table, break if buff is nil (that means no other buffs exist on the player) if name and id then buffs[name] = id else break end end