TrinityCore
Loading...
Searching...
No Matches
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 "MiscPackets.h"
24#include "SharedDefines.h"
25
26#include <memory>
27#include <string>
28
29class Player;
30class WorldObject;
31
32namespace Trinity
33{
35 {
36 private:
37 // params
42 std::string Text;
46
47 public:
48 // caches
52 std::unique_ptr<WorldPackets::ServerPacket> SoundPacket;
53
54 ChatPacketSender(ChatMsg chatType, ::Language language, WorldObject const* sender, WorldObject const* receiver, std::string message,
55 uint32 achievementId = 0, LocaleConstant locale = LOCALE_enUS, uint32 broadcastTextId = 0, uint16 emoteId = 0, uint32 soundKitId = 0, SoundKitPlayType soundKitPlayType = SoundKitPlayType::Normal, uint32 playerConditionId = 0);
56
57 void operator()(Player const* player) const;
58 };
59
61 {
62 public:
63 BroadcastTextBuilder(WorldObject const* obj, ChatMsg msgType, uint32 textId, uint8 gender, WorldObject const* target = nullptr, uint32 achievementId = 0)
64 : _source(obj), _msgType(msgType), _textId(textId), _gender(gender), _target(target), _achievementId(achievementId) { }
65
67
68 private:
75 };
76
78 {
79 public:
80 CustomChatTextBuilder(WorldObject const* obj, ChatMsg msgType, std::string_view text, Language language = LANG_UNIVERSAL, WorldObject const* target = nullptr)
81 : _source(obj), _msgType(msgType), _text(text), _language(language), _target(target) { }
82
84
85 private:
88 std::string _text;
91 };
92
94 {
95 public:
96 TrinityStringChatBuilder(WorldObject const* obj, ChatMsg msgType, uint32 textId, WorldObject const* target = nullptr, va_list* args = nullptr)
97 : _source(obj), _msgType(msgType), _textId(textId), _target(target), _args(args) { }
98
100
101 private:
106 va_list* _args;
107 };
108
110 {
111 public:
112 CreatureTextTextBuilder(WorldObject const* obj, WorldObject const* speaker, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, Language language, WorldObject const* target, uint32 broadcastTextId, uint16 emoteId, uint32 soundKitId, SoundKitPlayType soundKitPlayType, uint32 playerConditionId)
113 : _source(obj), _talker(speaker), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target), _broadcastTextId(broadcastTextId), _emoteId(emoteId), _soundKitId(soundKitId), _soundKitPlayType(soundKitPlayType), _playerConditionId(playerConditionId) { }
114
116
117 private:
131 };
132}
133// namespace Trinity
134
135#endif // __CHATTEXT_BUILDER_H
LocaleConstant
Definition Common.h:51
@ LOCALE_enUS
Definition Common.h:52
uint8_t uint8
Definition Define.h:156
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
Language
@ LANG_UNIVERSAL
SoundKitPlayType
ChatMsg
ChatPacketSender * operator()(LocaleConstant locale) const
BroadcastTextBuilder(WorldObject const *obj, ChatMsg msgType, uint32 textId, uint8 gender, WorldObject const *target=nullptr, uint32 achievementId=0)
WorldPackets::Chat::Chat UntranslatedPacket
WorldObject const * Sender
WorldObject const * Receiver
Optional< WorldPackets::Chat::Chat > TranslatedPacket
std::unique_ptr< WorldPackets::ServerPacket > SoundPacket
Optional< WorldPackets::Chat::Emote > EmotePacket
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, uint32 broadcastTextId, uint16 emoteId, uint32 soundKitId, SoundKitPlayType soundKitPlayType, uint32 playerConditionId)
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)