mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 07:48:02 +00:00
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:
@@ -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.');
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
namespace lfg
|
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 LFGPlayerScript();
|
||||||
new LFGGroupScript();
|
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
|
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
|
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))
|
if ((randomDungeon || selectedRandomLfgDungeon(player->GetGUID())) && !player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
|
||||||
{
|
{
|
||||||
randomDungeon = true;
|
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))
|
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)
|
if (itPlayers->second.accept != LFG_ANSWER_AGREE) // No answer (-1) or not accepted (0)
|
||||||
allAnswered = false;
|
allAnswered = false;
|
||||||
|
|
||||||
if (!allAnswered)
|
if (!m_Testing && !allAnswered)
|
||||||
{
|
{
|
||||||
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
|
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
|
||||||
SendLfgUpdateProposal(it->first, proposal);
|
SendLfgUpdateProposal(it->first, proposal);
|
||||||
|
|||||||
@@ -551,6 +551,10 @@ namespace lfg
|
|||||||
static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2);
|
static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2);
|
||||||
/// Sends queue status to player
|
/// Sends queue status to player
|
||||||
static void SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data);
|
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);
|
void SetDungeon(ObjectGuid guid, uint32 dungeon);
|
||||||
|
|
||||||
@@ -604,6 +608,7 @@ namespace lfg
|
|||||||
LfgPlayerBootContainer BootsStore; ///< Current player kicks
|
LfgPlayerBootContainer BootsStore; ///< Current player kicks
|
||||||
LfgPlayerDataContainer PlayersStore; ///< Player data
|
LfgPlayerDataContainer PlayersStore; ///< Player data
|
||||||
LfgGroupDataContainer GroupsStore; ///< Group data
|
LfgGroupDataContainer GroupsStore; ///< Group data
|
||||||
|
bool m_Testing;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace lfg
|
} // namespace lfg
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ namespace lfg
|
|||||||
return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS;
|
return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS;
|
||||||
|
|
||||||
// Group with less that MAXGROUPSIZE members always compatible
|
// 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());
|
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front());
|
||||||
LfgRolesMap roles = itQueue->second.roles;
|
LfgRolesMap roles = itQueue->second.roles;
|
||||||
@@ -385,7 +385,7 @@ namespace lfg
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enough players?
|
// Enough players?
|
||||||
if (numPlayers != MAXGROUPSIZE)
|
if (!sLFGMgr->IsTesting() && numPlayers != MAXGROUPSIZE)
|
||||||
{
|
{
|
||||||
strGuids.addRoles(proposalRoles);
|
strGuids.addRoles(proposalRoles);
|
||||||
for (uint8 i = 0; i < 5 && check.guids[i]; ++i)
|
for (uint8 i = 0; i < 5 && check.guids[i]; ++i)
|
||||||
|
|||||||
@@ -1355,8 +1355,11 @@ enum AcoreStrings
|
|||||||
LANG_BG_READY_CHECK_ERROR = 30084,
|
LANG_BG_READY_CHECK_ERROR = 30084,
|
||||||
|
|
||||||
LANG_DEBUG_BG_CONF = 30085,
|
LANG_DEBUG_BG_CONF = 30085,
|
||||||
LANG_DEBUG_ARENA_CONF = 30086
|
LANG_DEBUG_ARENA_CONF = 30086,
|
||||||
|
|
||||||
// 30087-30095 reserved for passive anticheat
|
// 30087-30095 reserved for passive anticheat
|
||||||
|
|
||||||
|
LANG_DEBUG_LFG_ON = 30096,
|
||||||
|
LANG_DEBUG_LFG_OFF = 30097
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public:
|
|||||||
{ "update", SEC_ADMINISTRATOR, false, &HandleDebugUpdateCommand, "" },
|
{ "update", SEC_ADMINISTRATOR, false, &HandleDebugUpdateCommand, "" },
|
||||||
{ "itemexpire", SEC_ADMINISTRATOR, false, &HandleDebugItemExpireCommand, "" },
|
{ "itemexpire", SEC_ADMINISTRATOR, false, &HandleDebugItemExpireCommand, "" },
|
||||||
{ "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "" },
|
{ "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "" },
|
||||||
|
{ "lfg", SEC_ADMINISTRATOR, false, &HandleDebugDungeonFinderCommand, "" },
|
||||||
{ "los", SEC_ADMINISTRATOR, false, &HandleDebugLoSCommand, "" },
|
{ "los", SEC_ADMINISTRATOR, false, &HandleDebugLoSCommand, "" },
|
||||||
{ "moveflags", SEC_ADMINISTRATOR, false, &HandleDebugMoveflagsCommand, "" },
|
{ "moveflags", SEC_ADMINISTRATOR, false, &HandleDebugMoveflagsCommand, "" },
|
||||||
{ "unitstate", SEC_ADMINISTRATOR, false, &HandleDebugUnitStateCommand, "" }
|
{ "unitstate", SEC_ADMINISTRATOR, false, &HandleDebugUnitStateCommand, "" }
|
||||||
@@ -805,6 +806,12 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool HandleDebugDungeonFinderCommand(ChatHandler* /*handler*/, char const* /*args*/)
|
||||||
|
{
|
||||||
|
sLFGMgr->ToggleTesting();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool HandleDebugBattlegroundCommand(ChatHandler* /*handler*/, char const* /*args*/)
|
static bool HandleDebugBattlegroundCommand(ChatHandler* /*handler*/, char const* /*args*/)
|
||||||
{
|
{
|
||||||
sBattlegroundMgr->ToggleTesting();
|
sBattlegroundMgr->ToggleTesting();
|
||||||
|
|||||||
Reference in New Issue
Block a user