fix: server motd

This commit is contained in:
FrancescoBorzi
2019-01-19 02:48:00 +01:00
parent ccaa74a9a7
commit 97ae1496a7
10 changed files with 101 additions and 83 deletions

View File

@@ -27,6 +27,7 @@
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "ServerMotd.h"
#include "SharedDefines.h"
#include "SocialMgr.h"
#include "SpellAuras.h"
@@ -745,7 +746,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recvData)
{
if (PlayerLoading() || GetPlayer() != NULL)
{
sLog->outError("Player tryes to login again, AccountId = %d", GetAccountId());
sLog->outError("Player tries to login again, AccountId = %d", GetAccountId());
KickPlayer();
return;
}
@@ -900,36 +901,7 @@ void WorldSession::HandlePlayerLoginFromDB(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);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("WORLD: Sent motd (SMSG_MOTD)");
#endif
SendPacket(Motd::GetMotdPacket());
// send server info
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
@@ -1246,36 +1218,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
// 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);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("WORLD: Sent motd (SMSG_MOTD)");
#endif
SendPacket(Motd::GetMotdPacket());
// send server info
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)