2 local pairs, ipairs = pairs, ipairs;
3 local GetTime = GetTime;
4 local UnitAura = UnitAura;
5 local UnitIsPlayer = UnitIsPlayer;
6 local CTimerAfter = C_Timer.After;
10 [156910] = "TOPRIGHT",
11 [200025] = "TOPRIGHT",
12 [200654] = "BOTTOMLEFT",
15 ["Psychic Assault"] = true,
16 ["Everburning Flames"] = true,
18 ["Sleep Canister"] = true,
20 ["Necrotic Embrace"] = true,
21 ["Fulminating Pulse"] = true,
22 ["Chilled Blood"] = true,
23 ["Soulblight"] = true,
30 local positions = {"TOPRIGHT", "BOTTOMLEFT"};
31 local auraFilters = {"HELPFUL", "HARMFUL"};
34 --[[local function remaining(expires, current)
35 if expires == 0 then return "" end
36 local remain = expires - current;
38 return format("%dm", ceil(remain/60));
40 return floor(remain+0.5);
43 --[[local function updateIndicators(frame, unit)
44 if not frame:IsShown() then
46 elseif not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then
47 if frame.inds:IsShown() then frame.inds:Hide() end
49 elseif not frame.inds:IsShown() then
53 local current = GetTime();
54 for pos, ind in pairs(frame.inds) do
55 if ind.expires ~= nil then
56 if OmaRF.db.profile.indicators[pos].showText then
57 ind.text:SetText(remaining(ind.expires, current));
60 if ind.icon:IsShown() then ind.icon:Hide() end
61 if ind.text:IsShown() then ind.text:Hide() end
64 for _, ind in ipairs(frame.majorInds) do
65 if ind.expires ~= nil then
66 ind.expireText:SetText(remaining(ind.expires, current));
68 if ind.icon:IsShown() then ind.icon:Hide() end
69 if ind.expireText:IsShown() then ind.expireText:Hide() end
70 if ind.stackText:IsShown() then ind.stackText:Hide() end
75 --local function showIndicator(ind, caster, expires, current, config)
76 local function showIndicator(ind, caster)
77 --if not config.mine or UnitIsPlayer(caster) then
78 if UnitIsPlayer(caster) then
79 --if config.showIcon and not ind:IsShown() then
80 if not ind:IsShown() then
83 --ind.expires = expires;
84 --[[if config.showText then
85 ind.text:SetText(remaining(expires, current));
86 if not ind.text:IsShown() then ind.text:Show() end
91 function OmaCheckIndicators(frame, unit)
92 for _, pos in pairs(positions) do
94 if frame.inds[pos]:IsShown() then frame.inds[pos]:Hide() end
98 if frame.major[1]:IsShown() then frame.major[1]:Hide() end
100 frame.showInds = false;
101 frame.showMajors = false;
103 local name, icon, count, expires, caster, id;
105 local current = GetTime();
106 for _, filter in ipairs(auraFilters) do
109 name, _, icon, count, _, _, expires, caster, _, _, id = UnitAura(unit, i, filter);
110 if not id then break end
111 local pos = watchedAuras[id] or watchedAuras[name];
113 frame.showInds = true;
114 if UnitIsPlayer(caster) and not frame.inds[pos]:IsShown() then
115 frame.inds[pos]:Show();
118 if (majorAuras[id] or majorAuras[name]) and majorPos <= 3 then
119 frame.major[majorPos]:SetTexture(icon);
120 frame.major[majorPos]:Show();
121 frame.showMajors = true;
122 majorPos = majorPos + 1;
127 if frame.showInds then
128 if not frame.inds:IsShown() then frame.inds:Show() end
129 -- create a function for updating the indicator each second
130 --[[local func = updaters[frame];
132 func = function() updateIndicators(frame, unit) end;
133 updaters[frame] = func;
135 CTimerAfter(1, func);]]
136 elseif frame.inds:IsShown() then
139 if frame.showMajors then
140 if not frame.major:IsShown() then frame.major:Show() end
141 elseif frame.major:IsShown() then