Fix mount bug after bot logout

This commit is contained in:
Yunfan Li
2024-08-03 00:02:11 +08:00
parent 8df01e8fed
commit b0ab63238c

View File

@@ -497,6 +497,7 @@ void PlayerbotAI::Reset(bool full)
}
currentEngine = engines[BOT_STATE_NON_COMBAT];
currentState = BOT_STATE_NON_COMBAT;
nextAICheckDelay = 0;
whispers.clear();
@@ -1166,18 +1167,25 @@ void PlayerbotAI::DoNextAction(bool min)
else if ((nextAICheckDelay < 1000) && bot->IsSitState())
bot->SetStandState(UNIT_STAND_STATE_STAND);
if (bot->IsFlying() && !!bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !bot->HasAuraType(SPELL_AURA_FLY))
bool hasMountAura = bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED) || bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED);
if (hasMountAura && !bot->IsMounted())
{
if (bot->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING))
bot->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_FLYING);
if (bot->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY))
bot->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_CAN_FLY);
if (bot->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY))
bot->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
bot->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED);
bot->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED);
}
// if (bot->IsFlying() && !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !bot->HasAuraType(SPELL_AURA_FLY))
// {
// if (bot->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING))
// bot->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_FLYING);
// if (bot->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY))
// bot->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_CAN_FLY);
// if (bot->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY))
// bot->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
// }
/*
// land after kncokback/jump
if (bot->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING))