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

#include "Chat.h"

Inheritance diagram for CliHandler:
ChatHandler

Public Types

using Print = void(void *, std::string_view)
 

Public Member Functions

 CliHandler (void *callbackArg, Print *zprint)
 
char const * GetAcoreString (uint32 entry) const override
 
void SendSysMessage (std::string_view, bool escapeCharacters) override
 
bool ParseCommands (std::string_view str) override
 
std::string GetNameLink () const override
 
bool needReportToTarget (Player *chr) const override
 
LocaleConstant GetSessionDbcLocale () const override
 
int GetSessionDbLocaleIndex () const override
 
bool HasSession () const override
 
- Public Member Functions inherited from ChatHandler
 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
 

Private Attributes

void * m_callbackArg
 
Printm_print
 

Additional Inherited Members

- Static Public Member Functions inherited from ChatHandler
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 inherited from ChatHandler
 ChatHandler ()
 

Detailed Description

Member Typedef Documentation

◆ Print

using CliHandler::Print = void(void*, std::string_view)

Constructor & Destructor Documentation

◆ CliHandler()

CliHandler::CliHandler ( void *  callbackArg,
Print zprint 
)
inlineexplicit
258: m_callbackArg(callbackArg), m_print(zprint) { }
void * m_callbackArg
Definition: Chat.h:273
Print * m_print
Definition: Chat.h:274

Member Function Documentation

◆ GetAcoreString()

char const * CliHandler::GetAcoreString ( uint32  entry) const
overridevirtual

Reimplemented from ChatHandler.

885{
886 return sObjectMgr->GetAcoreStringForDBCLocale(entry);
887}
#define sObjectMgr
Definition: ObjectMgr.h:1635

References sObjectMgr.

Referenced by GetNameLink().

◆ GetNameLink()

std::string CliHandler::GetNameLink ( ) const
overridevirtual

Reimplemented from ChatHandler.

908{
910}
@ LANG_CONSOLE_COMMAND
Definition: Language.h:212
char const * GetAcoreString(uint32 entry) const override
Definition: Chat.cpp:884

References GetAcoreString(), and LANG_CONSOLE_COMMAND.

◆ GetSessionDbcLocale()

LocaleConstant CliHandler::GetSessionDbcLocale ( ) const
overridevirtual

Reimplemented from ChatHandler.

963{
964 return sWorld->GetDefaultDbcLocale();
965}
#define sWorld
Definition: World.h:443

References sWorld.

◆ GetSessionDbLocaleIndex()

int CliHandler::GetSessionDbLocaleIndex ( ) const
overridevirtual

Reimplemented from ChatHandler.

968{
969 return sObjectMgr->GetDBCLocaleIndex();
970}

References sObjectMgr.

◆ HasSession()

bool CliHandler::HasSession ( ) const
overridevirtual

Reimplemented from ChatHandler.

973{
974 return true;
975}

◆ needReportToTarget()

bool CliHandler::needReportToTarget ( Player chr) const
overridevirtual

Reimplemented from ChatHandler.

913{
914 return true;
915}

◆ ParseCommands()

bool CliHandler::ParseCommands ( std::string_view  str)
overridevirtual

Reimplemented from ChatHandler.

896{
897 if (str.empty())
898 return false;
899
900 // Console allows using commands both with and without leading indicator
901 if (str[0] == '.' || str[0] == '!')
902 str = str.substr(1);
903
904 return _ParseCommands(str);
905}
bool _ParseCommands(std::string_view text)
Definition: Chat.cpp:227

References ChatHandler::_ParseCommands().

Referenced by World::ProcessCliCommands().

◆ SendSysMessage()

void CliHandler::SendSysMessage ( std::string_view  str,
bool  escapeCharacters 
)
overridevirtual

Reimplemented from ChatHandler.

890{
892 m_print(m_callbackArg, "\r\n");
893}

References m_callbackArg, and m_print.

Member Data Documentation

◆ m_callbackArg

void* CliHandler::m_callbackArg
private

Referenced by SendSysMessage().

◆ m_print

Print* CliHandler::m_print
private

Referenced by SendSysMessage().