Core/PacketIO: convert all authentication related packets to packet class (#26)

This commit is contained in:
Ghaster authored and Ovah committed 2020-01-25 15:44:56 +01:00
1 parent fcb79fee07
commit 97a727749a
16 files changed
+395 -172

No files matched your search

+6 -31
View File
@@ -115,7 +115,8 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun
_accountId(id),
_accountName(std::move(name)),
_battlenetAccountId(battlenetAccountId),
m_expansion(expansion),
m_accountExpansion(expansion),
m_expansion(std::min<uint8>(expansion, sWorld->getIntConfig(CONFIG_EXPANSION))),
_warden(nullptr),
_logoutTime(0),
m_inQueue(false),
@@ -197,7 +198,9 @@ std::string WorldSession::GetPlayerInfo() const
std::ostringstream ss;
ss << "[Player: ";
if (!m_playerLoading && _player)
if (!m_playerLoading.IsEmpty())
ss << "Logging in: " << m_playerLoading.ToString() << ", ";
else if (_player)
ss << _player->GetName() << ' ' << _player->GetGUID().ToString() << ", ";
ss << "Account: " << GetAccountId() << "]";
@@ -318,7 +321,7 @@ void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, char const* status,
}
/// Logging helper for unexpected opcodes
void WorldSession::LogUnprocessedTail(WorldPacket* packet)
void WorldSession::LogUnprocessedTail(WorldPacket const* packet)
{
if (!sLog->ShouldLog("network.opcode", LOG_LEVEL_TRACE) || packet->rpos() >= packet->wpos())
return;
@@ -373,7 +376,6 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
sScriptMgr->OnPacketReceive(this, *packet);
opHandle->Call(this, *packet);
LogUnprocessedTail(packet);
}
// lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
break;
@@ -386,7 +388,6 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
// not expected _player or must checked in packet hanlder
sScriptMgr->OnPacketReceive(this, *packet);
opHandle->Call(this, *packet);
LogUnprocessedTail(packet);
}
break;
case STATUS_TRANSFER:
@@ -398,7 +399,6 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
sScriptMgr->OnPacketReceive(this, *packet);
opHandle->Call(this, *packet);
LogUnprocessedTail(packet);
}
break;
case STATUS_AUTHED:
@@ -418,7 +418,6 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
sScriptMgr->OnPacketReceive(this, *packet);
opHandle->Call(this, *packet);
LogUnprocessedTail(packet);
}
break;
case STATUS_NEVER:
@@ -784,30 +783,6 @@ void WorldSession::SendConnectToInstance(WorldPackets::Auth::ConnectToSerial ser
SendPacket(connectTo.Write());
}
void WorldSession::SendAuthWaitQue(uint32 position)
{
if (position == 0)
{
WorldPacket packet(SMSG_AUTH_RESPONSE, 1);
packet.WriteBit(0); // has queue info
packet.WriteBit(0); // has account info
packet.FlushBits();
packet << uint8(AUTH_OK);
SendPacket(&packet);
}
else
{
WorldPacket packet(SMSG_AUTH_RESPONSE, 6);
packet.WriteBit(1); // has queue info
packet.WriteBit(0); // unk queue bool
packet.WriteBit(0); // has account info
packet.FlushBits();
packet << uint8(AUTH_WAIT_QUEUE);
packet << uint32(position);
SendPacket(&packet);
}
}
void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
{
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)