From cd65ee960abcbc13769955e6ed09e47d52194614 Mon Sep 17 00:00:00 2001 From: pepopo978 Date: Tue, 25 Jun 2024 19:00:56 -0700 Subject: [PATCH] add filter for mobs that have curses --- curses.lua | 7 +++++++ filter.lua | 8 ++++++++ settings.lua | 13 +++++++++++++ 3 files changed, 28 insertions(+) diff --git a/curses.lua b/curses.lua index 6b85a58..a9676da 100644 --- a/curses.lua +++ b/curses.lua @@ -172,6 +172,13 @@ function curses:ShouldPlayResistSound(guid) return false end +function curses:HasAnyCurse(guid) + if curses.guids[guid] and next(curses.guids[guid]) then + return true + end + return nil +end + function curses:HasCurse(spellName, targetGuid, minRemaining) if not minRemaining then minRemaining = 0 -- default to 0 diff --git a/filter.lua b/filter.lua index 2ff3370..803158c 100644 --- a/filter.lua +++ b/filter.lua @@ -12,6 +12,10 @@ filter.infight = function(unit) return UnitAffectingCombat(unit) and true or false end +filter.hascurse = function(unit) + return Cursive.curses:HasAnyCurse(unit) and true or false +end + filter.alive = function(unit) return not UnitIsDead(unit) and true or false end @@ -74,6 +78,10 @@ function Cursive:ShouldDisplayGuid(guid) shouldDisplay = shouldDisplay and filter.infight(guid) end + if Cursive.db.profile.filterhascurse then + shouldDisplay = shouldDisplay and filter.hascurse(guid) + end + if Cursive.db.profile.filterhostile then shouldDisplay = shouldDisplay and filter.hostile(guid) end diff --git a/settings.lua b/settings.lua index ea997b7..0447ba7 100644 --- a/settings.lua +++ b/settings.lua @@ -31,6 +31,7 @@ Cursive:RegisterDefaults("profile", { filterattackable = true, filterrange = false, filterraidmark = false, + filterhascurse = false, }) local barOptions = { @@ -223,6 +224,18 @@ local mobFilters = { Cursive.db.profile.filterraidmark = v end, }, + ["hascurse"] = { + type = "toggle", + name = "Has Curse", + desc = "Only show units you have cursed", + order = 6, + get = function() + return Cursive.db.profile.filterhascurse + end, + set = function(v) + Cursive.db.profile.filterhascurse = v + end, + }, } Cursive.cmdtable = {