mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-19 22:49:39 -04:00
Core/Objects: Refactored MovementInfo structure
This commit is contained in:
@@ -101,10 +101,10 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var)
|
||||
|
||||
player->SetTransport(player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde);
|
||||
|
||||
player->m_movementInfo.t_pos.m_positionX = TransportMovementInfo.GetPositionX();
|
||||
player->m_movementInfo.t_pos.m_positionY = TransportMovementInfo.GetPositionY();
|
||||
player->m_movementInfo.t_pos.m_positionZ = TransportMovementInfo.GetPositionZ();
|
||||
player->m_movementInfo.t_guid = (player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
|
||||
player->m_movementInfo.transport.pos.m_positionX = TransportMovementInfo.GetPositionX();
|
||||
player->m_movementInfo.transport.pos.m_positionY = TransportMovementInfo.GetPositionY();
|
||||
player->m_movementInfo.transport.pos.m_positionZ = TransportMovementInfo.GetPositionZ();
|
||||
player->m_movementInfo.transport.guid = (player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
|
||||
|
||||
if (player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(),
|
||||
TeleportToTransportPosition.GetPositionY(),
|
||||
|
||||
@@ -1078,12 +1078,12 @@ void MovementInfo::OutDebug()
|
||||
if (flags & MOVEMENTFLAG_ONTRANSPORT)
|
||||
{
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "TRANSPORT:");
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "guid: " UI64FMTD, t_guid);
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "position: `%s`", t_pos.ToString().c_str());
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "seat: %i", t_seat);
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "time: %u", t_time);
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "guid: " UI64FMTD, transport.guid);
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "position: `%s`", transport.pos.ToString().c_str());
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "seat: %i", transport.seat);
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "time: %u", transport.time);
|
||||
if (flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT)
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "time2: %u", t_time2);
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "time2: %u", transport.time2);
|
||||
}
|
||||
|
||||
if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
|
||||
@@ -1091,7 +1091,7 @@ void MovementInfo::OutDebug()
|
||||
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "fallTime: %u", fallTime);
|
||||
if (flags & MOVEMENTFLAG_FALLING)
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed);
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", jump.zspeed, jump.sinAngle, jump.cosAngle, jump.xyspeed);
|
||||
|
||||
if (flags & MOVEMENTFLAG_SPLINE_ELEVATION)
|
||||
TC_LOG_INFO(LOG_FILTER_GENERAL, "splineElevation: %f", splineElevation);
|
||||
@@ -1216,12 +1216,12 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool
|
||||
|
||||
if (m_transport && obj->GetTransport() && obj->GetTransport()->GetGUIDLow() == m_transport->GetGUIDLow())
|
||||
{
|
||||
float dtx = m_movementInfo.t_pos.m_positionX - obj->m_movementInfo.t_pos.m_positionX;
|
||||
float dty = m_movementInfo.t_pos.m_positionY - obj->m_movementInfo.t_pos.m_positionY;
|
||||
float dtx = m_movementInfo.transport.pos.m_positionX - obj->m_movementInfo.transport.pos.m_positionX;
|
||||
float dty = m_movementInfo.transport.pos.m_positionY - obj->m_movementInfo.transport.pos.m_positionY;
|
||||
float disttsq = dtx * dtx + dty * dty;
|
||||
if (is3D)
|
||||
{
|
||||
float dtz = m_movementInfo.t_pos.m_positionZ - obj->m_movementInfo.t_pos.m_positionZ;
|
||||
float dtz = m_movementInfo.transport.pos.m_positionZ - obj->m_movementInfo.transport.pos.m_positionZ;
|
||||
disttsq += dtz * dtz;
|
||||
}
|
||||
return disttsq < (maxdist * maxdist);
|
||||
|
||||
@@ -407,26 +407,54 @@ struct MovementInfo
|
||||
uint16 flags2;
|
||||
Position pos;
|
||||
uint32 time;
|
||||
|
||||
// transport
|
||||
uint64 t_guid;
|
||||
Position t_pos;
|
||||
int8 t_seat;
|
||||
uint32 t_time;
|
||||
uint32 t_time2;
|
||||
struct TransportInfo
|
||||
{
|
||||
void Reset()
|
||||
{
|
||||
guid = 0;
|
||||
pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
seat = -1;
|
||||
time = 0;
|
||||
time2 = 0;
|
||||
}
|
||||
|
||||
uint64 guid;
|
||||
Position pos;
|
||||
int8 seat;
|
||||
uint32 time;
|
||||
uint32 time2;
|
||||
} transport;
|
||||
|
||||
// swimming/flying
|
||||
float pitch;
|
||||
|
||||
// falling
|
||||
uint32 fallTime;
|
||||
// jumping
|
||||
float j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed;
|
||||
|
||||
// jumping
|
||||
struct JumpInfo
|
||||
{
|
||||
void Reset()
|
||||
{
|
||||
zspeed = sinAngle = cosAngle = xyspeed = 0.0f;
|
||||
}
|
||||
|
||||
float zspeed, sinAngle, cosAngle, xyspeed;
|
||||
|
||||
} jump;
|
||||
|
||||
// spline
|
||||
float splineElevation;
|
||||
|
||||
MovementInfo() :
|
||||
guid(), flags(), flags2(), pos(), time(), t_guid(), t_pos(),
|
||||
t_seat(-1), t_time(), t_time2(), pitch(), fallTime(),
|
||||
j_zspeed(), j_sinAngle(), j_cosAngle(), j_xyspeed()
|
||||
{ }
|
||||
guid(0), flags(0), flags2(0), time(0), pitch(0.0f)
|
||||
{
|
||||
pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
transport.Reset();
|
||||
jump.Reset();
|
||||
}
|
||||
|
||||
uint32 GetMovementFlags() const { return flags; }
|
||||
void SetMovementFlags(uint32 flag) { flags = flag; }
|
||||
@@ -440,15 +468,6 @@ struct MovementInfo
|
||||
|
||||
void SetFallTime(uint32 time) { fallTime = time; }
|
||||
|
||||
void ClearTransport()
|
||||
{
|
||||
t_guid = 0;
|
||||
t_pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
t_seat = -1;
|
||||
t_time = 0;
|
||||
t_time2 = 0;
|
||||
}
|
||||
|
||||
void OutDebug();
|
||||
};
|
||||
|
||||
|
||||
@@ -2115,7 +2115,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
{
|
||||
m_transport->RemovePassenger(this);
|
||||
m_transport = NULL;
|
||||
m_movementInfo.ClearTransport();
|
||||
m_movementInfo.transport.Reset();
|
||||
RepopAtGraveyard(); // teleport to near graveyard if on transport, looks blizz like :)
|
||||
}
|
||||
|
||||
@@ -2141,7 +2141,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
{
|
||||
m_transport->RemovePassenger(this);
|
||||
m_transport = NULL;
|
||||
m_movementInfo.ClearTransport();
|
||||
m_movementInfo.transport.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2294,10 +2294,10 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
|
||||
if (m_transport)
|
||||
{
|
||||
final_x += m_movementInfo.t_pos.GetPositionX();
|
||||
final_y += m_movementInfo.t_pos.GetPositionY();
|
||||
final_z += m_movementInfo.t_pos.GetPositionZ();
|
||||
final_o += m_movementInfo.t_pos.GetOrientation();
|
||||
final_x += m_movementInfo.transport.pos.GetPositionX();
|
||||
final_y += m_movementInfo.transport.pos.GetPositionY();
|
||||
final_z += m_movementInfo.transport.pos.GetPositionZ();
|
||||
final_o += m_movementInfo.transport.pos.GetOrientation();
|
||||
}
|
||||
|
||||
m_teleport_dest = WorldLocation(mapid, final_x, final_y, final_z, final_o);
|
||||
@@ -2310,7 +2310,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
WorldPacket data(SMSG_NEW_WORLD, 4 + 4 + 4 + 4 + 4);
|
||||
data << uint32(mapid);
|
||||
if (m_transport)
|
||||
data << m_movementInfo.t_pos.PositionXYZOStream();
|
||||
data << m_movementInfo.transport.pos.PositionXYZOStream();
|
||||
else
|
||||
data << m_teleport_dest.PositionXYZOStream();
|
||||
|
||||
@@ -17145,18 +17145,18 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
// currently we do not support transport in bg
|
||||
else if (transGUID)
|
||||
{
|
||||
m_movementInfo.t_guid = MAKE_NEW_GUID(transGUID, 0, HIGHGUID_MO_TRANSPORT);
|
||||
m_movementInfo.t_pos.Relocate(fields[26].GetFloat(), fields[27].GetFloat(), fields[28].GetFloat(), fields[29].GetFloat());
|
||||
m_movementInfo.transport.guid = MAKE_NEW_GUID(transGUID, 0, HIGHGUID_MO_TRANSPORT);
|
||||
m_movementInfo.transport.pos.Relocate(fields[26].GetFloat(), fields[27].GetFloat(), fields[28].GetFloat(), fields[29].GetFloat());
|
||||
|
||||
if (!Trinity::IsValidMapCoord(
|
||||
GetPositionX()+m_movementInfo.t_pos.m_positionX, GetPositionY()+m_movementInfo.t_pos.m_positionY,
|
||||
GetPositionZ()+m_movementInfo.t_pos.m_positionZ, GetOrientation()+m_movementInfo.t_pos.m_orientation) ||
|
||||
GetPositionX()+m_movementInfo.transport.pos.m_positionX, GetPositionY()+m_movementInfo.transport.pos.m_positionY,
|
||||
GetPositionZ()+m_movementInfo.transport.pos.m_positionZ, GetOrientation()+m_movementInfo.transport.pos.m_orientation) ||
|
||||
// transport size limited
|
||||
m_movementInfo.t_pos.m_positionX > 250 || m_movementInfo.t_pos.m_positionY > 250 || m_movementInfo.t_pos.m_positionZ > 250)
|
||||
m_movementInfo.transport.pos.m_positionX > 250 || m_movementInfo.transport.pos.m_positionY > 250 || m_movementInfo.transport.pos.m_positionZ > 250)
|
||||
{
|
||||
TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.",
|
||||
guid, GetPositionX()+m_movementInfo.t_pos.m_positionX, GetPositionY()+m_movementInfo.t_pos.m_positionY,
|
||||
GetPositionZ()+m_movementInfo.t_pos.m_positionZ, GetOrientation()+m_movementInfo.t_pos.m_orientation);
|
||||
guid, GetPositionX()+m_movementInfo.transport.pos.m_positionX, GetPositionY()+m_movementInfo.transport.pos.m_positionY,
|
||||
GetPositionZ()+m_movementInfo.transport.pos.m_positionZ, GetOrientation()+m_movementInfo.transport.pos.m_orientation);
|
||||
|
||||
RelocateToHomebind();
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
|
||||
creature->SetTransport(this);
|
||||
creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
|
||||
creature->m_movementInfo.guid = GetGUID();
|
||||
creature->m_movementInfo.t_pos.Relocate(x, y, z, o);
|
||||
creature->m_movementInfo.transport.pos.Relocate(x, y, z, o);
|
||||
|
||||
if (anim)
|
||||
creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim);
|
||||
@@ -648,7 +648,7 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
|
||||
o + GetOrientation());
|
||||
|
||||
creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
|
||||
creature->SetTransportHomePosition(creature->m_movementInfo.t_pos);
|
||||
creature->SetTransportHomePosition(creature->m_movementInfo.transport.pos);
|
||||
|
||||
if (!creature->IsPositionValid())
|
||||
{
|
||||
@@ -675,10 +675,10 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
|
||||
|
||||
void Transport::UpdatePosition(MovementInfo* mi)
|
||||
{
|
||||
float transport_o = mi->pos.GetOrientation() - mi->t_pos.GetOrientation();
|
||||
float transport_x = mi->pos.m_positionX - (mi->t_pos.m_positionX * std::cos(transport_o) - mi->t_pos.m_positionY * std::sin(transport_o));
|
||||
float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * std::cos(transport_o) + mi->t_pos.m_positionX * std::sin(transport_o));
|
||||
float transport_z = mi->pos.m_positionZ - mi->t_pos.m_positionZ;
|
||||
float transport_o = mi->pos.GetOrientation() - mi->transport.pos.GetOrientation();
|
||||
float transport_x = mi->pos.m_positionX - (mi->transport.pos.m_positionX * std::cos(transport_o) - mi->transport.pos.m_positionY * std::sin(transport_o));
|
||||
float transport_y = mi->pos.m_positionY - (mi->transport.pos.m_positionY * std::cos(transport_o) + mi->transport.pos.m_positionX * std::sin(transport_o));
|
||||
float transport_z = mi->pos.m_positionZ - mi->transport.pos.m_positionZ;
|
||||
|
||||
Relocate(transport_x, transport_y, transport_z, transport_o);
|
||||
UpdatePassengerPositions();
|
||||
@@ -691,7 +691,7 @@ void Transport::UpdatePassengerPositions()
|
||||
Creature* npc = *itr;
|
||||
|
||||
float x, y, z, o;
|
||||
npc->m_movementInfo.t_pos.GetPosition(x, y, z, o);
|
||||
npc->m_movementInfo.transport.pos.GetPosition(x, y, z, o);
|
||||
CalculatePassengerPosition(x, y, z, &o);
|
||||
GetMap()->CreatureRelocation(npc, x, y, z, o, false);
|
||||
npc->GetTransportHomePosition(x, y, z, o);
|
||||
|
||||
@@ -407,7 +407,7 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
|
||||
|
||||
if (HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
|
||||
{
|
||||
Position& pos = m_movementInfo.t_pos;
|
||||
Position& pos = m_movementInfo.transport.pos;
|
||||
pos.m_positionX = loc.x;
|
||||
pos.m_positionY = loc.y;
|
||||
pos.m_positionZ = loc.z;
|
||||
@@ -16985,7 +16985,7 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const
|
||||
*data << uint8 (GetTransSeat());
|
||||
|
||||
if (GetExtraUnitMovementFlags() & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT)
|
||||
*data << uint32(m_movementInfo.t_time2);
|
||||
*data << uint32(m_movementInfo.transport.time2);
|
||||
}
|
||||
|
||||
// 0x02200000
|
||||
@@ -16998,10 +16998,10 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const
|
||||
// 0x00001000
|
||||
if (GetUnitMovementFlags() & MOVEMENTFLAG_FALLING)
|
||||
{
|
||||
*data << (float)m_movementInfo.j_zspeed;
|
||||
*data << (float)m_movementInfo.j_sinAngle;
|
||||
*data << (float)m_movementInfo.j_cosAngle;
|
||||
*data << (float)m_movementInfo.j_xyspeed;
|
||||
*data << (float)m_movementInfo.jump.zspeed;
|
||||
*data << (float)m_movementInfo.jump.sinAngle;
|
||||
*data << (float)m_movementInfo.jump.cosAngle;
|
||||
*data << (float)m_movementInfo.jump.xyspeed;
|
||||
}
|
||||
|
||||
// 0x04000000
|
||||
|
||||
@@ -2079,12 +2079,12 @@ class Unit : public WorldObject
|
||||
bool IsOnVehicle(const Unit* vehicle) const;
|
||||
Unit* GetVehicleBase() const;
|
||||
Creature* GetVehicleCreatureBase() const;
|
||||
float GetTransOffsetX() const { return m_movementInfo.t_pos.GetPositionX(); }
|
||||
float GetTransOffsetY() const { return m_movementInfo.t_pos.GetPositionY(); }
|
||||
float GetTransOffsetZ() const { return m_movementInfo.t_pos.GetPositionZ(); }
|
||||
float GetTransOffsetO() const { return m_movementInfo.t_pos.GetOrientation(); }
|
||||
uint32 GetTransTime() const { return m_movementInfo.t_time; }
|
||||
int8 GetTransSeat() const { return m_movementInfo.t_seat; }
|
||||
float GetTransOffsetX() const { return m_movementInfo.transport.pos.GetPositionX(); }
|
||||
float GetTransOffsetY() const { return m_movementInfo.transport.pos.GetPositionY(); }
|
||||
float GetTransOffsetZ() const { return m_movementInfo.transport.pos.GetPositionZ(); }
|
||||
float GetTransOffsetO() const { return m_movementInfo.transport.pos.GetOrientation(); }
|
||||
uint32 GetTransTime() const { return m_movementInfo.transport.time; }
|
||||
int8 GetTransSeat() const { return m_movementInfo.transport.seat; }
|
||||
uint64 GetTransGUID() const;
|
||||
/// Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
|
||||
TransportBase* GetDirectTransport() const;
|
||||
|
||||
@@ -519,7 +519,7 @@ Vehicle* Vehicle::RemovePassenger(Unit* unit)
|
||||
if (_me->IsInWorld())
|
||||
{
|
||||
unit->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
|
||||
unit->m_movementInfo.ClearTransport();
|
||||
unit->m_movementInfo.transport.Reset();
|
||||
}
|
||||
|
||||
// only for flyable vehicles
|
||||
@@ -557,7 +557,7 @@ void Vehicle::RelocatePassengers()
|
||||
ASSERT(passenger->IsInWorld());
|
||||
|
||||
float px, py, pz, po;
|
||||
passenger->m_movementInfo.t_pos.GetPosition(px, py, pz, po);
|
||||
passenger->m_movementInfo.transport.pos.GetPosition(px, py, pz, po);
|
||||
CalculatePassengerPosition(px, py, pz, &po);
|
||||
passenger->UpdatePosition(px, py, pz, po);
|
||||
}
|
||||
@@ -840,10 +840,10 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
|
||||
|
||||
Passenger->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
|
||||
VehicleSeatEntry const* veSeat = Seat->second.SeatInfo;
|
||||
Passenger->m_movementInfo.t_pos.Relocate(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ);
|
||||
Passenger->m_movementInfo.t_time = 0; // 1 for player
|
||||
Passenger->m_movementInfo.t_seat = Seat->first;
|
||||
Passenger->m_movementInfo.t_guid = Target->GetBase()->GetGUID();
|
||||
Passenger->m_movementInfo.transport.pos.Relocate(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ);
|
||||
Passenger->m_movementInfo.transport.time = 0;
|
||||
Passenger->m_movementInfo.transport.seat = Seat->first;
|
||||
Passenger->m_movementInfo.transport.guid = Target->GetBase()->GetGUID();
|
||||
|
||||
if (Target->GetBase()->GetTypeId() == TYPEID_UNIT && Passenger->GetTypeId() == TYPEID_PLAYER &&
|
||||
Seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
|
||||
|
||||
@@ -889,7 +889,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
|
||||
if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT)
|
||||
{
|
||||
if (Vehicle* veh = player->GetVehicle())
|
||||
*data << uint32(veh->GetVehicleInfo()->m_seatID[player->m_movementInfo.t_seat]);
|
||||
*data << uint32(veh->GetVehicleInfo()->m_seatID[player->m_movementInfo.transport.seat]);
|
||||
else
|
||||
*data << uint32(0);
|
||||
}
|
||||
@@ -1026,7 +1026,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
|
||||
data.put<uint64>(maskPos, petAuraMask); // GROUP_UPDATE_FLAG_PET_AURAS
|
||||
|
||||
if (updateFlags & GROUP_UPDATE_FLAG_VEHICLE_SEAT)
|
||||
data << uint32(player->GetVehicle()->GetVehicleInfo()->m_seatID[player->m_movementInfo.t_seat]);
|
||||
data << uint32(player->GetVehicle()->GetVehicleInfo()->m_seatID[player->m_movementInfo.transport.seat]);
|
||||
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -283,14 +283,14 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
{
|
||||
// transports size limited
|
||||
// (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
|
||||
if (movementInfo.t_pos.GetPositionX() > 50 || movementInfo.t_pos.GetPositionY() > 50 || movementInfo.t_pos.GetPositionZ() > 50)
|
||||
if (movementInfo.transport.pos.GetPositionX() > 50 || movementInfo.transport.pos.GetPositionY() > 50 || movementInfo.transport.pos.GetPositionZ() > 50)
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.t_pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.t_pos.GetPositionY(),
|
||||
movementInfo.pos.GetPositionZ() + movementInfo.t_pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.t_pos.GetOrientation()))
|
||||
if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.transport.pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.transport.pos.GetPositionY(),
|
||||
movementInfo.pos.GetPositionZ() + movementInfo.transport.pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.transport.pos.GetOrientation()))
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
@@ -304,7 +304,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
// elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just dismount if the guid can be found in the transport list
|
||||
for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter)
|
||||
{
|
||||
if ((*iter)->GetGUID() == movementInfo.t_guid)
|
||||
if ((*iter)->GetGUID() == movementInfo.transport.guid)
|
||||
{
|
||||
plrMover->m_transport = *iter;
|
||||
(*iter)->AddPassenger(plrMover);
|
||||
@@ -312,13 +312,13 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (plrMover->GetTransport()->GetGUID() != movementInfo.t_guid)
|
||||
else if (plrMover->GetTransport()->GetGUID() != movementInfo.transport.guid)
|
||||
{
|
||||
bool foundNewTransport = false;
|
||||
plrMover->m_transport->RemovePassenger(plrMover);
|
||||
for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter)
|
||||
{
|
||||
if ((*iter)->GetGUID() == movementInfo.t_guid)
|
||||
if ((*iter)->GetGUID() == movementInfo.transport.guid)
|
||||
{
|
||||
foundNewTransport = true;
|
||||
plrMover->m_transport = *iter;
|
||||
@@ -330,14 +330,14 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
if (!foundNewTransport)
|
||||
{
|
||||
plrMover->m_transport = NULL;
|
||||
movementInfo.ClearTransport();
|
||||
movementInfo.transport.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mover->GetTransport() && !mover->GetVehicle())
|
||||
{
|
||||
GameObject* go = mover->GetMap()->GetGameObject(movementInfo.t_guid);
|
||||
GameObject* go = mover->GetMap()->GetGameObject(movementInfo.transport.guid);
|
||||
if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)
|
||||
movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT;
|
||||
}
|
||||
@@ -346,7 +346,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
{
|
||||
plrMover->m_transport->RemovePassenger(plrMover);
|
||||
plrMover->m_transport = NULL;
|
||||
movementInfo.ClearTransport();
|
||||
movementInfo.transport.Reset();
|
||||
}
|
||||
|
||||
// fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).
|
||||
@@ -542,10 +542,10 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
|
||||
_player->BuildMovementPacket(&data);
|
||||
|
||||
// knockback specific info
|
||||
data << movementInfo.j_sinAngle;
|
||||
data << movementInfo.j_cosAngle;
|
||||
data << movementInfo.j_xyspeed;
|
||||
data << movementInfo.j_zspeed;
|
||||
data << movementInfo.jump.sinAngle;
|
||||
data << movementInfo.jump.cosAngle;
|
||||
data << movementInfo.jump.xyspeed;
|
||||
data << movementInfo.jump.zspeed;
|
||||
|
||||
_player->SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
@@ -769,16 +769,16 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi)
|
||||
|
||||
if (mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
|
||||
{
|
||||
data.readPackGUID(mi->t_guid);
|
||||
data.readPackGUID(mi->transport.guid);
|
||||
|
||||
data >> mi->t_pos.PositionXYZOStream();
|
||||
data >> mi->t_time;
|
||||
data >> mi->t_seat;
|
||||
data >> mi->transport.pos.PositionXYZOStream();
|
||||
data >> mi->transport.time;
|
||||
data >> mi->transport.seat;
|
||||
|
||||
if (mi->HasExtraMovementFlag(MOVEMENTFLAG2_INTERPOLATED_MOVEMENT))
|
||||
data >> mi->t_time2;
|
||||
data >> mi->transport.time2;
|
||||
|
||||
if (mi->pos.m_positionX != mi->t_pos.m_positionX)
|
||||
if (mi->pos.m_positionX != mi->transport.pos.m_positionX)
|
||||
if (GetPlayer()->GetTransport())
|
||||
GetPlayer()->GetTransport()->UpdatePosition(mi);
|
||||
}
|
||||
@@ -790,10 +790,10 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi)
|
||||
|
||||
if (mi->HasMovementFlag(MOVEMENTFLAG_FALLING))
|
||||
{
|
||||
data >> mi->j_zspeed;
|
||||
data >> mi->j_sinAngle;
|
||||
data >> mi->j_cosAngle;
|
||||
data >> mi->j_xyspeed;
|
||||
data >> mi->jump.zspeed;
|
||||
data >> mi->jump.sinAngle;
|
||||
data >> mi->jump.cosAngle;
|
||||
data >> mi->jump.xyspeed;
|
||||
}
|
||||
|
||||
if (mi->HasMovementFlag(MOVEMENTFLAG_SPLINE_ELEVATION))
|
||||
@@ -883,14 +883,14 @@ void WorldSession::WriteMovementInfo(WorldPacket* data, MovementInfo* mi)
|
||||
|
||||
if (mi->HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
|
||||
{
|
||||
data->appendPackGUID(mi->t_guid);
|
||||
data->appendPackGUID(mi->transport.guid);
|
||||
|
||||
*data << mi->t_pos.PositionXYZOStream();
|
||||
*data << mi->t_time;
|
||||
*data << mi->t_seat;
|
||||
*data << mi->transport.pos.PositionXYZOStream();
|
||||
*data << mi->transport.time;
|
||||
*data << mi->transport.seat;
|
||||
|
||||
if (mi->HasExtraMovementFlag(MOVEMENTFLAG2_INTERPOLATED_MOVEMENT))
|
||||
*data << mi->t_time2;
|
||||
*data << mi->transport.time2;
|
||||
}
|
||||
|
||||
if (mi->HasMovementFlag(MovementFlags(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || mi->HasExtraMovementFlag(MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
|
||||
@@ -900,10 +900,10 @@ void WorldSession::WriteMovementInfo(WorldPacket* data, MovementInfo* mi)
|
||||
|
||||
if (mi->HasMovementFlag(MOVEMENTFLAG_FALLING))
|
||||
{
|
||||
*data << mi->j_zspeed;
|
||||
*data << mi->j_sinAngle;
|
||||
*data << mi->j_cosAngle;
|
||||
*data << mi->j_xyspeed;
|
||||
*data << mi->jump.zspeed;
|
||||
*data << mi->jump.sinAngle;
|
||||
*data << mi->jump.cosAngle;
|
||||
*data << mi->jump.xyspeed;
|
||||
}
|
||||
|
||||
if (mi->HasMovementFlag(MOVEMENTFLAG_SPLINE_ELEVATION))
|
||||
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
case PHASE_GROUND:
|
||||
me->CastStop(SPELL_FOG_BREATH);
|
||||
me->RemoveAurasDueToSpell(SPELL_FOG_BREATH);
|
||||
me->SetUnitMovementFlags(MOVEMENTFLAG_NONE);
|
||||
me->StopMoving();
|
||||
me->SetSpeed(MOVE_RUN, 2.0f);
|
||||
|
||||
events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000));
|
||||
|
||||
@@ -148,7 +148,6 @@ public:
|
||||
{
|
||||
CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID());
|
||||
CAST_AI(npc_escortAI, (creature->AI()))->SetMaxPlayerDistance(35.0f);
|
||||
creature->SetUnitMovementFlags(MOVEMENTFLAG_FALLING);
|
||||
creature->AI()->Talk(SAY_START_IRO);
|
||||
|
||||
switch (player->GetTeam()){
|
||||
|
||||
@@ -1910,7 +1910,7 @@ public:
|
||||
|
||||
//! HACK: Creature's can't have MOVEMENTFLAG_FLYING
|
||||
// Fly Away
|
||||
me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_ASCENDING|MOVEMENTFLAG_FLYING);
|
||||
me->SetCanFly(true);
|
||||
me->SetSpeed(MOVE_FLIGHT, 0.75f, true);
|
||||
me->SetSpeed(MOVE_RUN, 0.75f, true);
|
||||
float x = me->GetPositionX() + 20 * std::cos(me->GetOrientation());
|
||||
|
||||
Reference in New Issue
Block a user