AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::BattlegroundChatBuilder Class Reference

Public Member Functions

 BattlegroundChatBuilder (ChatMsg msgtype, uint32 textId, Player const *source, va_list *args=nullptr)
 
void operator() (WorldPacket &data, LocaleConstant loc_idx)
 

Private Member Functions

void do_helper (WorldPacket &data, char const *text)
 

Private Attributes

ChatMsg _msgtype
 
uint32 _textId
 
Player const * _source
 
va_list * _args
 

Detailed Description

Constructor & Destructor Documentation

◆ BattlegroundChatBuilder()

Acore::BattlegroundChatBuilder::BattlegroundChatBuilder ( ChatMsg  msgtype,
uint32  textId,
Player const *  source,
va_list *  args = nullptr 
)
inline
57 : _msgtype(msgtype), _textId(textId), _source(source), _args(args) { }
uint32 _textId
Definition: Battleground.cpp:85
va_list * _args
Definition: Battleground.cpp:87
Player const * _source
Definition: Battleground.cpp:86
ChatMsg _msgtype
Definition: Battleground.cpp:84

Member Function Documentation

◆ do_helper()

void Acore::BattlegroundChatBuilder::do_helper ( WorldPacket data,
char const *  text 
)
inlineprivate
80 {
82 }
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
static std::size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition: Chat.cpp:264

References _msgtype, _source, ChatHandler::BuildChatPacket(), and LANG_UNIVERSAL.

Referenced by operator()().

◆ operator()()

void Acore::BattlegroundChatBuilder::operator() ( WorldPacket data,
LocaleConstant  loc_idx 
)
inline
60 {
61 char const* text = sObjectMgr->GetAcoreString(_textId, loc_idx);
62 if (_args)
63 {
64 // we need copy va_list before use or original va_list will corrupted
65 va_list ap;
66 va_copy(ap, *_args);
67
68 char str[2048];
69 vsnprintf(str, 2048, text, ap);
70 va_end(ap);
71
72 do_helper(data, &str[0]);
73 }
74 else
75 do_helper(data, text);
76 }
#define sObjectMgr
Definition: ObjectMgr.h:1635
void do_helper(WorldPacket &data, char const *text)
Definition: Battleground.cpp:79

References _args, _textId, do_helper(), and sObjectMgr.

Member Data Documentation

◆ _args

va_list* Acore::BattlegroundChatBuilder::_args
private

Referenced by operator()().

◆ _msgtype

ChatMsg Acore::BattlegroundChatBuilder::_msgtype
private

Referenced by do_helper().

◆ _source

Player const* Acore::BattlegroundChatBuilder::_source
private

Referenced by do_helper().

◆ _textId

uint32 Acore::BattlegroundChatBuilder::_textId
private

Referenced by operator()().