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

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