From 87e5cb8d8c4822d1c5f2b769789d158e9558aa67 Mon Sep 17 00:00:00 2001 From: asmeralt Date: Sun, 9 Oct 2022 23:30:32 +0300 Subject: [PATCH] Feature: Sort Only Visible Bags --- classes/frame.lua | 8 +++- config/general.lua | 97 +++++++++++++++++++------------------- localization/config/cn.lua | 1 + localization/config/de.lua | 0 localization/config/en.lua | 1 + localization/config/es.lua | 1 + localization/config/fr.lua | 1 + localization/config/it.lua | 1 + localization/config/ko.lua | 1 + localization/config/pt.lua | 1 + localization/config/ru.lua | 1 + localization/config/tw.lua | 1 + 12 files changed, 65 insertions(+), 49 deletions(-) mode change 100644 => 100755 localization/config/cn.lua mode change 100644 => 100755 localization/config/de.lua mode change 100644 => 100755 localization/config/en.lua mode change 100644 => 100755 localization/config/es.lua mode change 100644 => 100755 localization/config/fr.lua mode change 100644 => 100755 localization/config/it.lua mode change 100644 => 100755 localization/config/ko.lua mode change 100644 => 100755 localization/config/pt.lua mode change 100644 => 100755 localization/config/ru.lua mode change 100644 => 100755 localization/config/tw.lua diff --git a/classes/frame.lua b/classes/frame.lua index 1cdeda9..a5e4bb4 100644 --- a/classes/frame.lua +++ b/classes/frame.lua @@ -89,7 +89,13 @@ end --[[ Shared ]]-- function Frame:SortItems() - Addon.Sorting:Start(self:GetOwner(), self.Bags) + local sortingBags = {} + for _, bag in pairs(self.Bags) do + if self:IsShowingBag(bag) or not Addon.sets.sortOnlyShowingBags then + table.insert(sortingBags, bag) + end + end + Addon.Sorting:Start(self:GetOwner(), sortingBags) end function Frame:IsShowingBag(bag) diff --git a/config/general.lua b/config/general.lua index 5ab3da7..d9eaf38 100644 --- a/config/general.lua +++ b/config/general.lua @@ -1,48 +1,49 @@ ---[[ - general.lua - General settings menu ---]] - -local CONFIG = ... -local L = LibStub('AceLocale-3.0'):GetLocale(CONFIG) -local ADDON, Addon = CONFIG:match('[^_]+'), _G[CONFIG:match('[^_]+')] -local General = Addon.OptionsGroup('GeneralOptions') - -function General:Populate() - self:AddCheck('locked') - self:AddCheck('tipCount') - - if CanGuildBankRepair and self.sets.tipCount then - local guild = self:AddCheck('countGuild') - guild.left = guild.left + 10 - guild:SetSmall(true) - end - - self:AddCheck('flashFind') - self:AddCheck('displayBlizzard') - - local global = self:Add('Check', L.CharacterSpecific) - global:SetChecked(Addon.profile ~= Addon.sets.global) - global:SetCall('OnInput', function() self:ToggleGlobals() end) -end - -function General:ToggleGlobals() - if Addon.profile == Addon.sets.global then - self:SetProfile(CopyTable(Addon.sets.global)) - else - LibStub('Sushi-3.1').Popup { - id = ADDON .. 'ConfirmGlobals', - text = L.ConfirmGlobals, button1 = YES, button2 = NO, - whileDead = 1, exclusive = 1, hideOnEscape = 1, - OnAccept = function() - self:SetProfile(nil) - self:Update() - end - } - end -end - -function General:SetProfile(profile) - Addon:SetCurrentProfile(profile) - Addon.Frames:Update() -end +--[[ + general.lua + General settings menu +--]] + +local CONFIG = ... +local L = LibStub('AceLocale-3.0'):GetLocale(CONFIG) +local ADDON, Addon = CONFIG:match('[^_]+'), _G[CONFIG:match('[^_]+')] +local General = Addon.OptionsGroup('GeneralOptions') + +function General:Populate() + self:AddCheck('locked') + self:AddCheck('tipCount') + + if CanGuildBankRepair and self.sets.tipCount then + local guild = self:AddCheck('countGuild') + guild.left = guild.left + 10 + guild:SetSmall(true) + end + + self:AddCheck('flashFind') + self:AddCheck('displayBlizzard') + self:AddCheck('sortOnlyShowingBags') + + local global = self:Add('Check', L.CharacterSpecific) + global:SetChecked(Addon.profile ~= Addon.sets.global) + global:SetCall('OnInput', function() self:ToggleGlobals() end) +end + +function General:ToggleGlobals() + if Addon.profile == Addon.sets.global then + self:SetProfile(CopyTable(Addon.sets.global)) + else + LibStub('Sushi-3.1').Popup { + id = ADDON .. 'ConfirmGlobals', + text = L.ConfirmGlobals, button1 = YES, button2 = NO, + whileDead = 1, exclusive = 1, hideOnEscape = 1, + OnAccept = function() + self:SetProfile(nil) + self:Update() + end + } + end +end + +function General:SetProfile(profile) + Addon:SetCurrentProfile(profile) + Addon.Frames:Update() +end diff --git a/localization/config/cn.lua b/localization/config/cn.lua old mode 100644 new mode 100755 index a6e1022..a367ff7 --- a/localization/config/cn.lua +++ b/localization/config/cn.lua @@ -16,6 +16,7 @@ L.CountGuild = '包含公会银行' L.FlashFind = '闪烁搜索' L.DisplayBlizzard = '显示暴雪框架隐藏背包' L.DisplayBlizzardTip = '如果启用,隐藏背包或银行容器将显示默认暴雪用户界面背包面板。\n\n|cffff1919需要重载用户界面。|r' +L.SortOnlyShowingBags = '不要从停用的袋子中订购物品' L.ConfirmGlobals = '确定要禁用特定此角色的特定设置?所有特定设置将丢失。' L.CharacterSpecific = '角色特定设置' diff --git a/localization/config/de.lua b/localization/config/de.lua old mode 100644 new mode 100755 diff --git a/localization/config/en.lua b/localization/config/en.lua old mode 100644 new mode 100755 index 34dcb58..9b09d96 --- a/localization/config/en.lua +++ b/localization/config/en.lua @@ -14,6 +14,7 @@ L.CountGuild = 'Include Guild Banks' L.FlashFind = 'Flash Find' L.DisplayBlizzard = 'Fallback Hidden Bags' L.DisplayBlizzardTip = 'If enabled, the default Blizzard UI bag panels will be displayed for hidden inventory or bank containers.\n\n|cffff1919Requires UI reload.|r' +L.SortOnlyShowingBags = 'Do not sort items from hidden bags' L.ConfirmGlobals = 'Are you sure you want to disable specific settings for this character? All specific settings will be lost.' L.CharacterSpecific = 'Character Specific Settings' diff --git a/localization/config/es.lua b/localization/config/es.lua old mode 100644 new mode 100755 index 8554764..1e3dc07 --- a/localization/config/es.lua +++ b/localization/config/es.lua @@ -15,6 +15,7 @@ L.TipCount = 'Contador de objetos en tooltips' L.FlashFind = 'Activar búsqueda rápida' L.DisplayBlizzard = 'Mostrar ventanas de Blizzard para bolsas desactivadas' L.DisplayBlizzardTip = 'Si se activa, se mostrará la interfaz por defecto de Blizzard para bolsas ocultas del inventario o del banco.\n\n|cffff1919Requiere reiniciar la interfaz (UI Reload).|r' +L.SortOnlyShowingBags = 'No ordene artículos de bolsas desactivadas' L.ConfirmGlobals = '¿Estás seguro de que quieres desactivar la configuración específica para este personaje? Se perderán todos los ajustes guardados.' L.CharacterSpecific = 'Ajustes del personaje' diff --git a/localization/config/fr.lua b/localization/config/fr.lua old mode 100644 new mode 100755 index 257a028..d49acb9 --- a/localization/config/fr.lua +++ b/localization/config/fr.lua @@ -18,6 +18,7 @@ L.CountGuild = 'Inclure les banques de guilde' L.FlashFind = 'Activer résultat éclair' L.EmptySlots = 'Afficher un fond sur les emplacements vides' L.DisplayBlizzard = 'Afficher les cadres de Blizzard pour les sacs désactivés' +L.SortOnlyShowingBags = 'НNe commandez pas d\'articles à partir les sacs désactivés' -- frame L.FrameOptions = 'Options des fenêtres' diff --git a/localization/config/it.lua b/localization/config/it.lua old mode 100644 new mode 100755 index 45a94a9..4aa9da4 --- a/localization/config/it.lua +++ b/localization/config/it.lua @@ -15,6 +15,7 @@ L.CountGuild = 'Includi Banca di Gilda' L.FlashFind = 'Attiva Ricerca Veloce.' L.DisplayBlizzard = 'Mostra le finestre di Blizzard per le borse disabilitate.' L.DisplayBlizzardTip = 'Se abilitato, verrà utilizzata l\'interfaccia Blizzard di base per le sacche o gli inventari di banca nascosti.\n\n|cffff1919Richiede un riavvio dell\'UI.|r' +L.SortOnlyShowingBags = 'Non ordinare articoli le borse disattivate' L.ConfirmGlobals = 'Sei sicuro di voler disabilitare le impostazioni specifiche per questo personaggio? Tutte le impostazioni specifiche verranno perse.' L.CharacterSpecific = 'Impostazioni specifiche personaggio' diff --git a/localization/config/ko.lua b/localization/config/ko.lua old mode 100644 new mode 100755 index 3a56d89..4298007 --- a/localization/config/ko.lua +++ b/localization/config/ko.lua @@ -15,6 +15,7 @@ L.CountGuild = '길드 금고 포함' L.FlashFind = '빠른 찾기 사용' L.DisplayBlizzard = '숨은 가방 대비책' L.DisplayBlizzardTip = '만약 활성화하면 숨긴 가방 또는 은행 저장소에 대해 기본 블리자드 UI 가방 창이 표시됩니다.\n\n|cffff1919UI 리로드가 필요합니다.|r' +L.SortOnlyShowingBags = '비활성화된 가방에서 품목을 주문하지 마십시오.' L.ConfirmGlobals = '이 캐릭터에 대한 개별 설정을 비활성화 하시겠습니까? 모든 개별 설정을 잃게됩니다.' L.CharacterSpecific = '캐릭터 개별 설정' diff --git a/localization/config/pt.lua b/localization/config/pt.lua old mode 100644 new mode 100755 index df93db6..e9435ce --- a/localization/config/pt.lua +++ b/localization/config/pt.lua @@ -14,6 +14,7 @@ L.TipCount = 'Ativar contagem de itens nas dicas' L.FlashFind = 'Ativar Flash Find' L.EmptySlots = 'Mostrar fundo em espaços para itens vazios' L.DisplayBlizzard = 'Mostrar janelas da Blizzard para sacos desligados' +L.SortOnlyShowingBags = 'Não peça itens de sacos desligados' -- frame L.FrameOptions = 'Preferências de Janela' diff --git a/localization/config/ru.lua b/localization/config/ru.lua old mode 100644 new mode 100755 index ddbb83c..a88b3f7 --- a/localization/config/ru.lua +++ b/localization/config/ru.lua @@ -15,6 +15,7 @@ L.CountGuild = 'Учитывать банк гильдии' L.FlashFind = 'Включить мгновенный поиск' L.DisplayBlizzard = 'Использовать стандартные окна для скрытых сумок' L.DisplayBlizzardTip = 'Если настройка включена, скрытые сумки инвентаря или банка будут использовать стандартный интерфейс Blizzard.\n\n|cffff1919Потребуется перезагрузка интерфейса.|r' +L.SortOnlyShowingBags = 'Не сортировать предметы из скрытых сумок' L.ConfirmGlobals = 'Уверены, что хотите отключить использование индивидуальных настроек для этого персонажа? Все индивидуальные настройки будут потеряны.' L.CharacterSpecific = 'Использовать отдельные настройки для текущего персонажа' diff --git a/localization/config/tw.lua b/localization/config/tw.lua old mode 100644 new mode 100755 index 3106706..268e16f --- a/localization/config/tw.lua +++ b/localization/config/tw.lua @@ -15,6 +15,7 @@ L.CountGuild = '包括工會銀行' L.FlashFind = '閃爍找到' L.EmptySlots = '在空的槽位顯示背景顏色' L.DisplayBlizzard = '隱藏的背包顯示為內建框架' +L.SortOnlyShowingBags = '不要從停用的袋子中訂購物品' -- frame L.FrameOptions = '框架設定'