-- Events.lua
+-- TODO -- recheck these, pvp functions not added yet
local _;
local unpack = unpack;
local ssub = string.sub;
local min = math.min;
local ceil = math.ceil;
local UnitName, UnitClass, UnitExists = UnitName, UnitClass, UnitExists;
-local UnitDebuff, UnitIsCharmed = UnitDebuff, UnitIsCharmed;
+local UnitDebuff, UnitIsCharmed, UnitIsFriend = UnitDebuff, UnitIsCharmed, UnitIsFriend;
local UnitPower, UnitPowerMax, UnitPowerType = UnitPower, UnitPowerMax, UnitPowerType;
local UnitHealth, UnitHealthMax = UnitHealth, UnitHealthMax;
local UnitGetIncomingHeals, UnitGetTotalAbsorbs = UnitGetIncomingHeals, UnitGetTotalAbsorbs;
end
local function updateAuras(frame, unit)
- if UnitDebuff(unit, 1, "RAID") ~= nil then
+ if UnitIsFriend("player", unit) and UnitDebuff(unit, 1, "RAID") ~= nil then
-- something dispellable
if frame.overlay.color ~= overlayColorDispel then
frame.overlay:SetVertexColor(unpack(overlayColorDispel));
local function updateRole(frame, unit)
local role = UnitGroupRolesAssigned(unit);
if role == "HEALER" or role == "TANK" or role == "DAMAGER" then
- frame.role:SetTexCoord(GetTexCoordsForRole(role));
+ frame.role:SetTexCoord(GetTexCoordsForRoleSmallCircle(role));
frame.role:Show();
else
frame.role:Hide();
end
end
+local function updateLeaderIcon(frame, unit)
+ if UnitIsGroupLeader(frame.unit) then
+ if HasLFGRestrictions() then
+ frame.leader:SetTexture("Interface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES");
+ frame.leader:SetTexCoord(0, 0.296875, 0.015625, 0.3125);
+ else
+ frame.leader:SetTexture("Interface\\GROUPFRAME\\UI-Group-LeaderIcon");
+ frame.leader:SetTexCoord(0, 1, 0, 1);
+ end
+ frame.leader:Show();
+ elseif UnitIsGroupAssistant(frame.unit) then
+ frame.leader:SetTexture("Interface\\GROUPFRAME\\UI-Group-AssistantIcon");
+ frame.leader:SetTexCoord(0, 1, 0, 1);
+ frame.leader:Show();
+ else
+ frame.leader:Hide();
+ end
+end
+
local eventFuncs = {
["UNIT_HEALTH"] = function(frame)
updateHealth(frame, frame.displayed);
["UNIT_FACTION"] = function(frame)
updatePVP(frame, frame.unit);
end,
+ ["PARTY_LEADER_CHANGED"] = function(frame)
+ updateLeaderIcon(frame, frame.unit);
+ end,
["UPDATE_ALL_BARS"] = function(frame)
updateVehicle(frame);
updateMaxHealth(frame, frame.displayed);
updateLevelText(frame, frame.unit);
updateStatus(frame, frame.unit);
updatePVP(frame, frame.unit);
+ updateLeaderIcon(frame, frame.unit);
end,
};
eventFuncs["UNIT_HEALTH_FREQUENT"] = eventFuncs["UNIT_HEALTH"];