feat(Core/debug): Add commad to debug lfg (#6638)

* feat(Core/debug): Add commad to debug lfg

* Update LFGMgr.h

* Update rev_1624914323095978900.sql

* Code review fixes

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Efymer
2021-09-14 17:08:49 +02:00
committed by GitHub
parent a9796af174
commit aa9a39e07f
6 changed files with 41 additions and 6 deletions

View File

@@ -0,0 +1,10 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1624914323095978900');
DELETE FROM `acore_string` WHERE `entry` IN (30096, 30097);
INSERT INTO `acore_string` (`entry`, `content_default`) VALUES
(30096, 'LFG is set to 1 player queue for debugging.'),
(30097, 'LFG is set to normal queue.');
DELETE FROM `command` WHERE `name` = 'debug lfg';
INSERT INTO `command` (`name`, `security`, `help`) VALUES
('debug lfg', 3, 'Syntax: .debug lfg\r\nToggle debug mode for lfg. In debug mode GM can start lfg queue with one player.');

View File

@@ -27,7 +27,7 @@
namespace lfg
{
LFGMgr::LFGMgr(): m_lfgProposalId(1), m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK))
LFGMgr::LFGMgr(): m_lfgProposalId(1), m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK)), m_Testing(false)
{
new LFGPlayerScript();
new LFGGroupScript();
@@ -768,6 +768,12 @@ namespace lfg
}*/
}
void LFGMgr::ToggleTesting()
{
m_Testing = !m_Testing;
sWorld->SendWorldText(m_Testing ? LANG_DEBUG_LFG_ON : LANG_DEBUG_LFG_OFF);
}
/**
Leaves Dungeon System. Player/Group is removed from queue, rolechecks, proposals
or votekicks. Player or group needs to be not nullptr and using Dungeon System
@@ -1645,7 +1651,11 @@ namespace lfg
if ((randomDungeon || selectedRandomLfgDungeon(player->GetGUID())) && !player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
{
randomDungeon = true;
player->AddAura(LFG_SPELL_DUNGEON_COOLDOWN, player);
// if player is debugging, don't add dungeon cooldown
if (!m_Testing)
{
player->AddAura(LFG_SPELL_DUNGEON_COOLDOWN, player);
}
}
if (player->GetMapId() == uint32(dungeon->map))
@@ -1723,7 +1733,7 @@ namespace lfg
if (itPlayers->second.accept != LFG_ANSWER_AGREE) // No answer (-1) or not accepted (0)
allAnswered = false;
if (!allAnswered)
if (!m_Testing && !allAnswered)
{
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
SendLfgUpdateProposal(it->first, proposal);

View File

@@ -551,6 +551,10 @@ namespace lfg
static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2);
/// Sends queue status to player
static void SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data);
// debug lfg command
void ToggleTesting();
/// For 1 player queue testing
[[nodiscard]] bool IsTesting() const { return m_Testing; }
void SetDungeon(ObjectGuid guid, uint32 dungeon);
@@ -604,6 +608,7 @@ namespace lfg
LfgPlayerBootContainer BootsStore; ///< Current player kicks
LfgPlayerDataContainer PlayersStore; ///< Player data
LfgGroupDataContainer GroupsStore; ///< Group data
bool m_Testing;
};
} // namespace lfg

View File

@@ -288,7 +288,7 @@ namespace lfg
return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS;
// Group with less that MAXGROUPSIZE members always compatible
if (check.size() == 1 && numPlayers < MAXGROUPSIZE)
if (!sLFGMgr->IsTesting() && check.size() == 1 && numPlayers < MAXGROUPSIZE)
{
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front());
LfgRolesMap roles = itQueue->second.roles;
@@ -385,7 +385,7 @@ namespace lfg
}
// Enough players?
if (numPlayers != MAXGROUPSIZE)
if (!sLFGMgr->IsTesting() && numPlayers != MAXGROUPSIZE)
{
strGuids.addRoles(proposalRoles);
for (uint8 i = 0; i < 5 && check.guids[i]; ++i)

View File

@@ -1355,8 +1355,11 @@ enum AcoreStrings
LANG_BG_READY_CHECK_ERROR = 30084,
LANG_DEBUG_BG_CONF = 30085,
LANG_DEBUG_ARENA_CONF = 30086
LANG_DEBUG_ARENA_CONF = 30086,
// 30087-30095 reserved for passive anticheat
LANG_DEBUG_LFG_ON = 30096,
LANG_DEBUG_LFG_OFF = 30097
};
#endif

View File

@@ -75,6 +75,7 @@ public:
{ "update", SEC_ADMINISTRATOR, false, &HandleDebugUpdateCommand, "" },
{ "itemexpire", SEC_ADMINISTRATOR, false, &HandleDebugItemExpireCommand, "" },
{ "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "" },
{ "lfg", SEC_ADMINISTRATOR, false, &HandleDebugDungeonFinderCommand, "" },
{ "los", SEC_ADMINISTRATOR, false, &HandleDebugLoSCommand, "" },
{ "moveflags", SEC_ADMINISTRATOR, false, &HandleDebugMoveflagsCommand, "" },
{ "unitstate", SEC_ADMINISTRATOR, false, &HandleDebugUnitStateCommand, "" }
@@ -805,6 +806,12 @@ public:
return true;
}
static bool HandleDebugDungeonFinderCommand(ChatHandler* /*handler*/, char const* /*args*/)
{
sLFGMgr->ToggleTesting();
return true;
}
static bool HandleDebugBattlegroundCommand(ChatHandler* /*handler*/, char const* /*args*/)
{
sBattlegroundMgr->ToggleTesting();