From 8c23ccd52305224f867aa39da002c547456e0c7a Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Sat, 2 Jun 2018 09:16:29 +0300 Subject: [PATCH] auras --- ElvUI/Libraries/oUF/elements/auras.lua | 12 +++++++----- ElvUI/Modules/UnitFrames/Elements/Auras.lua | 10 +++++----- ElvUI/Modules/UnitFrames/Units/Player.lua | 4 ++++ ElvUI/Modules/UnitFrames/Units/Target.lua | 4 ++++ ElvUI/Modules/UnitFrames/Units/TargetTarget.lua | 6 ++++++ 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ElvUI/Libraries/oUF/elements/auras.lua b/ElvUI/Libraries/oUF/elements/auras.lua index 83128cf..f4d5751 100644 --- a/ElvUI/Libraries/oUF/elements/auras.lua +++ b/ElvUI/Libraries/oUF/elements/auras.lua @@ -120,8 +120,8 @@ local function createAuraIcon(element, index) button.overlay = overlay button.UpdateTooltip = UpdateTooltip - button:SetScript('OnEnter', onEnter) - button:SetScript('OnLeave', onLeave) + button:SetScript('OnEnter', function() onEnter(this) end) + button:SetScript('OnLeave', function() onLeave(this) end) button.icon = icon button.count = count @@ -143,7 +143,7 @@ local function customFilter(element, unit, button, name) end local function updateIcon(element, unit, index, offset, filter, isDebuff, visible) - local name, rank, texture, count, dispelType, duration, expiration = UnitAura(unit, index, filter) + local texture, count, dispelType, duration, expiration = UnitAura(unit, index, filter) if unit == "player" then local idx = GetPlayerBuff(index - 1, filter) @@ -160,7 +160,7 @@ local function updateIcon(element, unit, index, offset, filter, isDebuff, visibl count, dispelType, duration, expiration = 5, 'Magic', 0, 60 end - if not name then return end + if not texture then return end local position = visible + offset + 1 local button = element[position] @@ -198,7 +198,7 @@ local function updateIcon(element, unit, index, offset, filter, isDebuff, visibl --]] local show = true if not element.forceShow then - show = (element.CustomFilter or customFilter) (element, unit, button, name, rank, texture, count, dispelType, duration, expiration) + -- show = (element.CustomFilter or customFilter) (element, unit, button, name, rank, texture, count, dispelType, duration, expiration) end if not show then return HIDDEN end @@ -479,6 +479,7 @@ end local function Enable(self) if self.Buffs or self.Debuffs or self.Auras then self:RegisterEvent('PLAYER_AURAS_CHANGED', UpdateAuras) + self:RegisterEvent('UNIT_AURA', UpdateAuras) local buffs = self.Buffs if buffs then @@ -520,6 +521,7 @@ end local function Disable(self) if self.Buffs or self.Debuffs or self.Auras then self:UnregisterEvent('PLAYER_AURAS_CHANGED', UpdateAuras) + self:UnregisterEvent('UNIT_AURA', UpdateAuras) if self.Buffs then self.Buffs:Hide() end if self.Debuffs then self.Debuffs:Hide() end diff --git a/ElvUI/Modules/UnitFrames/Elements/Auras.lua b/ElvUI/Modules/UnitFrames/Elements/Auras.lua index 4bc0168..40589f6 100644 --- a/ElvUI/Modules/UnitFrames/Elements/Auras.lua +++ b/ElvUI/Modules/UnitFrames/Elements/Auras.lua @@ -22,10 +22,10 @@ local UnitIsUnit = UnitIsUnit function UF:Construct_Buffs(frame) local buffs = CreateFrame("Frame", frame:GetName().."Buffs", frame) buffs.spacing = E.Spacing - buffs.PreSetPosition = (not frame:GetScript("OnUpdate")) and self.SortAuras or nil + --buffs.PreSetPosition = (not frame:GetScript("OnUpdate")) and self.SortAuras or nil buffs.PostCreateIcon = self.Construct_AuraIcon buffs.PostUpdateIcon = self.PostUpdateAura - buffs.CustomFilter = self.AuraFilter + --buffs.CustomFilter = self.AuraFilter buffs:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10) --Make them appear above any text element buffs.type = "buffs" --Set initial width to prevent division by zero. This value doesn't matter, as it will be updated later @@ -37,10 +37,10 @@ end function UF:Construct_Debuffs(frame) local debuffs = CreateFrame("Frame", frame:GetName().."Debuffs", frame) debuffs.spacing = E.Spacing - debuffs.PreSetPosition = (not frame:GetScript("OnUpdate")) and self.SortAuras or nil + --debuffs.PreSetPosition = (not frame:GetScript("OnUpdate")) and self.SortAuras or nil debuffs.PostCreateIcon = self.Construct_AuraIcon debuffs.PostUpdateIcon = self.PostUpdateAura - debuffs.CustomFilter = self.AuraFilter + --debuffs.CustomFilter = self.AuraFilter debuffs.type = "debuffs" debuffs:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10) --Make them appear above any text element --Set initial width to prevent division by zero. This value doesn't matter, as it will be updated later @@ -138,7 +138,7 @@ function UF:Configure_Auras(frame, auraType) auras.size = db[auraType].sizeOverride ~= 0 and db[auraType].sizeOverride or ((((auras:GetWidth() - (auras.spacing*(auras.num/rows - 1))) / auras.num)) * rows) if db[auraType].sizeOverride and db[auraType].sizeOverride > 0 then - auras:Width(db[auraType].perrow * db[auraType].sizeOverride) + E:Width(auras, db[auraType].perrow * db[auraType].sizeOverride) end local attachTo = self:GetAuraAnchorFrame(frame, db[auraType].attachTo, db.debuffs.attachTo == "BUFFS" and db.buffs.attachTo == "DEBUFFS") diff --git a/ElvUI/Modules/UnitFrames/Units/Player.lua b/ElvUI/Modules/UnitFrames/Units/Player.lua index 6861470..651f42e 100644 --- a/ElvUI/Modules/UnitFrames/Units/Player.lua +++ b/ElvUI/Modules/UnitFrames/Units/Player.lua @@ -99,6 +99,10 @@ function UF:Update_PlayerFrame(frame, db) UF:Configure_Portrait(frame) + UF:EnableDisable_Auras(frame) + UF:Configure_Auras(frame, "Buffs") + UF:Configure_Auras(frame, "Debuffs") + UF:Configure_RaidIcon(frame) E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height)) diff --git a/ElvUI/Modules/UnitFrames/Units/Target.lua b/ElvUI/Modules/UnitFrames/Units/Target.lua index 4f890c8..bd6f769 100644 --- a/ElvUI/Modules/UnitFrames/Units/Target.lua +++ b/ElvUI/Modules/UnitFrames/Units/Target.lua @@ -89,6 +89,10 @@ function UF:Update_TargetFrame(frame, db) UF:Configure_Portrait(frame) + UF:EnableDisable_Auras(frame) + UF:Configure_Auras(frame, "Buffs") + UF:Configure_Auras(frame, "Debuffs") + UF:Configure_GPS(frame) UF:Configure_RaidIcon(frame) diff --git a/ElvUI/Modules/UnitFrames/Units/TargetTarget.lua b/ElvUI/Modules/UnitFrames/Units/TargetTarget.lua index c517f1d..5932f56 100644 --- a/ElvUI/Modules/UnitFrames/Units/TargetTarget.lua +++ b/ElvUI/Modules/UnitFrames/Units/TargetTarget.lua @@ -15,6 +15,8 @@ function UF:Construct_TargetTargetFrame(frame) frame.Name = self:Construct_NameText(frame) frame.Portrait3D = self:Construct_Portrait(frame, "model") frame.Portrait2D = self:Construct_Portrait(frame, "texture") + frame.Buffs = self:Construct_Buffs(frame) + frame.Debuffs = self:Construct_Debuffs(frame) frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame) frame.InfoPanel = self:Construct_InfoPanel(frame) @@ -70,6 +72,10 @@ function UF:Update_TargetTargetFrame(frame, db) UF:Configure_Portrait(frame) + UF:EnableDisable_Auras(frame) + UF:Configure_Auras(frame, "Buffs") + UF:Configure_Auras(frame, "Debuffs") + UF:Configure_RaidIcon(frame) E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + self.db["units"].player.castbar.height))