mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Dungeon Finder: Add debugging commands
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
DELETE FROM `trinity_string` WHERE `entry` IN (9986, 9987, 9989, 9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999);
|
||||
INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`)
|
||||
VALUES
|
||||
(9999, 'Error', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9998, 'None', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9997, 'Leader', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9996, 'Dps', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9995, 'Healer', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9994, 'Tank', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9993, 'Raid browser', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9992, 'Finished dungeon', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9991, 'In dungeon', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9990, 'Vote kick', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9989, 'Proposal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9988, 'Queued', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
DELETE FROM `trinity_string` WHERE `entry` IN (9980, 9981, 9982, 9983, 9984, 9985, 9986, 9987, 9988, 9989, 9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999);
|
||||
INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES
|
||||
(9980, 'Player name: %s, State: %s, Dungeons: %u (%s), Roles: %s, Comment: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9981, 'LfgGroup?: %u, State: %s, Dungeon: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9982, 'Not in group', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9983, 'Queues cleared', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9984, 'Lfg options: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9985, 'Lfg options changed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9986, 'None', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9987, 'Role check', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9986, 'None', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
(9988, 'Queued', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9989, 'Proposal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9990, 'Vote kick', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9991, 'In dungeon', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9992, 'Finished dungeon', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9993, 'Raid browser', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9994, 'Tank', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9995, 'Healer', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9996, 'Dps', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9997, 'Leader', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9998, 'None', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
|
||||
(9999, 'Error', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
8
sql/updates/world/2012_10_23_01_world_command.sql
Normal file
8
sql/updates/world/2012_10_23_01_world_command.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
DELETE FROM `command` WHERE `name` LIKE 'lfg%';
|
||||
|
||||
INSERT INTO `command` (`name`, `security`, `help`) VALUES
|
||||
('lfg player', 2, 'Syntax: .lfg player\n Shows information about player (state, roles, comment, dungeons selected).'),
|
||||
('lfg group', 2, 'Syntax: .lfg group\n Shows information about all players in the group (state, roles, comment, dungeons selected).'),
|
||||
('lfg queue', 2, 'Syntax: .lfg queue\n Shows info about current lfg queues.'),
|
||||
('lfg clean', 3, 'Syntax: .flg clean\n Cleans current queue, only for debugging purposes.'),
|
||||
('lfg options', 3, 'Syntax: .lfg options [new value]\n Shows current lfg options. New value is set if extra param is present.');
|
||||
@@ -31,14 +31,11 @@
|
||||
#include "GroupMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
|
||||
LFGMgr::LFGMgr(): m_QueueTimer(0), m_lfgProposalId(1)
|
||||
LFGMgr::LFGMgr(): m_QueueTimer(0), m_lfgProposalId(1),
|
||||
m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK))
|
||||
{
|
||||
m_options = sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE);
|
||||
if (m_options)
|
||||
{
|
||||
new LFGPlayerScript();
|
||||
new LFGGroupScript();
|
||||
}
|
||||
new LFGPlayerScript();
|
||||
new LFGGroupScript();
|
||||
}
|
||||
|
||||
LFGMgr::~LFGMgr()
|
||||
@@ -353,7 +350,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
|
||||
|
||||
void LFGMgr::Update(uint32 diff)
|
||||
{
|
||||
if (!m_options)
|
||||
if (!isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
time_t currTime = time(NULL);
|
||||
@@ -1892,6 +1889,27 @@ bool LFGMgr::AllQueued(const LfgGuidList& check)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only for debugging purposes
|
||||
void LFGMgr::Clean()
|
||||
{
|
||||
m_Queues.clear();
|
||||
}
|
||||
|
||||
bool LFGMgr::isOptionEnabled(uint32 option)
|
||||
{
|
||||
return m_options & option;
|
||||
}
|
||||
|
||||
uint32 LFGMgr::GetOptions()
|
||||
{
|
||||
return m_options;
|
||||
}
|
||||
|
||||
void LFGMgr::SetOptions(uint32 options)
|
||||
{
|
||||
m_options = options;
|
||||
}
|
||||
|
||||
bool LFGMgr::IsSeasonActive(uint32 dungeonId)
|
||||
{
|
||||
switch (dungeonId)
|
||||
@@ -1907,3 +1925,25 @@ bool LFGMgr::IsSeasonActive(uint32 dungeonId)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string LFGMgr::DumpQueueInfo(bool /*full*/)
|
||||
{
|
||||
uint32 size = uint32(m_Queues.size());
|
||||
std::ostringstream o;
|
||||
|
||||
o << "Number of Queues: " << size << "\n";
|
||||
for (LfgQueueMap::const_iterator itr = m_Queues.begin(); itr != m_Queues.end(); ++itr)
|
||||
{
|
||||
std::string const& queued = itr->second.DumpQueueInfo();
|
||||
std::string const& compatibles = itr->second.DumpCompatibleInfo();
|
||||
o << queued << compatibles;
|
||||
/*
|
||||
if (full)
|
||||
{
|
||||
LfgCompatibleMap const& compatibles = itr->second.GetCompatibleMap();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return o.str();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
class Group;
|
||||
class Player;
|
||||
|
||||
enum LfgOptions
|
||||
{
|
||||
LFG_OPTION_ENABLE_DUNGEON_FINDER = 0x01,
|
||||
LFG_OPTION_ENABLE_RAID_BROWSER = 0x02,
|
||||
};
|
||||
|
||||
enum LFGMgrEnum
|
||||
{
|
||||
LFG_TIME_ROLECHECK = 40 * IN_MILLISECONDS,
|
||||
@@ -346,11 +352,17 @@ class LFGMgr
|
||||
bool IsTeleported(uint64 guid);
|
||||
|
||||
bool AllQueued(LfgGuidList const& check);
|
||||
void Clean();
|
||||
|
||||
static bool HasIgnore(uint64 guid1, uint64 guid2);
|
||||
static void SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data);
|
||||
|
||||
bool isOptionEnabled(uint32 option);
|
||||
uint32 GetOptions();
|
||||
void SetOptions(uint32 options);
|
||||
bool IsSeasonActive(uint32 dungeonId);
|
||||
|
||||
std::string DumpQueueInfo(bool full = false);
|
||||
static std::string ConcatenateDungeons(LfgDungeonSet const& dungeons);
|
||||
static std::string GetRolesString(uint8 roles);
|
||||
static char const * GetStateString(LfgState state);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "GroupMgr.h"
|
||||
|
||||
/**
|
||||
Given a list of guids returns the concatenation using | as delimiter
|
||||
@@ -536,4 +537,45 @@ void LfgQueue::UpdateQueueTimers(time_t currTime)
|
||||
time_t LfgQueue::GetJoinTime(uint64 guid)
|
||||
{
|
||||
return m_QueueDataMap[guid].joinTime;
|
||||
}
|
||||
}
|
||||
|
||||
LfgCompatibleMap const& LfgQueue::GetCompatibleMap()
|
||||
{
|
||||
return m_CompatibleMap;
|
||||
}
|
||||
|
||||
std::string LfgQueue::DumpQueueInfo() const
|
||||
{
|
||||
uint32 players = 0;
|
||||
uint32 groups = 0;
|
||||
uint32 playersInGroup = 0;
|
||||
|
||||
for (uint8 i = 0; i < 2; ++i)
|
||||
{
|
||||
LfgGuidList const& queue = i ? m_newToQueue : m_currentQueue;
|
||||
for (LfgGuidList::const_iterator it = queue.begin(); it != queue.end(); ++it)
|
||||
{
|
||||
uint64 guid = *it;
|
||||
if (IS_GROUP(guid))
|
||||
{
|
||||
groups++;
|
||||
if (Group const* group = sGroupMgr->GetGroupByGUID(GUID_LOPART(guid)))
|
||||
playersInGroup += group->GetMembersCount();
|
||||
else
|
||||
playersInGroup += 2; // Shouldn't happen but just in case
|
||||
}
|
||||
else
|
||||
players++;
|
||||
}
|
||||
}
|
||||
std::ostringstream o;
|
||||
o << "Queued Players: " << players << "(in group: " << playersInGroup << ") Groups: " << groups << "\n";
|
||||
return o.str();
|
||||
}
|
||||
|
||||
std::string LfgQueue::DumpCompatibleInfo() const
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << "Compatible Map size: " << m_CompatibleMap.size() << "\n";
|
||||
return o.str();
|
||||
}
|
||||
|
||||
@@ -34,11 +34,17 @@ LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript")
|
||||
|
||||
void LFGPlayerScript::OnLevelChanged(Player* player, uint8 /*oldLevel*/)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnLogout(Player* player)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 guid = player->GetGUID();
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE);
|
||||
@@ -51,6 +57,9 @@ void LFGPlayerScript::OnLogout(Player* player)
|
||||
|
||||
void LFGPlayerScript::OnLogin(Player* player)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
sLFGMgr->SetTeam(player->GetGUID(), player->GetTeam());
|
||||
// TODO - Restore LfgPlayerData and send proper status to player if it was in a group
|
||||
@@ -69,6 +78,9 @@ LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript")
|
||||
|
||||
void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
uint64 leader = group->GetLeaderGUID();
|
||||
|
||||
@@ -106,6 +118,9 @@ void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
|
||||
|
||||
void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : ""));
|
||||
|
||||
@@ -157,6 +172,9 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
|
||||
|
||||
void LFGGroupScript::OnDisband(Group* group)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
|
||||
|
||||
@@ -165,6 +183,9 @@ void LFGGroupScript::OnDisband(Group* group)
|
||||
|
||||
void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
|
||||
@@ -173,6 +194,9 @@ void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 o
|
||||
|
||||
void LFGGroupScript::OnInviteMember(Group* group, uint64 guid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
uint64 leader = group->GetLeaderGUID();
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader);
|
||||
|
||||
@@ -46,7 +46,7 @@ void BuildPartyLockDungeonBlock(WorldPacket& data, const LfgLockPartyMap& lockMa
|
||||
|
||||
void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE) ||
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER) ||
|
||||
(GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID() &&
|
||||
(GetPlayer()->GetGroup()->GetMembersCount() == MAXGROUPSIZE || !GetPlayer()->GetGroup()->isLFGGroup())))
|
||||
{
|
||||
|
||||
@@ -990,6 +990,12 @@ enum TrinityStrings
|
||||
LANG_WORLD_CLOSED = 7523,
|
||||
LANG_WORLD_OPENED = 7524,
|
||||
|
||||
LANG_LFG_PLAYER_INFO = 9980,
|
||||
LANG_LFG_GROUP_INFO = 9981,
|
||||
LANG_LFG_NOT_IN_GROUP = 9982,
|
||||
LANG_LFG_CLEAN = 9983,
|
||||
LANG_LFG_OPTIONS = 9984,
|
||||
LANG_LFG_OPTIONS_CHANGED = 9985,
|
||||
LANG_LFG_STATE_NONE = 9986,
|
||||
LANG_LFG_STATE_ROLECHECK = 9987,
|
||||
LANG_LFG_STATE_QUEUED = 9988,
|
||||
@@ -1098,4 +1104,3 @@ enum TrinityStrings
|
||||
// For other tables maybe 2000010000-2147483647 (max index)
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1182,7 +1182,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_int_configs[CONFIG_WARDEN_CLIENT_RESPONSE_DELAY] = ConfigMgr::GetIntDefault("Warden.ClientResponseDelay", 600);
|
||||
|
||||
// Dungeon finder
|
||||
m_bool_configs[CONFIG_DUNGEON_FINDER_ENABLE] = ConfigMgr::GetBoolDefault("DungeonFinder.Enable", false);
|
||||
m_int_configs[CONFIG_LFG_OPTIONSMASK] = ConfigMgr::GetIntDefault("DungeonFinder.OptionsMask", 1);
|
||||
|
||||
// DBC_ItemAttributes
|
||||
m_bool_configs[CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES] = ConfigMgr::GetBoolDefault("DBC.EnforceItemAttributes", true);
|
||||
|
||||
@@ -155,7 +155,6 @@ enum WorldBoolConfigs
|
||||
CONFIG_CHATLOG_PUBLIC,
|
||||
CONFIG_CHATLOG_ADDON,
|
||||
CONFIG_CHATLOG_BGROUND,
|
||||
CONFIG_DUNGEON_FINDER_ENABLE,
|
||||
CONFIG_AUTOBROADCAST,
|
||||
CONFIG_ALLOW_TICKETS,
|
||||
CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES,
|
||||
@@ -313,6 +312,7 @@ enum WorldIntConfigs
|
||||
CONFIG_DB_PING_INTERVAL,
|
||||
CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION,
|
||||
CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS,
|
||||
CONFIG_LFG_OPTIONSMASK,
|
||||
CONFIG_MAX_INSTANCES_PER_HOUR,
|
||||
CONFIG_WARDEN_CLIENT_RESPONSE_DELAY,
|
||||
CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF,
|
||||
|
||||
@@ -27,6 +27,7 @@ set(scripts_STAT_SRCS
|
||||
Commands/cs_honor.cpp
|
||||
Commands/cs_instance.cpp
|
||||
Commands/cs_learn.cpp
|
||||
Commands/cs_lfg.cpp
|
||||
Commands/cs_list.cpp
|
||||
Commands/cs_lookup.cpp
|
||||
Commands/cs_message.cpp
|
||||
|
||||
134
src/server/scripts/Commands/cs_lfg.cpp
Normal file
134
src/server/scripts/Commands/cs_lfg.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "Group.h"
|
||||
|
||||
void GetPlayerInfo(ChatHandler* handler, Player* player)
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
uint64 guid = player->GetGUID();
|
||||
LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(guid);
|
||||
|
||||
char const * const state = sLFGMgr->GetStateString(sLFGMgr->GetState(guid));
|
||||
handler->PSendSysMessage(LANG_LFG_PLAYER_INFO, player->GetName(),
|
||||
state, uint8(dungeons.size()), sLFGMgr->ConcatenateDungeons(dungeons).c_str(),
|
||||
sLFGMgr->GetRolesString(sLFGMgr->GetRoles(guid)).c_str(), sLFGMgr->GetComment(guid).c_str());
|
||||
}
|
||||
|
||||
class lfg_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
lfg_commandscript() : CommandScript("lfg_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand lfgCommandTable[] =
|
||||
{
|
||||
{ "player", SEC_GAMEMASTER, false, &HandleLfgPlayerInfoCommand, "", NULL },
|
||||
{ "group", SEC_GAMEMASTER, false, &HandleLfgGroupInfoCommand, "", NULL },
|
||||
{ "queue", SEC_GAMEMASTER, false, &HandleLfgQueueInfoCommand, "", NULL },
|
||||
{ "clean", SEC_ADMINISTRATOR, false, &HandleLfgCleanCommand, "", NULL },
|
||||
{ "options", SEC_ADMINISTRATOR, false, &HandleLfgOptionsCommand, "", NULL },
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "lfg", SEC_GAMEMASTER, false, NULL, "", lfgCommandTable },
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleLfgPlayerInfoCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target = NULL;
|
||||
std::string playerName;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
|
||||
return false;
|
||||
|
||||
GetPlayerInfo(handler, target);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleLfgGroupInfoCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target = NULL;
|
||||
std::string playerName;
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
|
||||
return false;
|
||||
|
||||
Group* grp = target->GetGroup();
|
||||
if (!grp)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_LFG_NOT_IN_GROUP, playerName.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64 guid = grp->GetGUID();
|
||||
char const * const state = sLFGMgr->GetStateString(sLFGMgr->GetState(guid));
|
||||
handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(),
|
||||
state, sLFGMgr->GetDungeon(guid));
|
||||
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
GetPlayerInfo(handler, itr->getSource());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleLfgOptionsCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
int32 options = -1;
|
||||
if (char* str = strtok((char*)args, " "))
|
||||
{
|
||||
int32 tmp = atoi(str);
|
||||
if (tmp > -1)
|
||||
options = tmp;
|
||||
}
|
||||
|
||||
if (options != -1)
|
||||
{
|
||||
sLFGMgr->SetOptions(options);
|
||||
handler->PSendSysMessage(LANG_LFG_OPTIONS_CHANGED);
|
||||
}
|
||||
handler->PSendSysMessage(LANG_LFG_OPTIONS, sLFGMgr->GetOptions());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleLfgQueueInfoCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
handler->SendSysMessage(sLFGMgr->DumpQueueInfo().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleLfgCleanCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_LFG_CLEAN);
|
||||
sLFGMgr->Clean();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_lfg_commandscript()
|
||||
{
|
||||
new lfg_commandscript();
|
||||
}
|
||||
@@ -1106,12 +1106,15 @@ Command.LookupMaxResults = 0
|
||||
AllowTickets = 1
|
||||
|
||||
#
|
||||
# DungeonFinder.Enable
|
||||
# DungeonFinder.OptionsMask
|
||||
# Description: Dungeon and raid finder system.
|
||||
# Default: 1 - (Enabled)
|
||||
# 0 - (Disabled)
|
||||
# Value is a bitmask consisting of:
|
||||
# LFG_OPTION_ENABLE_DUNGEON_FINDER = 1, Enable the dungeon finder browser
|
||||
# LFG_OPTION_ENABLE_RAID_BROWSER = 2, Enable the raid browser
|
||||
# Default: 1
|
||||
|
||||
DungeonFinder.OptionsMask = 1
|
||||
|
||||
DungeonFinder.Enable = 1
|
||||
|
||||
#
|
||||
# DBC.EnforceItemAttributes
|
||||
|
||||
Reference in New Issue
Block a user