From 8beee70478056f743e84a43ea206f67fb2b6f127 Mon Sep 17 00:00:00 2001 From: Luckyone Date: Thu, 21 Nov 2024 23:25:09 +0100 Subject: [PATCH 01/17] Toon --- ElvUI/Core/Modules/Chat/Chat.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ElvUI/Core/Modules/Chat/Chat.lua b/ElvUI/Core/Modules/Chat/Chat.lua index 0db5edba0d..df1b55e023 100644 --- a/ElvUI/Core/Modules/Chat/Chat.lua +++ b/ElvUI/Core/Modules/Chat/Chat.lua @@ -387,6 +387,8 @@ do --this can save some main file locals end elseif portal == 'EU' then if E.Classic then + -- Luckyone Anniversary (6112: Spineshatter EU) + z['Player-6112-028A3A6D'] = ElvGreen -- [Horde] Hunter -- Luckyone Seasonal (5827: Living Flame EU) z['Player-5827-0273D732'] = ElvGreen -- [Alliance] Hunter z['Player-5827-0273D63E'] = ElvGreen -- [Alliance] Paladin From 166daa4c36a60b7faa17f70bb013b914aa3ae48d Mon Sep 17 00:00:00 2001 From: Simpy Date: Sat, 23 Nov 2024 15:09:46 -0500 Subject: [PATCH 02/17] let the profiler watch style filters pooler --- ElvUI/Core/Modules/Nameplates/StyleFilter.lua | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua index 8b0cef509c..522d6d3aa4 100644 --- a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua +++ b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua @@ -1635,10 +1635,10 @@ end do -- oUF style filter inject watch functions without actually registering any events local pooler = CreateFrame('Frame') - pooler.frames = {} pooler.delay = 0.1 -- update check rate + pooler.frames = {} - pooler.update = function() + function NP:StyleFilterPoolerRun() for frame in pairs(pooler.frames) do NP:StyleFilterUpdate(frame, 'PoolerUpdate') end @@ -1646,52 +1646,52 @@ do -- oUF style filter inject watch functions without actually registering any e wipe(pooler.frames) -- clear it out end - pooler.onUpdate = function(self, elapsed) - if self.elapsed and self.elapsed > pooler.delay then - pooler.update() + function NP:StyleFilterPoolerOnUpdate(elapsed) + if pooler.elapsed and pooler.elapsed > pooler.delay then + NP:StyleFilterPoolerRun() - self.elapsed = 0 + pooler.elapsed = 0 else - self.elapsed = (self.elapsed or 0) + elapsed + pooler.elapsed = (pooler.elapsed or 0) + elapsed end end - pooler:SetScript('OnUpdate', pooler.onUpdate) + pooler:SetScript('OnUpdate', NP.StyleFilterPoolerOnUpdate) - local update = function(frame, event, arg1, arg2, arg3, ...) + function NP:StyleFilterPoolerTrack(event, arg1, arg2, arg3, ...) local eventFunc = NP.StyleFilterEventFunctions[event] if eventFunc then - eventFunc(frame, event, arg1, arg2, arg3, ...) + eventFunc(self, event, arg1, arg2, arg3, ...) end local auraEvent = event == 'UNIT_AURA' - if auraEvent and E.Retail and ElvUF:ShouldSkipAuraUpdate(frame, event, arg1, arg2, arg3) then + if auraEvent and E.Retail and ElvUF:ShouldSkipAuraUpdate(self, event, arg1, arg2, arg3) then return end -- Trigger Event and (auraEvent or unitless or verifiedUnit); auraEvent is already unit verified by ShouldSkipAuraUpdate local trigger = NP.StyleFilterTriggerEvents[event] - if trigger == 2 and (frame.unit ~= arg1) then + if trigger == 2 and (self.unit ~= arg1) then return -- this blocks rechecking other plates on added when not using the amount trigger (preformance thing) - elseif trigger and (auraEvent or NP.StyleFilterDefaultEvents[event] or (arg1 and arg1 == frame.unit)) then - pooler.frames[frame] = true + elseif trigger and (auraEvent or NP.StyleFilterDefaultEvents[event] or (arg1 and arg1 == self.unit)) then + pooler.frames[self] = true end end - local oUF_event_metatable = { - __call = function(funcs, frame, ...) - for _, func in next, funcs do - func(frame, ...) - end - end, - } + local update = NP.StyleFilterPoolerTrack + function NP:StyleFilterPoolerCall(frame, ...) + for _, func in next, self do + func(frame, ...) + end + end - local oUF_fake_register = function(frame, event, remove) + local metatable = { __call = NP.StyleFilterPoolerCall } + function NP:StyleFilterFakeRegister(frame, event, remove) local curev = frame[event] if curev then local kind = type(curev) if kind == 'function' and curev ~= update then - frame[event] = setmetatable({curev, update}, oUF_event_metatable) + frame[event] = setmetatable({curev, update}, metatable) elseif kind == 'table' then for index, infunc in next, curev do if infunc == update then @@ -1709,7 +1709,7 @@ do -- oUF style filter inject watch functions without actually registering any e end end - local styleFilterIsWatching = function(frame, event) + function NP:StyleFilterIsWatching(frame, event) local curev = frame[event] if curev then local kind = type(curev) @@ -1727,17 +1727,17 @@ do -- oUF style filter inject watch functions without actually registering any e if frame == _G.ElvNP_Test then return end for event in pairs(NP.StyleFilterDefaultEvents) do - local holdsEvent = styleFilterIsWatching(frame, event) + local holdsEvent = NP:StyleFilterIsWatching(frame, event) if disable then if holdsEvent then - oUF_fake_register(frame, event, true) + NP:StyleFilterFakeRegister(frame, event, true) end elseif NP.StyleFilterPlateEvents[event] then if not holdsEvent then - oUF_fake_register(frame, event) + NP:StyleFilterFakeRegister(frame, event) end elseif holdsEvent then - oUF_fake_register(frame, event, true) + NP:StyleFilterFakeRegister(frame, event, true) end end end function NP:StyleFilterRegister(nameplate, event, unitless, func, objectEvent) From 6c270229215a92370e7c7e2b40f69e38a5d463ae Mon Sep 17 00:00:00 2001 From: Simpy Date: Sat, 23 Nov 2024 15:16:47 -0500 Subject: [PATCH 03/17] export the style filter pooler to ouf object --- ElvUI/Core/Modules/Nameplates/StyleFilter.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua index 522d6d3aa4..f9a2a046bd 100644 --- a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua +++ b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua @@ -1638,6 +1638,8 @@ do -- oUF style filter inject watch functions without actually registering any e pooler.delay = 0.1 -- update check rate pooler.frames = {} + ElvUF.Pooler.StyleFilter = pooler + function NP:StyleFilterPoolerRun() for frame in pairs(pooler.frames) do NP:StyleFilterUpdate(frame, 'PoolerUpdate') From 990c6a421d086043c856fa809769526f3f7d7347 Mon Sep 17 00:00:00 2001 From: Simpy Date: Sat, 23 Nov 2024 15:27:35 -0500 Subject: [PATCH 04/17] ability to disable poolers --- ElvUI/Core/Modules/Nameplates/StyleFilter.lua | 13 +++++++++---- ElvUI_Libraries/Core/oUF/simpy/pooler.lua | 7 ++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua index f9a2a046bd..5108f9251b 100644 --- a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua +++ b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua @@ -1636,16 +1636,17 @@ end do -- oUF style filter inject watch functions without actually registering any events local pooler = CreateFrame('Frame') pooler.delay = 0.1 -- update check rate - pooler.frames = {} + pooler.active = true -- off is always instant + pooler.tracked = {} ElvUF.Pooler.StyleFilter = pooler function NP:StyleFilterPoolerRun() - for frame in pairs(pooler.frames) do + for frame in pairs(pooler.tracked) do NP:StyleFilterUpdate(frame, 'PoolerUpdate') end - wipe(pooler.frames) -- clear it out + wipe(pooler.tracked) -- clear it out end function NP:StyleFilterPoolerOnUpdate(elapsed) @@ -1676,7 +1677,11 @@ do -- oUF style filter inject watch functions without actually registering any e if trigger == 2 and (self.unit ~= arg1) then return -- this blocks rechecking other plates on added when not using the amount trigger (preformance thing) elseif trigger and (auraEvent or NP.StyleFilterDefaultEvents[event] or (arg1 and arg1 == self.unit)) then - pooler.frames[self] = true + if pooler.active then + pooler.tracked[self] = true + else + NP:StyleFilterUpdate(self, 'PoolerUpdate') + end end end diff --git a/ElvUI_Libraries/Core/oUF/simpy/pooler.lua b/ElvUI_Libraries/Core/oUF/simpy/pooler.lua index 4d7520372b..4600944131 100644 --- a/ElvUI_Libraries/Core/oUF/simpy/pooler.lua +++ b/ElvUI_Libraries/Core/oUF/simpy/pooler.lua @@ -22,6 +22,7 @@ object.times = {} object.delay = 0.1 -- update check rate object.instant = 1 -- seconds since last event +object.active = true -- off is always instant pooler.run = function(funcs, frame, event, ...) for i = 1, #funcs do @@ -87,7 +88,9 @@ end pooler.tracker = function(frame, event, arg1, ...) -- print('tracker', frame, event, arg1, ...) local pool = object.events[event] - if pool then + if not pool then return end + + if object.active then local now = time() local last = object.times[event] if last and (last + object.instant) < now then @@ -111,6 +114,8 @@ pooler.tracker = function(frame, event, arg1, ...) end object.times[event] = now + else + pooler.execute(event, pool, true, arg1, ...) end end From 3e8e4aa217a55829844bd1a78e01857b88bb868f Mon Sep 17 00:00:00 2001 From: Simpy Date: Sat, 23 Nov 2024 15:41:09 -0500 Subject: [PATCH 05/17] dont run the tracker when the pooler is off --- ElvUI/Core/Modules/Nameplates/StyleFilter.lua | 9 +++++++++ ElvUI_Libraries/Core/oUF/simpy/pooler.lua | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua index 5108f9251b..fd3094e049 100644 --- a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua +++ b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua @@ -1660,6 +1660,7 @@ do -- oUF style filter inject watch functions without actually registering any e end pooler:SetScript('OnUpdate', NP.StyleFilterPoolerOnUpdate) + pooler:Hide() function NP:StyleFilterPoolerTrack(event, arg1, arg2, arg3, ...) local eventFunc = NP.StyleFilterEventFunctions[event] @@ -1679,7 +1680,15 @@ do -- oUF style filter inject watch functions without actually registering any e elseif trigger and (auraEvent or NP.StyleFilterDefaultEvents[event] or (arg1 and arg1 == self.unit)) then if pooler.active then pooler.tracked[self] = true + + if not pooler:IsShown() then + pooler:Show() + end else + if pooler:IsShown() then + pooler:Hide() + end + NP:StyleFilterUpdate(self, 'PoolerUpdate') end end diff --git a/ElvUI_Libraries/Core/oUF/simpy/pooler.lua b/ElvUI_Libraries/Core/oUF/simpy/pooler.lua index 4600944131..e031cad6bd 100644 --- a/ElvUI_Libraries/Core/oUF/simpy/pooler.lua +++ b/ElvUI_Libraries/Core/oUF/simpy/pooler.lua @@ -113,8 +113,16 @@ pooler.tracker = function(frame, event, arg1, ...) end end + if not object:IsShown() then + object:Show() + end + object.times[event] = now else + if object:IsShown() then + object:Hide() + end + pooler.execute(event, pool, true, arg1, ...) end end @@ -130,6 +138,7 @@ pooler.onUpdate = function(self, elapsed) end object:SetScript('OnUpdate', pooler.onUpdate) +object:Hide() function oUF:RegisterEvent(frame, event, func) -- print('RegisterEvent', frame, event, func) From c807b0145f44a32f54739bac0b0de427b0284e33 Mon Sep 17 00:00:00 2001 From: Simpy Date: Sat, 23 Nov 2024 16:44:49 -0500 Subject: [PATCH 06/17] use a local var in the pooler onupdates --- ElvUI/Core/Modules/Nameplates/StyleFilter.lua | 7 ++++--- ElvUI_Libraries/Core/oUF/simpy/pooler.lua | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua index fd3094e049..2c7dac74e9 100644 --- a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua +++ b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua @@ -1649,13 +1649,14 @@ do -- oUF style filter inject watch functions without actually registering any e wipe(pooler.tracked) -- clear it out end + local wait = 0 function NP:StyleFilterPoolerOnUpdate(elapsed) - if pooler.elapsed and pooler.elapsed > pooler.delay then + if wait > pooler.delay then NP:StyleFilterPoolerRun() - pooler.elapsed = 0 + wait = 0 else - pooler.elapsed = (pooler.elapsed or 0) + elapsed + wait = wait + elapsed end end diff --git a/ElvUI_Libraries/Core/oUF/simpy/pooler.lua b/ElvUI_Libraries/Core/oUF/simpy/pooler.lua index e031cad6bd..6809551547 100644 --- a/ElvUI_Libraries/Core/oUF/simpy/pooler.lua +++ b/ElvUI_Libraries/Core/oUF/simpy/pooler.lua @@ -127,13 +127,14 @@ pooler.tracker = function(frame, event, arg1, ...) end end -pooler.onUpdate = function(self, elapsed) - local elapsedTime = self.elapsed or 0 - if elapsedTime > object.delay then +local wait = 0 +pooler.onUpdate = function(_, elapsed) + if wait > object.delay then pooler.update() - self.elapsed = 0 + + wait = 0 else - self.elapsed = elapsedTime + elapsed + wait = wait + elapsed end end From 8e136a44c5c8d96937e80730421ac5626ee887ad Mon Sep 17 00:00:00 2001 From: Simpy Date: Sat, 23 Nov 2024 17:23:42 -0500 Subject: [PATCH 07/17] test poolers execution at instant half second, add instant trigger to style filter pooler --- ElvUI/Core/Modules/Nameplates/StyleFilter.lua | 44 ++++++++++++------- ElvUI_Libraries/Core/oUF/simpy/pooler.lua | 6 +-- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua index 2c7dac74e9..d71f3634f4 100644 --- a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua +++ b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua @@ -9,10 +9,10 @@ local ipairs, next, pairs = ipairs, next, pairs local setmetatable, tostring, tonumber, type, unpack = setmetatable, tostring, tonumber, type, unpack local strmatch, tinsert, tremove, sort, wipe = strmatch, tinsert, tremove, sort, wipe +local GetTime = GetTime local GetInstanceInfo = GetInstanceInfo local GetInventoryItemID = GetInventoryItemID local GetRaidTargetIndex = GetRaidTargetIndex -local GetTime = GetTime local IsPlayerSpell = IsPlayerSpell local IsResting = IsResting local IsSpellKnownOrOverridesKnown = IsSpellKnownOrOverridesKnown @@ -1634,24 +1634,26 @@ function NP:StyleFilterUpdate(frame, event) end do -- oUF style filter inject watch functions without actually registering any events - local pooler = CreateFrame('Frame') - pooler.delay = 0.1 -- update check rate - pooler.active = true -- off is always instant - pooler.tracked = {} + local object = CreateFrame('Frame') + object.delay = 0.1 -- update check rate + object.instant = 0.5 -- seconds since last event + object.active = true -- off is always instant + object.tracked = {} + object.times = {} - ElvUF.Pooler.StyleFilter = pooler + ElvUF.Pooler.StyleFilter = object function NP:StyleFilterPoolerRun() - for frame in pairs(pooler.tracked) do + for frame in pairs(object.tracked) do NP:StyleFilterUpdate(frame, 'PoolerUpdate') end - wipe(pooler.tracked) -- clear it out + wipe(object.tracked) -- clear it out end local wait = 0 function NP:StyleFilterPoolerOnUpdate(elapsed) - if wait > pooler.delay then + if wait > object.delay then NP:StyleFilterPoolerRun() wait = 0 @@ -1660,8 +1662,8 @@ do -- oUF style filter inject watch functions without actually registering any e end end - pooler:SetScript('OnUpdate', NP.StyleFilterPoolerOnUpdate) - pooler:Hide() + object:SetScript('OnUpdate', NP.StyleFilterPoolerOnUpdate) + object:Hide() function NP:StyleFilterPoolerTrack(event, arg1, arg2, arg3, ...) local eventFunc = NP.StyleFilterEventFunctions[event] @@ -1679,15 +1681,23 @@ do -- oUF style filter inject watch functions without actually registering any e if trigger == 2 and (self.unit ~= arg1) then return -- this blocks rechecking other plates on added when not using the amount trigger (preformance thing) elseif trigger and (auraEvent or NP.StyleFilterDefaultEvents[event] or (arg1 and arg1 == self.unit)) then - if pooler.active then - pooler.tracked[self] = true + if object.active then + local now = GetTime() + local last = object.times[event] + if last and (last + object.instant) < now then + NP:StyleFilterUpdate(self, 'PoolerUpdate') + else + object.tracked[self] = true - if not pooler:IsShown() then - pooler:Show() + if not object:IsShown() then + object:Show() + end end + + object.times[event] = now else - if pooler:IsShown() then - pooler:Hide() + if object:IsShown() then + object:Hide() end NP:StyleFilterUpdate(self, 'PoolerUpdate') diff --git a/ElvUI_Libraries/Core/oUF/simpy/pooler.lua b/ElvUI_Libraries/Core/oUF/simpy/pooler.lua index 6809551547..58704f64b7 100644 --- a/ElvUI_Libraries/Core/oUF/simpy/pooler.lua +++ b/ElvUI_Libraries/Core/oUF/simpy/pooler.lua @@ -5,12 +5,12 @@ local Profiler = oUF.Profiler.func -- Event Pooler by Simpy local next = next -local time = time local wipe = wipe local pairs = pairs local unpack = unpack local tinsert = tinsert local tremove = tremove +local GetTime = GetTime local object = CreateFrame('Frame') local pooler = { frame = object } @@ -21,7 +21,7 @@ object.events = {} object.times = {} object.delay = 0.1 -- update check rate -object.instant = 1 -- seconds since last event +object.instant = 0.5 -- seconds since last event object.active = true -- off is always instant pooler.run = function(funcs, frame, event, ...) @@ -91,7 +91,7 @@ pooler.tracker = function(frame, event, arg1, ...) if not pool then return end if object.active then - local now = time() + local now = GetTime() local last = object.times[event] if last and (last + object.instant) < now then pooler.execute(event, pool, true, arg1, ...) From 72f99849717fd535afa9a1da63cc298353c780fc Mon Sep 17 00:00:00 2001 From: Simpy Date: Sat, 23 Nov 2024 17:57:26 -0500 Subject: [PATCH 08/17] lib anim math --- ElvUI_Libraries/Core/LibAnim/LibAnim.lua | 50 ++++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/ElvUI_Libraries/Core/LibAnim/LibAnim.lua b/ElvUI_Libraries/Core/LibAnim/LibAnim.lua index 7656fefc21..c6977068b5 100644 --- a/ElvUI_Libraries/Core/LibAnim/LibAnim.lua +++ b/ElvUI_Libraries/Core/LibAnim/LibAnim.lua @@ -82,9 +82,9 @@ local InOutQuadratic = function(t, b, c, d) t = t / d * 2 if t < 1 then - return c / 2 * (t ^ 2) + b + return (c * 0.5) * (t ^ 2) + b else - return -c / 2 * ((t - 1) * (t - 3) - 1) + b + return -(c * 0.5) * ((t - 1) * (t - 3) - 1) + b end end @@ -105,11 +105,11 @@ local InOutCubic = function(t, b, c, d) t = t / d * 2 if t < 1 then - return c / 2 * (t ^ 3) + b + return (c * 0.5) * (t ^ 3) + b else t = t - 2 - return c / 2 * (t ^ 3 + 2) + b + return (c * 0.5) * (t ^ 3 + 2) + b end end @@ -130,11 +130,11 @@ local InOutQuartic = function(t, b, c, d) t = t / d * 2 if t < 1 then - return c / 2 * t ^ 4 + b + return (c * 0.5) * t ^ 4 + b else t = t - 2 - return -c / 2 * (t ^ 4 - 2) + b + return -(c * 0.5) * (t ^ 4 - 2) + b end end @@ -155,25 +155,25 @@ local InOutQuintic = function(t, b, c, d) t = t / d * 2 if t < 1 then - return c / 2 * t ^ 5 + b + return (c * 0.5) * t ^ 5 + b else t = t - 2 - return c / 2 * (t ^ 5 + 2) + b + return (c * 0.5) * (t ^ 5 + 2) + b end end -- Sinusoidal local InSinusoidal = function(t, b, c, d) - return -c * cos(t / d * (pi / 2)) + c + b + return -c * cos(t / d * (pi * 0.5)) + c + b end local OutSinusoidal = function(t, b, c, d) - return c * sin(t / d * (pi / 2)) + b + return c * sin(t / d * (pi * 0.5)) + b end local InOutSinusoidal = function(t, b, c, d) - return -c / 2 * (cos(pi * t / d) - 1) + b + return -(c * 0.5) * (cos(pi * t / d) - 1) + b end -- Exponential @@ -205,11 +205,11 @@ local InOutExponential = function(t, b, c, d) t = t / d * 2 if t < 1 then - return c / 2 * (2 ^ (10 * (t - 1))) + b - c * 0.0005 + return (c * 0.5) * (2 ^ (10 * (t - 1))) + b - c * 0.0005 else t = t - 1 - return c / 2 * 1.0005 * (-(2 ^ (-10 * t)) + 2) + b + return (c * 0.5) * 1.0005 * (-(2 ^ (-10 * t)) + 2) + b end end @@ -230,11 +230,11 @@ local InOutCircular = function(t, b, c, d) t = t / d * 2 if t < 1 then - return -c / 2 * (sqrt(1 - t * t) - 1) + b + return -(c * 0.5) * (sqrt(1 - t * t) - 1) + b else t = t - 2 - return c / 2 * (sqrt(1 - t * t) + 1) + b + return (c * 0.5) * (sqrt(1 - t * t) + 1) + b end end @@ -242,18 +242,18 @@ end local OutBounce = function(t, b, c, d) t = t / d - if t < (1 / 2.75) then + if t < 0.36 then -- 1 / 2.75 return c * (7.5625 * t * t) + b - elseif t < (2 / 2.75) then - t = t - (1.5 / 2.75) + elseif t < 0.73 then -- 2 / 2.75 + t = t - 0.55 -- 1.5 / 2.75 return c * (7.5625 * t * t + 0.75) + b - elseif t < (2.5 / 2.75) then - t = t - (2.25 / 2.75) + elseif t < 0.91 then -- 2.5 / 2.75 + t = t - 0.82 -- 2.25 / 2.75 return c * (7.5625 * t * t + 0.9375) + b else - t = t - (2.625 / 2.75) + t = t - 0.95 -- 2.625 / 2.75 return c * (7.5625 * t * t + 0.984375) + b end @@ -264,7 +264,7 @@ local InBounce = function(t, b, c, d) end local InOutBounce = function(t, b, c, d) - if t < d / 2 then + if t < d * 0.5 then return InBounce(t * 2, 0, c, d) * 0.5 + b else return OutBounce(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b @@ -285,7 +285,7 @@ local InElastic = function(t, b, c, d) local a = c local p = d * 0.3 - local s = p / 4 + local s = p * 0.25 t = t - 1 @@ -305,7 +305,7 @@ local OutElastic = function(t, b, c, d) local a = c local p = d * 0.3 - local s = p / 4 + local s = p * 0.25 return a * 2 ^ (-10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b end @@ -323,7 +323,7 @@ local InOutElastic = function(t, b, c, d) local a = c local p = d * (0.3 * 1.5) - local s = p / 4 + local s = p * 0.25 if t < 1 then t = t - 1 From 2850a3e91a3013c33a5bfcfca78e14f0650c3807 Mon Sep 17 00:00:00 2001 From: Simpy Date: Sat, 23 Nov 2024 19:03:53 -0500 Subject: [PATCH 09/17] lower instant to 0.3 --- ElvUI/Core/Modules/Nameplates/StyleFilter.lua | 2 +- ElvUI_Libraries/Core/oUF/simpy/pooler.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua index d71f3634f4..68dc8518d1 100644 --- a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua +++ b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua @@ -1636,7 +1636,7 @@ end do -- oUF style filter inject watch functions without actually registering any events local object = CreateFrame('Frame') object.delay = 0.1 -- update check rate - object.instant = 0.5 -- seconds since last event + object.instant = 0.3 -- seconds since last event object.active = true -- off is always instant object.tracked = {} object.times = {} diff --git a/ElvUI_Libraries/Core/oUF/simpy/pooler.lua b/ElvUI_Libraries/Core/oUF/simpy/pooler.lua index 58704f64b7..db98c356d2 100644 --- a/ElvUI_Libraries/Core/oUF/simpy/pooler.lua +++ b/ElvUI_Libraries/Core/oUF/simpy/pooler.lua @@ -21,7 +21,7 @@ object.events = {} object.times = {} object.delay = 0.1 -- update check rate -object.instant = 0.5 -- seconds since last event +object.instant = 0.3 -- seconds since last event object.active = true -- off is always instant pooler.run = function(funcs, frame, event, ...) From 20d8b0f909ceda44f89b8033744ea2427c92fb9e Mon Sep 17 00:00:00 2001 From: Simpy Date: Sun, 24 Nov 2024 15:38:55 -0500 Subject: [PATCH 10/17] work on profiler (this lets me test single functions as well) --- ElvUI_Libraries/Core/oUF/simpy/profiler.lua | 123 ++++++++++++++------ 1 file changed, 87 insertions(+), 36 deletions(-) diff --git a/ElvUI_Libraries/Core/oUF/simpy/profiler.lua b/ElvUI_Libraries/Core/oUF/simpy/profiler.lua index a49343949a..c74f27137c 100644 --- a/ElvUI_Libraries/Core/oUF/simpy/profiler.lua +++ b/ElvUI_Libraries/Core/oUF/simpy/profiler.lua @@ -15,18 +15,70 @@ local debugprofilestop = debugprofilestop -- cpu timing stuff local _default = { total = 0, average = 0, count = 0 } -local _info, _data, _fps = {}, { _all = CopyTable(_default) }, { _all = CopyTable(_default) } +local _info, _funcs, _data, _fps = {}, {}, { _all = CopyTable(_default) }, { _all = CopyTable(_default) } oUF.Profiler = _info +_info.funcs = _funcs _info.data = _data _info.fps = _fps -local Collect = function(object, key, func, ...) +local Profile = function(func, ...) local start = debugprofilestop() local args = { func(...) } local finish = debugprofilestop() - start + return start, finish, args +end + +local Store = function(data, finish) + local count = data.count + 1 + return count, (finish > data.high) and finish, (finish < data.low) and finish, data.total + finish, data.total / count +end + +local Save = function(data, start, finish) + local count, high, low, total, average = Store(data, finish) + + if high then data.high = high end + if low then data.low = low end + + data.count = count + data.total = total + data.start = start + data.finish = finish + data.average = average +end + +local Total = function(data, finish) + local count = data.count + 1 + return count, data.total + finish, data.total / count +end + +local Single = function(func, ...) + local data = _funcs[func] + if not data then + return func(...) + end + + local start, finish, args = Profile(func, ...) + if not data.count then + data.high = finish + data.low = finish + data.total = finish + data.average = finish + data.finish = finish + data.start = start + data.count = 1 + else + Save(data, finish) + end + + return unpack(args) +end + +local Several = function(object, key, func, ...) + local start, finish, args = Profile(func, ...) + local obj = _data[object] if not obj then obj = { _module = CopyTable(_default) } @@ -40,40 +92,17 @@ local Collect = function(object, key, func, ...) local data = obj[key] if data then - data.count = data.count + 1 - - if data.finish > data.high then - data.high = data.finish - end - - if data.finish < data.low then - data.low = data.finish - end - - data.total = data.total + finish - data.average = data.total / data.count + Save(data, start, finish) else - data = { high = finish, low = finish, total = finish, average = finish, count = 1 } + data = { start = start, finish = finish, high = finish, low = finish, total = finish, average = finish, count = 1 } obj[key] = data end - -- update data - data.start = start - data.finish = finish + local module = obj._module -- module totals + if module then module.count, module.total, module.average = Total(module, finish) end - local module = obj._module - if module then -- module totals - module.total = module.total + finish - module.count = module.count + 1 - module.average = module.total / module.count - end - - local all = _data._all - if all then -- overall totals - all.total = all.total + finish - all.count = all.count + 1 - all.average = all.total / all.count - end + local all = _data._all -- overall totals + if all then all.count, all.total, all.average = Total(all, finish) end return unpack(args) end @@ -81,11 +110,21 @@ end local Generate = function(object, key, func) -- print('Generate', object, key, func) - return function(...) - if _info._enabled then - return Collect(object, key, func, ...) - else - return func(...) + if object then + return function(...) + if _info._enabled then + return Several(object, key, func, ...) + else + return func(...) + end + end + else + return function(...) + if _info._enabled then + return Single(func, ...) + else + return func(...) + end end end end @@ -101,6 +140,14 @@ local Generator = function(object, key, value) end end +_info.add = function(func) + if not _funcs[func] then + _funcs[func] = {} + + return Generate(nil, nil, func) + end +end + _info.clear = function(object) wipe(object) @@ -111,6 +158,10 @@ _info.reset = function() _info.clear(_data) _info.clear(_fps) + for _, obj in next, _funcs do + wipe(obj) + end + _info.oUF_Private = nil end From 641545a738bedcb8f0d5f82d7f3dac323f1c4e61 Mon Sep 17 00:00:00 2001 From: Simpy Date: Sun, 24 Nov 2024 15:40:41 -0500 Subject: [PATCH 11/17] rename this --- ElvUI_Libraries/Core/oUF/simpy/profiler.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ElvUI_Libraries/Core/oUF/simpy/profiler.lua b/ElvUI_Libraries/Core/oUF/simpy/profiler.lua index c74f27137c..be5540e973 100644 --- a/ElvUI_Libraries/Core/oUF/simpy/profiler.lua +++ b/ElvUI_Libraries/Core/oUF/simpy/profiler.lua @@ -31,13 +31,13 @@ local Profile = function(func, ...) return start, finish, args end -local Store = function(data, finish) +local Update = function(data, finish) local count = data.count + 1 return count, (finish > data.high) and finish, (finish < data.low) and finish, data.total + finish, data.total / count end local Save = function(data, start, finish) - local count, high, low, total, average = Store(data, finish) + local count, high, low, total, average = Update(data, finish) if high then data.high = high end if low then data.low = low end From cec2aa31422daa98a4b856801e2067d45167e015 Mon Sep 17 00:00:00 2001 From: Simpy Date: Sun, 24 Nov 2024 16:06:54 -0500 Subject: [PATCH 12/17] dispel types to use local table --- ElvUI/Core/General/API.lua | 3 ++- ElvUI/Core/Modules/Nameplates/StyleFilter.lua | 5 +++-- ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua | 10 +++++----- ElvUI_Libraries/Core/oUF/simpy/profiler.lua | 10 +++++----- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ElvUI/Core/General/API.lua b/ElvUI/Core/General/API.lua index 63949eca0d..70988cd02e 100644 --- a/ElvUI/Core/General/API.lua +++ b/ElvUI/Core/General/API.lua @@ -74,6 +74,7 @@ local UIErrorsFrame = UIErrorsFrame -- GLOBALS: ElvDB local DebuffColors = E.Libs.Dispel:GetDebuffTypeColor() +local DispelTypes = E.Libs.Dispel:GetMyDispelTypes() E.MountIDs = {} E.MountText = {} @@ -425,7 +426,7 @@ function E:CheckRole() end function E:IsDispellableByMe(debuffType) - return E.Libs.Dispel:IsDispellableByMe(debuffType) + return DispelTypes[debuffType] end function E:UpdateDispelColors() diff --git a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua index 68dc8518d1..085cd54e03 100644 --- a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua +++ b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua @@ -50,6 +50,7 @@ local C_Item_IsEquippedItem = C_Item.IsEquippedItem local C_PetBattles_IsInBattle = C_PetBattles and C_PetBattles.IsInBattle local BleedList = E.Libs.Dispel:GetBleedList() +local DispelTypes = E.Libs.Dispel:GetMyDispelTypes() local FallbackColor = {r=1, b=1, g=1} @@ -366,9 +367,9 @@ function NP:StyleFilterDispelCheck(frame, filter) if isStealable then return true end - elseif auraType and E:IsDispellableByMe(auraType) then + elseif auraType and DispelTypes[auraType] then return true - elseif not auraType and BleedList[spellID] and E:IsDispellableByMe('Bleed') then + elseif not auraType and BleedList[spellID] and DispelTypes.Bleed then return true end diff --git a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua index b7a988aff8..a953a81cd8 100644 --- a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua +++ b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua @@ -17,6 +17,7 @@ local UnitIsFriend = UnitIsFriend local UnitIsUnit = UnitIsUnit local DebuffColors = E.Libs.Dispel:GetDebuffTypeColor() +local DispelTypes = E.Libs.Dispel:GetMyDispelTypes() local BleedList = E.Libs.Dispel:GetBleedList() local BadDispels = E.Libs.Dispel:GetBadList() @@ -443,10 +444,10 @@ function UF:PostUpdateAura(_, button) if enemy and db.auraByType then r, g, b = enemy.r, enemy.g, enemy.b end - elseif bad and db.auraByDispels and BadDispels[button.spellID] and button.debuffType and E:IsDispellableByMe(button.debuffType) then + elseif bad and db.auraByDispels and BadDispels[button.spellID] and button.debuffType and DispelTypes[button.debuffType] then r, g, b = bad.r, bad.g, bad.b elseif db.auraByType then - local bleed = not button.debuffType and BleedList[button.spellID] and E:IsDispellableByMe('Bleed') and DebuffColors.Bleed + local bleed = not button.debuffType and BleedList[button.spellID] and DispelTypes.Bleed and DebuffColors.Bleed if bleed then r, g, b = bleed.r, bleed.g, bleed.b else @@ -623,9 +624,8 @@ function UF:AuraFilter(unit, button, name, icon, count, debuffType, duration, ex --- button.isDebuff = isDebuff --- button.isPlayer = source == 'player' or source == 'vehicle' - local dispel = self.type == 'debuffs' and debuffType and E:IsDispellableByMe(debuffType) - - local bleed = not dispel and not debuffType and E:IsDispellableByMe('Bleed') + local dispel = self.type == 'debuffs' and debuffType and DispelTypes[debuffType] + local bleed = not dispel and not debuffType and DispelTypes.Bleed if bleed then dispel = BleedList[spellID] end button.canDesaturate = db.desaturate diff --git a/ElvUI_Libraries/Core/oUF/simpy/profiler.lua b/ElvUI_Libraries/Core/oUF/simpy/profiler.lua index be5540e973..89b6656d6f 100644 --- a/ElvUI_Libraries/Core/oUF/simpy/profiler.lua +++ b/ElvUI_Libraries/Core/oUF/simpy/profiler.lua @@ -36,6 +36,11 @@ local Update = function(data, finish) return count, (finish > data.high) and finish, (finish < data.low) and finish, data.total + finish, data.total / count end +local Total = function(data, finish) + local count = data.count + 1 + return count, data.total + finish, data.total / count +end + local Save = function(data, start, finish) local count, high, low, total, average = Update(data, finish) @@ -49,11 +54,6 @@ local Save = function(data, start, finish) data.average = average end -local Total = function(data, finish) - local count = data.count + 1 - return count, data.total + finish, data.total / count -end - local Single = function(func, ...) local data = _funcs[func] if not data then From e66cd4a4efad5318297341e97ebe21b645460fa1 Mon Sep 17 00:00:00 2001 From: Simpy Date: Sun, 24 Nov 2024 19:33:21 -0500 Subject: [PATCH 13/17] split these functions up (so they can be profiled easily) --- ElvUI/Core/Modules/Nameplates/StyleFilter.lua | 2 +- .../Modules/UnitFrames/Elements/Auras.lua | 75 +++++++++++-------- 2 files changed, 46 insertions(+), 31 deletions(-) diff --git a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua index 085cd54e03..25847321eb 100644 --- a/ElvUI/Core/Modules/Nameplates/StyleFilter.lua +++ b/ElvUI/Core/Modules/Nameplates/StyleFilter.lua @@ -369,7 +369,7 @@ function NP:StyleFilterDispelCheck(frame, filter) end elseif auraType and DispelTypes[auraType] then return true - elseif not auraType and BleedList[spellID] and DispelTypes.Bleed then + elseif not auraType and DispelTypes.Bleed and BleedList[spellID] then return true end diff --git a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua index a953a81cd8..a16a21c09e 100644 --- a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua +++ b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua @@ -4,7 +4,7 @@ local NP = E:GetModule('NamePlates') local AB = E:GetModule('ActionBars') local LSM = E.Libs.LSM -local format, strlower = format, strlower +local format, strlower, strfind = format, strlower, strfind local tinsert, strsplit, strmatch = tinsert, strsplit, strmatch local sort, wipe, next, unpack, floor = sort, wipe, next, unpack, floor @@ -245,7 +245,7 @@ function UF:UpdateAuraSettings(button) if db then local point = db.countPosition or 'CENTER' button.Count:ClearAllPoints() - button.Count:SetJustifyH(point:find('RIGHT') and 'RIGHT' or 'LEFT') + button.Count:SetJustifyH(strfind(point, 'RIGHT', nil, true) and 'RIGHT' or 'LEFT') button.Count:Point(point, db.countXOffset, db.countYOffset) button.Count:FontTemplate(LSM:Fetch('font', db.countFont), db.countFontSize, db.countFontOutline) end @@ -278,7 +278,7 @@ function UF:UpdateAuraCooldownPosition(button) if point == 'CENTER' then button.Cooldown.timer.text:Point(point, 1, 0) else - local bottom, right = point:find('BOTTOM'), point:find('RIGHT') + local bottom, right = strfind(point, 'BOTTOM', nil, true), strfind(point, 'RIGHT', nil, true) button.Cooldown.timer.text:Point(point, right and -1 or 1, bottom and 1 or -1) end @@ -591,28 +591,49 @@ function UF:AuraUnchanged(a, name, icon, count, debuffType, duration, expiration end end -function UF:AuraFilter(unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll) - if not name then return end -- checking for an aura that is not there, pass nil to break while loop - - local db = button.db or self.db - if not db then return true end - +function UF:AuraStacks(db, auras, button, name, icon, count, spellID, source, castByPlayer) if db.stackAuras and not UF.ExcludeStacks[spellID] then local matching = source and castByPlayer and format('%s:%s', UF.SourceStacks[spellID] or source, name) or name local amount = (count and count > 0 and count) or 1 - local stack = self.stacks[matching] + local stack = auras.stacks[matching] if not stack then - self.stacks[matching] = button + auras.stacks[matching] = button button.matches = amount elseif stack.texture == icon then stack.matches = (stack.matches or 1) + amount stack.Count:SetText(stack.matches) - return false + return true -- its stacking end elseif button.matches then button.matches = nil -- stackAuras end +end + +function UF:AuraDispellable(debuffType, spellID) + if debuffType then + return DispelTypes[debuffType] + else + return DispelTypes.Bleed and BleedList[spellID] + end +end + +function UF:AuraDuration(db, duration) + local noDuration = (not duration or duration == 0) + return noDuration, noDuration or (duration and duration > 0 and (not db.maxDuration or db.maxDuration == 0 or duration <= db.maxDuration) and (not db.minDuration or db.minDuration == 0 or duration >= db.minDuration)) +end + +function UF:AuraFilter(unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll) + if not name then return end -- checking for an aura that is not there, pass nil to break while loop + + local db = self.db + if not db then + return true -- no database huh + end + + if UF:AuraStacks(db, self, button, name, icon, count, spellID, source, castByPlayer) then + return false -- stacking so dont allow it + end if UF:AuraUnchanged(button.auraInfo, name, icon, count, debuffType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll) then return button.filterPass @@ -624,33 +645,27 @@ function UF:AuraFilter(unit, button, name, icon, count, debuffType, duration, ex --- button.isDebuff = isDebuff --- button.isPlayer = source == 'player' or source == 'vehicle' - local dispel = self.type == 'debuffs' and debuffType and DispelTypes[debuffType] - local bleed = not dispel and not debuffType and DispelTypes.Bleed - if bleed then dispel = BleedList[spellID] end - - button.canDesaturate = db.desaturate - button.myPet = source == 'pet' - button.otherPet = source and not UnitIsUnit('pet', source) and strmatch(source, 'pet%d+') - button.isFriend = unit and UnitIsFriend('player', unit) and not UnitCanAttack('player', unit) - button.unitIsCaster = unit and source and UnitIsUnit(unit, source) - button.canDispel = dispel or (self.type == 'buffs' and isStealable) - button.isStealable = isStealable button.debuffType = debuffType button.duration = duration button.expiration = expiration - button.noTime = duration == 0 and expiration == 0 + button.isStealable = isStealable button.stackCount = count - button.texture = icon button.spellID = spellID + button.texture = icon button.name = name - button.priority = 0 - local isMount = E.MountIDs[spellID] - local noDuration = (not duration or duration == 0) - local allowDuration = noDuration or (duration and duration > 0 and (not db.maxDuration or db.maxDuration == 0 or duration <= db.maxDuration) and (not db.minDuration or db.minDuration == 0 or duration >= db.minDuration)) + button.myPet = source == 'pet' + button.otherPet = source and source ~= 'pet' and strfind(source, 'pet', nil, true) + button.canDispel = (self.type == 'buffs' and isStealable) or (self.type == 'debuffs' and UF:AuraDispellable(debuffType, spellID)) + button.isFriend = unit == 'player' or (UnitIsFriend('player', unit) and not UnitCanAttack('player', unit)) + button.unitIsCaster = source and ((unit == source) or UnitIsUnit(unit, source)) + button.canDesaturate = db.desaturate + button.noTime = duration == 0 and expiration == 0 + button.priority = 0 + local noDuration, allowDuration = UF:AuraDuration(db, duration) if self.filterList then - local filterCheck, spellPriority = UF:CheckFilter(source, name, spellID, button.canDispel, button.isFriend, button.isPlayer, button.unitIsCaster, button.myPet, button.otherPet, isBossDebuff, allowDuration, noDuration, isMount, castByPlayer, nameplateShowPersonal, nameplateShowAll, self.filterList) + local filterCheck, spellPriority = UF:CheckFilter(source, name, spellID, button.canDispel, button.isFriend, button.isPlayer, button.unitIsCaster, button.myPet, button.otherPet, isBossDebuff, allowDuration, noDuration, E.MountIDs[spellID], castByPlayer, nameplateShowPersonal, nameplateShowAll, self.filterList) if spellPriority then button.priority = spellPriority end -- this is the only difference from auarbars code button.filterPass = filterCheck return filterCheck From 946462ad89bf33349a91aa72308bb0696b101b2e Mon Sep 17 00:00:00 2001 From: Simpy Date: Sun, 24 Nov 2024 20:29:40 -0500 Subject: [PATCH 14/17] try to optimize the aura filter a bit --- .../Modules/UnitFrames/Elements/Auras.lua | 122 ++++++++++-------- ElvUI_Libraries/Core/oUF/simpy/profiler.lua | 3 +- 2 files changed, 69 insertions(+), 56 deletions(-) diff --git a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua index a16a21c09e..dd5241331d 100644 --- a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua +++ b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua @@ -530,7 +530,7 @@ function UF:ConvertFilters(auras, priority) end end -function UF:CheckFilter(source, spellName, spellID, canDispel, isFriend, isPlayer, unitIsCaster, myPet, otherPet, isBossDebuff, allowDuration, noDuration, isMount, castByPlayer, nameplateShowSelf, nameplateShowAll, filterList) +function UF:CheckFilter(source, spellName, spellID, canDispel, isFriend, isPlayer, unitIsCaster, myPet, otherPet, isBossDebuff, noDuration, castByPlayer, blizzardNameplate, isMount, filterList) for i = 1, #filterList do local data = filterList[i] local status = data.status @@ -543,40 +543,33 @@ function UF:CheckFilter(source, spellName, spellID, canDispel, isFriend, isPlaye if which and list and next(list) then local spell = list[spellID] or list[spellName] if spell and spell.enable then - if which == 'Blacklist' then - return false - elseif allowDuration then - return true, spell.priority - end + return which ~= 'Blacklist', spell.priority end end -- Special Filters else - -- Whitelists local name = data.name - local found = (allowDuration and ((name == 'Personal' and isPlayer) - or (name == 'nonPersonal' and not isPlayer) - or (name == 'Mount' and isMount) - or (name == 'Boss' and isBossDebuff) - or (name == 'MyPet' and myPet) - or (name == 'OtherPet' and otherPet) - or (name == 'CastByUnit' and source and unitIsCaster) - or (name == 'notCastByUnit' and source and not unitIsCaster) - or (name == 'Dispellable' and canDispel) - or (name == 'notDispellable' and not canDispel) - or (name == 'CastByNPC' and not castByPlayer) - or (name == 'CastByPlayers' and castByPlayer) - or (name == 'BlizzardNameplate' and (nameplateShowAll or (nameplateShowSelf and (isPlayer or myPet)))))) - -- Blacklists - or ((name == 'blockCastByPlayers' and castByPlayer) + if (name == 'blockCastByPlayers' and castByPlayer) or (name == 'blockNoDuration' and noDuration) or (name == 'blockMount' and isMount) or (name == 'blockNonPersonal' and not isPlayer) or (name == 'blockDispellable' and canDispel) - or (name == 'blockNotDispellable' and not canDispel)) and 0 - - if found then - return found ~= 0 + or (name == 'blockNotDispellable' and not canDispel) then + return false -- Blacklists + elseif (name == 'Personal' and isPlayer) + or (name == 'nonPersonal' and not isPlayer) + or (name == 'Mount' and isMount) + or (name == 'Boss' and isBossDebuff) + or (name == 'MyPet' and myPet) + or (name == 'OtherPet' and otherPet) + or (name == 'CastByUnit' and source and unitIsCaster) + or (name == 'notCastByUnit' and source and not unitIsCaster) + or (name == 'Dispellable' and canDispel) + or (name == 'notDispellable' and not canDispel) + or (name == 'CastByNPC' and not castByPlayer) + or (name == 'CastByPlayers' and castByPlayer) + or (name == 'BlizzardNameplate' and blizzardNameplate) then + return true -- Whitelists end end end @@ -623,28 +616,20 @@ function UF:AuraDuration(db, duration) return noDuration, noDuration or (duration and duration > 0 and (not db.maxDuration or db.maxDuration == 0 or duration <= db.maxDuration) and (not db.minDuration or db.minDuration == 0 or duration >= db.minDuration)) end -function UF:AuraFilter(unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll) - if not name then return end -- checking for an aura that is not there, pass nil to break while loop - - local db = self.db - if not db then - return true -- no database huh - end - - if UF:AuraStacks(db, self, button, name, icon, count, spellID, source, castByPlayer) then - return false -- stacking so dont allow it - end - - if UF:AuraUnchanged(button.auraInfo, name, icon, count, debuffType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll) then - return button.filterPass - end - +function UF:AuraPopulate(db, unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, spellID) -- already set by oUF: --- button.caster = source --- button.filter = filter --- button.isDebuff = isDebuff --- button.isPlayer = source == 'player' or source == 'vehicle' + local myPet = source == 'pet' + local otherPet = source and source ~= 'pet' and strfind(source, 'pet', nil, true) + local canDispel = (self.type == 'buffs' and isStealable) or (self.type == 'debuffs' and UF:AuraDispellable(debuffType, spellID)) + local isFriend = unit == 'player' or (UnitIsFriend('player', unit) and not UnitCanAttack('player', unit)) + local unitIsCaster = source and ((unit == source) or UnitIsUnit(unit, source)) + + -- straight from the args button.debuffType = debuffType button.duration = duration button.expiration = expiration @@ -654,23 +639,50 @@ function UF:AuraFilter(unit, button, name, icon, count, debuffType, duration, ex button.texture = icon button.name = name - button.myPet = source == 'pet' - button.otherPet = source and source ~= 'pet' and strfind(source, 'pet', nil, true) - button.canDispel = (self.type == 'buffs' and isStealable) or (self.type == 'debuffs' and UF:AuraDispellable(debuffType, spellID)) - button.isFriend = unit == 'player' or (UnitIsFriend('player', unit) and not UnitCanAttack('player', unit)) - button.unitIsCaster = source and ((unit == source) or UnitIsUnit(unit, source)) + -- from locals + button.myPet = myPet + button.otherPet = otherPet + button.canDispel = canDispel + button.isFriend = isFriend + button.unitIsCaster = unitIsCaster + + -- used elsewhere button.canDesaturate = db.desaturate button.noTime = duration == 0 and expiration == 0 - button.priority = 0 + + return myPet, otherPet, canDispel, isFriend, unitIsCaster +end + +function UF:AuraFilter(unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll) + if not name then return end -- checking for an aura that is not there, pass nil to break while loop + + local db = self.db + if not db then + return true -- no database huh + elseif UF:AuraStacks(db, self, button, name, icon, count, spellID, source, castByPlayer) then + return false -- stacking so dont allow it + end local noDuration, allowDuration = UF:AuraDuration(db, duration) - if self.filterList then - local filterCheck, spellPriority = UF:CheckFilter(source, name, spellID, button.canDispel, button.isFriend, button.isPlayer, button.unitIsCaster, button.myPet, button.otherPet, isBossDebuff, allowDuration, noDuration, E.MountIDs[spellID], castByPlayer, nameplateShowPersonal, nameplateShowAll, self.filterList) - if spellPriority then button.priority = spellPriority end -- this is the only difference from auarbars code - button.filterPass = filterCheck - return filterCheck - else - button.filterPass = allowDuration + if not self.filterList then + button.filterPass = nil + button.priority = 0 + return allowDuration -- Allow all auras to be shown when the filter list is empty, while obeying duration sliders + elseif allowDuration then + if button.filterPass and UF:AuraUnchanged(button.auraInfo, name, icon, count, debuffType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll) then + return button.filterPass + else + local myPet, otherPet, canDispel, isFriend, unitIsCaster = UF:AuraPopulate(db, unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, spellID) + local pass, priority = UF:CheckFilter(source, name, spellID, canDispel, isFriend, button.isPlayer, unitIsCaster, myPet, otherPet, isBossDebuff, noDuration, castByPlayer, nameplateShowAll or (nameplateShowPersonal and (button.isPlayer or myPet)), E.MountIDs[spellID], self.filterList) + + button.filterPass = pass + button.priority = priority or 0 -- this is the only difference from auarbars code + + return pass + end + else + button.filterPass = nil + button.priority = 0 end end diff --git a/ElvUI_Libraries/Core/oUF/simpy/profiler.lua b/ElvUI_Libraries/Core/oUF/simpy/profiler.lua index 89b6656d6f..8d2ef2e9a7 100644 --- a/ElvUI_Libraries/Core/oUF/simpy/profiler.lua +++ b/ElvUI_Libraries/Core/oUF/simpy/profiler.lua @@ -169,6 +169,7 @@ _info.state = function(value) _info._enabled = value end +local meta = { __newindex = Generator } _info.func = function(tbl, ...) -- print('Profiler', tbl) @@ -178,7 +179,7 @@ _info.func = function(tbl, ...) return tbl, ... else - return setmetatable(tbl, { __newindex = Generator }), ... + return setmetatable(tbl, meta), ... end end From 3dc265247592b044c5a075263cf654c19a2bb7f1 Mon Sep 17 00:00:00 2001 From: Simpy Date: Sun, 24 Nov 2024 22:24:40 -0500 Subject: [PATCH 15/17] messed this part up --- .../Modules/UnitFrames/Elements/Auras.lua | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua index dd5241331d..d5edccd241 100644 --- a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua +++ b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua @@ -664,25 +664,20 @@ function UF:AuraFilter(unit, button, name, icon, count, debuffType, duration, ex end local noDuration, allowDuration = UF:AuraDuration(db, duration) - if not self.filterList then + if not allowDuration or not self.filterList then button.filterPass = nil button.priority = 0 return allowDuration -- Allow all auras to be shown when the filter list is empty, while obeying duration sliders - elseif allowDuration then - if button.filterPass and UF:AuraUnchanged(button.auraInfo, name, icon, count, debuffType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll) then - return button.filterPass - else - local myPet, otherPet, canDispel, isFriend, unitIsCaster = UF:AuraPopulate(db, unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, spellID) - local pass, priority = UF:CheckFilter(source, name, spellID, canDispel, isFriend, button.isPlayer, unitIsCaster, myPet, otherPet, isBossDebuff, noDuration, castByPlayer, nameplateShowAll or (nameplateShowPersonal and (button.isPlayer or myPet)), E.MountIDs[spellID], self.filterList) + elseif UF:AuraUnchanged(button.auraInfo, name, icon, count, debuffType, duration, expiration, source, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll) then + return button.filterPass + else + local myPet, otherPet, canDispel, isFriend, unitIsCaster = UF:AuraPopulate(db, unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, spellID) + local pass, priority = UF:CheckFilter(source, name, spellID, canDispel, isFriend, button.isPlayer, unitIsCaster, myPet, otherPet, isBossDebuff, noDuration, castByPlayer, nameplateShowAll or (nameplateShowPersonal and (button.isPlayer or myPet)), E.MountIDs[spellID], self.filterList) - button.filterPass = pass - button.priority = priority or 0 -- this is the only difference from auarbars code + button.filterPass = pass + button.priority = priority or 0 -- This is the only difference from auarbars code - return pass - end - else - button.filterPass = nil - button.priority = 0 + return pass end end From 44d653c61716a8778cc36b2ebf9a43837b2fb82b Mon Sep 17 00:00:00 2001 From: Simpy Date: Sun, 24 Nov 2024 22:37:33 -0500 Subject: [PATCH 16/17] ss --- ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua index d5edccd241..c5616c929a 100644 --- a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua +++ b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua @@ -434,10 +434,9 @@ function UF:PreUpdateAura() end function UF:PostUpdateAura(_, button) - local db = (self.isNameplate and NP.db.colors) or UF.db.colors + local db, r, g, b = (self.isNameplate and NP.db.colors) or UF.db.colors local enemyNPC = not button.isFriend and not button.isPlayer local steal, bad, enemy = DebuffColors.Stealable, DebuffColors.BadDispel, DebuffColors.EnemyNPC - local r, g, b if button.isDebuff then if enemyNPC then From 0d8da8310600314fe509fe3788faec4bcf6b791e Mon Sep 17 00:00:00 2001 From: Simpy Date: Sun, 24 Nov 2024 22:54:34 -0500 Subject: [PATCH 17/17] this too --- ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua index c5616c929a..d999d9b0d8 100644 --- a/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua +++ b/ElvUI/Core/Modules/UnitFrames/Elements/Auras.lua @@ -611,8 +611,8 @@ function UF:AuraDispellable(debuffType, spellID) end function UF:AuraDuration(db, duration) - local noDuration = (not duration or duration == 0) - return noDuration, noDuration or (duration and duration > 0 and (not db.maxDuration or db.maxDuration == 0 or duration <= db.maxDuration) and (not db.minDuration or db.minDuration == 0 or duration >= db.minDuration)) + local dno, dmax, dmin = not duration or duration == 0, db.maxDuration, db.minDuration + return dno, dno or (duration and duration > 0 and (not dmax or dmax == 0 or duration <= dmax) and (not dmin or dmin == 0 or duration >= dmin)) end function UF:AuraPopulate(db, unit, button, name, icon, count, debuffType, duration, expiration, source, isStealable, spellID)