mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Merge branch 'master' into 310
Conflicts: src/game/BattleGroundHandler.cpp src/game/Unit.cpp
This commit is contained in:
commit
769a24252b
22 changed files with 795 additions and 774 deletions
|
|
@ -41,7 +41,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
|
|||
sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from: " I64FMT, guid);
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isBattleMaster()) // it's not battlemaster
|
||||
|
|
@ -52,7 +52,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
|
|||
|
||||
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(unit->GetEntry());
|
||||
|
||||
if(!_player->GetBGAccessByLevel(bgTypeId))
|
||||
if (!_player->GetBGAccessByLevel(bgTypeId))
|
||||
{
|
||||
// temp, must be gossip message...
|
||||
SendNotification(LANG_YOUR_BG_LEVEL_REQ_ERROR);
|
||||
|
|
@ -85,7 +85,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
recv_data >> instanceId; // instance id, 0 if First Available selected
|
||||
recv_data >> joinAsGroup; // join as group
|
||||
|
||||
if(!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u",bgTypeId_,_player->GetGUIDLow());
|
||||
return;
|
||||
|
|
@ -99,25 +99,25 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0);
|
||||
|
||||
// ignore if player is already in BG
|
||||
if(_player->InBattleGround())
|
||||
if (_player->InBattleGround())
|
||||
return;
|
||||
|
||||
// get bg instance or bg template if instance not found
|
||||
BattleGround * bg = NULL;
|
||||
if(instanceId)
|
||||
if (instanceId)
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
|
||||
if(!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
|
||||
if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
|
||||
{
|
||||
sLog.outError("Battleground: no available bg / template found");
|
||||
return;
|
||||
}
|
||||
|
||||
// check queueing conditions
|
||||
if(!joinAsGroup)
|
||||
if (!joinAsGroup)
|
||||
{
|
||||
// check Deserter debuff
|
||||
if( !_player->CanJoinToBattleground() )
|
||||
if (!_player->CanJoinToBattleground())
|
||||
{
|
||||
WorldPacket data(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
|
||||
data << uint32(0xFFFFFFFE);
|
||||
|
|
@ -129,14 +129,14 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
//player is already in this queue
|
||||
return;
|
||||
// check if has free queue slots
|
||||
if(!_player->HasFreeBattleGroundQueueId())
|
||||
if (!_player->HasFreeBattleGroundQueueId())
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
grp = _player->GetGroup();
|
||||
// no group found, error
|
||||
if(!grp)
|
||||
if (!grp)
|
||||
return;
|
||||
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
||||
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
|
||||
|
|
@ -151,7 +151,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
// _player->GetGroup() was already checked, grp is already initialized
|
||||
GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, 0, false, isPremade, 0);
|
||||
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
if(joinAsGroup /* && _player->GetGroup()*/)
|
||||
if (joinAsGroup /* && _player->GetGroup()*/)
|
||||
{
|
||||
sLog.outDebug("Battleground: the following players are joining as group:");
|
||||
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
|
|
@ -191,7 +191,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName());
|
||||
}
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
if(!ginfo->IsInvitedToBGInstanceGUID)
|
||||
if (!ginfo->IsInvitedToBGInstanceGUID)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true);
|
||||
}
|
||||
|
||||
|
|
@ -212,11 +212,11 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
|
|||
uint32 count2 = 0; //count of next fields
|
||||
|
||||
Player *ali_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID());
|
||||
if( ali_plr )
|
||||
if (ali_plr)
|
||||
++count2;
|
||||
|
||||
Player *horde_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID());
|
||||
if( horde_plr )
|
||||
if (horde_plr)
|
||||
++count2;
|
||||
|
||||
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2));
|
||||
|
|
@ -228,13 +228,13 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
|
|||
data << (float)0; // y
|
||||
}*/
|
||||
data << count2; // horde flag holders count - obsolete, now count of next fields
|
||||
if( ali_plr )
|
||||
if (ali_plr)
|
||||
{
|
||||
data << (uint64)ali_plr->GetGUID();
|
||||
data << (float)ali_plr->GetPositionX();
|
||||
data << (float)ali_plr->GetPositionY();
|
||||
}
|
||||
if( horde_plr )
|
||||
if (horde_plr)
|
||||
{
|
||||
data << (uint64)horde_plr->GetGUID();
|
||||
data << (float)horde_plr->GetPositionX();
|
||||
|
|
@ -268,7 +268,7 @@ void WorldSession::HandleBattleGroundPVPlogdataOpcode( WorldPacket & /*recv_data
|
|||
sLog.outDebug( "WORLD: Recvd MSG_PVP_LOG_DATA Message");
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
WorldPacket data;
|
||||
|
|
@ -291,7 +291,7 @@ void WorldSession::HandleBattleGroundListOpcode( WorldPacket &recv_data )
|
|||
recv_data >> fromWhere; // 0 - battlemaster, 1 - UI
|
||||
|
||||
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
if(!bl)
|
||||
if (!bl)
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype received.");
|
||||
return;
|
||||
|
|
@ -317,25 +317,25 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
|
||||
recv_data >> type >> unk2 >> bgTypeId_ >> unk >> action;
|
||||
|
||||
if( !sBattlemasterListStore.LookupEntry(bgTypeId_) )
|
||||
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype (%u) received.", bgTypeId_);
|
||||
// update battleground slots for the player to fix his UI and sent data.
|
||||
// this is a HACK, I don't know why the client starts sending invalid packets in the first place.
|
||||
// it usually happens with extremely high latency (if debugging / stepping in the code for example)
|
||||
if( _player->InBattleGroundQueue() )
|
||||
if (_player->InBattleGroundQueue())
|
||||
{
|
||||
// update all queues, send invitation info if player is invited, queue info if queued
|
||||
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
if( !bgQueueTypeId )
|
||||
if (!bgQueueTypeId)
|
||||
continue;
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
||||
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
|
||||
// if the player is not in queue, continue or no group information - this should never happen
|
||||
if( itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo )
|
||||
if (itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo)
|
||||
continue;
|
||||
|
||||
BattleGround * bg = NULL;
|
||||
|
|
@ -344,7 +344,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
uint8 israted = itrPlayerStatus->second.GroupInfo->IsRated;
|
||||
uint8 status = 0;
|
||||
|
||||
if( !itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID )
|
||||
if (!itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
// not invited to bg, get template
|
||||
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
|
|
@ -358,7 +358,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
}
|
||||
|
||||
// if bg not found, then continue, don't invite if already in the instance
|
||||
if( !bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID()) )
|
||||
if (!bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID()))
|
||||
continue;
|
||||
|
||||
// re - invite player with proper data
|
||||
|
|
@ -375,7 +375,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, type);
|
||||
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
|
||||
if( itrPlayerStatus == qpMap.end() )
|
||||
if (itrPlayerStatus == qpMap.end())
|
||||
{
|
||||
sLog.outError("Battleground: itrplayerstatus not found.");
|
||||
return;
|
||||
|
|
@ -383,7 +383,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
|
||||
instanceId = itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID;
|
||||
// if action == 1, then instanceId is required
|
||||
if( !instanceId && action == 1 )
|
||||
if (!instanceId && action == 1)
|
||||
{
|
||||
sLog.outError("Battleground: instance not found.");
|
||||
return;
|
||||
|
|
@ -392,15 +392,15 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(instanceId, bgTypeId);
|
||||
|
||||
// bg template might and must be used in case of leaving queue, when instance is not created yet
|
||||
if( !bg && action == 0 )
|
||||
if (!bg && action == 0)
|
||||
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
{
|
||||
sLog.outError("Battleground: bg_template not found for type id %u.", bgTypeId);
|
||||
return;
|
||||
}
|
||||
|
||||
if( _player->InBattleGroundQueue() )
|
||||
if (_player->InBattleGroundQueue())
|
||||
{
|
||||
//we must use temporary variables, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function!
|
||||
uint32 team = itrPlayerStatus->second.GroupInfo->Team;
|
||||
|
|
@ -410,10 +410,10 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
uint32 opponentsRating = itrPlayerStatus->second.GroupInfo->OpponentsTeamRating;
|
||||
|
||||
//some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it
|
||||
if( action == 1 && arenaType == 0)
|
||||
if (action == 1 && arenaType == 0)
|
||||
{
|
||||
//if player is trying to enter battleground (not arena!) and he has deserter debuff, we must just remove him from queue
|
||||
if( !_player->CanJoinToBattleground() )
|
||||
if (!_player->CanJoinToBattleground())
|
||||
{
|
||||
//send bg command result to show nice message
|
||||
WorldPacket data2(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
|
||||
|
|
@ -423,7 +423,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
sLog.outDebug("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
|
||||
}
|
||||
//if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue
|
||||
if( _player->getLevel() > bg->GetMaxLevel() )
|
||||
if (_player->getLevel() > bg->GetMaxLevel())
|
||||
{
|
||||
sLog.outError("Battleground: Player %s (%u) has level higher than maxlevel of battleground! Do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
|
||||
action = 0;
|
||||
|
|
@ -434,16 +434,16 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
switch( action )
|
||||
{
|
||||
case 1: // port to battleground
|
||||
if( !_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId) )
|
||||
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
||||
return; // cheating?
|
||||
// resurrect the player
|
||||
if( !_player->isAlive() )
|
||||
if (!_player->isAlive())
|
||||
{
|
||||
_player->ResurrectPlayer(1.0f);
|
||||
_player->SpawnCorpseBones();
|
||||
}
|
||||
// stop taxi flight at port
|
||||
if(_player->isInFlight())
|
||||
if (_player->isInFlight())
|
||||
{
|
||||
_player->GetMotionMaster()->MovementExpired();
|
||||
_player->m_taxi.ClearTaxiDestinations();
|
||||
|
|
@ -455,7 +455,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), false);
|
||||
// this is still needed here if battleground "jumping" shouldn't add deserter debuff
|
||||
// also this is required to prevent stuck at old battleground after SetBattleGroundId set to new
|
||||
if( BattleGround *currentBg = _player->GetBattleGround() )
|
||||
if (BattleGround *currentBg = _player->GetBattleGround())
|
||||
currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true);
|
||||
|
||||
// set the destination instance id
|
||||
|
|
@ -470,10 +470,10 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
break;
|
||||
case 0: // leave queue
|
||||
// if player leaves rated arena match before match start, it is counted as he played but he lost
|
||||
if( isRated )
|
||||
if (isRated)
|
||||
{
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(team);
|
||||
if( at )
|
||||
if (at)
|
||||
{
|
||||
sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), opponentsRating);
|
||||
at->MemberLost(_player, opponentsRating);
|
||||
|
|
@ -484,7 +484,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), true);
|
||||
// player left queue, we should update it - do not update Arena Queue
|
||||
if( !arenaType )
|
||||
if (!arenaType)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId), arenaType, isRated, rating);
|
||||
SendPacket(&data);
|
||||
sLog.outDebug("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
|
||||
|
|
@ -512,9 +512,9 @@ void WorldSession::HandleBattleGroundLeaveOpcode( WorldPacket & /*recv_data*/ )
|
|||
// return;
|
||||
|
||||
// not allow leave battleground in combat
|
||||
if(_player->isInCombat())
|
||||
if(BattleGround* bg = _player->GetBattleGround())
|
||||
if(bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
if (_player->isInCombat())
|
||||
if (BattleGround* bg = _player->GetBattleGround())
|
||||
if (bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
_player->LeaveBattleground();
|
||||
|
|
@ -531,16 +531,16 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
if( !bgQueueTypeId )
|
||||
if (!bgQueueTypeId)
|
||||
continue;
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
||||
uint8 arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId);
|
||||
if( bgTypeId == _player->GetBattleGroundTypeId() )
|
||||
if (bgTypeId == _player->GetBattleGroundTypeId())
|
||||
{
|
||||
bg = _player->GetBattleGround();
|
||||
//i cannot check any variable from player class because player class doesn't know if player is in 2v2 / 3v3 or 5v5 arena
|
||||
//so i must use bg pointer to get that information
|
||||
if( bg && bg->GetArenaType() == arenaType )
|
||||
if (bg && bg->GetArenaType() == arenaType)
|
||||
{
|
||||
// this line is checked, i only don't know if GetStartTime is changing itself after bg end!
|
||||
// send status in BattleGround
|
||||
|
|
@ -553,12 +553,12 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
//get GroupQueueInfo for queue status
|
||||
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
|
||||
if( itrPlayerStatus == qpMap.end() )
|
||||
if (itrPlayerStatus == qpMap.end())
|
||||
continue;
|
||||
if( itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID )
|
||||
if (itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId);
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
continue;
|
||||
uint32 remainingTime = getMSTimeDiff(getMSTime(), itrPlayerStatus->second.GroupInfo->RemoveInviteTime);
|
||||
// send status invited to BattleGround
|
||||
|
|
@ -568,7 +568,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
else
|
||||
{
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
continue;
|
||||
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(itrPlayerStatus->second.GroupInfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
// send status in BattleGround Queue
|
||||
|
|
@ -585,14 +585,14 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data )
|
|||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isSpiritService()) // it's not spirit service
|
||||
|
|
@ -608,14 +608,14 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
|
|||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isSpiritService()) // it's not spirit service
|
||||
|
|
@ -632,7 +632,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
recv_data.hexlike();
|
||||
|
||||
// ignore if we already in BG or BG queue
|
||||
if(_player->InBattleGround())
|
||||
if (_player->InBattleGround())
|
||||
return;
|
||||
|
||||
uint64 guid; // arena Battlemaster guid
|
||||
|
|
@ -644,7 +644,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
recv_data >> guid >> arenaslot >> asGroup >> isRated;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isBattleMaster()) // it's not battle master
|
||||
|
|
@ -671,7 +671,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
|
||||
//check existance
|
||||
BattleGround* bg = NULL;
|
||||
if( !(bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA)) )
|
||||
if (!(bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA)))
|
||||
{
|
||||
sLog.outError("Battleground: template bg (all arenas) not found");
|
||||
return;
|
||||
|
|
@ -681,21 +681,21 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||
|
||||
// check queueing conditions
|
||||
if(!asGroup)
|
||||
if (!asGroup)
|
||||
{
|
||||
// check if already in queue
|
||||
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
||||
//player is already in this queue
|
||||
return;
|
||||
// check if has free queue slots
|
||||
if(!_player->HasFreeBattleGroundQueueId())
|
||||
if (!_player->HasFreeBattleGroundQueueId())
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
grp = _player->GetGroup();
|
||||
// no group found, error
|
||||
if(!grp)
|
||||
if (!grp)
|
||||
return;
|
||||
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
|
||||
if (err != BG_JOIN_ERR_OK)
|
||||
|
|
@ -707,12 +707,12 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
|
||||
uint32 ateamId = 0;
|
||||
|
||||
if(isRated)
|
||||
if (isRated)
|
||||
{
|
||||
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)
|
||||
if (!at)
|
||||
{
|
||||
_player->GetSession()->SendNotInArenaTeamPacket(arenatype);
|
||||
return;
|
||||
|
|
@ -730,20 +730,20 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot*6) + 5);
|
||||
}
|
||||
|
||||
if( arenatype )
|
||||
if (arenatype)
|
||||
avg_pers_rating /= arenatype;
|
||||
|
||||
// if avg personal rating is more than 150 points below the teams rating, the team will be queued against an opponent matching or similar to the average personal rating
|
||||
if(avg_pers_rating + 150 < arenaRating)
|
||||
if (avg_pers_rating + 150 < arenaRating)
|
||||
arenaRating = avg_pers_rating;
|
||||
}
|
||||
|
||||
GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, arenatype, isRated, false, arenaRating, ateamId);
|
||||
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
if(asGroup)
|
||||
if (asGroup)
|
||||
{
|
||||
sLog.outDebug("Battleground: arena join as group start");
|
||||
if(isRated)
|
||||
if (isRated)
|
||||
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())
|
||||
{
|
||||
|
|
@ -765,7 +765,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
sLog.outDebug("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName());
|
||||
}
|
||||
sLog.outDebug("Battleground: arena join as group end");
|
||||
if(isRated)
|
||||
if (isRated)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true);
|
||||
}
|
||||
else
|
||||
|
|
@ -793,7 +793,7 @@ void WorldSession::HandleBattleGroundReportAFK( WorldPacket & recv_data )
|
|||
recv_data >> playerGuid;
|
||||
Player *reportedPlayer = objmgr.GetPlayer(playerGuid);
|
||||
|
||||
if(!reportedPlayer)
|
||||
if (!reportedPlayer)
|
||||
{
|
||||
sLog.outDebug("WorldSession::HandleBattleGroundReportAFK: player not found");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue