From 687d996643f6fa816e63e4b171ba4ed30f26e8b5 Mon Sep 17 00:00:00 2001 From: bash <31279994+hermensbas@users.noreply.github.com> Date: Thu, 7 Aug 2025 01:18:54 +0200 Subject: [PATCH] Safer way to check the leader is real player. --- src/Playerbots.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/Playerbots.cpp b/src/Playerbots.cpp index 6e122fa9..d8668689 100644 --- a/src/Playerbots.cpp +++ b/src/Playerbots.cpp @@ -213,29 +213,25 @@ public: if (sPlayerbotAIConfig->randomBotXPRate == 1.0 || !player) return; - // when player is no bot. - if (!player->GetSession()->IsBot()) + // no XP multiplier, when player is no bot. + if (!player->GetSession()->IsBot() || !sRandomPlayerbotMgr->IsRandomBot(player)) return; - // when player is no bot, double check. - if (!sRandomPlayerbotMgr->IsRandomBot(player)) - return; - - // when bot has group where leader is a real player. + // no XP multiplier, when bot has group where leader is a real player. if (Group* group = player->GetGroup()) { Player* leader = group->GetLeader(); if (leader != player) { - if (!leader->GetSession()->IsBot()) - return; - - if (!sRandomPlayerbotMgr->IsRandomBot(leader)) - return; + if (PlayerbotAI* leaderBotAI = GET_PLAYERBOT_AI(leader)) + { + if (leaderBotAI->HasRealPlayerMaster()) + return; + } } } - // otherwise apply bot XP scaling. + // otherwise apply bot XP multiplier. amount = static_cast(std::round(static_cast(amount) * sPlayerbotAIConfig->randomBotXPRate)); } };