feat: ignore arena team for downgrade

This commit is contained in:
Jered Little
2025-10-02 09:23:31 -06:00
parent 4d6e972f01
commit 402556fc36
2 changed files with 73 additions and 38 deletions

View File

@@ -120,6 +120,14 @@ BotLevelBrackets.Dynamic.RealPlayerWeight = 1.0
#
BotLevelBrackets.Dynamic.SyncFactions = 0
#
# BotLevelBrackets.IgnoreArenaTeamBots
# Description: Ignore bots that are members of any arena team (prevents downgrades)
# Default: 1 (enabled)
# Valid values: 0 (off) / 1 (on)
#
BotLevelBrackets.IgnoreArenaTeamBots = 1
##############################################
# Alliance Level Brackets Configuration
##############################################

View File

@@ -61,6 +61,7 @@ static bool g_BotDistLiteDebugMode = false;
static bool g_UseDynamicDistribution = false;
static bool g_IgnoreFriendListed = true;
static uint32 g_FlaggedProcessLimit = 5; // 0 = unlimited
static bool g_IgnoreArenaTeamBots = true;
// Real player weight to boost bracket contributions.
static float g_RealPlayerWeight = 1.0f;
@@ -108,7 +109,7 @@ static void LoadBotLevelBracketsConfig()
{
g_BotLevelBracketsEnabled = sConfigMgr->GetOption<bool>("BotLevelBrackets.Enabled", true);
g_IgnoreGuildBotsWithRealPlayers = sConfigMgr->GetOption<bool>("BotLevelBrackets.IgnoreGuildBotsWithRealPlayers", true);
g_IgnoreArenaTeamBots = sConfigMgr->GetOption<bool>("BotLevelBrackets.IgnoreArenaTeamBots", true);
g_BotDistFullDebugMode = sConfigMgr->GetOption<bool>("BotLevelBrackets.FullDebugMode", false);
g_BotDistLiteDebugMode = sConfigMgr->GetOption<bool>("BotLevelBrackets.LiteDebugMode", false);
g_BotDistCheckFrequency = sConfigMgr->GetOption<uint32>("BotLevelBrackets.CheckFrequency", 300);
@@ -201,6 +202,29 @@ static bool IsPlayerBot(Player* player)
return botAI && botAI->IsBotAI();
}
/**
* @brief Checks if player is in arena team.
*
* Checks if player is in arena team
*
* @param p Pointer to the Player object to check.
* @return true if the player is in a team.
*/
static bool BotInArenaTeam(Player* p)
{
if (!p || !p->IsInWorld() || !p->GetSession() || p->GetSession()->isLogingOut() || p->IsDuringRemoveFromWorld())
return false;
// Check if player is in an arena team
for (uint32 arena_slot = 0; arena_slot < MAX_ARENA_SLOT; ++arena_slot)
{
uint32 arenaTeamId = p->GetArenaTeamId(arena_slot);
if (arenaTeamId)
return true;
}
return false;
}
/**
* @brief Checks if the given player is a random bot.
@@ -1028,6 +1052,8 @@ static void ProcessPendingLevelResets()
continue;
}
if (g_IgnoreArenaTeamBots && BotInArenaTeam(bot)) { it = g_PendingLevelResets.erase(it); continue; }
if (bot && bot->IsInWorld() && IsBotSafeForLevelReset(bot))
{
AdjustBotToRange(bot, targetRange, it->factionRanges);
@@ -1279,6 +1305,7 @@ public:
continue;
if (IsPlayerBot(player))
continue; // Only count real players.
if (g_IgnoreArenaTeamBots && BotInArenaTeam(player)) continue;
int rangeIndex = GetOrFlagPlayerBracket(player);
if (rangeIndex < 0)
continue;