mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
refactor(Core/Misc): Acore::StringFormat to fmt format (#19838)
refactor(Core/Utilities): Acore::StringFormat to fmt format * closes https://github.com/azerothcore/azerothcore-wotlk/issues/10356
This commit is contained in:
@@ -62,12 +62,12 @@ def isPAppend(line):
|
|||||||
else :
|
else :
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# def isStringFormat(line):
|
def isStringFormat(line):
|
||||||
# substring = 'StringFormat'
|
substring = 'StringFormat'
|
||||||
# if substring in line:
|
if substring in line:
|
||||||
# return True
|
return True
|
||||||
# else :
|
else :
|
||||||
# return False
|
return False
|
||||||
|
|
||||||
def haveDelimeter(line):
|
def haveDelimeter(line):
|
||||||
if ';' in line:
|
if ';' in line:
|
||||||
@@ -96,8 +96,8 @@ def checkSoloLine(line):
|
|||||||
# return handleCleanup(line), False
|
# return handleCleanup(line), False
|
||||||
# elif isPSendSysMessage(line):
|
# elif isPSendSysMessage(line):
|
||||||
# return handleCleanup(line), False
|
# return handleCleanup(line), False
|
||||||
# elif isStringFormat(line):
|
elif isStringFormat(line):
|
||||||
# return handleCleanup(line), False
|
return handleCleanup(line), False
|
||||||
else:
|
else:
|
||||||
return line, False
|
return line, False
|
||||||
|
|
||||||
@@ -122,8 +122,8 @@ def startMultiLine(line):
|
|||||||
elif isPAppend(line):
|
elif isPAppend(line):
|
||||||
line = line.replace("PAppend", "Append");
|
line = line.replace("PAppend", "Append");
|
||||||
return handleCleanup(line), True
|
return handleCleanup(line), True
|
||||||
# elif isStringFormat(line):
|
elif isStringFormat(line):
|
||||||
# return handleCleanup(line), True
|
return handleCleanup(line), True
|
||||||
else :
|
else :
|
||||||
return line, False
|
return line, False
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
void Acore::Banner::Show(std::string_view applicationName, void(*log)(std::string_view text), void(*logExtraInfo)())
|
void Acore::Banner::Show(std::string_view applicationName, void(*log)(std::string_view text), void(*logExtraInfo)())
|
||||||
{
|
{
|
||||||
log(Acore::StringFormatFmt("{} ({})", GitRevision::GetFullVersion(), applicationName));
|
log(Acore::StringFormat("{} ({})", GitRevision::GetFullVersion(), applicationName));
|
||||||
log("<Ctrl-C> to stop.\n");
|
log("<Ctrl-C> to stop.\n");
|
||||||
log(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗");
|
log(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗");
|
||||||
log(" ██╔══██╗╚══███╔╝██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝██║ ██║");
|
log(" ██╔══██╗╚══███╔╝██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝██║ ██║");
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace MMAP
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load and init dtNavMesh - read parameters from file
|
// load and init dtNavMesh - read parameters from file
|
||||||
std::string fileName = Acore::StringFormat(MAP_FILE_NAME_FORMAT, sConfigMgr->GetOption<std::string>("DataDir", ".").c_str(), mapId);
|
std::string fileName = Acore::StringFormat(MAP_FILE_NAME_FORMAT, sConfigMgr->GetOption<std::string>("DataDir", "."), mapId);
|
||||||
|
|
||||||
FILE* file = fopen(fileName.c_str(), "rb");
|
FILE* file = fopen(fileName.c_str(), "rb");
|
||||||
if (!file)
|
if (!file)
|
||||||
@@ -146,7 +146,7 @@ namespace MMAP
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load this tile :: mmaps/MMMXXYY.mmtile
|
// load this tile :: mmaps/MMMXXYY.mmtile
|
||||||
std::string fileName = Acore::StringFormat(TILE_FILE_NAME_FORMAT, sConfigMgr->GetOption<std::string>("DataDir", ".").c_str(), mapId, x, y);
|
std::string fileName = Acore::StringFormat(TILE_FILE_NAME_FORMAT, sConfigMgr->GetOption<std::string>("DataDir", "."), mapId, x, y);
|
||||||
FILE* file = fopen(fileName.c_str(), "rb");
|
FILE* file = fopen(fileName.c_str(), "rb");
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace
|
|||||||
template<typename Format, typename... Args>
|
template<typename Format, typename... Args>
|
||||||
inline void PrintError(std::string_view filename, Format&& fmt, Args&& ... args)
|
inline void PrintError(std::string_view filename, Format&& fmt, Args&& ... args)
|
||||||
{
|
{
|
||||||
std::string message = Acore::StringFormatFmt(std::forward<Format>(fmt), std::forward<Args>(args)...);
|
std::string message = Acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...);
|
||||||
|
|
||||||
if (IsAppConfig(filename))
|
if (IsAppConfig(filename))
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ namespace
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw ConfigException(Acore::StringFormatFmt("Config::LoadFile: Failed open {}file '{}'", isOptional ? "optional " : "", file));
|
throw ConfigException(Acore::StringFormat("Config::LoadFile: Failed open {}file '{}'", isOptional ? "optional " : "", file));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
@@ -144,7 +144,7 @@ namespace
|
|||||||
|
|
||||||
// read line error
|
// read line error
|
||||||
if (!in.good() && !in.eof())
|
if (!in.good() && !in.eof())
|
||||||
throw ConfigException(Acore::StringFormatFmt("> Config::LoadFile: Failure to read line number {} in file '{}'", lineNumber, file));
|
throw ConfigException(Acore::StringFormat("> Config::LoadFile: Failure to read line number {} in file '{}'", lineNumber, file));
|
||||||
|
|
||||||
// remove whitespace in line
|
// remove whitespace in line
|
||||||
line = Acore::String::Trim(line, in.getloc());
|
line = Acore::String::Trim(line, in.getloc());
|
||||||
@@ -187,7 +187,7 @@ namespace
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw ConfigException(Acore::StringFormatFmt("Config::LoadFile: Empty file '{}'", file));
|
throw ConfigException(Acore::StringFormat("Config::LoadFile: Empty file '{}'", file));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add correct keys if file load without errors
|
// Add correct keys if file load without errors
|
||||||
|
|||||||
@@ -62,19 +62,19 @@ namespace
|
|||||||
inline std::string MakeMessage(std::string_view messageType, std::string_view file, uint32 line, std::string_view function,
|
inline std::string MakeMessage(std::string_view messageType, std::string_view file, uint32 line, std::string_view function,
|
||||||
std::string_view message, std::string_view fmtMessage = {}, std::string_view debugInfo = {})
|
std::string_view message, std::string_view fmtMessage = {}, std::string_view debugInfo = {})
|
||||||
{
|
{
|
||||||
std::string msg = Acore::StringFormatFmt("\n>> {}\n\n# Location: {}:{}\n# Function: {}\n# Condition: {}\n", messageType, file, line, function, message);
|
std::string msg = Acore::StringFormat("\n>> {}\n\n# Location: {}:{}\n# Function: {}\n# Condition: {}\n", messageType, file, line, function, message);
|
||||||
|
|
||||||
if (!fmtMessage.empty())
|
if (!fmtMessage.empty())
|
||||||
{
|
{
|
||||||
msg.append(Acore::StringFormatFmt("# Message: {}\n", fmtMessage));
|
msg.append(Acore::StringFormat("# Message: {}\n", fmtMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!debugInfo.empty())
|
if (!debugInfo.empty())
|
||||||
{
|
{
|
||||||
msg.append(Acore::StringFormatFmt("\n# Debug info: {}\n", debugInfo));
|
msg.append(Acore::StringFormat("\n# Debug info: {}\n", debugInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Acore::StringFormatFmt(
|
return Acore::StringFormat(
|
||||||
"#{0:-^{2}}#\n"
|
"#{0:-^{2}}#\n"
|
||||||
" {1: ^{2}} \n"
|
" {1: ^{2}} \n"
|
||||||
"#{0:-^{2}}#\n", "", msg, 70);
|
"#{0:-^{2}}#\n", "", msg, 70);
|
||||||
@@ -90,14 +90,14 @@ namespace
|
|||||||
*/
|
*/
|
||||||
inline std::string MakeAbortMessage(std::string_view file, uint32 line, std::string_view function, std::string_view fmtMessage = {})
|
inline std::string MakeAbortMessage(std::string_view file, uint32 line, std::string_view function, std::string_view fmtMessage = {})
|
||||||
{
|
{
|
||||||
std::string msg = Acore::StringFormatFmt("\n>> ABORTED\n\n# Location '{}:{}'\n# Function '{}'\n", file, line, function);
|
std::string msg = Acore::StringFormat("\n>> ABORTED\n\n# Location '{}:{}'\n# Function '{}'\n", file, line, function);
|
||||||
|
|
||||||
if (!fmtMessage.empty())
|
if (!fmtMessage.empty())
|
||||||
{
|
{
|
||||||
msg.append(Acore::StringFormatFmt("# Message '{}'\n", fmtMessage));
|
msg.append(Acore::StringFormat("# Message '{}'\n", fmtMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Acore::StringFormatFmt(
|
return Acore::StringFormat(
|
||||||
"\n#{0:-^{2}}#\n"
|
"\n#{0:-^{2}}#\n"
|
||||||
" {1: ^{2}} \n"
|
" {1: ^{2}} \n"
|
||||||
"#{0:-^{2}}#\n", "", msg, 70);
|
"#{0:-^{2}}#\n", "", msg, 70);
|
||||||
@@ -148,7 +148,7 @@ void Acore::Abort(std::string_view file, uint32 line, std::string_view function,
|
|||||||
void Acore::AbortHandler(int sigval)
|
void Acore::AbortHandler(int sigval)
|
||||||
{
|
{
|
||||||
// nothing useful to log here, no way to pass args
|
// nothing useful to log here, no way to pass args
|
||||||
std::string formattedMessage = StringFormatFmt("Caught signal {}\n", sigval);
|
std::string formattedMessage = StringFormat("Caught signal {}\n", sigval);
|
||||||
fmt::print(stderr, "{}", formattedMessage);
|
fmt::print(stderr, "{}", formattedMessage);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
Crash(formattedMessage.c_str());
|
Crash(formattedMessage.c_str());
|
||||||
|
|||||||
@@ -31,19 +31,19 @@ namespace Acore
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
AC_COMMON_API inline void Assert(std::string_view file, uint32 line, std::string_view function, std::string_view debugInfo, std::string_view message, std::string_view fmt, Args&&... args)
|
AC_COMMON_API inline void Assert(std::string_view file, uint32 line, std::string_view function, std::string_view debugInfo, std::string_view message, std::string_view fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
Assert(file, line, function, debugInfo, message, StringFormatFmt(fmt, std::forward<Args>(args)...));
|
Assert(file, line, function, debugInfo, message, StringFormat(fmt, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
AC_COMMON_API inline void Fatal(std::string_view file, uint32 line, std::string_view function, std::string_view message, std::string_view fmt, Args&&... args)
|
AC_COMMON_API inline void Fatal(std::string_view file, uint32 line, std::string_view function, std::string_view message, std::string_view fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
Fatal(file, line, function, message, StringFormatFmt(fmt, std::forward<Args>(args)...));
|
Fatal(file, line, function, message, StringFormat(fmt, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
AC_COMMON_API inline void Abort(std::string_view file, uint32 line, std::string_view function, std::string_view fmt, Args&&... args)
|
AC_COMMON_API inline void Abort(std::string_view file, uint32 line, std::string_view function, std::string_view fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
Abort(file, line, function, StringFormatFmt(fmt, std::forward<Args>(args)...));
|
Abort(file, line, function, StringFormat(fmt, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
AC_COMMON_API void Warning(std::string_view file, uint32 line, std::string_view function, std::string_view message);
|
AC_COMMON_API void Warning(std::string_view file, uint32 line, std::string_view function, std::string_view message);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void AppenderConsole::InitColors(std::string const& name, std::string_view str)
|
|||||||
std::vector<std::string_view> colorStrs = Acore::Tokenize(str, ' ', false);
|
std::vector<std::string_view> colorStrs = Acore::Tokenize(str, ' ', false);
|
||||||
if (colorStrs.size() != NUM_ENABLED_LOG_LEVELS)
|
if (colorStrs.size() != NUM_ENABLED_LOG_LEVELS)
|
||||||
{
|
{
|
||||||
throw InvalidAppenderArgsException(Acore::StringFormatFmt("Log::CreateAppenderFromConfig: Invalid color data '{}' for console appender {} (expected {} entries, got {})",
|
throw InvalidAppenderArgsException(Acore::StringFormat("Log::CreateAppenderFromConfig: Invalid color data '{}' for console appender {} (expected {} entries, got {})",
|
||||||
str, name, NUM_ENABLED_LOG_LEVELS, colorStrs.size()));
|
str, name, NUM_ENABLED_LOG_LEVELS, colorStrs.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ void AppenderConsole::InitColors(std::string const& name, std::string_view str)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw InvalidAppenderArgsException(Acore::StringFormatFmt("Log::CreateAppenderFromConfig: Invalid color '{}' for log level {} on console appender {}",
|
throw InvalidAppenderArgsException(Acore::StringFormat("Log::CreateAppenderFromConfig: Invalid color '{}' for log level {} on console appender {}",
|
||||||
colorStrs[i], EnumUtils::ToTitle(static_cast<LogLevel>(i)), name));
|
colorStrs[i], EnumUtils::ToTitle(static_cast<LogLevel>(i)), name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, Ap
|
|||||||
{
|
{
|
||||||
if (args.size() < 4)
|
if (args.size() < 4)
|
||||||
{
|
{
|
||||||
throw InvalidAppenderArgsException(Acore::StringFormatFmt("Log::CreateAppenderFromConfig: Missing file name for appender {}", name));
|
throw InvalidAppenderArgsException(Acore::StringFormat("Log::CreateAppenderFromConfig: Missing file name for appender {}", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
_fileName.assign(args[3]);
|
_fileName.assign(args[3]);
|
||||||
@@ -63,7 +63,7 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, Ap
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw InvalidAppenderArgsException(Acore::StringFormatFmt("Log::CreateAppenderFromConfig: Invalid size '{}' for appender {}", args[5], name));
|
throw InvalidAppenderArgsException(Acore::StringFormat("Log::CreateAppenderFromConfig: Invalid size '{}' for appender {}", args[5], name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline void outMessage(std::string const& filter, LogLevel const level, Acore::FormatString<Args...> fmt, Args&&... args)
|
inline void outMessage(std::string const& filter, LogLevel const level, Acore::FormatString<Args...> fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
_outMessage(filter, level, Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
|
_outMessage(filter, level, Acore::StringFormat(fmt, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_outCommand(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...), std::to_string(account));
|
_outCommand(Acore::StringFormat(fmt, std::forward<Args>(args)...), std::to_string(account));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRealmId(uint32 id);
|
void SetRealmId(uint32 id);
|
||||||
|
|||||||
@@ -26,27 +26,12 @@
|
|||||||
|
|
||||||
namespace Acore
|
namespace Acore
|
||||||
{
|
{
|
||||||
/// Default AC string format function.
|
|
||||||
template<typename Format, typename... Args>
|
|
||||||
inline std::string StringFormat(Format&& fmt, Args&& ... args)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return fmt::sprintf(std::forward<Format>(fmt), std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
catch (const fmt::format_error& formatError)
|
|
||||||
{
|
|
||||||
std::string error = "An error occurred formatting string \"" + std::string(fmt) + "\" : " + std::string(formatError.what());
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
using FormatString = fmt::format_string<Args...>;
|
using FormatString = fmt::format_string<Args...>;
|
||||||
|
|
||||||
// Default string format function.
|
/// Default AC string format function.
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
inline std::string StringFormatFmt(FormatString<Args...> fmt, Args&&... args)
|
inline std::string StringFormat(FormatString<Args...> fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,27 +86,27 @@ AC_COMMON_API std::string Acore::Time::ToTimeString<Microseconds>(uint64 duratio
|
|||||||
{
|
{
|
||||||
if (days)
|
if (days)
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{}:{:02}:{:02}:{:02}:{:02}:{:02}", days, hours, minutes, secs, millisecs);
|
return Acore::StringFormat("{}:{:02}:{:02}:{:02}:{:02}:{:02}", days, hours, minutes, secs, millisecs);
|
||||||
}
|
}
|
||||||
else if (hours)
|
else if (hours)
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{}:{:02}:{:02}:{:02}:{:02}", hours, minutes, secs, millisecs);
|
return Acore::StringFormat("{}:{:02}:{:02}:{:02}:{:02}", hours, minutes, secs, millisecs);
|
||||||
}
|
}
|
||||||
else if (minutes)
|
else if (minutes)
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{}:{:02}:{:02}:{:02}", minutes, secs, millisecs);
|
return Acore::StringFormat("{}:{:02}:{:02}:{:02}", minutes, secs, millisecs);
|
||||||
}
|
}
|
||||||
else if (secs)
|
else if (secs)
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{}:{:02}:{:02}", secs, millisecs);
|
return Acore::StringFormat("{}:{:02}:{:02}", secs, millisecs);
|
||||||
}
|
}
|
||||||
else if (millisecs)
|
else if (millisecs)
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{}:{:02}", millisecs);
|
return Acore::StringFormat("{}:{:02}", millisecs);
|
||||||
}
|
}
|
||||||
else // microsecs
|
else // microsecs
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{}", microsecs);
|
return Acore::StringFormat("{}", microsecs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
if (sql.empty())
|
if (sql.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Execute(Acore::StringFormatFmt(sql, std::forward<Args>(args)...));
|
Execute(Acore::StringFormat(sql, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Enqueues a one-way SQL operation in prepared statement format that will be executed asynchronously.
|
//! Enqueues a one-way SQL operation in prepared statement format that will be executed asynchronously.
|
||||||
@@ -126,7 +126,7 @@ public:
|
|||||||
if (sql.empty())
|
if (sql.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DirectExecute(Acore::StringFormatFmt(sql, std::forward<Args>(args)...));
|
DirectExecute(Acore::StringFormat(sql, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Directly executes a one-way SQL operation in prepared statement format, that will block the calling thread until finished.
|
//! Directly executes a one-way SQL operation in prepared statement format, that will block the calling thread until finished.
|
||||||
@@ -149,7 +149,7 @@ public:
|
|||||||
if (sql.empty())
|
if (sql.empty())
|
||||||
return QueryResult(nullptr);
|
return QueryResult(nullptr);
|
||||||
|
|
||||||
return Query(Acore::StringFormatFmt(sql, std::forward<Args>(args)...));
|
return Query(Acore::StringFormat(sql, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Directly executes an SQL query in prepared format that will block the calling thread until finished.
|
//! Directly executes an SQL query in prepared format that will block the calling thread until finished.
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ bool PreparedStatementTask::Execute()
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
std::string PreparedStatementData::ToString(T value)
|
std::string PreparedStatementData::ToString(T value)
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{}", value);
|
return Acore::StringFormat("{}", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void Append(std::string_view sql, Args&&... args)
|
void Append(std::string_view sql, Args&&... args)
|
||||||
{
|
{
|
||||||
Append(Acore::StringFormatFmt(sql, std::forward<Args>(args)...));
|
Append(Acore::StringFormat(sql, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] std::size_t GetSize() const { return m_queries.size(); }
|
[[nodiscard]] std::size_t GetSize() const { return m_queries.size(); }
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool, std::string_view modulesL
|
|||||||
|
|
||||||
auto CheckUpdateTable = [&](std::string const& tableName)
|
auto CheckUpdateTable = [&](std::string const& tableName)
|
||||||
{
|
{
|
||||||
auto checkTable = DBUpdater<T>::Retrieve(pool, Acore::StringFormatFmt("SHOW TABLES LIKE '{}'", tableName));
|
auto checkTable = DBUpdater<T>::Retrieve(pool, Acore::StringFormat("SHOW TABLES LIKE '{}'", tableName));
|
||||||
if (!checkTable)
|
if (!checkTable)
|
||||||
{
|
{
|
||||||
LOG_WARN("sql.updates", "> Table '{}' not exist! Try add based table", tableName);
|
LOG_WARN("sql.updates", "> Table '{}' not exist! Try add based table", tableName);
|
||||||
@@ -279,7 +279,7 @@ bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool, std::string_view modulesL
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const info = Acore::StringFormatFmt("Containing {} new and {} archived updates.", result.recent, result.archived);
|
std::string const info = Acore::StringFormat("Containing {} new and {} archived updates.", result.recent, result.archived);
|
||||||
|
|
||||||
if (!result.updated)
|
if (!result.updated)
|
||||||
LOG_INFO("sql.updates", ">> {} database is up-to-date! {}", DBUpdater<T>::GetTableName(), info);
|
LOG_INFO("sql.updates", ">> {} database is up-to-date! {}", DBUpdater<T>::GetTableName(), info);
|
||||||
@@ -307,7 +307,7 @@ bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool, std::vector<std::string>
|
|||||||
|
|
||||||
auto CheckUpdateTable = [&](std::string const& tableName)
|
auto CheckUpdateTable = [&](std::string const& tableName)
|
||||||
{
|
{
|
||||||
auto checkTable = DBUpdater<T>::Retrieve(pool, Acore::StringFormatFmt("SHOW TABLES LIKE '{}'", tableName));
|
auto checkTable = DBUpdater<T>::Retrieve(pool, Acore::StringFormat("SHOW TABLES LIKE '{}'", tableName));
|
||||||
if (!checkTable)
|
if (!checkTable)
|
||||||
{
|
{
|
||||||
Path const temp(GetBaseFilesDirectory() + tableName + ".sql");
|
Path const temp(GetBaseFilesDirectory() + tableName + ".sql");
|
||||||
@@ -507,7 +507,7 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos
|
|||||||
|
|
||||||
// Execute sql file
|
// Execute sql file
|
||||||
args.emplace_back("-e");
|
args.emplace_back("-e");
|
||||||
args.emplace_back(Acore::StringFormat("BEGIN; SOURCE %s; COMMIT;", path.generic_string().c_str()));
|
args.emplace_back(Acore::StringFormat("BEGIN; SOURCE {}; COMMIT;", path.generic_string()));
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
if (!database.empty())
|
if (!database.empty())
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ protected:
|
|||||||
// For Logging purpose
|
// For Logging purpose
|
||||||
std::string ToString() const override
|
std::string ToString() const override
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("Damage done: {}, Healing done: {}, Killing blows: {}", DamageDone, HealingDone, KillingBlows);
|
return Acore::StringFormat("Damage done: {}, Healing done: {}, Killing blows: {}", DamageDone, HealingDone, KillingBlows);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 PvPTeamId;
|
uint8 PvPTeamId;
|
||||||
|
|||||||
@@ -1107,7 +1107,7 @@ void BattlegroundQueue::SendJoinMessageArenaQueue(Player* leader, GroupQueueInfo
|
|||||||
|
|
||||||
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
|
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
|
||||||
auto bgName = bg->GetName();
|
auto bgName = bg->GetName();
|
||||||
auto arenatype = Acore::StringFormat("%uv%u", ginfo->ArenaType, ginfo->ArenaType);
|
auto arenatype = Acore::StringFormat("{}v{}", ginfo->ArenaType, ginfo->ArenaType);
|
||||||
uint32 playersNeed = ArenaTeam::GetReqPlayersForType(ginfo->ArenaType);
|
uint32 playersNeed = ArenaTeam::GetReqPlayersForType(ginfo->ArenaType);
|
||||||
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32)80);
|
uint32 q_min_level = std::min(bracketEntry->minLevel, (uint32)80);
|
||||||
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32)80);
|
uint32 q_max_level = std::min(bracketEntry->maxLevel, (uint32)80);
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ public:
|
|||||||
void SendNotification(uint32 strId, Args&&... args)
|
void SendNotification(uint32 strId, Args&&... args)
|
||||||
{
|
{
|
||||||
if (HasSession())
|
if (HasSession())
|
||||||
SendNotification(Acore::StringFormatFmt(GetAcoreString(strId), std::forward<Args>(args)...));
|
SendNotification(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void SendNotification(char const* fmt, Args&&... args)
|
void SendNotification(char const* fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
if (HasSession())
|
if (HasSession())
|
||||||
SendNotification(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
|
SendNotification(Acore::StringFormat(fmt, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendGMText(std::string_view str);
|
void SendGMText(std::string_view str);
|
||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
DoForAllValidSessions([&](Player* player)
|
DoForAllValidSessions([&](Player* player)
|
||||||
{
|
{
|
||||||
m_session = player->GetSession();
|
m_session = player->GetSession();
|
||||||
SendGMText(Acore::StringFormatFmt(GetAcoreString(strId), std::forward<Args>(args)...));
|
SendGMText(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
DoForAllValidSessions([&](Player* player)
|
DoForAllValidSessions([&](Player* player)
|
||||||
{
|
{
|
||||||
m_session = player->GetSession();
|
m_session = player->GetSession();
|
||||||
SendGMText(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
|
SendGMText(Acore::StringFormat(fmt, std::forward<Args>(args)...));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ public:
|
|||||||
DoForAllValidSessions([&](Player* player)
|
DoForAllValidSessions([&](Player* player)
|
||||||
{
|
{
|
||||||
m_session = player->GetSession();
|
m_session = player->GetSession();
|
||||||
SendWorldText(Acore::StringFormatFmt(GetAcoreString(strId), std::forward<Args>(args)...));
|
SendWorldText(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@@ -105,7 +105,7 @@ public:
|
|||||||
DoForAllValidSessions([&](Player* player)
|
DoForAllValidSessions([&](Player* player)
|
||||||
{
|
{
|
||||||
m_session = player->GetSession();
|
m_session = player->GetSession();
|
||||||
SendWorldText(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
|
SendWorldText(Acore::StringFormat(fmt, std::forward<Args>(args)...));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ public:
|
|||||||
DoForAllValidSessions([&](Player* player)
|
DoForAllValidSessions([&](Player* player)
|
||||||
{
|
{
|
||||||
m_session = player->GetSession();
|
m_session = player->GetSession();
|
||||||
SendWorldTextOptional(Acore::StringFormatFmt(GetAcoreString(strId), std::forward<Args>(args)...), flag);
|
SendWorldTextOptional(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...), flag);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@@ -127,7 +127,7 @@ public:
|
|||||||
DoForAllValidSessions([&](Player* player)
|
DoForAllValidSessions([&](Player* player)
|
||||||
{
|
{
|
||||||
m_session = player->GetSession();
|
m_session = player->GetSession();
|
||||||
SendWorldTextOptional(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...), flag);
|
SendWorldTextOptional(Acore::StringFormat(fmt, std::forward<Args>(args)...), flag);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ public:
|
|||||||
void PSendSysMessage(char const* fmt, Args&&... args)
|
void PSendSysMessage(char const* fmt, Args&&... args)
|
||||||
{
|
{
|
||||||
if (HasSession())
|
if (HasSession())
|
||||||
SendSysMessage(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
|
SendSysMessage(Acore::StringFormat(fmt, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@@ -155,7 +155,7 @@ public:
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
std::string PGetParseString(uint32 entry, Args&&... args) const
|
std::string PGetParseString(uint32 entry, Args&&... args) const
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt(GetAcoreString(entry), std::forward<Args>(args)...);
|
return Acore::StringFormat(GetAcoreString(entry), std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const* GetModuleString(std::string module, uint32 id) const;
|
std::string const* GetModuleString(std::string module, uint32 id) const;
|
||||||
@@ -170,7 +170,7 @@ public:
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
std::string PGetParseModuleString(std::string module, uint32 id, Args&&... args) const
|
std::string PGetParseModuleString(std::string module, uint32 id, Args&&... args) const
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt(GetModuleString(module, id)->c_str(), std::forward<Args>(args)...);
|
return Acore::StringFormat(GetModuleString(module, id)->c_str(), std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendErrorMessage(uint32 entry);
|
void SendErrorMessage(uint32 entry);
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ static void LogCommandUsage(WorldSession const& session, std::string_view cmdStr
|
|||||||
zoneName = zone->area_name[locale];
|
zoneName = zone->area_name[locale];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string logMessage = Acore::StringFormatFmt("Command: {} [Player: {} ({}) (Account: {}) X: {} Y: {} Z: {} Map: {} ({}) Area: {} ({}) Zone: {} ({}) Selected: {} ({})]",
|
std::string logMessage = Acore::StringFormat("Command: {} [Player: {} ({}) (Account: {}) X: {} Y: {} Z: {} Map: {} ({}) Area: {} ({}) Zone: {} ({}) Selected: {} ({})]",
|
||||||
cmdStr, player->GetName(), player->GetGUID().ToString(),
|
cmdStr, player->GetName(), player->GetGUID().ToString(),
|
||||||
session.GetAccountId(),
|
session.GetAccountId(),
|
||||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(),
|
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(),
|
||||||
@@ -443,11 +443,11 @@ namespace Acore::Impl::ChatCommands
|
|||||||
{
|
{
|
||||||
if (prefix.empty())
|
if (prefix.empty())
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{}{}{}", match, COMMAND_DELIMITER, suffix);
|
return Acore::StringFormat("{}{}{}", match, COMMAND_DELIMITER, suffix);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{}{}{}{}{}", prefix, COMMAND_DELIMITER, match, COMMAND_DELIMITER, suffix);
|
return Acore::StringFormat("{}{}{}{}{}", prefix, COMMAND_DELIMITER, match, COMMAND_DELIMITER, suffix);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -465,7 +465,7 @@ namespace Acore::Impl::ChatCommands
|
|||||||
path.assign(it1->first);
|
path.assign(it1->first);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
path = Acore::StringFormatFmt("{}{}{}", path, COMMAND_DELIMITER, it1->first);
|
path = Acore::StringFormat("{}{}{}", path, COMMAND_DELIMITER, it1->first);
|
||||||
}
|
}
|
||||||
cmd = &it1->second;
|
cmd = &it1->second;
|
||||||
map = &cmd->_subCommands;
|
map = &cmd->_subCommands;
|
||||||
@@ -477,7 +477,7 @@ namespace Acore::Impl::ChatCommands
|
|||||||
{ /* there is some trailing text, leave it as is */
|
{ /* there is some trailing text, leave it as is */
|
||||||
if (cmd)
|
if (cmd)
|
||||||
{ /* if we matched a command at some point, auto-complete it */
|
{ /* if we matched a command at some point, auto-complete it */
|
||||||
return { Acore::StringFormatFmt("{}{}{}", path, COMMAND_DELIMITER, oldTail) };
|
return { Acore::StringFormat("{}{}{}", path, COMMAND_DELIMITER, oldTail) };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return {};
|
return {};
|
||||||
@@ -490,7 +490,7 @@ namespace Acore::Impl::ChatCommands
|
|||||||
return std::string(match);
|
return std::string(match);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{}{}{}", prefix, COMMAND_DELIMITER, match);
|
return Acore::StringFormat("{}{}{}", prefix, COMMAND_DELIMITER, match);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace Acore::Impl::ChatCommands
|
|||||||
return result2;
|
return result2;
|
||||||
if (result1.HasErrorMessage() && result2.HasErrorMessage())
|
if (result1.HasErrorMessage() && result2.HasErrorMessage())
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt("{} \"{}\"\n{} \"{}\"",
|
return Acore::StringFormat("{} \"{}\"\n{} \"{}\"",
|
||||||
GetAcoreString(handler, LANG_CMDPARSER_EITHER), result2.GetErrorMessage(),
|
GetAcoreString(handler, LANG_CMDPARSER_EITHER), result2.GetErrorMessage(),
|
||||||
GetAcoreString(handler, LANG_CMDPARSER_OR), result1.GetErrorMessage());
|
GetAcoreString(handler, LANG_CMDPARSER_OR), result1.GetErrorMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,9 +273,9 @@ namespace Acore::Impl::ChatCommands
|
|||||||
if (!nestedResult.HasErrorMessage())
|
if (!nestedResult.HasErrorMessage())
|
||||||
return thisResult;
|
return thisResult;
|
||||||
if (StringStartsWith(nestedResult.GetErrorMessage(), "\""))
|
if (StringStartsWith(nestedResult.GetErrorMessage(), "\""))
|
||||||
return Acore::StringFormat("\"%s\"\n%s %s", thisResult.GetErrorMessage().c_str(), GetAcoreString(handler, LANG_CMDPARSER_OR), nestedResult.GetErrorMessage().c_str());
|
return Acore::StringFormat("\"{}\"\n{} {}", thisResult.GetErrorMessage(), GetAcoreString(handler, LANG_CMDPARSER_OR), nestedResult.GetErrorMessage());
|
||||||
else
|
else
|
||||||
return Acore::StringFormat("\"%s\"\n%s \"%s\"", thisResult.GetErrorMessage().c_str(), GetAcoreString(handler, LANG_CMDPARSER_OR), nestedResult.GetErrorMessage().c_str());
|
return Acore::StringFormat("\"{}\"\n{} \"{}\"", thisResult.GetErrorMessage(), GetAcoreString(handler, LANG_CMDPARSER_OR), nestedResult.GetErrorMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -286,7 +286,7 @@ namespace Acore::Impl::ChatCommands
|
|||||||
{
|
{
|
||||||
ChatCommandResult result = TryAtIndex<0>(val, handler, args);
|
ChatCommandResult result = TryAtIndex<0>(val, handler, args);
|
||||||
if (result.HasErrorMessage() && (result.GetErrorMessage().find('\n') != std::string::npos))
|
if (result.HasErrorMessage() && (result.GetErrorMessage().find('\n') != std::string::npos))
|
||||||
return Acore::StringFormat("%s %s", GetAcoreString(handler, LANG_CMDPARSER_EITHER), result.GetErrorMessage().c_str());
|
return Acore::StringFormat("{} {}", GetAcoreString(handler, LANG_CMDPARSER_EITHER), result.GetErrorMessage());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ namespace Acore::Impl::ChatCommands
|
|||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
std::string FormatAcoreString(ChatHandler const* handler, AcoreStrings which, Ts&&... args)
|
std::string FormatAcoreString(ChatHandler const* handler, AcoreStrings which, Ts&&... args)
|
||||||
{
|
{
|
||||||
return Acore::StringFormatFmt(GetAcoreString(handler, which), std::forward<Ts>(args)...);
|
return Acore::StringFormat(GetAcoreString(handler, which), std::forward<Ts>(args)...);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ void PlayerDump::InitializeTables()
|
|||||||
// item0 - item18
|
// item0 - item18
|
||||||
for (uint32 j = 0; j < EQUIPMENT_SLOT_END; ++j)
|
for (uint32 j = 0; j < EQUIPMENT_SLOT_END; ++j)
|
||||||
{
|
{
|
||||||
std::string itColumn = Acore::StringFormat("item%u", j);
|
std::string itColumn = Acore::StringFormat("item{}", j);
|
||||||
MarkDependentColumn(t, itColumn, GUID_TYPE_ITEM);
|
MarkDependentColumn(t, itColumn, GUID_TYPE_ITEM);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -923,7 +923,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::istream& input, uint32 account, std::
|
|||||||
if (name.empty())
|
if (name.empty())
|
||||||
{
|
{
|
||||||
// generate a temporary name
|
// generate a temporary name
|
||||||
std::string guidPart = Acore::StringFormat("%X", guid);
|
std::string guidPart = Acore::StringFormat("{:X}", guid);
|
||||||
std::size_t maxCharsFromOriginalName = MAX_PLAYER_NAME - guidPart.length();
|
std::size_t maxCharsFromOriginalName = MAX_PLAYER_NAME - guidPart.length();
|
||||||
|
|
||||||
name = GetColumn(ts, line, "name").substr(0, maxCharsFromOriginalName) + guidPart;
|
name = GetColumn(ts, line, "name").substr(0, maxCharsFromOriginalName) + guidPart;
|
||||||
|
|||||||
@@ -246,14 +246,14 @@ void Warden::ApplyPenalty(uint16 checkId, std::string const& reason)
|
|||||||
if (Player const* plr = _session->GetPlayer())
|
if (Player const* plr = _session->GetPlayer())
|
||||||
{
|
{
|
||||||
std::string const reportFormat = "Player {} (guid {}, account id: {}) failed warden {} check ({}). Action: {}";
|
std::string const reportFormat = "Player {} (guid {}, account id: {}) failed warden {} check ({}). Action: {}";
|
||||||
reportMsg = Acore::StringFormatFmt(reportFormat, plr->GetName(), plr->GetGUID().GetCounter(), _session->GetAccountId(),
|
reportMsg = Acore::StringFormat(reportFormat, plr->GetName(), plr->GetGUID().GetCounter(), _session->GetAccountId(),
|
||||||
checkId, ((checkData && !checkData->Comment.empty()) ? checkData->Comment : "<warden comment is not set>"),
|
checkId, ((checkData && !checkData->Comment.empty()) ? checkData->Comment : "<warden comment is not set>"),
|
||||||
GetWardenActionStr(action));
|
GetWardenActionStr(action));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string const reportFormat = "Account id: {} failed warden {} check. Action: {}";
|
std::string const reportFormat = "Account id: {} failed warden {} check. Action: {}";
|
||||||
reportMsg = Acore::StringFormatFmt(reportFormat, _session->GetAccountId(), checkId, GetWardenActionStr(action));
|
reportMsg = Acore::StringFormat(reportFormat, _session->GetAccountId(), checkId, GetWardenActionStr(action));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -261,12 +261,12 @@ void Warden::ApplyPenalty(uint16 checkId, std::string const& reason)
|
|||||||
if (Player const* plr = _session->GetPlayer())
|
if (Player const* plr = _session->GetPlayer())
|
||||||
{
|
{
|
||||||
std::string const reportFormat = "Player {} (guid {}, account id: {}) triggered warden penalty by reason: {}. Action: {}";
|
std::string const reportFormat = "Player {} (guid {}, account id: {}) triggered warden penalty by reason: {}. Action: {}";
|
||||||
reportMsg = Acore::StringFormatFmt(reportFormat, plr->GetName(), plr->GetGUID().GetCounter(), _session->GetAccountId(), causeMsg, GetWardenActionStr(action));
|
reportMsg = Acore::StringFormat(reportFormat, plr->GetName(), plr->GetGUID().GetCounter(), _session->GetAccountId(), causeMsg, GetWardenActionStr(action));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string const reportFormat = "Account id: {} failed warden {} check. Action: {}";
|
std::string const reportFormat = "Account id: {} failed warden {} check. Action: {}";
|
||||||
reportMsg = Acore::StringFormatFmt(reportFormat, _session->GetAccountId(), causeMsg, GetWardenActionStr(action));
|
reportMsg = Acore::StringFormat(reportFormat, _session->GetAccountId(), causeMsg, GetWardenActionStr(action));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ void WardenCheckMgr::LoadWardenChecks()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string str2 = Acore::StringFormat("%04u", id);
|
std::string str2 = Acore::StringFormat("{:04}", id);
|
||||||
ASSERT(str2.size() == 4);
|
ASSERT(str2.size() == 4);
|
||||||
std::copy(str2.begin(), str2.end(), wardenCheck.IdStr.begin());
|
std::copy(str2.begin(), str2.end(), wardenCheck.IdStr.begin());
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ bool WardenPayloadMgr::RegisterPayload(std::string const& payload, uint16 payloa
|
|||||||
wCheck.Str = payload;
|
wCheck.Str = payload;
|
||||||
wCheck.CheckId = payloadId;
|
wCheck.CheckId = payloadId;
|
||||||
|
|
||||||
std::string idStr = Acore::StringFormat("%04u", payloadId);
|
std::string idStr = Acore::StringFormat("{:04}", payloadId);
|
||||||
ASSERT(idStr.size() == 4);
|
ASSERT(idStr.size() == 4);
|
||||||
std::copy(idStr.begin(), idStr.end(), wCheck.IdStr.begin());
|
std::copy(idStr.begin(), idStr.end(), wCheck.IdStr.begin());
|
||||||
|
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ public:
|
|||||||
if (target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index)
|
if (target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index)
|
||||||
activeStr = handler->GetAcoreString(LANG_ACTIVE);
|
activeStr = handler->GetAcoreString(LANG_ACTIVE);
|
||||||
|
|
||||||
std::string titleName = Acore::StringFormat(name, player->GetName().c_str());
|
std::string titleName = Acore::StringFormat(name, player->GetName());
|
||||||
|
|
||||||
// send title in "id (idx:idx) - [namedlink locale]" format
|
// send title in "id (idx:idx) - [namedlink locale]" format
|
||||||
if (handler->GetSession())
|
if (handler->GetSession())
|
||||||
|
|||||||
@@ -733,14 +733,14 @@ public:
|
|||||||
|
|
||||||
if (item->GetOwnerGUID() != player->GetGUID())
|
if (item->GetOwnerGUID() != player->GetGUID())
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(Acore::StringFormatFmt("queue({}): For the item {}, the owner ({}) and the player ({}) don't match!", index, item->GetGUID().ToString(), item->GetOwnerGUID().ToString(), player->GetGUID().ToString()));
|
handler->SendSysMessage(Acore::StringFormat("queue({}): For the item {}, the owner ({}) and the player ({}) don't match!", index, item->GetGUID().ToString(), item->GetOwnerGUID().ToString(), player->GetGUID().ToString()));
|
||||||
error = true;
|
error = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->GetQueuePos() != index)
|
if (item->GetQueuePos() != index)
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(Acore::StringFormatFmt("queue({}): For the item {}, the queuepos doesn't match it's position in the queue!", index, item->GetGUID().ToString()));
|
handler->SendSysMessage(Acore::StringFormat("queue({}): For the item {}, the queuepos doesn't match it's position in the queue!", index, item->GetGUID().ToString()));
|
||||||
error = true;
|
error = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -752,14 +752,14 @@ public:
|
|||||||
|
|
||||||
if (!test)
|
if (!test)
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(Acore::StringFormatFmt("queue({}): The bag({}) and slot({}) values for {} are incorrect, the player doesn't have any item at that position!", index, item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString()));
|
handler->SendSysMessage(Acore::StringFormat("queue({}): The bag({}) and slot({}) values for {} are incorrect, the player doesn't have any item at that position!", index, item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString()));
|
||||||
error = true;
|
error = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test != item)
|
if (test != item)
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(Acore::StringFormatFmt("queue({}): The bag({}) and slot({}) values for the {} are incorrect, {} is there instead!", index, item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString(), test->GetGUID().ToString()));
|
handler->SendSysMessage(Acore::StringFormat("queue({}): The bag({}) and slot({}) values for the {} are incorrect, {} is there instead!", index, item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString(), test->GetGUID().ToString()));
|
||||||
error = true;
|
error = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public:
|
|||||||
if (message.empty())
|
if (message.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
sWorld->SendServerMessage(SERVER_MSG_STRING, Acore::StringFormatFmt(handler->GetAcoreString(LANG_SYSTEMMESSAGE), message.data()));
|
sWorld->SendServerMessage(SERVER_MSG_STRING, Acore::StringFormat(handler->GetAcoreString(LANG_SYSTEMMESSAGE), message.data()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public:
|
|||||||
itemCount = *Acore::StringTo<uint32>(itemTokens.at(1));
|
itemCount = *Acore::StringTo<uint32>(itemTokens.at(1));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
handler->SendSysMessage(Acore::StringFormatFmt("> Incorrect item list format for '{}'", itemString));
|
handler->SendSysMessage(Acore::StringFormat("> Incorrect item list format for '{}'", itemString));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,9 +121,9 @@ public:
|
|||||||
dbPort = (*res)[0].Get<uint16>();
|
dbPort = (*res)[0].Get<uint16>();
|
||||||
|
|
||||||
if (dbPort)
|
if (dbPort)
|
||||||
dbPortOutput = Acore::StringFormatFmt("Realmlist (Realm Id: {}) configured in port {}", realm.Id.Realm, dbPort);
|
dbPortOutput = Acore::StringFormat("Realmlist (Realm Id: {}) configured in port {}", realm.Id.Realm, dbPort);
|
||||||
else
|
else
|
||||||
dbPortOutput = Acore::StringFormatFmt("Realm Id: {} not found in `realmlist` table. Please check your setup", realm.Id.Realm);
|
dbPortOutput = Acore::StringFormat("Realm Id: {} not found in `realmlist` table. Please check your setup", realm.Id.Realm);
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleServerInfoCommand(handler);
|
HandleServerInfoCommand(handler);
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ class spell_the_flag_of_ownership : public SpellScript
|
|||||||
|
|
||||||
LocaleConstant loc_idx = caster->ToPlayer()->GetSession()->GetSessionDbLocaleIndex();
|
LocaleConstant loc_idx = caster->ToPlayer()->GetSession()->GetSessionDbLocaleIndex();
|
||||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(TEXT_FLAG_OF_OWNERSHIP);
|
BroadcastText const* bct = sObjectMgr->GetBroadcastText(TEXT_FLAG_OF_OWNERSHIP);
|
||||||
std::string bctMsg = Acore::StringFormat(bct->GetText(loc_idx, caster->getGender()), caster->GetName().c_str(), target->GetName().c_str());
|
std::string bctMsg = Acore::StringFormat(bct->GetText(loc_idx, caster->getGender()), caster->GetName(), target->GetName());
|
||||||
caster->Talk(bctMsg, CHAT_MSG_MONSTER_EMOTE, LANG_UNIVERSAL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
|
caster->Talk(bctMsg, CHAT_MSG_MONSTER_EMOTE, LANG_UNIVERSAL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
|
||||||
|
|
||||||
haveTarget = true;
|
haveTarget = true;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ DBCDatabaseLoader::DBCDatabaseLoader(char const* tableName, char const* dbcForma
|
|||||||
|
|
||||||
char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
||||||
{
|
{
|
||||||
std::string query = Acore::StringFormat("SELECT * FROM `%s` ORDER BY `ID` DESC", _sqlTableName);
|
std::string query = Acore::StringFormat("SELECT * FROM `{}` ORDER BY `ID` DESC", _sqlTableName);
|
||||||
|
|
||||||
// no error if empty set
|
// no error if empty set
|
||||||
QueryResult result = WorldDatabase.Query(query);
|
QueryResult result = WorldDatabase.Query(query);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ ByteBufferSourceException::ByteBufferSourceException(std::size_t pos, std::size_
|
|||||||
|
|
||||||
ByteBufferInvalidValueException::ByteBufferInvalidValueException(char const* type, char const* value)
|
ByteBufferInvalidValueException::ByteBufferInvalidValueException(char const* type, char const* value)
|
||||||
{
|
{
|
||||||
message().assign(Acore::StringFormat("Invalid %s value (%s) found in ByteBuffer", type, value));
|
message().assign(Acore::StringFormat("Invalid {} value ({}) found in ByteBuffer", type, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer& ByteBuffer::operator>>(float& value)
|
ByteBuffer& ByteBuffer::operator>>(float& value)
|
||||||
|
|||||||
@@ -188,11 +188,11 @@ Optional<std::string> SecretMgr::AttemptTransition(Secrets i, Optional<BigNumber
|
|||||||
if (hadOldSecret)
|
if (hadOldSecret)
|
||||||
{
|
{
|
||||||
if (!oldSecret)
|
if (!oldSecret)
|
||||||
return Acore::StringFormat("Cannot decrypt old TOTP tokens - add config key '%s' to authserver.conf!", secret_info[i].oldKey);
|
return Acore::StringFormat("Cannot decrypt old TOTP tokens - add config key '{}' to authserver.conf!", secret_info[i].oldKey);
|
||||||
|
|
||||||
bool success = Acore::Crypto::AEDecrypt<Acore::Crypto::AES>(totpSecret, oldSecret->ToByteArray<Acore::Crypto::AES::KEY_SIZE_BYTES>());
|
bool success = Acore::Crypto::AEDecrypt<Acore::Crypto::AES>(totpSecret, oldSecret->ToByteArray<Acore::Crypto::AES::KEY_SIZE_BYTES>());
|
||||||
if (!success)
|
if (!success)
|
||||||
return Acore::StringFormat("Cannot decrypt old TOTP tokens - value of '%s' is incorrect for some users!", secret_info[i].oldKey);
|
return Acore::StringFormat("Cannot decrypt old TOTP tokens - value of '{}' is incorrect for some users!", secret_info[i].oldKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newSecret)
|
if (newSecret)
|
||||||
|
|||||||
@@ -990,7 +990,7 @@ void ExtractMapsFromMpq(uint32 build)
|
|||||||
{
|
{
|
||||||
printf("Extract %s (%d/%u) \n", map_ids[z].name, z + 1, map_count);
|
printf("Extract %s (%d/%u) \n", map_ids[z].name, z + 1, map_count);
|
||||||
// Loadup map grid data
|
// Loadup map grid data
|
||||||
mpqMapName = Acore::StringFormat(R"(World\Maps\%s\%s.wdt)", map_ids[z].name, map_ids[z].name);
|
mpqMapName = Acore::StringFormat(R"(World\Maps\{}\{}.wdt)", map_ids[z].name, map_ids[z].name);
|
||||||
WDT_file wdt;
|
WDT_file wdt;
|
||||||
if (!wdt.loadFile(mpqMapName, false))
|
if (!wdt.loadFile(mpqMapName, false))
|
||||||
{
|
{
|
||||||
@@ -1004,8 +1004,8 @@ void ExtractMapsFromMpq(uint32 build)
|
|||||||
{
|
{
|
||||||
if (!wdt.main->adt_list[y][x].exist)
|
if (!wdt.main->adt_list[y][x].exist)
|
||||||
continue;
|
continue;
|
||||||
mpqFileName = Acore::StringFormat(R"(World\Maps\%s\%s_%u_%u.adt)", map_ids[z].name, map_ids[z].name, x, y);
|
mpqFileName = Acore::StringFormat(R"(World\Maps\{}\{}_{}_{}.adt)", map_ids[z].name, map_ids[z].name, x, y);
|
||||||
outputFileName = Acore::StringFormat("%s/maps/%03u%02u%02u.map", output_path, map_ids[z].id, y, x);
|
outputFileName = Acore::StringFormat("{}/maps/{:03}{:02}{:02}.map", output_path, map_ids[z].id, y, x);
|
||||||
ConvertADT(mpqFileName, outputFileName, y, x, build);
|
ConvertADT(mpqFileName, outputFileName, y, x, build);
|
||||||
}
|
}
|
||||||
// draw progress bar
|
// draw progress bar
|
||||||
|
|||||||
Reference in New Issue
Block a user