Added buff containers for vanity and consolidated buffs to match base… (#98)

* Added buff containers for vanity and consolidated buffs to match base ui feature

* use locals and don't unpack values 2x

* Moved vanity and consolidated settings to base profile instead of private per character
This commit is contained in:
Jeremy P
2026-01-19 11:47:05 -08:00
committed by GitHub
parent e11b8b0817
commit 44fe39508a
5 changed files with 299 additions and 11 deletions
+195 -10
View File
@@ -1,4 +1,4 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local E, L, V, P, G = unpack(select(2, ...)) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local A = E:GetModule("Auras")
local NP = E:GetModule("NamePlates")
local LSM = E.Libs.LSM
@@ -69,7 +69,7 @@ local enchantableSlots = {
}
local weaponEnchantTime = {}
A.EnchanData = weaponEnchantTime
-- A.EnchanData = weaponEnchantTime -- unused and misspelled?
function A:UpdateTime(elapsed)
self.timeLeft = self.timeLeft - elapsed
@@ -265,11 +265,29 @@ function A:Update_CooldownOptions(button)
end
local buttons = {}
local vanityButton = {}
local consolidatedButton = {}
local expiringVanityOrConsolidated = 0
function A:triggerUpdateOnNext()
expiringVanityOrConsolidated = 1
end
local function checkExpiringVanityAndConsolidated()
if expiringVanityOrConsolidated > 0 and expiringVanityOrConsolidated <= GetTime() then
expiringVanityOrConsolidated = 0
return true
end
end
function A:ConfigureAuras(header, auraTable, weaponPosition)
local headerName = header:GetName()
local db = self.db.debuffs
if header.filter == "HELPFUL" then
db = self.db.buffs
expiringVanityOrConsolidated = 0
wipe(vanityButton)
wipe(consolidatedButton)
end
local xOffset, yOffset, wrapXOffset, wrapYOffset, minWidth, minHeight
@@ -335,19 +353,73 @@ function A:ConfigureAuras(header, auraTable, weaponPosition)
button.text:Hide()
end
button.texture:SetTexture(buffInfo.icon)
button:SetParent(header)
if buffInfo.filter == "HARMFUL" then
local color = DebuffTypeColor[buffInfo.dispelType or ""]
button:SetBackdropBorderColor(color.r, color.g, color.b)
button.statusBar.backdrop:SetBackdropBorderColor(color.r, color.g, color.b)
button:SetParent(header)
buttons[i] = button
else
local cr, cg, cb = unpack(E.media.bordercolor)
button:SetBackdropBorderColor(cr, cg, cb)
button.statusBar.backdrop:SetBackdropBorderColor(cr, cg, cb)
local exitTime, expiring = 0, false
if buffInfo.expires > 0 and buffInfo.duration > 30 then
exitTime = buffInfo.expires - max(10, buffInfo.duration / 10)
expiring = exitTime < GetTime()
end
if E.db.auras.mergeVanity and not expiring and C_VanityCollection.IsConsolidatedVanityBuff(buffInfo.spellID) then
button:SetParent(ElvuiVanityBuffsTooltip)
button:Show()
vanityButton[#vanityButton+1] = button
if exitTime > 0 then
if expiringVanityOrConsolidated > 0 then
expiringVanityOrConsolidated = min(expiringVanityOrConsolidated, exitTime)
else
expiringVanityOrConsolidated = exitTime
end
end
elseif E.db.auras.mergeConsolidated and not expiring and buffInfo.shouldConsolidate then
button:SetParent(ElvuiConsolidatedBuffsTooltip)
button:Show()
consolidatedButton[#consolidatedButton+1] = button
if exitTime > 0 then
if expiringVanityOrConsolidated > 0 then
expiringVanityOrConsolidated = min(expiringVanityOrConsolidated, exitTime)
else
expiringVanityOrConsolidated = exitTime
end
end
else
buttons[#buttons+1] = button
end
end
button.texture:SetTexture(buffInfo.icon)
end
buttons[i] = button
if header.filter == "HELPFUL" then
if #vanityButton > 0 then
ElvuiVanityBuffs:Show()
ElvuiVanityBuffs.count:SetText(#vanityButton)
tinsert(buttons, 1, ElvuiVanityBuffs)
else
ElvuiVanityBuffs:Hide()
ElvuiVanityBuffs.count:SetText("")
end
if #consolidatedButton > 0 then
ElvuiConsolidatedBuffs:Show()
ElvuiConsolidatedBuffs.count:SetText(#consolidatedButton)
tinsert(buttons, 1, ElvuiConsolidatedBuffs)
else
ElvuiConsolidatedBuffs:Hide()
ElvuiConsolidatedBuffs.count:SetText("")
end
end
if weaponPosition then
@@ -476,6 +548,8 @@ function A:ConfigureAuras(header, auraTable, weaponPosition)
header:SetWidth(minWidth)
header:SetHeight(minHeight)
end
A:ElvuiConsolidatedBuffs_UpdateAllAnchors()
A:ElvuiVanityBuffs_UpdateAllAnchors()
end
local freshTable
@@ -505,7 +579,7 @@ local function sortFactory(key, separateOwn, reverse)
else
return a.filter < b.filter
end
end;
end
else
return function(a, b)
if a.filter == b.filter then
@@ -517,7 +591,7 @@ local function sortFactory(key, separateOwn, reverse)
else
return a.filter < b.filter
end
end;
end
end
else
if reverse then
@@ -527,7 +601,7 @@ local function sortFactory(key, separateOwn, reverse)
else
return a.filter < b.filter
end
end;
end
else
return function(a, b)
if a.filter == b.filter then
@@ -535,7 +609,7 @@ local function sortFactory(key, separateOwn, reverse)
else
return a.filter < b.filter
end
end;
end
end
end
end
@@ -569,7 +643,7 @@ function A:UpdateHeader(header)
local i = 1
repeat
local aura, _ = freshTable()
aura.name, _, aura.icon, aura.count, aura.dispelType, aura.duration, aura.expires, aura.caster = UnitAura("player", i, filter)
aura.name, _, aura.icon, aura.count, aura.dispelType, aura.duration, aura.expires, aura.caster, _, aura.shouldConsolidate, aura.spellID = UnitAura("player", i, filter)
if aura.name then
aura.filter = filter
aura.index = i
@@ -628,6 +702,115 @@ function A:CreateAuraHeader(filter)
return header
end
function A:ActuallyUpdateAllAnchors(buttons, tooltip)
local index = 0
db = self.db.buffs
local xOffset, wrapYOffset
local size = db.size
local wrapAfter = 4
local offset = floor(size / 2)
xOffset = db.horizontalSpacing + size
wrapYOffset = (db.verticalSpacing + size) * -1
for _, buff in pairs(buttons) do
index = index + 1
local tick, cycle = floor((index - 1) % wrapAfter), floor((index - 1) / wrapAfter)
buff:ClearAllPoints()
buff:SetPoint("TOPLEFT", tooltip, offset + tick * xOffset, cycle * wrapYOffset - offset)
buff:SetSize(size, size)
end
local wm, hm = min(index, wrapAfter), floor((index + wrapAfter - 1) / wrapAfter)
tooltip:SetWidth( size + wm * size + (wm - 1) * db.horizontalSpacing)
tooltip:SetHeight( offset + hm * size + hm * db.verticalSpacing)
end
function A:ElvuiConsolidatedBuffs_UpdateAllAnchors()
self:ActuallyUpdateAllAnchors(consolidatedButton, ElvuiConsolidatedBuffsTooltip)
end
function A:ElvuiVanityBuffs_UpdateAllAnchors()
self:ActuallyUpdateAllAnchors(vanityButton, ElvuiVanityBuffsTooltip)
end
local function ElvuiConsolidatedBuffs_OnUpdate(self)
-- tooltip stuff
-- need 1-pixel outer padding because otherwise at certain resolutions OnEnter will trigger with IsMouseOver returning false
if ( self.mousedOver and not self:IsMouseOver(1, -1, -1, 1) ) then
self.mousedOver = nil
if ( not ElvuiConsolidatedBuffsTooltip:IsMouseOver() ) then
ElvuiConsolidatedBuffsTooltip:Hide()
end
end
end
local function ElvuiConsolidatedBuffs_OnEnter(self)
ElvuiConsolidatedBuffsTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, 0)
A:ElvuiConsolidatedBuffs_UpdateAllAnchors()
ElvuiConsolidatedBuffsTooltip:Show()
ElvuiConsolidatedBuffs.mousedOver = true
end
local function ElvuiVanityBuffs_OnUpdate(self)
-- tooltip stuff
-- need 1-pixel outer padding because otherwise at certain resolutions OnEnter will trigger with IsMouseOver returning false
if ( self.mousedOver and not self:IsMouseOver(1, -1, -1, 1) ) then
self.mousedOver = nil
if ( not ElvuiVanityBuffsTooltip:IsMouseOver() ) then
ElvuiVanityBuffsTooltip:Hide()
end
end
end
local function ElvuiVanityBuffs_OnEnter(self)
ElvuiVanityBuffsTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, 0)
A:ElvuiVanityBuffs_UpdateAllAnchors()
ElvuiVanityBuffsTooltip:Show()
ElvuiVanityBuffs.mousedOver = true
end
local function InitConsolidated(offset)
local cr, cg, cb = unpack(E.media.bordercolor)
local br, bg, bb = unpack(E.media.backdropcolor)
A:CreateIcon(ElvuiConsolidatedBuffs)
ElvuiConsolidatedBuffs.statusBar:Hide()
ElvuiConsolidatedBuffs.texture:SetTexture("Interface\\Buttons\\BuffConsolidation")
ElvuiConsolidatedBuffs.texture:SetTexCoord(0.1, 0.4, 0.2, 0.8)
ElvuiConsolidatedBuffs.texture:SetInside()
ElvuiConsolidatedBuffs:SetBackdropBorderColor(cr, cg, cb)
ElvuiConsolidatedBuffs.statusBar.backdrop:SetBackdropBorderColor(cr, cg, cb)
ElvuiConsolidatedBuffs:SetScript("OnUpdate", ElvuiConsolidatedBuffs_OnUpdate)
ElvuiConsolidatedBuffs:SetScript("OnEnter", ElvuiConsolidatedBuffs_OnEnter)
ElvuiConsolidatedBuffsTooltip:SetBackdrop({
bgFile = E.media.glossTex or E.media.blankTex,
edgeFile = E.media.blankTex,
edgeSize = E.mult,
insets = {left = -E.mult, right = -E.mult, top = -E.mult, bottom = -E.mult}
})
ElvuiConsolidatedBuffsTooltip:SetScale(E.global.general.UIScale)
ElvuiConsolidatedBuffsTooltip:SetBackdropBorderColor(cr, cg, cb)
ElvuiConsolidatedBuffsTooltip:SetBackdropColor(br, bg, bb)
A:CreateIcon(ElvuiVanityBuffs)
ElvuiVanityBuffs.statusBar:Hide()
ElvuiVanityBuffs.texture:SetTexture("Interface\\Icons\\INV_Chest_Awakening")
ElvuiVanityBuffs:SetBackdropBorderColor(cr, cg, cb)
ElvuiVanityBuffs.statusBar.backdrop:SetBackdropBorderColor(cr, cg, cb)
ElvuiVanityBuffs:SetScript("OnUpdate", ElvuiVanityBuffs_OnUpdate)
ElvuiVanityBuffs:SetScript("OnEnter", ElvuiVanityBuffs_OnEnter)
ElvuiVanityBuffsTooltip:SetBackdrop({
bgFile = E.media.glossTex or E.media.blankTex,
edgeFile = E.media.blankTex,
edgeSize = E.mult,
insets = {left = -E.mult, right = -E.mult, top = -E.mult, bottom = -E.mult}
})
ElvuiVanityBuffsTooltip:SetScale(E.global.general.UIScale)
ElvuiVanityBuffsTooltip:SetBackdropBorderColor(cr, cg, cb)
ElvuiVanityBuffsTooltip:SetBackdropColor(br, bg, bb)
end
function A:Initialize()
if E.private.auras.disableBlizzard then
BuffFrame:Kill()
@@ -647,6 +830,8 @@ function A:Initialize()
self.LBFGroup = LBF and LBF:Group("ElvUI", "Auras")
end
InitConsolidated(floor(self.db.buffs.size / 2))
self.BuffFrame = self:CreateAuraHeader("HELPFUL")
self.BuffFrame:Point("TOPRIGHT", MMHolder, "TOPLEFT", -(6 + E.Border), -E.Border - E.Spacing)
E:CreateMover(self.BuffFrame, "BuffsMover", L["Player Buffs"], nil, nil, nil, nil, nil, "auras,buffs")
@@ -665,7 +850,7 @@ function A:Initialize()
if GetRangedWeaponEnchantInfo then
hasRangedEnchant, rangedExpiration = GetRangedWeaponEnchantInfo()
end
if A:HasEnchant(1, hasMainHandEnchant, mainHandExpiration) or A:HasEnchant(2, hasOffHandEnchant, offHandExpiration) or A:HasEnchant(3, hasRangedEnchant, rangedExpiration) then
if A:HasEnchant(1, hasMainHandEnchant, mainHandExpiration) or A:HasEnchant(2, hasOffHandEnchant, offHandExpiration) or A:HasEnchant(3, hasRangedEnchant, rangedExpiration) or checkExpiringVanityAndConsolidated() then
A:UpdateHeader(bf)
end
end)
+80
View File
@@ -1,3 +1,83 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Auras.lua"/>
<Button name="ElvuiConsolidatedBuffs" parent="UIParent" inherits="AuraButtonTemplate" hidden="true">
</Button>
<Frame name="ElvuiConsolidatedBuffsTooltip" frameStrata="FULLSCREEN_DIALOG" clampedToScreen="true" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" />
</Anchors>
<Size>
<AbsDimension x="60" y="60"/>
</Size>
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<EdgeSize>
<AbsValue val="16"/>
</EdgeSize>
<TileSize>
<AbsValue val="16"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="4" right="4" top="4" bottom="4"/>
</BackgroundInsets>
</Backdrop>
<Scripts>
<OnLoad>
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b);
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b);
</OnLoad>
<OnEnter>
self.mousedOver = true;
</OnEnter>
<OnUpdate>
if ( self.mousedOver and not ElvuiConsolidatedBuffs.mousedOver and not self:IsMouseOver() ) then
self.mousedOver = nil;
self:Hide();
end
</OnUpdate>
<OnHide>
self.mousedOver = nil;
</OnHide>
</Scripts>
</Frame>
<Button name="ElvuiVanityBuffs" parent="UIParent" inherits="AuraButtonTemplate" hidden="true">
</Button>
<Frame name="ElvuiVanityBuffsTooltip" frameStrata="FULLSCREEN_DIALOG" clampedToScreen="true" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" />
</Anchors>
<Size>
<AbsDimension x="60" y="60"/>
</Size>
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<EdgeSize>
<AbsValue val="16"/>
</EdgeSize>
<TileSize>
<AbsValue val="16"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="4" right="4" top="4" bottom="4"/>
</BackgroundInsets>
</Backdrop>
<Scripts>
<OnLoad>
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b);
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b);
</OnLoad>
<OnEnter>
self.mousedOver = true;
</OnEnter>
<OnUpdate>
if ( self.mousedOver and not ElvuiVanityBuffs.mousedOver and not self:IsMouseOver() ) then
self.mousedOver = nil;
self:Hide();
end
</OnUpdate>
<OnHide>
self.mousedOver = nil;
</OnHide>
</Scripts>
</Frame>
</Ui>
+2 -1
View File
@@ -818,7 +818,8 @@ P.auras = {
mmssColor = {r = 0.56, g = 0.56, b = 0.56},
hhmmThreshold = -1,
mmssThreshold = -1
}
},
mergeVanity = true,
}
--Chat
+20
View File
@@ -149,6 +149,26 @@ E.Options.args.auras = {
E:StaticPopup_Show("PRIVATE_RL")
end
},
mergeVanity = {
order = 3.1,
type = "toggle",
name = L["Merge Vanity"],
get = function(info) return E.db.auras[info[#info]] end,
set = function(info, value)
E.db.auras[info[#info]] = value
A:triggerUpdateOnNext()
end
},
mergeConsolidated = {
order = 3.2,
type = "toggle",
name = L["Merge Consolidated"],
get = function(info) return E.db.auras[info[#info]] end,
set = function(info, value)
E.db.auras[info[#info]] = value
A:triggerUpdateOnNext()
end
},
general = {
order = 4,
type = "group",
+2
View File
@@ -326,6 +326,8 @@ L["Disable Bank Sort"] = true
L["Disable Debuff Highlight"] = true
L["Disabled Blizzard Frames"] = true
L["Disabled Blizzard"] = true
L["Merge Vanity"] = true
L["Merge Consolidated"] = true
L["Disables the focus and target of focus unitframes."] = true
L["Disables the player and pet unitframes."] = true
L["Disables the target and target of target unitframes."] = true