mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[7632] more "if"-condition related codestyle in battlegroundfiles
this time with this regex: sed -i 's/if *( *\(.*\) *)$/if (\1)/' BattleGround*
This commit is contained in:
parent
73d12d7ccf
commit
6b2fd22a9c
14 changed files with 346 additions and 346 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,11 +99,11 @@ 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;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isBattleMaster()) // it's not battlemaster
|
||||
|
|
@ -111,17 +111,17 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
|
||||
// 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())
|
||||
|
|
@ -136,14 +136,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());
|
||||
|
|
@ -158,7 +158,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())
|
||||
|
|
@ -198,7 +198,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);
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +275,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;
|
||||
|
|
@ -295,7 +295,7 @@ void WorldSession::HandleBattleGroundListOpcode( WorldPacket &recv_data )
|
|||
recv_data >> bgTypeId; // id from DBC
|
||||
|
||||
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
if(!bl)
|
||||
if (!bl)
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype received.");
|
||||
return;
|
||||
|
|
@ -414,7 +414,7 @@ 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())
|
||||
|
|
@ -447,7 +447,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
_player->SpawnCorpseBones();
|
||||
}
|
||||
// stop taxi flight at port
|
||||
if(_player->isInFlight())
|
||||
if (_player->isInFlight())
|
||||
{
|
||||
_player->GetMotionMaster()->MovementExpired();
|
||||
_player->m_taxi.ClearTaxiDestinations();
|
||||
|
|
@ -516,9 +516,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();
|
||||
|
|
@ -589,14 +589,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
|
||||
|
|
@ -612,14 +612,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
|
||||
|
|
@ -636,7 +636,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
|
||||
|
|
@ -648,7 +648,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
|
||||
|
|
@ -685,21 +685,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)
|
||||
|
|
@ -711,12 +711,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;
|
||||
|
|
@ -738,16 +738,16 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
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())
|
||||
{
|
||||
|
|
@ -769,7 +769,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
|
||||
|
|
@ -797,7 +797,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