Skip to content

Commit

Permalink
Player/Taxi: Fix unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Jan 7, 2025
1 parent 6cd92d2 commit fc077e0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
18 changes: 13 additions & 5 deletions src/game/Entities/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20214,13 +20214,23 @@ void Player::OnTaxiFlightStart(const TaxiPathEntry* /*path*/)

void Player::OnTaxiFlightEnd(const TaxiPathEntry* path)
{
// Final destination
if (const TaxiNodesEntry* destination = sTaxiNodesStore.LookupEntry(path->to))
TeleportTo(GetMap()->GetId(), destination->x, destination->y, destination->z, GetOrientation());
RemoveFlag(UNIT_FIELD_FLAGS, (UNIT_FLAG_CLIENT_CONTROL_LOST | UNIT_FLAG_TAXI_FLIGHT));

RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);

// Client-controlled unit should have control restored
if (const Player* controllingClientPlayer = GetClientControlling())
UpdateClientControl(this, true);

Unmount();

if (pvpInfo.inPvPEnforcedArea)
CastSpell(this, 2479, TRIGGERED_OLD_TRIGGERED);

// Final destination
if (const TaxiNodesEntry* destination = sTaxiNodesStore.LookupEntry(path->to))
TeleportTo(GetMap()->GetId(), destination->x, destination->y, destination->z, GetOrientation());

/*
NOTE: B clearly has some form of extra scripts on certain fly path ends. Nodes contain extra events, that can be done using dbscript_on_event,
but these extra scripts have no EventID in the DBC. In future if this place fills up, need to consider moving it to a more generic way of scripting.
Expand Down Expand Up @@ -20315,8 +20325,6 @@ void Player::OnTaxiFlightSplineStart(const TaxiPathNodeEntry* node)

void Player::OnTaxiFlightSplineEnd()
{
Unmount();

getHostileRefManager().updateOnlineOfflineState(true);

// Note: only gets set by itself when container does not end up empty
Expand Down
2 changes: 1 addition & 1 deletion src/game/MotionGenerators/MovementHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recv_data)

bool WorldSession::ProcessMovementInfo(MovementInfo& movementInfo, Unit* mover, Player* plMover, WorldPacket& recv_data)
{
if (plMover && plMover->IsBeingTeleported())
if (plMover && plMover->IsBeingTeleported() && recv_data.GetOpcode() != CMSG_MOVE_SET_COLLISION_HGT_ACK)
return false;

if (!VerifyMovementInfo(movementInfo, mover, recv_data.GetOpcode() == CMSG_FORCE_MOVE_UNROOT_ACK))
Expand Down
18 changes: 12 additions & 6 deletions src/game/MotionGenerators/PathMovementGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,20 @@ void TaxiMovementGenerator::Initialize(Unit& unit)
void TaxiMovementGenerator::Finalize(Unit& unit)
{
unit.clearUnitState(UNIT_STAT_TAXI_FLIGHT);
unit.RemoveFlag(UNIT_FIELD_FLAGS, (UNIT_FLAG_CLIENT_CONTROL_LOST | UNIT_FLAG_TAXI_FLIGHT));

if (unit.GetTypeId() == TYPEID_PLAYER)
unit.RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);
if (unit.HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_TAXI_FLIGHT)) // cleanup if still present, otherwise done in Player::OnTaxiFlightEnd
{
unit.RemoveFlag(UNIT_FIELD_FLAGS, (UNIT_FLAG_CLIENT_CONTROL_LOST | UNIT_FLAG_TAXI_FLIGHT));

// Client-controlled unit should have control restored
if (const Player* controllingClientPlayer = unit.GetClientControlling())
controllingClientPlayer->UpdateClientControl(&unit, true);
if (unit.GetTypeId() == TYPEID_PLAYER)
unit.RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);

// Client-controlled unit should have control restored
if (const Player* controllingClientPlayer = unit.GetClientControlling())
controllingClientPlayer->UpdateClientControl(&unit, true);

unit.Unmount();
}

AbstractPathMovementGenerator::Finalize(unit);
}
Expand Down

0 comments on commit fc077e0

Please sign in to comment.