mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 17:43:47 +00:00
fix(Core/ArenaTeam): Arena team queue protections (#3803)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Opcodes.h"
|
||||
|
||||
void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData)
|
||||
@@ -222,7 +223,7 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recvData)
|
||||
// Disallow leave team while in arena
|
||||
if (arenaTeam->IsFighting())
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAM_INTERNAL);
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAMS_LOCKED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -233,6 +234,21 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
// Player cannot be removed during queues
|
||||
if (BattlegroundQueueTypeId bgQueue = BattlegroundMgr::BGQueueTypeId(BATTLEGROUND_AA, arenaTeam->GetType()))
|
||||
{
|
||||
GroupQueueInfo ginfo;
|
||||
BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueue);
|
||||
if (queue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
|
||||
{
|
||||
if (ginfo.IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAMS_LOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If team consists only of the captain, disband the team
|
||||
if (_player->GetGUID() == arenaTeam->GetCaptain())
|
||||
{
|
||||
@@ -265,6 +281,16 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recvData)
|
||||
if (arenaTeam->GetCaptain() != _player->GetGUID())
|
||||
return;
|
||||
|
||||
// Teams cannot be disbanded during queues
|
||||
if (BattlegroundQueueTypeId bgQueue = BattlegroundMgr::BGQueueTypeId(BATTLEGROUND_AA, arenaTeam->GetType()))
|
||||
{
|
||||
GroupQueueInfo ginfo;
|
||||
BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueue);
|
||||
if (queue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
|
||||
if (ginfo.IsInvitedToBGInstanceGUID)
|
||||
return;
|
||||
}
|
||||
|
||||
// Teams cannot be disbanded during fights
|
||||
if (arenaTeam->IsFighting())
|
||||
return;
|
||||
@@ -316,6 +342,21 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
// Team member cannot be removed during queues
|
||||
if (BattlegroundQueueTypeId bgQueue = BattlegroundMgr::BGQueueTypeId(BATTLEGROUND_AA, arenaTeam->GetType()))
|
||||
{
|
||||
GroupQueueInfo ginfo;
|
||||
BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueue);
|
||||
if (queue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
|
||||
{
|
||||
if (ginfo.IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, "", "", ERR_ARENA_TEAMS_LOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Player cannot be removed during fights
|
||||
if (arenaTeam->IsFighting())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user