Adding Safety checks, refactoring to flag when not enough safe bots have been found for later processing, split brackets into faction based.

This commit is contained in:
Dustin Hendrickson
2025-02-18 14:49:22 -08:00
parent 2790e08d5e
commit 1b3dadc57c
3 changed files with 608 additions and 197 deletions

106
README.md
View File

@@ -1,44 +1,45 @@
# AzerothCore Module: Bot Level Brackets
==========================================
--------
Overview
--------
The Bot Level Brackets module for AzerothCore ensures an even spread of player bots across configurable level ranges (brackets). It periodically monitors bot levels and automatically adjusts them by transferring bots from overpopulated brackets to those with a deficit. During adjustments, bot levels are reset, equipped items are destroyed, pets are removed, and auto-maintenance actions are executed.
The Bot Level Brackets module for AzerothCore ensures an even spread of player bots across configurable level ranges (brackets). It periodically monitors bot levels and automatically adjusts them by transferring bots from overpopulated brackets to those with a deficit. During adjustments, bot levels are reset, equipped items are destroyed, trade skills are removed, quests are cleared, active auras are removed, pets are dismissed, and auto-maintenance actions are executed. Bots that are not immediately safe for level reset (for example, those in combat or engaged in other activities) are flagged for pending adjustment and processed later when they become safe. Additionally, Death Knight bots are safeguarded to never be assigned a level below 55.
Features
--------
**Configurable Level Brackets:**
Define nine distinct level brackets with customizable lower and upper bounds:
- 1-9
- 10-19
- 20-29
- 30-39
- 40-49
- 50-59
- 60-69
- 70-79
- 80
- **Configurable Level Brackets:**
Define nine distinct level brackets with configurable lower and upper bounds:
- 1-9
- 10-19
- 20-29
- 30-39
- 40-49
- 50-59
- 60-69
- 70-79
- 80
**Desired Percentage Distribution:**
Set target percentages for the number of bots within each level bracket.
- **Faction-Specific Configuration:**
Separate configurations for Alliance and Horde bots allow individual control over desired bot percentages within each bracket.
**Dynamic Bot Adjustment:**
Automatically reassign bots from brackets with a surplus to those with a deficit.
- **Desired Percentage Distribution:**
Target percentages can be set for the number of bots within each level bracket. The sum of percentages for each faction must equal 100.
**Death Knight Level Safeguard:**
Ensures that bots of the Death Knight class are never assigned a level below 55, guaranteeing they only appear in higher brackets.
- **Dynamic Bot Adjustment:**
Bots in overpopulated brackets are automatically adjusted to a random level within a bracket with a deficit. Adjustments include resetting XP, removing equipped items, trade skills, learned spells, quests, and active auras, and dismissing pets.
**Auto Maintenance Execution:**
Executes the AutoMaintenanceOnLevelupAction after adjusting a bots level to ensure proper reinitialization.
- **Death Knight Level Safeguard:**
Bots of the Death Knight class are enforced a minimum level of 55, ensuring they are only assigned to higher brackets.
**Equipment and Pet Reset:**
Destroys all equipped items and removes any pet during a level adjustment.
- **Automated Maintenance Execution:**
After a level change, the module executes the AutoMaintenanceOnLevelupAction to properly reinitialize the bots state.
**Support for Random Bots:**
Applies exclusively to bots managed by RandomPlayerbotMgr.
- **Support for Random Bots:**
The module applies exclusively to bots managed by RandomPlayerbotMgr.
**Debug Mode:**
Provides detailed logging to aid in monitoring and troubleshooting module operations.
- **Debug Mode:**
An optional debug mode provides detailed logging for monitoring bot adjustments and troubleshooting module operations.
Installation
------------
@@ -68,23 +69,44 @@ Installation
Configuration Options
---------------------
Customize the modules behavior by editing the `mod_player_bot_level_brackets.conf` file:
Customize the modules behavior by editing the `mod_player_bot_level_brackets.conf` file. The configuration options are separated for Alliance and Horde bots:
Setting | Description | Default | Valid Values
-------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------- | --------------------
BotLevelBrackets.DebugMode | Enables detailed debug logging for module operations. | 0 | 0 (off) / 1 (on)
BotLevelBrackets.CheckFrequency | Frequency (in seconds) for performing the bot bracket distribution check. | 300 | Positive Integer
BotLevelBrackets.Range1Pct | Desired percentage of bots in level bracket 1-9. | 11 | 0-100
BotLevelBrackets.Range2Pct | Desired percentage of bots in level bracket 10-19. | 11 | 0-100
BotLevelBrackets.Range3Pct | Desired percentage of bots in level bracket 20-29. | 11 | 0-100
BotLevelBrackets.Range4Pct | Desired percentage of bots in level bracket 30-39. | 11 | 0-100
BotLevelBrackets.Range5Pct | Desired percentage of bots in level bracket 40-49. | 11 | 0-100
BotLevelBrackets.Range6Pct | Desired percentage of bots in level bracket 50-59. | 11 | 0-100
BotLevelBrackets.Range7Pct | Desired percentage of bots in level bracket 60-69. | 11 | 0-100
BotLevelBrackets.Range8Pct | Desired percentage of bots in level bracket 70-79. | 11 | 0-100
BotLevelBrackets.Range9Pct | Desired percentage of bots in level bracket 80. | 12 | 0-100
### Global Settings
*Note: The sum of all bracket percentages must equal 100.*
Setting | Description | Default | Valid Values
--------------------------------|----------------------------------------------------------------------------------------------|---------|--------------------
BotLevelBrackets.DebugMode | Enables detailed debug logging for module operations. | 0 | 0 (off) / 1 (on)
BotLevelBrackets.CheckFrequency | Frequency (in seconds) for performing the bot bracket distribution check. | 300 | Positive Integer
### Alliance Level Brackets Configuration
*The percentages below must sum to 100.*
Setting | Description | Default | Valid Values
-------------------------------------------|--------------------------------------------------------------|---------|--------------------
BotLevelBrackets.Alliance.Range1Pct | Desired percentage of Alliance bots within level range 1-9. | 11 | 0-100
BotLevelBrackets.Alliance.Range2Pct | Desired percentage of Alliance bots within level range 10-19. | 11 | 0-100
BotLevelBrackets.Alliance.Range3Pct | Desired percentage of Alliance bots within level range 20-29. | 11 | 0-100
BotLevelBrackets.Alliance.Range4Pct | Desired percentage of Alliance bots within level range 30-39. | 11 | 0-100
BotLevelBrackets.Alliance.Range5Pct | Desired percentage of Alliance bots within level range 40-49. | 11 | 0-100
BotLevelBrackets.Alliance.Range6Pct | Desired percentage of Alliance bots within level range 50-59. | 11 | 0-100
BotLevelBrackets.Alliance.Range7Pct | Desired percentage of Alliance bots within level range 60-69. | 11 | 0-100
BotLevelBrackets.Alliance.Range8Pct | Desired percentage of Alliance bots within level range 70-79. | 11 | 0-100
BotLevelBrackets.Alliance.Range9Pct | Desired percentage of Alliance bots at level 80. | 12 | 0-100
### Horde Level Brackets Configuration
*The percentages below must sum to 100.*
Setting | Description | Default | Valid Values
---------------------------------------|-----------------------------------------------------------|---------|--------------------
BotLevelBrackets.Horde.Range1Pct | Desired percentage of Horde bots within level range 1-9. | 11 | 0-100
BotLevelBrackets.Horde.Range2Pct | Desired percentage of Horde bots within level range 10-19.| 11 | 0-100
BotLevelBrackets.Horde.Range3Pct | Desired percentage of Horde bots within level range 20-29.| 11 | 0-100
BotLevelBrackets.Horde.Range4Pct | Desired percentage of Horde bots within level range 30-39.| 11 | 0-100
BotLevelBrackets.Horde.Range5Pct | Desired percentage of Horde bots within level range 40-49.| 11 | 0-100
BotLevelBrackets.Horde.Range6Pct | Desired percentage of Horde bots within level range 50-59.| 11 | 0-100
BotLevelBrackets.Horde.Range7Pct | Desired percentage of Horde bots within level range 60-69.| 11 | 0-100
BotLevelBrackets.Horde.Range8Pct | Desired percentage of Horde bots within level range 70-79.| 11 | 0-100
BotLevelBrackets.Horde.Range9Pct | Desired percentage of Horde bots at level 80. | 12 | 0-100
Debugging
---------