Originally Posted by merlight
I have a question regarding bug #1 fix. You set .cached to false if .rawName doesn't match. Is that condition sufficient? I mean, I noticed the search also includes item style, e.g. "breton" finds all items in Breton style. Hopefully I can find a pair of identically named items in different styles to test. Just wanted to ask how much "wrong" it would be to clear the .cached flag unconditionally.
|
At the time I assumed two items with the same name would be the same style, but now that you mention it your probably right.
(untested) Probably the easiest way I can think of to fix that would be to copy the itemInstanceId and check it instead to see if its changed:
Lua Code:
local function OnSlotUpdated(bagId, slotIndex, slotData)
if not slotData then return end
local searchData = slotData.searchData
if not (searchData and searchData.cached) then return end
if not (searchData.cache) then return end
local newItemInstanceId = slotData.itemInstanceId
local oldItemInstaceId = slotData.itemInstanceIdOLD
-- if its the same item, nothing to do return.
-- if there is no item in the slot newItemInstanceId will be nil
if newItemInstanceId == oldItemInstaceId then return end
searchData.cache = nil
searchData.cached = false
-- if there is no item in the slot this will
-- nil out the old Id for us:
slotData.itemInstanceIdOLD = newItemInstanceId
end