mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 14:16:31 +00: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:
@@ -56,13 +56,13 @@ public:
|
||||
void SendNotification(uint32 strId, Args&&... args)
|
||||
{
|
||||
if (HasSession())
|
||||
SendNotification(Acore::StringFormatFmt(GetAcoreString(strId), std::forward<Args>(args)...));
|
||||
SendNotification(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
|
||||
}
|
||||
template<typename... Args>
|
||||
void SendNotification(char const* fmt, Args&&... args)
|
||||
{
|
||||
if (HasSession())
|
||||
SendNotification(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
|
||||
SendNotification(Acore::StringFormat(fmt, std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
void SendGMText(std::string_view str);
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
DoForAllValidSessions([&](Player* player)
|
||||
{
|
||||
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>
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
DoForAllValidSessions([&](Player* player)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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>
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
DoForAllValidSessions([&](Player* player)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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>
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
DoForAllValidSessions([&](Player* player)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (HasSession())
|
||||
SendSysMessage(Acore::StringFormatFmt(fmt, std::forward<Args>(args)...));
|
||||
SendSysMessage(Acore::StringFormat(fmt, std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
template<typename... Args>
|
||||
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;
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
template<typename... Args>
|
||||
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);
|
||||
|
||||
@@ -175,7 +175,7 @@ static void LogCommandUsage(WorldSession const& session, std::string_view cmdStr
|
||||
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(),
|
||||
session.GetAccountId(),
|
||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(),
|
||||
@@ -443,11 +443,11 @@ namespace Acore::Impl::ChatCommands
|
||||
{
|
||||
if (prefix.empty())
|
||||
{
|
||||
return Acore::StringFormatFmt("{}{}{}", match, COMMAND_DELIMITER, suffix);
|
||||
return Acore::StringFormat("{}{}{}", match, COMMAND_DELIMITER, suffix);
|
||||
}
|
||||
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);
|
||||
else
|
||||
{
|
||||
path = Acore::StringFormatFmt("{}{}{}", path, COMMAND_DELIMITER, it1->first);
|
||||
path = Acore::StringFormat("{}{}{}", path, COMMAND_DELIMITER, it1->first);
|
||||
}
|
||||
cmd = &it1->second;
|
||||
map = &cmd->_subCommands;
|
||||
@@ -477,7 +477,7 @@ namespace Acore::Impl::ChatCommands
|
||||
{ /* there is some trailing text, leave it as is */
|
||||
if (cmd)
|
||||
{ /* 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
|
||||
return {};
|
||||
@@ -490,7 +490,7 @@ namespace Acore::Impl::ChatCommands
|
||||
return std::string(match);
|
||||
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;
|
||||
if (result1.HasErrorMessage() && result2.HasErrorMessage())
|
||||
{
|
||||
return Acore::StringFormatFmt("{} \"{}\"\n{} \"{}\"",
|
||||
return Acore::StringFormat("{} \"{}\"\n{} \"{}\"",
|
||||
GetAcoreString(handler, LANG_CMDPARSER_EITHER), result2.GetErrorMessage(),
|
||||
GetAcoreString(handler, LANG_CMDPARSER_OR), result1.GetErrorMessage());
|
||||
}
|
||||
|
||||
@@ -273,9 +273,9 @@ namespace Acore::Impl::ChatCommands
|
||||
if (!nestedResult.HasErrorMessage())
|
||||
return thisResult;
|
||||
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
|
||||
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
|
||||
@@ -286,7 +286,7 @@ namespace Acore::Impl::ChatCommands
|
||||
{
|
||||
ChatCommandResult result = TryAtIndex<0>(val, handler, args);
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Acore::Impl::ChatCommands
|
||||
template <typename... Ts>
|
||||
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)...);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user