TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
lfg_commandscript Class Reference

Public Member Functions

 lfg_commandscript ()
 
std::vector< ChatCommandGetCommands () const override
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Static Public Member Functions

static bool HandleLfgPlayerInfoCommand (ChatHandler *handler, char const *args)
 
static bool HandleLfgGroupInfoCommand (ChatHandler *handler, char const *args)
 
static bool HandleLfgOptionsCommand (ChatHandler *handler, char const *args)
 
static bool HandleLfgQueueInfoCommand (ChatHandler *handler, char const *args)
 
static bool HandleLfgCleanCommand (ChatHandler *handler, char const *)
 

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

Constructor & Destructor Documentation

lfg_commandscript::lfg_commandscript ( )
inline
44 : CommandScript("lfg_commandscript") { }
CommandScript(const char *name)
Definition: ScriptMgr.cpp:1616

Member Function Documentation

std::vector<ChatCommand> lfg_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

47  {
48  static std::vector<ChatCommand> lfgCommandTable =
49  {
55  };
56 
57  static std::vector<ChatCommand> commandTable =
58  {
59  { "lfg", rbac::RBAC_PERM_COMMAND_LFG, true, NULL, "", lfgCommandTable },
60  };
61  return commandTable;
62  }
static bool HandleLfgQueueInfoCommand(ChatHandler *handler, char const *args)
Definition: cs_lfg.cpp:149
Definition: RBAC.h:340
Definition: RBAC.h:341
static bool HandleLfgGroupInfoCommand(ChatHandler *handler, char const *args)
Definition: cs_lfg.cpp:75
Definition: RBAC.h:337
arena_t NULL
Definition: jemalloc_internal.h:624
static bool HandleLfgOptionsCommand(ChatHandler *handler, char const *args)
Definition: cs_lfg.cpp:130
static bool HandleLfgPlayerInfoCommand(ChatHandler *handler, char const *args)
Definition: cs_lfg.cpp:64
Definition: RBAC.h:339
static bool HandleLfgCleanCommand(ChatHandler *handler, char const *)
Definition: cs_lfg.cpp:155

+ Here is the call graph for this function:

static bool lfg_commandscript::HandleLfgCleanCommand ( ChatHandler handler,
char const  
)
inlinestatic
156  {
158  sLFGMgr->Clean();
159  return true;
160  }
#define sLFGMgr
Definition: LFGMgr.h:481
Definition: Language.h:1159
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool lfg_commandscript::HandleLfgGroupInfoCommand ( ChatHandler handler,
char const args 
)
inlinestatic
76  {
77  Player* playerTarget;
78  ObjectGuid guidTarget;
79  std::string nameTarget;
80 
81  ObjectGuid parseGUID = ObjectGuid::Create<HighGuid::Player>(uint64(atoull(args)));
82 
83  if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget))
84  {
85  playerTarget = ObjectAccessor::FindPlayer(parseGUID);
86  guidTarget = parseGUID;
87  }
88  else if (!handler->extractPlayerTarget((char*)args, &playerTarget, &guidTarget, &nameTarget))
89  return false;
90 
91  Group* groupTarget = NULL;
92 
93  if (playerTarget)
94  groupTarget = playerTarget->GetGroup();
95  else
96  {
98  stmt->setUInt32(0, guidTarget.GetCounter());
99  PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt);
100  if (resultGroup)
101  groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32());
102  }
103  if (!groupTarget)
104  {
105  handler->PSendSysMessage(LANG_LFG_NOT_IN_GROUP, nameTarget.c_str());
106  handler->SetSentErrorMessage(true);
107  return false;
108  }
109 
110  ObjectGuid guid = groupTarget->GetGUID();
111  std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid));
112  handler->PSendSysMessage(LANG_LFG_GROUP_INFO, groupTarget->isLFGGroup(),
113  state.c_str(), sLFGMgr->GetDungeon(guid));
114 
115  Group::MemberSlotList const& members = groupTarget->GetMemberSlots();
116 
117  for (Group::MemberSlotList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
118  {
119  Group::MemberSlot const& slot = *itr;
120  Player* p = ObjectAccessor::FindPlayer((*itr).guid);
121  if (p)
122  GetPlayerInfo(handler, p);
123  else
124  handler->PSendSysMessage("%s is offline.", slot.name.c_str());
125  }
126 
127  return true;
128  }
void SetSentErrorMessage(bool val)
Definition: Chat.h:138
Definition: Language.h:1158
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
unsigned long long atoull(char const *str)
Definition: Common.h:91
ObjectGuid GetGUID() const
Definition: Group.cpp:2534
void GetPlayerInfo(ChatHandler *handler, Player *player)
Definition: cs_lfg.cpp:27
std::list< MemberSlot > MemberSlotList
Definition: Group.h:204
arena_t NULL
Definition: jemalloc_internal.h:624
uint64_t uint64
Definition: g3dmath.h:170
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=NULL, std::string *player_name=NULL)
Definition: Chat.cpp:945
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: PreparedStatement.h:74
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: Group.h:194
std::string GetStateString(LfgState state)
Definition: LFG.cpp:74
#define sLFGMgr
Definition: LFGMgr.h:481
#define sGroupMgr
Definition: GroupMgr.h:59
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
std::string name
Definition: Group.h:197
Definition: Language.h:1157
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
bool isLFGGroup() const
Definition: Group.cpp:2504
MemberSlotList const & GetMemberSlots() const
Definition: Group.h:294
Definition: CharacterDatabase.h:69
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72
Definition: ObjectGuid.h:189
Definition: Group.h:191
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool lfg_commandscript::HandleLfgOptionsCommand ( ChatHandler handler,
char const args 
)
inlinestatic
131  {
132  int32 options = -1;
133  if (char* str = strtok((char*)args, " "))
134  {
135  int32 tmp = atoi(str);
136  if (tmp > -1)
137  options = tmp;
138  }
139 
140  if (options != -1)
141  {
142  sLFGMgr->SetOptions(options);
144  }
145  handler->PSendSysMessage(LANG_LFG_OPTIONS, sLFGMgr->GetOptions());
146  return true;
147  }
Definition: Language.h:1161
#define sLFGMgr
Definition: LFGMgr.h:481
int32_t int32
Definition: Define.h:146
Definition: Language.h:1160
void PSendSysMessage(const char *fmt, Args &&...args)
Definition: Chat.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool lfg_commandscript::HandleLfgPlayerInfoCommand ( ChatHandler handler,
char const args 
)
inlinestatic
65  {
66  Player* target = NULL;
67  std::string playerName;
68  if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
69  return false;
70 
71  GetPlayerInfo(handler, target);
72  return true;
73  }
void GetPlayerInfo(ChatHandler *handler, Player *player)
Definition: cs_lfg.cpp:27
arena_t NULL
Definition: jemalloc_internal.h:624
bool extractPlayerTarget(char *args, Player **player, ObjectGuid *player_guid=NULL, std::string *player_name=NULL)
Definition: Chat.cpp:945

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool lfg_commandscript::HandleLfgQueueInfoCommand ( ChatHandler handler,
char const args 
)
inlinestatic
150  {
151  handler->SendSysMessage(sLFGMgr->DumpQueueInfo(*args != '\0').c_str(), true);
152  return true;
153  }
#define sLFGMgr
Definition: LFGMgr.h:481
virtual void SendSysMessage(char const *str, bool escapeCharacters=false)
Definition: Chat.cpp:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: