fix(Core/WorldSession): incorrect fmt formatting (#20926)
This commit is contained in:
@@ -689,44 +689,6 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data)
|
|||||||
GetPlayer()->ResurectUsingRequestData();
|
GetPlayer()->ResurectUsingRequestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendAreaTriggerMessage(const char* Text, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
char szStr [1024];
|
|
||||||
szStr[0] = '\0';
|
|
||||||
|
|
||||||
va_start(ap, Text);
|
|
||||||
vsnprintf(szStr, 1024, Text, ap);
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
uint32 length = strlen(szStr) + 1;
|
|
||||||
WorldPacket data(SMSG_AREA_TRIGGER_MESSAGE, 4 + length);
|
|
||||||
data << length;
|
|
||||||
data << szStr;
|
|
||||||
SendPacket(&data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorldSession::SendAreaTriggerMessage(uint32 entry, ...)
|
|
||||||
{
|
|
||||||
char const* format = GetAcoreString(entry);
|
|
||||||
if (format)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
char szStr[1024];
|
|
||||||
szStr[0] = '\0';
|
|
||||||
|
|
||||||
va_start(ap, entry);
|
|
||||||
vsnprintf(szStr, 1024, format, ap);
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
uint32 length = strlen(szStr) + 1;
|
|
||||||
WorldPacket data(SMSG_AREA_TRIGGER_MESSAGE, 4 + length);
|
|
||||||
data << length;
|
|
||||||
data << szStr;
|
|
||||||
SendPacket(&data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
uint32 triggerId;
|
uint32 triggerId;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
#include "AccountMgr.h"
|
#include "AccountMgr.h"
|
||||||
#include "BattlegroundMgr.h"
|
#include "BattlegroundMgr.h"
|
||||||
|
#include "BanMgr.h"
|
||||||
#include "CharacterPackets.h"
|
#include "CharacterPackets.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "DatabaseEnv.h"
|
#include "DatabaseEnv.h"
|
||||||
@@ -44,6 +45,7 @@
|
|||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "SocialMgr.h"
|
#include "SocialMgr.h"
|
||||||
#include "Transport.h"
|
#include "Transport.h"
|
||||||
|
#include "Tokenize.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "WardenWin.h"
|
#include "WardenWin.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
@@ -52,8 +54,6 @@
|
|||||||
#include "WorldState.h"
|
#include "WorldState.h"
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include "BanMgr.h"
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
std::string const DefaultPlayerName = "<none>";
|
std::string const DefaultPlayerName = "<none>";
|
||||||
@@ -202,6 +202,19 @@ std::string WorldSession::GetPlayerInfo() const
|
|||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldSession::SendAreaTriggerMessage(std::string_view str)
|
||||||
|
{
|
||||||
|
std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
|
||||||
|
for (std::string_view line : lines)
|
||||||
|
{
|
||||||
|
uint32 length = line.size() + 1;
|
||||||
|
WorldPacket data(SMSG_AREA_TRIGGER_MESSAGE, 4 + length);
|
||||||
|
data << length;
|
||||||
|
data << line.data();
|
||||||
|
SendPacket(&data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Get player guid if available. Use for logging purposes only
|
/// Get player guid if available. Use for logging purposes only
|
||||||
ObjectGuid::LowType WorldSession::GetGuidLow() const
|
ObjectGuid::LowType WorldSession::GetGuidLow() const
|
||||||
{
|
{
|
||||||
@@ -766,8 +779,8 @@ bool WorldSession::ValidateHyperlinksAndMaybeKick(std::string_view str)
|
|||||||
if (Acore::Hyperlinks::CheckAllLinks(str))
|
if (Acore::Hyperlinks::CheckAllLinks(str))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
LOG_ERROR("network", "Player {} {} sent a message with an invalid link:\n%.*s", GetPlayer()->GetName(),
|
LOG_ERROR("network", "Player {} {} sent a message with an invalid link:\n{}", GetPlayer()->GetName(),
|
||||||
GetPlayer()->GetGUID().ToString(), STRING_VIEW_FMT_ARG(str));
|
GetPlayer()->GetGUID().ToString(), str);
|
||||||
|
|
||||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||||
KickPlayer("WorldSession::ValidateHyperlinksAndMaybeKick Invalid chat link");
|
KickPlayer("WorldSession::ValidateHyperlinksAndMaybeKick Invalid chat link");
|
||||||
@@ -780,8 +793,8 @@ bool WorldSession::DisallowHyperlinksAndMaybeKick(std::string_view str)
|
|||||||
if (str.find('|') == std::string_view::npos)
|
if (str.find('|') == std::string_view::npos)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
LOG_ERROR("network", "Player {} {} sent a message which illegally contained a hyperlink:\n%.*s", GetPlayer()->GetName(),
|
LOG_ERROR("network", "Player {} {} sent a message which illegally contained a hyperlink:\n{}", GetPlayer()->GetName(),
|
||||||
GetPlayer()->GetGUID().ToString(), STRING_VIEW_FMT_ARG(str));
|
GetPlayer()->GetGUID().ToString(), str);
|
||||||
|
|
||||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||||
KickPlayer("WorldSession::DisallowHyperlinksAndMaybeKick Illegal chat link");
|
KickPlayer("WorldSession::DisallowHyperlinksAndMaybeKick Illegal chat link");
|
||||||
|
|||||||
@@ -348,8 +348,22 @@ public:
|
|||||||
void SendPacket(WorldPacket const* packet);
|
void SendPacket(WorldPacket const* packet);
|
||||||
void SendPetNameInvalid(uint32 error, std::string const& name, DeclinedName* declinedName);
|
void SendPetNameInvalid(uint32 error, std::string const& name, DeclinedName* declinedName);
|
||||||
void SendPartyResult(PartyOperation operation, std::string const& member, PartyResult res, uint32 val = 0);
|
void SendPartyResult(PartyOperation operation, std::string const& member, PartyResult res, uint32 val = 0);
|
||||||
void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2, 3);
|
|
||||||
void SendAreaTriggerMessage(uint32 entry, ...);
|
void SendAreaTriggerMessage(std::string_view str);
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
|
void SendAreaTriggerMessage(char const* fmt, Args&&... args)
|
||||||
|
{
|
||||||
|
if (!m_playerLoading)
|
||||||
|
SendAreaTriggerMessage(Acore::StringFormat(fmt, std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
template<typename... Args>
|
||||||
|
void SendAreaTriggerMessage(uint32 strId, Args&&... args)
|
||||||
|
{
|
||||||
|
if (!m_playerLoading)
|
||||||
|
SendAreaTriggerMessage(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
void SendSetPhaseShift(uint32 phaseShift);
|
void SendSetPhaseShift(uint32 phaseShift);
|
||||||
void SendQueryTimeResponse();
|
void SendQueryTimeResponse();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user