AzeorthCore 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
 

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)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ lfg_commandscript()

lfg_commandscript::lfg_commandscript ( )
inline
45: CommandScript("lfg_commandscript") { }
Definition: ScriptMgr.h:849

Member Function Documentation

◆ GetCommands()

ChatCommandTable lfg_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

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

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

◆ HandleLfgCleanCommand()

static bool lfg_commandscript::HandleLfgCleanCommand ( ChatHandler handler)
inlinestatic
125 {
127 sLFGMgr->Clean();
128 return true;
129 }
#define sLFGMgr
Definition: LFGMgr.h:638
@ LANG_LFG_CLEAN
Definition: Language.h:1180
void PSendSysMessage(char const *fmt, Args &&... args)
Definition: Chat.h:60

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

Referenced by GetCommands().

◆ HandleLfgGroupInfoCommand()

static bool lfg_commandscript::HandleLfgGroupInfoCommand ( ChatHandler handler,
Optional< PlayerIdentifier player 
)
inlinestatic
82 {
83 if (!player)
84 player = PlayerIdentifier::FromTargetOrSelf(handler);
85 if (!player)
86 return false;
87
88 Group* groupTarget = nullptr;
89 if (Player* target = player->GetConnectedPlayer())
90 groupTarget = target->GetGroup();
91 if (!groupTarget)
92 {
93 handler->PSendSysMessage(LANG_LFG_NOT_IN_GROUP, player->GetName().c_str());
94 return true;
95 }
96
97 ObjectGuid guid = groupTarget->GetGUID();
98 std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid));
99 handler->PSendSysMessage(LANG_LFG_GROUP_INFO, groupTarget->isLFGGroup(),
100 state.c_str(), sLFGMgr->GetDungeon(guid));
101
102 for (GroupReference* itr = groupTarget->GetFirstMember(); itr != nullptr; itr = itr->next())
103 GetPlayerInfo(handler, itr->GetSource());
104
105 return true;
106 }
@ LANG_LFG_NOT_IN_GROUP
Definition: Language.h:1179
@ LANG_LFG_GROUP_INFO
Definition: Language.h:1178
void GetPlayerInfo(ChatHandler *handler, Player *player)
Definition: cs_lfg.cpp:26
std::string GetStateString(LfgState state)
Definition: LFG.cpp:73
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)
Definition: ChatCommandTags.h:189
Definition: ObjectGuid.h:120
Definition: Player.h:1046
Definition: Group.h:168
bool isLFGGroup(bool restricted=false) const
Definition: Group.cpp:2205
ObjectGuid GetGUID() const
Definition: Group.cpp:2241
GroupReference * GetFirstMember()
Definition: Group.h:241
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
109 {
110 if (optionsArg)
111 {
112 sLFGMgr->SetOptions(*optionsArg);
114 }
115 handler->PSendSysMessage(LANG_LFG_OPTIONS, sLFGMgr->GetOptions());
116 return true;
117 }
@ LANG_LFG_OPTIONS
Definition: Language.h:1181
@ LANG_LFG_OPTIONS_CHANGED
Definition: Language.h:1182

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
66 {
67 if (!player)
68 player = PlayerIdentifier::FromTargetOrSelf(handler);
69 if (!player)
70 return false;
71
72 if (Player* target = player->GetConnectedPlayer())
73 {
74 GetPlayerInfo(handler, target);
75 return true;
76 }
77
78 return false;
79 }

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

Referenced by GetCommands().

◆ HandleLfgQueueInfoCommand()

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

Referenced by GetCommands().