Added some missing SetFallInformation calls (#19121)

Fixed HP drop bug on zeppelins
Fixed possible packet relocation problems on huge transports
This commit is contained in:
xinef1
2017-02-13 21:05:32 +01:00
committed by Shauren
parent 2412886ef6
commit b3f04ec157
6 changed files with 31 additions and 4 deletions

View File

@@ -1929,7 +1929,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// this will be used instead of the current location in SaveToDB
m_teleport_dest = WorldLocation(mapid, x, y, z, orientation);
SetFallInformation(0, z);
SetFallInformation(0, GetPositionZ());
// code for finish transfer called in WorldSession::HandleMovementOpcodes()
// at client packet MSG_MOVE_TELEPORT_ACK
@@ -2037,7 +2037,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
oldmap->RemovePlayerFromMap(this, false);
m_teleport_dest = WorldLocation(mapid, x, y, z, orientation);
SetFallInformation(0, z);
SetFallInformation(0, GetPositionZ());
// if the player is saved before worldportack (at logout for example)
// this will be used instead of the current location in SaveToDB

View File

@@ -286,7 +286,10 @@ void Transport::RemovePassenger(WorldObject* passenger)
TC_LOG_DEBUG("entities.transport", "Object %s removed from transport %s.", passenger->GetName().c_str(), GetName().c_str());
if (Player* plr = passenger->ToPlayer())
{
sScriptMgr->OnRemovePassenger(this, plr);
plr->SetFallInformation(0, plr->GetPositionZ());
}
}
}
@@ -713,8 +716,11 @@ void Transport::UpdatePassengerPositions(PassengerSet& passengers)
}
case TYPEID_PLAYER:
//relocate only passengers in world and skip any player that might be still logging in/teleporting
if (passenger->IsInWorld())
if (passenger->IsInWorld() && !passenger->ToPlayer()->IsBeingTeleported())
{
GetMap()->PlayerRelocation(passenger->ToPlayer(), x, y, z, o);
passenger->ToPlayer()->SetFallInformation(0, passenger->GetPositionZ());
}
break;
case TYPEID_GAMEOBJECT:
GetMap()->GameObjectRelocation(passenger->ToGameObject(), x, y, z, o, false);

View File

@@ -88,6 +88,7 @@ void WorldSession::HandleMoveWorldportAck()
if (GetPlayer()->HasUnitMovementFlag(MOVEMENTFLAG_HOVER))
z += GetPlayer()->GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
GetPlayer()->Relocate(loc.GetPositionX(), loc.GetPositionY(), z, loc.GetOrientation());
GetPlayer()->SetFallInformation(0, GetPlayer()->GetPositionZ());
GetPlayer()->ResetMap();
GetPlayer()->SetMap(newMap);
@@ -224,6 +225,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
WorldLocation const& dest = plMover->GetTeleportDest();
plMover->UpdatePosition(dest, true);
plMover->SetFallInformation(0, GetPlayer()->GetPositionZ());
uint32 newzone, newarea;
plMover->GetZoneAndAreaId(newzone, newarea);
@@ -289,9 +291,16 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
/* handle special cases */
if (movementInfo.HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
{
// We were teleported, skip packets that were broadcast before teleport
if (movementInfo.pos.GetExactDist2d(mover) > SIZE_OF_GRIDS)
{
recvData.rfinish(); // prevent warnings spam
return;
}
// transports size limited
// (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
if (movementInfo.transport.pos.GetPositionX() > 50 || movementInfo.transport.pos.GetPositionY() > 50 || movementInfo.transport.pos.GetPositionZ() > 50)
if (fabs(movementInfo.transport.pos.GetPositionX()) > 75.0f || fabs(movementInfo.transport.pos.GetPositionY()) > 75.0f || fabs(movementInfo.transport.pos.GetPositionZ()) > 75.0f)
{
recvData.rfinish(); // prevent warnings spam
return;

View File

@@ -585,7 +585,10 @@ void MotionMaster::MoveFall(uint32 id /*=0*/)
// don't run spline movement for players
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
_owner->ToPlayer()->SetFallInformation(0, _owner->GetPositionZ());
return;
}
Movement::MoveSplineInit init(_owner);
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz, false);

View File

@@ -328,6 +328,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
// this prevent cheating with landing point at lags
// when client side flight end early in comparison server side
player->StopMoving();
player->SetFallInformation(0, player->GetPositionZ());
}
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);

View File

@@ -4665,6 +4665,10 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
{
// charge changes fall time
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetFallInformation(0, m_caster->GetPositionZ());
float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE;
// Spell is not using explicit target - no generated path
if (m_preGeneratedPath.GetPathType() == PATHFIND_BLANK)
@@ -4755,6 +4759,10 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex)
float speedz = damage/ 10.f;
//1891: Disengage
unitTarget->JumpTo(speedxy, speedz, m_spellInfo->SpellIconID != 1891);
// changes fall time
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetFallInformation(0, m_caster->GetPositionZ());
}
void Spell::EffectQuestClear(SpellEffIndex effIndex)