mirror of
https://github.com/mangosfour/server.git
synced 2025-12-21 19:37:02 +00:00
Apply style fix
This commit is contained in:
parent
5531a0087d
commit
35405dd549
155 changed files with 10968 additions and 3660 deletions
|
|
@ -65,12 +65,16 @@ static bool MapSessionFilterHelper(WorldSession* session, OpcodeHandler const& o
|
|||
{
|
||||
// we do not process thread-unsafe packets
|
||||
if (opHandle.packetProcessing == PROCESS_THREADUNSAFE)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// we do not process not loggined player packets
|
||||
Player* plr = session->GetPlayer();
|
||||
if (!plr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// in Map::Update() we do not process packets where player is not in world!
|
||||
return plr->IsInWorld();
|
||||
|
|
@ -81,7 +85,9 @@ bool MapSessionFilter::Process(WorldPacket* packet)
|
|||
{
|
||||
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
|
||||
if (opHandle.packetProcessing == PROCESS_INPLACE)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// let's check if our opcode can be really processed in Map::Update()
|
||||
return MapSessionFilterHelper(m_pSession, opHandle);
|
||||
|
|
@ -94,7 +100,9 @@ bool WorldSessionFilter::Process(WorldPacket* packet)
|
|||
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
|
||||
// check if packet handler is supposed to be safe
|
||||
if (opHandle.packetProcessing == PROCESS_INPLACE)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// let's check if our opcode can't be processed in Map::Update()
|
||||
return !MapSessionFilterHelper(m_pSession, opHandle);
|
||||
|
|
@ -119,7 +127,9 @@ WorldSession::~WorldSession()
|
|||
{
|
||||
///- unload player if not unloaded
|
||||
if (_player)
|
||||
{ LogoutPlayer(true); }
|
||||
{
|
||||
LogoutPlayer(true);
|
||||
}
|
||||
|
||||
/// - If have unclosed socket, close it
|
||||
if (m_Socket)
|
||||
|
|
@ -165,7 +175,9 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
|||
#endif
|
||||
|
||||
if (!m_Socket)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (opcodeTable[packet->GetOpcode()].status == STATUS_UNHANDLED)
|
||||
{
|
||||
|
|
@ -212,7 +224,9 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
|||
#endif // !MANGOS_DEBUG
|
||||
|
||||
if (m_Socket->SendPacket(*packet) == -1)
|
||||
{ m_Socket->CloseSocket(); }
|
||||
{
|
||||
m_Socket->CloseSocket();
|
||||
}
|
||||
}
|
||||
|
||||
/// Add an incoming packet to the queue
|
||||
|
|
@ -263,7 +277,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
{
|
||||
// skip STATUS_LOGGEDIN opcode unexpected errors if player logout sometime ago - this can be network lag delayed packets
|
||||
if (!m_playerRecentlyLogout)
|
||||
{ LogUnexpectedOpcode(packet, "the player has not logged in yet"); }
|
||||
{
|
||||
LogUnexpectedOpcode(packet, "the player has not logged in yet");
|
||||
}
|
||||
}
|
||||
else if (_player->IsInWorld())
|
||||
{ ExecuteOpcode(opHandle, packet); }
|
||||
|
|
@ -286,7 +302,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
break;
|
||||
case STATUS_TRANSFER:
|
||||
if (!_player)
|
||||
{ LogUnexpectedOpcode(packet, "the player has not logged in yet"); }
|
||||
{
|
||||
LogUnexpectedOpcode(packet, "the player has not logged in yet");
|
||||
}
|
||||
else if (_player->IsInWorld())
|
||||
{ LogUnexpectedOpcode(packet, "the player is still in world"); }
|
||||
else
|
||||
|
|
@ -369,7 +387,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
///- If necessary, log the player out
|
||||
time_t currTime = time(NULL);
|
||||
if (!m_Socket || (ShouldLogOut(currTime) && !m_playerLoading))
|
||||
{ LogoutPlayer(true); }
|
||||
{
|
||||
LogoutPlayer(true);
|
||||
}
|
||||
// WARDEN ISSUE - commented out to stop crash
|
||||
// if (m_Socket && GetPlayer() && _warden)
|
||||
// _warden->Update();
|
||||
|
|
@ -414,7 +434,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
sLog.outChar("Account: %d (IP: %s) Logout Character:[%s] (guid: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() , _player->GetGUIDLow());
|
||||
|
||||
if (ObjectGuid lootGuid = GetPlayer()->GetLootGuid())
|
||||
{ DoLootRelease(lootGuid); }
|
||||
{
|
||||
DoLootRelease(lootGuid);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PLAYERBOTS
|
||||
if (_player->GetPlayerbotMgr())
|
||||
|
|
@ -444,7 +466,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
if (owner)
|
||||
{
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{ aset.insert((Player*)owner); }
|
||||
{
|
||||
aset.insert((Player*)owner);
|
||||
}
|
||||
}
|
||||
else if ((*itr)->GetTypeId() == TYPEID_PLAYER)
|
||||
{ aset.insert((Player*)(*itr)); }
|
||||
|
|
@ -463,7 +487,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
// this can't be called for all attackers.
|
||||
if (!aset.empty())
|
||||
if (BattleGround* bg = _player->GetBattleGround())
|
||||
{ bg->HandleKillPlayer(_player, *aset.begin()); }
|
||||
{
|
||||
bg->HandleKillPlayer(_player, *aset.begin());
|
||||
}
|
||||
}
|
||||
else if (_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
{
|
||||
|
|
@ -476,7 +502,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
}
|
||||
// drop a flag if player is carrying it
|
||||
if (BattleGround* bg = _player->GetBattleGround())
|
||||
{ bg->EventPlayerLoggedOut(_player); }
|
||||
{
|
||||
bg->EventPlayerLoggedOut(_player);
|
||||
}
|
||||
|
||||
///- Teleport to home if the player is in an invalid instance
|
||||
if (!_player->m_InstanceValid && !_player->isGameMaster())
|
||||
|
|
@ -538,7 +566,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
///- empty buyback items and save the player in the database
|
||||
// some save parts only correctly work in case player present in map/player_lists (pets, etc)
|
||||
if (Save)
|
||||
{ _player->SaveToDB(); }
|
||||
{
|
||||
_player->SaveToDB();
|
||||
}
|
||||
|
||||
///- Leave all channels before player delete...
|
||||
_player->CleanupChannels();
|
||||
|
|
@ -549,11 +579,15 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
// remove player from the group if he is:
|
||||
// a) in group; b) not in raid group; c) logging out normally (not being kicked or disconnected)
|
||||
if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket)
|
||||
{ _player->RemoveFromGroup(); }
|
||||
{
|
||||
_player->RemoveFromGroup();
|
||||
}
|
||||
#endif
|
||||
///- Send update to group
|
||||
if (_player->GetGroup())
|
||||
{ _player->GetGroup()->SendUpdate(); }
|
||||
{
|
||||
_player->GetGroup()->SendUpdate();
|
||||
}
|
||||
|
||||
///- Broadcast a logout message to the player's friends
|
||||
sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetObjectGuid(), true);
|
||||
|
|
@ -613,7 +647,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
void WorldSession::KickPlayer()
|
||||
{
|
||||
if (m_Socket)
|
||||
{ m_Socket->CloseSocket(); }
|
||||
{
|
||||
m_Socket->CloseSocket();
|
||||
}
|
||||
}
|
||||
|
||||
/// Cancel channeling handler
|
||||
|
|
@ -1152,7 +1188,9 @@ void WorldSession::ExecuteOpcode(OpcodeHandler const& opHandle, WorldPacket* pac
|
|||
// need prevent do internal far teleports in handlers because some handlers do lot steps
|
||||
// or call code that can do far teleports in some conditions unexpectedly for generic way work code
|
||||
if (_player)
|
||||
{ _player->SetCanDelayTeleport(true); }
|
||||
{
|
||||
_player->SetCanDelayTeleport(true);
|
||||
}
|
||||
|
||||
(this->*opHandle.handler)(*packet);
|
||||
|
||||
|
|
@ -1164,11 +1202,15 @@ void WorldSession::ExecuteOpcode(OpcodeHandler const& opHandle, WorldPacket* pac
|
|||
// we should execute delayed teleports only for alive(!) players
|
||||
// because we don't want player's ghost teleported from graveyard
|
||||
if (_player->IsHasDelayedTeleport())
|
||||
{ _player->TeleportTo(_player->m_teleport_dest, _player->m_teleport_options); }
|
||||
{
|
||||
_player->TeleportTo(_player->m_teleport_dest, _player->m_teleport_options);
|
||||
}
|
||||
}
|
||||
|
||||
if (packet->rpos() < packet->wpos() && sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG))
|
||||
{ LogUnprocessedTail(packet); }
|
||||
{
|
||||
LogUnprocessedTail(packet);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::InitWarden(uint16 build, BigNumber* k, std::string const& os)
|
||||
|
|
@ -1185,4 +1227,4 @@ void WorldSession::InitWarden(uint16 build, BigNumber* k, std::string const& os)
|
|||
_warden = new WardenMac();
|
||||
_warden->Init(this, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue