fix import for TW and general issue with BuffsDebuffs
This commit is contained in:
		| @@ -7,6 +7,7 @@ LibClassAuras.debuffs = {} | ||||
| LibClassAuras.debuffToId = {} | ||||
| LibClassAuras.buffs = {} | ||||
| LibClassAuras.buffToId = {} | ||||
| LibClassAuras.altNames = {} | ||||
|  | ||||
| local function Spell(id, opts, class, spellTable, idTable) | ||||
|     if not opts or not class then | ||||
| @@ -26,9 +27,20 @@ local function Spell(id, opts, class, spellTable, idTable) | ||||
|         return | ||||
|     end | ||||
|     if opts.altName then | ||||
|         idTable[opts.altName] = {id = id , class = class} | ||||
|         for _,v in ipairs(id) do | ||||
|             LibClassAuras.altNames[v] = opts.altName | ||||
|         end | ||||
|         if idTable[opts.altName] then | ||||
|             tinsert(idTable[opts.altName], {id = id , class = class}) | ||||
|         else | ||||
|         idTable[spellName] = {id = id , class = class} | ||||
|             idTable[opts.altName] = {[1] = {id = id , class = class}} | ||||
|         end | ||||
|     else | ||||
|         if idTable[spellName] then | ||||
|             tinsert(idTable[spellName], {id = id , class = class}) | ||||
|         else | ||||
|             idTable[spellName] = {[1] = {id = id , class = class}} | ||||
|         end | ||||
|     end | ||||
|  | ||||
|     if type(id) == "table" then | ||||
| @@ -54,9 +66,11 @@ LibClassAuras.Buff = Buff | ||||
|  | ||||
| local function getClassDebuffs(class) | ||||
|     local classSpells = {} | ||||
|     for k,v in pairs(LibClassAuras.debuffToId) do | ||||
|         if v.class == class then | ||||
|             tinsert(classSpells, {name = k, id = v.id}) | ||||
|     for name, spells in pairs(LibClassAuras.debuffToId) do | ||||
|         for _, spellInfo in ipairs(spells) do | ||||
|             if spellInfo.class == class then | ||||
|                 tinsert(classSpells, {name = name, id = spellInfo.id}) | ||||
|             end | ||||
|         end | ||||
|     end | ||||
|     return classSpells | ||||
| @@ -65,9 +79,11 @@ LibClassAuras.GetClassDebuffs = getClassDebuffs | ||||
|  | ||||
| local function getClassBuffs(class) | ||||
|     local classSpells = {} | ||||
|     for k,v in pairs(LibClassAuras.buffToId) do | ||||
|         if v.class == class then | ||||
|             tinsert(classSpells, {name = k, id = v.id}) | ||||
|     for name, spells in pairs(LibClassAuras.buffToId) do | ||||
|         for _, spellInfo in ipairs(spells) do | ||||
|             if spellInfo.class == class then | ||||
|                 tinsert(classSpells, {name = name, id = spellInfo.id}) | ||||
|             end | ||||
|         end | ||||
|     end | ||||
|     return classSpells | ||||
| @@ -83,3 +99,8 @@ local function getSpellNameToId(auraType) | ||||
| end | ||||
|  | ||||
| LibClassAuras.GetSpellNameToId = getSpellNameToId | ||||
|  | ||||
| local function getAltName(spellID) | ||||
|     return LibClassAuras.altNames[spellID] | ||||
| end | ||||
| LibClassAuras.GetAltName = getAltName | ||||
| @@ -138,7 +138,8 @@ function BuffsDebuffs:Test(unit) | ||||
|  | ||||
|         BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF) | ||||
|         BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF) | ||||
|  | ||||
|         --BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 1243, select(1, GetSpellInfo(1243)), select(3, GetSpellInfo(1243)), 10, GetTime() + 10, 1, "physical") | ||||
|         --self:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 31117, select(1, GetSpellInfo(31117)), select(3, GetSpellInfo(31117)), 10, GetTime() + 10, 1, "physical") | ||||
|         local i = 1 | ||||
|         for spellID, enabled in pairs(Gladdy.db.trackedDebuffs) do | ||||
|             if i > 4 then | ||||
| @@ -197,13 +198,24 @@ function BuffsDebuffs:AURA_GAIN(unit, auraType, spellID, spellName, texture, dur | ||||
|         return | ||||
|     end | ||||
|     local auraFrame = self.frames[unit] | ||||
|     spellName = LibClassAuras.GetAltName(spellID) or spellName | ||||
|     local aura = Gladdy:GetImportantAuras()[spellName] and Gladdy.db.auraListDefault[tostring(Gladdy:GetImportantAuras()[spellName].spellID)].enabled | ||||
|     if aura and Gladdy.db.buffsShowAuraDebuffs then | ||||
|         aura = false | ||||
|     end | ||||
|     local auraNames = LibClassAuras.GetSpellNameToId(auraType) | ||||
|     local spellId = auraNames[spellName] and auraNames[spellName].id[1] | ||||
|     if not aura and spellID and spellId and expirationTime and (Gladdy.db.trackedBuffs[tostring(spellId)] or Gladdy.db.trackedDebuffs[tostring(spellId)]) then | ||||
|     local spellId | ||||
|     local isTracked = false | ||||
|     if auraNames[spellName] then | ||||
|         for _, spellInfo in ipairs(auraNames[spellName]) do | ||||
|             spellId = spellInfo.id[1] | ||||
|             if (Gladdy.db.trackedBuffs[tostring(spellId)] or Gladdy.db.trackedDebuffs[tostring(spellId)]) then | ||||
|                 isTracked = true | ||||
|                 break | ||||
|             end | ||||
|         end | ||||
|     end | ||||
|     if not aura and spellID and expirationTime and isTracked then | ||||
|         local index | ||||
|         if auraType == AURA_TYPE_DEBUFF then | ||||
|             auraFrame.numDebuffs = auraFrame.numDebuffs + 1 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user