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
39: m_session(session), sentErrorMessage(false) {}
WorldSession * m_session
Definition: Chat.h:248
bool sentErrorMessage
Definition: Chat.h:251

◆ ~ChatHandler()

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

◆ ChatHandler() [2/2]

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

Member Function Documentation

◆ _ParseCommands()

bool ChatHandler::_ParseCommands ( std::string_view  text)
228{
230 return true;
231
232 // Pretend commands don't exist for regular players
234 return false;
235
236 // Send error message for GMs
238 return true;
239}
@ LANG_CMD_INVALID
Definition: Language.h:38
@ CONFIG_ALLOW_PLAYER_COMMANDS
Definition: IWorld.h:68
#define sWorld
Definition: World.h:443
bool IsPlayerAccount(uint32 gmlevel)
Definition: AccountMgr.cpp:305
AC_GAME_API bool TryExecuteCommand(ChatHandler &handler, std::string_view cmd)
Definition: ChatCommand.cpp:532
void SendErrorMessage(uint32 entry)
Definition: Chat.cpp:215
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
267{
268 std::size_t receiverGUIDPos = 0;
270 data << uint8(chatType);
271 data << int32(language);
272 data << senderGUID;
273 data << uint32(0); // some flags
274 switch (chatType)
275 {
284 data << uint32(senderName.length() + 1);
285 data << senderName;
286 receiverGUIDPos = data.wpos();
287 data << receiverGUID;
288 if (receiverGUID && !receiverGUID.IsPlayer() && !receiverGUID.IsPet())
289 {
290 data << uint32(receiverName.length() + 1);
291 data << receiverName;
292 }
293 break;
295 data << uint32(senderName.length() + 1);
296 data << senderName;
297 receiverGUIDPos = data.wpos();
298 data << receiverGUID;
299 break;
303 receiverGUIDPos = data.wpos();
304 data << receiverGUID;
305 if (receiverGUID && !receiverGUID.IsPlayer())
306 {
307 data << uint32(receiverName.length() + 1);
308 data << receiverName;
309 }
310 break;
313 receiverGUIDPos = data.wpos();
314 data << receiverGUID;
315 break;
316 default:
317 if (gmMessage)
318 {
319 data << uint32(senderName.length() + 1);
320 data << senderName;
321 }
322
323 if (chatType == CHAT_MSG_CHANNEL)
324 {
325 ASSERT(channelName.length() > 0);
326 data << channelName;
327 }
328
329 receiverGUIDPos = data.wpos();
330 data << receiverGUID;
331 break;
332 }
333
334 data << uint32(message.length() + 1);
335 data << message;
336 data << uint8(chatTag);
337
338 if (chatType == CHAT_MSG_ACHIEVEMENT || chatType == CHAT_MSG_GUILD_ACHIEVEMENT)
339 data << uint32(achievementId);
340
341 return receiverGUIDPos;
342}
#define ASSERT
Definition: Errors.h:68
std::int32_t int32
Definition: Define.h:103
std::uint8_t uint8
Definition: Define.h:109
std::uint32_t uint32
Definition: Define.h:107
@ 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:68
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(), 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
346{
347 ObjectGuid senderGUID;
348 std::string senderName = "";
349 uint8 chatTag = 0;
350 bool gmMessage = false;
351 ObjectGuid receiverGUID;
352 std::string receiverName = "";
353 if (sender)
354 {
355 senderGUID = sender->GetGUID();
356 senderName = sender->GetNameForLocaleIdx(locale);
357 if (Player const* playerSender = sender->ToPlayer())
358 {
359 chatTag = playerSender->GetChatTag();
360 gmMessage = playerSender->IsGameMaster();
361 }
362 }
363
364 if (receiver)
365 {
366 receiverGUID = receiver->GetGUID();
367 receiverName = receiver->GetNameForLocaleIdx(locale);
368 }
369
370 return BuildChatPacket(data, chatType, language, senderGUID, receiverGUID, message, chatTag, senderName, receiverName, achievementId, gmMessage, channelName);
371}
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:264
Player * ToPlayer()
Definition: Object.h:201
Definition: ObjectGuid.h:118
Definition: Player.h:1081

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

◆ DoForAllValidSessions()

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

References sWorld.

◆ extractKeyFromLink() [1/2]

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

References LANG_WRONG_LINK_TYPE, and SendSysMessage().

◆ extractKeyFromLink() [2/2]

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

References LANG_WRONG_LINK_TYPE, and SendSysMessage().

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

◆ extractLowGuidFromLink()

ObjectGuid::LowType ChatHandler::extractLowGuidFromLink ( char *  text,
HighGuid guidHigh 
)
697{
698 int type = 0;
699
700 // |color|Hcreature:creature_guid|h[name]|h|r
701 // |color|Hgameobject:go_guid|h[name]|h|r
702 // |color|Hplayer:name|h[name]|h|r
703 char* idS = extractKeyFromLink(text, guidKeys, &type);
704 if (!idS)
705 return 0;
706
707 switch (type)
708 {
710 {
711 guidHigh = HighGuid::Player;
712
713 std::string name = idS;
714 if (!normalizePlayerName(name))
715 return 0;
716
717 if (Player* player = ObjectAccessor::FindPlayerByName(name, false))
718 return player->GetGUID().GetCounter();
719
720 if (ObjectGuid guid = sCharacterCache->GetCharacterGuidByName(name))
721 return guid.GetCounter();
722
723 return 0;
724 }
726 {
727 guidHigh = HighGuid::Unit;
728
729 ObjectGuid::LowType lowguid = (uint32)atol(idS);
730
731 if (sObjectMgr->GetCreatureData(lowguid))
732 return lowguid;
733 else
734 return 0;
735 }
737 {
738 guidHigh = HighGuid::GameObject;
739
740 ObjectGuid::LowType lowguid = (uint32)atol(idS);
741
742 if (sObjectMgr->GetGameObjectData(lowguid))
743 return lowguid;
744 else
745 return 0;
746 }
747 }
748
749 // unknown type?
750 return 0;
751}
#define sObjectMgr
Definition: ObjectMgr.h:1635
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:208
@ SPELL_LINK_PLAYER
Definition: Chat.cpp:683
@ SPELL_LINK_CREATURE
Definition: Chat.cpp:684
@ SPELL_LINK_GAMEOBJECT
Definition: Chat.cpp:685
static char const *const guidKeys[]
Definition: Chat.cpp:688
#define sCharacterCache
Definition: CharacterCache.h:83
Player * FindPlayerByName(std::string const &name, bool checkInWorld=true)
Definition: ObjectAccessor.cpp:271
char * extractKeyFromLink(char *text, char const *linkType, char **something1=nullptr)
Definition: Chat.cpp:452
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)
754{
755 // |color|Hplayer:name|h[name]|h|r
756 char* name_str = extractKeyFromLink(text, "Hplayer");
757 if (!name_str)
758 return "";
759
760 std::string name = name_str;
761 if (!normalizePlayerName(name))
762 return "";
763
764 return name;
765}

References extractKeyFromLink(), and normalizePlayerName().

Referenced by extractPlayerTarget().

◆ extractPlayerTarget()

bool ChatHandler::extractPlayerTarget ( char *  args,
Player **  player,
ObjectGuid player_guid = nullptr,
std::string *  player_name = nullptr 
)
768{
769 if (args && *args)
770 {
771 std::string name = extractPlayerNameFromLink(args);
772 if (name.empty())
773 {
775 return false;
776 }
777
778 Player* pl = ObjectAccessor::FindPlayerByName(name, false);
779
780 // if allowed player pointer
781 if (player)
782 *player = pl;
783
784 // if need guid value from DB (in name case for check player existence)
785 ObjectGuid guid = !pl && (player_guid || player_name) ? sCharacterCache->GetCharacterGuidByName(name) : ObjectGuid::Empty;
786
787 // if allowed player guid (if no then only online players allowed)
788 if (player_guid)
789 *player_guid = pl ? pl->GetGUID() : guid;
790
791 if (player_name)
792 *player_name = pl || guid ? name : "";
793 }
794 else
795 {
796 // populate strtok buffer to prevent crashes
797 static char dummy[1] = "";
798 strtok(dummy, "");
799
801 // if allowed player pointer
802 if (player)
803 *player = pl;
804
805 // if allowed player guid (if no then only online players allowed)
806 if (player_guid)
807 *player_guid = pl ? pl->GetGUID() : ObjectGuid::Empty;
808
809 if (player_name)
810 *player_name = pl ? pl->GetName() : "";
811 }
812
813 // some from req. data must be provided (note: name is empty if player not exist)
814 if ((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty()))
815 {
817 return false;
818 }
819
820 return true;
821}
@ LANG_PLAYER_NOT_FOUND
Definition: Language.h:539
std::string extractPlayerNameFromLink(char *text)
Definition: Chat.cpp:753
Player * getSelectedPlayer() const
Definition: Chat.cpp:373
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
std::string const & GetName() const
Definition: Object.h:463
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)
824{
825 if (!*args)
826 return nullptr;
827
828 if (*args == '"')
829 return strtok(args + 1, "\"");
830 else
831 {
832 // skip spaces
833 while (*args == ' ')
834 {
835 args += 1;
836 continue;
837 }
838
839 // return nullptr if we reached the end of the string
840 if (!*args)
841 return nullptr;
842
843 // since we skipped all spaces, we expect another token now
844 if (*args == '"')
845 {
846 // return an empty string if there are 2 "" in a row.
847 // strtok doesn't handle this case
848 if (*(args + 1) == '"')
849 {
850 strtok(args, " ");
851 static char arg[1];
852 arg[0] = '\0';
853 return arg;
854 }
855 else
856 return strtok(args + 1, "\"");
857 }
858 else
859 return nullptr;
860 }
861}

◆ extractSpellIdFromLink()

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

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.

41{
42 return m_session->GetAcoreString(entry);
43}
char const * GetAcoreString(uint32 entry) const
Definition: WorldSession.cpp:794

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)
578{
579 if (!m_session)
580 return nullptr;
581
582 // Select the first alive creature or a dead one if not found
583 Creature* creature = nullptr;
584
585 auto bounds = m_session->GetPlayer()->GetMap()->GetCreatureBySpawnIdStore().equal_range(lowguid);
586 for (auto it = bounds.first; it != bounds.second; ++it)
587 {
588 creature = it->second;
589 if (it->second->IsAlive())
590 break;
591 }
592
593 return creature;
594}
Definition: Creature.h:43
Map * GetMap() const
Definition: Object.h:536
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition: Map.h:518
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
46{
47 return m_session->GetModuleString(module, id);
48}
std::string const * GetModuleString(std::string module, uint32 id) const
Definition: WorldSession.cpp:799

References WorldSession::GetModuleString(), and m_session.

◆ GetNameLink() [1/2]

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

Reimplemented in CliHandler.

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

References GetNameLink().

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

◆ GetNameLink() [2/2]

std::string ChatHandler::GetNameLink ( Player chr) const
880{
881 return playerLink(chr->GetName());
882}
std::string playerLink(std::string const &name) const
Definition: Chat.h:231

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

◆ GetNearbyGameObject()

GameObject * ChatHandler::GetNearbyGameObject ( ) const
565{
566 if (!m_session)
567 return nullptr;
568
569 Player* pl = m_session->GetPlayer();
570 GameObject* obj = nullptr;
574 return obj;
575}
#define SIZE_OF_GRIDS
Definition: MapDefines.h:25
Definition: GameObject.h:120
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:178
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
36{
37 return m_session ? m_session->GetPlayer() : nullptr;
38}

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(), reload_commandscript::HandleReloadMotdCommand(), server_commandscript::HandleServerMotdCommand(), player_settings_commandscript::HandleSettingsAnnouncerFlags(), and AddonChannelCommandHandler::Send().

◆ GetPlayerGroupAndGUIDByName()

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

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
410{
411 if (!m_session)
412 return nullptr;
413
415}
Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const)
Definition: ObjectAccessor.cpp:234
ObjectGuid GetTarget() const
Definition: Unit.h:818

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
397{
398 if (!m_session)
399 return nullptr;
400
402
403 if (!guid)
404 return GetNearbyGameObject();
405
407}
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:199
GameObject * GetNearbyGameObject() const
Definition: Chat.cpp:564

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

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
386{
387 if (!m_session)
388 return nullptr;
389
390 if (Unit* selected = m_session->GetPlayer()->GetSelectedUnit())
391 return selected;
392
393 return m_session->GetPlayer();
394}
Unit * GetSelectedUnit() const
Definition: Player.cpp:11571
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
242{ 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 
)
57{
58 WorldSession* target_session = nullptr;
59 uint32 target_account = 0;
60
61 if (target)
62 target_session = target->GetSession();
63 else if (guid)
64 target_account = sCharacterCache->GetCharacterAccountIdByGuid(guid);
65
66 if (!target_session && !target_account)
67 {
69 return true;
70 }
71
72 return HasLowerSecurityAccount(target_session, target_account, strong);
73}
bool HasLowerSecurityAccount(WorldSession *target, uint32 account, bool strong=false)
Definition: Chat.cpp:75
WorldSession * GetSession() const
Definition: Player.h:1998
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 
)
76{
77 uint32 target_sec;
78
79 // allow everything from console and RA console
80 if (!m_session)
81 return false;
82
83 // ignore only for non-players for non strong checks (when allow apply command at least to same sec level)
85 return false;
86
87 if (target)
88 target_sec = target->GetSecurity();
89 else if (target_account)
90 target_sec = AccountMgr::GetSecurity(target_account, realm.Id.Realm);
91 else
92 return true; // caller must report error for (target == nullptr && target_account == 0)
93
94 AccountTypes target_ac_sec = AccountTypes(target_sec);
95 if (m_session->GetSecurity() < target_ac_sec || (strong && m_session->GetSecurity() <= target_ac_sec))
96 {
98 return true;
99 }
100
101 return false;
102}
AccountTypes
Definition: Common.h:56
@ LANG_YOURS_SECURITY_IS_LOW
Definition: Language.h:429
@ CONFIG_GM_LOWER_SECURITY
Definition: IWorld.h:90
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.

436{
437 if (!m_session)
438 return false;
439
440 return true;
441}

References m_session.

◆ IsAvailable()

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

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.

197{ return true; }

◆ LineFromMessage()

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

◆ needReportToTarget()

◆ ParseCommands()

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

Reimplemented in CliHandler, and AddonChannelCommandHandler.

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

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
170 {
171 return Acore::StringFormat(GetModuleString(module, id)->c_str(), std::forward<Args>(args)...);
172 }
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:45

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
163 {
164 if (HasSession())
165 SendSysMessage(PGetParseModuleString(module, id, std::forward<Args>(args)...));
166 }
virtual bool HasSession() const
Definition: Chat.cpp:435
std::string PGetParseModuleString(std::string module, uint32 id, Args &&... args) const
Definition: Chat.h:169

◆ PSendSysMessage() [1/3]

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

References Acore::StringFormat().

◆ PSendSysMessage() [2/3]

void ChatHandler::PSendSysMessage ( std::string_view  str,
bool  escapeCharacters = false 
)
211{
212 SendSysMessage(str, escapeCharacters);
213}

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
148 {
149 if (HasSession())
150 SendSysMessage(PGetParseString(entry, std::forward<Args>(args)...));
151 }
std::string PGetParseString(uint32 entry, Args &&... args) const
Definition: Chat.h:154

◆ SendErrorMessage() [1/4]

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

◆ SendErrorMessage() [2/4]

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

References SendSysMessage(), and SetSentErrorMessage().

◆ SendErrorMessage() [3/4]

void ChatHandler::SendErrorMessage ( uint32  entry)
216{
217 SendSysMessage(entry);
219}

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
186 {
187 PSendSysMessage(entry, std::forward<Args>(args)...);
189 }

◆ SendGlobalGMSysMessage()

void ChatHandler::SendGlobalGMSysMessage ( const char *  str)
196{
197 WorldPacket data;
198 for (std::string_view line : Acore::Tokenize(str, '\n', true))
199 {
200 BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
201 sWorld->SendGlobalGMMessage(&data);
202 }
203}
@ 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:26

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)
186{
187 WorldPacket data;
188 for (std::string_view line : Acore::Tokenize(str, '\n', true))
189 {
190 BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
191 sWorld->SendGlobalMessage(&data);
192 }
193}

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
79 {
80 // GMText should be sent to all sessions
81 DoForAllValidSessions([&](Player* player)
82 {
83 m_session = player->GetSession();
84 SendGMText(Acore::StringFormat(fmt, std::forward<Args>(args)...));
85 });
86 }
void SendGMText(std::string_view str)
Definition: Chat.cpp:115
void DoForAllValidSessions(std::function< void(Player *)> exec)
Definition: Chat.cpp:443

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

◆ SendGMText() [2/3]

void ChatHandler::SendGMText ( std::string_view  str)
116{
117 std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
118 // Session should have permissions to receive global gm messages
120 return;
121
122 for (std::string_view line : lines)
123 {
124 WorldPacket data;
125 ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
126 m_session->SendPacket(&data);
127 }
128}
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
69 {
70 // GMText should be sent to all sessions
71 DoForAllValidSessions([&](Player* player)
72 {
73 m_session = player->GetSession();
74 SendGMText(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
75 });
76 }

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

◆ SendNotification() [1/3]

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

References Acore::StringFormat().

◆ SendNotification() [2/3]

void ChatHandler::SendNotification ( std::string_view  str)
105{
106 std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
107 for (std::string_view line : lines)
108 {
109 WorldPacket data(SMSG_NOTIFICATION, line.size() + 1);
110 data << line.data();
111 m_session->SendPacket(&data);
112 }
113}
@ 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
55 {
56 if (HasSession())
57 SendNotification(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...));
58 }

References Acore::StringFormat().

◆ SendSysMessage() [1/2]

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

Reimplemented in AddonChannelCommandHandler, AddonChannelCommandHandler, and CliHandler.

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

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)
206{
208}

References GetAcoreString(), and SendSysMessage().

◆ SendWorldText() [1/3]

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

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

◆ SendWorldText() [2/3]

◆ SendWorldText() [3/3]

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

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

◆ SendWorldTextOptional() [1/3]

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

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

◆ SendWorldTextOptional() [2/3]

void ChatHandler::SendWorldTextOptional ( std::string_view  str,
uint32  flag 
)
143{
144 std::vector<std::string_view> lines = Acore::Tokenize(str, '\n', true);
145
146 Player* player = m_session->GetPlayer();
147 if (sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
149 return;
150
151 for (std::string_view line : lines)
152 {
153 WorldPacket data;
154 ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
155 player->SendDirectMessage(&data);
156 }
157}
@ CONFIG_PLAYER_SETTINGS_ENABLED
Definition: IWorld.h:171
const std::string AzerothcorePSSource
Definition: PlayerSettings.h:23
@ SETTING_ANNOUNCER_FLAGS
Definition: PlayerSettings.h:27
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5723
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
113 {
114 // WorldTextOptional should be sent to all sessions
115 DoForAllValidSessions([&](Player* player)
116 {
117 m_session = player->GetSession();
118 SendWorldTextOptional(Acore::StringFormat(GetAcoreString(strId), std::forward<Args>(args)...), flag);
119 });
120 }

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

◆ SetSentErrorMessage()

Member Data Documentation

◆ m_session

◆ sentErrorMessage

bool ChatHandler::sentErrorMessage
private