mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Compare commits
6 Commits
master
...
xprate-not
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8e11b73de | ||
|
|
687d996643 | ||
|
|
3bc576f7fb | ||
|
|
7f64dc20c0 | ||
|
|
d4a8c4abab | ||
|
|
fa005ac1a9 |
@@ -209,16 +209,30 @@ public:
|
||||
|
||||
void OnPlayerGiveXP(Player* player, uint32& amount, Unit* /*victim*/, uint8 /*xpSource*/) override
|
||||
{
|
||||
if (!player->GetSession()->IsBot())
|
||||
return;
|
||||
|
||||
if (!sRandomPlayerbotMgr->IsRandomBot(player))
|
||||
// early return
|
||||
if (sPlayerbotAIConfig->randomBotXPRate == 1.0 || !player)
|
||||
return;
|
||||
|
||||
if (sPlayerbotAIConfig->randomBotXPRate != 1.0)
|
||||
// no XP multiplier, when player is no bot.
|
||||
if (!player->GetSession()->IsBot() || !sRandomPlayerbotMgr->IsRandomBot(player))
|
||||
return;
|
||||
|
||||
// no XP multiplier, when bot has group where leader is a real player.
|
||||
if (Group* group = player->GetGroup())
|
||||
{
|
||||
amount = static_cast<uint32>(std::round(static_cast<float>(amount) * sPlayerbotAIConfig->randomBotXPRate));
|
||||
Player* leader = group->GetLeader();
|
||||
if (leader && leader != player)
|
||||
{
|
||||
if (PlayerbotAI* leaderBotAI = GET_PLAYERBOT_AI(leader))
|
||||
{
|
||||
if (leaderBotAI->HasRealPlayerMaster())
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise apply bot XP multiplier.
|
||||
amount = static_cast<uint32>(std::round(static_cast<float>(amount) * sPlayerbotAIConfig->randomBotXPRate));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user