18 #ifndef TRINITY_CREATURE_TEXT_MGR_H
19 #define TRINITY_CREATURE_TEXT_MGR_H
88 void LoadCreatureTexts();
89 void LoadCreatureTextLocales();
93 static void SendEmote(
Unit* source,
uint32 emote);
97 bool TextExist(
uint32 sourceEntry,
uint8 textGroup)
const;
107 static float GetRangeForChatType(
ChatMsg msgType);
113 #define sCreatureTextMgr CreatureTextMgr::instance()
115 template<
class Builder>
132 LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
138 messageTemplate =
_builder(loc_idx);
156 player->SendDirectMessage(message.
Write());
165 template<
class Builder>
180 if (
Player* whisperPlayer = const_cast<Player*>(whisperTarget->
ToPlayer()))
182 if (
Group* group = whisperPlayer->GetGroup())
183 group->BroadcastWorker(localizer);
195 localizer(const_cast<Player*>(whisperTarget->
ToPlayer()));
211 if (itr->GetSource()->GetAreaId() == areaId && (!team ||
Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
212 localizer(itr->GetSource());
220 if (itr->GetSource()->GetZoneId() == zoneId && (!team ||
Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
221 localizer(itr->GetSource());
228 if ((!team ||
Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
229 localizer(itr->GetSource());
235 for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
236 if (
Player* player = iter->second->GetPlayer())
237 if ((!team ||
Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster()))
static float GetRangeForChatType(ChatMsg msgType)
Definition: CreatureTextMgr.cpp:277
Map * GetMap() const
Definition: Object.h:543
uint32 textGroup
Definition: CreatureTextMgr.h:69
Emote emote
Definition: CreatureTextMgr.h:47
Definition: CreatureTextMgr.h:31
uint8 id
Definition: CreatureTextMgr.h:42
Emote
Definition: SharedDefines.h:2410
static void SendChatPacket(WorldObject *source, Builder const &builder, ChatMsg msgType, WorldObject const *whisperTarget=nullptr, CreatureTextRange range=TEXT_RANGE_NORMAL, Team team=TEAM_OTHER, bool gmOnly=false)
Definition: CreatureTextMgr.h:166
std::vector< CreatureTextEntry > CreatureTextGroup
Definition: CreatureTextMgr.h:73
uint8 group
Definition: CreatureTextMgr.h:41
void SetReceiver(WorldObject const *receiver, LocaleConstant locale)
Definition: ChatPackets.cpp:155
Definition: GridNotifiers.h:560
Definition: CreatureTextMgr.h:35
Definition: SharedDefines.h:4246
std::map< CreatureTextId, CreatureTextLocale > LocaleCreatureTextMap
Definition: CreatureTextMgr.h:77
CreatureTextRange TextRange
Definition: CreatureTextMgr.h:51
uint32 entry
Definition: CreatureTextMgr.h:68
void VisitNearbyWorldObject(float const &radius, NOTIFIER ¬ifier) const
Definition: Object.h:589
uint32 GetZoneId() const
Definition: Object.cpp:1525
std::vector< uint8 > CreatureTextRepeatIds
Definition: Creature.h:464
Builder const & _builder
Definition: CreatureTextMgr.h:161
Definition: ChatPackets.h:150
ChatMsg
Definition: SharedDefines.h:4228
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 entry
Definition: CreatureTextMgr.h:40
Definition: Creature.h:467
Definition: CreatureTextMgr.h:54
#define sWorld
Definition: World.h:887
iterator begin()
Definition: MapRefManager.h:37
uint32 duration
Definition: CreatureTextMgr.h:48
Definition: CreatureTextMgr.h:34
uint32 textId
Definition: CreatureTextMgr.h:70
Player * ToPlayer()
Definition: Object.h:191
WorldPacket const * Write() override
Definition: ChatPackets.cpp:162
ChatMsg type
Definition: CreatureTextMgr.h:44
uint32 BroadcastTextId
Definition: CreatureTextMgr.h:50
TypeID GetTypeId() const
Definition: Object.h:113
Definition: CreatureTextMgr.h:38
Team
Definition: SharedDefines.h:997
std::unordered_map< uint32, CreatureTextHolder > CreatureTextMap
Definition: CreatureTextMgr.h:75
Language
Definition: SharedDefines.h:959
CreatureTextMgr()
Definition: CreatureTextMgr.h:82
Definition: SharedDefines.h:4244
Definition: CreatureTextMgr.h:32
LocaleConstant
Definition: Common.h:115
Definition: CreatureTextMgr.h:33
Definition: SharedDefines.h:4273
uint32_t uint32
Definition: Define.h:150
bool operator<(CreatureTextId const &right) const
Definition: CreatureTextMgr.h:63
Definition: LinkedList.h:141
CreatureTextMap const & GetTextMap() const
Definition: CreatureTextMgr.h:90
CreatureTextLocalizer(Builder const &builder, ChatMsg msgType)
Definition: CreatureTextMgr.h:119
CreatureTextId(uint32 e, uint32 g, uint32 i)
Definition: CreatureTextMgr.h:61
uint32 GetAreaId() const
Definition: Object.cpp:1530
CreatureTextRange
Definition: CreatureTextMgr.h:29
std::string text
Definition: CreatureTextMgr.h:43
Definition: SharedDefines.h:1006
uint32 sound
Definition: CreatureTextMgr.h:49
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: CreatureTextMgr.h:116
Language lang
Definition: CreatureTextMgr.h:45
std::vector< std::string > StringVector
Definition: Common.h:142
Definition: MapRefManager.h:26
Definition: ObjectGuid.h:33
Definition: SharedDefines.h:4230
float probability
Definition: CreatureTextMgr.h:46
#define TC_GAME_API
Definition: Define.h:134
LocaleCreatureTextMap mLocaleTextMap
Definition: CreatureTextMgr.h:110
CreatureTextMap mTextMap
Definition: CreatureTextMgr.h:109
ChatMsg _msgType
Definition: CreatureTextMgr.h:162
uint8_t uint8
Definition: Define.h:152
std::unordered_map< uint8, CreatureTextGroup > CreatureTextHolder
Definition: CreatureTextMgr.h:74
std::unordered_map< uint32, WorldSession * > SessionMap
Definition: World.h:530
Definition: CreatureTextMgr.h:59
std::vector< WorldPackets::Chat::Chat * > _packetCache
Definition: CreatureTextMgr.h:160
StringVector Text
Definition: CreatureTextMgr.h:56
Definition: WorldPacket.h:26
~CreatureTextMgr()
Definition: CreatureTextMgr.h:83
Definition: CreatureTextMgr.h:79
void operator()(Player *player)
Definition: CreatureTextMgr.h:130
iterator end()
Definition: MapRefManager.h:38
Definition: SharedDefines.h:985
~CreatureTextLocalizer()
Definition: CreatureTextMgr.h:124