TrinityCore
ChatTextBuilder.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __CHATTEXT_BUILDER_H
19#define __CHATTEXT_BUILDER_H
20
21#include "Common.h"
22#include "ChatPackets.h"
23#include "SharedDefines.h"
24#include <string>
25
26class Player;
27class WorldObject;
28
29namespace Trinity
30{
32 {
33 private:
34 // params
39 std::string Text;
42
43 public:
44 // caches
47
48 ChatPacketSender(ChatMsg chatType, ::Language language, WorldObject const* sender, WorldObject const* receiver, std::string message,
49 uint32 achievementId = 0, LocaleConstant locale = LOCALE_enUS);
50
51 void operator()(Player const* player) const;
52 };
53
55 {
56 public:
57 BroadcastTextBuilder(WorldObject const* obj, ChatMsg msgType, uint32 textId, uint8 gender, WorldObject const* target = nullptr, uint32 achievementId = 0)
58 : _source(obj), _msgType(msgType), _textId(textId), _gender(gender), _target(target), _achievementId(achievementId) { }
59
61
62 private:
69 };
70
72 {
73 public:
74 CustomChatTextBuilder(WorldObject const* obj, ChatMsg msgType, std::string_view text, Language language = LANG_UNIVERSAL, WorldObject const* target = nullptr)
75 : _source(obj), _msgType(msgType), _text(text), _language(language), _target(target) { }
76
78
79 private:
82 std::string _text;
85 };
86
88 {
89 public:
90 TrinityStringChatBuilder(WorldObject const* obj, ChatMsg msgType, uint32 textId, WorldObject const* target = nullptr, va_list* args = nullptr)
91 : _source(obj), _msgType(msgType), _textId(textId), _target(target), _args(args) { }
92
94
95 private:
100 va_list* _args;
101 };
102
104 {
105 public:
106 CreatureTextTextBuilder(WorldObject const* obj, WorldObject const* speaker, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, Language language, WorldObject const* target)
107 : _source(obj), _talker(speaker), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target) { }
108
110
111 private:
120 };
121}
122// namespace Trinity
123
124#endif // __CHATTEXT_BUILDER_H
LocaleConstant
Definition: Common.h:48
@ LOCALE_enUS
Definition: Common.h:49
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
Language
@ LANG_UNIVERSAL
ChatMsg
WorldObject const * _source
WorldObject const * _target
ChatPacketSender * operator()(LocaleConstant locale) const
BroadcastTextBuilder(WorldObject const *obj, ChatMsg msgType, uint32 textId, uint8 gender, WorldObject const *target=nullptr, uint32 achievementId=0)
ChatPacketSender(ChatMsg chatType, ::Language language, WorldObject const *sender, WorldObject const *receiver, std::string message, uint32 achievementId=0, LocaleConstant locale=LOCALE_enUS)
WorldPackets::Chat::Chat UntranslatedPacket
WorldObject const * Sender
WorldObject const * Receiver
Optional< WorldPackets::Chat::Chat > TranslatedPacket
void operator()(Player const *player) const
ChatPacketSender * operator()(LocaleConstant locale) const
CreatureTextTextBuilder(WorldObject const *obj, WorldObject const *speaker, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, Language language, WorldObject const *target)
ChatPacketSender * operator()(LocaleConstant locale) const
CustomChatTextBuilder(WorldObject const *obj, ChatMsg msgType, std::string_view text, Language language=LANG_UNIVERSAL, WorldObject const *target=nullptr)
ChatPacketSender * operator()(LocaleConstant locale) const
TrinityStringChatBuilder(WorldObject const *obj, ChatMsg msgType, uint32 textId, WorldObject const *target=nullptr, va_list *args=nullptr)