Open PaulJaco opened 1 year ago
Thanks, this works ... It's in Filters.lua for those interested. It should look like this when you're done: https://i.imgur.com/NMaITbw.png
Edit: This does not fix search in Bank Window tho.
Thanks! Sorry I didn't think of the Bank Window. Hopefully can find a fix there. I also updated my comment to have the Filters.lua file in the path, my apologies for missing that.
Hi, So it appears to be working for me in the player bank but not the Guild Bank. After some testing it appears the following code works for the Guild Bank as well bags and player bank. I did some code refactoring so that itemSearch would be set multiple places but used once for the search. I hope this helps, and thank you for such a wonderful addon!!! Replace the entire match = function with:
match = function(self, item, _, search)
local where = item.location
local itemSearch = nil --initialize to nil
if where then
local data = where and (where.bagID and C_TooltipInfo.GetBagItem(where.bagID, where.slotIndex) or
where.equipmentSlotIndex and C_TooltipInfo.GetInventoryItem(where.unitID or 'player', where.equipmentSlotIndex))
or C_TooltipInfo.GetHyperlink(item.link) or C_TooltipInfo.GetItemByID(item.ID)
itemSearch = C_Container.GetContainerItemLink(where.bagID, where.slotIndex)
else
--since item.location is for bags and player bank, using the item.link allows finding when at Guild Bank
itemSearch = item.link
end
if itemSearch and Parser:Find(search, itemSearch) then
return true
end
-- if data then -- for lines, args in ipairs(data) do -- if Parser:Find(search, lines) then -- return true -- end -- end -- end end
Nice, it now only breaks when you try to search in the bank window away from the bank ... but to be fair, it was also fixed in the update.
the error is:
323x bad argument #1 to '?' (Usage: local itemLink = C_Item.GetItemLink(itemLocation))
[string "=[C]"]: in function `GetItemLink'
[string "@BagBrother/libs/ItemSearch-1.3-1/API.lua"]:40: in function `Matches'
[string "@BagBrother/addons/core/classes/item.lua"]:296: in function `?'
[string "@BagBrother/libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:119: in function <...her/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:119>
[string "=[C]"]: ?
[string "@BagBrother/libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:29: in function <...her/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:25>
[string "@BagBrother/libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:64: in function `SendMessage'
[string "@BagBrother/libs/WildAddon-1.0-1/WildAddon-1.0.lua"]:83: in function `SendSignal'
[string "@Bagnon/src/searchFrame.lua"]:78: in function <Bagnon/src/searchFrame.lua:74>
Hi, My apologies, I haven't had time to work on this. Embarrassed to say I didn't even know about the ability to view bank away from the bank lol. This addon is amazing! I hope to work on this latest issue this weekend and report back. Getting into the meat of the addon!
Hi, I think I got it! Change is in the BagBrother/addons/core/classes/item.lua file Item:UpdateSearch() function. I have print statements in there that can/should be? removed at some point, I left them in encase you wanted to do similar in your testing. The call to Search:Matches has been modified from here, but the Search:Matches function was left as is. Please replace the entire Item:UpdateSearch() function with the following, the lines dealing specifically with item was what has been specifically changed. I hope it helps, and thank you for letting me participate :) REPLACE Item:UpdateSearch() function with following, the function starts around line 295 function Item:UpdateSearch() local search = Addon.canSearch and Addon.search or '' local item = nil --initialize
if self.info.id then
item = GetItemInfo(self.info.id)
--print("using selfInfo", item)
else
item = self:GetQuery()
--print("using GetQuery", item)
end
--passing item, item maybe a table if using self:GetQuery(), called function Search:Matches will check if table or not and do it's thing
local matches = search == '' or self.hasItem and Search:Matches(item, search)
self:SetAlpha(matches and 1 or 0.3)
self:SetLocked(not matches or self.info.locked)
end
In World of Warcraft_retail_\Interface\AddOns\BagBrother\libs\ItemSearch-1.3\Filters.lua the match function. When typing in to search for item, it will show some, not others. The following, allows searching on things like "fire" or "potion" or "key", showing all items in bags with that as part of their name or references.
Fix: Add following starting at around line 42 after the "local data =" section. local itemSearch = C_Container.GetContainerItemLink(where.bagID, where.slotIndex) if itemSearch and Parser:Find(search, itemSearch) then return true end
I then simply commented out the following lines, they could be removed, so it appears, as well. Also that "args" as nil value happens here also. I had a fix for that, but still did not find items as expected, so was more than 1 issue in this section of code. -- if data then -- for i, line in ipairs(data.lines) do -- if Parser:Find(search, line.args[2].stringVal) then -- return true -- end -- end -- end