local _;
-- global functions used every update
-local C_TimerAfter = C_Timer.After
+local C_TimerAfter = C_Timer.After;
local GetTime = GetTime;
local UnitAura = UnitAura;
local UnitIsPlayer = UnitIsPlayer;
local frameName = name or frame:GetName();
if not f[frameName] then return end
- local config = OmaRF.db.profile;
+ local config = OmaRF.db.profile.indicators;
local font = media and media:Fetch('font', config.indicatorFont) or STANDARD_TEXT_FONT;
for pos, ind in pairs(f[frameName]) do
ind.text:SetFont(font, config[pos]["textSize"]);
local function updateIndicators(frame)
local frameName = frame:GetName();
local unit = frame.unit;
+ if not unit then return end -- possible if the frame is just being hidden
-- Create indicators if needed
if not f[frameName] then setupCompactUnitFrame(frame, frameName) end
if not id then break end
local pos = watchedAuras[name] or watchedAuras[id] or watchedAuras[debuff];
if pos then
- local config = OmaRF.db.profile[pos];
+ local ind = f[frameName][pos];
+ local config = OmaRF.db.profile.indicators[pos];
if not config.mine or UnitIsPlayer(caster) then
- if config.showIcon and not config.useDefaultIcon then
+ if config.showIcon then
-- show icon
- ind.icon:SetTexture(icon);
+ if config.useDefaultIcon then
+ ind.icon:SetTexture(DEFAULT_ICON);
+ else
+ ind.icon:SetTexture(icon);
+ end
end
if config.showText then
-- show text
-- Update all indicators
function OmaRF:UpdateAllIndicators()
CompactRaidFrameContainer_ApplyToFrames(CompactRaidFrameContainer, "normal", updateIndicators);
- if self.running then
- C_TimerAfter(0.15, self:UpdateAllIndicators);
+ if OmaRF.running then
+ C_TimerAfter(0.15, OmaRF.UpdateAllIndicators);
end
end
-- Format aura strings
watchedAuras = {};
for _, pos in ipairs(positions) do
- for _, aura in ipairs(self.db.profile[pos]["auras"]) do
+ for _, aura in ipairs(self.db.profile.indicators[pos]["auras"]) do
watchedAuras[aura] = pos; -- TODO single aura only in one position
end
end
if next(watchedAuras) ~= nil then
self.running = true;
- C_TimerAfter(0.15, self:UpdateAllIndicators);
+ C_TimerAfter(0.15, self.UpdateAllIndicators);
end
end
end