local UnitGetIncomingHeals, UnitGetTotalAbsorbs = UnitGetIncomingHeals, UnitGetTotalAbsorbs;
local UnitThreatSituation, GetThreatStatusColor = UnitThreatSituation, GetThreatStatusColor;
local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
-local UnitHasIncomingResurrection = UnitHasIncomingResurrection;
local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs;
local UnitHasVehicleUI, UnitTargetsVehicleInRaidUI = UnitHasVehicleUI, UnitTargetsVehicleInRaidUI;
local GetReadyCheckTimeLeft, GetReadyCheckStatus = GetReadyCheckTimeLeft, GetReadyCheckStatus;
frame:RegisterUnitEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", frame.unit, displayed);
frame:RegisterUnitEvent("UNIT_THREAT_SITUATION_UPDATE", frame.unit, displayed);
frame:RegisterUnitEvent("UNIT_CONNECTION", frame.unit, displayed);
- frame:RegisterUnitEvent("INCOMING_RESURRECT_CHANGED", frame.unit, displayed);
frame:RegisterUnitEvent("PLAYER_FLAGS_CHANGED", frame.unit, displayed);
frame:RegisterUnitEvent("READY_CHECK_CONFIRM", frame.unit, displayed);
frame:RegisterUnitEvent("UNIT_ENTERED_VEHICLE", frame.unit, displayed);
end
end
-local function updateIncomingRes(frame, unit)
- if UnitHasIncomingResurrection(unit) then frame.rez:Show();
- else frame.rez:Hide(); end
-end
-
local function updateMaxPower(frame, unit)
frame.mana.max = UnitPowerMax(unit);
end
["UNIT_CONNECTION"] = function(frame)
updateText(frame, frame.displayed);
end,
- ["INCOMING_RESURRECT_CHANGED"] = function(frame)
- updateIncomingRes(frame, frame.unit);
- end,
["PARTY_MEMBER_ENABLE"] = function(frame)
-- new power info possibly (FrameXML/CompactUnitFrame.lua)
updateMaxPower(frame, frame.displayed);
updateHealAbsorb(frame, frame.displayed);
updateAggro(frame, frame.displayed);
updateName(frame, frame.displayed);
- updateIncomingRes(frame, frame.unit);
updateReadyCheck(frame, frame.unit);
updateRaidMarker(frame, frame.displayed);
end,
local class = nil;
local party = {};
local raid = {};
+local updaters = {};
local M = {};
OmaRaidFrame = M;
local function unitUpdate(frame)
-- there's no in/out of range event, have to check each frame
-- from FrameXML/CompactUnitFrame.lua
- local inRange, checked = UnitInRange(frame.displayed);
- if checked and not inRange then
- frame:SetAlpha(0.55);
- else
- frame:SetAlpha(1);
+ if frame.updating then
+ local inRange, checked = UnitInRange(frame.displayed);
+ if checked and not inRange then
+ frame:SetAlpha(0.55);
+ else
+ frame:SetAlpha(1);
+ end
+ CTimerAfter(0.20, updaters[frame]);
end
end
local function frameShow(frame)
registerEvents(frame);
registerUnitEvents(frame);
- frame:SetScript("OnUpdate", unitUpdate);
+ frame.updating = true;
+ CTimerAfter(0.20, updaters[frame]);
unitEvent(frame, "UPDATE_ALL_BARS");
end
local function frameHide(frame)
frame:UnregisterAllEvents();
- frame:SetScript("OnUpdate", nil);
+ frame.updating = nil;
end
local function showTooltip(secure)
- GameTooltip_SetDefaultAnchor(GameTooltip, secure);
- GameTooltip:SetUnit(secure:GetAttribute("unit"));
+ -- only show raid frame tooltips out of combat
+ if not InCombatLockdown() then
+ GameTooltip_SetDefaultAnchor(GameTooltip, secure);
+ GameTooltip:SetUnit(secure:GetAttribute("unit"));
+ end
end
local function hideTooltip(secure)
- GameTooltip:FadeOut();
+ if GameTooltip:IsOwned(secure) then GameTooltip:FadeOut() end
end
local function setupFrame(frame, secure, unit)
frame.text:SetFont(STANDARD_TEXT_FONT, 13);
frame.text:SetPoint("CENTER", frame.background, "CENTER", 0, -1);
frame.text:Hide();
- frame.rez = frame:CreateTexture(nil, "OVERLAY");
- frame.rez:SetPoint("TOPLEFT", frame.background, "CENTER", -12, 12);
- frame.rez:SetPoint("BOTTOMRIGHT", frame.background, "CENTER", 12, -12);
- frame.rez:SetTexture("Interface\\RaidFrame\\Raid-Icon-Rez");
- frame.rez:Hide();
frame.ready = frame:CreateTexture(nil, "OVERLAY");
frame.ready:SetPoint("TOPLEFT", frame.background, "BOTTOMLEFT", 0, 14);
frame.ready:SetPoint("BOTTOMRIGHT", frame.background, "BOTTOMLEFT", 14, 0);
frame:SetScript("OnEvent", unitEvent);
secure:SetScript("OnEnter", showTooltip);
secure:SetScript("OnLeave", hideTooltip);
+ -- set up periodic updates
+ updaters[frame] = function() return unitUpdate(frame) end
-- set attributes
secure:RegisterForClicks("AnyDown");
for attr, val in pairs(attributes) do