mirror of
https://github.com/kadeshar/mod-player-bot-level-brackets.git
synced 2026-01-29 16:43:48 +00:00
Merge pull request #14 from DustinHendrickson/Dustin/SafetyChanges
Dustin/safety changes
This commit is contained in:
10
README.md
10
README.md
@@ -77,13 +77,15 @@ Setting | Description
|
|||||||
--------------------------------|----------------------------------------------------------------------------------------------|---------|--------------------
|
--------------------------------|----------------------------------------------------------------------------------------------|---------|--------------------
|
||||||
BotLevelBrackets.DebugMode | Enables detailed debug logging for module operations. | 0 | 0 (off) / 1 (on)
|
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.CheckFrequency | Frequency (in seconds) for performing the bot bracket distribution check. | 300 | Positive Integer
|
||||||
|
BotLevelBrackets.CheckFlaggedFrequency | Frequency (in seconds) at which the bot level reset is performed for flagged bots that failed safety checks initially. | 15 | Positive Integer
|
||||||
|
|
||||||
|
|
||||||
### Alliance Level Brackets Configuration
|
### Alliance Level Brackets Configuration
|
||||||
*The percentages below must sum to 100.*
|
*The percentages below must sum to 100.*
|
||||||
|
|
||||||
Setting | Description | Default | Valid Values
|
Setting | Description | Default | Valid Values
|
||||||
-------------------------------------------|--------------------------------------------------------------|---------|--------------------
|
-------------------------------------------|--------------------------------------------------------------|---------|--------------------
|
||||||
BotLevelBrackets.Alliance.Range1Pct | Desired percentage of Alliance bots within level range 1-9. | 11 | 0-100
|
BotLevelBrackets.Alliance.Range1Pct | Desired percentage of Alliance bots within level range 1-9. | 12 | 0-100
|
||||||
BotLevelBrackets.Alliance.Range2Pct | Desired percentage of Alliance bots within level range 10-19. | 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.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.Range4Pct | Desired percentage of Alliance bots within level range 30-39. | 11 | 0-100
|
||||||
@@ -91,14 +93,14 @@ BotLevelBrackets.Alliance.Range5Pct | Desired percentage of Alliance bot
|
|||||||
BotLevelBrackets.Alliance.Range6Pct | Desired percentage of Alliance bots within level range 50-59. | 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.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.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
|
BotLevelBrackets.Alliance.Range9Pct | Desired percentage of Alliance bots at level 80. | 11 | 0-100
|
||||||
|
|
||||||
### Horde Level Brackets Configuration
|
### Horde Level Brackets Configuration
|
||||||
*The percentages below must sum to 100.*
|
*The percentages below must sum to 100.*
|
||||||
|
|
||||||
Setting | Description | Default | Valid Values
|
Setting | Description | Default | Valid Values
|
||||||
---------------------------------------|-----------------------------------------------------------|---------|--------------------
|
---------------------------------------|-----------------------------------------------------------|---------|--------------------
|
||||||
BotLevelBrackets.Horde.Range1Pct | Desired percentage of Horde bots within level range 1-9. | 11 | 0-100
|
BotLevelBrackets.Horde.Range1Pct | Desired percentage of Horde bots within level range 1-9. | 12 | 0-100
|
||||||
BotLevelBrackets.Horde.Range2Pct | Desired percentage of Horde bots within level range 10-19.| 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.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.Range4Pct | Desired percentage of Horde bots within level range 30-39.| 11 | 0-100
|
||||||
@@ -106,7 +108,7 @@ BotLevelBrackets.Horde.Range5Pct | Desired percentage of Horde bots with
|
|||||||
BotLevelBrackets.Horde.Range6Pct | Desired percentage of Horde bots within level range 50-59.| 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.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.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
|
BotLevelBrackets.Horde.Range9Pct | Desired percentage of Horde bots at level 80. | 11 | 0-100
|
||||||
|
|
||||||
Debugging
|
Debugging
|
||||||
---------
|
---------
|
||||||
|
|||||||
@@ -15,14 +15,19 @@ BotLevelBrackets.DebugMode = 0
|
|||||||
# Default: 300
|
# Default: 300
|
||||||
BotLevelBrackets.CheckFrequency = 300
|
BotLevelBrackets.CheckFrequency = 300
|
||||||
|
|
||||||
|
# BotLevelBrackets.CheckFlaggedFrequency
|
||||||
|
# Description: The frequency (in seconds) at which the bot level reset is performed for flagged bots that failed safety checks initially.
|
||||||
|
# Default: 15
|
||||||
|
BotLevelBrackets.CheckFlaggedFrequency = 15
|
||||||
|
|
||||||
#
|
#
|
||||||
# Alliance Level Brackets Configuration
|
# Alliance Level Brackets Configuration
|
||||||
# The percentages below must sum to 100.
|
# The percentages below must sum to 100.
|
||||||
#
|
#
|
||||||
# BotLevelBrackets.Alliance.Range1Pct
|
# BotLevelBrackets.Alliance.Range1Pct
|
||||||
# Description: Desired percentage of Alliance bots within level range 1-9.
|
# Description: Desired percentage of Alliance bots within level range 1-9.
|
||||||
# Default: 11
|
# Default: 12
|
||||||
BotLevelBrackets.Alliance.Range1Pct = 11
|
BotLevelBrackets.Alliance.Range1Pct = 12
|
||||||
|
|
||||||
# BotLevelBrackets.Alliance.Range2Pct
|
# BotLevelBrackets.Alliance.Range2Pct
|
||||||
# Description: Desired percentage of Alliance bots within level range 10-19.
|
# Description: Desired percentage of Alliance bots within level range 10-19.
|
||||||
@@ -61,8 +66,8 @@ BotLevelBrackets.Alliance.Range8Pct = 11
|
|||||||
|
|
||||||
# BotLevelBrackets.Alliance.Range9Pct
|
# BotLevelBrackets.Alliance.Range9Pct
|
||||||
# Description: Desired percentage of Alliance bots within level range 80.
|
# Description: Desired percentage of Alliance bots within level range 80.
|
||||||
# Default: 12
|
# Default: 11
|
||||||
BotLevelBrackets.Alliance.Range9Pct = 12
|
BotLevelBrackets.Alliance.Range9Pct = 11
|
||||||
|
|
||||||
#
|
#
|
||||||
# Horde Level Brackets Configuration
|
# Horde Level Brackets Configuration
|
||||||
@@ -70,8 +75,8 @@ BotLevelBrackets.Alliance.Range9Pct = 12
|
|||||||
#
|
#
|
||||||
# BotLevelBrackets.Horde.Range1Pct
|
# BotLevelBrackets.Horde.Range1Pct
|
||||||
# Description: Desired percentage of Horde bots within level range 1-9.
|
# Description: Desired percentage of Horde bots within level range 1-9.
|
||||||
# Default: 11
|
# Default: 12
|
||||||
BotLevelBrackets.Horde.Range1Pct = 11
|
BotLevelBrackets.Horde.Range1Pct = 12
|
||||||
|
|
||||||
# BotLevelBrackets.Horde.Range2Pct
|
# BotLevelBrackets.Horde.Range2Pct
|
||||||
# Description: Desired percentage of Horde bots within level range 10-19.
|
# Description: Desired percentage of Horde bots within level range 10-19.
|
||||||
@@ -110,5 +115,5 @@ BotLevelBrackets.Horde.Range8Pct = 11
|
|||||||
|
|
||||||
# BotLevelBrackets.Horde.Range9Pct
|
# BotLevelBrackets.Horde.Range9Pct
|
||||||
# Description: Desired percentage of Horde bots within level range 80.
|
# Description: Desired percentage of Horde bots within level range 80.
|
||||||
# Default: 12
|
# Default: 11
|
||||||
BotLevelBrackets.Horde.Range9Pct = 12
|
BotLevelBrackets.Horde.Range9Pct = 11
|
||||||
|
|||||||
@@ -13,9 +13,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "PlayerbotFactory.h"
|
#include "PlayerbotFactory.h"
|
||||||
#include <thread>
|
|
||||||
#include <mutex>
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
void RemoveAllEquippedItems(Player* bot);
|
void RemoveAllEquippedItems(Player* bot);
|
||||||
void RemoveAllTradeSkills(Player* bot);
|
void RemoveAllTradeSkills(Player* bot);
|
||||||
@@ -26,9 +23,6 @@ void RemoveAllActiveAuras(Player* bot);
|
|||||||
static bool IsAlliancePlayerBot(Player* bot);
|
static bool IsAlliancePlayerBot(Player* bot);
|
||||||
static bool IsHordePlayerBot(Player* bot);
|
static bool IsHordePlayerBot(Player* bot);
|
||||||
|
|
||||||
static std::mutex g_ResetMutex;
|
|
||||||
static bool g_RunningResetThread = true;
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// LEVEL RANGE CONFIGURATION
|
// LEVEL RANGE CONFIGURATION
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -47,6 +41,7 @@ static LevelRangeConfig g_AllianceLevelRanges[NUM_RANGES];
|
|||||||
static LevelRangeConfig g_HordeLevelRanges[NUM_RANGES];
|
static LevelRangeConfig g_HordeLevelRanges[NUM_RANGES];
|
||||||
|
|
||||||
static uint32 g_BotDistCheckFrequency = 300; // in seconds
|
static uint32 g_BotDistCheckFrequency = 300; // in seconds
|
||||||
|
static uint32 g_BotDistFlaggedCheckFrequency = 15; // in seconds
|
||||||
static bool g_BotDistDebugMode = false;
|
static bool g_BotDistDebugMode = false;
|
||||||
|
|
||||||
// Loads the configuration from the config file.
|
// Loads the configuration from the config file.
|
||||||
@@ -54,9 +49,10 @@ static void LoadBotLevelBracketsConfig()
|
|||||||
{
|
{
|
||||||
g_BotDistDebugMode = sConfigMgr->GetOption<bool>("BotLevelBrackets.DebugMode", false);
|
g_BotDistDebugMode = sConfigMgr->GetOption<bool>("BotLevelBrackets.DebugMode", false);
|
||||||
g_BotDistCheckFrequency = sConfigMgr->GetOption<uint32>("BotLevelBrackets.CheckFrequency", 300);
|
g_BotDistCheckFrequency = sConfigMgr->GetOption<uint32>("BotLevelBrackets.CheckFrequency", 300);
|
||||||
|
g_BotDistFlaggedCheckFrequency = sConfigMgr->GetOption<uint32>("BotLevelBrackets.CheckFlaggedFrequency", 15);
|
||||||
|
|
||||||
// Alliance configuration.
|
// Alliance configuration.
|
||||||
g_AllianceLevelRanges[0] = { 1, 9, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range1Pct", 11)) };
|
g_AllianceLevelRanges[0] = { 1, 9, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range1Pct", 12)) };
|
||||||
g_AllianceLevelRanges[1] = { 10, 19, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range2Pct", 11)) };
|
g_AllianceLevelRanges[1] = { 10, 19, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range2Pct", 11)) };
|
||||||
g_AllianceLevelRanges[2] = { 20, 29, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range3Pct", 11)) };
|
g_AllianceLevelRanges[2] = { 20, 29, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range3Pct", 11)) };
|
||||||
g_AllianceLevelRanges[3] = { 30, 39, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range4Pct", 11)) };
|
g_AllianceLevelRanges[3] = { 30, 39, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range4Pct", 11)) };
|
||||||
@@ -64,10 +60,10 @@ static void LoadBotLevelBracketsConfig()
|
|||||||
g_AllianceLevelRanges[5] = { 50, 59, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range6Pct", 11)) };
|
g_AllianceLevelRanges[5] = { 50, 59, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range6Pct", 11)) };
|
||||||
g_AllianceLevelRanges[6] = { 60, 69, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range7Pct", 11)) };
|
g_AllianceLevelRanges[6] = { 60, 69, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range7Pct", 11)) };
|
||||||
g_AllianceLevelRanges[7] = { 70, 79, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range8Pct", 11)) };
|
g_AllianceLevelRanges[7] = { 70, 79, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range8Pct", 11)) };
|
||||||
g_AllianceLevelRanges[8] = { 80, 80, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range9Pct", 12)) };
|
g_AllianceLevelRanges[8] = { 80, 80, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Alliance.Range9Pct", 11)) };
|
||||||
|
|
||||||
// Horde configuration.
|
// Horde configuration.
|
||||||
g_HordeLevelRanges[0] = { 1, 9, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range1Pct", 11)) };
|
g_HordeLevelRanges[0] = { 1, 9, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range1Pct", 12)) };
|
||||||
g_HordeLevelRanges[1] = { 10, 19, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range2Pct", 11)) };
|
g_HordeLevelRanges[1] = { 10, 19, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range2Pct", 11)) };
|
||||||
g_HordeLevelRanges[2] = { 20, 29, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range3Pct", 11)) };
|
g_HordeLevelRanges[2] = { 20, 29, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range3Pct", 11)) };
|
||||||
g_HordeLevelRanges[3] = { 30, 39, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range4Pct", 11)) };
|
g_HordeLevelRanges[3] = { 30, 39, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range4Pct", 11)) };
|
||||||
@@ -75,7 +71,7 @@ static void LoadBotLevelBracketsConfig()
|
|||||||
g_HordeLevelRanges[5] = { 50, 59, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range6Pct", 11)) };
|
g_HordeLevelRanges[5] = { 50, 59, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range6Pct", 11)) };
|
||||||
g_HordeLevelRanges[6] = { 60, 69, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range7Pct", 11)) };
|
g_HordeLevelRanges[6] = { 60, 69, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range7Pct", 11)) };
|
||||||
g_HordeLevelRanges[7] = { 70, 79, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range8Pct", 11)) };
|
g_HordeLevelRanges[7] = { 70, 79, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range8Pct", 11)) };
|
||||||
g_HordeLevelRanges[8] = { 80, 80, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range9Pct", 12)) };
|
g_HordeLevelRanges[8] = { 80, 80, static_cast<uint8>(sConfigMgr->GetOption<uint32>("BotLevelBrackets.Horde.Range9Pct", 11)) };
|
||||||
|
|
||||||
uint32 totalAlliancePercent = 0;
|
uint32 totalAlliancePercent = 0;
|
||||||
uint32 totalHordePercent = 0;
|
uint32 totalHordePercent = 0;
|
||||||
@@ -321,25 +317,19 @@ struct PendingResetEntry
|
|||||||
};
|
};
|
||||||
static std::vector<PendingResetEntry> g_PendingLevelResets;
|
static std::vector<PendingResetEntry> g_PendingLevelResets;
|
||||||
|
|
||||||
static void ProcessPendingLevelResetsAsync()
|
static void ProcessPendingLevelResets()
|
||||||
{
|
{
|
||||||
while (g_RunningResetThread)
|
for (auto it = g_PendingLevelResets.begin(); it != g_PendingLevelResets.end(); )
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(30)); // Run every 30 seconds
|
Player* bot = it->bot;
|
||||||
|
int targetRange = it->targetRange;
|
||||||
std::lock_guard<std::mutex> lock(g_ResetMutex);
|
if (bot && bot->IsInWorld() && IsBotSafeForLevelReset(bot))
|
||||||
for (auto it = g_PendingLevelResets.begin(); it != g_PendingLevelResets.end(); )
|
|
||||||
{
|
{
|
||||||
Player* bot = it->bot;
|
AdjustBotToRange(bot, targetRange, it->factionRanges);
|
||||||
int targetRange = it->targetRange;
|
it = g_PendingLevelResets.erase(it);
|
||||||
if (bot && bot->IsInWorld() && IsBotSafeForLevelReset(bot))
|
|
||||||
{
|
|
||||||
AdjustBotToRange(bot, targetRange, it->factionRanges);
|
|
||||||
it = g_PendingLevelResets.erase(it);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,14 +339,14 @@ static void ProcessPendingLevelResetsAsync()
|
|||||||
class BotLevelBracketsWorldScript : public WorldScript
|
class BotLevelBracketsWorldScript : public WorldScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BotLevelBracketsWorldScript() : WorldScript("BotLevelBracketsWorldScript"), m_timer(0) { }
|
BotLevelBracketsWorldScript() : WorldScript("BotLevelBracketsWorldScript"), m_timer(0), m_flaggedTimer(0) { }
|
||||||
|
|
||||||
void OnStartup() override
|
void OnStartup() override
|
||||||
{
|
{
|
||||||
LoadBotLevelBracketsConfig();
|
LoadBotLevelBracketsConfig();
|
||||||
if (g_BotDistDebugMode)
|
if (g_BotDistDebugMode)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Module loaded. Check frequency: {} seconds.", g_BotDistCheckFrequency);
|
LOG_INFO("server.loading", "[BotLevelBrackets] Module loaded. Check frequency: {} seconds, Check flagged frequency: {}.", g_BotDistCheckFrequency, g_BotDistFlaggedCheckFrequency);
|
||||||
for (uint8 i = 0; i < NUM_RANGES; ++i)
|
for (uint8 i = 0; i < NUM_RANGES; ++i)
|
||||||
{
|
{
|
||||||
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance Range {}: {}-{}, Desired Percentage: {}%",
|
LOG_INFO("server.loading", "[BotLevelBrackets] Alliance Range {}: {}-{}, Desired Percentage: {}%",
|
||||||
@@ -365,19 +355,21 @@ public:
|
|||||||
i + 1, g_HordeLevelRanges[i].lower, g_HordeLevelRanges[i].upper, g_HordeLevelRanges[i].desiredPercent);
|
i + 1, g_HordeLevelRanges[i].lower, g_HordeLevelRanges[i].upper, g_HordeLevelRanges[i].desiredPercent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start background thread for pending level resets
|
|
||||||
std::thread(ProcessPendingLevelResetsAsync).detach();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnShutdown() override
|
|
||||||
{
|
|
||||||
g_RunningResetThread = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnUpdate(uint32 diff) override
|
void OnUpdate(uint32 diff) override
|
||||||
{
|
{
|
||||||
m_timer += diff;
|
m_timer += diff;
|
||||||
|
m_flaggedTimer += diff;
|
||||||
|
|
||||||
|
// Check if it's time to process pending level resets
|
||||||
|
if (m_flaggedTimer >= g_BotDistFlaggedCheckFrequency * 1000)
|
||||||
|
{
|
||||||
|
ProcessPendingLevelResets();
|
||||||
|
m_flaggedTimer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Continue with distribution adjustments once its timer expires
|
||||||
if (m_timer < g_BotDistCheckFrequency * 1000)
|
if (m_timer < g_BotDistCheckFrequency * 1000)
|
||||||
return;
|
return;
|
||||||
m_timer = 0;
|
m_timer = 0;
|
||||||
@@ -662,7 +654,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 m_timer;
|
uint32 m_timer; // For distribution adjustments
|
||||||
|
uint32 m_flaggedTimer; // For pending reset checks
|
||||||
};
|
};
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user