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 char const * 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
 
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 (const char *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 (const char *str)
 
PlayergetSelectedPlayer () const
 
CreaturegetSelectedCreature () const
 
UnitgetSelectedUnit () const
 
WorldObjectgetSelectedObject () const
 
PlayergetSelectedPlayerOrSelf () 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 (const char *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
 
GameObjectGetNearbyGameObject () const
 
GameObjectGetObjectFromPlayerMapByDbGuid (ObjectGuid::LowType lowguid)
 
CreatureGetCreatureFromPlayerMapByDbGuid (ObjectGuid::LowType lowguid)
 
bool HasSentErrorMessage () const
 
void SetSentErrorMessage (bool val)
 
bool IsConsole () const
 
PlayerGetPlayer () const
 
WorldSessionGetSession ()
 
bool IsAvailable (uint32 securityLevel) 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

WorldSessionm_session
 
bool sentErrorMessage
 

Detailed Description

Constructor & Destructor Documentation

◆ ChatHandler() [1/2]

ChatHandler::ChatHandler ( WorldSession session)
inlineexplicit
41: m_session(session), sentErrorMessage(false) {}
WorldSession * m_session
Definition: Chat.h:250
bool sentErrorMessage
Definition: Chat.h:253

◆ ~ChatHandler()

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

◆ ChatHandler() [2/2]

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

Member Function Documentation

◆ _ParseCommands()

bool ChatHandler::_ParseCommands ( std::string_view  text)
231{
233 return true;
234
235 // Pretend commands don't exist for regular players
237 return false;
238
239 // Send error message for GMs
241 return true;
242}
@ CONFIG_ALLOW_PLAYER_COMMANDS
Definition: IWorld.h:73
@ LANG_CMD_INVALID
Definition: Language.h:38
#define sWorld
Definition: World.h:444
bool IsPlayerAccount(uint32 gmlevel)
Definition: AccountMgr.cpp:305
AC_GAME_API bool TryExecuteCommand(ChatHandler &handler, std::string_view cmd)
Definition: ChatCommand.cpp:529
void SendErrorMessage(uint32 entry)
Definition: Chat.cpp:218
AccountTypes GetSecurity() const
Definition: WorldSession.h:359

References CONFIG_ALLOW_PLAYER_COMMANDS, WorldSession::GetSecurity(), AccountMgr::IsPlayerAccount(), LANG_CMD_INVALID, m_session, 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
270{
271 std::size_t receiverGUIDPos = 0;
273 data << uint8(chatType);
274 data << int32(language);
275 data << senderGUID;
276 data << uint32(0); // some flags
277 switch (chatType)
278 {
287 data << uint32(senderName.length() + 1);
288 data << senderName;
289 receiverGUIDPos = data.wpos();
290 data << receiverGUID;
291 if (receiverGUID && !receiverGUID.IsPlayer() && !receiverGUID.IsPet())
292 {
293 data << uint32(receiverName.length() + 1);
294 data << receiverName;
295 }
296 break;
298 data << uint32(senderName.length() + 1);
299 data << senderName;
300 receiverGUIDPos = data.wpos();
301 data << receiverGUID;
302 break;
306 receiverGUIDPos = data.wpos();
307 data << receiverGUID;
308 if (receiverGUID && !receiverGUID.IsPlayer())
309 {
310 data << uint32(receiverName.length() + 1);
311 data << receiverName;
312 }
313 break;
316 receiverGUIDPos = data.wpos();
317 data << receiverGUID;
318 break;
319 default:
320 if (gmMessage)
321 {
322 data << uint32(senderName.length() + 1);
323 data << senderName;
324 }
325
326 if (chatType == CHAT_MSG_CHANNEL)
327 {
328 ASSERT(channelName.length() > 0);
329 data << channelName;
330 }
331
332 receiverGUIDPos = data.wpos();
333 data << receiverGUID;
334 break;
335 }
336
337 data << uint32(message.length() + 1);
338 data << message;
339 data << uint8(chatTag);
340
341 if (chatType == CHAT_MSG_ACHIEVEMENT || chatType == CHAT_MSG_GUILD_ACHIEVEMENT)
342 data << uint32(achievementId);
343
344 return receiverGUIDPos;
345}
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:3167
@ CHAT_MSG_RAID_BOSS_WHISPER
Definition: SharedDefines.h:3194
@ CHAT_MSG_WHISPER_FOREIGN
Definition: SharedDefines.h:3160
@ CHAT_MSG_GUILD_ACHIEVEMENT
Definition: SharedDefines.h:3201
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
Definition: SharedDefines.h:3189
@ CHAT_MSG_MONSTER_PARTY
Definition: SharedDefines.h:3165
@ CHAT_MSG_ACHIEVEMENT
Definition: SharedDefines.h:3200
@ CHAT_MSG_RAID_BOSS_EMOTE
Definition: SharedDefines.h:3193
@ CHAT_MSG_BATTLENET
Definition: SharedDefines.h:3199
@ CHAT_MSG_MONSTER_EMOTE
Definition: SharedDefines.h:3168
@ CHAT_MSG_MONSTER_SAY
Definition: SharedDefines.h:3164
@ CHAT_MSG_MONSTER_YELL
Definition: SharedDefines.h:3166
@ CHAT_MSG_BG_SYSTEM_HORDE
Definition: SharedDefines.h:3190
@ CHAT_MSG_BG_SYSTEM_NEUTRAL
Definition: SharedDefines.h:3188
@ CHAT_MSG_CHANNEL
Definition: SharedDefines.h:3169
@ SMSG_GM_MESSAGECHAT
Definition: Opcodes.h:977
@ SMSG_MESSAGECHAT
Definition: Opcodes.h:180
void Initialize(uint16 opcode, std::size_t newres=200)
Definition: WorldPacket.h:69
std::size_t wpos() const
Definition: ByteBuffer.h:330

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()(), CreatureTextBuilder::operator()(), PlayerTextBuilder::operator()(), Channel::Say(), Player::Say(), AddonChannelCommandHandler::Send(), SendGlobalGMSysMessage(), SendGlobalSysMessage(), SendGMText(), SendSysMessage(), AddonChannelCommandHandler::SendSysMessage(), SendWorldTextOptional(), World::SendZoneText(), Player::TextEmote(), Player::Whisper(), Unit::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
349{
350 ObjectGuid senderGUID;
351 std::string senderName = "";
352 uint8 chatTag = 0;
353 bool gmMessage = false;
354 ObjectGuid receiverGUID;
355 std::string receiverName = "";
356 if (sender)
357 {
358 senderGUID = sender->GetGUID();
359 senderName = sender->GetNameForLocaleIdx(locale);
360 if (Player const* playerSender = sender->ToPlayer())
361 {
362 chatTag = playerSender->GetChatTag();
363 gmMessage = playerSender->IsGameMaster();
364 }
365 }
366
367 if (receiver)
368 {
369 receiverGUID = receiver->GetGUID();
370 receiverName = receiver->GetNameForLocaleIdx(locale);
371 }
372
373 return BuildChatPacket(data, chatType, language, senderGUID, receiverGUID, message, chatTag, senderName, receiverName, achievementId, gmMessage, channelName);
374}
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:267
Player * ToPlayer()
Definition: Object.h:198
Definition: ObjectGuid.h:118
Definition: Player.h:1064

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

◆ DoForAllValidSessions()

void ChatHandler::DoForAllValidSessions ( std::function< void(Player *)>  exec)
447{
448 SessionMap::const_iterator itr;
449 for (itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
450 if (Player* player = itr->second->GetPlayer())
451 if (player->IsInWorld())
452 exec(player);
453}

References sWorld.

◆ extractKeyFromLink() [1/2]

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

References LANG_WRONG_LINK_TYPE, and SendSysMessage().

◆ extractKeyFromLink() [2/2]

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

References LANG_WRONG_LINK_TYPE, and SendSysMessage().

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

◆ extractLowGuidFromLink()

ObjectGuid::LowType ChatHandler::extractLowGuidFromLink ( char *  text,
HighGuid guidHigh 
)
700{
701 int type = 0;
702
703 // |color|Hcreature:creature_guid|h[name]|h|r
704 // |color|Hgameobject:go_guid|h[name]|h|r
705 // |color|Hplayer:name|h[name]|h|r
706 char* idS = extractKeyFromLink(text, guidKeys, &type);
707 if (!idS)
708 return 0;
709
710 switch (type)
711 {
713 {
714 guidHigh = HighGuid::Player;
715
716 std::string name = idS;
717 if (!normalizePlayerName(name))
718 return 0;
719
720 if (Player* player = ObjectAccessor::FindPlayerByName(name, false))
721 return player->GetGUID().GetCounter();
722
723 if (ObjectGuid guid = sCharacterCache->GetCharacterGuidByName(name))
724 return guid.GetCounter();
725
726 return 0;
727 }
729 {
730 guidHigh = HighGuid::Unit;
731
732 ObjectGuid::LowType lowguid = (uint32)atol(idS);
733
734 if (sObjectMgr->GetCreatureData(lowguid))
735 return lowguid;
736 else
737 return 0;
738 }
740 {
741 guidHigh = HighGuid::GameObject;
742
743 ObjectGuid::LowType lowguid = (uint32)atol(idS);
744
745 if (sObjectMgr->GetGameObjectData(lowguid))
746 return lowguid;
747 else
748 return 0;
749 }
750 }
751
752 // unknown type?
753 return 0;
754}
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:206
#define sObjectMgr
Definition: ObjectMgr.h:1623
@ SPELL_LINK_PLAYER
Definition: Chat.cpp:686
@ SPELL_LINK_CREATURE
Definition: Chat.cpp:687
@ SPELL_LINK_GAMEOBJECT
Definition: Chat.cpp:688
static char const *const guidKeys[]
Definition: Chat.cpp:691
#define sCharacterCache
Definition: CharacterCache.h:83
Player * FindPlayerByName(std::string const &name, bool checkInWorld=true)
Definition: ObjectAccessor.cpp:274
char * extractKeyFromLink(char *text, char const *linkType, char **something1=nullptr)
Definition: Chat.cpp:455
uint32 LowType
Definition: ObjectGuid.h:122

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

◆ extractPlayerNameFromLink()

std::string ChatHandler::extractPlayerNameFromLink ( char *  text)
757{
758 // |color|Hplayer:name|h[name]|h|r
759 char* name_str = extractKeyFromLink(text, "Hplayer");
760 if (!name_str)
761 return "";
762
763 std::string name = name_str;
764 if (!normalizePlayerName(name))
765 return "";
766
767 return name;
768}

References extractKeyFromLink(), and normalizePlayerName().

Referenced by extractPlayerTarget().

◆ extractPlayerTarget()

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

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

◆ extractQuotedArg()

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

◆ extractSpellIdFromLink()

uint32 ChatHandler::extractSpellIdFromLink ( char *  text)
631{
632 // number or [name] Shift-click form |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r
633 // number or [name] Shift-click form |color|Hglyph:glyph_slot_id:glyph_prop_id|h[%s]|h|r
634 // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
635 // number or [name] Shift-click form |color|Htalent:talent_id, rank|h[name]|h|r
636 // number or [name] Shift-click form |color|Htrade:spell_id, skill_id, max_value, cur_value|h[name]|h|r
637 int type = 0;
638 char* param1_str = nullptr;
639 char* idS = extractKeyFromLink(text, spellKeys, &type, &param1_str);
640 if (!idS)
641 return 0;
642
643 uint32 id = (uint32)atol(idS);
644
645 switch (type)
646 {
647 case SPELL_LINK_SPELL:
648 return id;
650 {
651 // talent
652 TalentEntry const* talentEntry = sTalentStore.LookupEntry(id);
653 if (!talentEntry)
654 return 0;
655
656 int32 rank = param1_str ? (uint32)atol(param1_str) : 0;
657 if (rank >= MAX_TALENT_RANK)
658 return 0;
659
660 if (rank < 0)
661 rank = 0;
662
663 return talentEntry->RankID[rank];
664 }
666 case SPELL_LINK_TRADE:
667 return id;
668 case SPELL_LINK_GLYPH:
669 {
670 uint32 glyph_prop_id = param1_str ? (uint32)atol(param1_str) : 0;
671
672 GlyphPropertiesEntry const* glyphPropEntry = sGlyphPropertiesStore.LookupEntry(glyph_prop_id);
673 if (!glyphPropEntry)
674 return 0;
675
676 return glyphPropEntry->SpellId;
677 }
678 }
679
680 // unknown type?
681 return 0;
682}
DBCStorage< TalentEntry > sTalentStore(TalentEntryfmt)
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
@ SPELL_LINK_SPELL
Definition: Chat.cpp:613
@ SPELL_LINK_GLYPH
Definition: Chat.cpp:617
@ SPELL_LINK_TALENT
Definition: Chat.cpp:614
@ SPELL_LINK_ENCHANT
Definition: Chat.cpp:615
@ SPELL_LINK_TRADE
Definition: Chat.cpp:616
static char const *const spellKeys[]
Definition: Chat.cpp:620
#define MAX_TALENT_RANK
Definition: DBCStructure.h:1918
Definition: DBCStructure.h:1021
uint32 SpellId
Definition: DBCStructure.h:1023
Definition: DBCStructure.h:1923
std::array< uint32, MAX_TALENT_RANK > RankID
Definition: DBCStructure.h:1928

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()

char const * ChatHandler::GetAcoreString ( uint32  entry) const
virtual

Reimplemented in CliHandler.

44{
45 return m_session->GetAcoreString(entry);
46}
char const * GetAcoreString(uint32 entry) const
Definition: WorldSession.cpp:790

References WorldSession::GetAcoreString(), and m_session.

Referenced by tele_commandscript::DoNameTeleport(), Acore::Impl::ChatCommands::GetAcoreString(), message_commandscript::HandleAnnounceCommand(), ban_commandscript::HandleBanInfoCharacterCommand(), ban_commandscript::HandleBanInfoHelper(), ban_commandscript::HandleBanInfoIPCommand(), character_commandscript::HandleCharacterReputationCommand(), character_commandscript::HandleCharacterTitlesCommand(), misc_commandscript::HandleCooldownCommand(), event_commandscript::HandleEventActiveListCommand(), event_commandscript::HandleEventInfoCommand(), message_commandscript::HandleGMNotifyCommand(), gm_commandscript::HandleGMVisibleCommand(), 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(), misc_commandscript::HandleSummonCommand(), misc_commandscript::HandleUnstuckCommand(), message_commandscript::HandleWhispersCommand(), list_commandscript::ListAurasCommand(), and SendSysMessage().

◆ GetCreatureFromPlayerMapByDbGuid()

Creature * ChatHandler::GetCreatureFromPlayerMapByDbGuid ( ObjectGuid::LowType  lowguid)
581{
582 if (!m_session)
583 return nullptr;
584
585 // Select the first alive creature or a dead one if not found
586 Creature* creature = nullptr;
587
588 auto bounds = m_session->GetPlayer()->GetMap()->GetCreatureBySpawnIdStore().equal_range(lowguid);
589 for (auto it = bounds.first; it != bounds.second; ++it)
590 {
591 creature = it->second;
592 if (it->second->IsAlive())
593 break;
594 }
595
596 return creature;
597}
Definition: Creature.h:46
Map * GetMap() const
Definition: Object.h:531
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition: Map.h:520
Player * GetPlayer() const
Definition: WorldSession.h:362

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

Referenced by npc_commandscript::HandleNpcSetMoveTypeCommand().

◆ GetModuleString()

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

References WorldSession::GetModuleString(), and m_session.

◆ GetNameLink() [1/2]

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

Reimplemented in CliHandler.

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

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
883{
884 return playerLink(chr->GetName());
885}
std::string playerLink(std::string const &name) const
Definition: Chat.h:233

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

◆ GetNearbyGameObject()

GameObject * ChatHandler::GetNearbyGameObject ( ) const
568{
569 if (!m_session)
570 return nullptr;
571
572 Player* pl = m_session->GetPlayer();
573 GameObject* obj = nullptr;
577 return obj;
578}
#define SIZE_OF_GRIDS
Definition: MapDefines.h:25
Definition: GameObject.h:121
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:179
Definition: GridNotifiers.h:335
Definition: GridNotifiers.h:703

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

Referenced by getSelectedObject(), and debug_commandscript::HandleDebugSendOpcodeCommand().

◆ GetObjectFromPlayerMapByDbGuid()

◆ GetPlayer()

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

References WorldSession::GetPlayer(), and m_session.

Referenced by Acore::ChatCommands::PlayerIdentifier::FromSelf(), Acore::ChatCommands::PlayerIdentifier::FromTarget(), debug_commandscript::HandleDebugCooldownCommand(), debug_commandscript::HandleDebugEnterVehicleCommand(), debug_commandscript::HandleDebugGetItemStateCommand(), debug_commandscript::HandleDebugGetItemValueCommand(), debug_commandscript::HandleDebugItemExpireCommand(), 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::HandleDebugUpdateWorldStateCommand(), debug_commandscript::HandleDebugVisualCommand(), gm_commandscript::HandleGMOffCommand(), gm_commandscript::HandleGMOnCommand(), learn_commandscript::HandleLearnAllLangCommand(), Acore::PlayerCommand::HandleLearnSpellCommand(), player_settings_commandscript::HandleSettingsAnnouncerFlags(), and AddonChannelCommandHandler::Send().

◆ GetPlayerGroupAndGUIDByName()

bool ChatHandler::GetPlayerGroupAndGUIDByName ( const char *  cname,
Player *&  player,
Group *&  group,
ObjectGuid guid,
bool  offline = false 
)
921{
922 player = nullptr;
923 guid = ObjectGuid::Empty;
924
925 if (cname)
926 {
927 std::string name = cname;
928 if (!name.empty())
929 {
930 if (!normalizePlayerName(name))
931 {
933 return false;
934 }
935
936 player = ObjectAccessor::FindPlayerByName(name, false);
937 if (offline)
938 {
939 guid = sCharacterCache->GetCharacterGuidByName(name);
940 }
941 }
942 }
943
944 if (player)
945 {
946 group = player->GetGroup();
947 if (!guid || !offline)
948 guid = player->GetGUID();
949 }
950 else
951 {
952 if (getSelectedPlayer())
953 player = getSelectedPlayer();
954 else
955 player = m_session->GetPlayer();
956
957 if (!guid || !offline)
958 guid = player->GetGUID();
959 group = player->GetGroup();
960 }
961
962 return true;
963}
Group * GetGroup()
Definition: Player.h:2448

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
413{
414 if (!m_session)
415 return nullptr;
416
418}
Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const)
Definition: ObjectAccessor.cpp:237
ObjectGuid GetTarget() const
Definition: Unit.h:1742

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

Referenced by cast_commandscript::HandleCastBackCommand(), cast_commandscript::HandleCastTargetCommad(), misc_commandscript::HandleComeToMeCommand(), debug_commandscript::HandleDebugGetLootRecipientCommand(), debug_commandscript::HandleDebugThreatListCommand(), misc_commandscript::HandleFreezeCommand(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcAddFormationCommand(), npc_commandscript::HandleNpcAddVendorItemCommand(), npc_commandscript::HandleNpcDeleteCommand(), npc_commandscript::HandleNpcDeleteVendorItemCommand(), 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::HandleNpcTameCommand(), npc_commandscript::HandleNpcTextEmoteCommand(), npc_commandscript::HandleNpcUnFollowCommand(), npc_commandscript::HandleNpcWhisperCommand(), npc_commandscript::HandleNpcYellCommand(), pet_commandscript::HandlePetCreateCommand(), misc_commandscript::HandleUnFreezeCommand(), wp_commandscript::HandleWpAddCommand(), wp_commandscript::HandleWpLoadCommand(), wp_commandscript::HandleWpModifyCommand(), wp_commandscript::HandleWpShowCommand(), and wp_commandscript::HandleWpUnLoadCommand().

◆ getSelectedObject()

WorldObject * ChatHandler::getSelectedObject ( ) const
400{
401 if (!m_session)
402 return nullptr;
403
405
406 if (!guid)
407 return GetNearbyGameObject();
408
410}
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
GameObject * GetNearbyGameObject() const
Definition: Chat.cpp:567

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
377{
378 if (!m_session)
379 return nullptr;
380
381 ObjectGuid selected = m_session->GetPlayer()->GetTarget();
382 if (!selected)
383 return m_session->GetPlayer();
384
386}
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:260

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

Referenced by extractPlayerTarget(), GetPlayerGroupAndGUIDByName(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetGmLevelCommand(), achievement_commandscript::HandleAchievementAddCommand(), 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
389{
390 if (!m_session)
391 return nullptr;
392
393 if (Unit* selected = m_session->GetPlayer()->GetSelectedUnit())
394 return selected;
395
396 return m_session->GetPlayer();
397}
Unit * GetSelectedUnit() const
Definition: Player.cpp:11535
Definition: Unit.h:630

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::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::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
244{ return m_session; }

Referenced by go_commandscript::DoTeleport(), account_commandscript::HandleAccount2FARemoveCommand(), account_commandscript::HandleAccount2FASetupCommand(), account_commandscript::HandleAccountAddonCommand(), account_commandscript::HandleAccountCommand(), account_commandscript::HandleAccountCreateCommand(), account_commandscript::HandleAccountLockCountryCommand(), account_commandscript::HandleAccountLockIpCommand(), account_commandscript::HandleAccountPasswordCommand(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetGmLevelCommand(), misc_commandscript::HandleAddItemCommand(), misc_commandscript::HandleAddItemSetCommand(), misc_commandscript::HandleAppearCommand(), arena_commandscript::HandleArenaLookupCommand(), bg_commandscript::HandleBagsClearCommand(), ban_commandscript::HandleBanCharacterCommand(), ban_commandscript::HandleBanHelper(), ban_commandscript::HandleBanListCharacterCommand(), ban_commandscript::HandleBanListHelper(), ban_commandscript::HandleBanListIPCommand(), misc_commandscript::HandleBindSightCommand(), 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::HandleGameObjectMoveCommand(), gobject_commandscript::HandleGameObjectNearCommand(), gobject_commandscript::HandleGameObjectTargetCommand(), gobject_commandscript::HandleGameObjectTurnCommand(), misc_commandscript::HandleGetDistanceCommand(), gm_commandscript::HandleGMChatCommand(), gm_commandscript::HandleGMFlyCommand(), gm_commandscript::HandleGMListFullCommand(), gm_commandscript::HandleGMListIngameCommand(), message_commandscript::HandleGMNameAnnounceCommand(), 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(), 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::HandleLearnAllMySpellsCommand(), learn_commandscript::HandleLearnAllMyTalentsCommand(), character_commandscript::HandleLevelUpCommand(), misc_commandscript::HandleLinkGraveCommand(), list_commandscript::HandleListCreatureCommand(), list_commandscript::HandleListObjectCommand(), 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::HandleNpcFollowCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcNearCommand(), npc_commandscript::HandleNpcSetFactionTempIdCommand(), npc_commandscript::HandleNpcSetOriginalFaction(), npc_commandscript::HandleNpcTameCommand(), npc_commandscript::HandleNpcUnFollowCommand(), pet_commandscript::HandlePetCreateCommand(), pet_commandscript::HandlePetLearnCommand(), pet_commandscript::HandlePetUnlearnCommand(), misc_commandscript::HandlePInfoCommand(), misc_commandscript::HandlePossessCommand(), cheat_commandscript::HandlePowerCheatCommand(), reset_commandscript::HandleResetAllCommand(), reset_commandscript::HandleResetSpellsCommand(), reset_commandscript::HandleResetTalentsCommand(), misc_commandscript::HandleRespawnAllCommand(), misc_commandscript::HandleRespawnCommand(), 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()

◆ GetSessionDbLocaleIndex()

int ChatHandler::GetSessionDbLocaleIndex ( ) const
virtual

◆ HasLowerSecurity()

bool ChatHandler::HasLowerSecurity ( Player target,
ObjectGuid  guid = ObjectGuid::Empty,
bool  strong = false 
)
60{
61 WorldSession* target_session = nullptr;
62 uint32 target_account = 0;
63
64 if (target)
65 target_session = target->GetSession();
66 else if (guid)
67 target_account = sCharacterCache->GetCharacterAccountIdByGuid(guid);
68
69 if (!target_session && !target_account)
70 {
72 return true;
73 }
74
75 return HasLowerSecurityAccount(target_session, target_account, strong);
76}
bool HasLowerSecurityAccount(WorldSession *target, uint32 account, bool strong=false)
Definition: Chat.cpp:78
WorldSession * GetSession() const
Definition: Player.h:1978
Player session in the World.
Definition: WorldSession.h:330

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

Referenced by modify_commandscript::CheckModifyInt32(), modify_commandscript::CheckModifySpeed(), tele_commandscript::DoNameTeleport(), 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 
)
79{
80 uint32 target_sec;
81
82 // allow everything from console and RA console
83 if (!m_session)
84 return false;
85
86 // ignore only for non-players for non strong checks (when allow apply command at least to same sec level)
88 return false;
89
90 if (target)
91 target_sec = target->GetSecurity();
92 else if (target_account)
93 target_sec = AccountMgr::GetSecurity(target_account, realm.Id.Realm);
94 else
95 return true; // caller must report error for (target == nullptr && target_account == 0)
96
97 AccountTypes target_ac_sec = AccountTypes(target_sec);
98 if (m_session->GetSecurity() < target_ac_sec || (strong && m_session->GetSecurity() <= target_ac_sec))
99 {
101 return true;
102 }
103
104 return false;
105}
AccountTypes
Definition: Common.h:56
@ CONFIG_GM_LOWER_SECURITY
Definition: IWorld.h:95
@ LANG_YOURS_SECURITY_IS_LOW
Definition: Language.h:429
Realm realm
Definition: World.cpp:112
uint32 GetSecurity(uint32 accountId)
Definition: AccountMgr.cpp:238
uint32 Realm
Definition: Realm.h:43
RealmHandle Id
Definition: Realm.h:69

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

Referenced by account_commandscript::HandleAccountDeleteCommand(), account_commandscript::HandleAccountSet2FACommand(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetPasswordCommand(), and HasLowerSecurity().

◆ HasSentErrorMessage()

◆ HasSession()

bool ChatHandler::HasSession ( ) const
virtual

Reimplemented in CliHandler.

439{
440 if (!m_session)
441 return false;
442
443 return true;
444}

References m_session.

◆ IsAvailable()

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

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

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

◆ IsConsole()

bool ChatHandler::IsConsole ( ) const
inline

◆ IsHumanReadable()

virtual bool ChatHandler::IsHumanReadable ( ) const
inlinevirtual

Reimplemented in AddonChannelCommandHandler.

199{ return true; }

◆ LineFromMessage()

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

◆ needReportToTarget()

◆ ParseCommands()

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

Reimplemented in CliHandler, and AddonChannelCommandHandler.

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

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

◆ PGetParseModuleString()

template<typename... Args>
std::string ChatHandler::PGetParseModuleString ( std::string  module,
uint32  id,
Args &&...  args 
) const
inline
172 {
173 return Acore::StringFormat(GetModuleString(module, id)->c_str(), std::forward<Args>(args)...);
174 }
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default AC string format function.
Definition: StringFormat.h:34
std::string const * GetModuleString(std::string module, uint32 id) const
Definition: Chat.cpp:48

References Acore::StringFormat().

◆ PGetParseString()

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

◆ playerLink()

◆ PSendModuleSysMessage()

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

◆ PSendSysMessage() [1/3]

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

References Acore::StringFormat().

◆ PSendSysMessage() [2/3]

void ChatHandler::PSendSysMessage ( std::string_view  str,
bool  escapeCharacters = false 
)
214{
215 SendSysMessage(str, escapeCharacters);
216}

References SendSysMessage().

Referenced by Battleground::_ProcessProgress(), Player::AddItem(), BattlegroundSA::CaptureGraveyard(), 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::HandleAccountLockCountryCommand(), account_commandscript::HandleAccountLockIpCommand(), account_commandscript::HandleAccountOnlineListCommand(), account_commandscript::HandleAccountRemoveLockCountryCommand(), account_commandscript::HandleAccountSet2FACommand(), account_commandscript::HandleAccountSetAddonCommand(), account_commandscript::HandleAccountSetGmLevelCommand(), 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(), 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(), 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(), cheat_commandscript::HandleCheatStatusCommand(), misc_commandscript::HandleCooldownCommand(), debug_commandscript::HandleDebugAnimCommand(), debug_commandscript::HandleDebugAreaTriggersCommand(), debug_commandscript::HandleDebugEnterVehicleCommand(), debug_commandscript::HandleDebugGetItemStateCommand(), debug_commandscript::HandleDebugGetItemValueCommand(), debug_commandscript::HandleDebugGetLootRecipientCommand(), debug_commandscript::HandleDebugGetValueCommand(), debug_commandscript::HandleDebugHostileRefListCommand(), debug_commandscript::HandleDebugLoSCommand(), 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::HandleDebugThreatListCommand(), debug_commandscript::HandleDebugUpdateCommand(), 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::HandleGameObjectInfoCommand(), gobject_commandscript::HandleGameObjectMoveCommand(), gobject_commandscript::HandleGameObjectNearCommand(), gobject_commandscript::HandleGameObjectRespawn(), gobject_commandscript::HandleGameObjectSetStateCommand(), 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::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(), 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(), 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::HandleNpcFollowCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcNearCommand(), npc_commandscript::HandleNpcSetDataCommand(), npc_commandscript::HandleNpcSetLinkCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetSpawnTimeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), npc_commandscript::HandleNpcTameCommand(), npc_commandscript::HandleNpcUnFollowCommand(), character_commandscript::HandlePDumpCopyCommand(), character_commandscript::HandlePDumpLoadCommand(), character_commandscript::HandlePDumpWriteCommand(), pet_commandscript::HandlePetLearnCommand(), pet_commandscript::HandlePetUnlearnCommand(), misc_commandscript::HandlePInfoCommand(), misc_commandscript::HandlePlayAllCommand(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), quest_commandscript::HandleQuestAdd(), quest_commandscript::HandleQuestComplete(), quest_commandscript::HandleQuestRemove(), quest_commandscript::HandleQuestReward(), 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(), send_commandscript::HandleSendItemsCommand(), send_commandscript::HandleSendMailCommand(), send_commandscript::HandleSendMessageCommand(), send_commandscript::HandleSendMoneyCommand(), server_commandscript::HandleServerDebugCommand(), server_commandscript::HandleServerInfoCommand(), server_commandscript::HandleServerMotdCommand(), server_commandscript::HandleServerSetMotdCommand(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSetSkillCommand(), player_settings_commandscript::HandleSettingsAnnouncerFlags(), misc_commandscript::HandleSkirmishCommand(), spectator_commandscript::HandleSpectatorCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), misc_commandscript::HandleStringCommand(), misc_commandscript::HandleSummonCommand(), WorldSession::HandleSummonResponseOpcode(), 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(), lookup_commandscript::LookupPlayerSearchCommand(), modify_commandscript::NotifyModification(), npc_icc_buff_switcher::OnGossipSelect(), BattlegroundSA::PostUpdateImpl(), Player::PrettyPrintRequirementsAchievementsList(), Player::PrettyPrintRequirementsItemsList(), Player::PrettyPrintRequirementsQuestList(), Player::RewardHonor(), Player::Satisfy(), Acore::Impl::ChatCommands::ChatCommandNode::SendCommandHelp(), Acore::Impl::ChatCommands::ChatCommandNode::SendCommandHelpFor(), BattlegroundQueue::SendJoinMessageArenaQueue(), BattlegroundQueue::SendMessageBGQueue(), 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
150 {
151 if (HasSession())
152 SendSysMessage(PGetParseString(entry, std::forward<Args>(args)...));
153 }
std::string PGetParseString(uint32 entry, Args &&... args) const
Definition: Chat.h:156

◆ SendErrorMessage() [1/4]

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

◆ SendErrorMessage() [2/4]

void ChatHandler::SendErrorMessage ( std::string_view  str,
bool  escapeCharacters 
)
225{
226 SendSysMessage(str, escapeCharacters);
228}

References SendSysMessage(), and SetSentErrorMessage().

◆ SendErrorMessage() [3/4]

void ChatHandler::SendErrorMessage ( uint32  entry)
219{
220 SendSysMessage(entry);
222}

References SendSysMessage(), and SetSentErrorMessage().

Referenced by _ParseCommands(), modify_commandscript::CheckModifyInt32(), modify_commandscript::CheckModifySpeed(), cast_commandscript::CheckSpellExistsAndIsValid(), tele_commandscript::DoNameTeleport(), go_commandscript::DoTeleport(), extractPlayerTarget(), GetPlayerGroupAndGUIDByName(), account_commandscript::HandleAccount2FARemoveCommand(), account_commandscript::HandleAccount2FASetupCommand(), account_commandscript::HandleAccountAddonCommand(), account_commandscript::HandleAccountCreateCommand(), account_commandscript::HandleAccountDeleteCommand(), 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::HandleArenaRenameCommand(), misc_commandscript::HandleAuraCommand(), misc_commandscript::HandleAuraStacksCommand(), ban_commandscript::HandleBanCharacterCommand(), ban_commandscript::HandleBanHelper(), ban_commandscript::HandleBanInfoAccountCommand(), bf_commandscript::HandleBattlefieldTimer(), 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(), misc_commandscript::HandleCombatStopCommand(), misc_commandscript::HandleComeToMeCommand(), misc_commandscript::HandleCommentatorCommand(), misc_commandscript::HandleCooldownCommand(), misc_commandscript::HandleDamageCommand(), debug_commandscript::HandleDebugGetValueCommand(), 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(), 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::HandleGameObjectInfoCommand(), gobject_commandscript::HandleGameObjectMoveCommand(), gobject_commandscript::HandleGameObjectRespawn(), gobject_commandscript::HandleGameObjectSetPhaseCommand(), gobject_commandscript::HandleGameObjectSetStateCommand(), 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(), 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(), 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::HandleNpcFollowCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), 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::HandleNpcTameCommand(), npc_commandscript::HandleNpcTextEmoteCommand(), npc_commandscript::HandleNpcUnFollowCommand(), npc_commandscript::HandleNpcWhisperCommand(), npc_commandscript::HandleNpcYellCommand(), character_commandscript::HandlePDumpCopyCommand(), character_commandscript::HandlePDumpLoadCommand(), character_commandscript::HandlePDumpWriteCommand(), pet_commandscript::HandlePetCreateCommand(), pet_commandscript::HandlePetLearnCommand(), pet_commandscript::HandlePetUnlearnCommand(), misc_commandscript::HandlePlayAllCommand(), quest_commandscript::HandleQuestAdd(), quest_commandscript::HandleQuestComplete(), quest_commandscript::HandleQuestRemove(), quest_commandscript::HandleQuestReward(), 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(), send_commandscript::HandleSendItemsCommand(), server_commandscript::HandleServerIdleRestartCommand(), server_commandscript::HandleServerIdleShutDownCommand(), server_commandscript::HandleServerRestartCommand(), server_commandscript::HandleServerSetClosedCommand(), server_commandscript::HandleServerShutDownCommand(), misc_commandscript::HandleSetSkillCommand(), misc_commandscript::HandleShowAreaCommand(), misc_commandscript::HandleSkirmishCommand(), 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
188 {
189 PSendSysMessage(entry, std::forward<Args>(args)...);
191 }

◆ SendGlobalGMSysMessage()

void ChatHandler::SendGlobalGMSysMessage ( const char *  str)
199{
200 WorldPacket data;
201 for (std::string_view line : Acore::Tokenize(str, '\n', true))
202 {
203 BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
204 sWorld->SendGlobalGMMessage(&data);
205 }
206}
@ CHAT_MSG_SYSTEM
Definition: SharedDefines.h:3152
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition: Tokenize.cpp:20
Definition: WorldPacket.h:27

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

Referenced by bf_commandscript::HandleBattlefieldEnable(), bf_commandscript::HandleBattlefieldEnd(), bf_commandscript::HandleBattlefieldStart(), bf_commandscript::HandleBattlefieldSwitch(), bf_commandscript::HandleBattlefieldTimer(), 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::HandleReloadAreaTriggerCommand(), reload_commandscript::HandleReloadAreaTriggerTavernCommand(), reload_commandscript::HandleReloadAreaTriggerTeleportCommand(), reload_commandscript::HandleReloadAuctionsCommand(), reload_commandscript::HandleReloadAutobroadcastCommand(), reload_commandscript::HandleReloadBattlegroundTemplate(), reload_commandscript::HandleReloadBroadcastTextCommand(), 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::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::HandleReloadNpcTrainerCommand(), 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::HandleReloadReputationRewardRateCommand(), reload_commandscript::HandleReloadReputationSpilloverTemplateCommand(), reload_commandscript::HandleReloadReservedNameCommand(), reload_commandscript::HandleReloadSkillDiscoveryTemplateCommand(), reload_commandscript::HandleReloadSkillExtraItemTemplateCommand(), reload_commandscript::HandleReloadSkillFishingBaseLevelCommand(), reload_commandscript::HandleReloadSkillPerfectItemTemplateCommand(), reload_commandscript::HandleReloadSmartScripts(), reload_commandscript::HandleReloadSpellAreaCommand(), reload_commandscript::HandleReloadSpellBonusesCommand(), reload_commandscript::HandleReloadSpellClickSpellsCommand(), reload_commandscript::HandleReloadSpellGroupsCommand(), reload_commandscript::HandleReloadSpellGroupStackRulesCommand(), reload_commandscript::HandleReloadSpellLinkedSpellCommand(), reload_commandscript::HandleReloadSpellPetAurasCommand(), reload_commandscript::HandleReloadSpellProcEventCommand(), reload_commandscript::HandleReloadSpellProcsCommand(), reload_commandscript::HandleReloadSpellRequiredCommand(), reload_commandscript::HandleReloadSpellScriptsCommand(), reload_commandscript::HandleReloadSpellTargetPositionCommand(), reload_commandscript::HandleReloadSpellThreatsCommand(), reload_commandscript::HandleReloadVehicleAccessoryCommand(), reload_commandscript::HandleReloadVehicleTemplateAccessoryCommand(), reload_commandscript::HandleReloadWardenactionCommand(), reload_commandscript::HandleReloadWpCommand(), and reload_commandscript::HandleReloadWpScriptsCommand().

◆ SendGlobalSysMessage()

void ChatHandler::SendGlobalSysMessage ( const char *  str)
189{
190 WorldPacket data;
191 for (std::string_view line : Acore::Tokenize(str, '\n', true))
192 {
193 BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
194 sWorld->SendGlobalMessage(&data);
195 }
196}

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

Referenced by reload_commandscript::HandleReloadMotdCommand().

◆ SendGMText() [1/3]

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

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

◆ SendGMText() [2/3]

void ChatHandler::SendGMText ( std::string_view  str)
119{
120 std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
121 // Session should have permissions to receive global gm messages
123 return;
124
125 for (std::string_view line : lines)
126 {
127 WorldPacket data;
128 ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
129 m_session->SendPacket(&data);
130 }
131}
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:214

References BuildChatPacket(), CHAT_MSG_SYSTEM, WorldSession::GetSecurity(), AccountMgr::IsPlayerAccount(), LANG_UNIVERSAL, m_session, WorldSession::SendPacket(), 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
71 {
72 // GMText should be sent to all sessions
73 DoForAllValidSessions([&](Player* player)
74 {
75 m_session = player->GetSession();
76 SendGMText(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
77 });
78 }

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

◆ SendNotification() [1/3]

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

References Acore::StringFormat().

◆ SendNotification() [2/3]

void ChatHandler::SendNotification ( std::string_view  str)
108{
109 std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
110 for (std::string_view line : lines)
111 {
112 WorldPacket data(SMSG_NOTIFICATION, line.size() + 1);
113 data << line.data();
114 m_session->SendPacket(&data);
115 }
116}
@ SMSG_NOTIFICATION
Definition: Opcodes.h:489

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

Referenced by InstanceScript::DoSendNotifyToInstance(), Spell::EffectPlaySound(), WorldSession::HandleAcceptTradeOpcode(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlemasterHelloOpcode(), misc_commandscript::HandleCommentatorCommand(), misc_commandscript::HandleDevCommand(), gm_commandscript::HandleGMChatCommand(), gm_commandscript::HandleGMOffCommand(), gm_commandscript::HandleGMOnCommand(), 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(), Battleground::ReadyMarkerClicked(), and WorldSession::SendAuctionHello().

◆ SendNotification() [3/3]

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

References Acore::StringFormat().

◆ SendSysMessage() [1/2]

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

Reimplemented in AddonChannelCommandHandler, AddonChannelCommandHandler, and CliHandler.

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

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

Referenced by 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(), bg_commandscript::HandleBagsClearCommand(), ban_commandscript::HandleBanListCharacterCommand(), ban_commandscript::HandleBanListHelper(), ban_commandscript::HandleBanListIPCommand(), WorldSession::HandleCancelMountAuraOpcode(), cheat_commandscript::HandleCasttimeCheatCommand(), WorldSession::HandleCharacterAuraFrozen(), character_commandscript::HandleCharacterDeletedDeleteCommand(), character_commandscript::HandleCharacterDeletedListHelper(), character_commandscript::HandleCharacterDeletedRestoreCommand(), character_commandscript::HandleCharacterReputationCommand(), cheat_commandscript::HandleCheatStatusCommand(), cheat_commandscript::HandleCoolDownCheatCommand(), debug_commandscript::HandleDebugDummyCommand(), debug_commandscript::HandleDebugGetItemStateCommand(), debug_commandscript::HandleDebugHostileRefListCommand(), debug_commandscript::HandleDebugSendLargePacketCommand(), 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(), misc_commandscript::HandleHideAreaCommand(), inventory_commandscript::HandleInventoryCountCommand(), learn_commandscript::HandleLearnAllCraftsCommand(), learn_commandscript::HandleLearnAllGMCommand(), learn_commandscript::HandleLearnAllLangCommand(), learn_commandscript::HandleLearnAllMyPetTalentsCommand(), learn_commandscript::HandleLearnAllMySpellsCommand(), learn_commandscript::HandleLearnAllMyTalentsCommand(), learn_commandscript::HandleLearnAllRecipesCommand(), 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(), cheat_commandscript::HandlePowerCheatCommand(), reset_commandscript::HandleResetAllCommand(), reset_commandscript::HandleResetSpellsCommand(), reset_commandscript::HandleResetTalentsCommand(), 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(), Acore::Impl::ChatCommands::ChatCommandNode::SendCommandHelp(), Acore::Impl::ChatCommands::ChatCommandNode::SendCommandHelpFor(), SendErrorMessage(), Acore::Impl::ChatCommands::SendErrorMessageToHandler(), SendSysMessage(), Player::SendSystemMessage(), TicketMgr::ShowClosedList(), TicketMgr::ShowEscalatedList(), TicketMgr::ShowList(), and Player::Whisper().

◆ SendSysMessage() [2/2]

void ChatHandler::SendSysMessage ( uint32  entry)
209{
211}

References GetAcoreString(), and SendSysMessage().

◆ SendWorldText() [1/3]

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

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

◆ SendWorldText() [2/3]

◆ SendWorldText() [3/3]

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

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

◆ SendWorldTextOptional() [1/3]

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

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

◆ SendWorldTextOptional() [2/3]

void ChatHandler::SendWorldTextOptional ( std::string_view  str,
uint32  flag 
)
146{
147 std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
148
149 Player* player = m_session->GetPlayer();
150 if (sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
152 return;
153
154 for (std::string_view line : lines)
155 {
156 WorldPacket data;
157 ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
158 player->SendDirectMessage(&data);
159 }
160}
@ CONFIG_PLAYER_SETTINGS_ENABLED
Definition: IWorld.h:176
const std::string AzerothcorePSSource
Definition: PlayerSettings.h:23
@ SETTING_ANNOUNCER_FLAGS
Definition: PlayerSettings.h:27
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5692
PlayerSetting GetPlayerSetting(std::string source, uint8 index)
Definition: PlayerSettings.cpp:70
bool HasFlag(uint32 flag)
Definition: PlayerSettings.h:42

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 BattlegroundQueue::BattlegroundQueueAnnouncerUpdate(), BattlegroundQueue::SendExitMessageArenaQueue(), BattlegroundQueue::SendJoinMessageArenaQueue(), BattlegroundQueue::SendMessageBGQueue(), and AutobroadcastMgr::SendWorldAnnouncement().

◆ SendWorldTextOptional() [3/3]

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

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

◆ SetSentErrorMessage()

Member Data Documentation

◆ m_session

◆ sentErrorMessage

bool ChatHandler::sentErrorMessage
private