Skip to content

Commit

Permalink
Mount and taxi: Fixed wotlk bots mouting and using flightpaths
Browse files Browse the repository at this point in the history
mostlikely4r committed Feb 1, 2025
1 parent 973ba56 commit ea881cd
Showing 6 changed files with 36 additions and 5 deletions.
3 changes: 3 additions & 0 deletions playerbot/PlayerbotAI.cpp
Original file line number Diff line number Diff line change
@@ -840,6 +840,9 @@ void PlayerbotAI::Unmount()
{
bot->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
bot->Unmount();
#ifdef MANGOSBOT_TWO
bot->ResolvePendingUnmount();
#endif

bot->UpdateSpeed(MOVE_RUN, true);
bot->UpdateSpeed(MOVE_RUN, false);
3 changes: 3 additions & 0 deletions playerbot/strategy/actions/CheckMountStateAction.cpp
Original file line number Diff line number Diff line change
@@ -469,6 +469,9 @@ bool CheckMountStateAction::Mount(Player* requester)

if (ai->CastSpell(mount.GetSpellId(), bot))
{
#ifdef MANGOSBOT_TWO
bot->ResolvePendingMount();
#endif
sPlayerbotAIConfig.logEvent(ai, "CheckMountStateAction", sServerFacade.LookupSpellInfo(mount.GetSpellId())->SpellName[0], std::to_string(mount.GetSpeed(canFly)));
SetDuration(GetSpellRecoveryTime(sServerFacade.LookupSpellInfo(mount.GetSpellId())));
didMount = true;
2 changes: 1 addition & 1 deletion playerbot/strategy/actions/GenericSpellActions.cpp
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ bool CastSpellAction::isPossible()
}
if (bot->IsInCombat())
{
bot->Unmount();
ai->Unmount();
return false;
}
}
7 changes: 6 additions & 1 deletion playerbot/strategy/actions/MovementActions.cpp
Original file line number Diff line number Diff line change
@@ -715,8 +715,13 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
{
bot->SetMoney(10000000);
}

#ifdef MANGOSBOT_TWO
bot->OnTaxiFlightEject(true);
#endif
bool goTaxi = bot->ActivateTaxiPathTo({ tEntry->from, tEntry->to }, unit, 1);
#ifdef MANGOSBOT_TWO
bot->ResolvePendingMount();
#endif

if (ai->HasCheat(BotCheatMask::gold) || ai->HasCheat(BotCheatMask::taxi))
{
8 changes: 8 additions & 0 deletions playerbot/strategy/actions/RpgSubActions.cpp
Original file line number Diff line number Diff line change
@@ -193,11 +193,19 @@ bool RpgTaxiAction::Execute(Event& event)
sLog.outError("Bot %s cannot talk to flightmaster (%zu location available)", bot->GetName(), nodes.size());
return false;
}
#ifdef MANGOSBOT_TWO
bot->OnTaxiFlightEject(true);
#endif
if (!bot->ActivateTaxiPathTo({ entry->from, entry->to }, flightMaster, 0))
{
sLog.outError("Bot %s cannot fly %u (%zu location available)", bot->GetName(), path, nodes.size());
return false;
}

#ifdef MANGOSBOT_TWO
bot->ResolvePendingMount();
#endif

sLog.outString("Bot #%d <%s> is flying from %s to %s (%zu location available)", bot->GetGUIDLow(), bot->GetName(), nodeFrom->name[0], nodeTo->name[0], nodes.size());
bot->SetMoney(money);

18 changes: 15 additions & 3 deletions playerbot/strategy/actions/TaxiAction.cpp
Original file line number Diff line number Diff line change
@@ -68,10 +68,18 @@ bool TaxiAction::Execute(Event& event)
uint32 path = nodes[selected - 1];
TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(path);
if (!entry) return false;

return bot->ActivateTaxiPathTo({ entry->from, entry->to }, npc, 0);
#ifdef MANGOSBOT_TWO
bot->OnTaxiFlightEject(true);
#endif
bool didTaxi = bot->ActivateTaxiPathTo({ entry->from, entry->to }, npc, 0);
#ifdef MANGOSBOT_TWO
bot->ResolvePendingMount();
#endif;
return didTaxi;
}

#ifdef MANGOSBOT_TWO
bot->OnTaxiFlightEject(true);
#endif
if (!movement.taxiNodes.empty() && !bot->ActivateTaxiPathTo(movement.taxiNodes, npc))
{
movement.taxiNodes.clear();
@@ -81,6 +89,10 @@ bool TaxiAction::Execute(Event& event)
return false;
}

#ifdef MANGOSBOT_TWO
bot->ResolvePendingMount();
#endif

return true;
}

1 comment on commit ea881cd

@al3xc1985
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Please sign in to comment.