local pairs, ipairs = pairs, ipairs;
local floor = math.floor;
local GetTime = GetTime;
+local UnitExists = UnitExists;
local UnitAura = UnitAura;
local CreateFrame = CreateFrame;
local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
frame.throttle = function()
frame.throttled = nil;
- updateAuras(frame, frame.displayed);
+ if UnitExists(frame.displayed) then
+ return updateAuras(frame, frame.displayed);
+ end
end;
end
function M.UpdateAuras(frame, unit)
local current = GetTime();
if frame.throttled then
- print("updateAuras throttled for ", unit); -- TODO debug print
return;
- elseif frame.prevUpdate - current < 0.1 then
+ elseif frame.prevUpdate and current - frame.prevUpdate < 0.2 then
frame.throttled = true;
- return CTimerAfter(0.1, frame.throttle);
+ return CTimerAfter(0.2, frame.throttle);
end
+ frame.prevUpdate = current;
for _, ind in pairs(frame.inds) do
hideInd(ind);
end
local showInds, needUpdate = false, false;
local i = 1;
while true do
- _, _, icon, count, _, _, expires, _, _, _, id = UnitAura(unit, i, "PLAYER HELPFUL");
+ _, icon, count, _, _, expires, _, _, _, id = UnitAura(unit, i, "PLAYER HELPFUL");
if not id then break end
local pos = watchedAuras[id];
if pos then
for _, ind in pairs(frame.majors) do
hideInd(ind);
end
- local icon, count, expires, id;
+ if UnitIsDeadOrGhost(unit) then return end
+ local name, icon, count, expires, id;
local showMajors, needUpdate = false, false;
local majorPos = 1;
local alert = false; -- color the whole bar
local current = GetTime();
local i = 1;
while true do
- _, _, icon, count, _, _, expires, _, _, _, id = UnitAura(unit, i, "HARMFUL");
+ name, icon, count, _, _, expires, _, _, _, id = UnitAura(unit, i, "HARMFUL");
if not id or majorPos > 3 then break end
- local major = majorAuras[id];
+ 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
+ if not major.noicon then
+ needUpdate = showInd(frame.majors[majorPos], expires, current, count, icon) or needUpdate;
+ end
+ if major.bar then alert = major.bar end
showMajors = true;
majorPos = majorPos + 1;
end