mirror of
https://github.com/kadeshar/mod-player-bot-level-brackets.git
synced 2026-01-14 09:39:12 +00:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f64862503 | ||
|
|
6a33cb3257 | ||
|
|
a926792857 | ||
|
|
1faa24cf15 | ||
|
|
11dc0941fd | ||
|
|
6152f9e77e | ||
|
|
a33f0ca354 | ||
|
|
10c47670cf | ||
|
|
d3ab2c899f | ||
|
|
d45213c360 | ||
|
|
93989a902f | ||
|
|
0d78babe57 | ||
|
|
82d83f64a4 | ||
|
|
ba34ee7908 | ||
|
|
4205db2b0f | ||
|
|
db5499ee72 | ||
|
|
d2e3ad166c | ||
|
|
e8bf099b03 | ||
|
|
74fb4876f5 | ||
|
|
8669a4dbcb | ||
|
|
a5eb4c6855 | ||
|
|
af1ee91c17 |
@@ -79,8 +79,8 @@ BotLevelBrackets.LiteDebugMode | Enables lite debug logging for th
|
|||||||
BotLevelBrackets.CheckFrequency | Frequency (in seconds) at which the bot level distribution check is performed. | 300 | Positive Integer
|
BotLevelBrackets.CheckFrequency | Frequency (in seconds) at which the bot level distribution check is performed. | 300 | Positive Integer
|
||||||
BotLevelBrackets.CheckFlaggedFrequency | Frequency (in seconds) at which the bot level reset is performed for flagged bots that initially failed safety checks. | 15 | Positive Integer
|
BotLevelBrackets.CheckFlaggedFrequency | Frequency (in seconds) at which the bot level reset is performed for flagged bots that initially failed safety checks. | 15 | Positive Integer
|
||||||
BotLevelBrackets.FlaggedProcessLimit | Maximum number of flagged bots to process per pending level change step. | 5 | Positive Integer
|
BotLevelBrackets.FlaggedProcessLimit | Maximum number of flagged bots to process per pending level change step. | 5 | Positive Integer
|
||||||
BotLevelBrackets.Dynamic.UseDynamicDistribution | Enables dynamic bot distribution: when on, brackets with more real players get a higher share of bots, based on the weight below. | 0 | 0 (off) / 1 (on)
|
BotLevelBrackets.Dynamic.UseDynamicDistribution | Enables dynamic bot distribution: when on, brackets with more real players get a higher share of bots in their level bracket, based on the weight below. | 0 | 0 (off) / 1 (on)
|
||||||
BotLevelBrackets.Dynamic.RealPlayerWeight | Controls how much bots "follow" real player activity when dynamic distribution is enabled. 0.0 = bots always spread evenly; 1.0 = mild effect; higher values = more bots go where players are, but the effect is scaled. | 1.0 | ≥ 0.0 (float)
|
BotLevelBrackets.Dynamic.RealPlayerWeight | Controls how much bots "follow" real player activity when dynamic distribution is enabled. 0.0 = bots always spread evenly; 1.0 = minimal effect; 10.0 = heavy effect; higher values = more bots go where players are, but the effect is scaled. | 1.0 | ≥ 0.0 (float)
|
||||||
BotLevelBrackets.Dynamic.SyncFactions | Enables synchronized brackets and weighting between Alliance and Horde factions when Dynamic Distribution is also enabled. | 0 | 0 (off) / 1 (on)
|
BotLevelBrackets.Dynamic.SyncFactions | Enables synchronized brackets and weighting between Alliance and Horde factions when Dynamic Distribution is also enabled. | 0 | 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.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 from adjustments. Uses persistent database tracking for both online and offline real players. | 1 | 0 (disabled) / 1 (enabled)
|
BotLevelBrackets.IgnoreGuildBotsWithRealPlayers | Excludes bots in a guild with at least one real (non-bot) player from adjustments. Uses persistent database tracking for both online and offline real players. | 1 | 0 (disabled) / 1 (enabled)
|
||||||
|
|||||||
@@ -44,13 +44,22 @@ BotLevelBrackets.FlaggedProcessLimit = 5
|
|||||||
|
|
||||||
#
|
#
|
||||||
# BotLevelBrackets.IgnoreGuildBotsWithRealPlayers
|
# BotLevelBrackets.IgnoreGuildBotsWithRealPlayers
|
||||||
# Description: When enabled, bots that are in a guild with at least one real (non-bot) player are excluded
|
# Description: When enabled, bots that are in a guild with at least one real (non-bot) player are excluded
|
||||||
# from bot bracket calculations and will not be level changed or flagged.
|
# from bot bracket calculations and will not be level changed or flagged.
|
||||||
# This now works for both online and offline real players using persistent database tracking.
|
# This now works for both online and offline real players using persistent database tracking.
|
||||||
# Default: 1 (enabled)
|
# Default: 1 (enabled)
|
||||||
# Valid values: 0 (disabled) / 1 (enabled)
|
# Valid values: 0 (disabled) / 1 (enabled)
|
||||||
BotLevelBrackets.IgnoreGuildBotsWithRealPlayers = 1
|
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
|
# BotLevelBrackets.GuildTrackerUpdateFrequency
|
||||||
# Description: The frequency (in seconds) at which the persistent guild tracker database is updated.
|
# Description: The frequency (in seconds) at which the persistent guild tracker database is updated.
|
||||||
@@ -84,8 +93,8 @@ BotLevelBrackets.NumRanges = 9
|
|||||||
|
|
||||||
#
|
#
|
||||||
# BotLevelBrackets.Dynamic.UseDynamicDistribution
|
# BotLevelBrackets.Dynamic.UseDynamicDistribution
|
||||||
# Description: Enables dynamic recalculation of bot distribution percentages based on the number of non-bot players
|
# Description: Enables dynamic recalculation of bot distribution percentages based on the number of non-bot players
|
||||||
# present in each level bracket.
|
# present in each level bracket. This overrides any custom brackets in the conf.
|
||||||
# Default: 0 (disabled)
|
# Default: 0 (disabled)
|
||||||
# Valid values: 0 (off) / 1 (on)
|
# Valid values: 0 (off) / 1 (on)
|
||||||
BotLevelBrackets.Dynamic.UseDynamicDistribution = 0
|
BotLevelBrackets.Dynamic.UseDynamicDistribution = 0
|
||||||
@@ -95,7 +104,7 @@ BotLevelBrackets.Dynamic.UseDynamicDistribution = 0
|
|||||||
# The higher you set this value, the more bots will move to the same level brackets where real players are found, but the effect is *gentle*, not extreme.
|
# The higher you set this value, the more bots will move to the same level brackets where real players are found, but the effect is *gentle*, not extreme.
|
||||||
# A value of 0.0 means bots always distribute evenly across all brackets, regardless of where players are. The default value of 1.0 gives a mild, balanced effect.
|
# A value of 0.0 means bots always distribute evenly across all brackets, regardless of where players are. The default value of 1.0 gives a mild, balanced effect.
|
||||||
# Raising this to 3.0, 5.0, or higher will make bots concentrate more in brackets with real players.
|
# Raising this to 3.0, 5.0, or higher will make bots concentrate more in brackets with real players.
|
||||||
# The value is a multiplier (not a percent): 0.0 = no extra effect, 1.0 = default, 3.0 = stronger, 5.0 = strong but not extreme.
|
# The value is a multiplier (not a percent): 0.0 = no extra effect, 1.0 = minimal, 3.0 = stronger, 5.0 = strong but not extreme.
|
||||||
# Experiment based on your total bot count and real player counts to find a good number for your server.
|
# Experiment based on your total bot count and real player counts to find a good number for your server.
|
||||||
# If you want a large congestion of bots in your level bracket for solo play I recommend 10-15 for RealPlayerWeight.
|
# If you want a large congestion of bots in your level bracket for solo play I recommend 10-15 for RealPlayerWeight.
|
||||||
# What to expect:
|
# What to expect:
|
||||||
@@ -120,14 +129,6 @@ BotLevelBrackets.Dynamic.RealPlayerWeight = 1.0
|
|||||||
#
|
#
|
||||||
BotLevelBrackets.Dynamic.SyncFactions = 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
|
# Alliance Level Brackets Configuration
|
||||||
##############################################
|
##############################################
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
|
#include "CommandScript.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "PlayerbotMgr.h"
|
#include "PlayerbotMgr.h"
|
||||||
@@ -19,6 +20,10 @@
|
|||||||
#include "QueryResult.h"
|
#include "QueryResult.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
#include "PlayerbotAIConfig.h"
|
||||||
|
#include "ArenaTeamMgr.h"
|
||||||
|
|
||||||
|
using namespace Acore::ChatCommands;
|
||||||
|
|
||||||
// Forward declarations.
|
// Forward declarations.
|
||||||
class Guild;
|
class Guild;
|
||||||
@@ -48,6 +53,8 @@ static uint8 g_RandomBotMaxLevel = 80;
|
|||||||
static bool g_BotLevelBracketsEnabled = true;
|
static bool g_BotLevelBracketsEnabled = true;
|
||||||
// Ignore bots in guilds with a real player online. Default is true.
|
// Ignore bots in guilds with a real player online. Default is true.
|
||||||
static bool g_IgnoreGuildBotsWithRealPlayers = 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.
|
// Use vectors to store the level ranges.
|
||||||
static std::vector<LevelRangeConfig> g_AllianceLevelRanges;
|
static std::vector<LevelRangeConfig> g_AllianceLevelRanges;
|
||||||
@@ -61,7 +68,6 @@ static bool g_BotDistLiteDebugMode = false;
|
|||||||
static bool g_UseDynamicDistribution = false;
|
static bool g_UseDynamicDistribution = false;
|
||||||
static bool g_IgnoreFriendListed = true;
|
static bool g_IgnoreFriendListed = true;
|
||||||
static uint32 g_FlaggedProcessLimit = 5; // 0 = unlimited
|
static uint32 g_FlaggedProcessLimit = 5; // 0 = unlimited
|
||||||
static bool g_IgnoreArenaTeamBots = true;
|
|
||||||
|
|
||||||
// Real player weight to boost bracket contributions.
|
// Real player weight to boost bracket contributions.
|
||||||
static float g_RealPlayerWeight = 1.0f;
|
static float g_RealPlayerWeight = 1.0f;
|
||||||
@@ -72,7 +78,7 @@ static float g_RealPlayerWeight = 1.0f;
|
|||||||
static bool g_SyncFactions = false;
|
static bool g_SyncFactions = false;
|
||||||
|
|
||||||
// Array for character social list friends
|
// Array for character social list friends
|
||||||
std::vector<int> g_SocialFriendsList;
|
std::vector<uint64> g_SocialFriendsList;
|
||||||
|
|
||||||
// Array for excluded bot names.
|
// Array for excluded bot names.
|
||||||
static std::vector<std::string> g_ExcludeBotNames;
|
static std::vector<std::string> g_ExcludeBotNames;
|
||||||
@@ -110,6 +116,7 @@ static void LoadBotLevelBracketsConfig()
|
|||||||
g_BotLevelBracketsEnabled = sConfigMgr->GetOption<bool>("BotLevelBrackets.Enabled", true);
|
g_BotLevelBracketsEnabled = sConfigMgr->GetOption<bool>("BotLevelBrackets.Enabled", true);
|
||||||
g_IgnoreGuildBotsWithRealPlayers = sConfigMgr->GetOption<bool>("BotLevelBrackets.IgnoreGuildBotsWithRealPlayers", true);
|
g_IgnoreGuildBotsWithRealPlayers = sConfigMgr->GetOption<bool>("BotLevelBrackets.IgnoreGuildBotsWithRealPlayers", true);
|
||||||
g_IgnoreArenaTeamBots = sConfigMgr->GetOption<bool>("BotLevelBrackets.IgnoreArenaTeamBots", true);
|
g_IgnoreArenaTeamBots = sConfigMgr->GetOption<bool>("BotLevelBrackets.IgnoreArenaTeamBots", true);
|
||||||
|
|
||||||
g_BotDistFullDebugMode = sConfigMgr->GetOption<bool>("BotLevelBrackets.FullDebugMode", false);
|
g_BotDistFullDebugMode = sConfigMgr->GetOption<bool>("BotLevelBrackets.FullDebugMode", false);
|
||||||
g_BotDistLiteDebugMode = sConfigMgr->GetOption<bool>("BotLevelBrackets.LiteDebugMode", false);
|
g_BotDistLiteDebugMode = sConfigMgr->GetOption<bool>("BotLevelBrackets.LiteDebugMode", false);
|
||||||
g_BotDistCheckFrequency = sConfigMgr->GetOption<uint32>("BotLevelBrackets.CheckFrequency", 300);
|
g_BotDistCheckFrequency = sConfigMgr->GetOption<uint32>("BotLevelBrackets.CheckFrequency", 300);
|
||||||
@@ -168,8 +175,8 @@ static void LoadBotLevelBracketsConfig()
|
|||||||
LOG_ERROR("server.loading", "[BotLevelBrackets] FATAL: Bracket mismatch detected between factions at index {}. "
|
LOG_ERROR("server.loading", "[BotLevelBrackets] FATAL: Bracket mismatch detected between factions at index {}. "
|
||||||
"Alliance: {}-{}, Horde: {}-{}. "
|
"Alliance: {}-{}, Horde: {}-{}. "
|
||||||
"When SyncFactions is enabled, both bracket number and min/max levels must match exactly. "
|
"When SyncFactions is enabled, both bracket number and min/max levels must match exactly. "
|
||||||
"Check your configuration.",
|
"Check your configuration.",
|
||||||
i, g_AllianceLevelRanges[i].lower, g_AllianceLevelRanges[i].upper,
|
i, g_AllianceLevelRanges[i].lower, g_AllianceLevelRanges[i].upper,
|
||||||
g_HordeLevelRanges[i].lower, g_HordeLevelRanges[i].upper);
|
g_HordeLevelRanges[i].lower, g_HordeLevelRanges[i].upper);
|
||||||
std::terminate();
|
std::terminate();
|
||||||
}
|
}
|
||||||
@@ -202,29 +209,6 @@ static bool IsPlayerBot(Player* player)
|
|||||||
return botAI && botAI->IsBotAI();
|
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.
|
* @brief Checks if the given player is a random bot.
|
||||||
@@ -275,39 +259,6 @@ static bool IsHordePlayerBot(Player* bot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Logs the number of player bots at each level if full debug mode is enabled.
|
|
||||||
*
|
|
||||||
* This function iterates through all players in the world, counts the number of bots at each level,
|
|
||||||
* and logs the results. Only bots that are currently in the world are considered. The logging occurs
|
|
||||||
* only if the global debug mode flag `g_BotDistFullDebugMode` is set to true.
|
|
||||||
*/
|
|
||||||
static void LogAllBotLevels()
|
|
||||||
{
|
|
||||||
if (g_BotDistFullDebugMode)
|
|
||||||
{
|
|
||||||
std::map<uint8, uint32> botLevelCount;
|
|
||||||
for (auto const& itr : ObjectAccessor::GetPlayers())
|
|
||||||
{
|
|
||||||
Player* player = itr.second;
|
|
||||||
if (!player || !player->IsInWorld())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!IsPlayerBot(player))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
botLevelCount[player->GetLevel()]++;
|
|
||||||
}
|
|
||||||
for (const auto& entry : botLevelCount)
|
|
||||||
{
|
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Level {}: {} bots", entry.first, entry.second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Removes a bot from the list of pending level resets.
|
* @brief Removes a bot from the list of pending level resets.
|
||||||
*
|
*
|
||||||
@@ -362,7 +313,7 @@ static void LoadSocialFriendList()
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
uint32 socialFriendGUID = result->Fetch()->Get<uint32>();
|
uint32 socialFriendGUID = result->Fetch()->Get<uint32>();
|
||||||
g_SocialFriendsList.push_back(socialFriendGUID);
|
g_SocialFriendsList.push_back(static_cast<uint64>(socialFriendGUID));
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.load", "[BotLevelBrackets] Adding GUID {} to Social Friend List", socialFriendGUID);
|
LOG_INFO("server.load", "[BotLevelBrackets] Adding GUID {} to Social Friend List", socialFriendGUID);
|
||||||
@@ -382,7 +333,7 @@ static void LoadPersistentGuildTracker()
|
|||||||
{
|
{
|
||||||
g_PersistentRealPlayerGuildIds.clear();
|
g_PersistentRealPlayerGuildIds.clear();
|
||||||
QueryResult result = CharacterDatabase.Query("SELECT guild_id FROM bot_level_brackets_guild_tracker WHERE has_real_players = 1");
|
QueryResult result = CharacterDatabase.Query("SELECT guild_id FROM bot_level_brackets_guild_tracker WHERE has_real_players = 1");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
@@ -391,12 +342,12 @@ static void LoadPersistentGuildTracker()
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Loading persistent guild tracker data from database...");
|
LOG_INFO("server.loading", "[BotLevelBrackets] Loading persistent guild tracker data from database...");
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
uint32 guildId = result->Fetch()->Get<uint32>();
|
uint32 guildId = result->Fetch()->Get<uint32>();
|
||||||
@@ -406,7 +357,7 @@ static void LoadPersistentGuildTracker()
|
|||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Loaded guild {} as having real players.", guildId);
|
LOG_INFO("server.loading", "[BotLevelBrackets] Loaded guild {} as having real players.", guildId);
|
||||||
}
|
}
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
||||||
if (g_BotDistFullDebugMode || g_BotDistLiteDebugMode)
|
if (g_BotDistFullDebugMode || g_BotDistLiteDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Loaded {} guilds with real players from persistent storage.", g_PersistentRealPlayerGuildIds.size());
|
LOG_INFO("server.loading", "[BotLevelBrackets] Loaded {} guilds with real players from persistent storage.", g_PersistentRealPlayerGuildIds.size());
|
||||||
@@ -427,17 +378,17 @@ static void UpdatePersistentGuildTracker()
|
|||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Starting additive-only persistent guild tracker update...");
|
LOG_INFO("server.loading", "[BotLevelBrackets] Starting additive-only persistent guild tracker update...");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find guilds with currently online real players
|
// Find guilds with currently online real players
|
||||||
std::unordered_set<uint32> currentRealPlayerGuilds;
|
std::unordered_set<uint32> currentRealPlayerGuilds;
|
||||||
|
|
||||||
const auto& allPlayers = ObjectAccessor::GetPlayers();
|
const auto& allPlayers = ObjectAccessor::GetPlayers();
|
||||||
for (const auto& itr : allPlayers)
|
for (const auto& itr : allPlayers)
|
||||||
{
|
{
|
||||||
Player* player = itr.second;
|
Player* player = itr.second;
|
||||||
if (!player || !player->IsInWorld())
|
if (!player || !player->IsInWorld())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!IsPlayerBot(player))
|
if (!IsPlayerBot(player))
|
||||||
{
|
{
|
||||||
uint32 guildId = player->GetGuildId();
|
uint32 guildId = player->GetGuildId();
|
||||||
@@ -447,9 +398,9 @@ static void UpdatePersistentGuildTracker()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 addedCount = 0;
|
uint32 addedCount = 0;
|
||||||
|
|
||||||
// Update or insert guilds with real players - ensure has_real_players is set to 1
|
// Update or insert guilds with real players - ensure has_real_players is set to 1
|
||||||
for (uint32 guildId : currentRealPlayerGuilds)
|
for (uint32 guildId : currentRealPlayerGuilds)
|
||||||
{
|
{
|
||||||
@@ -459,15 +410,15 @@ static void UpdatePersistentGuildTracker()
|
|||||||
"VALUES ({}, 1)",
|
"VALUES ({}, 1)",
|
||||||
guildId
|
guildId
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add to our in-memory cache
|
// Add to our in-memory cache
|
||||||
g_PersistentRealPlayerGuildIds.insert(guildId);
|
g_PersistentRealPlayerGuildIds.insert(guildId);
|
||||||
addedCount++;
|
addedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_BotDistFullDebugMode || g_BotDistLiteDebugMode)
|
if (g_BotDistFullDebugMode || g_BotDistLiteDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Additive guild tracker update complete. {} guilds processed, {} total tracked guilds.",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Additive guild tracker update complete. {} guilds processed, {} total tracked guilds.",
|
||||||
addedCount, g_PersistentRealPlayerGuildIds.size());
|
addedCount, g_PersistentRealPlayerGuildIds.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -486,7 +437,7 @@ static void CleanupGuildTracker()
|
|||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Starting guild tracker cleanup - removing guilds with no online real players...");
|
LOG_INFO("server.loading", "[BotLevelBrackets] Starting guild tracker cleanup - removing guilds with no online real players...");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current guilds with online real players
|
// Get current guilds with online real players
|
||||||
std::unordered_set<uint32> currentRealPlayerGuilds;
|
std::unordered_set<uint32> currentRealPlayerGuilds;
|
||||||
const auto& allPlayers = ObjectAccessor::GetPlayers();
|
const auto& allPlayers = ObjectAccessor::GetPlayers();
|
||||||
@@ -495,7 +446,7 @@ static void CleanupGuildTracker()
|
|||||||
Player* player = itr.second;
|
Player* player = itr.second;
|
||||||
if (!player || !player->IsInWorld())
|
if (!player || !player->IsInWorld())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!IsPlayerBot(player))
|
if (!IsPlayerBot(player))
|
||||||
{
|
{
|
||||||
uint32 guildId = player->GetGuildId();
|
uint32 guildId = player->GetGuildId();
|
||||||
@@ -505,7 +456,7 @@ static void CleanupGuildTracker()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find guilds to remove (those in tracker but not in current real player guilds)
|
// Find guilds to remove (those in tracker but not in current real player guilds)
|
||||||
std::vector<uint32> guildsToRemove;
|
std::vector<uint32> guildsToRemove;
|
||||||
for (uint32 trackedGuildId : g_PersistentRealPlayerGuildIds)
|
for (uint32 trackedGuildId : g_PersistentRealPlayerGuildIds)
|
||||||
@@ -515,7 +466,7 @@ static void CleanupGuildTracker()
|
|||||||
guildsToRemove.push_back(trackedGuildId);
|
guildsToRemove.push_back(trackedGuildId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove guilds that no longer have real players online
|
// Remove guilds that no longer have real players online
|
||||||
uint32 removedCount = 0;
|
uint32 removedCount = 0;
|
||||||
for (uint32 guildId : guildsToRemove)
|
for (uint32 guildId : guildsToRemove)
|
||||||
@@ -525,21 +476,21 @@ static void CleanupGuildTracker()
|
|||||||
"UPDATE bot_level_brackets_guild_tracker SET has_real_players = 0 WHERE guild_id = {}",
|
"UPDATE bot_level_brackets_guild_tracker SET has_real_players = 0 WHERE guild_id = {}",
|
||||||
guildId
|
guildId
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove from in-memory caches
|
// Remove from in-memory caches
|
||||||
g_PersistentRealPlayerGuildIds.erase(guildId);
|
g_PersistentRealPlayerGuildIds.erase(guildId);
|
||||||
g_RealPlayerGuildIds.erase(guildId);
|
g_RealPlayerGuildIds.erase(guildId);
|
||||||
removedCount++;
|
removedCount++;
|
||||||
|
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Removed guild {} from tracker - no real players online.", guildId);
|
LOG_INFO("server.loading", "[BotLevelBrackets] Removed guild {} from tracker - no real players online.", guildId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_BotDistFullDebugMode || g_BotDistLiteDebugMode)
|
if (g_BotDistFullDebugMode || g_BotDistLiteDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Guild tracker cleanup complete. {} guilds removed, {} guilds remain.",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Guild tracker cleanup complete. {} guilds removed, {} guilds remain.",
|
||||||
removedCount, g_PersistentRealPlayerGuildIds.size());
|
removedCount, g_PersistentRealPlayerGuildIds.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -654,7 +605,7 @@ static void AdjustBotToRange(Player* bot, int targetRangeIndex, const LevelRange
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetRangeIndex < 0 || targetRangeIndex >= g_NumRanges)
|
if (targetRangeIndex < 0 || targetRangeIndex >= g_NumRanges)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -688,16 +639,40 @@ static void AdjustBotToRange(Player* bot, int targetRangeIndex, const LevelRange
|
|||||||
{
|
{
|
||||||
lowerBound = 55;
|
lowerBound = 55;
|
||||||
}
|
}
|
||||||
|
if (lowerBound > upperBound)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
newLevel = urand(lowerBound, upperBound);
|
newLevel = urand(lowerBound, upperBound);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newLevel = GetRandomLevelInRange(factionRanges[targetRangeIndex]);
|
const LevelRangeConfig& range = factionRanges[targetRangeIndex];
|
||||||
|
if (range.lower > range.upper)
|
||||||
|
{
|
||||||
|
if (g_BotDistFullDebugMode)
|
||||||
|
{
|
||||||
|
std::string playerFaction = IsAlliancePlayerBot(bot) ? "Alliance" : "Horde";
|
||||||
|
LOG_INFO("server.loading",
|
||||||
|
"[BotLevelBrackets] AdjustBotToRange: Invalid range {}-{} for {} bot '{}'.",
|
||||||
|
range.lower, range.upper, playerFaction, bot->GetName());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
newLevel = GetRandomLevelInRange(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerbotFactory newFactory(bot, newLevel);
|
PlayerbotFactory newFactory(bot, newLevel);
|
||||||
newFactory.Randomize(false);
|
newFactory.Randomize(false);
|
||||||
|
|
||||||
|
// Force reset talents if equipment persistence is enabled and bot rolled to max level
|
||||||
|
// This is to fix an issue with Playerbots and how Randomization works with Equipment Persistence
|
||||||
|
if (newLevel == g_RandomBotMaxLevel && sPlayerbotAIConfig->equipmentPersistence)
|
||||||
|
{
|
||||||
|
PlayerbotFactory tempFactory(bot, newLevel);
|
||||||
|
tempFactory.InitTalentsTree(false, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
PlayerbotAI* botAI = sPlayerbotsMgr->GetPlayerbotAI(bot);
|
PlayerbotAI* botAI = sPlayerbotsMgr->GetPlayerbotAI(bot);
|
||||||
@@ -773,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.
|
* @brief Clamps and balances the level brackets for Alliance and Horde bot distributions.
|
||||||
*
|
*
|
||||||
@@ -943,7 +942,7 @@ static bool IsBotSafeForLevelReset(Player* bot)
|
|||||||
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
|
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
|
||||||
{
|
{
|
||||||
Player* member = ref->GetSource();
|
Player* member = ref->GetSource();
|
||||||
if (member && !IsPlayerBot(member))
|
if (member && member->IsInWorld() && !IsPlayerBot(member))
|
||||||
{
|
{
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
@@ -1020,7 +1019,7 @@ static void ProcessPendingLevelResets()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
Player* bot = ObjectAccessor::FindPlayer(it->botGuid);
|
Player* bot = ObjectAccessor::FindPlayer(it->botGuid);
|
||||||
|
|
||||||
if (!bot)
|
if (!bot)
|
||||||
{
|
{
|
||||||
it = g_PendingLevelResets.erase(it);
|
it = g_PendingLevelResets.erase(it);
|
||||||
@@ -1052,7 +1051,31 @@ static void ProcessPendingLevelResets()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_IgnoreArenaTeamBots && BotInArenaTeam(bot)) { it = g_PendingLevelResets.erase(it); continue; }
|
if (g_IgnoreArenaTeamBots && BotInArenaTeam(bot))
|
||||||
|
{
|
||||||
|
it = g_PendingLevelResets.erase(it);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if bot is now in a group with real players
|
||||||
|
if (Group* group = bot->GetGroup())
|
||||||
|
{
|
||||||
|
bool hasRealPlayer = false;
|
||||||
|
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
|
||||||
|
{
|
||||||
|
Player* member = ref->GetSource();
|
||||||
|
if (member && member->IsInWorld() && !IsPlayerBot(member))
|
||||||
|
{
|
||||||
|
hasRealPlayer = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasRealPlayer)
|
||||||
|
{
|
||||||
|
it = g_PendingLevelResets.erase(it);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (bot && bot->IsInWorld() && IsBotSafeForLevelReset(bot))
|
if (bot && bot->IsInWorld() && IsBotSafeForLevelReset(bot))
|
||||||
{
|
{
|
||||||
@@ -1089,6 +1112,37 @@ static int GetOrFlagPlayerBracket(Player* player)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsPlayerBot(player) && g_IgnoreGuildBotsWithRealPlayers && BotInGuildWithRealPlayer(player))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsPlayerBot(player) && g_IgnoreArenaTeamBots && BotInArenaTeam(player))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if bot is in a group with real players - if so, exclude from bracket processing
|
||||||
|
if (IsPlayerBot(player))
|
||||||
|
{
|
||||||
|
if (Group* group = player->GetGroup())
|
||||||
|
{
|
||||||
|
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
|
||||||
|
{
|
||||||
|
Player* member = ref->GetSource();
|
||||||
|
if (member && member->IsInWorld() && !IsPlayerBot(member))
|
||||||
|
{
|
||||||
|
if (g_BotDistFullDebugMode)
|
||||||
|
{
|
||||||
|
LOG_INFO("server.loading", "[BotLevelBrackets] GetOrFlagPlayerBracket: Bot {} (Level {}) is in group with real player {} - excluding from bracket processing.",
|
||||||
|
player->GetName(), player->GetLevel(), member->GetName());
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int rangeIndex = GetLevelRangeIndex(player->GetLevel(), player->GetTeamId());
|
int rangeIndex = GetLevelRangeIndex(player->GetLevel(), player->GetTeamId());
|
||||||
if (rangeIndex >= 0)
|
if (rangeIndex >= 0)
|
||||||
{
|
{
|
||||||
@@ -1117,6 +1171,13 @@ static int GetOrFlagPlayerBracket(Player* player)
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip brackets that Death Knights cannot be assigned to (upper bound < 55)
|
||||||
|
if (player->getClass() == CLASS_DEATH_KNIGHT && factionRanges[i].upper < 55)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int diff = 0;
|
int diff = 0;
|
||||||
if (player->GetLevel() < factionRanges[i].lower)
|
if (player->GetLevel() < factionRanges[i].lower)
|
||||||
{
|
{
|
||||||
@@ -1253,7 +1314,7 @@ public:
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_timer += diff;
|
m_timer += diff;
|
||||||
m_flaggedTimer += diff;
|
m_flaggedTimer += diff;
|
||||||
m_guildTrackerTimer += diff;
|
m_guildTrackerTimer += diff;
|
||||||
@@ -1305,7 +1366,6 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
if (IsPlayerBot(player))
|
if (IsPlayerBot(player))
|
||||||
continue; // Only count real players.
|
continue; // Only count real players.
|
||||||
if (g_IgnoreArenaTeamBots && BotInArenaTeam(player)) continue;
|
|
||||||
int rangeIndex = GetOrFlagPlayerBracket(player);
|
int rangeIndex = GetOrFlagPlayerBracket(player);
|
||||||
if (rangeIndex < 0)
|
if (rangeIndex < 0)
|
||||||
continue;
|
continue;
|
||||||
@@ -1388,6 +1448,9 @@ public:
|
|||||||
applyWeights(g_AllianceLevelRanges, allianceWeights);
|
applyWeights(g_AllianceLevelRanges, allianceWeights);
|
||||||
applyWeights(g_HordeLevelRanges, hordeWeights);
|
applyWeights(g_HordeLevelRanges, hordeWeights);
|
||||||
|
|
||||||
|
// Ensure brackets respect global min/max levels and percentages sum to 100
|
||||||
|
ClampAndBalanceBrackets();
|
||||||
|
|
||||||
// Debug output for new bracket percentages after normalization
|
// Debug output for new bracket percentages after normalization
|
||||||
if (g_BotDistFullDebugMode || g_BotDistLiteDebugMode)
|
if (g_BotDistFullDebugMode || g_BotDistLiteDebugMode)
|
||||||
{
|
{
|
||||||
@@ -1402,7 +1465,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 totalAllianceBots = 0;
|
uint32 totalAllianceBots = 0;
|
||||||
std::vector<int> allianceActualCounts(g_NumRanges, 0);
|
std::vector<int> allianceActualCounts(g_NumRanges, 0);
|
||||||
std::vector< std::vector<Player*> > allianceBotsByRange(g_NumRanges);
|
std::vector< std::vector<Player*> > allianceBotsByRange(g_NumRanges);
|
||||||
@@ -1459,6 +1522,10 @@ public:
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (g_IgnoreArenaTeamBots && BotInArenaTeam(player))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (IsAlliancePlayerBot(player))
|
if (IsAlliancePlayerBot(player))
|
||||||
{
|
{
|
||||||
totalAllianceBots++;
|
totalAllianceBots++;
|
||||||
@@ -1469,7 +1536,7 @@ public:
|
|||||||
allianceBotsByRange[rangeIndex].push_back(player);
|
allianceBotsByRange[rangeIndex].push_back(player);
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance bot '{}' with level {} added to range {}.",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance bot '{}' with level {} added to range {}.",
|
||||||
player->GetName(), player->GetLevel(), rangeIndex + 1);
|
player->GetName(), player->GetLevel(), rangeIndex + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1488,7 +1555,7 @@ public:
|
|||||||
hordeBotsByRange[rangeIndex].push_back(player);
|
hordeBotsByRange[rangeIndex].push_back(player);
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Horde bot '{}' with level {} added to range {}.",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Horde bot '{}' with level {} added to range {}.",
|
||||||
player->GetName(), player->GetLevel(), rangeIndex + 1);
|
player->GetName(), player->GetLevel(), rangeIndex + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1520,7 +1587,7 @@ public:
|
|||||||
allianceDesiredCounts[i] = static_cast<int>(round((g_AllianceLevelRanges[i].desiredPercent / 100.0) * totalAllianceBots));
|
allianceDesiredCounts[i] = static_cast<int>(round((g_AllianceLevelRanges[i].desiredPercent / 100.0) * totalAllianceBots));
|
||||||
if (g_BotDistFullDebugMode || g_BotDistLiteDebugMode)
|
if (g_BotDistFullDebugMode || g_BotDistLiteDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance Range {} ({}-{}): Desired = {}, Actual = {}.",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance Range {} ({}-{}): Desired = {}, Actual = {}.",
|
||||||
i + 1, g_AllianceLevelRanges[i].lower, g_AllianceLevelRanges[i].upper,
|
i + 1, g_AllianceLevelRanges[i].lower, g_AllianceLevelRanges[i].upper,
|
||||||
allianceDesiredCounts[i], allianceActualCounts[i]);
|
allianceDesiredCounts[i], allianceActualCounts[i]);
|
||||||
}
|
}
|
||||||
@@ -1579,7 +1646,7 @@ public:
|
|||||||
g_PendingLevelResets.push_back({bot->GetGUID(), targetRange, g_AllianceLevelRanges.data()});
|
g_PendingLevelResets.push_back({bot->GetGUID(), targetRange, g_AllianceLevelRanges.data()});
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance bot '{}' flagged for pending level reset to range {}-{}.",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance bot '{}' flagged for pending level reset to range {}-{}.",
|
||||||
bot->GetName(), g_AllianceLevelRanges[targetRange].lower, g_AllianceLevelRanges[targetRange].upper);
|
bot->GetName(), g_AllianceLevelRanges[targetRange].lower, g_AllianceLevelRanges[targetRange].upper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1619,7 +1686,7 @@ public:
|
|||||||
g_PendingLevelResets.push_back({bot->GetGUID(), targetRange, g_AllianceLevelRanges.data()});
|
g_PendingLevelResets.push_back({bot->GetGUID(), targetRange, g_AllianceLevelRanges.data()});
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance flagged bot '{}' flagged for pending level reset to range {}-{}.",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance flagged bot '{}' flagged for pending level reset to range {}-{}.",
|
||||||
bot->GetName(), g_AllianceLevelRanges[targetRange].lower, g_AllianceLevelRanges[targetRange].upper);
|
bot->GetName(), g_AllianceLevelRanges[targetRange].lower, g_AllianceLevelRanges[targetRange].upper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1700,7 +1767,7 @@ public:
|
|||||||
g_PendingLevelResets.push_back({bot->GetGUID(), targetRange, g_HordeLevelRanges.data()});
|
g_PendingLevelResets.push_back({bot->GetGUID(), targetRange, g_HordeLevelRanges.data()});
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Horde bot '{}' flagged for pending level reset to range {}-{}.",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Horde bot '{}' flagged for pending level reset to range {}-{}.",
|
||||||
bot->GetName(), g_HordeLevelRanges[targetRange].lower, g_HordeLevelRanges[targetRange].upper);
|
bot->GetName(), g_HordeLevelRanges[targetRange].lower, g_HordeLevelRanges[targetRange].upper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1739,7 +1806,7 @@ public:
|
|||||||
g_PendingLevelResets.push_back({bot->GetGUID(), targetRange, g_HordeLevelRanges.data()});
|
g_PendingLevelResets.push_back({bot->GetGUID(), targetRange, g_HordeLevelRanges.data()});
|
||||||
if (g_BotDistFullDebugMode)
|
if (g_BotDistFullDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Horde flagged bot '{}' flagged for pending level reset to range {}-{}.",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Horde flagged bot '{}' flagged for pending level reset to range {}-{}.",
|
||||||
bot->GetName(), g_HordeLevelRanges[targetRange].lower, g_HordeLevelRanges[targetRange].upper);
|
bot->GetName(), g_HordeLevelRanges[targetRange].lower, g_HordeLevelRanges[targetRange].upper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1762,7 +1829,7 @@ public:
|
|||||||
for (int i = 0; i < g_NumRanges; ++i)
|
for (int i = 0; i < g_NumRanges; ++i)
|
||||||
{
|
{
|
||||||
allianceDesiredCounts[i] = static_cast<int>(round((g_AllianceLevelRanges[i].desiredPercent / 100.0) * totalAllianceBots));
|
allianceDesiredCounts[i] = static_cast<int>(round((g_AllianceLevelRanges[i].desiredPercent / 100.0) * totalAllianceBots));
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance Range {} ({}-{}): Desired = {}, Actual = {}.",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance Range {} ({}-{}): Desired = {}, Actual = {}.",
|
||||||
i + 1, g_AllianceLevelRanges[i].lower, g_AllianceLevelRanges[i].upper,
|
i + 1, g_AllianceLevelRanges[i].lower, g_AllianceLevelRanges[i].upper,
|
||||||
allianceDesiredCounts[i], allianceActualCounts[i]);
|
allianceDesiredCounts[i], allianceActualCounts[i]);
|
||||||
}
|
}
|
||||||
@@ -1794,7 +1861,7 @@ public:
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CleanupGuildTracker();
|
CleanupGuildTracker();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1826,18 +1893,47 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class BotLevelBracketsCommandScript
|
||||||
|
* @brief Handles chat commands for the Player Bot Level Brackets module.
|
||||||
|
*
|
||||||
|
* This script provides administrative commands to manage the bot level brackets configuration.
|
||||||
|
*/
|
||||||
|
class BotLevelBracketsCommandScript : public CommandScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BotLevelBracketsCommandScript() : CommandScript("BotLevelBracketsCommandScript") {}
|
||||||
|
|
||||||
|
ChatCommandTable GetCommands() const override
|
||||||
|
{
|
||||||
|
static ChatCommandTable commandTable =
|
||||||
|
{
|
||||||
|
{ "reload", HandleReloadConfig, SEC_ADMINISTRATOR, Console::No }
|
||||||
|
};
|
||||||
|
return commandTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleReloadConfig(ChatHandler* handler)
|
||||||
|
{
|
||||||
|
LoadBotLevelBracketsConfig();
|
||||||
|
handler->SendSysMessage("Bot level brackets config reloaded.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// ENTRY POINT: Register the Bot Level Distribution Module
|
// ENTRY POINT: Register the Bot Level Distribution Module
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief Registers the world and player scripts for the Player Bot Level Brackets module.
|
* @brief Registers the world, player, and command scripts for the Player Bot Level Brackets module.
|
||||||
*
|
*
|
||||||
* This function instantiates and adds the BotLevelBracketsWorldScript and BotLevelBracketsPlayerScript
|
* This function instantiates and adds the BotLevelBracketsWorldScript, BotLevelBracketsPlayerScript,
|
||||||
* to the script system, enabling custom logic for player bot level brackets within the game world.
|
* and BotLevelBracketsCommandScript to the script system, enabling custom logic and commands
|
||||||
|
* for player bot level brackets within the game world.
|
||||||
*/
|
*/
|
||||||
void Addmod_player_bot_level_bracketsScripts()
|
void Addmod_player_bot_level_bracketsScripts()
|
||||||
{
|
{
|
||||||
new BotLevelBracketsWorldScript();
|
new BotLevelBracketsWorldScript();
|
||||||
new BotLevelBracketsPlayerScript();
|
new BotLevelBracketsPlayerScript();
|
||||||
|
new BotLevelBracketsCommandScript();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user