Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Search/CheckItem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,36 @@ 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

local tsmItemString = TSM_API.ToItemString(details.itemLink)
-- Ungrouped items return nil, invalid item strings raise an error.
local group = tsmItemString and TSM_API.GetGroupPathByItem(tsmItemString)
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
Expand All @@ -1669,6 +1699,7 @@ local patterns = {
["^%d+[gsc]%-%d+[gsc]$"] = AHValueRangePatternCheck,

["^%#.*$"] = ExactKeywordCheck,
["^tsm:.*$"] = TSMGroupCheck,
}

-- Used to prevent equipment and use returning results based on partial words in
Expand Down