Cs Server
Cs Server
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright
information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
Name: server_commandscript
%Complete: 100
Comment: All server related commands
Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "Config.h"
#include "GameTime.h"
#include "GitRevision.h"
#include "Language.h"
#include "ModuleMgr.h"
#include "MySQLThreading.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
#include "ServerMotd.h"
#include "StringConvert.h"
#include "UpdateTime.h"
#include "VMapFactory.h"
#include "VMapMgr2.h"
#include <boost/version.hpp>
#include <filesystem>
#include <numeric>
#include <openssl/crypto.h>
#include <openssl/opensslv.h>
return commandTable;
}
{
uint16 dbPort = 0;
if (QueryResult res = LoginDatabase.PQuery("SELECT port FROM realmlist
WHERE id = %u", realm.Id.Realm))
dbPort = (*res)[0].GetUInt16();
if (dbPort)
dbPortOutput = Acore::StringFormatFmt("Realmlist (Realm Id: {})
configured in port {}", realm.Id.Realm, dbPort);
else
dbPortOutput = Acore::StringFormat("Realm Id: %u not found in
`realmlist` table. Please check your setup", realm.Id.Realm);
}
handler->PSendSysMessage("%s", GitRevision::GetFullVersion());
handler->PSendSysMessage("Using SSL version: %s (library: %s)",
OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
handler->PSendSysMessage("Using Boost version: %i.%i.%i", BOOST_VERSION /
100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
handler->PSendSysMessage("Using MySQL version: %u",
MySQL::GetLibraryVersion());
handler->PSendSysMessage("Using CMake version: %s",
GitRevision::GetCMakeVersion());
if (mmapEnabled)
{
handler->SendSysMessage("MMAPs status: Enabled");
subDirs.emplace_back("mmaps");
}
else
handler->SendSysMessage("MMAPs status: Disabled");
if (!std::filesystem::exists(mapPath))
{
handler->PSendSysMessage("%s directory doesn't exist!. Using path:
%s", subDir.c_str(), mapPath.generic_string().c_str());
continue;
}
if (sWorld->GetAvailableDbcLocale(locale) != defaultLocale)
availableLocalesMask |= (1 << locale);
}
std::string availableLocales;
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
{
if (!(availableLocalesMask & (1 << i)))
continue;
availableLocales += localeNames[i];
if (i != TOTAL_LOCALES - 1)
availableLocales += " ";
}
return true;
}
handler->PSendSysMessage("%s", GitRevision::GetFullVersion());
if (!queuedSessionCount)
handler->PSendSysMessage("Connected players: %u. Characters in world:
%u.", activeSessionCount, playerCount);
else
handler->PSendSysMessage("Connected players: %u. Characters in world:
%u. Queue: %u.", activeSessionCount, playerCount, queuedSessionCount);
return true;
}
// Display the 'Message of the day' for the realm
static bool HandleServerMotdCommand(ChatHandler* handler)
{
handler->PSendSysMessage(LANG_MOTD_CURRENT, Motd::GetMotd());
return true;
}
return true;
}
if (!reason.empty())
{
if (!Utf8toWStr(reason, wReason))
{
return false;
}
if (!WStrToUtf8(wReason, strReason))
{
return false;
}
}
return true;
}
if (!WStrToUtf8(wReason, strReason))
{
return false;
}
}
return true;
}
if (!reason.empty())
{
if (!Utf8toWStr(reason, wReason))
{
return false;
}
if (!WStrToUtf8(wReason, strReason))
{
return false;
}
}
return true;
}
static bool HandleServerIdleShutDownCommand(ChatHandler* /*handler*/, int32
time, Optional<int32> exitCode, Tail reason)
{
std::wstring wReason = std::wstring();
std::string strReason = std::string();
if (!reason.empty())
{
if (!Utf8toWStr(reason, wReason))
{
return false;
}
if (!WStrToUtf8(wReason, strReason))
{
return false;
}
}
return true;
}
handler->SendSysMessage(LANG_USE_BOL);
handler->SetSentErrorMessage(true);
return false;
}
void AddSC_server_commandscript()
{
new server_commandscript();
}