@@ -38,14 +38,14 @@ local SendChatMessage = SendChatMessage
38
38
local StaticPopup_Hide = StaticPopup_Hide
39
39
local StaticPopupSpecial_Hide = StaticPopupSpecial_Hide
40
40
local UninviteUnit = UninviteUnit
41
- local UnitExists = UnitExists
42
41
local UnitGUID = UnitGUID
43
42
local UnitInRaid = UnitInRaid
44
43
local UnitName = UnitName
45
44
local IsInGuild = IsInGuild
46
45
local PlaySound = PlaySound
47
46
local GetNumFactions = GetNumFactions
48
47
local GetFactionInfo = GetFactionInfo
48
+ local UnitIsGroupLeader = UnitIsGroupLeader
49
49
local GetWatchedFactionInfo = GetWatchedFactionInfo
50
50
local ExpandAllFactionHeaders = ExpandAllFactionHeaders
51
51
local SetWatchedFactionIndex = SetWatchedFactionIndex
@@ -58,6 +58,7 @@ local IsFriend = C_FriendList.IsFriend
58
58
59
59
local LE_GAME_ERR_GUILD_NOT_ENOUGH_MONEY = LE_GAME_ERR_GUILD_NOT_ENOUGH_MONEY
60
60
local LE_GAME_ERR_NOT_ENOUGH_MONEY = LE_GAME_ERR_NOT_ENOUGH_MONEY
61
+ local LE_PARTY_CATEGORY_HOME = LE_PARTY_CATEGORY_HOME
61
62
local MAX_PARTY_MEMBERS = MAX_PARTY_MEMBERS
62
63
local UNKNOWN = UNKNOWN
63
64
@@ -218,17 +219,24 @@ end
218
219
function M :DisbandRaidGroup ()
219
220
if InCombatLockdown () then return end -- Prevent user error in combat
220
221
221
- if UnitInRaid (' player' ) then
222
- for i = 1 , GetNumGroupMembers () do
223
- local name , _ , _ , _ , _ , _ , _ , online = GetRaidRosterInfo (i )
224
- if online and name ~= E .myname then
225
- UninviteUnit (name )
222
+ local myIndex = UnitInRaid (' player' )
223
+ if myIndex then
224
+ local _ , myRank = GetRaidRosterInfo (myIndex )
225
+ if myRank == 2 then -- real raid leader
226
+ for i = 1 , GetNumGroupMembers () do
227
+ if i ~= myIndex then -- dont kick yourself
228
+ local name = GetRaidRosterInfo (i )
229
+ if name then
230
+ UninviteUnit (name )
231
+ end
232
+ end
226
233
end
227
234
end
228
- else
235
+ elseif not myIndex and UnitIsGroupLeader ( ' player ' , LE_PARTY_CATEGORY_HOME ) then
229
236
for i = MAX_PARTY_MEMBERS , 1 , - 1 do
230
- if UnitExists (' party' .. i ) then
231
- UninviteUnit (UnitName (' party' .. i ))
237
+ local name = UnitName (' party' .. i )
238
+ if name then
239
+ UninviteUnit (name )
232
240
end
233
241
end
234
242
end
0 commit comments