if frame.unit == "player" then frame:RegisterEvent("PLAYER_ALIVE") end
if frame.unit == "focus" then frame:RegisterEvent("PLAYER_FOCUS_CHANGED") end
if frame.unit == "target" then frame:RegisterEvent("PLAYER_TARGET_CHANGED") end
- if not frame.nonraid then
+ if frame.raid then
frame:RegisterEvent("PLAYER_REGEN_DISABLED");
frame:RegisterEvent("READY_CHECK");
frame:RegisterEvent("READY_CHECK_FINISHED");
if frame.unit == "focus" or frame.unit == "target" then
frame:RegisterUnitEvent("UNIT_TARGETABLE_CHANGED", frame.unit, displayed);
end
- if not frame.nonraid or frame.unit ~= "player" then
+ if frame.raid or frame.unit ~= "player" then
frame:RegisterUnitEvent("UNIT_NAME_UPDATE", frame.unit, displayed);
end
- if not frame.nonraid then
+ if frame.raid then
frame:RegisterUnitEvent("UNIT_THREAT_SITUATION_UPDATE", frame.unit, displayed);
frame:RegisterUnitEvent("READY_CHECK_CONFIRM", frame.unit, displayed);
end
local _, class = UnitClass(unit);
local color = RAID_CLASS_COLORS[class];
- if color then frame.name:SetVertexColor(color.r, color.g, color.b) end
+ if color then
+ if not frame.raid then
+ if UnitIsEnemy("player", unit) then
+ frame.health:SetVertexColor(1, 0, 0);
+ else
+ frame.health:SetVertexColor(color.r, color.g, color.b);
+ end
+ else
+ frame.name:SetVertexColor(color.r, color.g, color.b);
+ end
+ end
end
addon.Events.UpdateName = updateName;
end,
["UNIT_NAME_UPDATE"] = function(frame)
updateName(frame, frame.unit);
- if not frame.nonraid then
+ if frame.raid then
if frame.guid then
guids[frame.guid] = nil;
end
updateRaidMarker(frame, frame.displayed);
end,
["PLAYER_REGEN_DISABLED"] = function(frame)
- if not frame.nonraid then
+ if frame.raid then
-- clear buff status on entering combat, should also use UnitAura to re-fill
frame.tankcd = {};
frame.alert = {};
["UPDATE_ALL_BARS"] = function(frame)
updateVehicle(frame);
updateRaidMarker(frame, frame.displayed);
- if not frame.nonraid or frame.unit ~= "player" then
+ if frame.raid or frame.unit ~= "player" then
updateName(frame, frame.unit);
end
- if not frame.nonraid then
+ if frame.raid then
updateRole(frame, frame.unit);
updateAggro(frame, frame.displayed);
updateReadyCheck(frame, frame.unit);
frame.buff1 = {};
frame.buff2 = {};
addon.SetAuras(frame.unit, frame.guid);
+ else
+ frame.prev = {};
end
end,
};
f.buff1 = {}; -- custom buff indicator 1
f.buff2 = {}; -- custom buff indicator 2
f.incoming = {}; -- incoming ability indicator
+ f.raid = true;
f.rounds = 0;
-- set up periodic updates
updaters[f] = function()
f.unit = "player";
f.displayed = "player";
f.vehicle = "vehicle"
- f.nonraid = true;
f.prev = {};
playerUpdate = function()
f.health:SetPoint("TOPLEFT", f.background, "TOPLEFT");
f.health:SetPoint("BOTTOMLEFT", f.background, "LEFT", 0, -height/8);
f.health:SetTexture(barTexture);
- f.health:SetVertexColor(0.8, 0.8, 0.8);
+ f.health:SetVertexColor(0.7, 0.7, 0.7);
f.health:Hide();
f.mana = f:CreateTexture(nil, "BORDER");
f.mana:SetPoint("TOPLEFT", f.background, "LEFT", 0, -height/8);
f.unit = "pet";
f.displayed = "pet";
f.vehicle = "player"
- f.nonraid = true;
f.prev = {};
petUpdate = function()
f.health:SetPoint("TOPLEFT", f.background, "TOPLEFT");
f.health:SetPoint("BOTTOMLEFT", f.background, "BOTTOMLEFT");
f.health:SetTexture(barTexture);
- f.health:SetVertexColor(0.8, 0.8, 0.8);
+ f.health:SetVertexColor(0.7, 0.7, 0.7);
f.health:Hide();
f.shield = f:CreateTexture(nil, "BORDER");
f.shield:SetPoint("TOPLEFT", f.health, "TOPRIGHT");
local f = CreateFrame("Button", "kehysTarget", parent,
"SecureUnitButtonTemplate,SecureHandlerStateTemplate");
f:Hide();
- f:SetPoint("CENTER", parent, "CENTER", 300, -178);
+ f:SetPoint("CENTER", parent, "CENTER", 290, -178);
f:SetWidth(width);
f:SetHeight(height);
f.barwidth = width - 2; -- 1px padding
f:SetAttribute("displayed", "target");
f.unit = "target";
f.displayed = "target";
- f.nonraid = true;
f.prev = {};
targetUpdate = function()
update(f);
end
f:SetScript("OnEvent", event);
+ f:SetScript("OnHide", function (frame) frame.prev = {} end);
+ f:SetScript("OnShow", function (frame) update(frame) end);
f:RegisterForClicks("AnyDown");
f:SetAttribute("*type1", "target");
f:SetAttribute("*type2", "togglemenu");
f.health:SetPoint("TOPLEFT", f.background, "TOPLEFT");
f.health:SetPoint("BOTTOMLEFT", f.background, "LEFT", 0, -height/8);
f.health:SetTexture(barTexture);
- f.health:SetVertexColor(0.8, 0.8, 0.8);
+ f.health:SetVertexColor(0.7, 0.7, 0.7);
f.health:Hide();
f.mana = f:CreateTexture(nil, "BORDER");
f.mana:SetPoint("TOPLEFT", f.background, "LEFT", 0, -height/8);
local powerColors = {
[Enum.PowerType.Mana] = {0.1, 0.5, 0.9},
[Enum.PowerType.Rage] = {1, 0, 0},
+ [Enum.PowerType.Pain] = {1, 0, 0},
[Enum.PowerType.Focus] = {1, 0.5, 0},
[Enum.PowerType.Energy] = {1, 0.8, 0},
+ [Enum.PowerType.Fury] = {0.8, 0.3, 0.9},
[Enum.PowerType.RunicPower] = {0.8, 0, 0.2},
+ [Enum.PowerType.LunarPower] = {0.3, 0.5, 0.9},
+ [Enum.PowerType.Maelstrom] = {0, 0.5, 1},
+ [Enum.PowerType.Insanity] = {0.4, 0, 0.8},
};
function addon.FrameUpdate(frame)
if not frame.text:IsShown() then frame.text:Show() end
else
frame.text.status = false;
- if not (frame.nonraid and frame.unit == "target") and frame.text:IsShown() then
+ if (frame.raid or frame.unit ~= "target") and frame.text:IsShown() then
frame.text:Hide();
end
end
- if frame.nonraid and frame.unit == "player" then
+ if not frame.raid and frame.unit == "player" then
if InCombatLockdown() then
frame.status:SetTexCoord(0.5, 1, 0, 0.484375);
frame.status:Show();
frame.status:Hide();
end
end
- -- TODO incoming res, maybe just with events?
-- health
local current, hmax = UnitHealth(unit), UnitHealthMax(unit);
if frame.prev.health ~= current or frame.prev.hmax ~= hmax then
- if frame.nonraid and frame.unit == "target" and frame.prev.htext ~= current then
+ if not frame.raid and frame.unit == "target" and not frame.text.status
+ and frame.prev.htext ~= current then
frame.prev.htext = current;
if current > 1000000000 then -- 1.0B
frame.text:SetFormattedText("%.2fB", current / 1000000000);
frame.rounds = 0;
end
end
- if not frame.nonraid then
+ if frame.raid then
-- tank CD marker
if next(frame.tankcd) then
if not frame.defensive:IsShown() then frame.defensive:Show() end