diff --git a/README.md b/README.md index ddf9e28..2de5816 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ BotLevelBrackets.CheckFrequency | Frequency (in seconds) at which t 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.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 = minimal effect; 10.0 = heavy effect; higher values = more bots go where players are, but the effect is scaled. | 10.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.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) diff --git a/conf/mod_player_bot_level_brackets.conf.dist b/conf/mod_player_bot_level_brackets.conf.dist index d8ca1ea..35277a5 100644 --- a/conf/mod_player_bot_level_brackets.conf.dist +++ b/conf/mod_player_bot_level_brackets.conf.dist @@ -107,8 +107,8 @@ BotLevelBrackets.Dynamic.UseDynamicDistribution = 0 # Formula (per bracket): # bracket_weight = 1.0 + (RealPlayerWeight × (1 / TotalRealPlayers) × log(1 + RealPlayersInBracket)) # All bracket weights are normalized to total 100%. -# Default: 10.0 -BotLevelBrackets.Dynamic.RealPlayerWeight = 10.0 +# Default: 1.0 +BotLevelBrackets.Dynamic.RealPlayerWeight = 1.0 # # BotLevelBrackets.Dynamic.SyncFactions diff --git a/src/mod-player-bot-level-brackets.cpp b/src/mod-player-bot-level-brackets.cpp index 48ca132..b1ac876 100644 --- a/src/mod-player-bot-level-brackets.cpp +++ b/src/mod-player-bot-level-brackets.cpp @@ -1806,18 +1806,51 @@ 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") {} + + std::vector GetCommands() const override + { + static std::vector commandTable = + { + { "reload", SEC_ADMINISTRATOR, false, &HandleReloadConfig, "" } + }; + static std::vector commandTableMain = + { + { "botlevelbrackets", SEC_ADMINISTRATOR, true, nullptr, "", commandTable } + }; + return commandTableMain; + } + + static bool HandleReloadConfig(ChatHandler* handler, const char* args) + { + LoadBotLevelBracketsConfig(); + handler->SendSysMessage("Bot level brackets config reloaded."); + return true; + } +}; // ----------------------------------------------------------------------------- // 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 - * to the script system, enabling custom logic for player bot level brackets within the game world. + * This function instantiates and adds the BotLevelBracketsWorldScript, BotLevelBracketsPlayerScript, + * 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() { new BotLevelBracketsWorldScript(); new BotLevelBracketsPlayerScript(); + new BotLevelBracketsCommandScript(); }