Skip to content

Commit adb91fe

Browse files
committed
Implemented support for the Keyring.
Closes #586.
1 parent 12928c6 commit adb91fe

File tree

7 files changed

+50
-10
lines changed

7 files changed

+50
-10
lines changed

Localization.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ L["One section per item slot."] = true
170170
L["Only one section."] = true
171171
L["Please note this filter matchs every item. Any filter with lower priority than this one will have no effect."] = true
172172
L["Put any item that can be equipped (including bags) into the \"Equipment\" section."] = true
173+
L["Put items categorized as keys in their own section."] = true
173174
L["Put items in sections depending on their first-level category at the Auction House."] = true
174175
L["Put quest-related items in their own section."] = true
175176
L["Quest Items"] = true
@@ -341,6 +342,7 @@ L["Bag #%d"] = true
341342
L["Bank bag #%d"] = true
342343
L["Click to toggle the equipped bag panel, so you can change them."] = true
343344
L["Close"] = true
345+
L["Keyring"] = true
344346
L["Right-click to toggle %s."] = true
345347
L["auto-sort"] = true
346348
L["disabled"] = true
@@ -470,6 +472,7 @@ L["Jewelry"] = "Joaillerie"
470472
L["Junk category"] = "Catégorie camelote"
471473
L["Keep all stacks together."] = "Conserver les piles ensembles."
472474
L["KEYRING_TAG"] = "Cl"
475+
L["Keyring"] = "Trousseau de clés"
473476
L["LDB Plugin"] = "Plugin LDB"
474477
L["LEATHERWORKING_BAG_TAG"] = "Cu"
475478
L["Lock anchor"] = "Verrouiller l'ancre"
@@ -505,6 +508,7 @@ L["Press Alt while doing so to open a dropdown menu."] = "Presser Alt en le fais
505508
L["Priority"] = "Priorité"
506509
L["Provides a LDB data source to be displayed by LDB display addons."] = "Fournit une source LDB qui peut être affichée dans un addon d'affichage de LDB."
507510
L["Put any item that can be equipped (including bags) into the \"Equipment\" section."] = "Place les objets qui peuvent être équipés (y compris les sacs) dans la section \"Equipement\"."
511+
L["Put items categorized as keys in their own section."] = "Mettez les éléments classés comme clés dans leur propre section." -- Needs review
508512
L["Put items in sections depending on their first-level category at the Auction House."] = "Répartit les objets en fonction de leur catégorie principale (premier niveau de l'Hôtel des Ventes). "
509513
L["Put items of poor quality or labeled as junk in the \"Junk\" section."] = "Place les objets de mauvaise qualité ou considéré comme camelote dans la section \"Camelote\"."
510514
L["Put quest-related items in their own section."] = "Place les objets en rapport avec les quêtes dans une section spécifique."
@@ -664,6 +668,7 @@ L["Item information"] = "Gegenstandsinformation"
664668
L["Items"] = "Gegenstände"
665669
L["Jewelry"] = "Schmuck" -- Needs review
666670
L["KEYRING_TAG"] = "Schl"
671+
L["Keyring"] = "Schlüsselbund"
667672
L["LDB Plugin"] = "LBD Plugin"
668673
L["LEATHERWORKING_BAG_TAG"] = "Le"
669674
L["Lock anchor"] = "Anker abschließen"
@@ -688,6 +693,7 @@ L["Position mode"] = "Positions Modus"
688693
L["Priority"] = "Priorität"
689694
L["Provides a LDB data source to be displayed by LDB display addons."] = "Sieht vor, dass eine LDB Datenquelle von DataBroker Addons angezeigt wird"
690695
L["Put any item that can be equipped (including bags) into the \"Equipment\" section."] = "Zeigt jeden verwendbaren Gegenstand (inklusive Taschen) im \"Equipment\" Bereich."
696+
L["Put items categorized as keys in their own section."] = "Legen Sie als Schlüssel kategorisierte Elemente in einen eigenen Abschnitt." -- Needs review
691697
L["Put items in sections depending on their first-level category at the Auction House."] = "Zeigt Gegenstände basierend auf der ersten Kategorie des Auktoinshauses in den Bereichen an"
692698
L["Put items of poor quality or labeled as junk in the \"Junk\" section."] = "Zeigt Gegenstände geringer Qualität oder als Müll gekennzeichnete Gegenstände im \"Junk\" Bereich an."
693699
L["Put quest-related items in their own section."] = "Zeigt questbezogene Gegenstände in einem eigenen Bereich an"
@@ -822,6 +828,7 @@ L["Item information"] = "Информация о предмете"
822828
L["Items"] = "Предметы"
823829
L["Jewelry"] = "Драгоценности"
824830
L["KEYRING_TAG"] = "Клч"
831+
L["Keyring"] = "Связка ключей"
825832
L["LDB Plugin"] = "Плагин LDB"
826833
L["LEATHERWORKING_BAG_TAG"] = "Кж"
827834
L["Lock anchor"] = "Блокировать якорь"
@@ -846,6 +853,7 @@ L["Position mode"] = "Режим позиционирования"
846853
L["Priority"] = "Приоритет"
847854
L["Provides a LDB data source to be displayed by LDB display addons."] = "Позволяет отображать источник LDB данных другими аддонами для отображения LDB." -- Needs review
848855
L["Put any item that can be equipped (including bags) into the \"Equipment\" section."] = "Поместить все предметы которые могут быть одеты на персонажа (включая сумки) в секцию \"Экипировка\""
856+
L["Put items categorized as keys in their own section."] = "Поместите элементы, отнесенные к категории ключей, в отдельный раздел." -- Needs review
849857
L["Put items in sections depending on their first-level category at the Auction House."] = "Раскладывать вещи в сумках, используя общие категории аукциона."
850858
L["Put items of poor quality or labeled as junk in the \"Junk\" section."] = "Поместить предметы низкого качества или помеченных как хлам с секцию \"Хлам\"."
851859
L["Put quest-related items in their own section."] = "Поместить предметы связанные с заданием в свою секцию."
@@ -962,6 +970,7 @@ L["Plugins"] = "Accesorio, complemento."
962970
L["Priority"] = "Prioridad"
963971
L["Provides a LDB data source to be displayed by LDB display addons."] = "Proporciona una fuente de datos de Carga que se muestran en el panel del ayudante LDB.(loaddatabase)"
964972
L["Put any item that can be equipped (including bags) into the \"Equipment\" section."] = "Ponga cualquier elemento que puede ser equipado (incluyendo las bolsas) en la sección \"equipo\" ."
973+
L["Put items categorized as keys in their own section."] = "Coloque los elementos categorizados como claves en su propia sección." -- Needs review
965974
L["Put items in sections depending on their first-level category at the Auction House."] = "Coloca los artículos en las secciones en función de su primer nivel de categoría de la casa de subastas."
966975
L["Put items of poor quality or labeled as junk in the \"Junk\" section."] = "Coloca los artículos de mala calidad o etiquetados como basura en la sección \"basura\" ."
967976
L["Put quest-related items in their own section."] = [=[Poner los objetos relacionados con misiones en su correspondiente seccion.
@@ -1113,6 +1122,7 @@ L["Jewelry"] = "飾品"
11131122
L["Junk category"] = "垃圾" -- Needs review
11141123
L["Keep all stacks together."] = "保持全部堆疊合起來。"
11151124
L["KEYRING_TAG"] = "Ke"
1125+
L["Keyring"] = "鑰匙圈"
11161126
L["LDB Plugin"] = "LDB 插件"
11171127
L["LEATHERWORKING_BAG_TAG"] = "皮類" -- Needs review
11181128
L["Let SyLevel handle the the display."] = "讓(SyLevel)處理的顯示。" -- Needs review
@@ -1149,6 +1159,7 @@ L["Press Alt while doing so to open a dropdown menu."] = "按下Alt鍵,而這
11491159
L["Priority"] = "優先順序"
11501160
L["Provides a LDB data source to be displayed by LDB display addons."] = "提供LDB顯示插件的資料來源"
11511161
L["Put any item that can be equipped (including bags) into the \"Equipment\" section."] = "放置可裝備物品至「裝備」類別。" -- Needs review
1162+
L["Put items categorized as keys in their own section."] = "將分類為鍵的項目放在它們自己的部分中。" -- Needs review
11521163
L["Put items in sections depending on their first-level category at the Auction House."] = "按拍賣場主類型規則類別放置物品。" -- Needs review
11531164
L["Put items of poor quality or labeled as junk in the \"Junk\" section."] = "將劣質或垃圾裝備放置於垃圾類別。" -- Needs review
11541165
L["Put quest-related items in their own section."] = "將任務相關物品置入相關類別" -- Needs review
@@ -1353,6 +1364,7 @@ L["Jewelry"] = "饰品"
13531364
L["Junk category"] = "垃圾"
13541365
L["Keep all stacks together."] = "将所有堆叠合并"
13551366
L["KEYRING_TAG"] = ""
1367+
L["Keyring"] = "钥匙链"
13561368
L["LDB Plugin"] = "LDB 组件"
13571369
L["LEATHERWORKING_BAG_TAG"] = ""
13581370
L["Lock anchor"] = "锁定锚点"
@@ -1388,6 +1400,7 @@ L["Press Alt while doing so to open a dropdown menu."] = "按下Alt键将打开
13881400
L["Priority"] = "优先级"
13891401
L["Provides a LDB data source to be displayed by LDB display addons."] = "给 LDB 提供数据资料, 以便符合 LDB 规范的插件使用."
13901402
L["Put any item that can be equipped (including bags) into the \"Equipment\" section."] = "放置可装备物品至[装备]分组"
1403+
L["Put items categorized as keys in their own section."] = "将归类为键的项目放在它们自己的部分中。" -- Needs review
13911404
L["Put items in sections depending on their first-level category at the Auction House."] = "按拍卖行主类型规则分组放置物品."
13921405
L["Put items of poor quality or labeled as junk in the \"Junk\" section."] = "将低品质或者垃圾物品放入[垃圾]分组"
13931406
L["Put quest-related items in their own section."] = "将任务物品放入相关分组"
@@ -1597,6 +1610,7 @@ L["Jewelry"] = "장신구"
15971610
L["Junk category"] = "잡동사니"
15981611
L["Keep all stacks together."] = "모든 중첩을 함께 유지합니다."
15991612
L["KEYRING_TAG"] = "열쇠"
1613+
L["Keyring"] = "열쇠고리"
16001614
L["LDB Plugin"] = "LDB 플러그인"
16011615
L["LEATHERWORKING_BAG_TAG"] = "가세"
16021616
L["Legacy"] = "기존 스타일"
@@ -1634,6 +1648,7 @@ L["Press Alt while doing so to open a dropdown menu."] = "드롭다운 메뉴를
16341648
L["Priority"] = "우선 순위"
16351649
L["Provides a LDB data source to be displayed by LDB display addons."] = "LDB 표시 애드온에 표시될 LDB 데이터 소스를 제공합니다."
16361650
L["Put any item that can be equipped (including bags) into the \"Equipment\" section."] = "착용할 수 있는 모든 아이템(가방 포함)을 \"장비\" 항목으로 분류합니다."
1651+
L["Put items categorized as keys in their own section."] = "키로 분류 된 항목을 자체 섹션에 넣습니다." -- Needs review
16371652
L["Put items in sections depending on their first-level category at the Auction House."] = "경매장의 1차 범주에 따라 아이템을 항목으로 분류합니다."
16381653
L["Put items of poor quality or labeled as junk in the \"Junk\" section."] = "하급 아이템이나 잡동사니 아이템을 \"잡동사니\" 항목으로 분류합니다."
16391654
L["Put quest-related items in their own section."] = "퀘스트 관련 아이템을 항목으로 분류합니다."
@@ -1839,6 +1854,7 @@ L["Jewelry"] = "Jóias"
18391854
L["Junk category"] = "Categoria de sucata"
18401855
L["Keep all stacks together."] = "Manter todas as pilhas juntas"
18411856
L["KEYRING_TAG"] = "Ch"
1857+
L["Keyring"] = "Chaveiro"
18421858
L["LDB Plugin"] = "Plugin LDB"
18431859
L["LEATHERWORKING_BAG_TAG"] = "Co"
18441860
L["Let SyLevel handle the the display."] = "Permite que SyLevel suporte a tela"
@@ -1875,6 +1891,7 @@ L["Press Alt while doing so to open a dropdown menu."] = "Pressione Alt enquanto
18751891
L["Priority"] = "Prioridade"
18761892
L["Provides a LDB data source to be displayed by LDB display addons."] = "Fornece uma fonte LDB para ser exibida por LDB addons"
18771893
L["Put any item that can be equipped (including bags) into the \"Equipment\" section."] = "Põe qualquer item que pode ser equipado (incluindo bolsas) na categoria \"equipamento\""
1894+
L["Put items categorized as keys in their own section."] = "Coloque os itens categorizados como chaves em sua própria seção." -- Needs review
18781895
L["Put items in sections depending on their first-level category at the Auction House."] = "Põe itens em seções dependendo da categoria inicial na Casa de Leilões"
18791896
L["Put items of poor quality or labeled as junk in the \"Junk\" section."] = "Põe itens de qualidade inferior ou rotulados como sucata na seção \"Sucata\" "
18801897
L["Put quest-related items in their own section."] = "Põe itens relativos a missões em suas respectivas seções"

core/Constants.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ local L = addon.L
2626
local _G = _G
2727
local BACKPACK_CONTAINER = _G.BACKPACK_CONTAINER
2828
local BANK_CONTAINER = _G.BANK_CONTAINER
29+
local KEYRING_CONTAINER = _G.KEYRING_CONTAINER
2930
local NUM_BAG_SLOTS = _G.NUM_BAG_SLOTS
3031
local NUM_BANKBAGSLOTS = _G.NUM_BANKBAGSLOTS
3132
local pairs = _G.pairs
3233
--GLOBALS>
3334

34-
-- Backpack and bags
35-
local BAGS = { [BACKPACK_CONTAINER] = BACKPACK_CONTAINER }
35+
-- Keyring, backpack, and bags
36+
local BAGS = { [KEYRING_CONTAINER] = KEYRING_CONTAINER, [BACKPACK_CONTAINER] = BACKPACK_CONTAINER }
3637
for i = 1, NUM_BAG_SLOTS do BAGS[i] = i end
3738

38-
-- Base nank bags
39+
-- Bank and bank bags
3940
local BANK = { [BANK_CONTAINER] = BANK_CONTAINER }
4041
for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do BANK[i] = i end
4142

core/DefaultFilters.lua

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function addon:SetupDefaultFilters()
4444
local TRADE_GOODS = GetItemClassInfo(LE_ITEM_CLASS_TRADEGOODS)
4545
local WEAPON = GetItemClassInfo(LE_ITEM_CLASS_WEAPON)
4646
local ARMOR = GetItemClassInfo(LE_ITEM_CLASS_ARMOR)
47+
local KEY = GetItemClassInfo(LE_ITEM_CLASS_KEY)
4748
local JEWELRY = L['Jewelry']
4849
local EQUIPMENT = L['Equipment']
4950
local AMMUNITION = L['Ammunition']
@@ -56,9 +57,23 @@ function addon:SetupDefaultFilters()
5657
[CONSUMMABLE] = -10,
5758
[MISCELLANEOUS] = -20,
5859
[AMMUNITION] = -30,
59-
[JUNK] = -40,
60+
[KEY] = -40,
61+
[JUNK] = -50,
6062
}
6163

64+
-- [90] Key
65+
do
66+
local keyFilter = addon:RegisterFilter('Key', 90, function(self, slotData)
67+
if slotData.bagFamily == 256 or slotData.class == KEY or slotData.subclass == KEY then
68+
return KEY
69+
else
70+
return false
71+
end
72+
end)
73+
keyFilter.uiName = KEY
74+
keyFilter.uiDesc = L['Put items categorized as keys in their own section.']
75+
end
76+
6277
-- [75] Quest Items
6378
do
6479
local questItemFilter = addon:RegisterFilter('Quest', 75, function(self, slotData)

modules/DataSource.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ local format = _G.format
2828
local GetContainerNumFreeSlots = _G.GetContainerNumFreeSlots
2929
local GetContainerNumSlots = _G.GetContainerNumSlots
3030
local ipairs = _G.ipairs
31+
local KEYRING_CONTAINER = _G.KEYRING_CONTAINER
3132
local pairs = _G.pairs
3233
local strjoin = _G.strjoin
3334
local tconcat = _G.table.concat
@@ -121,7 +122,7 @@ local function BuildSpaceString(bags)
121122
wipe(free)
122123
for bag in pairs(bags) do
123124
local bagSize = GetContainerNumSlots(bag)
124-
if bagSize and bagSize > 0 then
125+
if bag ~= KEYRING_CONTAINER and bagSize and bagSize > 0 then
125126
local bagFree, bagFamily = GetContainerNumFreeSlots(bag)
126127
if mod.db.profile.mergeBags then bagFamily = 0 end
127128
size[bagFamily] = (size[bagFamily] or 0) + bagSize

widgets/BagSlots.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ local GetItemInfo = _G.GetItemInfo
4949
local GetNumBankSlots = _G.GetNumBankSlots
5050
local ipairs = _G.ipairs
5151
local IsInventoryItemLocked = _G.IsInventoryItemLocked
52+
local KEYRING_CONTAINER = _G.KEYRING_CONTAINER
5253
local next = _G.next
5354
local NUM_BAG_SLOTS = _G.NUM_BAG_SLOTS
5455
local NUM_BANKGENERIC_SLOTS = _G.NUM_BANKGENERIC_SLOTS
@@ -103,7 +104,7 @@ do
103104
addon:Debug('FindSlotForItem', itemId, GetItemInfo(itemId), 'count=', itemCount, 'maxStack=', maxStack, 'family=', itemFamily, 'bags:', unpack(bags))
104105
local bestBag, bestSlot, bestScore
105106
for i, bag in pairs(bags) do
106-
local scoreBonus = band(select(2, GetContainerNumFreeSlots(bag)) or 0, itemFamily) ~= 0 and maxStack or 0
107+
local scoreBonus = band(bag == KEYRING_CONTAINER and 256 or select(2, GetContainerNumFreeSlots(bag)) or 0, itemFamily) ~= 0 and maxStack or 0
107108
for slot = 1, GetContainerNumSlots(bag) do
108109
local texture, slotCount, locked = GetContainerItemInfo(bag, slot)
109110
if not locked and (not texture or GetContainerItemID(bag, slot) == itemId) then
@@ -456,7 +457,7 @@ function addon:CreateBagSlotPanel(container, name, bags, isBank)
456457
local x = BAG_INSET
457458
local height = 0
458459
for i, bag in ipairs(bags) do
459-
if bag ~= BACKPACK_CONTAINER and bag ~= BANK_CONTAINER then
460+
if bag ~= KEYRING_CONTAINER and bag ~= BACKPACK_CONTAINER and bag ~= BANK_CONTAINER then
460461
local button = buttonClass:Create(bag)
461462
button:SetParent(self)
462463
button:SetPoint("TOPLEFT", x, -TOP_PADDING)

widgets/ContainerFrame.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ local GetCursorInfo = _G.GetCursorInfo
4141
local GetItemInfo = _G.GetItemInfo
4242
local GetMerchantItemLink = _G.GetMerchantItemLink
4343
local ipairs = _G.ipairs
44+
local KEYRING_CONTAINER = _G.KEYRING_CONTAINER
4445
local max = _G.max
4546
local min = _G.min
4647
local next = _G.next
@@ -384,7 +385,7 @@ local function FindBagWithRoom(self, itemFamily)
384385
for bag in pairs(self:GetBagIds()) do
385386
local numFree, family = GetContainerNumFreeSlots(bag)
386387
if numFree and numFree > 0 then
387-
if band(family, itemFamily) ~= 0 then
388+
if band(bag == KEYRING_CONTAINER and 256 or family, itemFamily) ~= 0 then
388389
return bag
389390
elseif not fallback then
390391
fallback = bag
@@ -495,6 +496,7 @@ function containerProto:UpdateContent(bag)
495496
local content = self.content[bag]
496497
local newSize = self:GetBagIds()[bag] and GetContainerNumSlots(bag) or 0
497498
local _, bagFamily = GetContainerNumFreeSlots(bag)
499+
bagFamily = bag == KEYRING_CONTAINER and 256 or bagFamily
498500
content.family = bagFamily
499501
for slot = 1, newSize do
500502
local itemId = GetContainerItemID(bag, slot)
@@ -588,7 +590,9 @@ end
588590
local function FilterByBag(slotData)
589591
local bag = slotData.bag
590592
local name
591-
if bag == BACKPACK_CONTAINER then
593+
if bag == KEYRING_CONTAINER then
594+
name = L['Keyring']
595+
elseif bag == BACKPACK_CONTAINER then
592596
name = L['Backpack']
593597
elseif bag == BANK_CONTAINER then
594598
name = L['Bank']

widgets/ItemButton.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ local IsContainerItemAnUpgrade = _G.IsContainerItemAnUpgrade
3838
local IsInventoryItemLocked = _G.IsInventoryItemLocked
3939
local ITEM_QUALITY_COMMON = _G.Enum.ItemQuality.Standard
4040
local ITEM_QUALITY_POOR = _G.Enum.ItemQuality.Poor
41+
local KEYRING_CONTAINER = _G.KEYRING_CONTAINER
4142
local next = _G.next
4243
local pairs = _G.pairs
4344
local select = _G.select
@@ -275,7 +276,7 @@ function buttonProto:FullUpdate()
275276
self.itemLink = GetContainerItemLink(bag, slot)
276277
self.hasItem = not not self.itemId
277278
self.texture = GetContainerItemInfo(bag, slot)
278-
self.bagFamily = select(2, GetContainerNumFreeSlots(bag))
279+
self.bagFamily = bag == KEYRING_CONTAINER and 256 or select(2, GetContainerNumFreeSlots(bag))
279280
self:Update()
280281
end
281282

0 commit comments

Comments
 (0)