Core/Packets: converted SMSG_MOTD and SMSG_LOGIN_VERIFY_WORLD to packet class

This commit is contained in:
Ovahlord committed 2020-04-11 18:22:01 +02:00
1 parent 61df418204
commit 4539b571bf
9 files changed
+68 -52

No files matched your search

+12 -42
View File
@@ -838,13 +838,10 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
pCurrChar->GetMotionMaster()->Initialize();
pCurrChar->SendDungeonDifficulty(false);
WorldPacket data(SMSG_LOGIN_VERIFY_WORLD, 20);
data << pCurrChar->GetMapId();
data << pCurrChar->GetPositionX();
data << pCurrChar->GetPositionY();
data << pCurrChar->GetPositionZ();
data << pCurrChar->GetOrientation();
SendPacket(&data);
WorldPackets::Character::LoginVerifyWorld loginVerifyWorld;
loginVerifyWorld.MapID = pCurrChar->GetMapId();
loginVerifyWorld.Pos = pCurrChar->GetPosition();
SendPacket(loginVerifyWorld.Write());
// load player specific part before send times
LoadAccountData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA), PER_CHARACTER_CACHE_MASK);
@@ -871,42 +868,15 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
// Send MOTD
{
data.Initialize(SMSG_MOTD, 50); // new in 2.0.1
data << (uint32)0;
uint32 linecount=0;
std::string str_motd = sWorld->GetMotd();
std::string::size_type pos, nextpos;
pos = 0;
while ((nextpos= str_motd.find('@', pos)) != std::string::npos)
{
if (nextpos != pos)
{
data << str_motd.substr(pos, nextpos-pos);
++linecount;
}
pos = nextpos+1;
}
if (pos<str_motd.length())
{
data << str_motd.substr(pos);
++linecount;
}
data.put(0, linecount);
SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_MOTD)");
// send server info
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(GitRevision::GetFullVersion());
TC_LOG_DEBUG("network", "WORLD: Sent server info");
WorldPackets::System::MOTD motd;
motd.Text = &sWorld->GetMotd();
SendPacket(motd.Write());
}
// send server info
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(GitRevision::GetFullVersion());
//QueryResult* result = CharacterDatabase.PQuery("SELECT guildid, rank FROM guild_member WHERE guid = '%u'", pCurrChar->GetGUID().GetCounter());
if (PreparedQueryResult resultGuild = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GUILD))
{
@@ -930,7 +900,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
pCurrChar->SetGuildLevel(0);
}
data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4);
WorldPacket data(SMSG_LEARNED_DANCE_MOVES, 4+4);
data << uint64(0);
SendPacket(&data);