fix: search centralized
This commit is contained in:
+3
-68
@@ -118,21 +118,7 @@ end
|
||||
|
||||
-- Update lock states of existing buttons (lightweight, used during drag)
|
||||
function BankFrame:UpdateLockStates()
|
||||
for _, bankBagParent in pairs(bankBagParents) do
|
||||
if bankBagParent then
|
||||
local buttons = { bankBagParent:GetChildren() }
|
||||
for _, button in ipairs(buttons) do
|
||||
if button.hasItem ~= nil and button:IsShown() and button.bagID and button.slotID then
|
||||
-- Get live lock state
|
||||
local _, _, locked = GetContainerItemInfo(button.bagID, button.slotID)
|
||||
-- Update desaturation (gray out locked items)
|
||||
if not button.otherChar and not button.isReadOnly and SetItemButtonDesaturated then
|
||||
SetItemButtonDesaturated(button, locked, 0.5, 0.5, 0.5)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Guda_UpdateLockStates(bankBagParents)
|
||||
end
|
||||
|
||||
-- Update display
|
||||
@@ -1002,59 +988,8 @@ end
|
||||
|
||||
-- Check if item passes search filter (pfUI style)
|
||||
function BankFrame:PassesSearchFilter(itemData)
|
||||
-- If no search text, everything matches
|
||||
if not self:IsSearchActive() then
|
||||
return true
|
||||
end
|
||||
|
||||
-- Empty slots don't match when searching (pfUI style - they get dimmed)
|
||||
if not itemData then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Get item name from itemData.name or parse from link
|
||||
local itemName = itemData.name
|
||||
if not itemName and itemData.link then
|
||||
-- Parse name from item link: |cffffffff|Hitem:...|h[Item Name]|h|r
|
||||
local _, _, name = string.find(itemData.link, "%[(.+)%]")
|
||||
itemName = name
|
||||
end
|
||||
|
||||
if not itemName then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Case-insensitive search in item name
|
||||
local search = string.lower(searchText)
|
||||
|
||||
-- Advanced search (pfUI style categories)
|
||||
if string.sub(search, 1, 1) == "~" then
|
||||
local category = string.sub(search, 2)
|
||||
local itemType = itemData.class or ""
|
||||
local itemQuality = itemData.quality or -1
|
||||
|
||||
if category == "equipment" or category == "armor" or category == "weapon" then
|
||||
if itemType == "Armor" or itemType == "Weapon" then return true end
|
||||
elseif category == "consumable" then
|
||||
if itemType == "Consumable" then return true end
|
||||
elseif category == "tradegoods" or category == "trades" then
|
||||
if itemType == "Trade Goods" then return true end
|
||||
elseif category == "quest" then
|
||||
local isQuest, isQuestStarter = Guda_GetQuestInfo(itemData.bagID, itemData.slotID, itemData.isBank)
|
||||
if isQuest or isQuestStarter or itemType == "Quest" then return true end
|
||||
elseif category == "reagent" then
|
||||
if itemType == "Reagent" then return true end
|
||||
elseif category == "common" then if itemQuality == 1 then return true end
|
||||
elseif category == "uncommon" then if itemQuality == 2 then return true end
|
||||
elseif category == "rare" then if itemQuality == 3 then return true end
|
||||
elseif category == "epic" then if itemQuality == 4 then return true end
|
||||
elseif category == "legendary" then if itemQuality == 5 then return true end
|
||||
end
|
||||
end
|
||||
|
||||
itemName = string.lower(itemName)
|
||||
-- Check if item name contains search text
|
||||
return string.find(itemName, search, 1, true) ~= nil
|
||||
if not self:IsSearchActive() then return true end
|
||||
return Guda_PassesSearchFilter(itemData, searchText)
|
||||
end
|
||||
|
||||
-- Search changed handler
|
||||
|
||||
Reference in New Issue
Block a user