Skip to content

Commit 3b86762

Browse files
authored
Sync chat building with TrinityCore/TrinityCore@1389dd7 (#531)
1 parent d7191f0 commit 3b86762

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

methods/TrinityCore/PlayerMethods.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define PLAYERMETHODS_H
99

1010
#include "LuaValue.h"
11+
#include "ChatPackets.h"
1112
#include "NPCPackets.h"
1213
#include "PartyPackets.h"
1314
#include "Unit.h"
@@ -3354,10 +3355,9 @@ namespace LuaPlayer
33543355
std::string message = E->CHECKVAL<std::string>(3);
33553356
ChatMsg channel = ChatMsg(E->CHECKVAL<uint8>(4));
33563357
Player* receiver = E->CHECKOBJ<Player>(5);
3357-
std::string fullmsg = prefix + "\t" + message;
3358-
WorldPacket data;
3359-
ChatHandler::BuildChatPacket(data, channel, LANG_ADDON, player, receiver, fullmsg);
3360-
receiver->GetSession()->SendPacket(&data);
3358+
WorldPackets::Chat::Chat chat;
3359+
chat.Initialize(channel, LANG_ADDON, player, receiver, message, 0, "", LOCALE_enUS, prefix);
3360+
receiver->GetSession()->SendPacket(chat.Write());
33613361
return 0;
33623362
}
33633363

methods/TrinityCore/UnitMethods.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifndef UNITMETHODS_H
88
#define UNITMETHODS_H
99

10+
#include "ChatPackets.h"
11+
1012
/***
1113
* Inherits all methods from: [Object], [WorldObject]
1214
*/
@@ -1873,10 +1875,10 @@ namespace LuaUnit
18731875
if (lang >= LANGUAGES_COUNT)
18741876
return luaL_argerror(E->L, 3, "valid Language expected");
18751877

1876-
WorldPacket data;
1877-
ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), unit, target, msg);
1878+
WorldPackets::Chat::Chat chat;
1879+
chat.Initialize(ChatMsg(type), Language(lang), unit, target, msg);
18781880

1879-
target->GetSession()->SendPacket(&data);
1881+
target->GetSession()->SendPacket(chat.Write());
18801882
return 0;
18811883
}
18821884

0 commit comments

Comments
 (0)