mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Merge pull request #14236 from Golrag/Notification1
Core/Packets: SMSG_NOTIFICATION
This commit is contained in:
@@ -189,3 +189,10 @@ WorldPacket const* WorldPackets::Chat::STextEmote::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Chat::PrintNotification::Write()
|
||||
{
|
||||
_worldPacket.WriteBits(NotifyText.size(), 12);
|
||||
_worldPacket.WriteString(NotifyText);
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -196,6 +196,17 @@ namespace WorldPackets
|
||||
int32 SoundIndex = -1;
|
||||
int32 EmoteID = 0;
|
||||
};
|
||||
|
||||
class PrintNotification final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PrintNotification() : ServerPacket(SMSG_NOTIFICATION, 3) { }
|
||||
PrintNotification(std::string const& notifyText) : ServerPacket(SMSG_NOTIFICATION, 3), NotifyText(notifyText) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::string NotifyText;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1562,7 +1562,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_NEW_TAXI_PATH, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_NEW_WORLD, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_NEW_WORLD_ABORT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_NOTIFICATION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_NOTIFICATION, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_NOTIFY_DANCE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_NOTIFY_DEST_LOC_SPELL_CAST, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_NOTIFY_MISSILE_TRAJECTORY_COLLISION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "CharacterPackets.h"
|
||||
#include "ClientConfigPackets.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "ChatPackets.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -654,12 +655,7 @@ void WorldSession::SendNotification(char const* format, ...)
|
||||
vsnprintf(szStr, 1024, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
size_t len = strlen(szStr);
|
||||
WorldPacket data(SMSG_NOTIFICATION, 2 + len);
|
||||
data.WriteBits(len, 13);
|
||||
data.FlushBits();
|
||||
data.append(szStr, len);
|
||||
SendPacket(&data);
|
||||
SendPacket(WorldPackets::Chat::PrintNotification(szStr).Write());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -675,12 +671,7 @@ void WorldSession::SendNotification(uint32 stringId, ...)
|
||||
vsnprintf(szStr, 1024, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
size_t len = strlen(szStr);
|
||||
WorldPacket data(SMSG_NOTIFICATION, 2 + len);
|
||||
data.WriteBits(len, 13);
|
||||
data.FlushBits();
|
||||
data.append(szStr, len);
|
||||
SendPacket(&data);
|
||||
SendPacket(WorldPackets::Chat::PrintNotification(szStr).Write());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2827,22 +2827,11 @@ void World::SendAutoBroadcast()
|
||||
if (abcenter == 0)
|
||||
sWorld->SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
|
||||
else if (abcenter == 1)
|
||||
{
|
||||
WorldPacket data(SMSG_NOTIFICATION, 2 + msg.length());
|
||||
data.WriteBits(msg.length(), 13);
|
||||
data.FlushBits();
|
||||
data.WriteString(msg);
|
||||
sWorld->SendGlobalMessage(&data);
|
||||
}
|
||||
sWorld->SendGlobalMessage(WorldPackets::Chat::PrintNotification(msg).Write());
|
||||
else if (abcenter == 2)
|
||||
{
|
||||
sWorld->SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
|
||||
|
||||
WorldPacket data(SMSG_NOTIFICATION, 2 + msg.length());
|
||||
data.WriteBits(msg.length(), 13);
|
||||
data.FlushBits();
|
||||
data.WriteString(msg);
|
||||
sWorld->SendGlobalMessage(&data);
|
||||
sWorld->SendGlobalMessage(WorldPackets::Chat::PrintNotification(msg).Write());
|
||||
}
|
||||
|
||||
TC_LOG_DEBUG("misc", "AutoBroadcast: '%s'", msg.c_str());
|
||||
|
||||
@@ -157,9 +157,7 @@ public:
|
||||
std::string str = handler->GetTrinityString(LANG_GLOBAL_NOTIFY);
|
||||
str += args;
|
||||
|
||||
WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
|
||||
data << str;
|
||||
sWorld->SendGlobalMessage(&data);
|
||||
sWorld->SendGlobalMessage(WorldPackets::Chat::PrintNotification(str).Write());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -172,9 +170,7 @@ public:
|
||||
std::string str = handler->GetTrinityString(LANG_GM_NOTIFY);
|
||||
str += args;
|
||||
|
||||
WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
|
||||
data << str;
|
||||
sWorld->SendGlobalGMMessage(&data);
|
||||
sWorld->SendGlobalGMMessage(WorldPackets::Chat::PrintNotification(str).Write());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user