From 37b1697dc5143b8b2b8c3308545a3363de57d5ac Mon Sep 17 00:00:00 2001 From: bhhandley Date: Sun, 22 Dec 2024 12:03:57 -0600 Subject: [PATCH] Added option to move buffs/debuffs with no duration to the end (#56) * Added option to move buffs/debuffs with no duration to the end of the list * Forgot to remove some testing code --- ElvUI/Modules/Auras/Auras.lua | 12 ++++++++++++ ElvUI/Modules/UnitFrames/Elements/Auras.lua | 16 +++++++++++++++- ElvUI_OptionsUI/Auras.lua | 6 ++++++ ElvUI_OptionsUI/Locales/deDE.lua | 2 ++ ElvUI_OptionsUI/Locales/enUS.lua | 2 ++ ElvUI_OptionsUI/Locales/esMX.lua | 2 ++ ElvUI_OptionsUI/Locales/frFR.lua | 2 ++ ElvUI_OptionsUI/Locales/koKR.lua | 2 ++ ElvUI_OptionsUI/Locales/ptBR.lua | 2 ++ ElvUI_OptionsUI/Locales/ruRU.lua | 2 ++ ElvUI_OptionsUI/Locales/zhCN.lua | 2 ++ ElvUI_OptionsUI/Locales/zhTW.lua | 2 ++ ElvUI_OptionsUI/UnitFrames.lua | 10 ++++++++-- 13 files changed, 59 insertions(+), 3 deletions(-) diff --git a/ElvUI/Modules/Auras/Auras.lua b/ElvUI/Modules/Auras/Auras.lua index deb293f..4a57508 100644 --- a/ElvUI/Modules/Auras/Auras.lua +++ b/ElvUI/Modules/Auras/Auras.lua @@ -584,6 +584,18 @@ function A:UpdateHeader(header) local sortMethod = (sorters[db.sortMethod] or sorters.INDEX)[db.sortDir == "-"][db.seperateOwn] tsort(sortingTable, sortMethod) + if db.noDurationLast then + local tempAuras = {} + for i = 1, #sortingTable do + if sortingTable[i].duration == 0 then + table.insert(tempAuras, 1, sortingTable[i]) + else + table.insert(tempAuras, sortingTable[i]) + end + end + sortingTable = tempAuras + end + self:ConfigureAuras(header, sortingTable, weaponPosition) while sortingTable[1] do releaseTable(tremove(sortingTable)) diff --git a/ElvUI/Modules/UnitFrames/Elements/Auras.lua b/ElvUI/Modules/UnitFrames/Elements/Auras.lua index fba8b75..f739e01 100644 --- a/ElvUI/Modules/UnitFrames/Elements/Auras.lua +++ b/ElvUI/Modules/UnitFrames/Elements/Auras.lua @@ -440,6 +440,20 @@ function UF:SortAuras() sort(self, SortAurasByCaster) end + if self.db.noDurationLast and self[1] then + local tempAuras = {} + for i = 1, #self do + if self[i].duration == 0 then + table.insert(tempAuras, self[i]) + else + table.insert(tempAuras, 1, self[i]) + end + end + for i = 1, #tempAuras do + self[i] = tempAuras[i] + end + end + --Look into possibly applying filter priorities for auras here. return 1, #self --from/to range needed for the :SetPosition call in oUF aura element. Without this aura icon position gets all whacky when not sorted by index @@ -510,7 +524,7 @@ function UF:AuraFilter(unit, button, name, _, _, _, debuffType, duration, expira else db = parent.db and parent.db[self.type] end - + if not db then return true end diff --git a/ElvUI_OptionsUI/Auras.lua b/ElvUI_OptionsUI/Auras.lua index d5c7d88..907b66a 100644 --- a/ElvUI_OptionsUI/Auras.lua +++ b/ElvUI_OptionsUI/Auras.lua @@ -105,6 +105,12 @@ local function GetAuraOptions(headerName) [0] = L["No Sorting"], [1] = L["Your Auras First"] } + }, + noDurationLast = { + order = 13, + type = "toggle", + name = L["No Duration Last"], + desc = L["Show buffs with no duration last."], } } diff --git a/ElvUI_OptionsUI/Locales/deDE.lua b/ElvUI_OptionsUI/Locales/deDE.lua index c7d50f2..5b7877c 100644 --- a/ElvUI_OptionsUI/Locales/deDE.lua +++ b/ElvUI_OptionsUI/Locales/deDE.lua @@ -704,6 +704,7 @@ L["Neutral"] = "Neutral" L["Never Hide"] = "Niemals verstecken" L["No Alert In Combat"] = "Kein Alarm im Kampf" L["No Duration"] = true +L["No Duration Last"] = true L["No Sorting"] = "Nicht Sortieren" L["Non-Interruptable"] = "Nicht-Unterbrechbar" L["Non-Target Alpha"] = "Nicht-Anvisiert Alpha" @@ -917,6 +918,7 @@ L["Show Aura From Other Players"] = "Zeige Auren von anderen Spielern" L["Show Auras"] = "Zeige Auren" L["Show Bind on Equip/Use Text"] = "Zeigt gebunden beim Aufheben/Anlegen Text" L["Show Both"] = "Zeige Beide" +L["Show buffs with no duration last."] = true L["Show Coins"] = "Währungssymbole anzeigen" L["Show Dispellable Debuffs"] = "Zeige stehlbare Schwächungszauber" L["Show Empty Buttons"] = "Zeige leere Tasten" diff --git a/ElvUI_OptionsUI/Locales/enUS.lua b/ElvUI_OptionsUI/Locales/enUS.lua index 5989b66..bdf13e0 100644 --- a/ElvUI_OptionsUI/Locales/enUS.lua +++ b/ElvUI_OptionsUI/Locales/enUS.lua @@ -708,6 +708,7 @@ L["Neutral"] = true L["Never Hide"] = true L["No Alert In Combat"] = true L["No Duration"] = true +L["No Duration Last"] = true L["No Sorting"] = true L["Non-Interruptable"] = true L["Non-Target Alpha"] = true @@ -923,6 +924,7 @@ L["Show Aura From Other Players"] = true L["Show Auras"] = true L["Show Bind on Equip/Use Text"] = true L["Show Both"] = true +L["Show buffs with no duration last."] = true L["Show Coins"] = true L["Show Dispellable Debuffs"] = true L["Show Empty Buttons"] = true diff --git a/ElvUI_OptionsUI/Locales/esMX.lua b/ElvUI_OptionsUI/Locales/esMX.lua index 970d160..db97732 100644 --- a/ElvUI_OptionsUI/Locales/esMX.lua +++ b/ElvUI_OptionsUI/Locales/esMX.lua @@ -707,6 +707,7 @@ L["Neutral"] = "Neutral" L["Never Hide"] = "Nunca Ocultar" L["No Alert In Combat"] = true L["No Duration"] = true +L["No Duration Last"] = true L["No Sorting"] = "No Ordenar" L["Non-Interruptable"] = "No-Interrumpible" L["Non-Target Alpha"] = true @@ -920,6 +921,7 @@ L["Show Aura From Other Players"] = "Mostrar Auras de Otros Jugadores" L["Show Auras"] = "Mostrar Auras" L["Show Bind on Equip/Use Text"] = true L["Show Both"] = "Mostrar Ambos" +L["Show buffs with no duration last."] = true L["Show Coins"] = true L["Show Dispellable Debuffs"] = true L["Show Empty Buttons"] = true diff --git a/ElvUI_OptionsUI/Locales/frFR.lua b/ElvUI_OptionsUI/Locales/frFR.lua index 68bd3c7..3a9eb18 100644 --- a/ElvUI_OptionsUI/Locales/frFR.lua +++ b/ElvUI_OptionsUI/Locales/frFR.lua @@ -708,6 +708,7 @@ L["Neutral"] = "Neutre" L["Never Hide"] = "Jamais caché" L["No Alert In Combat"] = "Pas d'alerte en combat" L["No Duration"] = true +L["No Duration Last"] = true L["No Sorting"] = "Aucun tri" L["Non-Interruptable"] = "Non-interruptible" L["Non-Target Alpha"] = true @@ -921,6 +922,7 @@ L["Show Aura From Other Players"] = "N'importe quelle unité" L["Show Auras"] = "Afficher les auras" L["Show Bind on Equip/Use Text"] = true L["Show Both"] = "Afficher les deux" +L["Show buffs with no duration last."] = true L["Show Coins"] = "Afficher les pièces" L["Show Dispellable Debuffs"] = "Voir les affaiblissements dissipables" L["Show Empty Buttons"] = "Voir les emplacements vide" diff --git a/ElvUI_OptionsUI/Locales/koKR.lua b/ElvUI_OptionsUI/Locales/koKR.lua index 5fd62f7..b06f32e 100644 --- a/ElvUI_OptionsUI/Locales/koKR.lua +++ b/ElvUI_OptionsUI/Locales/koKR.lua @@ -707,6 +707,7 @@ L["Neutral"] = "중립" L["Never Hide"] = "항시 표시" L["No Alert In Combat"] = "전투 중 알리지 않기" L["No Duration"] = true +L["No Duration Last"] = true L["No Sorting"] = "구분 없음" L["Non-Interruptable"] = "차단불가능 기술" L["Non-Target Alpha"] = true @@ -920,6 +921,7 @@ L["Show Aura From Other Players"] = "다른 유저가 건 주문효과도 표시 L["Show Auras"] = "오라아이콘 표시" L["Show Bind on Equip/Use Text"] = true L["Show Both"] = "둘 다 배경 표시" +L["Show buffs with no duration last."] = true L["Show Coins"] = "동전 이미지로 보기" L["Show Dispellable Debuffs"] = "해제가능한 약화효과 표시" L["Show Empty Buttons"] = "빈 칸 표시" diff --git a/ElvUI_OptionsUI/Locales/ptBR.lua b/ElvUI_OptionsUI/Locales/ptBR.lua index 3576b22..ece5824 100644 --- a/ElvUI_OptionsUI/Locales/ptBR.lua +++ b/ElvUI_OptionsUI/Locales/ptBR.lua @@ -707,6 +707,7 @@ L["Neutral"] = "Neutro" L["Never Hide"] = "Nunca Esconder" L["No Alert In Combat"] = true L["No Duration"] = true +L["No Duration Last"] = true L["No Sorting"] = "Não organizado" L["Non-Interruptable"] = "Não interrompível" L["Non-Target Alpha"] = true @@ -920,6 +921,7 @@ L["Show Aura From Other Players"] = "Mostrar Auras de outros Jogadores" L["Show Auras"] = "Mostrar Auras" L["Show Bind on Equip/Use Text"] = true L["Show Both"] = "Mostrar Ambos" +L["Show buffs with no duration last."] = true L["Show Coins"] = true L["Show Dispellable Debuffs"] = true L["Show Empty Buttons"] = true diff --git a/ElvUI_OptionsUI/Locales/ruRU.lua b/ElvUI_OptionsUI/Locales/ruRU.lua index 04cfff3..5e87e1a 100644 --- a/ElvUI_OptionsUI/Locales/ruRU.lua +++ b/ElvUI_OptionsUI/Locales/ruRU.lua @@ -704,6 +704,7 @@ L["Neutral"] = "Нейтральный" L["Never Hide"] = "Никогда не скрывать" L["No Alert In Combat"] = "Без оповещений в бою" L["No Duration"] = true +L["No Duration Last"] = true L["No Sorting"] = "Без сортировки" L["Non-Interruptable"] = "Непрерываемые" L["Non-Target Alpha"] = "Прозрачность не цели" @@ -917,6 +918,7 @@ L["Show Aura From Other Players"] = "Отображать чужие" L["Show Auras"] = "Показать ауры" L["Show Bind on Equip/Use Text"] = "Отображать текст ПпН/ПпИ" L["Show Both"] = "Показать оба" +L["Show buffs with no duration last."] = true L["Show Coins"] = "Показывать монеты" L["Show Dispellable Debuffs"] = "Показывать развеиваемые дебаффы" L["Show Empty Buttons"] = "Показывать пустые кнопки" diff --git a/ElvUI_OptionsUI/Locales/zhCN.lua b/ElvUI_OptionsUI/Locales/zhCN.lua index a4a832d..5a35818 100644 --- a/ElvUI_OptionsUI/Locales/zhCN.lua +++ b/ElvUI_OptionsUI/Locales/zhCN.lua @@ -704,6 +704,7 @@ L["Neutral"] = "中立" L["Never Hide"] = "从不隐藏" L["No Alert In Combat"] = "战斗中不警报" L["No Duration"] = true +L["No Duration Last"] = true L["No Sorting"] = "不排序" L["Non-Interruptable"] = "不可打断" L["Non-Target Alpha"] = "非目标透明度" @@ -917,6 +918,7 @@ L["Show Aura From Other Players"] = "显示其他玩家的光环" L["Show Auras"] = "显示光环" L["Show Bind on Equip/Use Text"] = "显示绑定状态" L["Show Both"] = "全部显示" +L["Show buffs with no duration last."] = true L["Show Coins"] = "显示硬币" L["Show Dispellable Debuffs"] = "显示可驱散的减益光环" L["Show Empty Buttons"] = "显示空白按钮" diff --git a/ElvUI_OptionsUI/Locales/zhTW.lua b/ElvUI_OptionsUI/Locales/zhTW.lua index e4cc3e7..f7c5333 100644 --- a/ElvUI_OptionsUI/Locales/zhTW.lua +++ b/ElvUI_OptionsUI/Locales/zhTW.lua @@ -704,6 +704,7 @@ L["Neutral"] = "中立" L["Never Hide"] = "從不隱藏" L["No Alert In Combat"] = "戰鬥中不警報" L["No Duration"] = true +L["No Duration Last"] = true L["No Sorting"] = "不分類" L["Non-Interruptable"] = "不可斷法的施法條色" L["Non-Target Alpha"] = "非目標透明度" @@ -917,6 +918,7 @@ L["Show Aura From Other Players"] = "顯示其他玩家的光環" L["Show Auras"] = "顯示光環" L["Show Bind on Equip/Use Text"] = "顯示裝綁文字" L["Show Both"] = "全部顯示" +L["Show buffs with no duration last."] = true L["Show Coins"] = "顯示硬幣" L["Show Dispellable Debuffs"] = "顯示無法驅散的debuff" L["Show Empty Buttons"] = "顯示空白按鈕" diff --git a/ElvUI_OptionsUI/UnitFrames.lua b/ElvUI_OptionsUI/UnitFrames.lua index 00c73ad..6043261 100644 --- a/ElvUI_OptionsUI/UnitFrames.lua +++ b/ElvUI_OptionsUI/UnitFrames.lua @@ -498,8 +498,14 @@ local function GetOptionsTable_Auras(auraType, updateFunc, groupName, numUnits) ["DESCENDING"] = L["Descending"] } }, - stacks = { + noDurationLast = { order = 12, + type = "toggle", + name = L["No Duration Last"], + desc = L["Show buffs with no duration last."], + }, + stacks = { + order = 13, type = "group", name = L["Stack Counter"], guiInline = true, @@ -528,7 +534,7 @@ local function GetOptionsTable_Auras(auraType, updateFunc, groupName, numUnits) } }, duration = { - order = 13, + order = 14, type = "group", name = L["Duration"], guiInline = true,