mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-21 02:20:00 +01:00
Compare commits
No commits in common. "b8e11b73de0c49321606927e0605762cd13ccdd5" and "7f64dc20c04dc44b5dbfce1cfebd7880ec124a66" have entirely different histories.
b8e11b73de
...
7f64dc20c0
@ -209,29 +209,33 @@ public:
|
||||
|
||||
void OnPlayerGiveXP(Player* player, uint32& amount, Unit* /*victim*/, uint8 /*xpSource*/) override
|
||||
{
|
||||
// early return
|
||||
if (sPlayerbotAIConfig->randomBotXPRate == 1.0 || !player)
|
||||
// when default no XP scaling.
|
||||
if (sPlayerbotAIConfig->randomBotXPRate == 1.0)
|
||||
return;
|
||||
|
||||
// no XP multiplier, when player is no bot.
|
||||
if (!player->GetSession()->IsBot() || !sRandomPlayerbotMgr->IsRandomBot(player))
|
||||
// when player is no bot.
|
||||
if (!player->GetSession()->IsBot())
|
||||
return;
|
||||
|
||||
// no XP multiplier, when bot has group where leader is a real player.
|
||||
// when player is no bot, double check.
|
||||
if (!sRandomPlayerbotMgr->IsRandomBot(player))
|
||||
return;
|
||||
|
||||
// when bot has group where leader is a real player.
|
||||
if (Group* group = player->GetGroup())
|
||||
{
|
||||
Player* leader = group->GetLeader();
|
||||
if (leader && leader != player)
|
||||
if (leader != player)
|
||||
{
|
||||
if (PlayerbotAI* leaderBotAI = GET_PLAYERBOT_AI(leader))
|
||||
{
|
||||
if (leaderBotAI->HasRealPlayerMaster())
|
||||
return;
|
||||
}
|
||||
if (!leader->GetSession()->IsBot())
|
||||
return;
|
||||
|
||||
if (!sRandomPlayerbotMgr->IsRandomBot(leader))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise apply bot XP multiplier.
|
||||
// otherwise apply bot XP scaling.
|
||||
amount = static_cast<uint32>(std::round(static_cast<float>(amount) * sPlayerbotAIConfig->randomBotXPRate));
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user