TrinityCore
Loading...
Searching...
No Matches
Chat.cpp
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#include "Chat.h"
19#include "AccountMgr.h"
20#include "CellImpl.h"
21#include "CharacterCache.h"
22#include "ChatPackets.h"
23#include "GridNotifiersImpl.h"
24#include "Language.h"
25#include "ObjectAccessor.h"
26#include "ObjectMgr.h"
27#include "Optional.h"
28#include "Player.h"
29#include "Realm.h"
30#include "StringConvert.h"
31#include "World.h"
32#include "WorldSession.h"
33#include <boost/algorithm/string/replace.hpp>
34
35Player* ChatHandler::GetPlayer() const { return m_session ? m_session->GetPlayer() : nullptr; }
36
37char const* ChatHandler::GetTrinityString(uint32 entry) const
38{
39 return m_session->GetTrinityString(entry);
40}
41
42bool ChatHandler::HasPermission(uint32 permission) const
43{
44 return m_session->HasPermission(permission);
45}
46
47std::string ChatHandler::GetNameLink() const
48{
50}
51
52bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
53{
54 WorldSession* target_session = nullptr;
55 uint32 target_account = 0;
57 if (target)
58 target_session = target->GetSession();
59 else if (!guid.IsEmpty())
60 target_account = sCharacterCache->GetCharacterAccountIdByGuid(guid);
61
62 if (!target_session && !target_account)
63 {
66 return true;
67 }
68
69 return HasLowerSecurityAccount(target_session, target_account, strong);
70}
71
72bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_account, bool strong)
73{
74 uint32 target_sec;
75
76 // allow everything from console and RA console
77 if (!m_session)
78 return false;
79
80 // ignore only for non-players for non strong checks (when allow apply command at least to same sec level)
82 return false;
83
84 if (target)
85 target_sec = target->GetSecurity();
86 else if (target_account)
87 target_sec = AccountMgr::GetSecurity(target_account, realm.Id.Realm);
88 else
89 return true; // caller must report error for (target == nullptr && target_account == 0)
90
91 AccountTypes target_ac_sec = AccountTypes(target_sec);
92 if (m_session->GetSecurity() < target_ac_sec || (strong && m_session->GetSecurity() <= target_ac_sec))
93 {
96 return true;
97 }
98
99 return false;
100}
101
102void ChatHandler::SendSysMessage(std::string_view str, bool escapeCharacters)
103{
104 std::string msg{ str };
105
106 // Replace every "|" with "||" in msg
107 if (escapeCharacters && msg.find('|') != std::string::npos)
108 {
109 std::vector<std::string_view> tokens = Trinity::Tokenize(msg, '|', true);
110 std::ostringstream stream;
111 for (size_t i = 0; i < tokens.size() - 1; ++i)
112 stream << tokens[i] << "||";
113 stream << tokens[tokens.size() - 1];
114
115 msg = stream.str();
116 }
117
119 for (std::string_view line : Trinity::Tokenize(str, '\n', true))
120 {
121 packet.Initialize(CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
122 m_session->SendPacket(packet.Write());
123 }
124}
125
127{
129 for (std::string_view line : Trinity::Tokenize(str, '\n', true))
130 {
131 packet.Initialize(CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
132 sWorld->SendGlobalMessage(packet.Write());
133 }
134}
135
137{
139 for (std::string_view line : Trinity::Tokenize(str, '\n', true))
140 {
141 packet.Initialize(CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
142 sWorld->SendGlobalGMMessage(packet.Write());
143 }
144}
145
150
151std::string ChatHandler::StringVPrintf(std::string_view messageFormat, fmt::printf_args messageFormatArgs)
152{
153 return fmt::vsprintf<char>(messageFormat, messageFormatArgs);
154}
155
156bool ChatHandler::_ParseCommands(std::string_view text)
157{
159 return true;
160
161 // Pretend commands don't exist for regular players
163 return false;
164
165 // Send error message for GMs
168 return true;
169}
170
171bool ChatHandler::ParseCommands(std::string_view text)
172{
173 ASSERT(!text.empty());
174
175 // chat case (.command or !command format)
176 if ((text[0] != '!') && (text[0] != '.'))
177 return false;
178
179 // ignore single . and ! in line
180 if (text.length() < 2)
181 return false;
182
183 // ignore messages staring from many dots.
184 if (text[1] == text[0])
185 return false;
186
187 // ignore messages with separator after .
189 return false;
190
191 return _ParseCommands(text.substr(1));
192}
193
195{
196 if (!m_session)
197 return nullptr;
198
199 ObjectGuid selected = m_session->GetPlayer()->GetTarget();
200 if (!selected)
201 return m_session->GetPlayer();
202
204}
205
207{
208 if (!m_session)
209 return nullptr;
210
211 if (Unit* selected = m_session->GetPlayer()->GetSelectedUnit())
212 return selected;
213
214 return m_session->GetPlayer();
215}
216
218{
219 if (!m_session)
220 return nullptr;
221
223
224 if (!guid)
225 return GetNearbyGameObject();
226
228}
229
237
239{
240 if (!m_session)
241 return nullptr;
242
243 ObjectGuid selected = m_session->GetPlayer()->GetTarget();
244 if (!selected)
245 return m_session->GetPlayer();
246
247 // first try with selected target
248 Player* targetPlayer = ObjectAccessor::FindConnectedPlayer(selected);
249 // if the target is not a player, then return self
250 if (!targetPlayer)
251 targetPlayer = m_session->GetPlayer();
252
253 return targetPlayer;
254}
255
256char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** something1)
257{
258 // skip empty
259 if (!text)
260 return nullptr;
261
262 // skip spaces
263 while (*text == ' '||*text == '\t'||*text == '\b')
264 ++text;
265
266 if (!*text)
267 return nullptr;
268
269 // return non link case
270 if (text[0] != '|')
271 return strtok(text, " ");
272
273 // [name] Shift-click form |color|linkType:key|h[name]|h|r
274 // or
275 // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
276
277 char* check = strtok(text, "|"); // skip color
278 if (!check)
279 return nullptr; // end of data
280
281 char* cLinkType = strtok(nullptr, ":"); // linktype
282 if (!cLinkType)
283 return nullptr; // end of data
284
285 if (strcmp(cLinkType, linkType) != 0)
286 {
287 strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after retturn from function
289 return nullptr;
290 }
291
292 char* cKeys = strtok(nullptr, "|"); // extract keys and values
293 char* cKeysTail = strtok(nullptr, "");
294
295 char* cKey = strtok(cKeys, ":|"); // extract key
296 if (something1)
297 *something1 = strtok(nullptr, ":|"); // extract something
298
299 strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces
300 strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after return from function
301 return cKey;
302}
303
304char* ChatHandler::extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1)
305{
306 // skip empty
307 if (!text)
308 return nullptr;
309
310 // skip spaces
311 while (*text == ' '||*text == '\t'||*text == '\b')
312 ++text;
313
314 if (!*text)
315 return nullptr;
316
317 // return non link case
318 if (text[0] != '|')
319 return strtok(text, " ");
320
321 // [name] Shift-click form |color|linkType:key|h[name]|h|r
322 // or
323 // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
324 // or
325 // [name] Shift-click form |linkType:key|h[name]|h|r
326
327 char* tail;
328
329 if (text[1] == 'c')
330 {
331 char* check = strtok(text, "|"); // skip color
332 if (!check)
333 return nullptr; // end of data
334
335 tail = strtok(nullptr, ""); // tail
336 }
337 else
338 tail = text+1; // skip first |
339
340 char* cLinkType = strtok(tail, ":"); // linktype
341 if (!cLinkType)
342 return nullptr; // end of data
343
344 for (int i = 0; linkTypes[i]; ++i)
345 {
346 if (strcmp(cLinkType, linkTypes[i]) == 0)
347 {
348 char* cKeys = strtok(nullptr, "|"); // extract keys and values
349 char* cKeysTail = strtok(nullptr, "");
350
351 char* cKey = strtok(cKeys, ":|"); // extract key
352 if (something1)
353 *something1 = strtok(nullptr, ":|"); // extract something
354
355 strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces
356 strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after return from function
357 if (found_idx)
358 *found_idx = i;
359 return cKey;
360 }
361 }
362
363 strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after return from function
365 return nullptr;
366}
367
369{
370 if (!m_session)
371 return nullptr;
372
373 Player* pl = m_session->GetPlayer();
374 GameObject* obj = nullptr;
378 return obj;
379}
380
382{
383 if (!m_session)
384 return nullptr;
385 auto bounds = m_session->GetPlayer()->GetMap()->GetGameObjectBySpawnIdStore().equal_range(lowguid);
386 if (bounds.first != bounds.second)
387 return bounds.first->second;
388 return nullptr;
389}
390
392{
393 if (!m_session)
394 return nullptr;
395 // Select the first alive creature or a dead one if not found
396 Creature* creature = nullptr;
397 auto bounds = m_session->GetPlayer()->GetMap()->GetCreatureBySpawnIdStore().equal_range(lowguid);
398 for (auto it = bounds.first; it != bounds.second; ++it)
399 {
400 creature = it->second;
401 if (it->second->IsAlive())
402 break;
403 }
404 return creature;
405}
406
408{
409 GUID_LINK_PLAYER = 0, // must be first for selection in not link case
413
414static char const* const guidKeys[] =
415{
416 "Hplayer",
417 "Hcreature",
418 "Hgameobject",
419 nullptr
420};
421
423{
424 int type = 0;
425
426 // |color|Hcreature:creature_guid|h[name]|h|r
427 // |color|Hgameobject:go_guid|h[name]|h|r
428 // |color|Hplayer:name|h[name]|h|r
429 char* idS = extractKeyFromLink(text, guidKeys, &type);
430 if (!idS)
431 return 0;
432
433 switch (type)
434 {
435 case GUID_LINK_PLAYER:
436 {
437 guidHigh = HighGuid::Player;
438 std::string name = idS;
439 if (!normalizePlayerName(name))
440 return 0;
441
442 if (Player* player = ObjectAccessor::FindPlayerByName(name))
443 return player->GetGUID().GetCounter();
444
445 ObjectGuid guid = sCharacterCache->GetCharacterGuidByName(name);
446 return guid.GetCounter();
447
448 }
450 {
451 guidHigh = HighGuid::Unit;
452 ObjectGuid::LowType lowguid = Trinity::StringTo<ObjectGuid::LowType>(idS).value_or(0);
453 return lowguid;
454 }
456 {
457 guidHigh = HighGuid::GameObject;
458 ObjectGuid::LowType lowguid = Trinity::StringTo<ObjectGuid::LowType>(idS).value_or(0);
459 return lowguid;
460 }
461 }
462
463 // unknown type?
464 return 0;
465}
466
468{
469 // |color|Hplayer:name|h[name]|h|r
470 char* name_str = extractKeyFromLink(text, "Hplayer");
471 if (!name_str)
472 return "";
473
474 std::string name = name_str;
475 if (!normalizePlayerName(name))
476 return "";
477
478 return name;
479}
480
481bool ChatHandler::extractPlayerTarget(char* args, Player** player, ObjectGuid* player_guid /*=nullptr*/, std::string* player_name /*= nullptr*/)
482{
483 if (args && *args)
484 {
485 std::string name = extractPlayerNameFromLink(args);
486 if (name.empty())
487 {
490 return false;
491 }
492
494
495 // if allowed player pointer
496 if (player)
497 *player = pl;
498
499 // if need guid value from DB (in name case for check player existence)
500 ObjectGuid guid = !pl && (player_guid || player_name) ? sCharacterCache->GetCharacterGuidByName(name) : ObjectGuid::Empty;
501
502 // if allowed player guid (if no then only online players allowed)
503 if (player_guid)
504 *player_guid = pl ? pl->GetGUID() : guid;
505
506 if (player_name)
507 *player_name = pl || !guid.IsEmpty() ? name : "";
508 }
509 else
510 {
511 // populate strtok buffer to prevent crashes
512 static char dummy[1] = "";
513 strtok(dummy, "");
514
516 // if allowed player pointer
517 if (player)
518 *player = pl;
519 // if allowed player guid (if no then only online players allowed)
520 if (player_guid)
521 *player_guid = pl ? pl->GetGUID() : ObjectGuid::Empty;
522
523 if (player_name)
524 *player_name = pl ? pl->GetName() : "";
525 }
526
527 // some from req. data must be provided (note: name is empty if player does not exist)
528 if ((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty()))
529 {
532 return false;
533 }
534
535 return true;
536}
537
539{
540 if (!args || !*args)
541 return nullptr;
542
543 if (*args == '"')
544 return strtok(args+1, "\"");
545 else
546 {
547 // skip spaces
548 while (*args == ' ')
549 {
550 args += 1;
551 continue;
552 }
553
554 // return nullptr if we reached the end of the string
555 if (!*args)
556 return nullptr;
557
558 // since we skipped all spaces, we expect another token now
559 if (*args == '"')
560 {
561 // return an empty string if there are 2 "" in a row.
562 // strtok doesn't handle this case
563 if (*(args + 1) == '"')
564 {
565 strtok(args, " ");
566 static char arg[1];
567 arg[0] = '\0';
568 return arg;
569 }
570 else
571 return strtok(args + 1, "\"");
572 }
573 else
574 return nullptr;
575 }
576}
577
579{
580 Player* pl = m_session->GetPlayer();
581 return pl != chr && pl->IsVisibleGloballyFor(chr);
582}
583
588
593
594std::string ChatHandler::GetNameLink(Player const* chr) const
595{
596 return playerLink(chr->GetName());
597}
598
599char const* CliHandler::GetTrinityString(uint32 entry) const
600{
601 return sObjectMgr->GetTrinityStringForDBCLocale(entry);
602}
603
604void CliHandler::SendSysMessage(std::string_view str, bool /*escapeCharacters*/)
605{
607 m_print(m_callbackArg, "\r\n");
608}
609
610bool CliHandler::ParseCommands(std::string_view str)
611{
612 if (str.empty())
613 return false;
614 // Console allows using commands both with and without leading indicator
615 if (str[0] == '.' || str[0] == '!')
616 str = str.substr(1);
617 return _ParseCommands(str);
618}
619
620std::string CliHandler::GetNameLink() const
621{
623}
624
626{
627 return true;
628}
629
630bool ChatHandler::GetPlayerGroupAndGUIDByName(char const* cname, Player*& player, Group*& group, ObjectGuid& guid, bool offline)
631{
632 player = nullptr;
633 guid.Clear();
634
635 if (cname)
636 {
637 std::string name = cname;
638 if (!name.empty())
639 {
640 if (!normalizePlayerName(name))
641 {
644 return false;
645 }
646
648 if (offline)
649 guid = sCharacterCache->GetCharacterGuidByName(name);
650 }
651 }
652
653 if (player)
654 {
655 group = player->GetGroup();
656 if (!guid || !offline)
657 guid = player->GetGUID();
658 }
659 else
660 {
661 if (getSelectedPlayer())
662 player = getSelectedPlayer();
663 else
664 player = m_session->GetPlayer();
665
666 if (!guid || !offline)
667 guid = player->GetGUID();
668 group = player->GetGroup();
669 }
670
671 return true;
672}
673
675{
676 return sWorld->GetDefaultDbcLocale();
677}
678
680{
681 return sObjectMgr->GetDBCLocaleIndex();
682}
683
684std::string_view const AddonChannelCommandHandler::PREFIX = "TrinityCore";
685
687{
688 if (str.length() < 17)
689 return false;
690 if (!StringStartsWith(str, "TrinityCore\t"))
691 return false;
692 char opcode = str[12];
693 echo = &str[13];
694
695 switch (opcode)
696 {
697 case 'p': // p Ping
698 SendAck();
699 return true;
700 case 'h': // h Issue human-readable command
701 case 'i': // i Issue command
702 {
703 if (!str[17])
704 return false;
705 humanReadable = (opcode == 'h');
706 std::string_view cmd = str.substr(17);
707 if (_ParseCommands(cmd)) // actual command starts at str[17]
708 {
709 if (!hadAck)
710 SendAck();
712 SendFailed();
713 else
714 SendOK();
715 }
716 else
717 {
719 SendFailed();
720 }
721 return true;
722 }
723 default:
724 return false;
725 }
726}
727
734
735void AddonChannelCommandHandler::SendAck() // a Command acknowledged, no body
736{
737 ASSERT(echo);
738 char ack[5] = "a";
739 memcpy(ack + 1, echo, 4);
740 Send(std::string_view(ack, 5));
741 hadAck = true;
742}
743
744void AddonChannelCommandHandler::SendOK() // o Command OK, no body
745{
746 ASSERT(echo);
747 char ok[5] = "o";
748 memcpy(ok + 1, echo, 4);
749 Send(std::string_view(ok, 5));
750}
751
752void AddonChannelCommandHandler::SendFailed() // f Command failed, no body
753{
754 ASSERT(echo);
755 char fail[5] = "f";
756 memcpy(fail + 1, echo, 4);
757 Send(std::string_view(fail, 5));
758}
759
760// m Command message, message in body
761void AddonChannelCommandHandler::SendSysMessage(std::string_view str, bool escapeCharacters)
762{
763 ASSERT(echo);
764 if (!hadAck)
765 SendAck();
766
767 std::string msg = "m";
768 msg.append(echo, 4);
769 std::string body(str);
770 if (escapeCharacters)
771 boost::replace_all(body, "|", "||");
772 size_t pos, lastpos;
773 for (lastpos = 0, pos = body.find('\n', lastpos); pos != std::string::npos; lastpos = pos + 1, pos = body.find('\n', lastpos))
774 {
775 std::string line(msg);
776 line.append(body, lastpos, pos - lastpos);
777 Send(line);
778 }
779 msg.append(body, lastpos, pos - lastpos);
780 Send(msg);
781}
#define sCharacterCache
GuidLinkType
Definition Chat.cpp:408
@ GUID_LINK_CREATURE
Definition Chat.cpp:410
@ GUID_LINK_GAMEOBJECT
Definition Chat.cpp:411
@ GUID_LINK_PLAYER
Definition Chat.cpp:409
static char const *const guidKeys[]
Definition Chat.cpp:414
LocaleConstant
Definition Common.h:48
@ LOCALE_enUS
Definition Common.h:49
AccountTypes
Definition Common.h:39
#define STRING_VIEW_FMT_ARG(str)
Definition Define.h:126
uint32_t uint32
Definition Define.h:133
#define ASSERT
Definition Errors.h:68
#define SIZE_OF_GRIDS
Definition GridDefines.h:38
@ LANG_CONSOLE_COMMAND
Definition Language.h:214
@ LANG_CMD_INVALID
Definition Language.h:38
@ LANG_YOURS_SECURITY_IS_LOW
Definition Language.h:460
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:570
@ LANG_WRONG_LINK_TYPE
Definition Language.h:585
HighGuid
Definition ObjectGuid.h:63
bool normalizePlayerName(std::string &name)
#define sObjectMgr
Definition ObjectMgr.h:1721
@ LANG_UNIVERSAL
@ LANG_ADDON
@ CHAT_MSG_WHISPER
@ CHAT_MSG_SYSTEM
bool StringStartsWith(std::string_view haystack, std::string_view needle)
Definition Util.h:363
static uint32 GetSecurity(uint32 accountId, int32 realmId)
char const * echo
Definition Chat.h:175
void SendSysMessage(std::string_view, bool escapeCharacters) override
Definition Chat.cpp:761
bool ParseCommands(std::string_view str) override
Definition Chat.cpp:686
static std::string_view const PREFIX
Definition Chat.h:161
void Send(std::string_view msg)
Definition Chat.cpp:728
char * extractKeyFromLink(char *text, char const *linkType, char **something1=nullptr)
Definition Chat.cpp:256
Player * getSelectedPlayerOrSelf()
Definition Chat.cpp:238
bool GetPlayerGroupAndGUIDByName(char const *cname, Player *&player, Group *&group, ObjectGuid &guid, bool offline=false)
Definition Chat.cpp:630
virtual bool HasPermission(uint32 permission) const
Definition Chat.cpp:42
std::string playerLink(std::string const &name) const
Definition Chat.h:119
char * extractQuotedArg(char *args)
Definition Chat.cpp:538
Unit * getSelectedUnit()
Definition Chat.cpp:206
void SendGlobalGMSysMessage(const char *str)
Definition Chat.cpp:136
virtual LocaleConstant GetSessionDbLocaleIndex() const
Definition Chat.cpp:589
Player * getSelectedPlayer()
Definition Chat.cpp:194
WorldSession * GetSession()
Definition Chat.h:46
void SendGlobalSysMessage(const char *str)
Definition Chat.cpp:126
bool HasSentErrorMessage() const
Definition Chat.h:125
virtual LocaleConstant GetSessionDbcLocale() const
Definition Chat.cpp:584
virtual std::string GetNameLink() const
Definition Chat.cpp:47
WorldSession * m_session
Definition Chat.h:131
Creature * GetCreatureFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
Definition Chat.cpp:391
static std::string StringVPrintf(std::string_view messageFormat, fmt::printf_args messageFormatArgs)
Definition Chat.cpp:151
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition Chat.cpp:52
Creature * getSelectedCreature()
Definition Chat.cpp:230
GameObject * GetObjectFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
Definition Chat.cpp:381
void SetSentErrorMessage(bool val)
Definition Chat.h:126
Player * GetPlayer() const
Definition Chat.cpp:35
void PSendSysMessage(char const *fmt, Args &&... args)
Definition Chat.h:61
WorldObject * getSelectedObject()
Definition Chat.cpp:217
virtual bool ParseCommands(std::string_view text)
Definition Chat.cpp:171
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:102
virtual bool needReportToTarget(Player *chr) const
Definition Chat.cpp:578
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=nullptr, std::string *player_name=nullptr)
Definition Chat.cpp:481
std::string extractPlayerNameFromLink(char *text)
Definition Chat.cpp:467
bool _ParseCommands(std::string_view text)
Definition Chat.cpp:156
GameObject * GetNearbyGameObject()
Definition Chat.cpp:368
ObjectGuid::LowType extractLowGuidFromLink(char *text, HighGuid &guidHigh)
Definition Chat.cpp:422
bool HasLowerSecurityAccount(WorldSession *target, uint32 account, bool strong=false)
Definition Chat.cpp:72
virtual char const * GetTrinityString(uint32 entry) const
Definition Chat.cpp:37
LocaleConstant GetSessionDbLocaleIndex() const override
Definition Chat.cpp:679
LocaleConstant GetSessionDbcLocale() const override
Definition Chat.cpp:674
void SendSysMessage(std::string_view, bool escapeCharacters) override
Definition Chat.cpp:604
void * m_callbackArg
Definition Chat.h:154
Print * m_print
Definition Chat.h:155
bool ParseCommands(std::string_view str) override
Definition Chat.cpp:610
char const * GetTrinityString(uint32 entry) const override
Definition Chat.cpp:599
bool needReportToTarget(Player *chr) const override
Definition Chat.cpp:625
std::string GetNameLink() const override
Definition Chat.cpp:620
Definition Group.h:165
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition Map.h:516
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition Map.h:512
LowType GetCounter() const
Definition ObjectGuid.h:156
static ObjectGuid const Empty
Definition ObjectGuid.h:140
bool IsEmpty() const
Definition ObjectGuid.h:172
uint32 LowType
Definition ObjectGuid.h:142
void Clear()
Definition ObjectGuid.h:150
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
WorldSession * GetSession() const
Definition Player.h:1705
Group * GetGroup()
Definition Player.h:2159
bool IsVisibleGloballyFor(Player const *player) const
Definition Player.cpp:22110
Unit * GetSelectedUnit() const
Definition Player.cpp:22374
Definition Unit.h:783
ObjectGuid GetTarget() const
Definition Unit.h:1813
Map * GetMap() const
Definition Object.h:451
std::string const & GetName() const
Definition Object.h:384
void Initialize(ChatMsg chatType, Language language, WorldObject const *sender, WorldObject const *receiver, std::string_view message, uint32 achievementId=0, std::string_view channelName="", LocaleConstant locale=DEFAULT_LOCALE, std::string_view addonPrefix="")
WorldPacket const * Write() override
Player session in the World.
char const * GetTrinityString(uint32 entry) const
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
AccountTypes GetSecurity() const
LocaleConstant GetSessionDbLocaleIndex() const
LocaleConstant GetSessionDbcLocale() const
Player * GetPlayer() const
bool HasPermission(uint32 permissionId)
#define sWorld
Definition World.h:901
Realm realm
Definition World.cpp:3610
@ CONFIG_GM_LOWER_SECURITY
Definition World.h:108
TC_GAME_API Player * FindPlayerByName(std::string_view name)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
TC_GAME_API Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const &)
TC_GAME_API bool TryExecuteCommand(ChatHandler &handler, std::string_view cmd)
static constexpr char COMMAND_DELIMITER
TC_COMMON_API std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition Util.cpp:56
@ RBAC_PERM_COMMANDS_NOTIFY_COMMAND_NOT_FOUND_ERROR
Definition RBAC.h:86
@ RBAC_PERM_CAN_IGNORE_LOWER_SECURITY_CHECK
Definition RBAC.h:100
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:168
uint32 Realm
Definition Realm.h:44
RealmHandle Id
Definition Realm.h:67