Modules/Auras: More fixes to aura filtering and nameplate auras

This commit is contained in:
andrew6180
2023-05-31 19:40:40 -07:00
parent ad3c7eaf28
commit 50e16a313b
8 changed files with 121 additions and 44 deletions
+14 -12
View File
@@ -7,6 +7,7 @@ local _G = _G
local wipe = wipe
local unpack = unpack
local CreateFrame = CreateFrame
local find = string.find
function NP:Construct_Auras(nameplate)
local frameName = nameplate:GetName()
@@ -21,8 +22,7 @@ function NP:Construct_Auras(nameplate)
Buffs.isNamePlate = nameplate
Buffs.initialAnchor = 'BOTTOMLEFT'
Buffs.growthX = 'RIGHT'
Buffs.growthY = 'UP'
Buffs.growthDirection = "RIGHT_UP"
Buffs.type = 'buffs'
Buffs.forceShow = nameplate == _G.ElvNP_Test
Buffs.tickers = {} -- StyleFilters
@@ -38,8 +38,7 @@ function NP:Construct_Auras(nameplate)
Debuffs.disableMouse = true
Debuffs.isNamePlate = nameplate
Debuffs.initialAnchor = 'BOTTOMLEFT'
Debuffs.growthX = 'RIGHT'
Debuffs.growthY = 'UP'
Debuffs.growthDirection = "LEFT_UP"
Debuffs.type = 'debuffs'
Debuffs.forceShow = nameplate == _G.ElvNP_Test
Debuffs.tickers = {} -- StyleFilters
@@ -48,14 +47,12 @@ function NP:Construct_Auras(nameplate)
Buffs.PreUpdate = UF.PreUpdateAura
Buffs.PreSetPosition = UF.SortAuras
Buffs.SetPosition = UF.SetPosition
Buffs.PostCreateIcon = NP.Construct_AuraIcon
Buffs.PostUpdateIcon = UF.PostUpdateAura
Buffs.CustomFilter = UF.AuraFilter
Debuffs.PreUpdate = UF.PreUpdateAura
Debuffs.PreSetPosition = UF.SortAuras
Debuffs.SetPosition = UF.SetPosition
Debuffs.PostCreateIcon = NP.Construct_AuraIcon
Debuffs.PostUpdateIcon = UF.PostUpdateAura
Debuffs.CustomFilter = UF.AuraFilter
@@ -66,14 +63,14 @@ end
function NP:Construct_AuraIcon(button)
if not button then return end
button:SetTemplate(nil, nil, nil, nil, nil, true, true)
local offset = UF.thinBorders and E.mult or E.Border
button:SetTemplate(nil, nil, nil, UF.thinBorders, true)
button.cd:SetReverse(true)
button.cd:SetInside(button)
button.cd:SetInside(button, offset, offset)
button.icon:SetDrawLayer('ARTWORK')
button.icon:SetInside()
button.icon:SetInside(button, offset, offset)
button.count:ClearAllPoints()
button.count:Point('BOTTOMRIGHT', 1, 1)
@@ -102,8 +99,7 @@ function NP:Configure_Auras(nameplate, auras, db)
auras.numRows = db.numRows
auras.onlyShowPlayer = false
auras.spacing = db.spacing
auras.growthY = UF.MatchGrowthY[db.anchorPoint] or db.growthY
auras.growthX = UF.MatchGrowthX[db.anchorPoint] or db.growthX
auras.growthDirection = db.growthDirection or "RIGHT_UP"
auras.xOffset = db.xOffset
auras.yOffset = db.yOffset
auras.anchorPoint = db.anchorPoint
@@ -114,6 +110,8 @@ function NP:Configure_Auras(nameplate, auras, db)
auras.attachTo = UF:GetAuraAnchorFrame(nameplate, db.attachTo) -- keep below SetSmartPosition
auras.num = db.numAuras * db.numRows
auras.db = db -- for auraSort
auras["growth-y"] = find(auras.growthDirection, "UP") and "UP" or "DOWN"
auras["growth-x"] = find(auras.growthDirection, "RIGHT") and "RIGHT" or "LEFT"
local index = 1
while auras[index] do
@@ -177,6 +175,10 @@ function NP:UpdateAuraSettings(button)
button.count:FontTemplate(LSM:Fetch('font', db.countFont), db.countFontSize, db.countFontOutline)
end
if button.icon then
button.icon:SetTexCoord(unpack(E.TexCoords))
end
if button.auraInfo then
wipe(button.auraInfo)
else
@@ -282,8 +282,7 @@ function NP:Update_BossMods(plate)
element.db = db
element.spacing = db.spacing
element.initialAnchor = inverse
element.growthY = UF.MatchGrowthY[anchor] or db.growthY
element.growthX = UF.MatchGrowthX[anchor] or db.growthX
element.growthDirection = db.growthDirection or "RIGHT_UP"
element.size = db.size + (db.spacing or 0)
element.height = not db.keepSizeRatio and db.height
element.rows = {}
@@ -218,8 +218,6 @@ function UF:CheckFilter(name, caster, spellID, isFriend, isPlayer, isUnit, allow
return true, spell.priority -- this is the only difference from auarbars code
elseif filterType and (filterType == "Blacklist") and (spell and spell.enable) then
return false
elseif allowDuration then
return true
end
elseif filterName == "Personal" and isPlayer and allowDuration then
return true
@@ -244,6 +242,9 @@ function UF:CheckFilter(name, caster, spellID, isFriend, isPlayer, isUnit, allow
end
end
end
if allowDuration then
return true
end
end
function UF:AuraBarFilter(unit, name, _, _, _, debuffType, duration, _, unitCaster, isStealable, _, spellID)
@@ -17,9 +17,6 @@ local UnitCanAttack = UnitCanAttack
local UnitIsFriend = UnitIsFriend
local UnitIsUnit = UnitIsUnit
UF.MatchGrowthY = { TOP = 'TOP', BOTTOM = 'BOTTOM' }
UF.MatchGrowthX = { LEFT = 'LEFT', RIGHT = 'RIGHT' }
UF.SortAuraFuncs = {
TIME_REMAINING = function(a, b, dir)
local A = a.noTime and huge or a.expiration or -huge