Support both - and %- in ignore list properly

This commit is contained in:
pepopo978
2025-11-04 08:52:21 -08:00
parent 6aea2fe1e6
commit f8bb31fe78
4 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
## Interface: 11200
## Title: [|CFF33AAFFSUPERWOW|R] Cursive 2.5.4
## Title-zhCN: [|CFF33AAFFSUPERWOW|R] Cursive 2.5.4
## Title: [|CFF33AAFFSUPERWOW|R] Cursive 2.5.5
## Title-zhCN: [|CFF33AAFFSUPERWOW|R] Cursive 2.5.5
## Author: Pepopo
## Notes: Uses SuperWoW GUIDs to show units in combat and track curses
## Notes-zhCN: 使用SuperWoW的GUID功能来显示战斗中的单位并监视诅咒等
+2 -2
View File
@@ -102,7 +102,7 @@ L:RegisterTranslations("enUS", function()
["Expiring latest -> soonest"] = true,
["Not ignored"] = true,
["Ignored Mobs List (Enter to save)"] = true,
["Comma separated list of strings to ignore if found in the unit name"] = true,
["Ignored Mobs Desc"] = "Comma separated list of strings to ignore if found in the unit name. If you use any of these regex characters (*+%?) it will do a regex search otherwise it will do a plain text search. So both Rift-Lost and Rift%-Lost should work.",
["Shared Faerie Fire"] = true,
["This will show other player's Faerie Fires and avoid trying to cast Faerie Fire on those mobs"] = true,
@@ -309,7 +309,7 @@ L:RegisterTranslations("zhCN", function()
["Expiring latest -> soonest"] = "最新->即将到期",
["Not ignored"] = "不被忽略",
["Ignored Mobs List (Enter to save)"] = "忽略的怪物列表(回车保存)",
["Comma separated list of strings to ignore if found in the unit name"] = "如果在单位名称中找到,则忽略的字符串列表,用半角逗号分隔",
["Ignored Mobs Desc"] = "用逗号分隔的字符串列表,如果在单位名称中找到则忽略。如果你使用了这些正则表达式字符(*+%?),它将进行正则表达式搜索,否则将进行纯文本搜索。所以Rift-Lost和Rift%-Lost都应该有效.",
["Shared Faerie Fire"] = "共享精灵之火",
["This will show other player's Faerie Fires and avoid trying to cast Faerie Fire on those mobs"] = "这将显示其他玩家的精灵之火,并避免尝试在这些怪物上施放精灵之火",
+1 -1
View File
@@ -66,7 +66,7 @@ filter.notignored = function(unit)
return true
end
for _, str in ipairs(Cursive.db.profile.ignorelist) do
if string.find(string.lower(unitName), string.lower(str), nil, false) then
if string.find(string.lower(unitName), string.lower(str), nil, not Cursive.db.profile.ignorelistuseregex) then
return false
end
end
+4 -1
View File
@@ -53,6 +53,7 @@ Cursive:RegisterDefaults("profile", {
filterignored = true,
ignorelist = {},
ignorelistuseregex = false,
})
local function splitString(str, delimiter)
@@ -451,7 +452,7 @@ local mobFilters = {
["ignorelist"] = {
type = "text",
name = L["Ignored Mobs List (Enter to save)"],
desc = L["Comma separated list of strings to ignore if found in the unit name"],
desc = L["Ignored Mobs Desc"],
usage = "whelp, black dragonkin, player3",
order = 68,
get = function()
@@ -466,6 +467,8 @@ local mobFilters = {
else
Cursive.db.profile.ignorelist = splitString(v, ",");
end
-- check for common lua regex patterns
Cursive.db.profile.ignorelistuseregex = string.find(v, "[*+%%?]") ~= nil
end,
},
}