Battleground/Arena: Properly check RBAC arena join permission before allowing queue.
Port From (https://github.com/TrinityCore/TrinityCore/commit/a69a061d76fe4e142e84c775230e2fcbd6ddb9d4)
This commit is contained in:
@@ -751,22 +751,17 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDeserter() { return HasAura(26013); }
|
||||
|
||||
public bool CanJoinToBattleground(Battleground bg)
|
||||
{
|
||||
// check Deserter debuff
|
||||
if (HasAura(26013))
|
||||
return false;
|
||||
RBACPermissions perm = RBACPermissions.JoinNormalBg;
|
||||
if (bg.IsArena())
|
||||
perm = RBACPermissions.JoinArenas;
|
||||
else if (bg.IsRandom())
|
||||
perm = RBACPermissions.JoinRandomBg;
|
||||
|
||||
if (bg.IsArena() && !GetSession().HasPermission(RBACPermissions.JoinArenas))
|
||||
return false;
|
||||
|
||||
if (bg.IsRandom() && !GetSession().HasPermission(RBACPermissions.JoinRandomBg))
|
||||
return false;
|
||||
|
||||
if (!GetSession().HasPermission(RBACPermissions.JoinNormalBg))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return GetSession().HasPermission(perm);
|
||||
}
|
||||
|
||||
public void ClearAfkReports() { m_bgData.bgAfkReporter.Clear(); }
|
||||
|
||||
@@ -1825,6 +1825,9 @@ namespace Game.Groups
|
||||
// offline member? don't let join
|
||||
if (!member)
|
||||
return GroupJoinBattlegroundResult.JoinFailed;
|
||||
// rbac permissions
|
||||
if (!member.CanJoinToBattleground(bgOrTemplate))
|
||||
return GroupJoinBattlegroundResult.JoinTimedOut;
|
||||
// don't allow cross-faction join as group
|
||||
if (member.GetTeam() != team)
|
||||
{
|
||||
@@ -1850,7 +1853,7 @@ namespace Game.Groups
|
||||
if ((bgOrTemplate.GetTypeID() == BattlegroundTypeId.RB || bgOrTemplate.GetTypeID() == BattlegroundTypeId.RandomEpic) && member.InBattlegroundQueue(true) && !isInRandomBgQueue)
|
||||
return GroupJoinBattlegroundResult.InNonRandomBg;
|
||||
// check for deserter debuff in case not arena queue
|
||||
if (bgOrTemplate.GetTypeID() != BattlegroundTypeId.AA && !member.CanJoinToBattleground(bgOrTemplate))
|
||||
if (bgOrTemplate.GetTypeID() != BattlegroundTypeId.AA && member.IsDeserter())
|
||||
return GroupJoinBattlegroundResult.Deserters;
|
||||
// check if member can join any more Battleground queues
|
||||
if (!member.HasFreeBattlegroundQueueId())
|
||||
|
||||
@@ -110,14 +110,22 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
// check Deserter debuff
|
||||
// check RBAC permissions
|
||||
if (!GetPlayer().CanJoinToBattleground(bg))
|
||||
{
|
||||
Global.BattlegroundMgr.BuildBattlegroundStatusFailed(out battlefieldStatusFailed, bgQueueTypeId, GetPlayer(), 0, GroupJoinBattlegroundResult.JoinTimedOut);
|
||||
SendPacket(battlefieldStatusFailed);
|
||||
return;
|
||||
}
|
||||
|
||||
// check Deserter debuff
|
||||
if (GetPlayer().IsDeserter())
|
||||
{
|
||||
Global.BattlegroundMgr.BuildBattlegroundStatusFailed(out battlefieldStatusFailed, bgQueueTypeId, GetPlayer(), 0, GroupJoinBattlegroundResult.Deserters);
|
||||
SendPacket(battlefieldStatusFailed);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool isInRandomBgQueue = _player.InBattlegroundQueueForBattlegroundQueueType(Global.BattlegroundMgr.BGQueueTypeId((ushort)BattlegroundTypeId.RB, BattlegroundQueueIdType.Battleground, false, 0))
|
||||
|| _player.InBattlegroundQueueForBattlegroundQueueType(Global.BattlegroundMgr.BGQueueTypeId((ushort)BattlegroundTypeId.RandomEpic, BattlegroundQueueIdType.Battleground, false, 0));
|
||||
if (bgTypeId != BattlegroundTypeId.RB && bgTypeId != BattlegroundTypeId.RandomEpic && isInRandomBgQueue)
|
||||
@@ -308,7 +316,7 @@ namespace Game
|
||||
if (battlefieldPort.AcceptedInvite && bgQueue.GetQueueId().TeamSize == 0)
|
||||
{
|
||||
//if player is trying to enter Battleground(not arena!) and he has deserter debuff, we must just remove him from queue
|
||||
if (!GetPlayer().CanJoinToBattleground(bg))
|
||||
if (!GetPlayer().IsDeserter())
|
||||
{
|
||||
// send bg command result to show nice message
|
||||
BattlefieldStatusFailed battlefieldStatus;
|
||||
@@ -547,6 +555,14 @@ namespace Game
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!GetPlayer().CanJoinToBattleground(bg))
|
||||
{
|
||||
BattlefieldStatusFailed battlefieldStatus;
|
||||
Global.BattlegroundMgr.BuildBattlegroundStatusFailed(out battlefieldStatus, bgQueueTypeId, GetPlayer(), 0, GroupJoinBattlegroundResult.JoinFailed, errorGuid);
|
||||
member.SendPacket(battlefieldStatus);
|
||||
return;
|
||||
}
|
||||
|
||||
// add to queue
|
||||
uint queueSlot = member.AddBattlegroundQueueId(bgQueueTypeId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user