- frame.rounds = frame.rounds + 1;
- if (frame.rounds > 7) then
- frame.tankcd = {};
- frame.alert = {};
- frame.stacks = {};
- frame.heal = {};
- frame.buff1 = {};
- addon.SetAuras(frame.unit, frame.guid);
- frame.rounds = 0;
+ -- mana, if present
+ if frame.mana ~= nil then
+ local current, max = UnitPower(unit), UnitPowerMax(unit);
+ if frame.prev.mana ~= current or frame.prev.mmax ~= max then
+ frame.prev.mana = current;
+ frame.prev.mmax = max;
+ if max < current or max <= 1 then
+ frame.mana:SetWidth(width);
+ frame.mana:SetText("100");
+ if not frame.mana:IsShown() then frame.mana:Show() end
+ if not frame.manatext:IsShown() then frame.manatext:Show() end
+ elseif current <= 0 then
+ if frame.mana:IsShown() then frame.mana:Hide() end
+ if frame.manatext:IsShown() then frame.manatext:Hide() end
+ else
+ local percent = current/max;
+ frame.mana:SetWidth(percent*width);
+ frame.manatext:SetText(format("%d", percent*100));
+ if not frame.mana:IsShown() then frame.mana:Show() end
+ if not frame.manatext:IsShown() then frame.manatext:Show() end
+ end
+ end
+ end
+ -- forced aura updates
+ if frame.rounds ~= nil then
+ frame.rounds = frame.rounds + 1;
+ if (frame.rounds > 7) then
+ frame.tankcd = {};
+ frame.alert = {};
+ frame.stacks = {};
+ frame.heal = {};
+ frame.buff1 = {};
+ addon.SetAuras(frame.unit, frame.guid);
+ frame.rounds = 0;
+ end