Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-09-04 23:45:48 +08:00
282 changed files with 1861 additions and 1430 deletions

View File

@@ -74,13 +74,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);
@@ -91,7 +91,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>
@@ -101,7 +101,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)...));
});
}
@@ -113,7 +113,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>
@@ -123,7 +123,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)...));
});
}
@@ -135,7 +135,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>
@@ -145,7 +145,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);
});
}
@@ -160,7 +160,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>
@@ -173,7 +173,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;
@@ -188,7 +188,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);

View File

@@ -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);
}
});

View File

@@ -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());
}

View File

@@ -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;
}
};

View File

@@ -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)...);
}
}