mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
replaced if( bla ) with if (bla) for applying mangos coding style
replaced it with sed -i 's/if( \(.*\) )$/if (\1)/' BattleGround* written by triply Signed-off-by: balrok <der-coole-carl@gmx.net>
This commit is contained in:
parent
c916f78abb
commit
73d12d7ccf
7 changed files with 207 additions and 207 deletions
|
|
@ -124,7 +124,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
if(!joinAsGroup)
|
||||
{
|
||||
// check Deserter debuff
|
||||
if( !_player->CanJoinToBattleground() )
|
||||
if (!_player->CanJoinToBattleground())
|
||||
{
|
||||
WorldPacket data(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
|
||||
data << uint32(0xFFFFFFFE);
|
||||
|
|
@ -219,11 +219,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));
|
||||
|
|
@ -235,13 +235,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();
|
||||
|
|
@ -321,25 +321,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;
|
||||
|
|
@ -348,7 +348,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);
|
||||
|
|
@ -362,7 +362,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
|
||||
|
|
@ -379,7 +379,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;
|
||||
|
|
@ -387,7 +387,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;
|
||||
|
|
@ -396,15 +396,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;
|
||||
|
|
@ -417,7 +417,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
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);
|
||||
|
|
@ -427,7 +427,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;
|
||||
|
|
@ -438,10 +438,10 @@ 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();
|
||||
|
|
@ -459,7 +459,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
|
||||
|
|
@ -474,10 +474,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);
|
||||
|
|
@ -488,7 +488,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);
|
||||
|
|
@ -535,16 +535,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
|
||||
|
|
@ -557,12 +557,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
|
||||
|
|
@ -572,7 +572,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
|
||||
|
|
@ -675,7 +675,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;
|
||||
|
|
@ -734,7 +734,7 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue