X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/001062c21d0a4b6600278f45ee096fc587c745df..c809e5da99427a93b5ad5eb010a1cb1cba507ec2:/OmaRF/Indicators.lua diff --git a/OmaRF/Indicators.lua b/OmaRF/Indicators.lua index 6b4e04a..d37383a 100644 --- a/OmaRF/Indicators.lua +++ b/OmaRF/Indicators.lua @@ -3,6 +3,7 @@ local pairs, ipairs = pairs, ipairs; local floor = math.floor; local GetTime = GetTime; local UnitAura = UnitAura; +local CreateFrame = CreateFrame; local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected; local CTimerAfter = C_Timer.After; @@ -12,7 +13,6 @@ local watchedAuras = {}; local updaters = {}; local updating = {}; -local auraFilters = {"HELPFUL", "HARMFUL"}; local M = {}; OmaRFIndicators = M; @@ -86,7 +86,7 @@ local function updateIndicators(frame) end end if needUpdate then - CTimerAfter(0.16, updaters[frame]); + CTimerAfter(0.20, updaters[frame]); else updating[frame] = nil; end @@ -131,26 +131,28 @@ function M.CheckIndicators(frame, unit) local majorPos = 1; local alert = false; -- color the whole bar local current = GetTime(); - for _, filter in ipairs(auraFilters) do - local i = 1; - while true do - name, _, icon, count, _, _, expires, caster, _, _, id = UnitAura(unit, i, filter); - if not id then break end - local pos = watchedAuras[id] or watchedAuras[name]; - if pos and caster == "player" then - needUpdate = showInd(frame.inds[pos], expires, current, count, icon) or needUpdate; - showInds = true; - end - local major = majorAuras[id] or majorAuras[name]; - if major and majorPos <= 3 then - needUpdate = showInd(frame.majors[majorPos], expires, current, count, icon) or needUpdate; - if major.bar then alert = true end - showMajors = true; - majorPos = majorPos + 1; - end - i = i + 1; + for spell, pos in pairs(watchedAuras) do + name, _, icon, count, _, _, expires = UnitAura(unit, spell, nil, "PLAYER HELPFUL"); + if name then + needUpdate = showInd(frame.inds[pos], expires, current, count, icon) or needUpdate; + showInds = true; + end + end + + local i = 1; + while true do + name, _, icon, count, _, _, expires, caster, _, _, id = UnitAura(unit, i, "HARMFUL"); + if not id or majorPos > 3 then break end + local major = majorAuras[id] or majorAuras[name]; + if major then + needUpdate = showInd(frame.majors[majorPos], expires, current, count, icon) or needUpdate; + if major.bar then alert = true end + showMajors = true; + majorPos = majorPos + 1; end + i = i + 1; end + if showInds or showMajors then frame.indBase:Show(); frame.majorBase:Show(); @@ -162,7 +164,7 @@ function M.CheckIndicators(frame, unit) func = function() updateIndicators(frame) end; updaters[frame] = func; end - CTimerAfter(0.16, func); + CTimerAfter(0.20, func); end else frame.indBase:Hide();