mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-29 23:20:52 +00:00
bags: use ClassicAPI's native item search
C_Container.SetItemSearch drives the search box; slots dim from isFiltered on INVENTORY_SEARCH_UPDATE and on each slot update. Matches name, subclass, equip slot and equipment set names. Drops the tooltip-scanning full-text option.
This commit is contained in:
@@ -171,7 +171,6 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("appearance", "bags", "newitem_color", "1,1,1,1")
|
||||
pfUI:UpdateConfig("appearance", "bags", "borderlimit", "1")
|
||||
pfUI:UpdateConfig("appearance", "bags", "borderonlygear", "0")
|
||||
pfUI:UpdateConfig("appearance", "bags", "fulltext", "1")
|
||||
pfUI:UpdateConfig("appearance", "bags", "movable", "0")
|
||||
pfUI:UpdateConfig("appearance", "bags", "abovechat", "0")
|
||||
pfUI:UpdateConfig("appearance", "bags", "hidechat", "0")
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["deDE"] = {
|
||||
["Enable Energy Ticks"] = nil,
|
||||
["Enable Extended Guild Information"] = nil,
|
||||
["Enable Frame Shadow"] = nil,
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = nil,
|
||||
["Enable Item Quality Color For Equipment Only"] = nil,
|
||||
["Enable \"Loot & Spam\" Chat Window"] = nil,
|
||||
|
||||
Vendored
-1
@@ -290,7 +290,6 @@ pfUI_translation["enUS"] = {
|
||||
["Enable Energy Ticks"] = nil,
|
||||
["Enable Extended Guild Information"] = nil,
|
||||
["Enable Frame Shadow"] = nil,
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = nil,
|
||||
["Enable Item Quality Color For Equipment Only"] = nil,
|
||||
["Enable \"Loot & Spam\" Chat Window"] = nil,
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["esES"] = {
|
||||
["Enable Energy Ticks"] = "Activar tics de energía",
|
||||
["Enable Extended Guild Information"] = "Activar información de hermandad extendida",
|
||||
["Enable Frame Shadow"] = "Activar sombra del marco",
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = "Activar indicadores",
|
||||
["Enable Item Quality Color For Equipment Only"] = "Mostrar el color de calidad de objetos solo para equipo",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "Activar ventana de chat \"Botín y spam\"",
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["frFR"] = {
|
||||
["Enable Energy Ticks"] = "Activer la barre de rechargement d'énergie",
|
||||
["Enable Extended Guild Information"] = "Activer les informations de guilde étendues",
|
||||
["Enable Frame Shadow"] = "Activer l'ombre des cadres",
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = "Activer les indicateurs",
|
||||
["Enable Item Quality Color For Equipment Only"] = "Activer la couleur de la qualité des objets seulement sur les pièces d'équipement",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "Activer la fenêtre de chat \"Butins & Spam\"",
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["koKR"] = {
|
||||
["Enable Energy Ticks"] = "Energy Ticks 활성화",
|
||||
["Enable Extended Guild Information"] = "길드 정보 확장 사용",
|
||||
["Enable Frame Shadow"] = nil,
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = nil,
|
||||
["Enable Item Quality Color For Equipment Only"] = "착용장비 전용 아이템품질 색상 활성화",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "\"루팅 & 스팜\"채팅 창 사용",
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["ruRU"] = {
|
||||
["Enable Energy Ticks"] = "Включить восполнение энергии",
|
||||
["Enable Extended Guild Information"] = "Включить расширенную информацию о гильдии",
|
||||
["Enable Frame Shadow"] = "Включить тень окон",
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = "Включить индикаторы",
|
||||
["Enable Item Quality Color For Equipment Only"] = "Включить цвет качества предметов только для экипировки",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "Включить окно чата \"Добыча & Спам\"",
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["zhCN"] = {
|
||||
["Enable Energy Ticks"] = "显示能量刻度",
|
||||
["Enable Extended Guild Information"] = "公会信息扩展显示",
|
||||
["Enable Frame Shadow"] = "启用框架阴影",
|
||||
["Enable Full-Text Search"] = "启用全文搜索",
|
||||
["Enable Indicators"] = "启用指示器",
|
||||
["Enable Item Quality Color For Equipment Only"] = "仅在装备上显示品质颜色",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "启用[拾取、综合]聊天窗口",
|
||||
|
||||
Vendored
-1
@@ -281,7 +281,6 @@ pfUI_translation["zhTW"] = {
|
||||
["Enable Energy Ticks"] = "顯示能量刻度",
|
||||
["Enable Extended Guild Information"] = "公會資訊擴展顯示",
|
||||
["Enable Frame Shadow"] = "啟用框架陰影",
|
||||
["Enable Full-Text Search"] = nil,
|
||||
["Enable Indicators"] = nil,
|
||||
["Enable Item Quality Color For Equipment Only"] = "僅在裝備上顯示品質顏色",
|
||||
["Enable \"Loot & Spam\" Chat Window"] = "啟用[拾取、綜合]聊天視窗",
|
||||
|
||||
+29
-55
@@ -6,8 +6,6 @@ pfUI:RegisterModule("bags", function ()
|
||||
[1804] = {frame="picklock"},
|
||||
}
|
||||
|
||||
local scanner = libtipscan:GetScanner("input_search")
|
||||
|
||||
local function BagSortOpts()
|
||||
return {
|
||||
reverse = C.appearance.bags.sortreverse == "1",
|
||||
@@ -95,6 +93,7 @@ pfUI:RegisterModule("bags", function ()
|
||||
pfUI.bag:RegisterEvent("ITEM_LOCK_CHANGED")
|
||||
pfUI.bag:RegisterEvent("SPELLS_CHANGED")
|
||||
pfUI.bag:RegisterEvent("MERCHANT_CLOSED")
|
||||
pfUI.bag:RegisterEvent("INVENTORY_SEARCH_UPDATE")
|
||||
|
||||
pfUI.bag.delay = { UpdateBag = {} }
|
||||
|
||||
@@ -122,6 +121,11 @@ pfUI:RegisterModule("bags", function ()
|
||||
pfUI.bag:UpdateItemLock()
|
||||
end
|
||||
|
||||
if this.delay.UpdateSearch then
|
||||
this.delay.UpdateSearch = nil
|
||||
pfUI.bag:UpdateSearch()
|
||||
end
|
||||
|
||||
for bag in pairs(this.delay.UpdateBag) do
|
||||
this.delay.UpdateBag[bag] = nil
|
||||
pfUI.bag:UpdateBag(bag)
|
||||
@@ -159,6 +163,10 @@ pfUI:RegisterModule("bags", function ()
|
||||
this.delay.UpdateItemLock = true
|
||||
end
|
||||
|
||||
if event == "INVENTORY_SEARCH_UPDATE" then
|
||||
this.delay.UpdateSearch = true
|
||||
end
|
||||
|
||||
if event == "PLAYERBANKSLOTS_CHANGED" then
|
||||
this.delay.UpdateBag[-1] = true
|
||||
end
|
||||
@@ -377,6 +385,21 @@ pfUI:RegisterModule("bags", function ()
|
||||
end
|
||||
end
|
||||
|
||||
-- dim the slots that the bag search (C_Container.SetItemSearch) filters out
|
||||
local searchInfo = {}
|
||||
function pfUI.bag:UpdateSlotSearch(bag, slot)
|
||||
local info = C_Container.GetContainerItemInfo(bag, slot, searchInfo)
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(info and info.isFiltered and .25 or 1)
|
||||
end
|
||||
|
||||
function pfUI.bag:UpdateSearch()
|
||||
for bag = -2, 11 do
|
||||
for slot in ipairs(pfUI.bags[bag].slots) do
|
||||
pfUI.bag:UpdateSlotSearch(bag, slot)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI.bag:UpdateSlot(bag, slot)
|
||||
if not pfUI.bags[bag] then return end
|
||||
|
||||
@@ -465,6 +488,7 @@ pfUI:RegisterModule("bags", function ()
|
||||
SetItemButtonTexture(pfUI.bags[bag].slots[slot].frame, texture)
|
||||
SetItemButtonCount(pfUI.bags[bag].slots[slot].frame, count)
|
||||
SetItemButtonDesaturated(pfUI.bags[bag].slots[slot].frame, locked, 0.5, 0.5, 0.5)
|
||||
pfUI.bag:UpdateSlotSearch(bag, slot)
|
||||
|
||||
local hasItem = texture and 1 or nil
|
||||
pfUI.bags[bag].slots[slot].frame.hasItem = hasItem
|
||||
@@ -1010,7 +1034,6 @@ pfUI:RegisterModule("bags", function ()
|
||||
-- bag search
|
||||
if not frame.search then
|
||||
frame.search = CreateFrame("Frame", "pfBagSearch", frame)
|
||||
frame.search.db = {}
|
||||
frame.search:SetHeight(12)
|
||||
frame.search:SetPoint("TOPLEFT", frame, "TOPLEFT", default_border, -default_border)
|
||||
frame.search:SetPoint("TOPRIGHT", frame.sort, "TOPLEFT", -default_border*3, -default_border)
|
||||
@@ -1035,51 +1058,12 @@ pfUI:RegisterModule("bags", function ()
|
||||
|
||||
frame.search.edit:SetScript("OnEditFocusLost", function()
|
||||
this:SetText(T["Search"])
|
||||
for bag=-2, 11 do
|
||||
local bagsize = GetContainerNumSlots(bag)
|
||||
if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end
|
||||
for slot=1, bagsize do
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
C_Container.SetItemSearch("")
|
||||
end)
|
||||
|
||||
frame.search.edit:SetScript("OnTextChanged", function()
|
||||
if this:GetText() == T["Search"] then return end
|
||||
for bag=-2, 11 do
|
||||
local bagsize = GetContainerNumSlots(bag)
|
||||
if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end
|
||||
for slot=1, bagsize do
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(.25)
|
||||
local texture, itemCount, locked, quality, readable = GetContainerItemInfo(bag, slot)
|
||||
if itemCount then
|
||||
local itemLink = GetContainerItemLink(bag, slot)
|
||||
local itemstring = string.sub(itemLink, string.find(itemLink, "%[")+1, string.find(itemLink, "%]")-1)
|
||||
|
||||
if C.appearance.bags.fulltext == "1" then
|
||||
if not frame.search.db[itemLink] then
|
||||
scanner:SetBagItem(bag, slot)
|
||||
local text = scanner:Text()
|
||||
|
||||
local str = ""
|
||||
for k, v in pairs(text) do
|
||||
str = str .. (v[1] or "") .. (v[2] or "")
|
||||
end
|
||||
|
||||
frame.search.db[itemLink] = strlower(str)
|
||||
end
|
||||
|
||||
if strfind(frame.search.db[itemLink], strlower(this:GetText()), 1, true) then
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
|
||||
if strfind(strlower(itemstring), strlower(this:GetText()), 1, true) then
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
C_Container.SetItemSearch(this:GetText())
|
||||
end)
|
||||
|
||||
frame.search:SetScript("OnLeave", function()
|
||||
@@ -1094,17 +1078,7 @@ pfUI:RegisterModule("bags", function ()
|
||||
|
||||
frame.search:SetScript("OnHide", function()
|
||||
frame.search.edit:SetText(T["Search"])
|
||||
for bag = -2, 11 do
|
||||
if pfUI.bags[bag] then
|
||||
local bagsize = GetContainerNumSlots(bag)
|
||||
if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end
|
||||
for slot = 1, bagsize do
|
||||
if pfUI.bags[bag] and pfUI.bags[bag].slots[slot] then
|
||||
pfUI.bags[bag].slots[slot].frame:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
C_Container.SetItemSearch("")
|
||||
end)
|
||||
end
|
||||
else
|
||||
|
||||
@@ -2459,7 +2459,6 @@ pfUI:RegisterModule("gui", function ()
|
||||
CreateConfig(nil, T["Hide Chat When Bags Are Opened"], C.appearance.bags, "hidechat", "checkbox")
|
||||
CreateConfig(nil, T["Bagslots Per Row"], C.appearance.bags, "bagrowlength")
|
||||
CreateConfig(nil, T["Bankslots Per Row"], C.appearance.bags, "bankrowlength")
|
||||
CreateConfig(nil, T["Enable Full-Text Search"], C.appearance.bags, "fulltext")
|
||||
CreateConfig(nil, T["Item Slot Size"], C.appearance.bags, "icon_size")
|
||||
CreateConfig(Reload, T["Reverse Cooldown Animation"], C.appearance.bags, "cooldown_reverse", "checkbox")
|
||||
CreateConfig(nil, T["Auto Sell Grey Items"], C.global, "autosell", "checkbox")
|
||||
|
||||
Reference in New Issue
Block a user