3 local unpack, pairs, ipairs = unpack, pairs, ipairs;
4 local ssub = string.sub;
6 local UnitName, UnitInRange, UnitDebuff = UnitName, UnitInRange, UnitDebuff;
7 local UnitPower, UnitPowerMax, UnitPowerType = UnitPower, UnitPowerMax, UnitPowerType;
8 local UnitHealth, UnitHealthMax = UnitHealth, UnitHealthMax;
9 local UnitInParty, UnitInRaid = UnitInParty, UnitInRaid;
10 local UnitGetIncomingHeals, UnitGetTotalAbsorbs = UnitGetIncomingHeals, UnitGetTotalAbsorbs;
11 local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs;
12 local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
13 local IsInGroup, IsInRaid = IsInGroup, IsInRaid;
14 local UnitIsCharmed = UnitIsCharmed;
15 local CTimerAfter = C_Timer.After;
16 local UnitClass = UnitClass;
17 local UnitHasIncomingResurrection = UnitHasIncomingResurrection;
18 local UnitThreatSituation, GetThreatStatusColor = UnitThreatSituation, GetThreatStatusColor;
19 local RAID_CLASS_COLORS = RAID_CLASS_COLORS;
20 local CreateFrame, RegisterStateDriver, RegisterUnitWatch = CreateFrame, RegisterStateDriver, RegisterUnitWatch;
21 local SPELL_POWER_MANA = SPELL_POWER_MANA;
22 local checkIndicators = OmaCheckIndicators;
24 local CFrame = CreateFrame("Frame", "OmaCFrame", UIParent);
27 local positions = {"TOPRIGHT", "BOTTOMLEFT"};
30 -- configurable settings
31 local width, height = 80, 40;
32 local anchorX, anchorY = 0, -330;
34 local baseColor = {0, 0, 0};
35 local bgColor = {0.7, 0.7, 0.7};
36 local healthColor = {0.3, 0.3, 0.3};
37 local shieldColor = {0, 0.7, 1};
38 local shieldhlColor = {0.5, 0.8, 1};
39 local healpredColor = {0.5, 0.6, 0.5};
40 local healabsorbColor = {0.1, 0.1, 0.1};
41 local overlayColorDispel = {1, 0.5, 0, 0.5};
42 local overlayColorCharm = {0.8, 0, 1, 0.5};
43 local overlayColorAlert = {1, 0, 0, 0.5};
45 [SPELL_POWER_MANA] = {0, 0.5, 1},
46 [SPELL_POWER_RAGE] = {1, 0, 0},
47 [SPELL_POWER_FOCUS] = {1, 0.5, 0},
48 [SPELL_POWER_ENERGY] = {1, 0.8, 0},
49 [SPELL_POWER_RUNIC_POWER] = {0.9, 0, 0.1},
51 -- watch to not remove mana entry
52 setmetatable(powerColors, {__index = function(t) return t[SPELL_POWER_MANA] end});
54 local function updateHealth(frame, unit)
55 local current, max = UnitHealth(unit), frame.health.max;
56 local healthLost = max - current;
57 -- sanity check, occasionally UnitHealthMax gives zero
59 frame.health:SetWidth(current/frame.health.max*width);
61 frame.health:SetWidth(width);
66 if UnitIsDeadOrGhost(unit) then
67 frame.health:SetWidth(1);
68 if UnitHasIncomingResurrection(unit) then
69 frame.text:SetText("Rez");
71 frame.text:SetText("Dead");
73 elseif not UnitIsConnected(unit) then
74 frame.health:SetWidth(1);
75 frame.text:SetText("DC");
76 elseif healthLost > 0 then
77 if healthLost > 1200000000 then -- 1.2B
78 frame.text:SetFormattedText("-%.1fB", healthLost / 1000000000);
79 elseif healthLost > 1200000 then -- 1.2M
80 frame.text:SetFormattedText("-%.1fM", healthLost / 1000000);
81 elseif healthLost > 1000 then -- 1K
82 frame.text:SetFormattedText("-%dK", healthLost / 1000);
84 frame.text:SetFormattedText("-%d", healthLost)
92 local function updateMaxHealth(frame, unit)
93 frame.health.max = UnitHealthMax(unit);
94 updateHealth(frame, unit);
97 local function updatePower(frame, unit)
98 local max = frame.mana.max;
99 -- sanity check, occasionally UnitPowerMax gives zero
101 frame.mana:SetWidth(UnitPower(unit)/max*width);
103 frame.mana:SetWidth(width);
107 local function updateMaxPower(frame, unit)
108 frame.mana.max = UnitPowerMax(unit);
109 updatePower(frame, unit);
112 local function updatePowerColor(frame, unit)
113 frame.mana:SetColorTexture(unpack(powerColors[UnitPowerType(unit)]));
116 local function updateName(frame, unit)
117 local name = UnitName(unit);
118 if not name then return end
119 frame.name:SetText(ssub(name, 1, 6));
121 local _, class = UnitClass(unit);
122 local color = RAID_CLASS_COLORS[class];
123 if color then frame.name:SetVertexColor(color.r, color.g, color.b) end
126 local function updateHealPred(frame, unit)
127 local incoming = UnitGetIncomingHeals(unit) or 0;
129 local max = frame.health.max;
130 local space = width - frame.health:GetWidth() + 1;
131 local pred = (incoming / max) * width;
132 frame.healpred:SetWidth(min(space, pred));
133 frame.healpred:Show();
135 frame.healpred:Hide();
139 local function updateShield(frame, unit)
140 local shield = UnitGetTotalAbsorbs(unit) or 0;
142 local max = frame.health.max;
143 local space = width - frame.health:GetWidth();
144 shield = (shield / max) * width;
145 if space < shield then
146 frame.shield:SetWidth(space);
147 frame.shieldhl:Show();
149 frame.shield:SetWidth(shield);
150 frame.shieldhl:Hide();
155 frame.shieldhl:Hide();
159 local function updateHealAbsorb(frame, unit)
160 local absorb = UnitGetTotalHealAbsorbs(unit) or 0;
162 local max = frame.health.max;
163 local space = frame.health:GetWidth();
164 absorb = (absorb / max) * width;
165 frame.healabsorb:SetWidth(min(space, absorb));
166 frame.healabsorb:Show();
168 frame.healabsorb:Hide();
172 local function updateAuras(frame, unit)
173 checkIndicators(frame, unit);
174 if UnitDebuff(unit, 1, "RAID") ~= nil then
175 -- something dispellable
176 if frame.overlay.color ~= overlayColorDispel then
177 frame.overlay:SetColorTexture(unpack(overlayColorDispel));
178 frame.overlay:Show();
179 frame.overlay.color = overlayColorDispel;
181 elseif UnitIsCharmed(unit) then
182 if frame.overlay.color ~= overlayColorCharm then
183 frame.overlay:SetColorTexture(unpack(overlayColorCharm));
184 frame.overlay:Show();
185 frame.overlay.color = overlayColorCharm;
188 if frame.overlay.color ~= nil then
189 frame.overlay:Hide();
190 frame.overlay.color = nil;
195 local function updateAggro(frame, unit)
196 local status = UnitThreatSituation(unit);
197 if status and status > 0 then
198 frame.base:SetColorTexture(GetThreatStatusColor(status));
200 frame.base:SetColorTexture(unpack(baseColor));
204 local function unitEvent(self, event, ...)
205 local arg1, arg2, arg3, arg4 = ...;
206 if event == "UNIT_HEALTH" or event == "UNIT_HEALTH_FREQUENT" then
207 updateHealth(self, arg1);
208 updateShield(self, arg1);
209 updateHealAbsorb(self, arg1);
210 -- no heal prediction update, that doesn't overflow too much
211 elseif event == "UNIT_POWER" then
212 updatePower(self, arg1);
213 elseif event == "UNIT_AURA" then
214 updateAuras(self, arg1);
215 elseif event == "UNIT_ABSORB_AMOUNT_CHANGED" then
216 updateShield(self, arg1);
217 elseif event == "UNIT_HEAL_PREDICTION" then
218 updateHealPred(self, arg1);
219 elseif event == "UNIT_HEAL_ABSORB_AMOUNT_CHANGED" then
220 updateHealAbsorb(self, arg1);
221 elseif event == "UNIT_THREAT_SITUATION_UPDATE" then
222 updateAggro(self, arg1);
223 elseif event == "UNIT_MAXHEALTH" then
224 updateMaxHealth(self, arg1);
225 elseif event == "UNIT_MAXPOWER" then
226 updateMaxPower(self, arg1);
227 elseif event == "UNIT_DISPLAYPOWER" then
228 updatePowerColor(self, arg1);
229 elseif event == "INCOMING_RESURRECT_CHANGED" then
231 updateHealth(self, arg1);
232 elseif event == "UNIT_NAME_UPDATE" then
233 updateName(self, arg1);
234 elseif event == "PARTY_MEMBER_ENABLE" or event == "PARTY_MEMBER_DISABLE" then
235 -- new power info possibly (FrameXML/CompactUnitFrame.lua)
236 updateMaxPower(self, self.unit);
237 updatePowerColor(self, self.unit);
238 elseif event == "UNIT_CONNECTION" then
239 updateHealth(self, arg1);
240 elseif event == "UPDATE_ALL_BARS" then
241 updateMaxHealth(self, arg1);
242 updateMaxPower(self, arg1);
243 --updateHealth(self, arg1); -- MaxHealth covers this
244 --updatePower(self, arg1); -- MaxPower covers this
245 updateAuras(self, arg1);
246 updateShield(self, arg1);
247 updateHealPred(self, arg1);
248 updateHealAbsorb(self, arg1);
249 updatePowerColor(self, arg1);
250 updateName(self, arg1);
254 local function unitUpdate(self, elapsed)
255 -- there's no in/out of range event, have to check each frame
256 -- from FrameXML/CompactUnitFrame.lua
257 local inRange, checked = UnitInRange(self.unit);
258 if checked and not inRange then
265 local function registerEvents(frame, unit)
266 -- events are taken from FrameXML/CompactUnitFrame.lua
267 -- TODO vehicle support, ready check support, raid marker support,
268 -- player flags support (/afk, /dnd)
269 frame:RegisterEvent("PARTY_MEMBER_ENABLE");
270 frame:RegisterEvent("PARTY_MEMBER_DISABLE");
271 frame:RegisterUnitEvent("UNIT_HEALTH", unit);
272 frame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", unit);
273 frame:RegisterUnitEvent("UNIT_MAXHEALTH", unit);
274 frame:RegisterUnitEvent("UNIT_POWER", unit);
275 frame:RegisterUnitEvent("UNIT_MAXPOWER", unit);
276 frame:RegisterUnitEvent("UNIT_DISPLAYPOWER", unit);
277 frame:RegisterUnitEvent("UNIT_NAME_UPDATE", unit);
278 frame:RegisterUnitEvent("UNIT_AURA", unit);
279 frame:RegisterUnitEvent("UNIT_HEAL_PREDICTION", unit);
280 frame:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", unit);
281 frame:RegisterUnitEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", unit);
282 frame:RegisterUnitEvent("UNIT_THREAT_SITUATION_UPDATE", unit);
283 frame:RegisterUnitEvent("UNIT_CONNECTION", unit);
284 frame:RegisterUnitEvent("INCOMING_RESURRECT_CHANGED", unit);
287 local function vis(frame, vis)
290 frame:SetScript("OnUpdate", unitUpdate);
291 frame:UnregisterAllEvents();
292 registerEvents(frame, frame.unit);
293 -- wait one frame to update data
294 -- create function if needed to pass arguments to unitEvent
295 local func = updaters[frame];
297 func = function() unitEvent(frame, "UPDATE_ALL_BARS", frame.unit) end;
298 updaters[frame] = func;
300 CTimerAfter(0.01, func);
303 frame:SetScript("OnUpdate", nil);
304 frame:UnregisterAllEvents();
308 local function updateGroup()
312 for _, val in ipairs(raid) do
313 if UnitInRaid(val.frame.unit) then
314 vis(val.frame, true);
315 elseif val.frame:IsShown() then
316 vis(val.frame, false);
319 -- hide player + party (use pairs, not ipairs)
320 for _, val in pairs(party) do
321 if val.frame:IsShown() then vis(val.frame, false) end
324 -- show player + party
325 for _, val in pairs(party) do
326 if UnitInParty(val.frame.unit) then
327 vis(val.frame, true);
328 elseif val.frame:IsShown() then
329 vis(val.frame, false);
333 for _, val in ipairs(raid) do
334 if val.frame:IsShown() then vis(val.frame, false) end
339 vis(party[0].frame, true);
340 -- hide all other frames
341 for _, val in ipairs(party) do
342 if val.frame:IsShown() then vis(val.frame, false) end
344 for _, val in ipairs(raid) do
345 if val.frame:IsShown() then vis(val.frame, false) end
350 local function setupIndicators(frame)
351 frame.inds = CreateFrame("Frame", nil, frame);
352 frame.inds:SetAllPoints();
354 for _, pos in pairs(positions) do
355 frame.inds[pos] = frame.inds:CreateTexture(nil, "OVERLAY");
356 frame.inds[pos]:SetPoint(pos, frame.inds, pos);
357 frame.inds[pos]:SetWidth(indSize);
358 frame.inds[pos]:SetHeight(indSize);
359 frame.inds[pos]:SetTexture("Interface\\AddOns\\OmaRF\\images\\rhomb");
360 frame.inds[pos]:SetVertexColor(1, 0, 0);
361 frame.inds[pos]:Hide();
362 frame.inds[pos].text = frame.inds:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
363 frame.inds[pos].text:SetPoint("BOTTOMRIGHT", frame.inds[pos], "BOTTOMRIGHT");
364 frame.inds[pos].text:Hide();
366 frame.major = CreateFrame("Frame", nil, frame);
367 frame.major:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, -indSize + 4);
368 frame.major:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT");
370 frame.major[i] = frame.major:CreateTexture(nil, "OVERLAY");
372 frame.major[i]:SetPoint("TOPLEFT", frame.major, "TOPLEFT");
374 frame.major[i]:SetPoint("TOPLEFT", frame.major[i-1], "TOPLEFT");
376 frame.major[i]:SetWidth(indSize*2);
377 frame.major[i]:SetHeight(indSize*2);
378 frame.major[i]:Hide();
379 frame.major[i].text = frame.major:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
380 frame.major[i].text:SetPoint("BOTTOMRIGHT", frame.major[i], "BOTTOMRIGHT");
381 frame.major[i].text:Hide();
382 frame.major[i].stack = frame.major:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
383 frame.major[i].stack:SetPoint("TOPLEFT", frame.major[i], "TOPLEFT");
384 frame.major[i].stack:Hide();
388 local function setupFrame(frame, secure, unit)
390 secure:SetWidth(width+2);
391 frame:SetWidth(width+2);
392 frame.base = frame:CreateTexture(nil, "BACKGROUND");
393 frame.base:SetAllPoints();
394 frame.base:SetColorTexture(unpack(baseColor));
395 frame.background = frame:CreateTexture(nil, "BACKGROUND", nil, 1);
396 frame.background:SetPoint("TOPLEFT", frame, "TOPLEFT", 1, -1);
397 frame.background:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -1, 1);
398 frame.background:SetColorTexture(unpack(bgColor));
399 frame.health = frame:CreateTexture(nil, "BORDER");
400 frame.health:SetTexture("Interface\\RaidFrame\\Raid-Bar-Hp-Fill");
401 frame.health:SetPoint("TOPLEFT", frame.background, "TOPLEFT");
402 frame.health:SetPoint("BOTTOMLEFT", frame.background, "BOTTOMLEFT", 0, 2);
403 frame.health:SetVertexColor(unpack(healthColor));
404 frame.health:SetWidth(width);
405 frame.health.max = UnitHealthMax(unit);
406 frame.mana = frame:CreateTexture(nil, "BORDER");
407 frame.mana:SetPoint("TOPLEFT", frame.background, "BOTTOMLEFT", 0, 2);
408 frame.mana:SetPoint("BOTTOMLEFT", frame.background, "BOTTOMLEFT");
409 frame.mana:SetColorTexture(1, 1, 1);
410 frame.mana:SetWidth(width);
411 frame.mana.max = UnitPowerMax(unit);
412 frame.shield = frame:CreateTexture(nil, "BORDER");
413 frame.shield:SetPoint("TOPLEFT", frame.health, "TOPRIGHT");
414 frame.shield:SetPoint("BOTTOMLEFT", frame.health, "BOTTOMRIGHT");
415 frame.shield:SetColorTexture(unpack(shieldColor));
417 frame.shieldhl = frame:CreateTexture(nil, "ARTWORK");
418 frame.shieldhl:SetPoint("TOPLEFT", frame.background, "TOPRIGHT", -1, 0);
419 frame.shieldhl:SetPoint("BOTTOMRIGHT", frame.background, "BOTTOMRIGHT", 1, 0);
420 frame.shieldhl:SetColorTexture(unpack(shieldhlColor));
421 frame.shieldhl:Hide();
422 frame.healpred = frame:CreateTexture(nil, "ARTWORK");
423 frame.healpred:SetPoint("TOPLEFT", frame.health, "TOPRIGHT");
424 frame.healpred:SetPoint("BOTTOMLEFT", frame.health, "BOTTOMRIGHT");
425 frame.healpred:SetColorTexture(unpack(healpredColor));
426 frame.healpred:Hide();
427 frame.healabsorb = frame:CreateTexture(nil, "ARTWORK");
428 frame.healabsorb:SetPoint("TOPRIGHT", frame.health, "TOPRIGHT");
429 frame.healabsorb:SetPoint("BOTTOMRIGHT", frame.health, "BOTTOMRIGHT");
430 frame.healabsorb:SetColorTexture(unpack(healabsorbColor));
431 frame.healabsorb:Hide();
432 frame.overlay = frame:CreateTexture(nil, "ARTWORK", nil, 1);
433 frame.overlay:SetPoint("TOPLEFT", frame.background, "TOPLEFT");
434 frame.overlay:SetPoint("BOTTOMRIGHT", frame.background, "BOTTOMRIGHT", 0, 2);
435 frame.overlay:Hide();
436 frame.name = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
437 frame.name:SetPoint("CENTER", frame.background, "CENTER", 0, 11);
438 frame.text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
439 frame.text:SetFont(STANDARD_TEXT_FONT, 13);
440 frame.text:SetPoint("CENTER", frame.background, "CENTER", 0, -1);
442 setupIndicators(frame);
444 secure:RegisterForClicks("AnyDown");
445 secure:SetAttribute("type1", "spell"); -- left click
446 secure:SetAttribute("type2", "spell"); -- right click
447 secure:SetAttribute("shift-type1", "spell"); -- shift left click
448 secure:SetAttribute("shift-type2", "spell"); -- shift right click
449 secure:SetAttribute("ctrl-type1", "spell"); -- ctrl left click
450 secure:SetAttribute("alt-type2", "spell"); -- alt right click
451 secure:SetAttribute("alt-shift-type1", "spell"); -- alt+shift left click
452 secure:SetAttribute("alt-shift-type2", "spell"); -- alt+shift right click
453 secure:SetAttribute("spell1", "Holy Light");
454 secure:SetAttribute("spell2", "Bestow Faith");
455 secure:SetAttribute("shift-spell1", "Flash of Light");
456 secure:SetAttribute("shift-spell2", "Light of the Martyr");
457 secure:SetAttribute("ctrl-spell1", "Cleanse");
458 secure:SetAttribute("alt-spell2", "Lay on Hands");
459 secure:SetAttribute("alt-shift-spell1", "Beacon of Light");
460 secure:SetAttribute("alt-shift-spell2", "Beacon of Faith");
461 -- rest give target and menu
462 secure:SetAttribute("*type1", "target");
463 secure:SetAttribute("*type2", "togglemenu");
466 local function initializeParty()
467 local secure = CreateFrame("Button", "OmaPartySecure0", CFrame, "SecureUnitButtonTemplate");
468 local frame = CreateFrame("Frame", "OmaParty0", CFrame);
469 local unit = "player";
470 secure:SetAttribute("unit", unit);
471 secure:SetPoint("TOPLEFT", CFrame, "TOPLEFT");
472 secure:SetHeight(height+2);
474 frame:SetPoint("TOPLEFT", CFrame, "TOPLEFT");
475 frame:SetHeight(height+2);
476 frame:SetScript("OnEvent", unitEvent);
478 setupFrame(frame, secure, unit);
479 RegisterStateDriver(secure, "visibility", "[@player,group:raid] hide; show");
480 party[0] = {secure=secure, frame=frame};
482 local secure = CreateFrame("Button", "OmaPartySecure"..i, CFrame, "SecureUnitButtonTemplate");
483 local frame = CreateFrame("Frame", "OmaParty"..i, CFrame);
484 local unit = "party"..i;
485 secure:SetAttribute("unit", unit);
486 secure:SetPoint("TOPLEFT", party[i-1].secure, "TOPRIGHT");
487 secure:SetPoint("BOTTOMLEFT", party[i-1].secure, "BOTTOMRIGHT");
489 frame:SetPoint("TOPLEFT", party[i-1].frame, "TOPRIGHT");
490 frame:SetPoint("BOTTOMLEFT", party[i-1].frame, "BOTTOMRIGHT");
491 frame:SetScript("OnEvent", unitEvent);
493 setupFrame(frame, secure, unit);
494 RegisterUnitWatch(secure);
495 party[i] = {secure=secure, frame=frame};
499 local function initializeRaid()
500 local secure = CreateFrame("Button", "OmaRaidSecure1", CFrame, "SecureUnitButtonTemplate");
501 local frame = CreateFrame("Frame", "OmaRaid1", CFrame);
502 local unit = "raid1";
503 secure:SetAttribute("unit", unit);
504 secure:SetPoint("TOPLEFT", CFrame, "TOPLEFT");
505 secure:SetHeight(height+2);
507 frame:SetPoint("TOPLEFT", CFrame, "TOPLEFT");
508 frame:SetHeight(height+2);
509 frame:SetScript("OnEvent", unitEvent);
511 setupFrame(frame, secure, unit);
512 RegisterUnitWatch(secure);
513 raid[1] = {secure=secure, frame=frame};
516 local secure = CreateFrame("Button", "OmaRaidSecure"..i, CFrame, "SecureUnitButtonTemplate");
517 local frame = CreateFrame("Frame", "OmaRaid"..i, CFrame);
518 local unit = "raid"..i;
519 secure:SetAttribute("unit", unit);
520 secure:SetPoint("TOPLEFT", raid[i-5].secure, "BOTTOMLEFT");
521 secure:SetHeight(height+2);
523 frame:SetPoint("TOPLEFT", raid[i-5].frame, "BOTTOMLEFT");
524 frame:SetHeight(height+2);
525 frame:SetScript("OnEvent", unitEvent);
527 setupFrame(frame, secure, unit);
528 RegisterUnitWatch(secure);
529 raid[i] = {secure=secure, frame=frame};
534 local secure = CreateFrame("Button", "OmaRaidSecure"..i, CFrame, "SecureUnitButtonTemplate");
535 local frame = CreateFrame("Frame", "OmaRaid"..i, CFrame);
536 local unit = "raid"..i;
537 secure:SetAttribute("unit", unit);
538 secure:SetPoint("TOPLEFT", raid[i-1].secure, "TOPRIGHT");
539 secure:SetPoint("BOTTOMLEFT", raid[i-1].secure, "BOTTOMRIGHT");
541 frame:SetPoint("TOPLEFT", raid[i-1].frame, "TOPRIGHT");
542 frame:SetPoint("BOTTOMLEFT", raid[i-1].frame, "BOTTOMRIGHT");
543 frame:SetScript("OnEvent", unitEvent);
545 setupFrame(frame, secure, unit);
546 RegisterUnitWatch(secure);
547 raid[i] = {secure=secure, frame=frame};
552 local function initialize()
553 CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY);
554 CFrame:SetHeight((height+2)*8);
555 CFrame:SetWidth((width+2)*5+1); -- extra pixel for shield overflow
560 CFrame:RegisterEvent("PLAYER_LOGIN");
561 CFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
562 CFrame:RegisterEvent("GROUP_ROSTER_UPDATE");
563 CFrame:RegisterEvent("PLAYER_REGEN_ENABLED");
564 CFrame:SetScript("OnEvent", function(self, event, ...)
565 if event == "GROUP_ROSTER_UPDATE" or event == "PLAYER_REGEN_ENABLED" or
566 event == "PLAYER_ENTERING_WORLD" then
568 elseif event == "PLAYER_LOGIN" then