Revert "Feat: Filter bot logins by level range" (#1705)

This commit is contained in:
bash
2025-10-03 22:58:30 +02:00
committed by GitHub
parent 2a340ce68f
commit 377ac199a7
6 changed files with 40 additions and 257 deletions

View File

@@ -87,8 +87,7 @@ public:
PLAYERHOOK_ON_BEFORE_CRITERIA_PROGRESS,
PLAYERHOOK_ON_BEFORE_ACHI_COMPLETE,
PLAYERHOOK_CAN_PLAYER_USE_PRIVATE_CHAT,
PLAYERHOOK_ON_GIVE_EXP,
PLAYERHOOK_ON_LEVEL_CHANGED
PLAYERHOOK_ON_GIVE_EXP
}) {}
void OnPlayerLogin(Player* player) override
@@ -122,33 +121,6 @@ public:
}
}
void OnPlayerLevelChanged(Player* player, uint8 oldLevel) override
{
// Check if feature is enabled and required objects are valid
if (!sPlayerbotAIConfig || !sPlayerbotAIConfig->randomBotLogoutOutsideLoginRange || !sRandomPlayerbotMgr)
return;
// Only apply to bots from rndBotTypeAccounts (type 1)
uint32 accountId = player->GetSession()->GetAccountId();
if (!sRandomPlayerbotMgr->IsAccountType(accountId, 1))
return;
uint32 newLevel = player->GetLevel();
// Check if the new level is outside the allowed login range
if (newLevel < sPlayerbotAIConfig->randomBotMinLoginLevel ||
newLevel > sPlayerbotAIConfig->randomBotMaxLoginLevel)
{
LOG_INFO("playerbots", "Bot {} changed levels from {} to {}, outside login range ({}-{}). Marking for logout",
player->GetName(), oldLevel, newLevel,
sPlayerbotAIConfig->randomBotMinLoginLevel, sPlayerbotAIConfig->randomBotMaxLoginLevel);
// Mark the bot for removal in the next update cycle
sRandomPlayerbotMgr->MarkBotForLogout(player->GetGUID().GetCounter());
sRandomPlayerbotMgr->ForceRecount();
}
}
void OnPlayerAfterUpdate(Player* player, uint32 diff) override
{
if (PlayerbotAI* botAI = GET_PLAYERBOT_AI(player))