AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ChatHandler Class Reference

#include "Chat.h"

Inheritance diagram for ChatHandler:
AddonChannelCommandHandler CliHandler

Public Member Functions

 ChatHandler (WorldSession *session)
 
virtual ~ChatHandler ()
 
void SendNotification (std::string_view str)
 
template<typename... Args>
void SendNotification (uint32 strId, Args &&... args)
 
template<typename... Args>
void SendNotification (char const *fmt, Args &&... args)
 
void SendGMText (std::string_view str)
 
template<typename... Args>
void SendGMText (uint32 strId, Args &&... args)
 
template<typename... Args>
void SendGMText (char const *fmt, Args &&... args)
 
void SendWorldText (std::string_view str)
 
template<typename... Args>
void SendWorldText (uint32 strId, Args &&... args)
 
template<typename... Args>
void SendWorldText (char const *fmt, Args &&... args)
 
void SendWorldTextOptional (std::string_view str, uint32 flag)
 
template<typename... Args>
void SendWorldTextOptional (uint32 strId, uint32 flag, Args &&... args)
 
template<typename... Args>
void SendWorldTextOptional (char const *fmt, uint32 flag, Args &&... args)
 
virtual std::string GetAcoreString (uint32 entry) const
 
virtual void SendSysMessage (std::string_view str, bool escapeCharacters=false)
 
void SendSysMessage (uint32 entry)
 
void PSendSysMessage (std::string_view str, bool escapeCharacters=false)
 
template<typename... Args>
void PSendSysMessage (char const *fmt, Args &&... args)
 
template<typename... Args>
void PSendSysMessage (uint32 entry, Args &&... args)
 
template<typename... Args>
std::string PGetParseString (uint32 entry, Args &&... args) const
 
virtual std::string const * GetModuleString (std::string module, uint32 id) const
 
template<typename... Args>
void PSendModuleSysMessage (std::string module, uint32 id, Args &&... args)
 
template<typename... Args>
std::string PGetParseModuleString (std::string module, uint32 id, Args &&... args) const
 
void SendErrorMessage (uint32 entry)
 
void SendErrorMessage (std::string_view str, bool escapeCharacters)
 
template<typename... Args>
void SendErrorMessage (char const *fmt, Args &&... args)
 
template<typename... Args>
void SendErrorMessage (uint32 entry, Args &&... args)
 
bool _ParseCommands (std::string_view text)
 
virtual bool ParseCommands (std::string_view text)
 
void SendGlobalSysMessage (char const *str)
 
virtual bool IsHumanReadable () const
 
virtual std::string GetNameLink () const
 
virtual bool needReportToTarget (Player *chr) const
 
virtual LocaleConstant GetSessionDbcLocale () const
 
virtual int GetSessionDbLocaleIndex () const
 
bool HasLowerSecurity (Player *target, ObjectGuid guid=ObjectGuid::Empty, bool strong=false)
 
bool HasLowerSecurityAccount (WorldSession *target, uint32 account, bool strong=false)
 
void SendGlobalGMSysMessage (char const *str)
 
Player * getSelectedPlayer () const
 
Creature * getSelectedCreature () const
 
Unit * getSelectedUnit () const
 
WorldObject * getSelectedObject () const
 
Player * getSelectedPlayerOrSelf () const
 
virtual bool HasSession () const
 
void DoForAllValidSessions (std::function< void(Player *)> exec)
 
char * extractKeyFromLink (char *text, char const *linkType, char **something1=nullptr)
 
char * extractKeyFromLink (char *text, char const *const *linkTypes, int *found_idx, char **something1=nullptr)
 
char * extractQuotedArg (char *args)
 
uint32 extractSpellIdFromLink (char *text)
 
ObjectGuid::LowType extractLowGuidFromLink (char *text, HighGuid &guidHigh)
 
bool GetPlayerGroupAndGUIDByName (char const *cname, Player *&player, Group *&group, ObjectGuid &guid, bool offline=false)
 
std::string extractPlayerNameFromLink (char *text)
 
bool extractPlayerTarget (char *args, Player **player, ObjectGuid *player_guid=nullptr, std::string *player_name=nullptr)
 
std::string playerLink (std::string const &name) const
 
std::string GetNameLink (Player *chr) const
 
GameObject * GetNearbyGameObject () const
 
GameObject * GetObjectFromPlayerMapByDbGuid (ObjectGuid::LowType lowguid)
 
Creature * GetCreatureFromPlayerMapByDbGuid (ObjectGuid::LowType lowguid)
 
bool HasSentErrorMessage () const
 
void SetSentErrorMessage (bool val)
 
bool IsConsole () const
 
Player * GetPlayer () const
 
WorldSession * GetSession ()
 
bool IsAvailable (uint32 securityLevel) const
 
bool HasPermission (uint32 permissionId) const
 

Static Public Member Functions

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="")
 
static std::size_t BuildChatPacket (WorldPacket &data, ChatMsg chatType, Language language, WorldObject const *sender, WorldObject const *receiver, std::string_view message, uint32 achievementId=0, std::string const &channelName="", LocaleConstant locale=DEFAULT_LOCALE)
 
static char * LineFromMessage (char *&pos)
 

Protected Member Functions

 ChatHandler ()
 

Private Attributes

WorldSession * m_session
 
bool sentErrorMessage
 

Detailed Description

Constructor & Destructor Documentation

◆ ChatHandler() [1/2]

ChatHandler::ChatHandler ( WorldSession *  session)
inlineexplicit
39: m_session(session), sentErrorMessage(false) {}
WorldSession * m_session
Definition Chat.h:249
bool sentErrorMessage
Definition Chat.h:252

◆ ~ChatHandler()

virtual ChatHandler::~ChatHandler ( )
inlinevirtual
40{ }

◆ ChatHandler() [2/2]

ChatHandler::ChatHandler ( )
inlineexplicitprotected
246: m_session(nullptr), sentErrorMessage(false) {} // for CLI subclass

Member Function Documentation

◆ _ParseCommands()

bool ChatHandler::_ParseCommands ( std::string_view  text)
237{
239 return true;
240
241 // Pretend commands don't exist for regular players
243 return false;
244
245 // Send error message for GMs
247 return true;
248}
@ LANG_CMD_INVALID
Definition Language.h:38
@ CONFIG_ALLOW_PLAYER_COMMANDS
Definition WorldConfig.h:27
void SendErrorMessage(uint32 entry)
Definition Chat.cpp:224
bool HasPermission(uint32 permissionId)
Definition WorldSession.cpp:1691
#define sWorld
Definition World.h:318
AC_GAME_API bool TryExecuteCommand(ChatHandler &handler, std::string_view cmd)
Definition ChatCommand.cpp:537
@ RBAC_PERM_COMMANDS_NOTIFY_COMMAND_NOT_FOUND_ERROR
Definition RBAC.h:84

References CONFIG_ALLOW_PLAYER_COMMANDS, WorldSession::HasPermission(), LANG_CMD_INVALID, m_session, rbac::RBAC_PERM_COMMANDS_NOTIFY_COMMAND_NOT_FOUND_ERROR, SendErrorMessage(), sWorld, and Acore::ChatCommands::TryExecuteCommand().

Referenced by CliHandler::ParseCommands(), AddonChannelCommandHandler::ParseCommands(), and ParseCommands().

◆ BuildChatPacket() [1/2]

std::size_t ChatHandler::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 = "" 
)
static
276{
277 std::size_t receiverGUIDPos = 0;
279 data << uint8(chatType);
280 data << int32(language);
281 data << senderGUID;
282 data << uint32(0); // some flags
283 switch (chatType)
284 {
293 data << uint32(senderName.length() + 1);
294 data << senderName;
295 receiverGUIDPos = data.wpos();
296 data << receiverGUID;
297 if (receiverGUID && !receiverGUID.IsPlayer() && !receiverGUID.IsPet())
298 {
299 data << uint32(receiverName.length() + 1);
300 data << receiverName;
301 }
302 break;
304 data << uint32(senderName.length() + 1);
305 data << senderName;
306 receiverGUIDPos = data.wpos();
307 data << receiverGUID;
308 break;
312 receiverGUIDPos = data.wpos();
313 data << receiverGUID;
314 if (receiverGUID && !receiverGUID.IsPlayer())
315 {
316 data << uint32(receiverName.length() + 1);
317 data << receiverName;
318 }
319 break;
322 receiverGUIDPos = data.wpos();
323 data << receiverGUID;
324 break;
325 default:
326 if (gmMessage)
327 {
328 data << uint32(senderName.length() + 1);
329 data << senderName;
330 }
331
332 if (chatType == CHAT_MSG_CHANNEL)
333 {
334 ASSERT(channelName.length() > 0);
335 data << channelName;
336 }
337
338 receiverGUIDPos = data.wpos();
339 data << receiverGUID;
340 break;
341 }
342
343 data << uint32(message.length() + 1);
344 data << message;
345 data << uint8(chatTag);
346
347 if (chatType == CHAT_MSG_ACHIEVEMENT || chatType == CHAT_MSG_GUILD_ACHIEVEMENT)
348 data << uint32(achievementId);
349
350 return receiverGUIDPos;
351}
std::int32_t int32
Definition Define.h:103
std::uint8_t uint8
Definition Define.h:109
std::uint32_t uint32
Definition Define.h:107
#define ASSERT
Definition Errors.h:68
@ CHAT_MSG_MONSTER_WHISPER
Definition SharedDefines.h:3400
@ CHAT_MSG_RAID_BOSS_WHISPER
Definition SharedDefines.h:3427
@ CHAT_MSG_WHISPER_FOREIGN
Definition SharedDefines.h:3393
@ CHAT_MSG_GUILD_ACHIEVEMENT
Definition SharedDefines.h:3434
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
Definition SharedDefines.h:3422
@ CHAT_MSG_MONSTER_PARTY
Definition SharedDefines.h:3398
@ CHAT_MSG_ACHIEVEMENT
Definition SharedDefines.h:3433
@ CHAT_MSG_RAID_BOSS_EMOTE
Definition SharedDefines.h:3426
@ CHAT_MSG_BATTLENET
Definition SharedDefines.h:3432
@ CHAT_MSG_MONSTER_EMOTE
Definition SharedDefines.h:3401
@ CHAT_MSG_MONSTER_SAY
Definition SharedDefines.h:3397
@ CHAT_MSG_MONSTER_YELL
Definition SharedDefines.h:3399
@ CHAT_MSG_BG_SYSTEM_HORDE
Definition SharedDefines.h:3423
@ CHAT_MSG_BG_SYSTEM_NEUTRAL
Definition SharedDefines.h:3421
@ CHAT_MSG_CHANNEL
Definition SharedDefines.h:3402
std::size_t wpos() const
Definition ByteBuffer.h:330
void Initialize(uint16 opcode, std::size_t newres=200)
Definition WorldPacket.h:68
@ SMSG_GM_MESSAGECHAT
Definition Opcodes.h:977
@ SMSG_MESSAGECHAT
Definition Opcodes.h:180

References ASSERT, CHAT_MSG_ACHIEVEMENT, CHAT_MSG_BATTLENET, CHAT_MSG_BG_SYSTEM_ALLIANCE, CHAT_MSG_BG_SYSTEM_HORDE, CHAT_MSG_BG_SYSTEM_NEUTRAL, CHAT_MSG_CHANNEL, CHAT_MSG_GUILD_ACHIEVEMENT, CHAT_MSG_MONSTER_EMOTE, CHAT_MSG_MONSTER_PARTY, CHAT_MSG_MONSTER_SAY, CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_MONSTER_YELL, CHAT_MSG_RAID_BOSS_EMOTE, CHAT_MSG_RAID_BOSS_WHISPER, CHAT_MSG_WHISPER_FOREIGN, WorldPacket::Initialize(), SMSG_GM_MESSAGECHAT, SMSG_MESSAGECHAT, and ByteBuffer::wpos().

Referenced by Guild::BroadcastToGuild(), BuildChatPacket(), Acore::BattlegroundChatBuilder::do_helper(), Acore::WorldWorldTextBuilder::do_helper(), WorldSession::HandleChatIgnoredOpcode(), debug_commandscript::HandleDebugSendChatMsgCommand(), WorldSession::HandleMessagechatOpcode(), npc_spiritual_insight::npc_spiritual_insightAI::IsSummonedBy(), Acore::Battleground2ChatBuilder::operator()(), Acore::BroadcastTextBuilder::operator()(), Acore::CustomChatTextBuilder::operator()(), Acore::AcoreStringChatBuilder::operator()(), Acore::BroadcastTextBuilder::operator()(), CreatureTextBuilder::operator()(), PlayerTextBuilder::operator()(), Channel::Say(), Player::Say(), AddonChannelCommandHandler::Send(), SendGlobalGMSysMessage(), SendGlobalSysMessage(), SendSysMessage(), SendWorldText(), SendWorldTextOptional(), Map::SendZoneText(), Player::TextEmote(), Player::Whisper(), Unit::Whisper(), Unit::Whisper(), Player::Whisper(), Player::Yell(), and Battleground::YellToAll().

◆ BuildChatPacket() [2/2]

std::size_t ChatHandler::BuildChatPacket ( WorldPacket &  data,
ChatMsg  chatType,
Language  language,
WorldObject const *  sender,
WorldObject const *  receiver,
std::string_view  message,
uint32  achievementId = 0,
std::string const &  channelName = "",
LocaleConstant  locale = DEFAULT_LOCALE 
)
static
355{
356 ObjectGuid senderGUID;
357 std::string senderName = "";
358 uint8 chatTag = 0;
359 bool gmMessage = false;
360 ObjectGuid receiverGUID;
361 std::string receiverName = "";
362 if (sender)
363 {
364 senderGUID = sender->GetGUID();
365 senderName = sender->GetNameForLocaleIdx(locale);
366 if (Player const* playerSender = sender->ToPlayer())
367 {
368 chatTag = playerSender->GetChatTag();
369 gmMessage = playerSender->GetSession()->HasPermission(rbac::RBAC_PERM_COMMAND_GM_CHAT);
370 }
371 }
372
373 if (receiver)
374 {
375 receiverGUID = receiver->GetGUID();
376 receiverName = receiver->GetNameForLocaleIdx(locale);
377 }
378
379 return BuildChatPacket(data, chatType, language, senderGUID, receiverGUID, message, chatTag, senderName, receiverName, achievementId, gmMessage, channelName);
380}
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:273
Definition ObjectGuid.h:121
Player * ToPlayer()
Definition Object.h:208
Definition Player.h:1086
@ RBAC_PERM_COMMAND_GM_CHAT
Definition RBAC.h:220

References BuildChatPacket(), Object::GetGUID(), WorldObject::GetNameForLocaleIdx(), rbac::RBAC_PERM_COMMAND_GM_CHAT, and Object::ToPlayer().

◆ DoForAllValidSessions()

void ChatHandler::DoForAllValidSessions ( std::function< void(Player *)>  exec)
453{
454 WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
455 for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
456 if (Player* player = itr->second->GetPlayer())
457 if (player->IsInWorld())
458 exec(player);
459}
#define sWorldSessionMgr
Definition WorldSessionMgr.h:118
std::unordered_map< uint32, WorldSession * > SessionMap
Definition WorldSessionMgr.h:64

References sWorldSessionMgr.

Referenced by AutobroadcastMgr::SendNotificationAnnouncement(), and AutobroadcastMgr::SendWorldAnnouncement().

◆ extractKeyFromLink() [1/2]

char * ChatHandler::extractKeyFromLink ( char *  text,
char const *const *  linkTypes,
int *  found_idx,
char **  something1 = nullptr 
)
510{
511 // skip empty
512 if (!text)
513 return nullptr;
514
515 // skip spaces
516 while (*text == ' ' || *text == '\t' || *text == '\b')
517 ++text;
518
519 if (!*text)
520 return nullptr;
521
522 // return non link case
523 if (text[0] != '|')
524 return strtok(text, " ");
525
526 // [name] Shift-click form |color|linkType:key|h[name]|h|r
527 // or
528 // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
529 // or
530 // [name] Shift-click form |linkType:key|h[name]|h|r
531
532 char* tail;
533
534 if (text[1] == 'c')
535 {
536 char* check = strtok(text, "|"); // skip color
537 if (!check)
538 return nullptr; // end of data
539
540 tail = strtok(nullptr, ""); // tail
541 }
542 else
543 tail = text + 1; // skip first |
544
545 char* cLinkType = strtok(tail, ":"); // linktype
546 if (!cLinkType)
547 return nullptr; // end of data
548
549 for (int i = 0; linkTypes[i]; ++i)
550 {
551 if (strcmp(cLinkType, linkTypes[i]) == 0)
552 {
553 char* cKeys = strtok(nullptr, "|"); // extract keys and values
554 char* cKeysTail = strtok(nullptr, "");
555
556 char* cKey = strtok(cKeys, ":|"); // extract key
557 if (something1)
558 *something1 = strtok(nullptr, ":|"); // extract something
559
560 strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces
561 strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after return from function
562 if (found_idx)
563 *found_idx = i;
564 return cKey;
565 }
566 }
567
568 strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after return from function
570 return nullptr;
571}
@ LANG_WRONG_LINK_TYPE
Definition Language.h:563
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:168

References LANG_WRONG_LINK_TYPE, and SendSysMessage().

◆ extractKeyFromLink() [2/2]

char * ChatHandler::extractKeyFromLink ( char *  text,
char const *  linkType,
char **  something1 = nullptr 
)
462{
463 // skip empty
464 if (!text)
465 return nullptr;
466
467 // skip spaces
468 while (*text == ' ' || *text == '\t' || *text == '\b')
469 ++text;
470
471 if (!*text)
472 return nullptr;
473
474 // return non link case
475 if (text[0] != '|')
476 return strtok(text, " ");
477
478 // [name] Shift-click form |color|linkType:key|h[name]|h|r
479 // or
480 // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r
481
482 char* check = strtok(text, "|"); // skip color
483 if (!check)
484 return nullptr; // end of data
485
486 char* cLinkType = strtok(nullptr, ":"); // linktype
487 if (!cLinkType)
488 return nullptr; // end of data
489
490 if (strcmp(cLinkType, linkType) != 0)
491 {
492 strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after retturn from function
494 return nullptr;
495 }
496
497 char* cKeys = strtok(nullptr, "|"); // extract keys and values
498 char* cKeysTail = strtok(nullptr, "");
499
500 char* cKey = strtok(cKeys, ":|"); // extract key
501 if (something1)
502 *something1 = strtok(nullptr, ":|"); // extract something
503
504 strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces
505 strtok(nullptr, " "); // skip link tail (to allow continue strtok(nullptr, s) use after return from function
506 return cKey;
507}

References LANG_WRONG_LINK_TYPE, and SendSysMessage().

Referenced by extractLowGuidFromLink(), extractPlayerNameFromLink(), and extractSpellIdFromLink().

◆ extractLowGuidFromLink()

ObjectGuid::LowType ChatHandler::extractLowGuidFromLink ( char *  text,
HighGuid &  guidHigh 
)
706{
707 int type = 0;
708
709 // |color|Hcreature:creature_guid|h[name]|h|r
710 // |color|Hgameobject:go_guid|h[name]|h|r
711 // |color|Hplayer:name|h[name]|h|r
712 char* idS = extractKeyFromLink(text, guidKeys, &type);
713 if (!idS)
714 return 0;
715
716 switch (type)
717 {
719 {
720 guidHigh = HighGuid::Player;
721
722 std::string name = idS;
723 if (!normalizePlayerName(name))
724 return 0;
725
726 if (Player* player = ObjectAccessor::FindPlayerByName(name, false))
727 return player->GetGUID().GetCounter();
728
729 if (ObjectGuid guid = sCharacterCache->GetCharacterGuidByName(name))
730 return guid.GetCounter();
731
732 return 0;
733 }
735 {
736 guidHigh = HighGuid::Unit;
737
738 ObjectGuid::LowType lowguid = (uint32)atol(idS);
739
740 if (sObjectMgr->GetCreatureData(lowguid))
741 return lowguid;
742 else
743 return 0;
744 }
746 {
747 guidHigh = HighGuid::GameObject;
748
749 ObjectGuid::LowType lowguid = (uint32)atol(idS);
750
751 if (sObjectMgr->GetGameObjectData(lowguid))
752 return lowguid;
753 else
754 return 0;
755 }
756 }
757
758 // unknown type?
759 return 0;
760}
#define sCharacterCache
Definition CharacterCache.h:88
@ SPELL_LINK_PLAYER
Definition Chat.cpp:692
@ SPELL_LINK_CREATURE
Definition Chat.cpp:693
@ SPELL_LINK_GAMEOBJECT
Definition Chat.cpp:694
static char const *const guidKeys[]
Definition Chat.cpp:697
bool normalizePlayerName(std::string &name)
Definition ObjectMgr.cpp:209
#define sObjectMgr
Definition ObjectMgr.h:1731
char * extractKeyFromLink(char *text, char const *linkType, char **something1=nullptr)
Definition Chat.cpp:461
uint32 LowType
Definition ObjectGuid.h:125
Player * FindPlayerByName(std::string const &name, bool checkInWorld=true)
Definition ObjectAccessor.cpp:295

References extractKeyFromLink(), ObjectAccessor::FindPlayerByName(), GameObject, guidKeys, normalizePlayerName(), Player, sCharacterCache, sObjectMgr, SPELL_LINK_CREATURE, SPELL_LINK_GAMEOBJECT, SPELL_LINK_PLAYER, and Unit.

◆ extractPlayerNameFromLink()

std::string ChatHandler::extractPlayerNameFromLink ( char *  text)
763{
764 // |color|Hplayer:name|h[name]|h|r
765 char* name_str = extractKeyFromLink(text, "Hplayer");
766 if (!name_str)
767 return "";
768
769 std::string name = name_str;
770 if (!normalizePlayerName(name))
771 return "";
772
773 return name;
774}

References extractKeyFromLink(), and normalizePlayerName().

Referenced by extractPlayerTarget().

◆ extractPlayerTarget()

bool ChatHandler::extractPlayerTarget ( char *  args,
Player **  player,
ObjectGuid *  player_guid = nullptr,
std::string *  player_name = nullptr 
)
777{
778 if (args && *args)
779 {
780 std::string name = extractPlayerNameFromLink(args);
781 if (name.empty())
782 {
784 return false;
785 }
786
787 Player* pl = ObjectAccessor::FindPlayerByName(name, false);
788
789 // if allowed player pointer
790 if (player)
791 *player = pl;
792
793 // if need guid value from DB (in name case for check player existence)
794 ObjectGuid guid = !pl && (player_guid || player_name) ? sCharacterCache->GetCharacterGuidByName(name) : ObjectGuid::Empty;
795
796 // if allowed player guid (if no then only online players allowed)
797 if (player_guid)
798 *player_guid = pl ? pl->GetGUID() : guid;
799
800 if (player_name)
801 *player_name = pl || guid ? name : "";
802 }
803 else
804 {
805 // populate strtok buffer to prevent crashes
806 static char dummy[1] = "";
807 strtok(dummy, "");
808
810 // if allowed player pointer
811 if (player)
812 *player = pl;
813
814 // if allowed player guid (if no then only online players allowed)
815 if (player_guid)
816 *player_guid = pl ? pl->GetGUID() : ObjectGuid::Empty;
817
818 if (player_name)
819 *player_name = pl ? pl->GetName() : "";
820 }
821
822 // some from req. data must be provided (note: name is empty if player not exist)
823 if ((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty()))
824 {
826 return false;
827 }
828
829 return true;
830}
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:548
std::string extractPlayerNameFromLink(char *text)
Definition Chat.cpp:762
Player * getSelectedPlayer() const
Definition Chat.cpp:382
static ObjectGuid const Empty
Definition ObjectGuid.h:123
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
std::string const & GetName() const
Definition Object.h:535

References ObjectGuid::Empty, extractPlayerNameFromLink(), ObjectAccessor::FindPlayerByName(), Object::GetGUID(), WorldObject::GetName(), getSelectedPlayer(), LANG_PLAYER_NOT_FOUND, sCharacterCache, and SendErrorMessage().

◆ extractQuotedArg()

char * ChatHandler::extractQuotedArg ( char *  args)
833{
834 if (!*args)
835 return nullptr;
836
837 if (*args == '"')
838 return strtok(args + 1, "\"");
839 else
840 {
841 // skip spaces
842 while (*args == ' ')
843 {
844 args += 1;
845 continue;
846 }
847
848 // return nullptr if we reached the end of the string
849 if (!*args)
850 return nullptr;
851
852 // since we skipped all spaces, we expect another token now
853 if (*args == '"')
854 {
855 // return an empty string if there are 2 "" in a row.
856 // strtok doesn't handle this case
857 if (*(args + 1) == '"')
858 {
859 strtok(args, " ");
860 static char arg[1];
861 arg[0] = '\0';
862 return arg;
863 }
864 else
865 return strtok(args + 1, "\"");
866 }
867 else
868 return nullptr;
869 }
870}

◆ extractSpellIdFromLink()

uint32 ChatHandler::extractSpellIdFromLink ( char *  text)
637{
638 // number or [name] Shift-click form |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r
639 // number or [name] Shift-click form |color|Hglyph:glyph_slot_id:glyph_prop_id|h[%s]|h|r
640 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
641 // number or [name] Shift-click form |color|Htalent:talent_id, rank|h[name]|h|r
642 // number or [name] Shift-click form |color|Htrade:spell_id, skill_id, max_value, cur_value|h[name]|h|r
643 int type = 0;
644 char* param1_str = nullptr;
645 char* idS = extractKeyFromLink(text, spellKeys, &type, &param1_str);
646 if (!idS)
647 return 0;
648
649 uint32 id = (uint32)atol(idS);
650
651 switch (type)
652 {
653 case SPELL_LINK_SPELL:
654 return id;
656 {
657 // talent
658 TalentEntry const* talentEntry = sTalentStore.LookupEntry(id);
659 if (!talentEntry)
660 return 0;
661
662 int32 rank = param1_str ? (uint32)atol(param1_str) : 0;
663 if (rank >= MAX_TALENT_RANK)
664 return 0;
665
666 if (rank < 0)
667 rank = 0;
668
669 return talentEntry->RankID[rank];
670 }
672 case SPELL_LINK_TRADE:
673 return id;
674 case SPELL_LINK_GLYPH:
675 {
676 uint32 glyph_prop_id = param1_str ? (uint32)atol(param1_str) : 0;
677
678 GlyphPropertiesEntry const* glyphPropEntry = sGlyphPropertiesStore.LookupEntry(glyph_prop_id);
679 if (!glyphPropEntry)
680 return 0;
681
682 return glyphPropEntry->SpellId;
683 }
684 }
685
686 // unknown type?
687 return 0;
688}
@ SPELL_LINK_SPELL
Definition Chat.cpp:619
@ SPELL_LINK_GLYPH
Definition Chat.cpp:623
@ SPELL_LINK_TALENT
Definition Chat.cpp:620
@ SPELL_LINK_ENCHANT
Definition Chat.cpp:621
@ SPELL_LINK_TRADE
Definition Chat.cpp:622
static char const *const spellKeys[]
Definition Chat.cpp:626
DBCStorage< TalentEntry > sTalentStore(TalentEntryfmt)
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
#define MAX_TALENT_RANK
Definition DBCStructure.h:1954
Definition DBCStructure.h:1060
uint32 SpellId
Definition DBCStructure.h:1062
Definition DBCStructure.h:1959
std::array< uint32, MAX_TALENT_RANK > RankID
Definition DBCStructure.h:1964

References extractKeyFromLink(), MAX_TALENT_RANK, TalentEntry::RankID, sGlyphPropertiesStore, SPELL_LINK_ENCHANT, SPELL_LINK_GLYPH, SPELL_LINK_SPELL, SPELL_LINK_TALENT, SPELL_LINK_TRADE, GlyphPropertiesEntry::SpellId, spellKeys, and sTalentStore.

◆ GetAcoreString()

std::string ChatHandler::GetAcoreString ( uint32  entry) const
virtual

Reimplemented in CliHandler.

43{
44 return m_session->GetAcoreString(entry);
45}
std::string GetAcoreString(uint32 entry) const
Definition WorldSession.cpp:923

References WorldSession::GetAcoreString(), and m_session.

Referenced by tele_commandscript::DoNameTeleport(), Acore::Impl::ChatCommands::GetAcoreString(), account_commandscript::HandleAccountInfoCommand(), message_commandscript::HandleAnnounceCommand(), ban_commandscript::HandleBanInfoCharacterCommand(), ban_commandscript::HandleBanInfoHelper(), ban_commandscript::HandleBanInfoIPCommand(), bf_commandscript::HandleBattlefieldQueue(), character_commandscript::HandleCharacterReputationCommand(), character_commandscript::HandleCharacterTitlesCommand(), misc_commandscript::HandleCooldownCommand(), event_commandscript::HandleEventActiveListCommand(), event_commandscript::HandleEventInfoCommand(), message_commandscript::HandleGMNotifyCommand(), gm_commandscript::HandleGMVisibleCommand(), group_commandscript::HandleGroupInvitesCommand(), misc_commandscript::HandleKickPlayerCommand(), lookup_commandscript::HandleLookupEventCommand(), lookup_commandscript::HandleLookupFactionCommand(), lookup_commandscript::HandleLookupMapCommand(), lookup_commandscript::HandleLookupQuestCommand(), lookup_commandscript::HandleLookupSkillCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), lookup_commandscript::HandleLookupTitleCommand(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyMoneyCommand(), modify_commandscript::HandleModifyRepCommand(), misc_commandscript::HandleMuteCommand(), misc_commandscript::HandleNearGraveCommand(), message_commandscript::HandleNotifyCommand(), misc_commandscript::HandlePInfoCommand(), rbac_commandscript::HandleRBACListPermissionsCommand(), rbac_commandscript::HandleRBACPermListCommand(), misc_commandscript::HandleSummonCommand(), misc_commandscript::HandleUnstuckCommand(), message_commandscript::HandleWhispersCommand(), list_commandscript::ListAurasCommand(), and SendSysMessage().

◆ GetCreatureFromPlayerMapByDbGuid()

Creature * ChatHandler::GetCreatureFromPlayerMapByDbGuid ( ObjectGuid::LowType  lowguid)
587{
588 if (!m_session)
589 return nullptr;
590
591 // Select the first alive creature or a dead one if not found
592 Creature* creature = nullptr;
593
594 auto bounds = m_session->GetPlayer()->GetMap()->GetCreatureBySpawnIdStore().equal_range(lowguid);
595 for (auto it = bounds.first; it != bounds.second; ++it)
596 {
597 creature = it->second;
598 if (it->second->IsAlive())
599 break;
600 }
601
602 return creature;
603}
Definition Creature.h:47
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition Map.h:361
Map * GetMap() const
Definition Object.h:637
Player * GetPlayer() const
Definition WorldSession.h:503

References Map::GetCreatureBySpawnIdStore(), WorldObject::GetMap(), WorldSession::GetPlayer(), and m_session.

Referenced by npc_commandscript::HandleNpcDeleteCommand(), npc_commandscript::HandleNpcInfoCommand(), npc_commandscript::HandleNpcMoveCommand(), and npc_commandscript::HandleNpcSetMoveTypeCommand().

◆ GetModuleString()

std::string const * ChatHandler::GetModuleString ( std::string  module,
uint32  id 
) const
virtual

Reimplemented in CliHandler.

48{
49 return m_session->GetModuleString(module, id);
50}
std::string const * GetModuleString(std::string module, uint32 id) const
Definition WorldSession.cpp:928

References WorldSession::GetModuleString(), and m_session.

◆ GetNameLink() [1/2]

virtual std::string ChatHandler::GetNameLink ( ) const
inlinevirtual

Reimplemented in CliHandler.

198{ return GetNameLink(m_session->GetPlayer()); }
virtual std::string GetNameLink() const
Definition Chat.h:198

References GetNameLink().

Referenced by modify_commandscript::CheckModifySpeed(), tele_commandscript::DoNameTeleport(), GetNameLink(), misc_commandscript::HandleAddItemCommand(), character_commandscript::HandleCharacterChangeFactionCommand(), character_commandscript::HandleCharacterChangeRaceCommand(), character_commandscript::HandleCharacterCustomizeCommand(), character_commandscript::HandleCharacterLevel(), character_commandscript::HandleCharacterRenameCommand(), misc_commandscript::HandleCooldownCommand(), cheat_commandscript::HandleExploreCheatCommand(), gm_commandscript::HandleGMFlyCommand(), misc_commandscript::HandleGroupSummonCommand(), learn_commandscript::HandleLearnAllDefaultCommand(), Acore::PlayerCommand::HandleLearnSpellCommand(), modify_commandscript::HandleModifyArenaCommand(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyGenderCommand(), modify_commandscript::HandleModifyHonorCommand(), modify_commandscript::HandleModifyHPCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyMoneyCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRepCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), modify_commandscript::HandleModifyScaleCommand(), modify_commandscript::HandleModifySpellCommand(), reset_commandscript::HandleResetItemsAllAndDeleteBagsCommand(), reset_commandscript::HandleResetItemsAllCommand(), reset_commandscript::HandleResetItemsEquippedCommand(), reset_commandscript::HandleResetItemsInBagsCommand(), reset_commandscript::HandleResetItemsInBankCommand(), reset_commandscript::HandleResetItemsInCurrenciesListCommand(), reset_commandscript::HandleResetItemsInVendorBuyBackTabCommand(), reset_commandscript::HandleResetItemsKeyringCommand(), reset_commandscript::HandleResetSpellsCommand(), reset_commandscript::HandleResetTalentsCommand(), misc_commandscript::HandleSetSkillCommand(), cheat_commandscript::HandleTaxiCheatCommand(), tele_commandscript::HandleTeleGroupCommand(), titles_commandscript::HandleTitlesAddCommand(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), and modify_commandscript::NotifyModification().

◆ GetNameLink() [2/2]

std::string ChatHandler::GetNameLink ( Player *  chr) const
889{
890 return playerLink(chr->GetName());
891}
std::string playerLink(std::string const &name) const
Definition Chat.h:231

References WorldObject::GetName(), and playerLink().

◆ GetNearbyGameObject()

GameObject * ChatHandler::GetNearbyGameObject ( ) const
574{
575 if (!m_session)
576 return nullptr;
577
578 Player* pl = m_session->GetPlayer();
579 GameObject* obj = nullptr;
582 Cell::VisitObjects(pl, searcher, SIZE_OF_GRIDS);
583 return obj;
584}
#define SIZE_OF_GRIDS
Definition MapDefines.h:26
Definition GridNotifiers.h:726
Definition GameObject.h:120
Definition GridNotifiers.h:358
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165

References WorldSession::GetPlayer(), m_session, SIZE_OF_GRIDS, and Cell::VisitObjects().

Referenced by getSelectedObject(), debug_commandscript::HandleDebugSendOpcodeCommand(), pooltools_commandscript::HandlePoolAdd(), and pool_commandscript::HandlePoolLookupCommand().

◆ GetObjectFromPlayerMapByDbGuid()

◆ GetPlayer()

Player * ChatHandler::GetPlayer ( ) const
38{
39 return m_session ? m_session->GetPlayer() : nullptr;
40}

References WorldSession::GetPlayer(), and m_session.

Referenced by Acore::ChatCommands::PlayerIdentifier::FromSelf(), Acore::ChatCommands::PlayerIdentifier::FromTarget(), pool_commandscript::GetPoolSpawns(), debug_commandscript::HandleDebugBoundaryCommand(), debug_commandscript::HandleDebugCombatListCommand(), debug_commandscript::HandleDebugCooldownCommand(), debug_commandscript::HandleDebugEnterVehicleCommand(), debug_commandscript::HandleDebugGetItemStateCommand(), debug_commandscript::HandleDebugGetItemValueCommand(), debug_commandscript::HandleDebugItemExpireCommand(), debug_commandscript::HandleDebugLootCommand(), debug_commandscript::HandleDebugMapDataCommand(), debug_commandscript::HandleDebugMod32ValueCommand(), debug_commandscript::HandleDebugMoveflagsCommand(), debug_commandscript::HandleDebugPlayCinematicCommand(), debug_commandscript::HandleDebugPlayMovieCommand(), debug_commandscript::HandleDebugPlayMusicCommand(), debug_commandscript::HandleDebugPlaySoundCommand(), debug_commandscript::HandleDebugSendBuyErrorCommand(), debug_commandscript::HandleDebugSendChatMsgCommand(), debug_commandscript::HandleDebugSendEquipErrorCommand(), debug_commandscript::HandleDebugSendQuestInvalidMsgCommand(), debug_commandscript::HandleDebugSendQuestPartyMsgCommand(), debug_commandscript::HandleDebugSendSellErrorCommand(), debug_commandscript::HandleDebugSetItemValueCommand(), debug_commandscript::HandleDebugSpawnVehicleCommand(), debug_commandscript::HandleDebugThreatListCommand(), debug_commandscript::HandleDebugUpdateWorldStateCommand(), debug_commandscript::HandleDebugVisibilityDataCommand(), debug_commandscript::HandleDebugVisualCommand(), gm_commandscript::HandleGMOffCommand(), gm_commandscript::HandleGMOnCommand(), learn_commandscript::HandleLearnAllLangCommand(), learn_commandscript::HandleLearnAllMyQuestSpells(), learn_commandscript::HandleLearnAllMyTrainerSpellsCommand(), Acore::PlayerCommand::HandleLearnSpellCommand(), misc_commandscript::HandleOpenDoorCommand(), pooltools_commandscript::HandlePoolAdd(), pooltools_commandscript::HandlePoolClear(), pooltools_commandscript::HandlePoolDef(), pooltools_commandscript::HandlePoolEnd(), pooltools_commandscript::HandlePoolRemove(), pooltools_commandscript::HandlePoolStart(), reload_commandscript::HandleReloadMotdCommand(), player_settings_commandscript::HandleSettingsAnnouncerFlags(), and AddonChannelCommandHandler::Send().

◆ GetPlayerGroupAndGUIDByName()

bool ChatHandler::GetPlayerGroupAndGUIDByName ( char const *  cname,
Player *&  player,
Group *&  group,
ObjectGuid &  guid,
bool  offline = false 
)
932{
933 player = nullptr;
934 guid = ObjectGuid::Empty;
935
936 if (cname)
937 {
938 std::string name = cname;
939 if (!name.empty())
940 {
941 if (!normalizePlayerName(name))
942 {
944 return false;
945 }
946
947 player = ObjectAccessor::FindPlayerByName(name, false);
948 if (offline)
949 {
950 guid = sCharacterCache->GetCharacterGuidByName(name);
951 }
952 }
953 }
954
955 if (player)
956 {
957 group = player->GetGroup();
958 if (!guid || !offline)
959 guid = player->GetGUID();
960 }
961 else
962 {
963 if (getSelectedPlayer())
964 player = getSelectedPlayer();
965 else
966 player = m_session->GetPlayer();
967
968 if (!guid || !offline)
969 guid = player->GetGUID();
970 group = player->GetGroup();
971 }
972
973 return true;
974}
Group * GetGroup()
Definition Player.h:2517

References ObjectGuid::Empty, ObjectAccessor::FindPlayerByName(), Player::GetGroup(), Object::GetGUID(), WorldSession::GetPlayer(), getSelectedPlayer(), LANG_PLAYER_NOT_FOUND, m_session, normalizePlayerName(), sCharacterCache, and SendErrorMessage().

Referenced by group_commandscript::HandleGroupDisbandCommand(), group_commandscript::HandleGroupJoinCommand(), group_commandscript::HandleGroupLeaderCommand(), and group_commandscript::HandleGroupRemoveCommand().

◆ getSelectedCreature()

Creature * ChatHandler::getSelectedCreature ( ) const
419{
420 if (!m_session)
421 return nullptr;
422
424}
ObjectGuid GetTarget() const
Definition Unit.h:862
Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const &)
Definition ObjectAccessor.cpp:258

References ObjectAccessor::GetCreatureOrPetOrVehicle(), WorldSession::GetPlayer(), Unit::GetTarget(), and m_session.

Referenced by cast_commandscript::HandleCastBackCommand(), cast_commandscript::HandleCastTargetCommad(), misc_commandscript::HandleComeToMeCommand(), debug_commandscript::HandleDebugBoundaryCommand(), debug_commandscript::HandleDebugGetLootRecipientCommand(), misc_commandscript::HandleFreezeCommand(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcAddFormationCommand(), npc_commandscript::HandleNpcAddVendorItemCommand(), npc_commandscript::HandleNpcDeleteCommand(), npc_commandscript::HandleNpcDeleteVendorItemCommand(), npc_commandscript::HandleNpcDoActionCommand(), npc_commandscript::HandleNpcFollowCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcPlayEmoteCommand(), npc_commandscript::HandleNpcSayCommand(), npc_commandscript::HandleNpcSetDataCommand(), npc_commandscript::HandleNpcSetFactionIdCommand(), npc_commandscript::HandleNpcSetFlagCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_commandscript::HandleNpcSetLinkCommand(), npc_commandscript::HandleNpcSetModelCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), npc_commandscript::HandleNpcSetSpawnTimeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), npc_commandscript::HandleNpcShowLootCommand(), npc_commandscript::HandleNpcTameCommand(), npc_commandscript::HandleNpcTextEmoteCommand(), npc_commandscript::HandleNpcUnFollowCommand(), npc_commandscript::HandleNpcWhisperCommand(), npc_commandscript::HandleNpcYellCommand(), pet_commandscript::HandlePetCreateCommand(), pool_commandscript::HandlePoolLookupCommand(), misc_commandscript::HandleUnFreezeCommand(), wp_commandscript::HandleWpAddCommand(), wp_commandscript::HandleWpLoadCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), and wp_commandscript::HandleWpUnLoadCommand().

◆ getSelectedObject()

WorldObject * ChatHandler::getSelectedObject ( ) const
406{
407 if (!m_session)
408 return nullptr;
409
411
412 if (!guid)
413 return GetNearbyGameObject();
414
416}
GameObject * GetNearbyGameObject() const
Definition Chat.cpp:573
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:223

References GetNearbyGameObject(), WorldSession::GetPlayer(), Unit::GetTarget(), ObjectAccessor::GetUnit(), and m_session.

Referenced by debug_commandscript::HandleDebugSet32BitCommand(), and debug_commandscript::HandleDebugSetValueCommand().

◆ getSelectedPlayer()

Player * ChatHandler::getSelectedPlayer ( ) const
383{
384 if (!m_session)
385 return nullptr;
386
387 ObjectGuid selected = m_session->GetPlayer()->GetTarget();
388 if (!selected)
389 return m_session->GetPlayer();
390
392}
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition ObjectAccessor.cpp:281

References ObjectAccessor::FindConnectedPlayer(), WorldSession::GetPlayer(), Unit::GetTarget(), and m_session.

Referenced by extractPlayerTarget(), GetPlayerGroupAndGUIDByName(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetGmLevelCommand(), misc_commandscript::HandleAddItemSetCommand(), misc_commandscript::HandleCooldownCommand(), debug_commandscript::HandleDebugGetItemStateCommand(), cheat_commandscript::HandleExploreCheatCommand(), gm_commandscript::HandleGMFlyCommand(), misc_commandscript::HandleHideAreaCommand(), honor_commandscript::HandleHonorAddCommand(), honor_commandscript::HandleHonorUpdateCommand(), instance_commandscript::HandleInstanceListBindsCommand(), instance_commandscript::HandleInstanceUnbindCommand(), learn_commandscript::HandleLearnAllRecipesCommand(), learn_commandscript::HandleLearnCommand(), lookup_commandscript::HandleLookupFactionCommand(), lookup_commandscript::HandleLookupQuestCommand(), lookup_commandscript::HandleLookupSkillCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), lookup_commandscript::HandleLookupTitleCommand(), misc_commandscript::HandleMaxSkillCommand(), modify_commandscript::HandleModifyArenaCommand(), modify_commandscript::HandleModifyDrunkCommand(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyGenderCommand(), modify_commandscript::HandleModifyHonorCommand(), modify_commandscript::HandleModifyHPCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyMoneyCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRepCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), modify_commandscript::HandleModifySpellCommand(), misc_commandscript::HandleSaveCommand(), misc_commandscript::HandleSetSkillCommand(), misc_commandscript::HandleShowAreaCommand(), cheat_commandscript::HandleTaxiCheatCommand(), tele_commandscript::HandleTeleGroupCommand(), titles_commandscript::HandleTitlesAddCommand(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), and learn_commandscript::HandleUnLearnCommand().

◆ getSelectedPlayerOrSelf()

◆ getSelectedUnit()

Unit * ChatHandler::getSelectedUnit ( ) const
395{
396 if (!m_session)
397 return nullptr;
398
399 if (Unit* selected = m_session->GetPlayer()->GetSelectedUnit())
400 return selected;
401
402 return m_session->GetPlayer();
403}
Unit * GetSelectedUnit() const
Definition Player.cpp:11724
Definition Unit.h:665

References WorldSession::GetPlayer(), Player::GetSelectedUnit(), and m_session.

Referenced by misc_commandscript::HandleAuraCommand(), misc_commandscript::HandleAuraStacksCommand(), misc_commandscript::HandleBindSightCommand(), cast_commandscript::HandleCastCommand(), cast_commandscript::HandleCastDestCommand(), cast_commandscript::HandleCastSelfCommand(), misc_commandscript::HandleDamageCommand(), debug_commandscript::HandleDebugAnimCommand(), debug_commandscript::HandleDebugCombatListCommand(), debug_commandscript::HandleDebugEnterVehicleCommand(), debug_commandscript::HandleDebugGetValueCommand(), debug_commandscript::HandleDebugHostileRefListCommand(), debug_commandscript::HandleDebugLoSCommand(), debug_commandscript::HandleDebugMoveflagsCommand(), debug_commandscript::HandleDebugPlaySoundCommand(), debug_commandscript::HandleDebugSendOpcodeCommand(), debug_commandscript::HandleDebugSetAuraStateCommand(), debug_commandscript::HandleDebugSetVehicleIdCommand(), debug_commandscript::HandleDebugThreatInfoCommand(), debug_commandscript::HandleDebugThreatListCommand(), debug_commandscript::HandleDebugUnitStateCommand(), debug_commandscript::HandleDebugUpdateCommand(), debug_commandscript::HandleDebugVisualCommand(), misc_commandscript::HandleDieCommand(), misc_commandscript::HandleGetDistanceCommand(), misc_commandscript::HandleGPSCommand(), honor_commandscript::HandleHonorAddKillCommand(), mmaps_commandscript::HandleMmapPathCommand(), modify_commandscript::HandleModifyBitCommand(), modify_commandscript::HandleModifyPhaseCommand(), modify_commandscript::HandleModifyScaleCommand(), modify_commandscript::HandleModifyTalentCommand(), modify_commandscript::HandleMorphResetCommand(), modify_commandscript::HandleMorphTargetCommand(), misc_commandscript::HandleMovegensCommand(), npc_commandscript::HandleNpcSetEntryCommand(), misc_commandscript::HandlePossessCommand(), misc_commandscript::HandleRespawnCommand(), misc_commandscript::HandleUnAuraCommand(), misc_commandscript::HandleUnPossessCommand(), and list_commandscript::ListAurasCommand().

◆ GetSession()

WorldSession * ChatHandler::GetSession ( )
inline
242{ return m_session; }

Referenced by go_commandscript::DoTeleport(), go_commandscript::DoTeleportToTransport(), account_commandscript::HandleAccount2FARemoveCommand(), account_commandscript::HandleAccount2FASetupCommand(), account_commandscript::HandleAccountAddonCommand(), account_commandscript::HandleAccountCommand(), account_commandscript::HandleAccountCreateCommand(), account_commandscript::HandleAccountFlagListCommand(), account_commandscript::HandleAccountInfoCommand(), account_commandscript::HandleAccountLockCountryCommand(), account_commandscript::HandleAccountLockIpCommand(), account_commandscript::HandleAccountPasswordCommand(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetGmLevelCommand(), misc_commandscript::HandleAddItemCommand(), misc_commandscript::HandleAddItemSetCommand(), misc_commandscript::HandleAppearCommand(), bg_commandscript::HandleBagsClearCommand(), ban_commandscript::HandleBanCharacterCommand(), ban_commandscript::HandleBanHelper(), ban_commandscript::HandleBanListCharacterCommand(), ban_commandscript::HandleBanListHelper(), ban_commandscript::HandleBanListIPCommand(), misc_commandscript::HandleBindSightCommand(), misc_commandscript::HandleBMCommand(), cast_commandscript::HandleCastBackCommand(), cast_commandscript::HandleCastCommand(), cast_commandscript::HandleCastDistCommand(), cheat_commandscript::HandleCasttimeCheatCommand(), misc_commandscript::HandleChangeWeather(), character_commandscript::HandleCharacterCheckBankCommand(), character_commandscript::HandleCharacterDeletedListHelper(), character_commandscript::HandleCharacterLevelCommand(), character_commandscript::HandleCharacterReputationCommand(), character_commandscript::HandleCharacterTitlesCommand(), cheat_commandscript::HandleCheatStatusCommand(), misc_commandscript::HandleComeToMeCommand(), misc_commandscript::HandleCommentatorCommand(), cheat_commandscript::HandleCoolDownCheatCommand(), misc_commandscript::HandleCooldownCommand(), misc_commandscript::HandleDamageCommand(), debug_commandscript::HandleDebugAreaTriggersCommand(), debug_commandscript::HandleDebugHostileRefListCommand(), debug_commandscript::HandleDebugLoSCommand(), debug_commandscript::HandleDebugSendChannelNotifyCommand(), debug_commandscript::HandleDebugSendChatMsgCommand(), debug_commandscript::HandleDebugSendOpcodeCommand(), debug_commandscript::HandleDebugSendSetPhaseShiftCommand(), debug_commandscript::HandleDebugSendSpellFailCommand(), debug_commandscript::HandleDebugSpawnVehicleCommand(), debug_commandscript::HandleDebugUnitStateCommand(), deserter_commandscript::HandleDeserterAdd(), misc_commandscript::HandleDevCommand(), misc_commandscript::HandleDieCommand(), misc_commandscript::HandleDismountCommand(), event_commandscript::HandleEventActiveListCommand(), cheat_commandscript::HandleExploreCheatCommand(), gobject_commandscript::HandleGameObjectActivateCommand(), gobject_commandscript::HandleGameObjectAddCommand(), gobject_commandscript::HandleGameObjectAddTempCommand(), gobject_commandscript::HandleGameObjectDeleteCommand(), gobject_commandscript::HandleGameObjectDespawnGroupCommand(), gobject_commandscript::HandleGameObjectMoveCommand(), gobject_commandscript::HandleGameObjectNearCommand(), gobject_commandscript::HandleGameObjectSpawnGroupCommand(), gobject_commandscript::HandleGameObjectTargetCommand(), gobject_commandscript::HandleGameObjectTurnCommand(), misc_commandscript::HandleGetDistanceCommand(), gm_commandscript::HandleGMChatCommand(), gm_commandscript::HandleGMFlyCommand(), gm_commandscript::HandleGMListFullCommand(), gm_commandscript::HandleGMListIngameCommand(), message_commandscript::HandleGMNameAnnounceCommand(), gm_commandscript::HandleGMSpectatorCommand(), ticket_commandscript::HandleGMTicketAssignToCommand(), ticket_commandscript::HandleGMTicketCloseByIdCommand(), ticket_commandscript::HandleGMTicketCommentCommand(), ticket_commandscript::HandleGMTicketCompleteCommand(), ticket_commandscript::HandleGMTicketDeleteByIdCommand(), ticket_commandscript::HandleGMTicketResponseDeleteCommand(), ticket_commandscript::HandleGMTicketUnAssignCommand(), gm_commandscript::HandleGMVisibleCommand(), cheat_commandscript::HandleGodModeCheatCommand(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoXYZCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGPSCommand(), group_commandscript::HandleGroupInvitesCommand(), misc_commandscript::HandleGroupSummonCommand(), misc_commandscript::HandleGUIDCommand(), honor_commandscript::HandleHonorAddKillCommand(), instance_commandscript::HandleInstanceGetBossStateCommand(), instance_commandscript::HandleInstanceListBindsCommand(), instance_commandscript::HandleInstanceSaveDataCommand(), instance_commandscript::HandleInstanceSetBossStateCommand(), instance_commandscript::HandleInstanceUnbindCommand(), item_commandscript::HandleItemMoveCommand(), misc_commandscript::HandleKickPlayerCommand(), learn_commandscript::HandleLearnAllCraftsCommand(), learn_commandscript::HandleLearnAllGMCommand(), learn_commandscript::HandleLearnAllMyPetTalentsCommand(), learn_commandscript::HandleLearnAllMyTalentsCommand(), learn_commandscript::HandleLearnAllMyTrainerSpellsCommand(), character_commandscript::HandleLevelUpCommand(), misc_commandscript::HandleLinkGraveCommand(), list_commandscript::HandleListCreatureCommand(), list_commandscript::HandleListObjectCommand(), list_commandscript::HandleListRespawnsCommand(), lookup_commandscript::HandleLookupAreaCommand(), lookup_commandscript::HandleLookupCreatureCommand(), lookup_commandscript::HandleLookupEventCommand(), lookup_commandscript::HandleLookupFactionCommand(), lookup_commandscript::HandleLookupItemCommand(), lookup_commandscript::HandleLookupItemSetCommand(), lookup_commandscript::HandleLookupMapCommand(), lookup_commandscript::HandleLookupObjectCommand(), lookup_commandscript::HandleLookupPlayerIpCommand(), lookup_commandscript::HandleLookupQuestCommand(), lookup_commandscript::HandleLookupSkillCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), lookup_commandscript::HandleLookupTaxiNodeCommand(), lookup_commandscript::HandleLookupTeleCommand(), lookup_commandscript::HandleLookupTitleCommand(), misc_commandscript::HandleMailBoxCommand(), mmaps_commandscript::HandleMmapLoadedTilesCommand(), mmaps_commandscript::HandleMmapLocCommand(), mmaps_commandscript::HandleMmapPathCommand(), mmaps_commandscript::HandleMmapStatsCommand(), mmaps_commandscript::HandleMmapTestArea(), modify_commandscript::HandleModifyPhaseCommand(), modify_commandscript::HandleModifyStandStateCommand(), modify_commandscript::HandleMorphResetCommand(), modify_commandscript::HandleMorphTargetCommand(), misc_commandscript::HandleMuteCommand(), message_commandscript::HandleNameAnnounceCommand(), misc_commandscript::HandleNearGraveCommand(), npc_commandscript::HandleNpcAddCommand(), npc_commandscript::HandleNpcAddFormationCommand(), npc_commandscript::HandleNpcAddTempSpawnCommand(), npc_commandscript::HandleNpcAddVendorItemCommand(), npc_commandscript::HandleNpcDeleteVendorItemCommand(), npc_commandscript::HandleNpcDespawnGroupCommand(), npc_commandscript::HandleNpcFollowCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcNearCommand(), npc_commandscript::HandleNpcSetFactionTempIdCommand(), npc_commandscript::HandleNpcSetOriginalFaction(), npc_commandscript::HandleNpcSpawnGroupCommand(), npc_commandscript::HandleNpcTameCommand(), npc_commandscript::HandleNpcUnFollowCommand(), pet_commandscript::HandlePetCreateCommand(), pet_commandscript::HandlePetLearnCommand(), pet_commandscript::HandlePetUnlearnCommand(), misc_commandscript::HandlePInfoCommand(), pool_commandscript::HandlePoolLookupCommand(), misc_commandscript::HandlePossessCommand(), cheat_commandscript::HandlePowerCheatCommand(), reset_commandscript::HandleResetAllCommand(), reset_commandscript::HandleResetSpellsCommand(), reset_commandscript::HandleResetTalentsCommand(), misc_commandscript::HandleRespawnAllCommand(), misc_commandscript::HandleRespawnCommand(), misc_commandscript::HandleRespawnCreatureByEntryCommand(), misc_commandscript::HandleRespawnCreatureByGuidCommand(), misc_commandscript::HandleRespawnGameObjectByEntryCommand(), misc_commandscript::HandleRespawnGameObjectByGuidCommand(), misc_commandscript::HandleSaveCommand(), send_commandscript::HandleSendItemsCommand(), send_commandscript::HandleSendMailCommand(), send_commandscript::HandleSendMoneyCommand(), spectator_commandscript::HandleSpectatorLeaveCommand(), spectator_commandscript::HandleSpectatorResetCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), spectator_commandscript::HandleSpectatorVersionCommand(), ArenaSpectator::HandleSpectatorWatchCommand(), misc_commandscript::HandleSummonCommand(), cheat_commandscript::HandleTaxiCheatCommand(), tele_commandscript::HandleTeleAddCommand(), tele_commandscript::HandleTeleCommand(), misc_commandscript::HandleUnbindSightCommand(), misc_commandscript::HandleUnPossessCommand(), misc_commandscript::HandleUnstuckCommand(), cheat_commandscript::HandleWaterWalkCheatCommand(), message_commandscript::HandleWhispersCommand(), wp_commandscript::HandleWpAddCommand(), debug_commandscript::HandleWPGPSCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), list_commandscript::ListAurasCommand(), AddonChannelCommandHandler::Send(), ticket_commandscript::TicketResponseAppend(), and Acore::Impl::ChatCommands::ChatCommandNode::TryExecuteCommand().

◆ GetSessionDbcLocale()

LocaleConstant ChatHandler::GetSessionDbcLocale ( ) const
virtual

◆ GetSessionDbLocaleIndex()

◆ HasLowerSecurity()

bool ChatHandler::HasLowerSecurity ( Player *  target,
ObjectGuid  guid = ObjectGuid::Empty,
bool  strong = false 
)
66{
67 WorldSession* target_session = nullptr;
68 uint32 target_account = 0;
69
70 if (target)
71 target_session = target->GetSession();
72 else if (guid)
73 target_account = sCharacterCache->GetCharacterAccountIdByGuid(guid);
74
75 if (!target_session && !target_account)
76 {
78 return true;
79 }
80
81 return HasLowerSecurityAccount(target_session, target_account, strong);
82}
bool HasLowerSecurityAccount(WorldSession *target, uint32 account, bool strong=false)
Definition Chat.cpp:84
WorldSession * GetSession() const
Definition Player.h:2031
Player session in the World.
Definition WorldSession.h:430

References Player::GetSession(), HasLowerSecurityAccount(), LANG_PLAYER_NOT_FOUND, sCharacterCache, and SendErrorMessage().

Referenced by modify_commandscript::CheckModifyInt32(), modify_commandscript::CheckModifySpeed(), tele_commandscript::DoNameTeleport(), misc_commandscript::HandleAddItemCommand(), misc_commandscript::HandleAppearCommand(), character_commandscript::HandleCharacterRenameCommand(), misc_commandscript::HandleCombatStopCommand(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), gear_commandscript::HandleGearRepairCommand(), misc_commandscript::HandleGroupSummonCommand(), honor_commandscript::HandleHonorAddCommand(), honor_commandscript::HandleHonorAddKillCommand(), honor_commandscript::HandleHonorUpdateCommand(), misc_commandscript::HandleKickPlayerCommand(), modify_commandscript::HandleModifyBitCommand(), modify_commandscript::HandleModifyHonorCommand(), modify_commandscript::HandleModifyMoneyCommand(), modify_commandscript::HandleModifyMountCommand(), modify_commandscript::HandleModifyPhaseCommand(), modify_commandscript::HandleModifyRepCommand(), modify_commandscript::HandleModifyScaleCommand(), modify_commandscript::HandleModifySpellCommand(), modify_commandscript::HandleModifyTalentCommand(), modify_commandscript::HandleMorphMountCommand(), modify_commandscript::HandleMorphResetCommand(), modify_commandscript::HandleMorphTargetCommand(), misc_commandscript::HandleMuteCommand(), npc_commandscript::HandleNpcWhisperCommand(), misc_commandscript::HandlePInfoCommand(), misc_commandscript::HandleRecallCommand(), misc_commandscript::HandleSummonCommand(), cheat_commandscript::HandleTaxiCheatCommand(), tele_commandscript::HandleTeleGroupCommand(), titles_commandscript::HandleTitlesAddCommand(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), misc_commandscript::HandleUnmuteCommand(), and misc_commandscript::HandleUnstuckCommand().

◆ HasLowerSecurityAccount()

bool ChatHandler::HasLowerSecurityAccount ( WorldSession *  target,
uint32  account,
bool  strong = false 
)
85{
86 uint32 target_sec;
87
88 // allow everything from console and RA console
89 if (!m_session)
90 return false;
91
92 // ignore only for non-players for non strong checks (when allow apply command at least to same sec level)
94 return false;
95
96 if (target)
97 target_sec = target->GetSecurity();
98 else if (target_account)
99 target_sec = AccountMgr::GetSecurity(target_account, realm.Id.Realm);
100 else
101 return true; // caller must report error for (target == nullptr && target_account == 0)
102
103 AccountTypes target_ac_sec = AccountTypes(target_sec);
104 if (m_session->GetSecurity() < target_ac_sec || (strong && m_session->GetSecurity() <= target_ac_sec))
105 {
107 return true;
108 }
109
110 return false;
111}
AccountTypes
Definition Common.h:56
@ LANG_YOURS_SECURITY_IS_LOW
Definition Language.h:438
@ CONFIG_GM_LOWER_SECURITY
Definition WorldConfig.h:47
static uint32 GetSecurity(uint32 accountId)
Definition AccountMgr.cpp:257
AccountTypes GetSecurity() const
Definition WorldSession.h:490
Realm realm
Definition World.cpp:115
@ RBAC_PERM_CAN_IGNORE_LOWER_SECURITY_CHECK
Definition RBAC.h:98
uint32 Realm
Definition Realm.h:43
RealmHandle Id
Definition Realm.h:69

References CONFIG_GM_LOWER_SECURITY, WorldSession::GetSecurity(), AccountMgr::GetSecurity(), WorldSession::HasPermission(), Realm::Id, LANG_YOURS_SECURITY_IS_LOW, m_session, rbac::RBAC_PERM_CAN_IGNORE_LOWER_SECURITY_CHECK, realm, RealmHandle::Realm, SendErrorMessage(), and sWorld.

Referenced by account_commandscript::ChangeAccountFlag(), account_commandscript::HandleAccountDeleteCommand(), account_commandscript::HandleAccountFlagListCommand(), account_commandscript::HandleAccountInfoCommand(), account_commandscript::HandleAccountSet2FACommand(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetPasswordCommand(), rbac_commandscript::HandleRBACPermDenyCommand(), rbac_commandscript::HandleRBACPermGrantCommand(), rbac_commandscript::HandleRBACPermRevokeCommand(), and HasLowerSecurity().

◆ HasPermission()

bool ChatHandler::HasPermission ( uint32  permissionId) const
59{
60 if (IsConsole())
61 return true;
62 return m_session && m_session->HasPermission(permissionId);
63}
bool IsConsole() const
Definition Chat.h:240

References WorldSession::HasPermission(), IsConsole(), and m_session.

Referenced by Acore::Impl::ChatCommands::ChatCommandNode::IsInvokerVisible().

◆ HasSentErrorMessage()

◆ HasSession()

bool ChatHandler::HasSession ( ) const
virtual

Reimplemented in CliHandler.

445{
446 if (!m_session)
447 return false;
448
449 return true;
450}

References m_session.

◆ IsAvailable()

bool ChatHandler::IsAvailable ( uint32  securityLevel) const
53{
54 // check security level only for simple command (without child commands)
55 return IsConsole() ? true : m_session->GetSecurity() >= AccountTypes(securityLevel);
56}

References WorldSession::GetSecurity(), IsConsole(), and m_session.

Referenced by Acore::Impl::ChatCommands::ChatCommandNode::IsInvokerVisible().

◆ IsConsole()

◆ IsHumanReadable()

virtual bool ChatHandler::IsHumanReadable ( ) const
inlinevirtual

Reimplemented in AddonChannelCommandHandler.

197{ return true; }

◆ LineFromMessage()

static char * ChatHandler::LineFromMessage ( char *&  pos)
inlinestatic
50{ char* start = strtok(pos, "\n"); pos = nullptr; return start; }

◆ needReportToTarget()

◆ ParseCommands()

bool ChatHandler::ParseCommands ( std::string_view  text)
virtual

Reimplemented in CliHandler, and AddonChannelCommandHandler.

251{
252 ASSERT(!text.empty());
253
254 // chat case (.command or !command format)
255 if ((text[0] != '!') && (text[0] != '.'))
256 return false;
257
258 // ignore single . and ! in line
259 if (text.length() < 2)
260 return false;
261
262 // ignore messages staring from many dots.
263 if (text[1] == text[0])
264 return false;
265
266 // ignore messages with separator after .
268 return false;
269
270 return _ParseCommands(text.substr(1));
271}
bool _ParseCommands(std::string_view text)
Definition Chat.cpp:236
static constexpr char COMMAND_DELIMITER
Definition ChatCommandHelpers.h:37

References _ParseCommands(), ASSERT, and Acore::Impl::ChatCommands::COMMAND_DELIMITER.

Referenced by WorldSession::HandleMessagechatOpcode().

◆ PGetParseModuleString()

template<typename... Args>
std::string ChatHandler::PGetParseModuleString ( std::string  module,
uint32  id,
Args &&...  args 
) const
inline
170 {
171 return Acore::StringFormat(GetModuleString(module, id)->c_str(), std::forward<Args>(args)...);
172 }
virtual std::string const * GetModuleString(std::string module, uint32 id) const
Definition Chat.cpp:47
std::string StringFormat(FormatStringView fmt, Args &&... args)
Default AC string format function.
Definition StringFormat.h:44

References Acore::StringFormat().

◆ PGetParseString()

template<typename... Args>
std::string ChatHandler::PGetParseString ( uint32  entry,
Args &&...  args 
) const
inline

◆ playerLink()

std::string ChatHandler::playerLink ( std::string const &  name) const
inline

◆ PSendModuleSysMessage()

template<typename... Args>
void ChatHandler::PSendModuleSysMessage ( std::string  module,
uint32  id,
Args &&...  args 
)
inline
163 {
164 if (HasSession())
165 SendSysMessage(PGetParseModuleString(module, id, std::forward<Args>(args)...));
166 }
virtual bool HasSession() const
Definition Chat.cpp:444
std::string PGetParseModuleString(std::string module, uint32 id, Args &&... args) const
Definition Chat.h:169

◆ PSendSysMessage() [1/3]

template<typename... Args>
void ChatHandler::PSendSysMessage ( char const *  fmt,
Args &&...  args 
)
inline
141 {
142 if (HasSession())
143 SendSysMessage(Acore::StringFormat(fmt, std::forward<Args>(args)...));
144 }

References Acore::StringFormat().

◆ PSendSysMessage() [2/3]

void ChatHandler::PSendSysMessage ( std::string_view  str,
bool  escapeCharacters = false 
)
220{
221 SendSysMessage(str, escapeCharacters);
222}

References SendSysMessage().

Referenced by Battleground::_ProcessProgress(), Player::AddItem(), BattlegroundSA::CaptureGraveyard(), account_commandscript::ChangeAccountFlag(), cast_commandscript::CheckSpellCastResult(), AchievementMgr::CompletedAchievement(), tele_commandscript::DoNameTeleport(), BattlegroundSA::EventPlayerDamagedGO(), GetPlayerInfo(), account_commandscript::HandleAccountAddonCommand(), account_commandscript::HandleAccountCommand(), account_commandscript::HandleAccountCreateCommand(), account_commandscript::HandleAccountDeleteCommand(), account_commandscript::HandleAccountFlagListCommand(), account_commandscript::HandleAccountInfoCommand(), account_commandscript::HandleAccountLockCountryCommand(), account_commandscript::HandleAccountLockIpCommand(), account_commandscript::HandleAccountOnlineListCommand(), account_commandscript::HandleAccountRemoveLockCountryCommand(), account_commandscript::HandleAccountSet2FACommand(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetGmLevelCommand(), achievement_commandscript::HandleAchievementAddCommand(), disable_commandscript::HandleAddDisables(), misc_commandscript::HandleAddItemCommand(), misc_commandscript::HandleAddItemSetCommand(), misc_commandscript::HandleAppearCommand(), WorldSession::HandleAreaTriggerOpcode(), arena_commandscript::HandleArenaCaptainCommand(), arena_commandscript::HandleArenaCreateCommand(), arena_commandscript::HandleArenaDisbandCommand(), arena_commandscript::HandleArenaInfoCommand(), arena_commandscript::HandleArenaLookupCommand(), arena_commandscript::HandleArenaRenameCommand(), arena_commandscript::HandleArenaSeasonDeleteTeamsCommand(), arena_commandscript::HandleArenaSeasonRewardCommand(), arena_commandscript::HandleArenaSeasonSetStateCommand(), arena_commandscript::HandleArenaSeasonStartCommand(), autobroadcast_commandscript::HandleAutobroadcastAddCommand(), autobroadcast_commandscript::HandleAutobroadcastListCommand(), autobroadcast_commandscript::HandleAutobroadcastLocaleCommand(), autobroadcast_commandscript::HandleAutobroadcastRemoveCommand(), ban_commandscript::HandleBanCharacterCommand(), ban_commandscript::HandleBanHelper(), ban_commandscript::HandleBanInfoAccountCommand(), ban_commandscript::HandleBanInfoCharacterCommand(), ban_commandscript::HandleBanInfoHelper(), ban_commandscript::HandleBanInfoIPCommand(), ban_commandscript::HandleBanListAccountCommand(), ban_commandscript::HandleBanListCharacterCommand(), ban_commandscript::HandleBanListHelper(), ban_commandscript::HandleBanListIPCommand(), bf_commandscript::HandleBattlefieldEnable(), bf_commandscript::HandleBattlefieldEnd(), bf_commandscript::HandleBattlefieldQueue(), bf_commandscript::HandleBattlefieldStart(), bf_commandscript::HandleBattlefieldSwitch(), bf_commandscript::HandleBattlefieldTimer(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), cache_commandscript::HandleCacheDeleteCommand(), cache_commandscript::HandleCacheInfoCommand(), cache_commandscript::HandleCacheRefreshCommand(), WorldSession::HandleCharacterAuraFrozen(), character_commandscript::HandleCharacterChangeAccountCommand(), character_commandscript::HandleCharacterChangeFactionCommand(), character_commandscript::HandleCharacterChangeRaceCommand(), character_commandscript::HandleCharacterCheckBagCommand(), character_commandscript::HandleCharacterCheckProfessionCommand(), character_commandscript::HandleCharacterCustomizeCommand(), character_commandscript::HandleCharacterDeletedListHelper(), character_commandscript::HandleCharacterDeletedRestoreHelper(), character_commandscript::HandleCharacterEraseCommand(), character_commandscript::HandleCharacterLevel(), character_commandscript::HandleCharacterLevelCommand(), character_commandscript::HandleCharacterRenameCommand(), character_commandscript::HandleCharacterTitlesCommand(), chatfilter_commandscript::HandleChatFilterAddCommand(), chatfilter_commandscript::HandleChatFilterListCommand(), chatfilter_commandscript::HandleChatFilterRemoveCommand(), cheat_commandscript::HandleCheatStatusCommand(), misc_commandscript::HandleCooldownCommand(), debug_commandscript::HandleDebugAnimCommand(), debug_commandscript::HandleDebugAreaTriggersCommand(), debug_commandscript::HandleDebugBoundaryCommand(), debug_commandscript::HandleDebugCombatListCommand(), debug_commandscript::HandleDebugEnterVehicleCommand(), debug_commandscript::HandleDebugFactionChangeCommand(), debug_commandscript::HandleDebugGetItemStateCommand(), debug_commandscript::HandleDebugGetItemValueCommand(), debug_commandscript::HandleDebugGetLootRecipientCommand(), debug_commandscript::HandleDebugGetValueCommand(), debug_commandscript::HandleDebugHostileRefListCommand(), debug_commandscript::HandleDebugLootCommand(), debug_commandscript::HandleDebugLoSCommand(), debug_commandscript::HandleDebugMapDataCommand(), debug_commandscript::HandleDebugMod32ValueCommand(), debug_commandscript::HandleDebugMoveflagsCommand(), debug_commandscript::HandleDebugObjectCountMap(), debug_commandscript::HandleDebugPlayCinematicCommand(), debug_commandscript::HandleDebugPlayMusicCommand(), debug_commandscript::HandleDebugPlaySoundCommand(), debug_commandscript::HandleDebugSendOpcodeCommand(), debug_commandscript::HandleDebugSet32BitCommand(), debug_commandscript::HandleDebugSetValueCommand(), debug_commandscript::HandleDebugSetVehicleIdCommand(), debug_commandscript::HandleDebugThreatInfoCommand(), debug_commandscript::HandleDebugThreatListCommand(), debug_commandscript::HandleDebugUpdateCommand(), debug_commandscript::HandleDebugVisibilityDataCommand(), debug_commandscript::HandleDebugZoneStatsCommand(), deserter_commandscript::HandleDeserterAdd(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), event_commandscript::HandleEventActiveListCommand(), event_commandscript::HandleEventInfoCommand(), event_commandscript::HandleEventStartCommand(), event_commandscript::HandleEventStopCommand(), cheat_commandscript::HandleExploreCheatCommand(), misc_commandscript::HandleFreezeCommand(), gobject_commandscript::HandleGameObjectActivateCommand(), gobject_commandscript::HandleGameObjectAddCommand(), gobject_commandscript::HandleGameObjectDeleteCommand(), gobject_commandscript::HandleGameObjectDespawnGroupCommand(), gobject_commandscript::HandleGameObjectInfoCommand(), gobject_commandscript::HandleGameObjectLoadCommand(), gobject_commandscript::HandleGameObjectMoveCommand(), gobject_commandscript::HandleGameObjectNearCommand(), gobject_commandscript::HandleGameObjectRespawn(), gobject_commandscript::HandleGameObjectSetStateCommand(), gobject_commandscript::HandleGameObjectSpawnGroupCommand(), gobject_commandscript::HandleGameObjectTargetCommand(), gobject_commandscript::HandleGameObjectTurnCommand(), gear_commandscript::HandleGearRepairCommand(), gear_commandscript::HandleGearStatsCommand(), misc_commandscript::HandleGetDistanceCommand(), gm_commandscript::HandleGMFlyCommand(), gm_commandscript::HandleGMListFullCommand(), gm_commandscript::HandleGMListIngameCommand(), ticket_commandscript::HandleGMTicketAssignToCommand(), ticket_commandscript::HandleGMTicketCloseByIdCommand(), ticket_commandscript::HandleGMTicketCommentCommand(), ticket_commandscript::HandleGMTicketCompleteCommand(), ticket_commandscript::HandleGMTicketResponseDeleteCommand(), ticket_commandscript::HandleGMTicketResponseShowCommand(), ticket_commandscript::HandleGMTicketUnAssignCommand(), gm_commandscript::HandleGMVisibleCommand(), misc_commandscript::HandleGPSCommand(), group_commandscript::HandleGroupInvitesCommand(), group_commandscript::HandleGroupJoinCommand(), group_commandscript::HandleGroupListCommand(), misc_commandscript::HandleGroupSummonCommand(), misc_commandscript::HandleGUIDCommand(), guild_commandscript::HandleGuildInfoCommand(), guild_commandscript::HandleGuildRenameCommand(), instance_commandscript::HandleInstanceGetBossStateCommand(), instance_commandscript::HandleInstanceListBindsCommand(), instance_commandscript::HandleInstanceSetBossStateCommand(), instance_commandscript::HandleInstanceStatsCommand(), instance_commandscript::HandleInstanceUnbindCommand(), Guild::HandleInviteMember(), item_commandscript::HandleItemRefundCommand(), item_commandscript::HandleItemRestoreCommand(), item_commandscript::HandleItemRestoreListCommand(), misc_commandscript::HandleKickPlayerCommand(), learn_commandscript::HandleLearnAllDefaultCommand(), learn_commandscript::HandleLearnAllRecipesCommand(), character_commandscript::HandleLevelUpCommand(), lfg_commandscript::HandleLfgCleanCommand(), lfg_commandscript::HandleLfgGroupInfoCommand(), lfg_commandscript::HandleLfgOptionsCommand(), misc_commandscript::HandleLinkGraveCommand(), list_commandscript::HandleListCreatureCommand(), list_commandscript::HandleListItemCommand(), list_commandscript::HandleListObjectCommand(), list_commandscript::HandleListRespawnsCommand(), lookup_commandscript::HandleLookupAreaCommand(), lookup_commandscript::HandleLookupCreatureCommand(), lookup_commandscript::HandleLookupEventCommand(), lookup_commandscript::HandleLookupFactionCommand(), lookup_commandscript::HandleLookupItemCommand(), lookup_commandscript::HandleLookupItemSetCommand(), lookup_commandscript::HandleLookupMapCommand(), lookup_commandscript::HandleLookupObjectCommand(), lookup_commandscript::HandleLookupQuestCommand(), lookup_commandscript::HandleLookupSkillCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), lookup_commandscript::HandleLookupTaxiNodeCommand(), lookup_commandscript::HandleLookupTeleCommand(), lookup_commandscript::HandleLookupTitleCommand(), mail_commandscript::HandleMailListCommand(), mail_commandscript::HandleMailReturnCommand(), mmaps_commandscript::HandleMmapLoadedTilesCommand(), mmaps_commandscript::HandleMmapLocCommand(), mmaps_commandscript::HandleMmapPathCommand(), mmaps_commandscript::HandleMmapStatsCommand(), mmaps_commandscript::HandleMmapTestArea(), modify_commandscript::HandleModifyArenaCommand(), modify_commandscript::HandleModifyBitCommand(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyFactionCommand(), modify_commandscript::HandleModifyGenderCommand(), modify_commandscript::HandleModifyHonorCommand(), modify_commandscript::HandleModifyHPCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyMoneyCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRepCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), modify_commandscript::HandleModifyScaleCommand(), modify_commandscript::HandleModifySpellCommand(), misc_commandscript::HandleMovegensCommand(), misc_commandscript::HandleMuteCommand(), misc_commandscript::HandleMuteInfoCommand(), misc_commandscript::HandleMuteInfoHelper(), misc_commandscript::HandleNearGraveCommand(), npc_commandscript::HandleNpcAddFormationCommand(), npc_commandscript::HandleNpcAddVendorItemCommand(), npc_commandscript::HandleNpcDeleteVendorItemCommand(), npc_commandscript::HandleNpcDespawnGroupCommand(), npc_commandscript::HandleNpcDoActionCommand(), npc_commandscript::HandleNpcFollowCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommandShowCreature(), npc_commandscript::HandleNpcInfoCommandShowFromDB(), npc_commandscript::HandleNpcLoadCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcNearCommand(), npc_commandscript::HandleNpcSetDataCommand(), npc_commandscript::HandleNpcSetLinkCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetSpawnTimeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), npc_commandscript::HandleNpcShowLootCommand(), npc_commandscript::HandleNpcSpawnGroupCommand(), npc_commandscript::HandleNpcTameCommand(), npc_commandscript::HandleNpcUnFollowCommand(), misc_commandscript::HandleOpenDoorCommand(), misc_commandscript::HandlePacketLog(), character_commandscript::HandlePDumpCopyCommand(), character_commandscript::HandlePDumpLoadCommand(), character_commandscript::HandlePDumpWriteCommand(), pet_commandscript::HandlePetDeleteCommand(), pet_commandscript::HandlePetLearnCommand(), pet_commandscript::HandlePetListCommand(), pet_commandscript::HandlePetRenameCommand(), pet_commandscript::HandlePetUnlearnCommand(), misc_commandscript::HandlePInfoCommand(), misc_commandscript::HandlePlayAllCommand(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), pooltools_commandscript::HandlePoolAdd(), pooltools_commandscript::HandlePoolClear(), pooltools_commandscript::HandlePoolDef(), pooltools_commandscript::HandlePoolEnd(), pool_commandscript::HandlePoolInfoCommand(), pool_commandscript::HandlePoolLookupCommand(), pooltools_commandscript::HandlePoolRemove(), pooltools_commandscript::HandlePoolStart(), quest_commandscript::HandleQuestAdd(), quest_commandscript::HandleQuestComplete(), quest_commandscript::HandleQuestRemove(), quest_commandscript::HandleQuestReward(), quest_commandscript::HandleQuestStatus(), rbac_commandscript::HandleRBACListPermissionsCommand(), rbac_commandscript::HandleRBACPermDenyCommand(), rbac_commandscript::HandleRBACPermGrantCommand(), rbac_commandscript::HandleRBACPermListCommand(), rbac_commandscript::HandleRBACPermRevokeCommand(), reload_commandscript::HandleReloadCreatureTemplateCommand(), disable_commandscript::HandleRemoveDisables(), reset_commandscript::HandleResetItemsAllAndDeleteBagsCommand(), reset_commandscript::HandleResetItemsAllCommand(), reset_commandscript::HandleResetItemsEquippedCommand(), reset_commandscript::HandleResetItemsInBagsCommand(), reset_commandscript::HandleResetItemsInBankCommand(), reset_commandscript::HandleResetItemsInCurrenciesListCommand(), reset_commandscript::HandleResetItemsInVendorBuyBackTabCommand(), reset_commandscript::HandleResetItemsKeyringCommand(), reset_commandscript::HandleResetSpellsCommand(), reset_commandscript::HandleResetTalentsCommand(), misc_commandscript::HandleRespawnCreatureByEntryCommand(), misc_commandscript::HandleRespawnCreatureByGuidCommand(), misc_commandscript::HandleRespawnGameObjectByEntryCommand(), misc_commandscript::HandleRespawnGameObjectByGuidCommand(), worldstate_commandscript::HandleScourgeInvasionCommand(), worldstate_commandscript::HandleScourgeInvasionStartZone(), worldstate_commandscript::HandleScourgeInvasionStateCommand(), send_commandscript::HandleSendItemsCommand(), send_commandscript::HandleSendMailCommand(), send_commandscript::HandleSendMessageCommand(), send_commandscript::HandleSendMoneyCommand(), server_commandscript::HandleServerDebugCommand(), server_commandscript::HandleServerInfoCommand(), server_commandscript::HandleServerMotdCommand(), server_commandscript::HandleServerSetMotdCommand(), server_commandscript::HandleServerSetSecurityCommand(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSetSkillCommand(), player_settings_commandscript::HandleSettingsAnnouncerFlags(), misc_commandscript::HandleSkirmishCommand(), spectator_commandscript::HandleSpectatorCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), spellinfo_commandscript::HandleSpellInfoAllCommand(), spellinfo_commandscript::HandleSpellInfoAttributesCommand(), spellinfo_commandscript::HandleSpellInfoEffectsCommand(), spellinfo_commandscript::HandleSpellInfoTargetsCommand(), misc_commandscript::HandleSummonCommand(), WorldSession::HandleSummonResponseOpcode(), worldstate_commandscript::HandleSunsReachReclamationCounterCommand(), worldstate_commandscript::HandleSunsReachReclamationPhaseCommand(), worldstate_commandscript::HandleSunsReachReclamationStatusCommand(), worldstate_commandscript::HandleSunsReachReclamationSubPhaseCommand(), worldstate_commandscript::HandleSunwellGateCommand(), worldstate_commandscript::HandleSunwellGateCounterCommand(), cheat_commandscript::HandleTaxiCheatCommand(), tele_commandscript::HandleTeleGroupCommand(), titles_commandscript::HandleTitlesAddCommand(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), ticket_commandscript::HandleToggleGMTicketSystem(), ban_commandscript::HandleUnBanHelper(), misc_commandscript::HandleUnFreezeCommand(), misc_commandscript::HandleUnmuteCommand(), misc_commandscript::HandleUnstuckCommand(), message_commandscript::HandleWhispersCommand(), wp_commandscript::HandleWpAddCommand(), wp_commandscript::HandleWpEventCommand(), debug_commandscript::HandleWPGPSCommand(), wp_commandscript::HandleWpLoadCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpReloadCommand(), wp_commandscript::HandleWpShowCommand(), wp_commandscript::HandleWpUnLoadCommand(), ObjectMgr::IsVendorItemValid(), Channel::JoinChannel(), Channel::KickOrBan(), list_commandscript::ListAurasCommand(), pool_commandscript::ListPoolMembers(), lookup_commandscript::LookupPlayerSearchCommand(), modify_commandscript::NotifyModification(), npc_icc_buff_switcher::OnGossipSelect(), BattlegroundSA::PostUpdateImpl(), Player::PrettyPrintRequirementsAchievementsList(), Player::PrettyPrintRequirementsItemsList(), Player::PrettyPrintRequirementsQuestList(), spellinfo_commandscript::PrintAttributes(), spellinfo_commandscript::PrintBasicInfo(), spellinfo_commandscript::PrintEffects(), spellinfo_commandscript::PrintGeneralInfo(), spellinfo_commandscript::PrintSpellAttrFlags(), spellinfo_commandscript::PrintTargets(), Player::RewardHonor(), Player::Satisfy(), Acore::Impl::ChatCommands::ChatCommandNode::SendCommandHelp(), Acore::Impl::ChatCommands::ChatCommandNode::SendCommandHelpFor(), BattlegroundQueue::SendJoinMessageArenaQueue(), BattlegroundQueue::SendMessageBGQueue(), npc_commandscript::ShowLootEntry(), ticket_commandscript::TicketResponseAppend(), Acore::Impl::ChatCommands::ChatCommandNode::TryExecuteCommand(), and Player::Whisper().

◆ PSendSysMessage() [3/3]

template<typename... Args>
void ChatHandler::PSendSysMessage ( uint32  entry,
Args &&...  args 
)
inline
148 {
149 if (HasSession())
150 SendSysMessage(PGetParseString(entry, std::forward<Args>(args)...));
151 }
std::string PGetParseString(uint32 entry, Args &&... args) const
Definition Chat.h:154

◆ SendErrorMessage() [1/4]

template<typename... Args>
void ChatHandler::SendErrorMessage ( char const *  fmt,
Args &&...  args 
)
inline
179 {
180 PSendSysMessage(fmt, std::forward<Args>(args)...);
182 }
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:219
void SetSentErrorMessage(bool val)
Definition Chat.h:238

◆ SendErrorMessage() [2/4]

void ChatHandler::SendErrorMessage ( std::string_view  str,
bool  escapeCharacters 
)
231{
232 SendSysMessage(str, escapeCharacters);
234}

References SendSysMessage(), and SetSentErrorMessage().

◆ SendErrorMessage() [3/4]

void ChatHandler::SendErrorMessage ( uint32  entry)
225{
226 SendSysMessage(entry);
228}

References SendSysMessage(), and SetSentErrorMessage().

Referenced by _ParseCommands(), account_commandscript::ChangeAccountFlag(), modify_commandscript::CheckModifyInt32(), modify_commandscript::CheckModifySpeed(), cast_commandscript::CheckSpellExistsAndIsValid(), tele_commandscript::DoNameTeleport(), go_commandscript::DoTeleport(), go_commandscript::DoTeleportToTransport(), extractPlayerTarget(), GetPlayerGroupAndGUIDByName(), account_commandscript::HandleAccount2FARemoveCommand(), account_commandscript::HandleAccount2FASetupCommand(), account_commandscript::HandleAccountAddonCommand(), account_commandscript::HandleAccountCreateCommand(), account_commandscript::HandleAccountDeleteCommand(), account_commandscript::HandleAccountFlagListCommand(), account_commandscript::HandleAccountInfoCommand(), account_commandscript::HandleAccountLockCountryCommand(), account_commandscript::HandleAccountLockIpCommand(), account_commandscript::HandleAccountPasswordCommand(), account_commandscript::HandleAccountRemoveLockCountryCommand(), account_commandscript::HandleAccountSet2FACommand(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetEmailCommand(), account_commandscript::HandleAccountSetGmLevelCommand(), account_commandscript::HandleAccountSetPasswordCommand(), achievement_commandscript::HandleAchievementAddCommand(), achievement_commandscript::HandleAchievementCheckAllCommand(), disable_commandscript::HandleAddDisables(), misc_commandscript::HandleAddItemCommand(), misc_commandscript::HandleAddItemSetCommand(), misc_commandscript::HandleAppearCommand(), arena_commandscript::HandleArenaCaptainCommand(), arena_commandscript::HandleArenaCreateCommand(), arena_commandscript::HandleArenaDisbandCommand(), arena_commandscript::HandleArenaInfoCommand(), arena_commandscript::HandleArenaLookupCommand(), arena_commandscript::HandleArenaRenameCommand(), misc_commandscript::HandleAuraCommand(), misc_commandscript::HandleAuraStacksCommand(), autobroadcast_commandscript::HandleAutobroadcastLocaleCommand(), autobroadcast_commandscript::HandleAutobroadcastRemoveCommand(), ban_commandscript::HandleBanCharacterCommand(), ban_commandscript::HandleBanHelper(), ban_commandscript::HandleBanInfoAccountCommand(), bf_commandscript::HandleBattlefieldEnable(), bf_commandscript::HandleBattlefieldEnd(), bf_commandscript::HandleBattlefieldQueue(), bf_commandscript::HandleBattlefieldStart(), bf_commandscript::HandleBattlefieldSwitch(), bf_commandscript::HandleBattlefieldTimer(), misc_commandscript::HandleBMCommand(), cache_commandscript::HandleCacheDeleteCommand(), cache_commandscript::HandleCacheInfoCommand(), cache_commandscript::HandleCacheRefreshCommand(), cast_commandscript::HandleCastBackCommand(), cast_commandscript::HandleCastCommand(), cast_commandscript::HandleCastDestCommand(), cast_commandscript::HandleCastSelfCommand(), cast_commandscript::HandleCastTargetCommad(), misc_commandscript::HandleChangeWeather(), character_commandscript::HandleCharacterChangeAccountCommand(), character_commandscript::HandleCharacterDeletedDeleteCommand(), character_commandscript::HandleCharacterDeletedListCommand(), character_commandscript::HandleCharacterDeletedRestoreCommand(), character_commandscript::HandleCharacterRenameCommand(), character_commandscript::HandleCharacterReputationCommand(), character_commandscript::HandleCharacterTitlesCommand(), chatfilter_commandscript::HandleChatFilterAddCommand(), chatfilter_commandscript::HandleChatFilterRemoveCommand(), misc_commandscript::HandleCombatStopCommand(), misc_commandscript::HandleComeToMeCommand(), misc_commandscript::HandleCommentatorCommand(), misc_commandscript::HandleCooldownCommand(), misc_commandscript::HandleDamageCommand(), debug_commandscript::HandleDebugFactionChangeCommand(), debug_commandscript::HandleDebugGetValueCommand(), debug_commandscript::HandleDebugLootCommand(), debug_commandscript::HandleDebugPlayCinematicCommand(), debug_commandscript::HandleDebugPlayMovieCommand(), debug_commandscript::HandleDebugPlayMusicCommand(), debug_commandscript::HandleDebugPlaySoundCommand(), debug_commandscript::HandleDebugSendOpcodeCommand(), debug_commandscript::HandleDebugSet32BitCommand(), debug_commandscript::HandleDebugSetAuraStateCommand(), debug_commandscript::HandleDebugSetValueCommand(), debug_commandscript::HandleDebugUpdateCommand(), debug_commandscript::HandleDebugVisualCommand(), debug_commandscript::HandleDebugZoneStatsCommand(), deserter_commandscript::HandleDeserterAdd(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), misc_commandscript::HandleDevCommand(), misc_commandscript::HandleDieCommand(), misc_commandscript::HandleDismountCommand(), event_commandscript::HandleEventInfoCommand(), event_commandscript::HandleEventStartCommand(), event_commandscript::HandleEventStopCommand(), cheat_commandscript::HandleExploreCheatCommand(), misc_commandscript::HandleFreezeCommand(), gobject_commandscript::HandleGameObjectActivateCommand(), gobject_commandscript::HandleGameObjectAddCommand(), gobject_commandscript::HandleGameObjectAddTempCommand(), gobject_commandscript::HandleGameObjectDeleteCommand(), gobject_commandscript::HandleGameObjectDespawnGroupCommand(), gobject_commandscript::HandleGameObjectInfoCommand(), gobject_commandscript::HandleGameObjectLoadCommand(), gobject_commandscript::HandleGameObjectMoveCommand(), gobject_commandscript::HandleGameObjectRespawn(), gobject_commandscript::HandleGameObjectSetPhaseCommand(), gobject_commandscript::HandleGameObjectSetStateCommand(), gobject_commandscript::HandleGameObjectSpawnGroupCommand(), gobject_commandscript::HandleGameObjectTurnCommand(), gm_commandscript::HandleGMChatCommand(), go_commandscript::HandleGoCreatureCIdCommand(), go_commandscript::HandleGoCreatureNameCommand(), go_commandscript::HandleGoCreatureSpawnIdCommand(), go_commandscript::HandleGoGameObjectGOIdCommand(), go_commandscript::HandleGoGameObjectSpawnIdCommand(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoQuestCommand(), go_commandscript::HandleGoTaxinodeCommand(), go_commandscript::HandleGoTriggerCommand(), go_commandscript::HandleGoXYZCommand(), go_commandscript::HandleGoZoneXYCommand(), group_commandscript::HandleGroupReviveCommand(), misc_commandscript::HandleGroupSummonCommand(), misc_commandscript::HandleGUIDCommand(), guild_commandscript::HandleGuildCreateCommand(), guild_commandscript::HandleGuildRenameCommand(), misc_commandscript::HandleHideAreaCommand(), honor_commandscript::HandleHonorAddCommand(), honor_commandscript::HandleHonorAddKillCommand(), honor_commandscript::HandleHonorUpdateCommand(), instance_commandscript::HandleInstanceGetBossStateCommand(), instance_commandscript::HandleInstanceSaveDataCommand(), instance_commandscript::HandleInstanceSetBossStateCommand(), instance_commandscript::HandleInstanceStatsCommand(), inventory_commandscript::HandleInventoryCountCommand(), item_commandscript::HandleItemRefundCommand(), item_commandscript::HandleItemRestoreCommand(), item_commandscript::HandleItemRestoreListCommand(), misc_commandscript::HandleKickPlayerCommand(), learn_commandscript::HandleLearnAllMyPetTalentsCommand(), learn_commandscript::HandleLearnCommand(), Acore::PlayerCommand::HandleLearnSpellCommand(), misc_commandscript::HandleLinkGraveCommand(), list_commandscript::HandleListCreatureCommand(), list_commandscript::HandleListItemCommand(), list_commandscript::HandleListObjectCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), mail_commandscript::HandleMailReturnCommand(), misc_commandscript::HandleMaxSkillCommand(), modify_commandscript::HandleModifyArenaCommand(), modify_commandscript::HandleModifyBitCommand(), modify_commandscript::HandleModifyFactionCommand(), modify_commandscript::HandleModifyGenderCommand(), modify_commandscript::HandleModifyHonorCommand(), modify_commandscript::HandleModifyMoneyCommand(), modify_commandscript::HandleModifyMountCommand(), modify_commandscript::HandleModifyRepCommand(), modify_commandscript::HandleModifyScaleCommand(), modify_commandscript::HandleModifySpellCommand(), modify_commandscript::HandleModifyTalentCommand(), misc_commandscript::HandleMovegensCommand(), misc_commandscript::HandleMuteCommand(), misc_commandscript::HandleMuteInfoCommand(), misc_commandscript::HandleNearGraveCommand(), npc_commandscript::HandleNpcAddFormationCommand(), npc_commandscript::HandleNpcAddMoveCommand(), npc_commandscript::HandleNpcAddVendorItemCommand(), npc_commandscript::HandleNpcDeleteCommand(), npc_commandscript::HandleNpcDeleteVendorItemCommand(), npc_commandscript::HandleNpcDespawnGroupCommand(), npc_commandscript::HandleNpcDoActionCommand(), npc_commandscript::HandleNpcFollowCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), npc_commandscript::HandleNpcInfoCommandShowFromDB(), npc_commandscript::HandleNpcLoadCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcPlayEmoteCommand(), npc_commandscript::HandleNpcSayCommand(), npc_commandscript::HandleNpcSetDataCommand(), npc_commandscript::HandleNpcSetEntryCommand(), npc_commandscript::HandleNpcSetFactionIdCommand(), npc_commandscript::HandleNpcSetFlagCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_commandscript::HandleNpcSetLinkCommand(), npc_commandscript::HandleNpcSetModelCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), npc_commandscript::HandleNpcSetSpawnTimeCommand(), npc_commandscript::HandleNpcShowLootCommand(), npc_commandscript::HandleNpcSpawnGroupCommand(), npc_commandscript::HandleNpcTameCommand(), npc_commandscript::HandleNpcTextEmoteCommand(), npc_commandscript::HandleNpcUnFollowCommand(), npc_commandscript::HandleNpcWhisperCommand(), npc_commandscript::HandleNpcYellCommand(), misc_commandscript::HandleOpenDoorCommand(), misc_commandscript::HandlePacketLog(), character_commandscript::HandlePDumpCopyCommand(), character_commandscript::HandlePDumpLoadCommand(), character_commandscript::HandlePDumpWriteCommand(), pet_commandscript::HandlePetCreateCommand(), pet_commandscript::HandlePetDeleteCommand(), pet_commandscript::HandlePetLearnCommand(), pet_commandscript::HandlePetRenameCommand(), pet_commandscript::HandlePetUnlearnCommand(), misc_commandscript::HandlePlayAllCommand(), pooltools_commandscript::HandlePoolAdd(), pooltools_commandscript::HandlePoolDef(), pooltools_commandscript::HandlePoolRemove(), pooltools_commandscript::HandlePoolStart(), quest_commandscript::HandleQuestAdd(), quest_commandscript::HandleQuestComplete(), quest_commandscript::HandleQuestRemove(), quest_commandscript::HandleQuestReward(), quest_commandscript::HandleQuestStatus(), misc_commandscript::HandleRecallCommand(), reload_commandscript::HandleReloadAllScriptsCommand(), reload_commandscript::HandleReloadEventScriptsCommand(), reload_commandscript::HandleReloadSpellScriptsCommand(), reload_commandscript::HandleReloadWardenactionCommand(), reload_commandscript::HandleReloadWpScriptsCommand(), disable_commandscript::HandleRemoveDisables(), reset_commandscript::HandleResetAllCommand(), reset_commandscript::HandleResetTalentsCommand(), misc_commandscript::HandleRespawnCommand(), misc_commandscript::HandleRespawnCreatureByEntryCommand(), misc_commandscript::HandleRespawnCreatureByGuidCommand(), misc_commandscript::HandleRespawnGameObjectByEntryCommand(), misc_commandscript::HandleRespawnGameObjectByGuidCommand(), send_commandscript::HandleSendItemsCommand(), server_commandscript::HandleServerIdleRestartCommand(), server_commandscript::HandleServerIdleShutDownCommand(), server_commandscript::HandleServerRestartCommand(), server_commandscript::HandleServerSetClosedCommand(), server_commandscript::HandleServerSetMotdCommand(), server_commandscript::HandleServerSetSecurityCommand(), server_commandscript::HandleServerShutDownCommand(), misc_commandscript::HandleSetSkillCommand(), misc_commandscript::HandleShowAreaCommand(), misc_commandscript::HandleSkirmishCommand(), spellinfo_commandscript::HandleSpellInfoAllCommand(), spellinfo_commandscript::HandleSpellInfoAttributesCommand(), spellinfo_commandscript::HandleSpellInfoEffectsCommand(), spellinfo_commandscript::HandleSpellInfoTargetsCommand(), misc_commandscript::HandleSummonCommand(), tele_commandscript::HandleTeleAddCommand(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleDelCommand(), tele_commandscript::HandleTeleGroupCommand(), tele_commandscript::HandleTeleNameNpcIdCommand(), tele_commandscript::HandleTeleNameNpcNameCommand(), tele_commandscript::HandleTeleNameNpcSpawnIdCommand(), titles_commandscript::HandleTitlesAddCommand(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), misc_commandscript::HandleUnAuraCommand(), ban_commandscript::HandleUnBanCharacterCommand(), ban_commandscript::HandleUnBanHelper(), misc_commandscript::HandleUnFreezeCommand(), learn_commandscript::HandleUnLearnCommand(), misc_commandscript::HandleUnmuteCommand(), message_commandscript::HandleWhispersCommand(), wp_commandscript::HandleWpLoadCommand(), wp_commandscript::HandleWpShowCommand(), HasLowerSecurity(), HasLowerSecurityAccount(), list_commandscript::ListAurasCommand(), lookup_commandscript::LookupPlayerSearchCommand(), and character_commandscript::ValidatePDumpTarget().

◆ SendErrorMessage() [4/4]

template<typename... Args>
void ChatHandler::SendErrorMessage ( uint32  entry,
Args &&...  args 
)
inline
186 {
187 PSendSysMessage(entry, std::forward<Args>(args)...);
189 }

◆ SendGlobalGMSysMessage()

void ChatHandler::SendGlobalGMSysMessage ( char const *  str)
205{
206 WorldPacket data;
207 for (std::string_view line : Acore::Tokenize(str, '\n', true))
208 {
209 BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
210 sWorldSessionMgr->SendGlobalGMMessage(&data);
211 }
212}
@ CHAT_MSG_SYSTEM
Definition SharedDefines.h:3385
@ LANG_UNIVERSAL
Definition SharedDefines.h:723
Definition WorldPacket.h:26
Definition AsioHacksFwd.h:47
std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition Tokenize.cpp:20

References BuildChatPacket(), CHAT_MSG_SYSTEM, LANG_UNIVERSAL, sWorldSessionMgr, and Acore::Tokenize().

Referenced by ticket_commandscript::HandleGMTicketAssignToCommand(), ticket_commandscript::HandleGMTicketCloseByIdCommand(), ticket_commandscript::HandleGMTicketCommentCommand(), ticket_commandscript::HandleGMTicketCompleteCommand(), ticket_commandscript::HandleGMTicketDeleteByIdCommand(), ticket_commandscript::HandleGMTicketResponseDeleteCommand(), ticket_commandscript::HandleGMTicketUnAssignCommand(), reload_commandscript::HandleReloadAchievementCriteriaDataCommand(), reload_commandscript::HandleReloadAchievementRewardCommand(), reload_commandscript::HandleReloadAcoreStringCommand(), reload_commandscript::HandleReloadAllLootCommand(), reload_commandscript::HandleReloadAllQuestCommand(), reload_commandscript::HandleReloadAllScriptsCommand(), reload_commandscript::HandleReloadAntiDosOpcodePoliciesCommand(), reload_commandscript::HandleReloadAreaTriggerCommand(), reload_commandscript::HandleReloadAreaTriggerTavernCommand(), reload_commandscript::HandleReloadAreaTriggerTeleportCommand(), reload_commandscript::HandleReloadAuctionsCommand(), reload_commandscript::HandleReloadAutobroadcastCommand(), reload_commandscript::HandleReloadBattlegroundTemplate(), reload_commandscript::HandleReloadBroadcastTextCommand(), reload_commandscript::HandleReloadChatFilterCommand(), reload_commandscript::HandleReloadCommandCommand(), reload_commandscript::HandleReloadConditions(), reload_commandscript::HandleReloadConfigCommand(), reload_commandscript::HandleReloadCreatureMovementOverrideCommand(), reload_commandscript::HandleReloadCreatureQuestEnderCommand(), reload_commandscript::HandleReloadCreatureQuestStarterCommand(), reload_commandscript::HandleReloadCreatureTemplateCommand(), reload_commandscript::HandleReloadCreatureText(), reload_commandscript::HandleReloadDisablesCommand(), reload_commandscript::HandleReloadDungeonAccessCommand(), reload_commandscript::HandleReloadEventScriptsCommand(), reload_commandscript::HandleReloadGameEventNPCVendorCommand(), reload_commandscript::HandleReloadGameGraveyardCommand(), reload_commandscript::HandleReloadGameGraveyardZoneCommand(), reload_commandscript::HandleReloadGameTeleCommand(), reload_commandscript::HandleReloadGOQuestEnderCommand(), reload_commandscript::HandleReloadGOQuestStarterCommand(), reload_commandscript::HandleReloadGossipMenuCommand(), reload_commandscript::HandleReloadGossipMenuOptionCommand(), reload_commandscript::HandleReloadItemEnchantementsCommand(), reload_commandscript::HandleReloadItemSetNamesCommand(), reload_commandscript::HandleReloadLfgRewardsCommand(), reload_commandscript::HandleReloadLinkedRespawnCommand(), reload_commandscript::HandleReloadLocalesAchievementRewardCommand(), reload_commandscript::HandleReloadLocalesCreatureCommand(), reload_commandscript::HandleReloadLocalesCreatureTextCommand(), reload_commandscript::HandleReloadLocalesGameobjectCommand(), reload_commandscript::HandleReloadLocalesGossipMenuOptionCommand(), reload_commandscript::HandleReloadLocalesItemCommand(), reload_commandscript::HandleReloadLocalesItemSetNameCommand(), reload_commandscript::HandleReloadLocalesNpcTextCommand(), reload_commandscript::HandleReloadLocalesPageTextCommand(), reload_commandscript::HandleReloadLocalesPointsOfInterestCommand(), reload_commandscript::HandleReloadLocalesQuestCommand(), reload_commandscript::HandleReloadLocalesQuestOfferRewardCommand(), reload_commandscript::HandleReloadLocalesQuestRequestItemsCommand(), reload_commandscript::HandleReloadLootTemplatesCreatureCommand(), reload_commandscript::HandleReloadLootTemplatesDisenchantCommand(), reload_commandscript::HandleReloadLootTemplatesFishingCommand(), reload_commandscript::HandleReloadLootTemplatesGameobjectCommand(), reload_commandscript::HandleReloadLootTemplatesItemCommand(), reload_commandscript::HandleReloadLootTemplatesMailCommand(), reload_commandscript::HandleReloadLootTemplatesMillingCommand(), reload_commandscript::HandleReloadLootTemplatesPickpocketingCommand(), reload_commandscript::HandleReloadLootTemplatesPlayerCommand(), reload_commandscript::HandleReloadLootTemplatesProspectingCommand(), reload_commandscript::HandleReloadLootTemplatesReferenceCommand(), reload_commandscript::HandleReloadLootTemplatesSkinningCommand(), reload_commandscript::HandleReloadLootTemplatesSpellCommand(), reload_commandscript::HandleReloadMailLevelRewardCommand(), reload_commandscript::HandleReloadMailServerTemplateCommand(), reload_commandscript::HandleReloadModuleStringCommand(), reload_commandscript::HandleReloadMotdCommand(), reload_commandscript::HandleReloadNpcVendorCommand(), reload_commandscript::HandleReloadOnKillReputationCommand(), reload_commandscript::HandleReloadPageTextsCommand(), reload_commandscript::HandleReloadPointsOfInterestCommand(), reload_commandscript::HandleReloadProfanityNameCommand(), reload_commandscript::HandleReloadQuestAreaTriggersCommand(), reload_commandscript::HandleReloadQuestGreetingCommand(), reload_commandscript::HandleReloadQuestPOICommand(), reload_commandscript::HandleReloadQuestTemplateCommand(), reload_commandscript::HandleReloadRBACCommand(), reload_commandscript::HandleReloadReputationRewardRateCommand(), reload_commandscript::HandleReloadReputationSpilloverTemplateCommand(), reload_commandscript::HandleReloadReservedNameCommand(), reload_commandscript::HandleReloadSkillDiscoveryTemplateCommand(), reload_commandscript::HandleReloadSkillExtraItemTemplateCommand(), reload_commandscript::HandleReloadSkillFishingBaseLevelCommand(), reload_commandscript::HandleReloadSkillPerfectItemTemplateCommand(), reload_commandscript::HandleReloadSmartScripts(), reload_commandscript::HandleReloadSpawnGroupCommand(), reload_commandscript::HandleReloadSpellAreaCommand(), reload_commandscript::HandleReloadSpellBonusesCommand(), reload_commandscript::HandleReloadSpellClickSpellsCommand(), reload_commandscript::HandleReloadSpellConeCommand(), reload_commandscript::HandleReloadSpellGroupsCommand(), reload_commandscript::HandleReloadSpellGroupStackRulesCommand(), reload_commandscript::HandleReloadSpellLinkedSpellCommand(), reload_commandscript::HandleReloadSpellPetAurasCommand(), reload_commandscript::HandleReloadSpellProcsCommand(), reload_commandscript::HandleReloadSpellRequiredCommand(), reload_commandscript::HandleReloadSpellScriptsCommand(), reload_commandscript::HandleReloadSpellTargetPositionCommand(), reload_commandscript::HandleReloadSpellThreatsCommand(), reload_commandscript::HandleReloadTrainerCommand(), reload_commandscript::HandleReloadVehicleAccessoryCommand(), reload_commandscript::HandleReloadVehicleTemplateAccessoryCommand(), reload_commandscript::HandleReloadWardenactionCommand(), reload_commandscript::HandleReloadWpCommand(), and reload_commandscript::HandleReloadWpScriptsCommand().

◆ SendGlobalSysMessage()

void ChatHandler::SendGlobalSysMessage ( char const *  str)
195{
196 WorldPacket data;
197 for (std::string_view line : Acore::Tokenize(str, '\n', true))
198 {
199 BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
200 sWorldSessionMgr->SendGlobalMessage(&data);
201 }
202}

References BuildChatPacket(), CHAT_MSG_SYSTEM, LANG_UNIVERSAL, sWorldSessionMgr, and Acore::Tokenize().

Referenced by reload_commandscript::HandleReloadMotdCommand().

◆ SendGMText() [1/3]

template<typename... Args>
void ChatHandler::SendGMText ( char const *  fmt,
Args &&...  args 
)
inline
79 {
80 // GMText should be sent to all sessions
81 DoForAllValidSessions([&](Player* player)
82 {
83 m_session = player->GetSession();
84 SendGMText(Acore::StringFormat(fmt, std::forward<Args>(args)...));
85 });
86 }
void SendGMText(std::string_view str)
Definition Chat.cpp:124
void DoForAllValidSessions(std::function< void(Player *)> exec)
Definition Chat.cpp:452

References Player::GetSession(), and Acore::StringFormat().

◆ SendGMText() [2/3]

void ChatHandler::SendGMText ( std::string_view  str)
125{
126 std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
127 // Session should have permissions to receive global gm messages
129 return;
130
131 for (std::string_view line : lines)
132 {
133 WorldPacket data;
134 ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
135 m_session->SendPacket(&data);
136 }
137}
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition WorldSession.cpp:308
@ RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE
Definition RBAC.h:95

References WorldSession::HasPermission(), m_session, rbac::RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE, and Acore::Tokenize().

Referenced by message_commandscript::HandleGMAnnounceCommand(), message_commandscript::HandleGMNameAnnounceCommand(), WorldSession::HandleGMTicketCreateOpcode(), WorldSession::HandleGMTicketDeleteOpcode(), and WorldSession::HandleGMTicketUpdateOpcode().

◆ SendGMText() [3/3]

template<typename... Args>
void ChatHandler::SendGMText ( uint32  strId,
Args &&...  args 
)
inline
69 {
70 // GMText should be sent to all sessions
71 DoForAllValidSessions([&](Player* player)
72 {
73 m_session = player->GetSession();
74 SendGMText(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
75 });
76 }

References Player::GetSession(), and Acore::StringFormat().

◆ SendNotification() [1/3]

template<typename... Args>
void ChatHandler::SendNotification ( char const *  fmt,
Args &&...  args 
)
inline
61 {
62 if (HasSession())
63 SendNotification(Acore::StringFormat(fmt, std::forward<Args>(args)...));
64 }
void SendNotification(std::string_view str)
Definition Chat.cpp:113

References Acore::StringFormat().

◆ SendNotification() [2/3]

void ChatHandler::SendNotification ( std::string_view  str)
114{
115 std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
116 for (std::string_view line : lines)
117 {
118 WorldPacket data(SMSG_NOTIFICATION, line.size() + 1);
119 data << line.data();
120 m_session->SendPacket(&data);
121 }
122}
@ SMSG_NOTIFICATION
Definition Opcodes.h:489

References m_session, WorldSession::SendPacket(), SMSG_NOTIFICATION, and Acore::Tokenize().

Referenced by InstanceScript::DoSendNotifyToInstance(), Spell::EffectPlaySound(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlemasterHelloOpcode(), misc_commandscript::HandleBMCommand(), misc_commandscript::HandleCommentatorCommand(), misc_commandscript::HandleDevCommand(), gm_commandscript::HandleGMChatCommand(), gm_commandscript::HandleGMOffCommand(), gm_commandscript::HandleGMOnCommand(), gm_commandscript::HandleGMSpectatorCommand(), WorldSession::HandleGMTicketCreateOpcode(), gm_commandscript::HandleGMVisibleCommand(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), WorldSession::HandlePushQuestToParty(), WorldSession::HandleRaidReadyCheckOpcode(), WorldSession::HandleSendMail(), WorldSession::HandleTextEmoteOpcode(), WorldSession::HandleWhoisOpcode(), WorldSession::HandleWorldTeleportOpcode(), go_tele_to_dalaran_crystal::OnGossipHello(), go_amberpine_outhouse::OnGossipSelect(), Player::OnGossipSelect(), and WorldSession::SendAuctionHello().

◆ SendNotification() [3/3]

template<typename... Args>
void ChatHandler::SendNotification ( uint32  strId,
Args &&...  args 
)
inline
55 {
56 if (HasSession())
57 SendNotification(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
58 }

References Acore::StringFormat().

◆ SendSysMessage() [1/2]

void ChatHandler::SendSysMessage ( std::string_view  str,
bool  escapeCharacters = false 
)
virtual

Reimplemented in AddonChannelCommandHandler, AddonChannelCommandHandler, and CliHandler.

169{
170 std::string msg{ str };
171
172 // Replace every "|" with "||" in msg
173 if (escapeCharacters && msg.find('|') != std::string::npos)
174 {
175 std::vector<std::string_view> tokens = Acore::Tokenize(msg, '|', true);
176 std::ostringstream stream;
177
178 for (std::size_t i = 0; i < tokens.size() - 1; ++i)
179 stream << tokens[i] << "||";
180
181 stream << tokens[tokens.size() - 1];
182
183 msg = stream.str();
184 }
185
186 WorldPacket data;
187 for (std::string_view line : Acore::Tokenize(str, '\n', true))
188 {
189 BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
190 m_session->SendPacket(&data);
191 }
192}

References BuildChatPacket(), CHAT_MSG_SYSTEM, LANG_UNIVERSAL, m_session, WorldSession::SendPacket(), and Acore::Tokenize().

Referenced by extractKeyFromLink(), extractKeyFromLink(), go_commandscript::GetCreatureData(), go_commandscript::GetGameObjectData(), reset_commandscript::GetPlayerFromIdentifierOrSelectedTarget(), account_commandscript::HandleAccount2FARemoveCommand(), account_commandscript::HandleAccount2FASetupCommand(), account_commandscript::HandleAccountOnlineListCommand(), account_commandscript::HandleAccountPasswordCommand(), account_commandscript::HandleAccountSetEmailCommand(), account_commandscript::HandleAccountSetPasswordCommand(), autobroadcast_commandscript::HandleAutobroadcastListCommand(), bg_commandscript::HandleBagsClearCommand(), ban_commandscript::HandleBanListCharacterCommand(), ban_commandscript::HandleBanListHelper(), ban_commandscript::HandleBanListIPCommand(), WorldSession::HandleCancelMountAuraOpcode(), cheat_commandscript::HandleCasttimeCheatCommand(), WorldSession::HandleCharacterAuraFrozen(), character_commandscript::HandleCharacterDeletedDeleteCommand(), character_commandscript::HandleCharacterDeletedListCommand(), character_commandscript::HandleCharacterDeletedListHelper(), character_commandscript::HandleCharacterDeletedRestoreCommand(), character_commandscript::HandleCharacterReputationCommand(), chatfilter_commandscript::HandleChatFilterListCommand(), cheat_commandscript::HandleCheatStatusCommand(), cheat_commandscript::HandleCoolDownCheatCommand(), debug_commandscript::HandleDebugDummyCommand(), debug_commandscript::HandleDebugGetItemStateCommand(), debug_commandscript::HandleDebugHostileRefListCommand(), debug_commandscript::HandleDebugSendLargePacketCommand(), debug_commandscript::HandleDebugThreatInfoCommand(), debug_commandscript::HandleDebugThreatListCommand(), event_commandscript::HandleEventActiveListCommand(), gobject_commandscript::HandleGameObjectTargetCommand(), gm_commandscript::HandleGMListFullCommand(), gm_commandscript::HandleGMListIngameCommand(), ticket_commandscript::HandleGMTicketAssignToCommand(), ticket_commandscript::HandleGMTicketCloseByIdCommand(), ticket_commandscript::HandleGMTicketCompleteCommand(), ticket_commandscript::HandleGMTicketDeleteByIdCommand(), ticket_commandscript::HandleGMTicketEscalateCommand(), ticket_commandscript::HandleGMTicketGetByIdCommand(), ticket_commandscript::HandleGMTicketGetByNameCommand(), ticket_commandscript::HandleGMTicketResetCommand(), ticket_commandscript::HandleGMTicketResponseDeleteCommand(), ticket_commandscript::HandleGMTicketResponseShowCommand(), ticket_commandscript::HandleGMTicketUnAssignCommand(), cheat_commandscript::HandleGodModeCheatCommand(), go_commandscript::HandleGoTicketCommand(), group_commandscript::HandleGroupInvitesCommand(), misc_commandscript::HandleHideAreaCommand(), inventory_commandscript::HandleInventoryCountCommand(), learn_commandscript::HandleLearnAllCraftsCommand(), learn_commandscript::HandleLearnAllGMCommand(), learn_commandscript::HandleLearnAllLangCommand(), learn_commandscript::HandleLearnAllMyPetTalentsCommand(), learn_commandscript::HandleLearnAllMyTalentsCommand(), learn_commandscript::HandleLearnAllMyTrainerSpellsCommand(), learn_commandscript::HandleLearnAllRecipesCommand(), lfg_commandscript::HandleLfgCooldownClearCommand(), list_commandscript::HandleListRespawnsCommand(), lookup_commandscript::HandleLookupAreaCommand(), lookup_commandscript::HandleLookupCreatureCommand(), lookup_commandscript::HandleLookupEventCommand(), lookup_commandscript::HandleLookupFactionCommand(), lookup_commandscript::HandleLookupItemCommand(), lookup_commandscript::HandleLookupItemSetCommand(), lookup_commandscript::HandleLookupMapCommand(), lookup_commandscript::HandleLookupObjectCommand(), lookup_commandscript::HandleLookupQuestCommand(), lookup_commandscript::HandleLookupSkillCommand(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), lookup_commandscript::HandleLookupTaxiNodeCommand(), lookup_commandscript::HandleLookupTeleCommand(), lookup_commandscript::HandleLookupTitleCommand(), misc_commandscript::HandleMovegensCommand(), npc_commandscript::HandleNpcAddMoveCommand(), npc_commandscript::HandleNpcDeleteCommand(), npc_commandscript::HandleNpcSetAllowMovementCommand(), npc_commandscript::HandleNpcSetEntryCommand(), npc_commandscript::HandleNpcSetFlagCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), pool_commandscript::HandlePoolLookupCommand(), cheat_commandscript::HandlePowerCheatCommand(), quest_commandscript::HandleQuestStatus(), rbac_commandscript::HandleRBACListPermissionsCommand(), rbac_commandscript::HandleRBACPermListCommand(), reset_commandscript::HandleResetAllCommand(), reset_commandscript::HandleResetSpellsCommand(), reset_commandscript::HandleResetTalentsCommand(), misc_commandscript::HandleRespawnCreatureByEntryCommand(), misc_commandscript::HandleRespawnGameObjectByEntryCommand(), misc_commandscript::HandleSaveAllCommand(), misc_commandscript::HandleSaveCommand(), send_commandscript::HandleSendItemsCommand(), server_commandscript::HandleServerDebugCommand(), server_commandscript::HandleServerExitCommand(), server_commandscript::HandleServerSetClosedCommand(), misc_commandscript::HandleShowAreaCommand(), spectator_commandscript::HandleSpectatorLeaveCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), misc_commandscript::HandleStringCommand(), tele_commandscript::HandleTeleAddCommand(), tele_commandscript::HandleTeleDelCommand(), tele_commandscript::HandleTeleNameNpcIdCommand(), tele_commandscript::HandleTeleNameNpcNameCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), misc_commandscript::HandleUnFreezeCommand(), Acore::PlayerCommand::HandleUnlearnSpellCommand(), cheat_commandscript::HandleWaterWalkCheatCommand(), message_commandscript::HandleWhispersCommand(), wp_commandscript::HandleWpEventCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), PSendSysMessage(), Player::Satisfy(), Player::Say(), Acore::Impl::ChatCommands::ChatCommandNode::SendCommandHelp(), Acore::Impl::ChatCommands::ChatCommandNode::SendCommandHelpFor(), SendErrorMessage(), SendErrorMessage(), Acore::Impl::ChatCommands::SendErrorMessageToHandler(), SendSysMessage(), Player::SendSystemMessage(), TicketMgr::ShowClosedList(), TicketMgr::ShowEscalatedList(), TicketMgr::ShowList(), Player::TextEmote(), Player::Whisper(), and Player::Yell().

◆ SendSysMessage() [2/2]

void ChatHandler::SendSysMessage ( uint32  entry)
215{
217}

References GetAcoreString(), and SendSysMessage().

◆ SendWorldText() [1/3]

template<typename... Args>
void ChatHandler::SendWorldText ( char const *  fmt,
Args &&...  args 
)
inline
101 {
102 // WorldText should be sent to all sessions
103 DoForAllValidSessions([&](Player* player)
104 {
105 m_session = player->GetSession();
106 SendWorldText(Acore::StringFormat(fmt, std::forward<Args>(args)...));
107 });
108 }
void SendWorldText(std::string_view str)
Definition Chat.cpp:139

References Player::GetSession(), and Acore::StringFormat().

◆ SendWorldText() [2/3]

◆ SendWorldText() [3/3]

template<typename... Args>
void ChatHandler::SendWorldText ( uint32  strId,
Args &&...  args 
)
inline
91 {
92 // WorldText should be sent to all sessions
93 DoForAllValidSessions([&](Player* player)
94 {
95 m_session = player->GetSession();
96 SendWorldText(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
97 });
98 }

References Player::GetSession(), and Acore::StringFormat().

◆ SendWorldTextOptional() [1/3]

template<typename... Args>
void ChatHandler::SendWorldTextOptional ( char const *  fmt,
uint32  flag,
Args &&...  args 
)
inline
123 {
124 // WorldTextOptional should be sent to all sessions
125 DoForAllValidSessions([&](Player* player)
126 {
127 m_session = player->GetSession();
128 SendWorldTextOptional(Acore::StringFormat(fmt, std::forward<Args>(args)...), flag);
129 });
130 }
void SendWorldTextOptional(std::string_view str, uint32 flag)
Definition Chat.cpp:151

References Player::GetSession(), and Acore::StringFormat().

◆ SendWorldTextOptional() [2/3]

void ChatHandler::SendWorldTextOptional ( std::string_view  str,
uint32  flag 
)
152{
153 std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
154
155 Player* player = m_session->GetPlayer();
156 if (sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
158 return;
159
160 for (std::string_view line : lines)
161 {
162 WorldPacket data;
163 ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
164 player->SendDirectMessage(&data);
165 }
166}
const std::string AzerothcorePSSource
Definition PlayerSettings.h:24
@ SETTING_ANNOUNCER_FLAGS
Definition PlayerSettings.h:28
@ CONFIG_PLAYER_SETTINGS_ENABLED
Definition WorldConfig.h:131
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5864
PlayerSetting GetPlayerSetting(std::string const &source, uint32 index)
Definition PlayerSettings.cpp:132
bool HasFlag(uint32 flag) const
Definition PlayerSettings.h:50

References AzerothcorePSSource, BuildChatPacket(), CHAT_MSG_SYSTEM, CONFIG_PLAYER_SETTINGS_ENABLED, WorldSession::GetPlayer(), Player::GetPlayerSetting(), PlayerSetting::HasFlag(), LANG_UNIVERSAL, m_session, Player::SendDirectMessage(), SETTING_ANNOUNCER_FLAGS, sWorld, and Acore::Tokenize().

Referenced by Battleground::_ProcessJoin(), BattlegroundQueue::BattlegroundQueueAnnouncerUpdate(), BattlegroundQueue::SendExitMessageArenaQueue(), BattlegroundQueue::SendJoinMessageArenaQueue(), and AutobroadcastMgr::SendWorldAnnouncement().

◆ SendWorldTextOptional() [3/3]

template<typename... Args>
void ChatHandler::SendWorldTextOptional ( uint32  strId,
uint32  flag,
Args &&...  args 
)
inline
113 {
114 // WorldTextOptional should be sent to all sessions
115 DoForAllValidSessions([&](Player* player)
116 {
117 m_session = player->GetSession();
118 SendWorldTextOptional(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...), flag);
119 });
120 }

References Player::GetSession(), and Acore::StringFormat().

◆ SetSentErrorMessage()

Member Data Documentation

◆ m_session

◆ sentErrorMessage

bool ChatHandler::sentErrorMessage
private

The documentation for this class was generated from the following files: