From 9267118965d6b05ad628228a0344493864000090 Mon Sep 17 00:00:00 2001 From: wutname1 Date: Tue, 30 Jan 2024 02:49:30 -0600 Subject: [PATCH] Blacklist global fix --- Core/Framework.lua | 17 ++++++++++++++--- Modules/AutoTurnIn.lua | 7 ++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Core/Framework.lua b/Core/Framework.lua index 12313f7a..c289c936 100644 --- a/Core/Framework.lua +++ b/Core/Framework.lua @@ -1376,6 +1376,10 @@ end override allows the source to be put into the target even if its already populated ]] +---@param target table +---@param source table +---@param override boolean +---@return table function SUI:MergeData(target, source, override) if source == nil then return target end @@ -1454,9 +1458,11 @@ function SUI:isPartialMatch(frameName, tab) return result end ---[[ - Takes a target table and searches for the specified phrase -]] +---Takes a target table and searches for the specified phrase +---@param searchTable table +---@param searchPhrase string|number +---@param all boolean +---@return boolean function SUI:IsInTable(searchTable, searchPhrase, all) if searchTable == nil or searchPhrase == nil then SUI:Error('Invalid isInTable call', 'Core') @@ -1485,6 +1491,9 @@ function SUI:IsInTable(searchTable, searchPhrase, all) return false end +---@param currentTable table +---@param defaultTable table +---@return table function SUI:CopyTable(currentTable, defaultTable) if type(currentTable) ~= 'table' then currentTable = {} end @@ -1622,6 +1631,8 @@ function SUI:FilterTableFromBlacklist(cleanTable, blacklistTable) return tfbCleaned end +---@param inTable table +---@return string function SUI:TableToLuaString(inTable) local function recurse(table, level, ret) for i, v in pairs(table) do diff --git a/Modules/AutoTurnIn.lua b/Modules/AutoTurnIn.lua index 16a7201e..3f8ea71b 100644 --- a/Modules/AutoTurnIn.lua +++ b/Modules/AutoTurnIn.lua @@ -625,7 +625,7 @@ function module.Blacklist.isBlacklisted(lookupId) local wildcardBlacklist = blacklistDB.Wildcard -- Function to perform a case-insensitive search - local function isNameInBlacklist(blacklist, checkName) + local function isInPairSearch(blacklist, checkName) for _, key in pairs(blacklist) do if string.find(string.lower(checkName), string.lower(key)) then return true end end @@ -633,15 +633,16 @@ function module.Blacklist.isBlacklisted(lookupId) end -- Check for direct match in blacklists or wildcard match - if SUI:IsInTable(gossipBlacklist, name) or SUI:IsInTable(TempBlackList, name) or SUI:IsInTable(questBlacklist, lookupId) then + if SUI:IsInTable(gossipBlacklist, name) or SUI:IsInTable(TempBlackList, name) then debug(name .. '---IS BLACKLISTED') return true - elseif isNameInBlacklist(wildcardBlacklist, name) then + elseif isInPairSearch(wildcardBlacklist, name) or isInPairSearch(questBlacklist, name) then debug(name .. ' - IS BLACKLISTED') return true end -- Not blacklisted + debug(name .. '---IS NOT BLACKLISTED') return false end