Skip to content

Commit

Permalink
Add more BattleGroundGroupJoinStatus and add some implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Jul 13, 2024
1 parent 87bf1ce commit a9c89d6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
32 changes: 31 additions & 1 deletion src/game/BattleGround/BattleGroundHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
return;
// check if has free queue slots
if (!_player->HasFreeBattleGroundQueueId())
{
WorldPacket data;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(data, bgTypeId, BG_GROUP_JOIN_STATUS_TOO_MANY_QUEUES);
_player->GetSession()->SendPacket(data);
return;
}
}
else
{
Expand Down Expand Up @@ -707,7 +712,12 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
return;
// check if has free queue slots
if (!_player->HasFreeBattleGroundQueueId())
{
WorldPacket data;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(data, bgTypeId, BG_GROUP_JOIN_STATUS_TOO_MANY_QUEUES);
_player->GetSession()->SendPacket(data);
return;
}
}
else
{
Expand All @@ -718,7 +728,27 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
uint32 err = group->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, arenatype, arenatype, isRated != 0, arenaslot);
if (err != BG_JOIN_ERR_OK)
{
SendBattleGroundOrArenaJoinError(err);
if (err == BG_JOIN_ERR_MIXED_ARENATEAM)
{
WorldPacket data;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(data, bgTypeId, BG_GROUP_JOIN_STATUS_NOT_IN_TEAM);
_player->GetSession()->SendPacket(data);
}
else if (err == BG_JOIN_ERR_ALL_QUEUES_USED)
{
WorldPacket data;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(data, bgTypeId, BG_GROUP_JOIN_STATUS_TOO_MANY_QUEUES);
_player->GetSession()->SendPacket(data);
}
else if (err == BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE)
{
WorldPacket data;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(data, bgTypeId, BG_GROUP_JOIN_STATUS_CANNOT_QUEUE_FOR_RATED);
_player->GetSession()->SendPacket(data);
}
else
SendBattleGroundOrArenaJoinError(err);

return;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/game/BattleGround/BattleGroundMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,11 @@ void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket& data, Batt
{
case BG_GROUP_JOIN_STATUS_DESERTERS: // You cannot join the battleground yet because you or one of your party members is flagged as a Deserter.
case BG_GROUP_JOIN_STATUS_NOT_ELIGIBLE: // Your group has joined a battleground queue, but you are not eligible
case BG_GROUP_JOIN_STATUS_NOT_IN_TEAM:
case BG_GROUP_JOIN_STATUS_TOO_MANY_QUEUES:
case BG_GROUP_JOIN_STATUS_CANNOT_QUEUE_FOR_RATED:
case BG_GROUP_JOIN_STATUS_QUEUED_FOR_RATED:
case BG_GROUP_JOIN_STATUS_TEAM_LEFT_QUEUE:
data << int32(status);
break;
case BG_GROUP_JOIN_STATUS_SUCCESS: // Your group has joined the queue for [map]
Expand Down
11 changes: 8 additions & 3 deletions src/game/BattleGround/BattleGroundMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,14 @@ enum BattleGroundQueueGroupTypes

enum BattleGroundGroupJoinStatus
{
BG_GROUP_JOIN_STATUS_DESERTERS = -2,
BG_GROUP_JOIN_STATUS_NOT_ELIGIBLE = -1,
BG_GROUP_JOIN_STATUS_SUCCESS = 0,
BG_GROUP_JOIN_STATUS_TEAM_LEFT_QUEUE = -7,
BG_GROUP_JOIN_STATUS_QUEUED_FOR_RATED = -6,
BG_GROUP_JOIN_STATUS_CANNOT_QUEUE_FOR_RATED = -5,
BG_GROUP_JOIN_STATUS_TOO_MANY_QUEUES = -4,
BG_GROUP_JOIN_STATUS_NOT_IN_TEAM = -3,
BG_GROUP_JOIN_STATUS_DESERTERS = -2,
BG_GROUP_JOIN_STATUS_NOT_ELIGIBLE = -1,
BG_GROUP_JOIN_STATUS_SUCCESS = 0,
};

class BattleGround;
Expand Down

0 comments on commit a9c89d6

Please sign in to comment.