From 7395acb660760877e841a3078008779db19490c1 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Thu, 27 Jun 2024 23:39:54 +0800 Subject: [PATCH] [Configuration] Random bots fixed level --- src/PlayerbotMgr.cpp | 6 ++++++ src/strategy/actions/XpGainAction.cpp | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index 97659583..ea239ca5 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -448,6 +448,12 @@ void PlayerbotHolder::OnBotLogin(Player* const bot) uint32 accountId = bot->GetSession()->GetAccountId(); bool isRandomAccount = sPlayerbotAIConfig->IsInRandomAccountList(accountId); + if (isRandomAccount && sPlayerbotAIConfig->randomBotFixedLevel) { + bot->SetPlayerFlag(PLAYER_FLAGS_NO_XP_GAIN); + } else { + bot->RemovePlayerFlag(PLAYER_FLAGS_NO_XP_GAIN); + } + bot->SaveToDB(false, false); if (master && isRandomAccount && master->GetLevel() < bot->GetLevel()) { // PlayerbotFactory factory(bot, master->getLevel()); diff --git a/src/strategy/actions/XpGainAction.cpp b/src/strategy/actions/XpGainAction.cpp index c446780f..31322360 100644 --- a/src/strategy/actions/XpGainAction.cpp +++ b/src/strategy/actions/XpGainAction.cpp @@ -11,11 +11,6 @@ bool XpGainAction::Execute(Event event) { context->GetValue("death count")->Set(0); - if (sRandomPlayerbotMgr->IsRandomBot(bot) && sPlayerbotAIConfig->randomBotFixedLevel) { - bot->SetUInt32Value(PLAYER_XP, 0); - return true; - } - if (!sRandomPlayerbotMgr->IsRandomBot(bot) || sPlayerbotAIConfig->playerbotsXPrate == 1) return true;