diff --git a/Ellipsis/Aura.lua b/Ellipsis/Aura.lua index f069f5d..ff21c19 100644 --- a/Ellipsis/Aura.lua +++ b/Ellipsis/Aura.lua @@ -151,8 +151,8 @@ local function OnClick(self, button) Ellipsis:Announce(self) elseif (button == 'RightButton') then if (IsShiftKeyDown()) then - if (self.spellID > 0) then -- only allow blocking of actual spellIDs and not 'faked' ones - Ellipsis:BlacklistAdd(self.spellID) + if (self.spellID > 0) then -- only allow (un)blocking of actual spellIDs and not 'faked' ones + Ellipsis:FilterAura(self.spellID) end else self:Release() diff --git a/Ellipsis/AuraData.lua b/Ellipsis/AuraData.lua index e1101e9..18737d3 100644 --- a/Ellipsis/AuraData.lua +++ b/Ellipsis/AuraData.lua @@ -36,7 +36,7 @@ local dataNoTargetFake = { -- auras that need to be faked due to lack of API f [51533] = 15, -- Feral Spirit [192249] = 60, -- Storm Elemental [198067] = 60, -- Fire Elemental - [198103] = 15, -- Earth Elemental + [198103] = 60, -- Earth Elemental -- WARLOCK [1122] = 25, -- Summon Infernal [5740] = 8, -- Rain of Fire diff --git a/Ellipsis/Control.lua b/Ellipsis/Control.lua index 419e06d..32f03c2 100644 --- a/Ellipsis/Control.lua +++ b/Ellipsis/Control.lua @@ -7,7 +7,7 @@ local activeUnits = Ellipsis.activeUnits local controlDB local Aura, Unit -local anchorLookup, priorityLookup, blacklist +local anchorLookup, priorityLookup, blacklist, whitelist, filterByBlacklist local noTargetFake, noTargetFakeHasted, noTargetRedirect local isUniqueAura @@ -55,21 +55,23 @@ function Ellipsis:InitializeControl() noTargetFake, noTargetFakeHasted, noTargetRedirect = self:GetDataNoTarget() isUniqueAura = self:GetDataUniqueAuras() - anchorLookup = self.anchorLookup - priorityLookup = self.priorityLookup - blacklist = controlDB.blacklist + anchorLookup = self.anchorLookup + priorityLookup = self.priorityLookup + blacklist = controlDB.blacklist + whitelist = controlDB.whitelist - playerGUID = UnitGUID('player') - petGUID = UnitExists('pet') and UnitGUID('pet') or false + playerGUID = UnitGUID('player') + petGUID = UnitExists('pet') and UnitGUID('pet') or false self:ConfigureControl() end function Ellipsis:ConfigureControl() -- update aura limits - durationMin = (controlDB.timeMinLimit) and controlDB.timeMinValue or -1 -- to make sure we don't block passives due to being to short - durationMax = (controlDB.timeMaxLimit) and controlDB.timeMaxValue or 2764800 -- 32 days, anything longer than this is not likely to be an issue - blockPassive = (not controlDB.showPassiveAuras) + durationMin = (controlDB.timeMinLimit) and controlDB.timeMinValue or -1 -- to make sure we don't block passives due to being to short + durationMax = (controlDB.timeMaxLimit) and controlDB.timeMaxValue or 2764800 -- 32 days, anything longer than this is not likely to be an issue + blockPassive = (not controlDB.showPassiveAuras) + filterByBlacklist = controlDB.filterByBlacklist for group, options in pairs(controlDB.unitGroups) do anchorLookup[group] = options.anchor and self.anchors[options.anchor] or false @@ -105,6 +107,16 @@ function Ellipsis:ApplyOptionsAuraRestrictions() end end end + + if (filterByBlacklist) then + if (blacklist[aura.spellID]) then -- filtering by blacklist, and on the list, remove + aura:Release() + end + else + if (not whitelist[aura.spellID]) then -- filtering by whitelist and NOT on the list, remove + aura:Release() + end + end end end @@ -162,7 +174,7 @@ do ------------------------ if (not destGUID or bit_band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_MINE) == 0) then return end -- abort if no target, or we're not the source if (subEvent == 'SPELL_CAST_SUCCESS') then -- used for tracking notarget spell casts - if (noTargetFake[arg1] and not blacklist[arg1]) then -- this cast needs a 'fake' aura generated for timing + if (noTargetFake[arg1] and ((filterByBlacklist and not blacklist[spellID]) or (not filterByBlacklist and whitelist[spellID]))) then local duration = noTargetFake[arg1] if (duration <= durationMin or duration >= durationMax) then return end -- abort if duration is restricted @@ -276,10 +288,11 @@ function Ellipsis:PLAYER_TOTEM_UPDATE(slot) if (not summonSpellID) then return end -- not even enough info to fake it totemTexture = GetSpellTexture(summonSpellID) - spellID = summonSpellID -- still needed for blacklist lookup + spellID = summonSpellID -- still needed for filter list lookup end - if (blacklist[spellID] or duration <= durationMin or duration >= durationMax) then return end + if (((filterByBlacklist and blacklist[spellID]) or (not filterByBlacklist and not whitelist[spellID])) or + (duration < durationMin or duration >= durationMax)) then return end if (startTime > 0) then -- totem in this slot if (duration == 0) then return end -- totem in this slot, but no duration (nothing to track) @@ -488,8 +501,9 @@ function Ellipsis:UNIT_AURA(unitTag) while (spellName) do -- only scanning our auras on target if (unitCaster == 'player' or unitCaster == 'pet') then -- make sure player (or their pet) cast this aura - -- handle aura limitations, bit chunky due to special handling of passive auras and their limits - if (not (blacklist[spellID] or (duration == 0 and blockPassive) or (duration > 0 and (duration <= durationMin or duration >= durationMax)))) then + -- handle aura limitations, bit chunky due to special handling of passive auras and their limits as well as filter lists + if (((filterByBlacklist and not blacklist[spellID]) or (not filterByBlacklist and whitelist[spellID])) and + ((duration > 0 and (duration > durationMin and duration < durationMax)) or (duration == 0 and not blockPassive))) then -- handle notarget redirects for auras that appear on the player but make more sense to appear in notarget if (noTargetRedirect[spellID]) then -- spell needs to be redirected to notarget unit diff --git a/Ellipsis/Core.lua b/Ellipsis/Core.lua index 4785ad7..1b89174 100644 --- a/Ellipsis/Core.lua +++ b/Ellipsis/Core.lua @@ -130,32 +130,54 @@ end -- ------------------------ --- BLACKLISTING FUNCTIONS +-- FILTER LIST FUNCTIONS -- ------------------------ -function Ellipsis:BlacklistAdd(spellID) - if (type(spellID) == 'number' and spellID > 0) then -- just ensure its a (potentially legitimate) spellID - self.db.profile.control.blacklist[spellID] = true +function Ellipsis:FilterAura(spellID) + if (type(spellID) == 'number' and spellID > 0) then -- ensure we're dealing with a (potentially) legitimate spellID + if (self.db.profile.control.filterByBlacklist) then -- Filtering via BLACKLIST + if (self.db.profile.control.blacklist[spellID]) then -- aura already blocked, remove filter + self.db.profile.control.blacklist[spellID] = nil + + local name = GetSpellInfo(spellID) + + self:Printf(L.FilterBlackRemove, name or L.Aura_Unknown, spellID) + else -- aura not currently blocked, add to blacklist + self.db.profile.control.blacklist[spellID] = true + + for _, aura in pairs(self.activeAuras) do + if (aura.spellID == spellID) then + aura:Release() -- kill any active auras with this newly blocked ID + end + end + + local name = GetSpellInfo(spellID) - for _, aura in pairs(self.activeAuras) do - if (aura.spellID == spellID) then - aura:Release() -- kill any active auras with this newly blocked ID + self:Printf(L.FilterBlackAdd, name or L.Aura_Unknown, spellID) end - end + else -- Filtering via WHITELIST + if (self.db.profile.control.whitelist[spellID]) then -- aura already allowed, remove + self.db.profile.control.whitelist[spellID] = nil + + for _, aura in pairs(self.activeAuras) do + if (aura.spellID == spellID) then + aura:Release() -- kill any active auras with this (now blocked) ID + end + end - local name = GetSpellInfo(spellID) - self:Printf(L.BlacklistAdd, name or L.BlacklistUnknown, spellID) - end -end + local name = GetSpellInfo(spellID) -function Ellipsis:BlacklistRemove(spellID) - if (self.db.profile.control.blacklist[spellID]) then - self.db.profile.control.blacklist[spellID] = nil + self:Printf(L.FilterWhiteRemove, name or L.Aura_Unknown, spellID) + else -- aura not currently allowed, add to whitelist + self.db.profile.control.whitelist[spellID] = true - local name = GetSpellInfo(spellID) - self:Printf(L.BlacklistRemove, name or L.BlacklistUnknown, spellID) - end + local name = GetSpellInfo(spellID) - self:UNIT_AURA('player') -- update player auras (only unit we can reliably assume may need it after a removal) + self:Printf(L.FilterWhiteAdd, name or L.Aura_Unknown, spellID) + end + end + + self:UNIT_AURA('player') -- update player auras (only unit we can reliably assume may need it after a removal) + end end function Ellipsis:BlacklistCooldownAdd(group, timerID) diff --git a/Ellipsis/Defaults.lua b/Ellipsis/Defaults.lua index e20c5b4..2c79ea0 100644 --- a/Ellipsis/Defaults.lua +++ b/Ellipsis/Defaults.lua @@ -21,12 +21,14 @@ function Ellipsis:GetDefaults() }, control = { -- aura restrictions - blacklist = {}, -- blacklisted auras by spellID showPassiveAuras = true, timeMinLimit = false, timeMinValue = 4, timeMaxLimit = false, timeMaxValue = 60, + blacklist = {}, -- blacklisted auras by spellID + whitelist = {}, -- whitelisted auras by spellID + filterByBlacklist = true, -- filter auras by using a blacklist -- grouping and tracking unitGroups = { -- set the anchor to display a group in (or false for 'do not show') and the priority (if enabled) ['target'] = {anchor = 1, priority = 1}, -- override (priority cannot be changed) diff --git a/Ellipsis/Ellipsis.toc b/Ellipsis/Ellipsis.toc index 8729727..24b8056 100644 --- a/Ellipsis/Ellipsis.toc +++ b/Ellipsis/Ellipsis.toc @@ -2,7 +2,7 @@ ## Title: Ellipsis (|cff67b1e9K|cff4779ceith|cff67b1e9M|cff4779ceod|r) ## Notes: A full-featured, multi-target Aura (DoTs and HoTs) tracker. ## Author: Kith -## Version: 4.2.5 +## Version: 4.2.6 ## SavedVariables: EllipsisDB, EllipsisVersion ## OptionalDeps: Ace3, LibSharedMedia-3.0, LibSink-2.0 ## X-Embeds: Ace3, LibSharedMedia-3.0, LibSink-2.0 diff --git a/Ellipsis/Locales/Local_enUS.lua b/Ellipsis/Locales/Local_enUS.lua index 299095c..2911543 100644 --- a/Ellipsis/Locales/Local_enUS.lua +++ b/Ellipsis/Locales/Local_enUS.lua @@ -9,9 +9,6 @@ local L = LibStub('AceLocale-3.0'):NewLocale('Ellipsis', 'enUS', true) L.OverlayCooldown = 'Cooldown Bar' - - - L.VersionUpdated = 'Version updated to v%s' L.VersionUpdatedNew = 'Version updated to v%s - New settings are available!' L.ChatUsage = 'Usage - /ellipsis [lock|unlock]\n With no argument to open options, or lock or unlock to control positioning of the display windows.' @@ -19,23 +16,26 @@ L.CannotLoadOptions = 'Failed to load Ellipsis_Options, cannot open settings. Er -- aura & unit strings L.Aura_Passive = '' +L.Aura_Unknown = 'Unknown Aura' L.UnitLevel_Boss = 'B' L.UnitName_NoTarget = 'Non-Targeted' -- aura tooltips L.AuraTooltip = '|cff67b1e9<Left Click> to announce duration\n<Right Click> to cancel aura timer\n<Shift-Right Click> to block this aura|r' -L.AuraTooltipNoBlock = '|cff67b1e9<Left Click> to announce duration\n<Right Click> to cancel aura timer|r\n|cffd0d0d0Can only block using Blacklist options|r' +L.AuraTooltipNoBlock = '|cff67b1e9<Left Click> to announce duration\n<Right Click> to cancel aura timer|r\n|cffd0d0d0Manual block only using options|r' -- cooldown icon tooltips L.CooldownTimerTooltip = '|cff67b1e9<Left Click> to announce cooldown\n<Right Click> to cancel cooldown timer\n<Shift-Right Click> to block this cooldown|r' L.CooldownTimerTooltipNoBlock = '|cff67b1e9<Left Click> to announce cooldown\n<Right Click> to cancel cooldown timer|r\n|cffd0d0d0Can only block using Blacklist options|r' --- blacklisting -L.BlacklistAdd = 'Aura Added To The Blacklist: %s [|cffffd100%d|r]' -L.BlacklistRemove = 'Aura Removed From The Blacklist: %s [|cffffd100%d|r]' +-- filter lists +L.FilterBlackAdd = 'Aura Added To The Blacklist: %s [|cffffd100%d|r]' +L.FilterBlackRemove = 'Aura Removed From The Blacklist: %s [|cffffd100%d|r]' +L.FilterWhiteAdd = 'Aura Added To The Whitelist: %s [|cffffd100%d|r]' +L.FilterWhiteRemove = 'Aura Removed From The Whitelist: %s [|cffffd100%d|r]' L.BlacklistCooldownAdd = 'Cooldown Added To The Blacklist: %s [|cffffd100%d|r]' L.BlacklistCooldownRemove = 'Cooldown Removed From The Blacklist: %s [|cffffd100%d|r]' -L.BlacklistUnknown = 'Unknown Aura' + -- announcements L.Announce_ActiveAura = 'My [%s] will expire on [%s] in %s.' diff --git a/Ellipsis_Options/ControlOptions.lua b/Ellipsis_Options/ControlOptions.lua index fe68bcd..ac9e745 100644 --- a/Ellipsis_Options/ControlOptions.lua +++ b/Ellipsis_Options/ControlOptions.lua @@ -3,6 +3,28 @@ local L = LibStub('AceLocale-3.0'):GetLocale('Ellipsis_Options') local LUG = LibStub('AceLocale-3.0'):GetLocale('Ellipsis') -- used to get UnitGroup locales local LSM = LibStub('LibSharedMedia-3.0') +local filterAuraToAdd = false +local filterAuraToRemove = false +local filterAuraList = {} + +local function GetFilteredAuras() + filterAuraList = wipe(filterAuraList) + + local name + local ctrl = Ellipsis.db.profile.control + local filterList = ctrl.filterByBlacklist and ctrl.blacklist or ctrl.whitelist + + for spellID in pairs(filterList) do + name = GetSpellInfo(spellID) + name = name or L.Aura_Unknown + filterAuraList[spellID] = format('[|cffffd100%d|r] %s', spellID, name) + end + + return filterAuraList +end + +--[[ + local blacklistAuraToAdd = false local blacklistAuraToRemove = false local blacklistAuraList = {} @@ -20,6 +42,7 @@ local function GetBlacklistedAuras() return blacklistAuraList end +]] local dropUnitGroupAnchor = { -- used for unitGroups that CANNOT be blocked from display @@ -146,31 +169,92 @@ local control1Options = { order = 6, width = 'full', }, - - } }, - groupBlacklist = { - name = L.Control1BlacklistHeader, + groupFilterList = { + name = L.Control1FilterHeader, type = 'group', inline = true, order = 2, args = { - groupAdd = { + groupFilterSelect = { name = '', type = 'group', inline = true, order = 1, args = { + restrictBy = { + name = L.Control1FilterUsing, + type = 'description', + order = 1, + width = 'normal', + fontSize = 'medium', + }, + blacklist = { + name = L.Control1FilterBlacklist, + desc = L.Control1FilterBlacklistDesc, + type = 'toggle', + order = 2, + width = 'half', + get = function() + return Ellipsis.db.profile.control.filterByBlacklist + end, + set = function(info, val) + if (not Ellipsis.db.profile.control.filterByBlacklist) then -- not already filtering by blacklist + Ellipsis.db.profile.control.filterByBlacklist = true + + -- clean out local store so as not to cross-contaminate lists + filterAuraToAdd = false + filterAuraToRemove = false + + Ellipsis:ConfigureControl() + Ellipsis:ApplyOptionsAuraRestrictions() + Ellipsis:UNIT_AURA('player') + end + end, + }, + whitelist = { + name = L.Control1FilterWhitelist, + desc = L.Control1FilterWhitelistDesc, + type = 'toggle', + order = 3, + width = 'half', + get = function() + return not Ellipsis.db.profile.control.filterByBlacklist + end, + set = function(info, val) + if (Ellipsis.db.profile.control.filterByBlacklist) then -- already filtering by whitelist + Ellipsis.db.profile.control.filterByBlacklist = false + + -- clean out local store so as not to cross-contaminate lists + filterAuraToAdd = false + filterAuraToRemove = false + + Ellipsis:ConfigureControl() + Ellipsis:ApplyOptionsAuraRestrictions() + Ellipsis:UNIT_AURA('player') + end + end, + }, + }, + }, + groupFilterAdd = { + name = '', + type = 'group', + inline = true, + order = 2, + args = { addInput = { - name = L.Control1BlacklistAdd, - desc = L.Control1BlacklistAddDesc, + name = function() + return Ellipsis.db.profile.control.filterByBlacklist and L.Control1FilterAddBlack or L.Control1FilterAddWhite + end, + desc = L.Control1FilterAddDesc, type = 'input', order = 1, multiline = false, get = function() - if (blacklistAuraToAdd) then - return tostring(blacklistAuraToAdd) + if (filterAuraToAdd) then + return tostring(filterAuraToAdd) else return '' end @@ -179,35 +263,37 @@ local control1Options = { val = tonumber(val) if (val and val > 0) then - blacklistAuraToAdd = val + filterAuraToAdd = val end end }, addExecute = { - name = L.Control1BlacklistAddButton, + name = L.Control1FilterAddBtn, type = 'execute', order = 2, func = function() - Ellipsis:BlacklistAdd(blacklistAuraToAdd) + Ellipsis:FilterAura(filterAuraToAdd) - blacklistAuraToAdd = false -- spellID added, clear + filterAuraToAdd = false -- spellID added, clear end, disabled = function() -- only enable if a valid spellID is waiting to be added - return not blacklistAuraToAdd + return not filterAuraToAdd end }, } }, - blacklistList = { - name = L.Control1BlacklistList, - desc = L.Control1BlacklistListDesc, + filterList = { + name = function() + return Ellipsis.db.profile.control.filterByBlacklist and L.Control1FilterListBlack or L.Control1FilterListWhite + end, + desc = L.Control1FilterListDesc, type = 'select', - order = 2, + order = 3, width = 'full', - values = GetBlacklistedAuras, + values = GetFilteredAuras, get = function() - if (blacklistAuraToRemove) then - return blacklistAuraToRemove + if (filterAuraToRemove) then + return filterAuraToRemove else return nil end @@ -216,22 +302,22 @@ local control1Options = { val = tonumber(val) if (val and val > 0) then - blacklistAuraToRemove = val + filterAuraToRemove = val end end }, - blacklistRemove = { - name = L.Control1BlacklistRemoveButton, + filterListRemove = { + name = L.Control1FilterListRemoveBtn, type = 'execute', - order = 3, + order = 4, width = 'full', func = function() - Ellipsis:BlacklistRemove(blacklistAuraToRemove) + Ellipsis:FilterAura(filterAuraToRemove) - blacklistAuraToRemove = false -- spellID removed, clear + filterAuraToRemove = false -- spellID removed, clear end, disabled = function () -- only allow removable once a valid spellID has been chosen first - return not blacklistAuraToRemove + return not filterAuraToRemove end } } diff --git a/Ellipsis_Options/Ellipsis_Options.toc b/Ellipsis_Options/Ellipsis_Options.toc index 2fb96bc..18d9527 100644 --- a/Ellipsis_Options/Ellipsis_Options.toc +++ b/Ellipsis_Options/Ellipsis_Options.toc @@ -2,7 +2,7 @@ ## Title: Ellipsis Options (|cff67b1e9K|cff4779ceith|cff67b1e9M|cff4779ceod|r) ## Notes: Options for Ellipsis. Must be enabled to alter settings. ## Author: Kith -## Version: 4.2.5 +## Version: 4.2.6 ## RequiredDeps: Ellipsis ## OptionalDeps: Ace3 ## LoadOnDemand: 1 diff --git a/Ellipsis_Options/Locales/Local_enUS.lua b/Ellipsis_Options/Locales/Local_enUS.lua index 0d2e4d2..1669a94 100644 --- a/Ellipsis_Options/Locales/Local_enUS.lua +++ b/Ellipsis_Options/Locales/Local_enUS.lua @@ -60,7 +60,7 @@ L.GeneralHelp = '|cffffd200Terminology:|r\n|cffffd200Aura|r = Buffs & Debuffs -- ------------------------ --- CONTROL OPTIONS (ControlOptions.lua +-- CONTROL OPTIONS (ControlOptions.lua) -- ------------------------ L.Control1TimeHeader = 'Restrict Auras By Duration' L.Control1TimeMinLimit = 'Limit Minimum' @@ -71,13 +71,23 @@ L.Control1TimeMaxValue = 'Maximum Duration' L.Control1TimeMaxValueDesc = 'Set the maximum duration (in seconds) an aura can have before it is blocked from display. All auras with a duration greater than, or equal to, this value will not be displayed.' L.Control1TimeHelp = 'Minimum and Maximum duration restrictions apply to all auras displayed by Ellipsis. Passive auras ignore the above duration restrictions and their display is controlled using the option below.' L.Control1ShowPassiveAuras = 'Show Passive (Infinite Duration) Auras' -L.Control1BlacklistHeader = 'Restrict Auras By Blacklisting' -L.Control1BlacklistAdd = 'Aura To Blacklist (by SpellID)' -L.Control1BlacklistAddDesc = 'Auras must be blacklisted by their SpellID rather than their name. For help finding the ID associated to a spell, you can use the databases on these sites:\n |cffffd100http://www.wowhead.com|r\n |cffffd100http://www.wowdb.com|r\n\nAlternatively, if auras are set to be Interactive (under |cffffd100Aura Configuration|r), you can blacklist an aura after casting it by using <Shift-Right Click> on the aura timer itself.' -L.Control1BlacklistAddButton = 'Add To Blacklist' -L.Control1BlacklistList = 'Blacklisted Auras' -L.Control1BlacklistListDesc = 'This is a list of all auras currently blacklisted from display, ordered by their SpellID.\n\nAuras can be removed from the list by selecting them and using the button below.' -L.Control1BlacklistRemoveButton = 'Remove Aura From Blacklist' + +L.Control1FilterHeader = 'Restrict Auras By Filtering' +L.Control1FilterUsing = ' Restrict Auras Using A:' +L.Control1FilterBlacklist = 'Blacklist' +L.Control1FilterBlacklistDesc = 'All auras will be displayed except for those blocked by being added to the blacklist.' +L.Control1FilterWhitelist = 'Whitelist' +L.Control1FilterWhitelistDesc = 'No auras will be displayed except for those allowed by being added to the whitelist.' + +L.Control1FilterAddBlack = 'Aura To Blacklist (by SpellID)' +L.Control1FilterAddWhite = 'Aura To Whitelist (by SpellID)' +L.Control1FilterAddDesc = 'Auras must be filtered by their SpellID rather than their name. For help finding the ID associated to a spell, you can use the databases on these sites:\n |cffffd100http://www.wowhead.com|r\n |cffffd100http://www.wowdb.com|r\n\nAlternatively, if auras are set to be Interactive (under |cffffd100Aura Configuration|r) they can be filtered after casting it by using <Shift-Right Click> on the aura timer itself.' +L.Control1FilterAddBtn = 'Add To Fiter List' + +L.Control1FilterListBlack = 'Blacklisted Auras' +L.Control1FilterListWhite = 'Whitelisted Auras' +L.Control1FilterListDesc = 'This is a list of all currently filtered auras, ordered by their SpellID.\n\nAuras can be removed from the list by selecting them and using the button below.' +L.Control1FilterListRemoveBtn = 'Remove Aura From Filter List' L.Control2Drop_0 = 'Hidden' L.Control2Drop_1 = '[ |cffffd1001|r ]'