mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7269] Use enum type for battleground queue type ids, and related cleanups.
* renamed a variable to make the content of it more clear: type->arenaslot * renamed BattleGroundQueueTypeId-variables to bgQueueTypeId just to make it easier reading the code (cause there existed 3 different names for this..) * renamed GetBattleGroundQueueId to GetBattleGroundQueueTypeId again this is just for better understanding * Renamed [GS]etQueueType and m_Queue_type * Renamed to [GS]etQueueId and m_QueueId Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
109813be29
commit
b75157946c
11 changed files with 90 additions and 87 deletions
|
|
@ -39,7 +39,7 @@ BattleGround::BattleGround()
|
|||
m_Status = 0;
|
||||
m_EndTime = 0;
|
||||
m_LastResurrectTime = 0;
|
||||
m_Queue_type = MAX_BATTLEGROUND_QUEUES;
|
||||
m_QueueId = MAX_BATTLEGROUND_QUEUES;
|
||||
m_InvitedAlliance = 0;
|
||||
m_InvitedHorde = 0;
|
||||
m_ArenaType = 0;
|
||||
|
|
@ -554,7 +554,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
sBattleGroundMgr.BuildPvpLogDataPacket(&data, this);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetTeam(), plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime());
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
|
||||
|
|
@ -771,7 +771,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
if(!team) team = plr->GetTeam();
|
||||
|
||||
BattleGroundTypeId bgTypeId = GetTypeID();
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
// if arena, remove the specific arena auras
|
||||
if(isArena())
|
||||
{
|
||||
|
|
@ -822,8 +822,8 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
|
||||
DecreaseInvitedCount(team);
|
||||
//we should update battleground queue, but only if bg isn't ending
|
||||
if (GetQueueType() < MAX_BATTLEGROUND_QUEUES)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueType());
|
||||
if (GetQueueId() < MAX_BATTLEGROUND_QUEUES)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueId());
|
||||
|
||||
Group * group = plr->GetGroup();
|
||||
// remove from raid group if exist
|
||||
|
|
@ -869,7 +869,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
// this method is called when no players remains in battleground
|
||||
void BattleGround::Reset()
|
||||
{
|
||||
SetQueueType(MAX_BATTLEGROUND_QUEUES);
|
||||
SetQueueId(MAX_BATTLEGROUND_QUEUES);
|
||||
SetWinner(WINNER_NONE);
|
||||
SetStatus(STATUS_WAIT_QUEUE);
|
||||
SetStartTime(0);
|
||||
|
|
@ -1513,7 +1513,7 @@ void BattleGround::PlayerRelogin(Player* plr)
|
|||
return;
|
||||
|
||||
WorldPacket data;
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
|
||||
BlockMovement(plr);
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ struct BattleGroundObjectInfo
|
|||
// handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time
|
||||
enum BattleGroundQueueTypeId
|
||||
{
|
||||
BATTLEGROUND_QUEUE_NONE = 0,
|
||||
BATTLEGROUND_QUEUE_AV = 1,
|
||||
BATTLEGROUND_QUEUE_WS = 2,
|
||||
BATTLEGROUND_QUEUE_AB = 3,
|
||||
|
|
@ -256,7 +257,7 @@ class BattleGround
|
|||
// Get methods:
|
||||
char const* GetName() const { return m_Name; }
|
||||
BattleGroundTypeId GetTypeID() const { return m_TypeID; }
|
||||
uint32 GetQueueType() const { return m_Queue_type; }
|
||||
uint32 GetQueueId() const { return m_QueueId; }
|
||||
uint32 GetInstanceID() const { return m_InstanceID; }
|
||||
uint32 GetStatus() const { return m_Status; }
|
||||
uint32 GetStartTime() const { return m_StartTime; }
|
||||
|
|
@ -279,7 +280,7 @@ class BattleGround
|
|||
// Set methods:
|
||||
void SetName(char const* Name) { m_Name = Name; }
|
||||
void SetTypeID(BattleGroundTypeId TypeID) { m_TypeID = TypeID; }
|
||||
void SetQueueType(uint32 ID) { m_Queue_type = ID; }
|
||||
void SetQueueId(uint32 ID) { m_QueueId = ID; }
|
||||
void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; }
|
||||
void SetStatus(uint32 Status) { m_Status = Status; }
|
||||
void SetStartTime(uint32 Time) { m_StartTime = Time; }
|
||||
|
|
@ -471,7 +472,7 @@ class BattleGround
|
|||
uint32 m_StartTime;
|
||||
uint32 m_EndTime;
|
||||
uint32 m_LastResurrectTime;
|
||||
uint32 m_Queue_type;
|
||||
uint32 m_QueueId;
|
||||
uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
|
||||
bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattleGroundMgr.BGFreeSlotQueue[bgTypeId] deque
|
||||
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from: " I64FMT, guid);
|
||||
|
||||
// can do this, since it's battleground, not arena
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0);
|
||||
|
||||
// ignore if player is already in BG
|
||||
if(_player->InBattleGround())
|
||||
|
|
@ -312,12 +312,12 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
// update all queues, send invitation info if player is invited, queue info if queued
|
||||
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
uint32 queue_id = _player->GetBattleGroundQueueId(i);
|
||||
if(!queue_id)
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
if(!bgQueueTypeId)
|
||||
continue;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = sBattleGroundMgr.m_BattleGroundQueues[queue_id].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].find(_player->GetGUID());
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].find(_player->GetGUID());
|
||||
// if the player is not in queue, contine
|
||||
if(itrPlayerStatus == sBattleGroundMgr.m_BattleGroundQueues[queue_id].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].end())
|
||||
if(itrPlayerStatus == sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].end())
|
||||
continue;
|
||||
|
||||
// no group information, this should never happen
|
||||
|
|
@ -365,7 +365,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
|
||||
BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_);
|
||||
|
||||
uint32 bgQueueTypeId = 0;
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
|
||||
// get the bg what we were invited to
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus;
|
||||
bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId,type);
|
||||
|
|
@ -529,7 +529,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(bg)
|
||||
{
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
if((bg->GetStatus() <= STATUS_IN_PROGRESS))
|
||||
{
|
||||
|
|
@ -538,20 +538,20 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
}
|
||||
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
uint32 queue_id = _player->GetBattleGroundQueueId(i); // battlegroundqueueid stores the type id, not the instance id, so this is definitely wrong
|
||||
uint8 arenatype = BattleGroundMgr::BGArenaType(queue_id);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
uint8 arenatype = BattleGroundMgr::BGArenaType(bgQueueTypeId);
|
||||
uint8 isRated = 0;
|
||||
if (i == queueSlot || !queue_id) // we need to get the instance ids
|
||||
if (i == queueSlot || !bgQueueTypeId)
|
||||
continue;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = sBattleGroundMgr.m_BattleGroundQueues[queue_id].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].find(_player->GetGUID());
|
||||
if(itrPlayerStatus == sBattleGroundMgr.m_BattleGroundQueues[queue_id].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].end())
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].find(_player->GetGUID());
|
||||
if(itrPlayerStatus == sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].end())
|
||||
continue;
|
||||
if(itrPlayerStatus->second.GroupInfo)
|
||||
{
|
||||
arenatype = itrPlayerStatus->second.GroupInfo->ArenaType;
|
||||
isRated = itrPlayerStatus->second.GroupInfo->IsRated;
|
||||
}
|
||||
BattleGround *bg2 = sBattleGroundMgr.GetBattleGroundTemplate(BattleGroundMgr::BGTemplateId(queue_id)); // try this
|
||||
BattleGround *bg2 = sBattleGroundMgr.GetBattleGroundTemplate(BattleGroundMgr::BGTemplateId(bgQueueTypeId));
|
||||
if(bg2)
|
||||
{
|
||||
//in this call is small bug, this call should be filled by player's waiting time in queue
|
||||
|
|
@ -567,22 +567,22 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
// we should update all queues? .. i'm not sure if this code is correct
|
||||
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
uint32 queue_id = _player->GetBattleGroundQueueId(i);
|
||||
if(!queue_id)
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
if(!bgQueueTypeId)
|
||||
continue;
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(queue_id);
|
||||
uint8 arenatype = BattleGroundMgr::BGArenaType(queue_id);
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
||||
uint8 arenatype = BattleGroundMgr::BGArenaType(bgQueueTypeId);
|
||||
uint8 isRated = 0;
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = sBattleGroundMgr.m_BattleGroundQueues[queue_id].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].find(_player->GetGUID());
|
||||
if(itrPlayerStatus == sBattleGroundMgr.m_BattleGroundQueues[queue_id].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].end())
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].find(_player->GetGUID());
|
||||
if(itrPlayerStatus == sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers[_player->GetBattleGroundQueueIdFromLevel()].end())
|
||||
continue;
|
||||
if(itrPlayerStatus->second.GroupInfo)
|
||||
{
|
||||
arenatype = itrPlayerStatus->second.GroupInfo->ArenaType;
|
||||
isRated = itrPlayerStatus->second.GroupInfo->IsRated;
|
||||
}
|
||||
if(bg && queue_id)
|
||||
if(bg)
|
||||
{
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, _player->GetTeam(), i, STATUS_WAIT_QUEUE, 0, 0, arenatype, isRated);
|
||||
SendPacket(&data);
|
||||
|
|
@ -657,12 +657,12 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
return;
|
||||
|
||||
uint64 guid; // arena Battlemaster guid
|
||||
uint8 type; // 2v2, 3v3 or 5v5
|
||||
uint8 arenaslot; // 2v2, 3v3 or 5v5
|
||||
uint8 asGroup; // asGroup
|
||||
uint8 isRated; // isRated
|
||||
Group * grp;
|
||||
|
||||
recv_data >> guid >> type >> asGroup >> isRated;
|
||||
recv_data >> guid >> arenaslot >> asGroup >> isRated;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
|
|
@ -674,7 +674,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
uint8 arenatype = 0;
|
||||
uint32 arenaRating = 0;
|
||||
|
||||
switch(type)
|
||||
switch(arenaslot)
|
||||
{
|
||||
case 0:
|
||||
arenatype = ARENA_TYPE_2v2;
|
||||
|
|
@ -686,7 +686,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
arenatype = ARENA_TYPE_5v5;
|
||||
break;
|
||||
default:
|
||||
sLog.outError("Unknown arena type %u at HandleBattleGroundArenaJoin()", type);
|
||||
sLog.outError("Unknown arena slot %u at HandleBattleGroundArenaJoin()", arenaslot);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -699,7 +699,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
BattleGroundTypeId bgTypeId = bg->GetTypeID();
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||
|
||||
// check queueing conditions
|
||||
if(!asGroup)
|
||||
|
|
@ -718,7 +718,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
// no group found, error
|
||||
if(!grp)
|
||||
return;
|
||||
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, arenatype, arenatype, (bool)isRated, type);
|
||||
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
|
||||
if (err != BG_JOIN_ERR_OK)
|
||||
{
|
||||
SendBattleGroundOrArenaJoinError(err);
|
||||
|
|
@ -730,7 +730,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
|
||||
if(isRated)
|
||||
{
|
||||
ateamId = _player->GetArenaTeamId(type);
|
||||
ateamId = _player->GetArenaTeamId(arenaslot);
|
||||
// check real arenateam existence only here (if it was moved to group->CanJoin .. () then we would ahve to get it twice)
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(ateamId);
|
||||
if(!at)
|
||||
|
|
@ -748,7 +748,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
Player *member = itr->getSource();
|
||||
|
||||
// calc avg personal rating
|
||||
avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (type*6) + 5);
|
||||
avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot*6) + 5);
|
||||
}
|
||||
|
||||
if( arenatype )
|
||||
|
|
@ -764,7 +764,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, arenatype, isRated, arenaRating, ateamId);
|
||||
sLog.outDebug("Battleground: arena join as group start");
|
||||
if(isRated)
|
||||
sLog.outDebug("Battleground: arena team id %u, leader %s queued with rating %u for type %u",_player->GetArenaTeamId(type),_player->GetName(),arenaRating,arenatype);
|
||||
sLog.outDebug("Battleground: arena team id %u, leader %s queued with rating %u for type %u",_player->GetArenaTeamId(arenaslot),_player->GetName(),arenaRating,arenatype);
|
||||
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player *member = itr->getSource();
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
|||
if(Player *plr2 = objmgr.GetPlayer(group->Players.begin()->first))
|
||||
{
|
||||
BattleGround * bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId);
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId,group->ArenaType);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId,group->ArenaType);
|
||||
uint32 queueSlot = plr2->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
plr2->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs
|
||||
WorldPacket data;
|
||||
|
|
@ -455,7 +455,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
|||
// not yet invited
|
||||
// set invitation
|
||||
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
// loop through the players
|
||||
for(std::map<uint64,PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
||||
{
|
||||
|
|
@ -547,9 +547,9 @@ bool BattleGroundQueue::BuildSelectionPool(BattleGroundTypeId bgTypeId, uint32 q
|
|||
// (this can happen in arenas mainly, since the preparation is shorter than the timer for the bgqueueremove event
|
||||
void BattleGroundQueue::BGEndedRemoveInvites(BattleGround *bg)
|
||||
{
|
||||
uint32 queue_id = bg->GetQueueType();
|
||||
uint32 queue_id = bg->GetQueueId();
|
||||
uint32 bgInstanceId = bg->GetInstanceID();
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
QueuedGroupsList::iterator itr, next;
|
||||
for(itr = m_QueuedGroups[queue_id].begin(); itr != m_QueuedGroups[queue_id].end(); itr = next)
|
||||
{
|
||||
|
|
@ -590,7 +590,7 @@ void BattleGroundQueue::BGEndedRemoveInvites(BattleGround *bg)
|
|||
RemovePlayer(itr2->first, true);
|
||||
// this is probably unneeded, since this player was already invited -> does not fit when initing eligible groups
|
||||
// but updateing the queue can't hurt
|
||||
Update(bg->GetTypeID(), bg->GetQueueType());
|
||||
Update(bg->GetTypeID(), bg->GetQueueId());
|
||||
// send info to client
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, team, queueSlot, STATUS_NONE, 0, 0);
|
||||
|
|
@ -619,7 +619,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uin
|
|||
if (m_QueuedGroups[queue_id].empty())
|
||||
return;
|
||||
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||
|
||||
//battleground with free slot for player should be always the last in this queue
|
||||
BGFreeSlotQueueType::iterator itr, next;
|
||||
|
|
@ -629,7 +629,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uin
|
|||
++next;
|
||||
// battleground is running, so if:
|
||||
// DO NOT allow queue manager to invite new player to running arena
|
||||
if ((*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetQueueType() == queue_id && (*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE)
|
||||
if ((*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetQueueId() == queue_id && (*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE)
|
||||
{
|
||||
//we must check both teams
|
||||
BattleGround* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
|
||||
|
|
@ -797,7 +797,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uin
|
|||
|
||||
// start the joining of the bg
|
||||
bg2->SetStatus(STATUS_WAIT_JOIN);
|
||||
bg2->SetQueueType(queue_id);
|
||||
bg2->SetQueueId(queue_id);
|
||||
// initialize arena / rating info
|
||||
bg2->SetArenaType(arenatype);
|
||||
// set rating
|
||||
|
|
@ -950,7 +950,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uin
|
|||
|
||||
// start the joining of the bg
|
||||
bg2->SetStatus(STATUS_WAIT_JOIN);
|
||||
bg2->SetQueueType(queue_id);
|
||||
bg2->SetQueueId(queue_id);
|
||||
// initialize arena / rating info
|
||||
bg2->SetArenaType(arenatype);
|
||||
|
||||
|
|
@ -1002,7 +1002,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
if (!bg)
|
||||
return true;
|
||||
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
|
||||
{
|
||||
|
|
@ -1038,7 +1038,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
|
||||
sLog.outDebug("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID);
|
||||
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
|
||||
{
|
||||
|
|
@ -1058,7 +1058,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
}
|
||||
plr->RemoveBattleGroundQueueId(bgQueueTypeId);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(m_PlayerGuid, true);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bg->GetTypeID(),bg->GetQueueType());
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bg->GetTypeID(),bg->GetQueueId());
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, m_PlayersTeam, queueSlot, STATUS_NONE, 0, 0);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
|
|
@ -1838,7 +1838,7 @@ bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId)
|
|||
bgTypeId == BATTLEGROUND_RL );
|
||||
}
|
||||
|
||||
uint32 BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType)
|
||||
BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType)
|
||||
{
|
||||
switch(bgTypeId)
|
||||
{
|
||||
|
|
@ -1867,14 +1867,14 @@ uint32 BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaTy
|
|||
case ARENA_TYPE_5v5:
|
||||
return BATTLEGROUND_QUEUE_5v5;
|
||||
default:
|
||||
return 0;
|
||||
return BATTLEGROUND_QUEUE_NONE;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
return BATTLEGROUND_QUEUE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
BattleGroundTypeId BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId)
|
||||
BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId)
|
||||
{
|
||||
switch(bgQueueTypeId)
|
||||
{
|
||||
|
|
@ -1897,7 +1897,7 @@ BattleGroundTypeId BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId)
|
|||
}
|
||||
}
|
||||
|
||||
uint8 BattleGroundMgr::BGArenaType(uint32 bgQueueTypeId)
|
||||
uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId)
|
||||
{
|
||||
switch(bgQueueTypeId)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -240,9 +240,9 @@ class BattleGroundMgr
|
|||
|
||||
static bool IsArenaType(BattleGroundTypeId bgTypeId);
|
||||
static bool IsBattleGroundType(BattleGroundTypeId bgTypeId) { return !BattleGroundMgr::IsArenaType(bgTypeId); }
|
||||
static uint32 BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType);
|
||||
static BattleGroundTypeId BGTemplateId(uint32 bgQueueTypeId);
|
||||
static uint8 BGArenaType(uint32 bgQueueTypeId);
|
||||
static BattleGroundQueueTypeId BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType);
|
||||
static BattleGroundTypeId BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId);
|
||||
static uint8 BGArenaType(BattleGroundQueueTypeId bgQueueTypeId);
|
||||
private:
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
|
||||
|
|
|
|||
|
|
@ -1329,7 +1329,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
|||
SendUpdate();
|
||||
}
|
||||
|
||||
uint32 Group::CanJoinBattleGroundQueue(BattleGroundTypeId bgTypeId, uint32 bgQueueType, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot)
|
||||
uint32 Group::CanJoinBattleGroundQueue(BattleGroundTypeId bgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot)
|
||||
{
|
||||
// check for min / max count
|
||||
uint32 memberscount = GetMembersCount();
|
||||
|
|
@ -1365,7 +1365,7 @@ uint32 Group::CanJoinBattleGroundQueue(BattleGroundTypeId bgTypeId, uint32 bgQue
|
|||
if(isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
|
||||
return BG_JOIN_ERR_MIXED_ARENATEAM;
|
||||
// don't let join if someone from the group is already in that bg queue
|
||||
if(member->InBattleGroundQueueForBattleGroundQueueType(bgQueueType))
|
||||
if(member->InBattleGroundQueueForBattleGroundQueueType(bgQueueTypeId))
|
||||
return BG_JOIN_ERR_GROUP_MEMBER_ALREADY_IN_QUEUE;
|
||||
// check for deserter debuff in case not arena queue
|
||||
if(bgTypeId != BATTLEGROUND_AA && !member->CanJoinToBattleground())
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "GroupReference.h"
|
||||
#include "GroupRefManager.h"
|
||||
#include "BattleGround.h"
|
||||
#include "LootMgr.h"
|
||||
|
||||
#include <map>
|
||||
|
|
@ -248,7 +249,7 @@ class MANGOS_DLL_SPEC Group
|
|||
void ConvertToRaid();
|
||||
|
||||
void SetBattlegroundGroup(BattleGround *bg) { m_bgGroup = bg; }
|
||||
uint32 CanJoinBattleGroundQueue(BattleGroundTypeId bgTypeId, uint32 bgQueueType, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
|
||||
uint32 CanJoinBattleGroundQueue(BattleGroundTypeId bgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
|
||||
|
||||
void ChangeMembersGroup(const uint64 &guid, const uint8 &group);
|
||||
void ChangeMembersGroup(Player *player, const uint8 &group);
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this)
|
|||
m_bgBattleGroundID = 0;
|
||||
for (int j=0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; j++)
|
||||
{
|
||||
m_bgBattleGroundQueueID[j].bgQueueType = 0;
|
||||
m_bgBattleGroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
|
||||
m_bgBattleGroundQueueID[j].invitedToInstance = 0;
|
||||
}
|
||||
m_bgTeam = 0;
|
||||
|
|
@ -14180,7 +14180,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
|
||||
if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID()))
|
||||
{
|
||||
uint32 bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
|
||||
BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
|
||||
uint32 queueSlot = AddBattleGroundQueueId(bgQueueTypeId);
|
||||
|
||||
SetBattleGroundId(currentBg->GetInstanceID());
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "MapReference.h"
|
||||
#include "Util.h" // for Tokens typedef
|
||||
#include "AchievementMgr.h"
|
||||
#include "BattleGround.h"
|
||||
|
||||
#include<string>
|
||||
#include<vector>
|
||||
|
|
@ -1872,39 +1873,39 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
bool InBattleGroundQueue() const
|
||||
{
|
||||
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueType != 0)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_NONE)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 GetBattleGroundQueueId(uint32 index) const { return m_bgBattleGroundQueueID[index].bgQueueType; }
|
||||
uint32 GetBattleGroundQueueIndex(uint32 bgQueueType) const
|
||||
BattleGroundQueueTypeId GetBattleGroundQueueTypeId(uint32 index) const { return m_bgBattleGroundQueueID[index].bgQueueTypeId; }
|
||||
uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const
|
||||
{
|
||||
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueType == bgQueueType)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
|
||||
return i;
|
||||
return PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
bool IsInvitedForBattleGroundQueueType(uint32 bgQueueType) const
|
||||
bool IsInvitedForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const
|
||||
{
|
||||
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueType == bgQueueType)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
|
||||
return m_bgBattleGroundQueueID[i].invitedToInstance != 0;
|
||||
return PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
bool InBattleGroundQueueForBattleGroundQueueType(uint32 bgQueueType) const
|
||||
bool InBattleGroundQueueForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const
|
||||
{
|
||||
return GetBattleGroundQueueIndex(bgQueueType) < PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
return GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
|
||||
void SetBattleGroundId(uint32 val) { m_bgBattleGroundID = val; }
|
||||
uint32 AddBattleGroundQueueId(uint32 val)
|
||||
uint32 AddBattleGroundQueueId(BattleGroundQueueTypeId val)
|
||||
{
|
||||
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueType == 0 || m_bgBattleGroundQueueID[i].bgQueueType == val)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE || m_bgBattleGroundQueueID[i].bgQueueTypeId == val)
|
||||
{
|
||||
m_bgBattleGroundQueueID[i].bgQueueType = val;
|
||||
m_bgBattleGroundQueueID[i].bgQueueTypeId = val;
|
||||
m_bgBattleGroundQueueID[i].invitedToInstance = 0;
|
||||
return i;
|
||||
}
|
||||
|
|
@ -1914,26 +1915,26 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
bool HasFreeBattleGroundQueueId()
|
||||
{
|
||||
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueType == 0)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
void RemoveBattleGroundQueueId(uint32 val)
|
||||
void RemoveBattleGroundQueueId(BattleGroundQueueTypeId val)
|
||||
{
|
||||
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueType == val)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == val)
|
||||
{
|
||||
m_bgBattleGroundQueueID[i].bgQueueType = 0;
|
||||
m_bgBattleGroundQueueID[i].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
|
||||
m_bgBattleGroundQueueID[i].invitedToInstance = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
void SetInviteForBattleGroundQueueType(uint32 bgQueueType, uint32 instanceId)
|
||||
void SetInviteForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId, uint32 instanceId)
|
||||
{
|
||||
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueType == bgQueueType)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
|
||||
m_bgBattleGroundQueueID[i].invitedToInstance = instanceId;
|
||||
}
|
||||
bool IsInvitedForBattleGroundInstance(uint32 instanceId) const
|
||||
|
|
@ -2150,7 +2151,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
*/
|
||||
struct BgBattleGroundQueueID_Rec
|
||||
{
|
||||
uint32 bgQueueType;
|
||||
BattleGroundQueueTypeId bgQueueTypeId;
|
||||
uint32 invitedToInstance;
|
||||
};
|
||||
BgBattleGroundQueueID_Rec m_bgBattleGroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES];
|
||||
|
|
|
|||
|
|
@ -309,10 +309,10 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
|
||||
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
if(int32 bgTypeId = _player->GetBattleGroundQueueId(i))
|
||||
if(BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i))
|
||||
{
|
||||
_player->RemoveBattleGroundQueueId(bgTypeId);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[ bgTypeId ].RemovePlayer(_player->GetGUID(), true);
|
||||
_player->RemoveBattleGroundQueueId(bgQueueTypeId);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[ bgQueueTypeId ].RemovePlayer(_player->GetGUID(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7268"
|
||||
#define REVISION_NR "7269"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue