From 89556dafa1a3daa0f4954be14f332a8cb12afd3e Mon Sep 17 00:00:00 2001 From: Revision Date: Tue, 27 May 2025 18:07:13 +0200 Subject: [PATCH] Fix crash when using random levels with a lowered max player level (#1344) --- src/PlayerbotAIConfig.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index aa944177..65c86eb3 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -310,6 +310,8 @@ bool PlayerbotAIConfig::Initialize() summonAtInnkeepersEnabled = sConfigMgr->GetOption("AiPlayerbot.SummonAtInnkeepersEnabled", true); randomBotMinLevel = sConfigMgr->GetOption("AiPlayerbot.RandomBotMinLevel", 1); randomBotMaxLevel = sConfigMgr->GetOption("AiPlayerbot.RandomBotMaxLevel", 80); + if (randomBotMaxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) + randomBotMaxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); randomBotLoginAtStartup = sConfigMgr->GetOption("AiPlayerbot.RandomBotLoginAtStartup", true); randomBotTeleLowerLevel = sConfigMgr->GetOption("AiPlayerbot.RandomBotTeleLowerLevel", 1); randomBotTeleHigherLevel = sConfigMgr->GetOption("AiPlayerbot.RandomBotTeleHigherLevel", 3);