AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
lfg_commandscript Class Reference
Inheritance diagram for lfg_commandscript:
CommandScript ScriptObject

Public Member Functions

 lfg_commandscript ()
 
ChatCommandTable GetCommands () const override
 
virtual std::vector< Acore::ChatCommands::ChatCommandBuilderGetCommands () const =0
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Static Public Member Functions

static bool HandleLfgPlayerInfoCommand (ChatHandler *handler, Optional< PlayerIdentifier > player)
 
static bool HandleLfgGroupInfoCommand (ChatHandler *handler, Optional< PlayerIdentifier > player)
 
static bool HandleLfgOptionsCommand (ChatHandler *handler, Optional< uint32 > optionsArg)
 
static bool HandleLfgQueueInfoCommand (ChatHandler *)
 
static bool HandleLfgCleanCommand (ChatHandler *handler)
 

Additional Inherited Members

- Protected Member Functions inherited from CommandScript
 CommandScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ lfg_commandscript()

lfg_commandscript::lfg_commandscript ( )
inline
44: CommandScript("lfg_commandscript") { }
Definition: CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable lfg_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

47 {
48 static ChatCommandTable lfgCommandTable =
49 {
50 { "player", HandleLfgPlayerInfoCommand, SEC_MODERATOR, Console::No },
51 { "group", HandleLfgGroupInfoCommand, SEC_MODERATOR, Console::No },
52 { "queue", HandleLfgQueueInfoCommand, SEC_MODERATOR, Console::Yes },
53 { "clean", HandleLfgCleanCommand, SEC_ADMINISTRATOR, Console::Yes },
54 { "options", HandleLfgOptionsCommand, SEC_GAMEMASTER, Console::Yes },
55 };
56
57 static ChatCommandTable commandTable =
58 {
59 { "lfg", lfgCommandTable },
60 };
61 return commandTable;
62 }
@ SEC_ADMINISTRATOR
Definition: Common.h:60
@ SEC_GAMEMASTER
Definition: Common.h:59
@ SEC_MODERATOR
Definition: Common.h:58
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:49
static bool HandleLfgGroupInfoCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_lfg.cpp:80
static bool HandleLfgQueueInfoCommand(ChatHandler *)
Definition: cs_lfg.cpp:118
static bool HandleLfgOptionsCommand(ChatHandler *handler, Optional< uint32 > optionsArg)
Definition: cs_lfg.cpp:107
static bool HandleLfgCleanCommand(ChatHandler *handler)
Definition: cs_lfg.cpp:123
static bool HandleLfgPlayerInfoCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_lfg.cpp:64

References HandleLfgCleanCommand(), HandleLfgGroupInfoCommand(), HandleLfgOptionsCommand(), HandleLfgPlayerInfoCommand(), HandleLfgQueueInfoCommand(), SEC_ADMINISTRATOR, SEC_GAMEMASTER, and SEC_MODERATOR.

◆ HandleLfgCleanCommand()

static bool lfg_commandscript::HandleLfgCleanCommand ( ChatHandler handler)
inlinestatic
124 {
126 sLFGMgr->Clean();
127 return true;
128 }
#define sLFGMgr
Definition: LFGMgr.h:641
@ LANG_LFG_CLEAN
Definition: Language.h:1177
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:213

References LANG_LFG_CLEAN, ChatHandler::PSendSysMessage(), and sLFGMgr.

Referenced by GetCommands().

◆ HandleLfgGroupInfoCommand()

static bool lfg_commandscript::HandleLfgGroupInfoCommand ( ChatHandler handler,
Optional< PlayerIdentifier player 
)
inlinestatic
81 {
82 if (!player)
83 player = PlayerIdentifier::FromTargetOrSelf(handler);
84 if (!player)
85 return false;
86
87 Group* groupTarget = nullptr;
88 if (Player* target = player->GetConnectedPlayer())
89 groupTarget = target->GetGroup();
90 if (!groupTarget)
91 {
92 handler->PSendSysMessage(LANG_LFG_NOT_IN_GROUP, player->GetName());
93 return true;
94 }
95
96 ObjectGuid guid = groupTarget->GetGUID();
97 std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid));
98 handler->PSendSysMessage(LANG_LFG_GROUP_INFO, groupTarget->isLFGGroup(),
99 state, sLFGMgr->GetDungeon(guid));
100
101 for (GroupReference* itr = groupTarget->GetFirstMember(); itr != nullptr; itr = itr->next())
102 GetPlayerInfo(handler, itr->GetSource());
103
104 return true;
105 }
@ LANG_LFG_NOT_IN_GROUP
Definition: Language.h:1176
@ LANG_LFG_GROUP_INFO
Definition: Language.h:1175
void GetPlayerInfo(ChatHandler *handler, Player *player)
Definition: cs_lfg.cpp:25
std::string GetStateString(LfgState state)
Definition: LFG.cpp:73
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)
Definition: ChatCommandTags.h:188
Definition: ObjectGuid.h:118
Definition: Player.h:1064
Definition: Group.h:169
bool isLFGGroup(bool restricted=false) const
Definition: Group.cpp:2265
ObjectGuid GetGUID() const
Definition: Group.cpp:2306
GroupReference * GetFirstMember()
Definition: Group.h:243
Definition: GroupReference.h:27
GroupReference * next()
Definition: GroupReference.h:36

References Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), Group::GetFirstMember(), Group::GetGUID(), GetPlayerInfo(), lfg::GetStateString(), Group::isLFGGroup(), LANG_LFG_GROUP_INFO, LANG_LFG_NOT_IN_GROUP, GroupReference::next(), ChatHandler::PSendSysMessage(), and sLFGMgr.

Referenced by GetCommands().

◆ HandleLfgOptionsCommand()

static bool lfg_commandscript::HandleLfgOptionsCommand ( ChatHandler handler,
Optional< uint32 optionsArg 
)
inlinestatic
108 {
109 if (optionsArg)
110 {
111 sLFGMgr->SetOptions(*optionsArg);
113 }
114 handler->PSendSysMessage(LANG_LFG_OPTIONS, sLFGMgr->GetOptions());
115 return true;
116 }
@ LANG_LFG_OPTIONS
Definition: Language.h:1178
@ LANG_LFG_OPTIONS_CHANGED
Definition: Language.h:1179

References LANG_LFG_OPTIONS, LANG_LFG_OPTIONS_CHANGED, ChatHandler::PSendSysMessage(), and sLFGMgr.

Referenced by GetCommands().

◆ HandleLfgPlayerInfoCommand()

static bool lfg_commandscript::HandleLfgPlayerInfoCommand ( ChatHandler handler,
Optional< PlayerIdentifier player 
)
inlinestatic
65 {
66 if (!player)
67 player = PlayerIdentifier::FromTargetOrSelf(handler);
68 if (!player)
69 return false;
70
71 if (Player* target = player->GetConnectedPlayer())
72 {
73 GetPlayerInfo(handler, target);
74 return true;
75 }
76
77 return false;
78 }

References Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), and GetPlayerInfo().

Referenced by GetCommands().

◆ HandleLfgQueueInfoCommand()

static bool lfg_commandscript::HandleLfgQueueInfoCommand ( ChatHandler )
inlinestatic
119 {
120 return true;
121 }

Referenced by GetCommands().