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));
205 ["UNIT_HEALTH"] = function(frame, unit)
206 updateHealth(frame, unit);
207 updateShield(frame, unit);
208 updateHealAbsorb(frame, unit);
209 -- no heal prediction update, that doesn't overflow too much
211 ["UNIT_POWER"] = function(frame, unit)
212 updatePower(frame, unit);
214 ["UNIT_AURA"] = function(frame, unit)
215 updateAuras(frame, unit);
217 ["UNIT_HEAL_PREDICTION"] = function(frame, unit)
218 updateHealPred(frame, unit);
220 ["UNIT_ABSORB_AMOUNT_CHANGED"] = function(frame, unit)
221 updateShield(frame, unit);
223 ["UNIT_HEAL_ABSORB_AMOUNT_CHANGED"] = function(frame, unit)
224 updateHealAbsorb(frame, unit);
226 ["UNIT_THREAT_SITUATION_UPDATE"] = function(frame, unit)
227 updateAggro(frame, unit);
229 ["UNIT_MAXHEALTH"] = function(frame, unit)
230 updateMaxHealth(frame, unit);
232 ["UNIT_MAXPOWER"] = function(frame, unit)
233 updateMaxPower(frame, unit);
235 ["UNIT_DISPLAYPOWER"] = function(frame, unit)
236 updatePowerColor(frame, unit);
238 ["UNIT_NAME_UPDATE"] = function(frame, unit)
239 updateName(frame, unit);
241 ["UNIT_CONNECTION"] = function(frame, unit)
242 updateHealth(frame, unit);
244 ["INCOMING_RESURRECT_CHANGED"] = function(frame, unit)
246 updateHealth(frame, unit);
248 ["PARTY_MEMBER_ENABLE"] = function(frame)
249 -- new power info possibly (FrameXML/CompactUnitFrame.lua)
250 updateMaxPower(frame, frame.unit);
251 updatePowerColor(frame, frame.unit);
253 ["UPDATE_ALL_BARS"] = function(frame, unit)
254 updateMaxHealth(frame, unit);
255 updateMaxPower(frame, unit);
256 --updateHealth(frame, unit); -- MaxHealth covers this
257 --updatePower(frame, unit); -- MaxPower covers this
258 updateAuras(frame, unit);
259 updateShield(frame, unit);
260 updateHealPred(frame, unit);
261 updateHealAbsorb(frame, unit);
262 updatePowerColor(frame, unit);
263 updateName(frame, unit);
266 eventFuncs["UNIT_HEALTH_FREQUENT"] = eventFuncs["UNIT_HEALTH"];
267 eventFuncs["PARTY_MEMBER_DISABLE"] = eventFuncs["PARTY_MEMBER_ENABLE"];
268 local function unitEvent(self, event, ...)
269 local arg1, arg2, arg3, arg4 = ...;
270 eventFuncs[event](self, arg1);
273 local function unitUpdate(self, elapsed)
274 -- there's no in/out of range event, have to check each frame
275 -- from FrameXML/CompactUnitFrame.lua
276 local inRange, checked = UnitInRange(self.unit);
277 if checked and not inRange then
284 local function registerEvents(frame, unit)
285 -- events are taken from FrameXML/CompactUnitFrame.lua
286 -- TODO vehicle support, ready check support, raid marker support,
287 -- player flags support (/afk, /dnd)
288 frame:RegisterEvent("PARTY_MEMBER_ENABLE");
289 frame:RegisterEvent("PARTY_MEMBER_DISABLE");
290 frame:RegisterUnitEvent("UNIT_HEALTH", unit);
291 frame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", unit);
292 frame:RegisterUnitEvent("UNIT_MAXHEALTH", unit);
293 frame:RegisterUnitEvent("UNIT_POWER", unit);
294 frame:RegisterUnitEvent("UNIT_MAXPOWER", unit);
295 frame:RegisterUnitEvent("UNIT_DISPLAYPOWER", unit);
296 frame:RegisterUnitEvent("UNIT_NAME_UPDATE", unit);
297 frame:RegisterUnitEvent("UNIT_AURA", unit);
298 frame:RegisterUnitEvent("UNIT_HEAL_PREDICTION", unit);
299 frame:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", unit);
300 frame:RegisterUnitEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", unit);
301 frame:RegisterUnitEvent("UNIT_THREAT_SITUATION_UPDATE", unit);
302 frame:RegisterUnitEvent("UNIT_CONNECTION", unit);
303 frame:RegisterUnitEvent("INCOMING_RESURRECT_CHANGED", unit);
306 local function vis(frame, vis)
309 frame:SetScript("OnUpdate", unitUpdate);
310 frame:UnregisterAllEvents();
311 registerEvents(frame, frame.unit);
312 -- wait one frame to update data
313 -- create function if needed to pass arguments to unitEvent
314 local func = updaters[frame];
316 func = function() unitEvent(frame, "UPDATE_ALL_BARS", frame.unit) end;
317 updaters[frame] = func;
319 CTimerAfter(0.01, func);
322 frame:SetScript("OnUpdate", nil);
323 frame:UnregisterAllEvents();
327 local function updateGroup()
331 for _, val in ipairs(raid) do
332 if UnitInRaid(val.frame.unit) then
333 vis(val.frame, true);
334 elseif val.frame:IsShown() then
335 vis(val.frame, false);
338 -- hide player + party (use pairs, not ipairs)
339 for _, val in pairs(party) do
340 if val.frame:IsShown() then vis(val.frame, false) end
343 -- show player + party
344 for _, val in pairs(party) do
345 if UnitInParty(val.frame.unit) then
346 vis(val.frame, true);
347 elseif val.frame:IsShown() then
348 vis(val.frame, false);
352 for _, val in ipairs(raid) do
353 if val.frame:IsShown() then vis(val.frame, false) end
358 vis(party[0].frame, true);
359 -- hide all other frames
360 for _, val in ipairs(party) do
361 if val.frame:IsShown() then vis(val.frame, false) end
363 for _, val in ipairs(raid) do
364 if val.frame:IsShown() then vis(val.frame, false) end
369 local function setupIndicators(frame)
370 frame.inds = CreateFrame("Frame", nil, frame);
371 frame.inds:SetAllPoints();
373 for _, pos in pairs(positions) do
374 frame.inds[pos] = frame.inds:CreateTexture(nil, "OVERLAY");
375 frame.inds[pos]:SetPoint(pos, frame.inds, pos);
376 frame.inds[pos]:SetWidth(indSize);
377 frame.inds[pos]:SetHeight(indSize);
378 frame.inds[pos]:SetTexture("Interface\\AddOns\\OmaRF\\images\\rhomb");
379 frame.inds[pos]:SetVertexColor(1, 0, 0);
380 frame.inds[pos]:Hide();
381 frame.inds[pos].text = frame.inds:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
382 frame.inds[pos].text:SetPoint("BOTTOMRIGHT", frame.inds[pos], "BOTTOMRIGHT");
383 frame.inds[pos].text:Hide();
385 frame.major = CreateFrame("Frame", nil, frame);
386 frame.major:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, -indSize + 4);
387 frame.major:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT");
389 frame.major[i] = frame.major:CreateTexture(nil, "OVERLAY");
391 frame.major[i]:SetPoint("TOPLEFT", frame.major, "TOPLEFT");
393 frame.major[i]:SetPoint("TOPLEFT", frame.major[i-1], "TOPLEFT");
395 frame.major[i]:SetWidth(indSize*2);
396 frame.major[i]:SetHeight(indSize*2);
397 frame.major[i]:Hide();
398 frame.major[i].text = frame.major:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
399 frame.major[i].text:SetPoint("BOTTOMRIGHT", frame.major[i], "BOTTOMRIGHT");
400 frame.major[i].text:Hide();
401 frame.major[i].stack = frame.major:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
402 frame.major[i].stack:SetPoint("TOPLEFT", frame.major[i], "TOPLEFT");
403 frame.major[i].stack:Hide();
407 local function setupFrame(frame, secure, unit)
409 secure:SetWidth(width+2);
410 frame:SetWidth(width+2);
411 frame.base = frame:CreateTexture(nil, "BACKGROUND");
412 frame.base:SetAllPoints();
413 frame.base:SetColorTexture(unpack(baseColor));
414 frame.background = frame:CreateTexture(nil, "BACKGROUND", nil, 1);
415 frame.background:SetPoint("TOPLEFT", frame, "TOPLEFT", 1, -1);
416 frame.background:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -1, 1);
417 frame.background:SetColorTexture(unpack(bgColor));
418 frame.health = frame:CreateTexture(nil, "BORDER");
419 frame.health:SetTexture("Interface\\RaidFrame\\Raid-Bar-Hp-Fill");
420 frame.health:SetPoint("TOPLEFT", frame.background, "TOPLEFT");
421 frame.health:SetPoint("BOTTOMLEFT", frame.background, "BOTTOMLEFT", 0, 2);
422 frame.health:SetVertexColor(unpack(healthColor));
423 frame.health:SetWidth(width);
424 frame.health.max = UnitHealthMax(unit);
425 frame.mana = frame:CreateTexture(nil, "BORDER");
426 frame.mana:SetPoint("TOPLEFT", frame.background, "BOTTOMLEFT", 0, 2);
427 frame.mana:SetPoint("BOTTOMLEFT", frame.background, "BOTTOMLEFT");
428 frame.mana:SetColorTexture(1, 1, 1);
429 frame.mana:SetWidth(width);
430 frame.mana.max = UnitPowerMax(unit);
431 frame.shield = frame:CreateTexture(nil, "BORDER");
432 frame.shield:SetPoint("TOPLEFT", frame.health, "TOPRIGHT");
433 frame.shield:SetPoint("BOTTOMLEFT", frame.health, "BOTTOMRIGHT");
434 frame.shield:SetColorTexture(unpack(shieldColor));
436 frame.shieldhl = frame:CreateTexture(nil, "ARTWORK");
437 frame.shieldhl:SetPoint("TOPLEFT", frame.background, "TOPRIGHT", -1, 0);
438 frame.shieldhl:SetPoint("BOTTOMRIGHT", frame.background, "BOTTOMRIGHT", 1, 0);
439 frame.shieldhl:SetColorTexture(unpack(shieldhlColor));
440 frame.shieldhl:Hide();
441 frame.healpred = frame:CreateTexture(nil, "ARTWORK");
442 frame.healpred:SetPoint("TOPLEFT", frame.health, "TOPRIGHT");
443 frame.healpred:SetPoint("BOTTOMLEFT", frame.health, "BOTTOMRIGHT");
444 frame.healpred:SetColorTexture(unpack(healpredColor));
445 frame.healpred:Hide();
446 frame.healabsorb = frame:CreateTexture(nil, "ARTWORK");
447 frame.healabsorb:SetPoint("TOPRIGHT", frame.health, "TOPRIGHT");
448 frame.healabsorb:SetPoint("BOTTOMRIGHT", frame.health, "BOTTOMRIGHT");
449 frame.healabsorb:SetColorTexture(unpack(healabsorbColor));
450 frame.healabsorb:Hide();
451 frame.overlay = frame:CreateTexture(nil, "ARTWORK", nil, 1);
452 frame.overlay:SetPoint("TOPLEFT", frame.background, "TOPLEFT");
453 frame.overlay:SetPoint("BOTTOMRIGHT", frame.background, "BOTTOMRIGHT", 0, 2);
454 frame.overlay:Hide();
455 frame.name = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
456 frame.name:SetPoint("CENTER", frame.background, "CENTER", 0, 11);
457 frame.text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
458 frame.text:SetFont(STANDARD_TEXT_FONT, 13);
459 frame.text:SetPoint("CENTER", frame.background, "CENTER", 0, -1);
461 setupIndicators(frame);
463 secure:RegisterForClicks("AnyDown");
464 secure:SetAttribute("type1", "spell"); -- left click
465 secure:SetAttribute("type2", "spell"); -- right click
466 secure:SetAttribute("shift-type1", "spell"); -- shift left click
467 secure:SetAttribute("shift-type2", "spell"); -- shift right click
468 secure:SetAttribute("ctrl-type1", "spell"); -- ctrl left click
469 secure:SetAttribute("alt-type2", "spell"); -- alt right click
470 secure:SetAttribute("alt-shift-type1", "spell"); -- alt+shift left click
471 secure:SetAttribute("alt-shift-type2", "spell"); -- alt+shift right click
472 secure:SetAttribute("spell1", "Holy Light");
473 secure:SetAttribute("spell2", "Bestow Faith");
474 secure:SetAttribute("shift-spell1", "Flash of Light");
475 secure:SetAttribute("shift-spell2", "Light of the Martyr");
476 secure:SetAttribute("ctrl-spell1", "Cleanse");
477 secure:SetAttribute("alt-spell2", "Lay on Hands");
478 secure:SetAttribute("alt-shift-spell1", "Beacon of Light");
479 secure:SetAttribute("alt-shift-spell2", "Beacon of Faith");
480 -- rest give target and menu
481 secure:SetAttribute("*type1", "target");
482 secure:SetAttribute("*type2", "togglemenu");
485 local function initializeParty()
486 local secure = CreateFrame("Button", "OmaPartySecure0", CFrame, "SecureUnitButtonTemplate");
487 local frame = CreateFrame("Frame", "OmaParty0", CFrame);
488 local unit = "player";
489 secure:SetAttribute("unit", unit);
490 secure:SetPoint("TOPLEFT", CFrame, "TOPLEFT");
491 secure:SetHeight(height+2);
493 frame:SetPoint("TOPLEFT", CFrame, "TOPLEFT");
494 frame:SetHeight(height+2);
495 frame:SetScript("OnEvent", unitEvent);
497 setupFrame(frame, secure, unit);
498 RegisterStateDriver(secure, "visibility", "[@player,group:raid] hide; show");
499 party[0] = {secure=secure, frame=frame};
501 local secure = CreateFrame("Button", "OmaPartySecure"..i, CFrame, "SecureUnitButtonTemplate");
502 local frame = CreateFrame("Frame", "OmaParty"..i, CFrame);
503 local unit = "party"..i;
504 secure:SetAttribute("unit", unit);
505 secure:SetPoint("TOPLEFT", party[i-1].secure, "TOPRIGHT");
506 secure:SetPoint("BOTTOMLEFT", party[i-1].secure, "BOTTOMRIGHT");
508 frame:SetPoint("TOPLEFT", party[i-1].frame, "TOPRIGHT");
509 frame:SetPoint("BOTTOMLEFT", party[i-1].frame, "BOTTOMRIGHT");
510 frame:SetScript("OnEvent", unitEvent);
512 setupFrame(frame, secure, unit);
513 RegisterUnitWatch(secure);
514 party[i] = {secure=secure, frame=frame};
518 local function initializeRaid()
519 local secure = CreateFrame("Button", "OmaRaidSecure1", CFrame, "SecureUnitButtonTemplate");
520 local frame = CreateFrame("Frame", "OmaRaid1", CFrame);
521 local unit = "raid1";
522 secure:SetAttribute("unit", unit);
523 secure:SetPoint("TOPLEFT", CFrame, "TOPLEFT");
524 secure:SetHeight(height+2);
526 frame:SetPoint("TOPLEFT", CFrame, "TOPLEFT");
527 frame:SetHeight(height+2);
528 frame:SetScript("OnEvent", unitEvent);
530 setupFrame(frame, secure, unit);
531 RegisterUnitWatch(secure);
532 raid[1] = {secure=secure, frame=frame};
535 local secure = CreateFrame("Button", "OmaRaidSecure"..i, CFrame, "SecureUnitButtonTemplate");
536 local frame = CreateFrame("Frame", "OmaRaid"..i, CFrame);
537 local unit = "raid"..i;
538 secure:SetAttribute("unit", unit);
539 secure:SetPoint("TOPLEFT", raid[i-5].secure, "BOTTOMLEFT");
540 secure:SetHeight(height+2);
542 frame:SetPoint("TOPLEFT", raid[i-5].frame, "BOTTOMLEFT");
543 frame:SetHeight(height+2);
544 frame:SetScript("OnEvent", unitEvent);
546 setupFrame(frame, secure, unit);
547 RegisterUnitWatch(secure);
548 raid[i] = {secure=secure, frame=frame};
553 local secure = CreateFrame("Button", "OmaRaidSecure"..i, CFrame, "SecureUnitButtonTemplate");
554 local frame = CreateFrame("Frame", "OmaRaid"..i, CFrame);
555 local unit = "raid"..i;
556 secure:SetAttribute("unit", unit);
557 secure:SetPoint("TOPLEFT", raid[i-1].secure, "TOPRIGHT");
558 secure:SetPoint("BOTTOMLEFT", raid[i-1].secure, "BOTTOMRIGHT");
560 frame:SetPoint("TOPLEFT", raid[i-1].frame, "TOPRIGHT");
561 frame:SetPoint("BOTTOMLEFT", raid[i-1].frame, "BOTTOMRIGHT");
562 frame:SetScript("OnEvent", unitEvent);
564 setupFrame(frame, secure, unit);
565 RegisterUnitWatch(secure);
566 raid[i] = {secure=secure, frame=frame};
571 local function initialize()
572 CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY);
573 CFrame:SetHeight((height+2)*8);
574 CFrame:SetWidth((width+2)*5+1); -- extra pixel for shield overflow
579 CFrame:RegisterEvent("PLAYER_LOGIN");
580 CFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
581 CFrame:RegisterEvent("GROUP_ROSTER_UPDATE");
582 CFrame:RegisterEvent("PLAYER_REGEN_ENABLED");
583 CFrame:SetScript("OnEvent", function(self, event, ...)
584 if event == "GROUP_ROSTER_UPDATE" or event == "PLAYER_REGEN_ENABLED" or
585 event == "PLAYER_ENTERING_WORLD" then
587 elseif event == "PLAYER_LOGIN" then