Skip to content

Commit 663f68d

Browse files
authored
leaderindicator: Show indicator for other leaders too (#693)
1 parent b0bde13 commit 663f68d

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.luacheckrc

+4-2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ read_globals = {
8383
'GetUnitTotalModifiedMaxHealthPercent',
8484
'HasLFGRestrictions',
8585
'InCombatLockdown',
86+
'IsInInstance',
8687
'IsLoggedIn',
8788
'IsPlayerSpell',
8889
'IsResting',
@@ -107,11 +108,11 @@ read_globals = {
107108
'UnitClassBase',
108109
'UnitExists',
109110
'UnitFactionGroup',
111+
'UnitGUID',
110112
'UnitGetIncomingHeals',
111113
'UnitGetTotalAbsorbs',
112114
'UnitGetTotalHealAbsorbs',
113115
'UnitGroupRolesAssigned',
114-
'UnitGUID',
115116
'UnitHasIncomingResurrection',
116117
'UnitHasVehiclePlayerFrameUI',
117118
'UnitHasVehicleUI',
@@ -127,13 +128,14 @@ read_globals = {
127128
'UnitIsGroupLeader',
128129
'UnitIsMercenary',
129130
'UnitIsOwnerOrControllerOfUnit',
130-
'UnitIsPlayer',
131131
'UnitIsPVP',
132132
'UnitIsPVPFreeForAll',
133+
'UnitIsPlayer',
133134
'UnitIsQuestBoss',
134135
'UnitIsTapDenied',
135136
'UnitIsUnit',
136137
'UnitIsVisible',
138+
'UnitLeadsAnyGroup',
137139
'UnitPhaseReason',
138140
'UnitPlayerControlled',
139141
'UnitPower',

elements/leaderindicator.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ local function Update(self, event)
4848
-- UnitLeadsAnyGroup(unit). Inside the group formed by the dungeon finder UnitIsGroupLeader(unit) will only return
4949
-- true for the instance leader.
5050
local isInLFGInstance = HasLFGRestrictions()
51-
local isLeader = UnitIsGroupLeader(unit)
51+
local isLeader
52+
if(IsInInstance()) then
53+
isLeader = UnitIsGroupLeader(unit)
54+
else
55+
isLeader = UnitLeadsAnyGroup(unit)
56+
end
57+
5258
if(isLeader) then
5359
if(isInLFGInstance) then
5460
element:SetTexture([[Interface\LFGFrame\UI-LFG-ICON-PORTRAITROLES]])
@@ -96,6 +102,7 @@ local function Enable(self)
96102
element.__owner = self
97103
element.ForceUpdate = ForceUpdate
98104

105+
self:RegisterEvent('UNIT_FLAGS', Path)
99106
self:RegisterEvent('PARTY_LEADER_CHANGED', Path, true)
100107
self:RegisterEvent('GROUP_ROSTER_UPDATE', Path, true)
101108

@@ -108,6 +115,7 @@ local function Disable(self)
108115
if(element) then
109116
element:Hide()
110117

118+
self:UnregisterEvent('UNIT_FLAGS', Path)
111119
self:UnregisterEvent('PARTY_LEADER_CHANGED', Path)
112120
self:UnregisterEvent('GROUP_ROSTER_UPDATE', Path)
113121
end

0 commit comments

Comments
 (0)