mirror of
https://github.com/kadeshar/mod-player-bot-level-brackets.git
synced 2026-01-13 01:08:36 +00:00
Adding Arena Team exclusion, on by default
This commit is contained in:
@@ -51,6 +51,15 @@ BotLevelBrackets.FlaggedProcessLimit = 5
|
||||
# Valid values: 0 (disabled) / 1 (enabled)
|
||||
BotLevelBrackets.IgnoreGuildBotsWithRealPlayers = 1
|
||||
|
||||
#
|
||||
# BotLevelBrackets.IgnoreArenaTeamBots
|
||||
# Description: When enabled, bots that are members of arena teams are excluded from bot bracket calculations
|
||||
# and will not be level changed or flagged. This prevents bots in arena teams from being
|
||||
# changed, which would break team compositions.
|
||||
# Default: 1 (enabled)
|
||||
# Valid values: 0 (disabled) / 1 (enabled)
|
||||
BotLevelBrackets.IgnoreArenaTeamBots = 1
|
||||
|
||||
#
|
||||
# BotLevelBrackets.GuildTrackerUpdateFrequency
|
||||
# Description: The frequency (in seconds) at which the persistent guild tracker database is updated.
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <string>
|
||||
#include "Player.h"
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
|
||||
using namespace Acore::ChatCommands;
|
||||
|
||||
@@ -52,6 +53,8 @@ static uint8 g_RandomBotMaxLevel = 80;
|
||||
static bool g_BotLevelBracketsEnabled = true;
|
||||
// Ignore bots in guilds with a real player online. Default is true.
|
||||
static bool g_IgnoreGuildBotsWithRealPlayers = true;
|
||||
// Ignore bots in arena teams. Default is true.
|
||||
static bool g_IgnoreArenaTeamBots = true;
|
||||
|
||||
// Use vectors to store the level ranges.
|
||||
static std::vector<LevelRangeConfig> g_AllianceLevelRanges;
|
||||
@@ -112,6 +115,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);
|
||||
@@ -744,6 +748,30 @@ static bool BotInFriendList(Player* bot)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Checks if the given bot is a member of any arena team.
|
||||
*
|
||||
* This function verifies that the provided Player pointer is valid and
|
||||
* checks all arena team slots to see if the bot is in any arena team.
|
||||
*
|
||||
* @param bot Pointer to the Player object representing the bot.
|
||||
* @return true if the bot is in an arena team, false otherwise.
|
||||
*/
|
||||
static bool BotInArenaTeam(Player* bot)
|
||||
{
|
||||
if (!bot)
|
||||
return false;
|
||||
for (uint32 slot = 0; slot < MAX_ARENA_SLOT; ++slot)
|
||||
{
|
||||
if (ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(bot->GetArenaTeamId(slot)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Clamps and balances the level brackets for Alliance and Horde bot distributions.
|
||||
*
|
||||
@@ -1023,6 +1051,12 @@ 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);
|
||||
@@ -1058,6 +1092,16 @@ static int GetOrFlagPlayerBracket(Player* player)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IsPlayerBot(player) && g_IgnoreGuildBotsWithRealPlayers && BotInGuildWithRealPlayer(player))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IsPlayerBot(player) && g_IgnoreArenaTeamBots && BotInArenaTeam(player))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rangeIndex = GetLevelRangeIndex(player->GetLevel(), player->GetTeamId());
|
||||
if (rangeIndex >= 0)
|
||||
{
|
||||
@@ -1430,6 +1474,10 @@ public:
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (g_IgnoreArenaTeamBots && BotInArenaTeam(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (IsAlliancePlayerBot(player))
|
||||
{
|
||||
totalAllianceBots++;
|
||||
|
||||
Reference in New Issue
Block a user