Fix: Bots not mounting in BG's anymore (#1056)

Bots didn't stop as they were supposed to, leading to some issues.
This commit is contained in:
SaW 2025-03-04 13:42:41 +01:00 committed by GitHub
parent 13a4dde643
commit bf22f20997
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,8 +144,9 @@ bool CheckMountStateAction::Execute(Event /*event*/)
return true;
}
// If there is a master and bot not in BG
bool inBattleground = bot->InBattleground();
// If there is a master and bot not in BG
if (master && !inBattleground)
{
Group* group = bot->GetGroup();
@ -305,9 +306,6 @@ bool CheckMountStateAction::TryPreferredMount(Player* master) const
if (index < mounts.size() && sSpellMgr->GetSpellInfo(mounts[index]) &&
botAI->CanCastSpell(mounts[index], bot))
{
if (bot->isMoving())
bot->StopMoving();
botAI->CastSpell(mounts[index], bot);
return true;
}
@ -319,6 +317,10 @@ bool CheckMountStateAction::TryPreferredMount(Player* master) const
bool CheckMountStateAction::TryRandomMountFiltered(const std::map<int32, std::vector<uint32>>& spells, int32 masterSpeed) const
{
// Required here as otherwise bots won't mount in BG's due to them constant moving
if (bot->isMoving())
bot->StopMoving();
for (const auto& pair : spells)
{
int32 currentSpeed = pair.first;
@ -333,9 +335,6 @@ bool CheckMountStateAction::TryRandomMountFiltered(const std::map<int32, std::ve
if (botAI->CanCastSpell(ids[index], bot))
{
if (bot->isMoving())
bot->StopMoving();
botAI->CastSpell(ids[index], bot);
return true;
}