Auras sorting by name and alt textures

This commit is contained in:
Sumsebrum 2021-06-15 12:20:33 +02:00
parent c970fe576f
commit 54e0aa4a47

View File

@ -141,10 +141,10 @@ function Auras:Test(unit)
local spellName, _, icon local spellName, _, icon
if (unit == "arena1") then if (unit == "arena1") then
spellName, _, icon = GetSpellInfo(12826) spellName, _, icon = GetSpellInfo(7922)
self:AURA_FADE(unit, AURA_TYPE_BUFF) self:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AURA_FADE(unit, AURA_TYPE_DEBUFF) self:AURA_FADE(unit, AURA_TYPE_DEBUFF)
self:AURA_GAIN(unit,AURA_TYPE_DEBUFF, 12826, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration) self:AURA_GAIN(unit,AURA_TYPE_DEBUFF, 7922, spellName, icon, self.auras[spellName].duration + 2, GetTime() + self.auras[spellName].duration + 2)
elseif (unit == "arena2") then elseif (unit == "arena2") then
spellName, _, icon = GetSpellInfo(6770) spellName, _, icon = GetSpellInfo(6770)
self:AURA_FADE(unit, AURA_TYPE_BUFF) self:AURA_FADE(unit, AURA_TYPE_BUFF)
@ -173,6 +173,10 @@ function Auras:AURA_GAIN(unit, auraType, spellID, spellName, icon, duration, exp
return return
end end
if spellID == 31117 then
spellName = "Unstable Affliction Silence"
end
if not self.auras[spellName] then if not self.auras[spellName] then
return return
end end
@ -189,7 +193,7 @@ function Auras:AURA_GAIN(unit, auraType, spellID, spellName, icon, duration, exp
auraFrame.name = spellName auraFrame.name = spellName
auraFrame.timeLeft = expirationTime - GetTime() auraFrame.timeLeft = expirationTime - GetTime()
auraFrame.priority = Gladdy.db.auraListDefault[tostring(self.auras[spellName].spellID)].priority auraFrame.priority = Gladdy.db.auraListDefault[tostring(self.auras[spellName].spellID)].priority
auraFrame.icon:SetTexture(icon) auraFrame.icon:SetTexture(Gladdy:GetImportantAuras()[GetSpellInfo(self.auras[spellName].spellID)] and Gladdy:GetImportantAuras()[GetSpellInfo(self.auras[spellName].spellID)].texture or icon)
auraFrame.track = auraType auraFrame.track = auraType
auraFrame.active = true auraFrame.active = true
auraFrame.icon.overlay:Show() auraFrame.icon.overlay:Show()
@ -389,19 +393,22 @@ function Auras:GetAuraOptions(auraType)
tinsert(auras, v.spellID) tinsert(auras, v.spellID)
end end
end end
tbl_sort(auras) tbl_sort(auras, function(a, b) return GetSpellInfo(a) < GetSpellInfo(b) end)
for i,k in ipairs(auras) do for i,k in ipairs(auras) do
options[tostring(k)] = { options[tostring(k)] = {
type = "group", type = "group",
name = GetSpellInfo(k), name = Gladdy:GetImportantAuras()["Unstable Affliction Silence"]
and Gladdy:GetImportantAuras()["Unstable Affliction Silence"].spellID == k
and Gladdy:GetImportantAuras()["Unstable Affliction Silence"].altName
or GetSpellInfo(k),
order = i+2, order = i+2,
icon = select(3, GetSpellInfo(k)), icon = Gladdy:GetImportantAuras()[GetSpellInfo(k)] and Gladdy:GetImportantAuras()[GetSpellInfo(k)].texture or select(3, GetSpellInfo(k)),
args = { args = {
enabled = { enabled = {
order = 1, order = 1,
name = L["Enabled"], name = L["Enabled"],
type = "toggle", type = "toggle",
image = select(3, GetSpellInfo(k)), image = Gladdy:GetImportantAuras()[GetSpellInfo(k)] and Gladdy:GetImportantAuras()[GetSpellInfo(k)].texture or select(3, GetSpellInfo(k)),
width = "2", width = "2",
set = function(info, value) set = function(info, value)
Gladdy.db.auraListDefault[tostring(k)].enabled = value Gladdy.db.auraListDefault[tostring(k)].enabled = value