From 5a369001105f9975109a898f381cf1f5299eeb62 Mon Sep 17 00:00:00 2001 From: "6mot, Tom" Date: Sat, 20 Dec 2025 22:20:54 +0100 Subject: [PATCH 1/2] Add TSMGroupCheck and GetTSMGroup functions, and registration --- Search/CheckItem.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Search/CheckItem.lua b/Search/CheckItem.lua index bbcbbb5..3745756 100644 --- a/Search/CheckItem.lua +++ b/Search/CheckItem.lua @@ -1652,6 +1652,35 @@ local function AHValuePatternCheck(details, text) end end +local function GetTSMGroup(details) + if details.TSMGroup ~= nil then + return details.TSMGroup ~= false + end + + if not TSM_API then + details.TSMGroup = false + return false + end + -- Needed? + if not C_Item.IsItemDataCachedByID(details.itemID) then + C_Item.RequestLoadItemDataByID(details.itemID) + return + end + + -- Ungrouped items return nil, invalid item strings raise an error. + local group = TSM_API.GetGroupPathByItem(TSM_API.ToItemString(details.itemLink)) + details.TSMGroup = group and group:lower() or false + return details.TSMGroup ~= false +end + +local function TSMGroupCheck(details, text) + local searchStr = text:sub(5):gsub("->", "`") + if GetTSMGroup(details) and details.TSMGroup:find(searchStr, nil, true) then + return true + end + return false +end + local function ExactKeywordCheck(details, text) local keyword = text:match("^#(.*)$") if KEYWORDS_TO_CHECK[keyword] ~= nil then @@ -1669,6 +1698,7 @@ local patterns = { ["^%d+[gsc]%-%d+[gsc]$"] = AHValueRangePatternCheck, ["^%#.*$"] = ExactKeywordCheck, + ["^tsm:.*$"] = TSMGroupCheck, } -- Used to prevent equipment and use returning results based on partial words in From ed6cbe28ca7b5c68a818e3038a3f1011b27347b1 Mon Sep 17 00:00:00 2001 From: "6mot, Tom" Date: Wed, 31 Dec 2025 01:37:41 +0100 Subject: [PATCH 2/2] Nil check for unrecognized item strings Should prevent errors caused by item strings that TSM cannot convert. --- Search/CheckItem.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Search/CheckItem.lua b/Search/CheckItem.lua index 3745756..4678ae6 100644 --- a/Search/CheckItem.lua +++ b/Search/CheckItem.lua @@ -1666,9 +1666,10 @@ local function GetTSMGroup(details) C_Item.RequestLoadItemDataByID(details.itemID) return end - + + local tsmItemString = TSM_API.ToItemString(details.itemLink) -- Ungrouped items return nil, invalid item strings raise an error. - local group = TSM_API.GetGroupPathByItem(TSM_API.ToItemString(details.itemLink)) + local group = tsmItemString and TSM_API.GetGroupPathByItem(tsmItemString) details.TSMGroup = group and group:lower() or false return details.TSMGroup ~= false end