fix(Core/Arena): Check to see if other members in your arena team are queued or in a r… (#18808)
* Check to see if other members in your arena team are queued or in a rated arena already and, if so, do not allow queue to go through * Accidentally put team party check inside the for loop * some basic logic efficiency changes * minor syntax issue
This commit is contained in:
@@ -41,6 +41,8 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
#include "ArenaTeam.h"
|
||||||
|
#include "ArenaTeamMgr.h"
|
||||||
|
|
||||||
Roll::Roll(ObjectGuid _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
|
Roll::Roll(ObjectGuid _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
|
||||||
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
|
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
|
||||||
@@ -1996,6 +1998,35 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const*
|
|||||||
if (bgTemplate->isArena() && memberscount != MinPlayerCount)
|
if (bgTemplate->isArena() && memberscount != MinPlayerCount)
|
||||||
return ERR_ARENA_TEAM_PARTY_SIZE;
|
return ERR_ARENA_TEAM_PARTY_SIZE;
|
||||||
|
|
||||||
|
//check against other arena team members
|
||||||
|
if (isRated)
|
||||||
|
{
|
||||||
|
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
|
||||||
|
for (auto const& itr : arenaTeam->GetMembers())
|
||||||
|
{
|
||||||
|
Player* teamMember = ObjectAccessor::FindConnectedPlayer(itr.Guid);
|
||||||
|
//are they online and not a member of this current group?
|
||||||
|
if (teamMember && !IsMember(teamMember->GetGUID()))
|
||||||
|
{
|
||||||
|
//are they already in queue for a rated arena?
|
||||||
|
if (teamMember->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeId))
|
||||||
|
{
|
||||||
|
GroupQueueInfo ginfo;
|
||||||
|
BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||||
|
if (queue.GetPlayerGroupInfoData(teamMember->GetGUID(), &ginfo))
|
||||||
|
{
|
||||||
|
if (ginfo.IsRated)
|
||||||
|
return ERR_BATTLEGROUND_JOIN_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//are they currently in an arena match?
|
||||||
|
Battleground* bg = teamMember->GetBattleground(false);
|
||||||
|
if (bg && bg->isRated() && bg->GetMinPlayersPerTeam() == MinPlayerCount)
|
||||||
|
return ERR_BATTLEGROUND_JOIN_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return GroupJoinBattlegroundResult(bgTemplate->GetBgTypeID());
|
return GroupJoinBattlegroundResult(bgTemplate->GetBgTypeID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user