This commit is contained in:
Logan Payton
2018-05-16 14:45:41 -04:00
parent 3345f43f11
commit 1dc8964dab
+21 -9
View File
@@ -70,6 +70,11 @@ local floor, min, mod = math.floor, math.min, math.mod
local CreateFrame = CreateFrame
local GetTime = GetTime
local UnitAura = UnitAura
local GetPlayerBuff = GetPlayerBuff
local GetPlayerBuffTexture = GetPlayerBuffTexture
local GetPlayerBuffApplications = GetPlayerBuffApplications
local GetPlayerBuffDispelType = GetPlayerBuffDispelType
local GetPlayerBuffTimeLeft = GetPlayerBuffTimeLeft
local VISIBLE = 1
local HIDDEN = 0
@@ -138,15 +143,25 @@ end
local function updateIcon(element, unit, index, offset, filter, isDebuff, visible)
local name, rank, texture, count, dispelType, duration, expiration = UnitAura(unit, index, filter)
if unit == "player" then
local idx = GetPlayerBuff(index - 1, filter)
if idx < 0 then return end
texture = GetPlayerBuffTexture(idx)
count = GetPlayerBuffApplications(idx)
dispelType = GetPlayerBuffDispelType(idx)
duration = GetPlayerBuffTimeLeft(idx)
end
if element.forceShow then
name, rank, texture = GetSpellInfo(26993)
count, dispelType, duration, expiration = 5, 'Magic', 0, 60
end
if(name) then
if not name then return end
local position = visible + offset + 1
local button = element[position]
if(not button) then
if not button then
--[[ Override: Auras:CreateIcon(position)
Used to create the aura button at a given position.
@@ -183,7 +198,8 @@ local function updateIcon(element, unit, index, offset, filter, isDebuff, visibl
show = (element.CustomFilter or customFilter) (element, unit, button, name, rank, texture, count, dispelType, duration, expiration)
end
if show then
if not show then return HIDDEN end
-- We might want to consider delaying the creation of an actual cooldown
-- object to this point, but I think that will just make things needlessly
-- complicated.
@@ -232,10 +248,6 @@ local function updateIcon(element, unit, index, offset, filter, isDebuff, visibl
end
return VISIBLE
else
return HIDDEN
end
end
end
local function SetPosition(element, from, to)
@@ -463,7 +475,7 @@ end
local function Enable(self)
if self.Buffs or self.Debuffs or self.Auras then
self:RegisterEvent('UNIT_AURA', UpdateAuras)
self:RegisterEvent('PLAYER_AURAS_CHANGED', UpdateAuras)
local buffs = self.Buffs
if buffs then
@@ -504,7 +516,7 @@ end
local function Disable(self)
if self.Buffs or self.Debuffs or self.Auras then
self:UnregisterEvent('UNIT_AURA', UpdateAuras)
self:UnregisterEvent('PLAYER_AURAS_CHANGED', UpdateAuras)
if self.Buffs then self.Buffs:Hide() end
if self.Debuffs then self.Debuffs:Hide() end