mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Compare commits
1 Commits
hermensbas
...
hermensbas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f3a28bcbd |
@@ -209,30 +209,16 @@ public:
|
|||||||
|
|
||||||
void OnPlayerGiveXP(Player* player, uint32& amount, Unit* /*victim*/, uint8 /*xpSource*/) override
|
void OnPlayerGiveXP(Player* player, uint32& amount, Unit* /*victim*/, uint8 /*xpSource*/) override
|
||||||
{
|
{
|
||||||
// early return
|
if (!player->GetSession()->IsBot())
|
||||||
if (sPlayerbotAIConfig->randomBotXPRate == 1.0 || !player)
|
return;
|
||||||
|
|
||||||
|
if (!sRandomPlayerbotMgr->IsRandomBot(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// no XP multiplier, when player is no bot.
|
if (sPlayerbotAIConfig->randomBotXPRate != 1.0)
|
||||||
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())
|
|
||||||
{
|
{
|
||||||
Player* leader = group->GetLeader();
|
amount = static_cast<uint32>(std::round(static_cast<float>(amount) * sPlayerbotAIConfig->randomBotXPRate));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -166,27 +166,18 @@ void PlayerbotFactory::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(gemId);
|
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(gemId);
|
||||||
if (!proto)
|
if (proto) {
|
||||||
{
|
if (proto->ItemLevel < 60)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
if (proto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE)
|
||||||
if (proto->ItemLevel < 60)
|
continue;
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (proto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sRandomItemMgr->IsTestItem(gemId))
|
if (sRandomItemMgr->IsTestItem(gemId))
|
||||||
{
|
continue;
|
||||||
continue;
|
|
||||||
}
|
if (!proto || !sGemPropertiesStore.LookupEntry(proto->GemProperties))
|
||||||
|
|
||||||
if (!sGemPropertiesStore.LookupEntry(proto->GemProperties))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -194,6 +185,7 @@ void PlayerbotFactory::Init()
|
|||||||
// LOG_INFO("playerbots", "Add {} to enchantment gems", gemId);
|
// LOG_INFO("playerbots", "Add {} to enchantment gems", gemId);
|
||||||
enchantGemIdCache.push_back(gemId);
|
enchantGemIdCache.push_back(gemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("playerbots", "Loading {} enchantment gems", enchantGemIdCache.size());
|
LOG_INFO("playerbots", "Loading {} enchantment gems", enchantGemIdCache.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user