mirror of
https://github.com/kadeshar/mod-player-bot-level-brackets.git
synced 2026-01-13 09:17:19 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
417aa84e9c | ||
|
|
8cb77796bb |
@@ -85,6 +85,7 @@ BotLevelBrackets.Dynamic.SyncFactions | Enables synchronized brackets and w
|
|||||||
BotLevelBrackets.IgnoreFriendListed | Ignores bots that are on real players' friend lists from any bracket calculations. | 1 | 0 (off) / 1 (on)
|
BotLevelBrackets.IgnoreFriendListed | Ignores bots that are on real players' friend lists from any bracket calculations. | 1 | 0 (off) / 1 (on)
|
||||||
BotLevelBrackets.IgnoreGuildBotsWithRealPlayers | Excludes bots in a guild with at least one real (non-bot) player online from adjustments. | 1 | 0 (disabled) / 1 (enabled)
|
BotLevelBrackets.IgnoreGuildBotsWithRealPlayers | Excludes bots in a guild with at least one real (non-bot) player online from adjustments. | 1 | 0 (disabled) / 1 (enabled)
|
||||||
BotLevelBrackets.NumRanges | Number of level brackets used for bot distribution. Both factions must have the same number defined. | 9 | Positive Integer
|
BotLevelBrackets.NumRanges | Number of level brackets used for bot distribution. Both factions must have the same number defined. | 9 | Positive Integer
|
||||||
|
BotLevelBrackets.ExcludeNames | Comma-separated list of case insensitive bot names to exclude from all bracket checks. | | String
|
||||||
|
|
||||||
**IMPORTANT:** If you extend the number of brackets beyond the default 9, you must update both your `mod_player_bot_level_brackets.conf` file and the accompanying `mod_player_bot_level_brackets.conf.dist` file to include configuration lines for the additional ranges (e.g. Range10, Range11, etc.), ensuring that the sum of the Pct values remains 100.
|
**IMPORTANT:** If you extend the number of brackets beyond the default 9, you must update both your `mod_player_bot_level_brackets.conf` file and the accompanying `mod_player_bot_level_brackets.conf.dist` file to include configuration lines for the additional ranges (e.g. Range10, Range11, etc.), ensuring that the sum of the Pct values remains 100.
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ BotLevelBrackets.IgnoreGuildBotsWithRealPlayers = 1
|
|||||||
# Valid values: 0 (off) / 1 (on)
|
# Valid values: 0 (off) / 1 (on)
|
||||||
BotLevelBrackets.IgnoreFriendListed = 1
|
BotLevelBrackets.IgnoreFriendListed = 1
|
||||||
|
|
||||||
|
# BotLevelBrackets.ExcludeNames
|
||||||
|
# Description: Comma-separated list of case insensitive bot names to exclude from all bracket checks.
|
||||||
|
# Default: ""
|
||||||
|
BotLevelBrackets.ExcludeNames =
|
||||||
|
|
||||||
#
|
#
|
||||||
# BotLevelBrackets.NumRanges
|
# BotLevelBrackets.NumRanges
|
||||||
# Description: The number of level brackets used for bot distribution.
|
# Description: The number of level brackets used for bot distribution.
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ static bool g_SyncFactions = false;
|
|||||||
// Array for character social list friends
|
// Array for character social list friends
|
||||||
std::vector<int> g_SocialFriendsList;
|
std::vector<int> g_SocialFriendsList;
|
||||||
|
|
||||||
|
// Array for excluded bot names.
|
||||||
|
static std::vector<std::string> g_ExcludeBotNames;
|
||||||
|
|
||||||
// Array for real player guild IDs.
|
// Array for real player guild IDs.
|
||||||
std::unordered_set<uint32> g_RealPlayerGuildIds;
|
std::unordered_set<uint32> g_RealPlayerGuildIds;
|
||||||
|
|
||||||
@@ -111,6 +114,17 @@ static void LoadBotLevelBracketsConfig()
|
|||||||
g_IgnoreFriendListed = sConfigMgr->GetOption<bool>("BotLevelBrackets.IgnoreFriendListed", true);
|
g_IgnoreFriendListed = sConfigMgr->GetOption<bool>("BotLevelBrackets.IgnoreFriendListed", true);
|
||||||
g_FlaggedProcessLimit = sConfigMgr->GetOption<uint32>("BotLevelBrackets.FlaggedProcessLimit", 5);
|
g_FlaggedProcessLimit = sConfigMgr->GetOption<uint32>("BotLevelBrackets.FlaggedProcessLimit", 5);
|
||||||
|
|
||||||
|
std::string excludeNames = sConfigMgr->GetOption<std::string>("BotLevelBrackets.ExcludeNames", "");
|
||||||
|
g_ExcludeBotNames.clear();
|
||||||
|
std::istringstream f(excludeNames);
|
||||||
|
std::string s;
|
||||||
|
while (getline(f, s, ',')) {
|
||||||
|
s.erase(std::remove_if(s.begin(), s.end(), ::isspace), s.end());
|
||||||
|
if (!s.empty()) {
|
||||||
|
g_ExcludeBotNames.push_back(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Load the bot level restrictions.
|
// Load the bot level restrictions.
|
||||||
g_RandomBotMinLevel = static_cast<uint8>(sConfigMgr->GetOption<uint32>("AiPlayerbot.RandomBotMinLevel", 1));
|
g_RandomBotMinLevel = static_cast<uint8>(sConfigMgr->GetOption<uint32>("AiPlayerbot.RandomBotMinLevel", 1));
|
||||||
g_RandomBotMaxLevel = static_cast<uint8>(sConfigMgr->GetOption<uint32>("AiPlayerbot.RandomBotMaxLevel", 80));
|
g_RandomBotMaxLevel = static_cast<uint8>(sConfigMgr->GetOption<uint32>("AiPlayerbot.RandomBotMaxLevel", 80));
|
||||||
@@ -737,6 +751,32 @@ static bool IsBotSafeForLevelReset(Player* bot)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if a given bot is in the exclusion list for bracket processing.
|
||||||
|
*
|
||||||
|
* This function determines whether the provided bot's name matches any entry in the global
|
||||||
|
* exclusion list `g_ExcludeBotNames`, which is populated from the BotLevelBrackets.ExcludeNames config.
|
||||||
|
* If a match is found, this bot will not be considered for any bracket checks or level resets.
|
||||||
|
*
|
||||||
|
* @param bot Pointer to the Player object representing the bot to check.
|
||||||
|
* @return true if the bot is excluded from bracket processing, false otherwise.
|
||||||
|
*/
|
||||||
|
static bool IsBotExcluded(Player* bot)
|
||||||
|
{
|
||||||
|
if (!bot)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const std::string& name = bot->GetName();
|
||||||
|
for (const auto& excluded : g_ExcludeBotNames)
|
||||||
|
{
|
||||||
|
if (excluded == name)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Processes the pending level reset requests for player bots.
|
* @brief Processes the pending level reset requests for player bots.
|
||||||
@@ -788,6 +828,12 @@ static void ProcessPendingLevelResets()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsBotExcluded(bot))
|
||||||
|
{
|
||||||
|
it = g_PendingLevelResets.erase(it);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int targetRange = it->targetRange;
|
int targetRange = it->targetRange;
|
||||||
if (g_IgnoreGuildBotsWithRealPlayers && BotInGuildWithRealPlayer(bot))
|
if (g_IgnoreGuildBotsWithRealPlayers && BotInGuildWithRealPlayer(bot))
|
||||||
{
|
{
|
||||||
@@ -831,6 +877,11 @@ static void ProcessPendingLevelResets()
|
|||||||
*/
|
*/
|
||||||
static int GetOrFlagPlayerBracket(Player* player)
|
static int GetOrFlagPlayerBracket(Player* player)
|
||||||
{
|
{
|
||||||
|
if (IsPlayerBot(player) && IsBotExcluded(player))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int rangeIndex = GetLevelRangeIndex(player->GetLevel(), player->GetTeamId());
|
int rangeIndex = GetLevelRangeIndex(player->GetLevel(), player->GetTeamId());
|
||||||
if (rangeIndex >= 0)
|
if (rangeIndex >= 0)
|
||||||
{
|
{
|
||||||
@@ -1172,6 +1223,14 @@ public:
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (IsBotExcluded(player))
|
||||||
|
{
|
||||||
|
if (g_BotDistFullDebugMode)
|
||||||
|
{
|
||||||
|
LOG_INFO("server.loading", "[BotLevelBrackets] Skipping excluded bot '{}'.", player->GetName());
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (g_IgnoreGuildBotsWithRealPlayers && BotInGuildWithRealPlayer(player))
|
if (g_IgnoreGuildBotsWithRealPlayers && BotInGuildWithRealPlayer(player))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user