mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-19 06:29:50 -04:00
Core/PacketIO: Updated SMSG_UPDATE_OBJECT
This commit is contained in:
@@ -177,7 +177,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
|
||||
return;
|
||||
|
||||
uint8 updateType = UPDATETYPE_CREATE_OBJECT;
|
||||
uint16 flags = m_updateFlag;
|
||||
uint32 flags = m_updateFlag;
|
||||
|
||||
/** lower flag1 **/
|
||||
if (target == this) // building packet for yourself
|
||||
@@ -239,7 +239,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
|
||||
flags |= UPDATEFLAG_ANIMKITS;
|
||||
}
|
||||
|
||||
ByteBuffer buf(500);
|
||||
ByteBuffer buf(0x400);
|
||||
buf << uint8(updateType);
|
||||
buf << GetPackGUID();
|
||||
buf << uint8(m_objectTypeId);
|
||||
@@ -348,325 +348,177 @@ ObjectGuid const& Object::GetGuidValue(uint16 index) const
|
||||
return *((ObjectGuid*)&(m_uint32Values[index]));
|
||||
}
|
||||
|
||||
void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
|
||||
void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const
|
||||
{
|
||||
Unit const* self = NULL;
|
||||
ObjectGuid guid = GetGUID();
|
||||
uint32 movementFlags = 0;
|
||||
uint16 movementFlagsExtra = 0;
|
||||
|
||||
bool hasTransportTime2 = false;
|
||||
bool hasTransportTime3 = false;
|
||||
bool hasFallDirection = false;
|
||||
bool hasFallData = false;
|
||||
bool hasPitch = false;
|
||||
bool hasSpline = false;
|
||||
bool hasSplineElevation = false;
|
||||
|
||||
uint32 stopFrameCount = 0;
|
||||
bool NoBirthAnim = false;
|
||||
bool EnablePortals = false;
|
||||
bool PlayHoverAnim = false;
|
||||
bool IsSuppressingGreetings = false;
|
||||
bool HasMovementUpdate = flags & UPDATEFLAG_LIVING;
|
||||
bool HasMovementTransport = flags & UPDATEFLAG_GO_TRANSPORT_POSITION;
|
||||
bool Stationary = flags & UPDATEFLAG_STATIONARY_POSITION;
|
||||
bool CombatVictim = flags & UPDATEFLAG_HAS_TARGET;
|
||||
bool ServerTime = flags & UPDATEFLAG_TRANSPORT;
|
||||
bool VehicleCreate = flags & UPDATEFLAG_VEHICLE;
|
||||
bool AnimKitCreate = flags & UPDATEFLAG_ANIMKITS;
|
||||
bool Rotation = flags & UPDATEFLAG_ROTATION;
|
||||
bool HasAreaTrigger = false;
|
||||
bool HasGameObject = false;
|
||||
bool ThisIsYou = flags & UPDATEFLAG_SELF;
|
||||
bool ReplaceActive = false;
|
||||
bool SceneObjCreate = false;
|
||||
bool ScenePendingInstances = false;
|
||||
uint32 PauseTimesCount = 0;
|
||||
if (GameObject const* go = ToGameObject())
|
||||
if (go->GetGoType() == GAMEOBJECT_TYPE_TRANSPORT)
|
||||
stopFrameCount = go->GetGOValue()->Transport.StopFrames->size();
|
||||
PauseTimesCount = go->GetGOValue()->Transport.StopFrames->size();
|
||||
|
||||
// Bit content
|
||||
data->WriteBit(0);
|
||||
data->WriteBit(0);
|
||||
data->WriteBit(flags & UPDATEFLAG_ROTATION);
|
||||
data->WriteBit(flags & UPDATEFLAG_ANIMKITS);
|
||||
data->WriteBit(flags & UPDATEFLAG_HAS_TARGET);
|
||||
data->WriteBit(flags & UPDATEFLAG_SELF);
|
||||
data->WriteBit(flags & UPDATEFLAG_VEHICLE);
|
||||
data->WriteBit(flags & UPDATEFLAG_LIVING);
|
||||
data->WriteBits(stopFrameCount, 24);
|
||||
data->WriteBit(0);
|
||||
data->WriteBit(flags & UPDATEFLAG_GO_TRANSPORT_POSITION);
|
||||
data->WriteBit(flags & UPDATEFLAG_STATIONARY_POSITION);
|
||||
data->WriteBit(flags & UPDATEFLAG_UNK5);
|
||||
data->WriteBit(0);
|
||||
data->WriteBit(flags & UPDATEFLAG_TRANSPORT);
|
||||
data->WriteBit(NoBirthAnim);
|
||||
data->WriteBit(EnablePortals);
|
||||
data->WriteBit(PlayHoverAnim);
|
||||
data->WriteBit(IsSuppressingGreetings);
|
||||
data->WriteBit(HasMovementUpdate);
|
||||
data->WriteBit(HasMovementTransport);
|
||||
data->WriteBit(Stationary);
|
||||
data->WriteBit(CombatVictim);
|
||||
data->WriteBit(ServerTime);
|
||||
data->WriteBit(VehicleCreate);
|
||||
data->WriteBit(AnimKitCreate);
|
||||
data->WriteBit(Rotation);
|
||||
data->WriteBit(HasAreaTrigger);
|
||||
data->WriteBit(HasGameObject);
|
||||
data->WriteBit(ThisIsYou);
|
||||
data->WriteBit(ReplaceActive);
|
||||
data->WriteBit(SceneObjCreate);
|
||||
data->WriteBit(ScenePendingInstances);
|
||||
*data << uint32(PauseTimesCount);
|
||||
|
||||
if (flags & UPDATEFLAG_LIVING)
|
||||
{
|
||||
self = ToUnit();
|
||||
movementFlags = self->m_movementInfo.GetMovementFlags();
|
||||
movementFlagsExtra = self->m_movementInfo.GetExtraMovementFlags();
|
||||
hasSpline = self->IsSplineEnabled();
|
||||
|
||||
hasTransportTime2 = !self->m_movementInfo.transport.guid.IsEmpty() && self->m_movementInfo.transport.time2 != 0;
|
||||
hasTransportTime3 = false;
|
||||
hasPitch = self->HasUnitMovementFlag(MovementFlags(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || self->HasExtraUnitMovementFlag(MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING);
|
||||
hasFallDirection = self->HasUnitMovementFlag(MOVEMENTFLAG_FALLING);
|
||||
hasFallData = hasFallDirection || self->m_movementInfo.jump.fallTime != 0;
|
||||
hasSplineElevation = self->HasUnitMovementFlag(MOVEMENTFLAG_SPLINE_ELEVATION);
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
movementFlags &= MOVEMENTFLAG_MASK_CREATURE_ALLOWED;
|
||||
|
||||
data->WriteBit(!movementFlags);
|
||||
data->WriteBit(G3D::fuzzyEq(self->GetOrientation(), 0.0f)); // Has Orientation
|
||||
data->WriteBit(guid[7]);
|
||||
data->WriteBit(guid[3]);
|
||||
data->WriteBit(guid[2]);
|
||||
if (movementFlags)
|
||||
data->WriteBits(movementFlags, 30);
|
||||
|
||||
data->WriteBit(hasSpline && GetTypeId() == TYPEID_PLAYER); // Has spline (from MovementInfo)
|
||||
data->WriteBit(!hasPitch); // Has pitch
|
||||
data->WriteBit(hasSpline); // Has spline data (independent)
|
||||
data->WriteBit(hasFallData); // Has fall data
|
||||
data->WriteBit(!hasSplineElevation); // Has spline elevation
|
||||
data->WriteBit(guid[5]);
|
||||
data->WriteBit(!self->m_movementInfo.transport.guid.IsEmpty()); // Has transport data
|
||||
data->WriteBit(0); // Is missing time
|
||||
|
||||
if (!self->m_movementInfo.transport.guid.IsEmpty())
|
||||
{
|
||||
ObjectGuid transGuid = self->m_movementInfo.transport.guid;
|
||||
|
||||
data->WriteBit(transGuid[1]);
|
||||
data->WriteBit(hasTransportTime2); // Has transport time 2
|
||||
data->WriteBit(transGuid[4]);
|
||||
data->WriteBit(transGuid[0]);
|
||||
data->WriteBit(transGuid[6]);
|
||||
data->WriteBit(hasTransportTime3); // Has transport time 3
|
||||
data->WriteBit(transGuid[7]);
|
||||
data->WriteBit(transGuid[5]);
|
||||
data->WriteBit(transGuid[3]);
|
||||
data->WriteBit(transGuid[2]);
|
||||
}
|
||||
|
||||
data->WriteBit(guid[4]);
|
||||
|
||||
if (hasSpline)
|
||||
Movement::PacketBuilder::WriteCreateBits(*self->movespline, *data);
|
||||
|
||||
data->WriteBit(guid[6]);
|
||||
if (hasFallData)
|
||||
data->WriteBit(hasFallDirection);
|
||||
|
||||
data->WriteBit(guid[0]);
|
||||
data->WriteBit(guid[1]);
|
||||
data->WriteBit(0);
|
||||
data->WriteBit(!movementFlagsExtra);
|
||||
if (movementFlagsExtra)
|
||||
data->WriteBits(movementFlagsExtra, 12);
|
||||
}
|
||||
|
||||
if (flags & UPDATEFLAG_GO_TRANSPORT_POSITION)
|
||||
{
|
||||
WorldObject const* self = static_cast<WorldObject const*>(this);
|
||||
ObjectGuid transGuid = self->m_movementInfo.transport.guid;
|
||||
data->WriteBit(transGuid[5]);
|
||||
data->WriteBit(0); // Has GO transport time 3
|
||||
data->WriteBit(transGuid[0]);
|
||||
data->WriteBit(transGuid[3]);
|
||||
data->WriteBit(transGuid[6]);
|
||||
data->WriteBit(transGuid[1]);
|
||||
data->WriteBit(transGuid[4]);
|
||||
data->WriteBit(transGuid[2]);
|
||||
data->WriteBit(0); // Has GO transport time 2
|
||||
data->WriteBit(transGuid[7]);
|
||||
}
|
||||
|
||||
if (flags & UPDATEFLAG_HAS_TARGET)
|
||||
{
|
||||
ObjectGuid victimGuid = self->GetVictim()->GetGUID(); // checked in BuildCreateUpdateBlockForPlayer
|
||||
data->WriteBit(victimGuid[2]);
|
||||
data->WriteBit(victimGuid[7]);
|
||||
data->WriteBit(victimGuid[0]);
|
||||
data->WriteBit(victimGuid[4]);
|
||||
data->WriteBit(victimGuid[5]);
|
||||
data->WriteBit(victimGuid[6]);
|
||||
data->WriteBit(victimGuid[1]);
|
||||
data->WriteBit(victimGuid[3]);
|
||||
}
|
||||
|
||||
if (flags & UPDATEFLAG_ANIMKITS)
|
||||
if (HasMovementUpdate)
|
||||
{
|
||||
Unit const* unit = ToUnit();
|
||||
data->WriteBit(unit->GetAIAnimKitId() == 0);
|
||||
data->WriteBit(unit->GetMovementAnimKitId() == 0);
|
||||
data->WriteBit(unit->GetMeleeAnimKitId() == 0);
|
||||
}
|
||||
bool HasFallDirection = unit->HasUnitMovementFlag(MOVEMENTFLAG_FALLING);
|
||||
bool HasFall = HasFallDirection || unit->m_movementInfo.jump.fallTime != 0;
|
||||
bool HasSpline = unit->IsSplineEnabled();
|
||||
|
||||
data->FlushBits();
|
||||
*data << unit->m_movementInfo.guid; // MoverGUID
|
||||
|
||||
// Data
|
||||
if (GameObject const* go = ToGameObject())
|
||||
for (uint32 i = 0; i < stopFrameCount; ++i)
|
||||
*data << uint32(go->GetGOValue()->Transport.StopFrames->at(i));
|
||||
*data << uint32(unit->m_movementInfo.time); // MoveIndex
|
||||
*data << float(unit->GetPositionX());
|
||||
*data << float(unit->GetPositionY());
|
||||
*data << float(unit->GetPositionZ());
|
||||
*data << float(unit->GetOrientation());
|
||||
|
||||
if (flags & UPDATEFLAG_LIVING)
|
||||
{
|
||||
data->WriteByteSeq(guid[4]);
|
||||
*data << self->GetSpeed(MOVE_RUN_BACK);
|
||||
*data << float(unit->m_movementInfo.pitch); // Pitch
|
||||
*data << float(unit->m_movementInfo.splineElevation); // StepUpStartElevation
|
||||
|
||||
if (hasFallData)
|
||||
uint32 removeMovementForcesCount = 0;
|
||||
*data << uint32(removeMovementForcesCount); // Count of RemoveForcesIDs
|
||||
*data << uint32(0); // Unknown
|
||||
|
||||
//for (uint32 i = 0; i < removeMovementForcesCount; ++i)
|
||||
// *data << ObjectGuid(RemoveForcesIDs);
|
||||
|
||||
data->WriteBits(unit->GetUnitMovementFlags(), 30);
|
||||
data->WriteBits(unit->GetExtraUnitMovementFlags(), 15);
|
||||
data->WriteBit(!unit->m_movementInfo.transport.guid.IsEmpty()); // HasTransport
|
||||
data->WriteBit(HasFall); // HasFall
|
||||
data->WriteBit(HasSpline); // HasSpline - marks that the unit uses spline movement
|
||||
data->WriteBit(0); // HeightChangeFailed
|
||||
|
||||
if (!unit->m_movementInfo.transport.guid.IsEmpty())
|
||||
{
|
||||
if (hasFallDirection)
|
||||
*data << unit->m_movementInfo.transport.guid; // Transport Guid
|
||||
*data << float(unit->GetTransOffsetX());
|
||||
*data << float(unit->GetTransOffsetY());
|
||||
*data << float(unit->GetTransOffsetZ());
|
||||
*data << float(unit->GetTransOffsetO());
|
||||
*data << int8(unit->m_movementInfo.transport.seat); // VehicleSeatIndex
|
||||
*data << uint32(unit->m_movementInfo.transport.time); // MoveTime
|
||||
|
||||
data->WriteBit(unit->m_movementInfo.transport.prevTime != 0);
|
||||
data->WriteBit(unit->m_movementInfo.transport.vehicleId != 0);
|
||||
|
||||
if (unit->m_movementInfo.transport.prevTime)
|
||||
*data << uint32(unit->m_movementInfo.transport.prevTime); // PrevMoveTime
|
||||
|
||||
if (unit->m_movementInfo.transport.vehicleId)
|
||||
*data << uint32(unit->m_movementInfo.transport.vehicleId); // VehicleRecID
|
||||
}
|
||||
|
||||
if (HasFall)
|
||||
{
|
||||
*data << uint32(unit->m_movementInfo.jump.fallTime); // Time
|
||||
*data << float(unit->m_movementInfo.jump.zspeed); // JumpVelocity
|
||||
|
||||
if (data->WriteBit(HasFallDirection))
|
||||
{
|
||||
*data << float(self->m_movementInfo.jump.xyspeed);
|
||||
*data << float(self->m_movementInfo.jump.sinAngle);
|
||||
*data << float(self->m_movementInfo.jump.cosAngle);
|
||||
*data << float(unit->m_movementInfo.jump.sinAngle); // Direction
|
||||
*data << float(unit->m_movementInfo.jump.cosAngle);
|
||||
*data << float(unit->m_movementInfo.jump.xyspeed); // Speed
|
||||
}
|
||||
|
||||
*data << uint32(self->m_movementInfo.jump.fallTime);
|
||||
*data << float(self->m_movementInfo.jump.zspeed);
|
||||
}
|
||||
|
||||
*data << self->GetSpeed(MOVE_SWIM_BACK);
|
||||
if (hasSplineElevation)
|
||||
*data << float(self->m_movementInfo.splineElevation);
|
||||
*data << float(unit->GetSpeed(MOVE_WALK));
|
||||
*data << float(unit->GetSpeed(MOVE_RUN));
|
||||
*data << float(unit->GetSpeed(MOVE_RUN_BACK));
|
||||
*data << float(unit->GetSpeed(MOVE_SWIM));
|
||||
*data << float(unit->GetSpeed(MOVE_SWIM_BACK));
|
||||
*data << float(unit->GetSpeed(MOVE_FLIGHT));
|
||||
*data << float(unit->GetSpeed(MOVE_FLIGHT_BACK));
|
||||
*data << float(unit->GetSpeed(MOVE_TURN_RATE));
|
||||
*data << float(unit->GetSpeed(MOVE_PITCH_RATE));
|
||||
|
||||
if (hasSpline)
|
||||
Movement::PacketBuilder::WriteCreateData(*self->movespline, *data);
|
||||
uint32 MovementForceCount = 0;
|
||||
*data << uint32(MovementForceCount);
|
||||
|
||||
*data << float(self->GetPositionZMinusOffset());
|
||||
data->WriteByteSeq(guid[5]);
|
||||
//for (uint32 i = 0; i < MovementForceCount; ++i)
|
||||
//{
|
||||
// *data << ObjectGuid(ID);
|
||||
// *data << Vector3(Direction);
|
||||
// *data << int32(TransportID);
|
||||
// *data << float(Magnitude);
|
||||
// *data << uint8(Type);
|
||||
//}
|
||||
|
||||
if (!self->m_movementInfo.transport.guid.IsEmpty())
|
||||
{
|
||||
ObjectGuid transGuid = self->m_movementInfo.transport.guid;
|
||||
|
||||
data->WriteByteSeq(transGuid[5]);
|
||||
data->WriteByteSeq(transGuid[7]);
|
||||
*data << uint32(self->GetTransTime());
|
||||
*data << float(self->GetTransOffsetO());
|
||||
if (hasTransportTime2)
|
||||
*data << uint32(self->m_movementInfo.transport.time2);
|
||||
|
||||
*data << float(self->GetTransOffsetY());
|
||||
*data << float(self->GetTransOffsetX());
|
||||
data->WriteByteSeq(transGuid[3]);
|
||||
*data << float(self->GetTransOffsetZ());
|
||||
data->WriteByteSeq(transGuid[0]);
|
||||
if (hasTransportTime3)
|
||||
*data << uint32(self->m_movementInfo.transport.time3);
|
||||
|
||||
*data << int8(self->GetTransSeat());
|
||||
data->WriteByteSeq(transGuid[1]);
|
||||
data->WriteByteSeq(transGuid[6]);
|
||||
data->WriteByteSeq(transGuid[2]);
|
||||
data->WriteByteSeq(transGuid[4]);
|
||||
}
|
||||
|
||||
*data << float(self->GetPositionX());
|
||||
*data << self->GetSpeed(MOVE_PITCH_RATE);
|
||||
data->WriteByteSeq(guid[3]);
|
||||
data->WriteByteSeq(guid[0]);
|
||||
*data << self->GetSpeed(MOVE_SWIM);
|
||||
*data << float(self->GetPositionY());
|
||||
data->WriteByteSeq(guid[7]);
|
||||
data->WriteByteSeq(guid[1]);
|
||||
data->WriteByteSeq(guid[2]);
|
||||
*data << self->GetSpeed(MOVE_WALK);
|
||||
|
||||
//if (true) // Has time, controlled by bit just after HasTransport
|
||||
*data << uint32(getMSTime());
|
||||
|
||||
*data << self->GetSpeed(MOVE_TURN_RATE);
|
||||
data->WriteByteSeq(guid[6]);
|
||||
*data << self->GetSpeed(MOVE_FLIGHT);
|
||||
if (!G3D::fuzzyEq(self->GetOrientation(), 0.0f))
|
||||
*data << float(self->GetOrientation());
|
||||
|
||||
*data << self->GetSpeed(MOVE_RUN);
|
||||
if (hasPitch)
|
||||
*data << float(self->m_movementInfo.pitch);
|
||||
|
||||
*data << self->GetSpeed(MOVE_FLIGHT_BACK);
|
||||
// HasMovementSpline - marks that spline data is present in packet
|
||||
if (data->WriteBit(HasSpline))
|
||||
Movement::PacketBuilder::WriteCreate(*unit->movespline, *data);
|
||||
}
|
||||
|
||||
if (flags & UPDATEFLAG_VEHICLE)
|
||||
{
|
||||
*data << float(self->GetOrientation());
|
||||
*data << uint32(self->GetVehicleKit()->GetVehicleInfo()->m_ID);
|
||||
}
|
||||
|
||||
if (flags & UPDATEFLAG_GO_TRANSPORT_POSITION)
|
||||
if (HasMovementTransport)
|
||||
{
|
||||
WorldObject const* self = static_cast<WorldObject const*>(this);
|
||||
ObjectGuid transGuid = self->m_movementInfo.transport.guid;
|
||||
|
||||
data->WriteBit(transGuid[0]);
|
||||
data->WriteBit(transGuid[5]);
|
||||
if (hasTransportTime3)
|
||||
*data << uint32(self->m_movementInfo.transport.time3);
|
||||
|
||||
data->WriteBit(transGuid[3]);
|
||||
*data << self->m_movementInfo.transport.guid; // Transport Guid
|
||||
*data << float(self->GetTransOffsetX());
|
||||
data->WriteBit(transGuid[4]);
|
||||
data->WriteBit(transGuid[6]);
|
||||
data->WriteBit(transGuid[1]);
|
||||
*data << uint32(self->GetTransTime());
|
||||
*data << float(self->GetTransOffsetY());
|
||||
data->WriteBit(transGuid[2]);
|
||||
data->WriteBit(transGuid[7]);
|
||||
*data << float(self->GetTransOffsetZ());
|
||||
*data << int8(self->GetTransSeat());
|
||||
*data << float(self->GetTransOffsetO());
|
||||
if (hasTransportTime2)
|
||||
*data << uint32(self->m_movementInfo.transport.time2);
|
||||
*data << int8(self->m_movementInfo.transport.seat); // VehicleSeatIndex
|
||||
*data << uint32(self->m_movementInfo.transport.time); // MoveTime
|
||||
|
||||
data->WriteBit(self->m_movementInfo.transport.prevTime != 0);
|
||||
data->WriteBit(self->m_movementInfo.transport.vehicleId != 0);
|
||||
|
||||
if (self->m_movementInfo.transport.prevTime)
|
||||
*data << uint32(self->m_movementInfo.transport.prevTime); // PrevMoveTime
|
||||
|
||||
if (self->m_movementInfo.transport.vehicleId)
|
||||
*data << uint32(self->m_movementInfo.transport.vehicleId); // VehicleRecID
|
||||
}
|
||||
|
||||
if (flags & UPDATEFLAG_ROTATION)
|
||||
*data << uint64(ToGameObject()->GetRotation());
|
||||
|
||||
if (flags & UPDATEFLAG_UNK5)
|
||||
{
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << uint8(0);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
*data << float(0.0f);
|
||||
}
|
||||
|
||||
if (flags & UPDATEFLAG_STATIONARY_POSITION)
|
||||
if (Stationary)
|
||||
{
|
||||
WorldObject const* self = static_cast<WorldObject const*>(this);
|
||||
*data << float(self->GetStationaryO());
|
||||
*data << float(self->GetStationaryX());
|
||||
*data << float(self->GetStationaryY());
|
||||
*data << float(self->GetStationaryZ());
|
||||
*data << float(self->GetStationaryO());
|
||||
}
|
||||
|
||||
if (flags & UPDATEFLAG_HAS_TARGET)
|
||||
{
|
||||
ObjectGuid victimGuid = self->GetVictim()->GetGUID(); // checked in BuildCreateUpdateBlockForPlayer
|
||||
data->WriteByteSeq(victimGuid[4]);
|
||||
data->WriteByteSeq(victimGuid[0]);
|
||||
data->WriteByteSeq(victimGuid[3]);
|
||||
data->WriteByteSeq(victimGuid[5]);
|
||||
data->WriteByteSeq(victimGuid[7]);
|
||||
data->WriteByteSeq(victimGuid[6]);
|
||||
data->WriteByteSeq(victimGuid[2]);
|
||||
data->WriteByteSeq(victimGuid[1]);
|
||||
}
|
||||
if (CombatVictim)
|
||||
*data << ToUnit()->GetVictim()->GetGUID(); // CombatVictim
|
||||
|
||||
if (flags & UPDATEFLAG_ANIMKITS)
|
||||
{
|
||||
Unit const* unit = ToUnit();
|
||||
if (unit->GetAIAnimKitId())
|
||||
*data << uint16(unit->GetAIAnimKitId());
|
||||
if (unit->GetMovementAnimKitId())
|
||||
*data << uint16(unit->GetMovementAnimKitId());
|
||||
if (unit->GetMeleeAnimKitId())
|
||||
*data << uint16(unit->GetMeleeAnimKitId());
|
||||
}
|
||||
|
||||
if (flags & UPDATEFLAG_TRANSPORT)
|
||||
if (ServerTime)
|
||||
{
|
||||
GameObject const* go = ToGameObject();
|
||||
/** @TODO Use IsTransport() to also handle type 11 (TRANSPORT)
|
||||
@@ -674,11 +526,267 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
|
||||
this causes clients to receive different PathProgress
|
||||
resulting in players seeing the object in a different position
|
||||
*/
|
||||
if (go && go->ToTransport())
|
||||
if (go && go->ToTransport()) // ServerTime
|
||||
*data << uint32(go->GetGOValue()->Transport.PathProgress);
|
||||
else
|
||||
*data << uint32(getMSTime());
|
||||
}
|
||||
|
||||
if (VehicleCreate)
|
||||
{
|
||||
Unit const* unit = ToUnit();
|
||||
*data << uint32(unit->GetVehicleKit()->GetVehicleInfo()->m_ID); // RecID
|
||||
*data << float(unit->GetOrientation()); // InitialRawFacing
|
||||
}
|
||||
|
||||
if (AnimKitCreate)
|
||||
{
|
||||
Unit const* unit = ToUnit();
|
||||
*data << uint16(unit->GetAIAnimKitId()); // AiID
|
||||
*data << uint16(unit->GetMovementAnimKitId()); // MovementID
|
||||
*data << uint16(unit->GetMeleeAnimKitId()); // MeleeID
|
||||
}
|
||||
|
||||
if (Rotation)
|
||||
*data << uint64(ToGameObject()->GetRotation()); // Rotation
|
||||
|
||||
//if (AreaTrigger)
|
||||
//{
|
||||
// packet.ReadInt32("ElapsedMs", index);
|
||||
|
||||
// packet.ReadVector3("RollPitchYaw1", index);
|
||||
|
||||
// packet.ResetBitReader();
|
||||
|
||||
// var HasAbsoluteOrientation = packet.ReadBit("HasAbsoluteOrientation", index);
|
||||
// var HasDynamicShape = packet.ReadBit("HasDynamicShape", index);
|
||||
// var HasAttached = packet.ReadBit("HasAttached", index);
|
||||
// var HasFaceMovementDir = packet.ReadBit("HasFaceMovementDir", index);
|
||||
// var HasFollowsTerrain = packet.ReadBit("HasFollowsTerrain", index);
|
||||
// var HasTargetRollPitchYaw = packet.ReadBit("HasTargetRollPitchYaw", index);
|
||||
// var HasScaleCurveID = packet.ReadBit("HasScaleCurveID", index);
|
||||
// var HasMorphCurveID = packet.ReadBit("HasMorphCurveID", index);
|
||||
// var HasFacingCurveID = packet.ReadBit("HasFacingCurveID", index);
|
||||
// var HasMoveCurveID = packet.ReadBit("HasMoveCurveID", index);
|
||||
// var HasAreaTriggerSphere = packet.ReadBit("HasAreaTriggerSphere", index);
|
||||
// var HasAreaTriggerBox = packet.ReadBit("HasAreaTriggerBox", index);
|
||||
// var HasAreaTriggerPolygon = packet.ReadBit("HasAreaTriggerPolygon", index);
|
||||
// var HasAreaTriggerCylinder = packet.ReadBit("HasAreaTriggerCylinder", index);
|
||||
// var HasAreaTriggerSpline = packet.ReadBit("HasAreaTriggerSpline", index);
|
||||
|
||||
// if (HasTargetRollPitchYaw)
|
||||
// packet.ReadVector3("TargetRollPitchYaw", index);
|
||||
|
||||
// if (HasScaleCurveID)
|
||||
// packet.ReadInt32("ScaleCurveID, index");
|
||||
|
||||
// if (HasMorphCurveID)
|
||||
// packet.ReadInt32("MorphCurveID", index);
|
||||
|
||||
// if (HasFacingCurveID)
|
||||
// packet.ReadInt32("FacingCurveID", index);
|
||||
|
||||
// if (HasMoveCurveID)
|
||||
// packet.ReadInt32("MoveCurveID", index);
|
||||
|
||||
// if (HasAreaTriggerSphere)
|
||||
// {
|
||||
// packet.ReadSingle("Radius", index);
|
||||
// packet.ReadSingle("RadiusTarget", index);
|
||||
// }
|
||||
|
||||
// if (HasAreaTriggerBox)
|
||||
// {
|
||||
// packet.ReadVector3("Extents", index);
|
||||
// packet.ReadVector3("ExtentsTarget", index);
|
||||
// }
|
||||
|
||||
// if (HasAreaTriggerPolygon)
|
||||
// {
|
||||
// var VerticesCount = packet.ReadInt32("VerticesCount", index);
|
||||
// var VerticesTargetCount = packet.ReadInt32("VerticesTargetCount", index);
|
||||
// packet.ReadSingle("Height", index);
|
||||
// packet.ReadSingle("HeightTarget", index);
|
||||
|
||||
// for (var i = 0; i < VerticesCount; ++i)
|
||||
// packet.ReadVector2("Vertices", index, i);
|
||||
|
||||
// for (var i = 0; i < VerticesTargetCount; ++i)
|
||||
// packet.ReadVector2("VerticesTarget", index, i);
|
||||
// }
|
||||
|
||||
// if (HasAreaTriggerCylinder)
|
||||
// {
|
||||
// packet.ReadSingle("Radius", index);
|
||||
// packet.ReadSingle("RadiusTarget", index);
|
||||
// packet.ReadSingle("Height", index);
|
||||
// packet.ReadSingle("HeightTarget", index);
|
||||
// packet.ReadSingle("Float4", index);
|
||||
// packet.ReadSingle("Float5", index);
|
||||
// }
|
||||
|
||||
// if (HasAreaTriggerSpline)
|
||||
// {
|
||||
// packet.ReadInt32("TimeToTarget", index);
|
||||
// packet.ReadInt32("ElapsedTimeForMovement", index);
|
||||
// var int8 = packet.ReadInt32("VerticesCount", index);
|
||||
|
||||
// for (var i = 0; i < int8; ++i)
|
||||
// packet.ReadVector3("Points", index, i);
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (GameObject)
|
||||
//{
|
||||
// packet.ReadInt32("WorldEffectID", index);
|
||||
|
||||
// packet.ResetBitReader();
|
||||
|
||||
// var bit8 = packet.ReadBit("bit8", index);
|
||||
// if (bit8)
|
||||
// packet.ReadInt32("Int1", index);
|
||||
//}
|
||||
|
||||
//if (SceneObjCreate)
|
||||
//{
|
||||
// packet.ResetBitReader();
|
||||
|
||||
// var CliSceneLocalScriptData = packet.ReadBit("CliSceneLocalScriptData", index);
|
||||
// var PetBattleFullUpdate = packet.ReadBit("PetBattleFullUpdate", index);
|
||||
|
||||
// if (CliSceneLocalScriptData)
|
||||
// {
|
||||
// packet.ResetBitReader();
|
||||
// var DataLength = packet.ReadBits(7);
|
||||
// packet.ReadWoWString("Data", DataLength, index);
|
||||
// }
|
||||
|
||||
// if (PetBattleFullUpdate)
|
||||
// {
|
||||
// for (var i = 0; i < 2; ++i)
|
||||
// {
|
||||
// packet.ReadPackedGuid128("CharacterID", index, i);
|
||||
|
||||
// packet.ReadInt32("TrapAbilityID", index, i);
|
||||
// packet.ReadInt32("TrapStatus", index, i);
|
||||
|
||||
// packet.ReadInt16("RoundTimeSecs", index, i);
|
||||
|
||||
// packet.ReadByte("FrontPet", index, i);
|
||||
// packet.ReadByte("InputFlags", index, i);
|
||||
|
||||
// packet.ResetBitReader();
|
||||
|
||||
// var PetBattlePetUpdateCount = packet.ReadBits("PetBattlePetUpdateCount", 2, index, i);
|
||||
|
||||
// for (var j = 0; j < PetBattlePetUpdateCount; ++j)
|
||||
// {
|
||||
// packet.ReadPackedGuid128("BattlePetGUID", index, i, j);
|
||||
|
||||
// packet.ReadInt32("SpeciesID", index, i, j);
|
||||
// packet.ReadInt32("DisplayID", index, i, j);
|
||||
// packet.ReadInt32("CollarID", index, i, j);
|
||||
|
||||
// packet.ReadInt16("Level", index, i, j);
|
||||
// packet.ReadInt16("Xp", index, i, j);
|
||||
|
||||
|
||||
// packet.ReadInt32("CurHealth", index, i, j);
|
||||
// packet.ReadInt32("MaxHealth", index, i, j);
|
||||
// packet.ReadInt32("Power", index, i, j);
|
||||
// packet.ReadInt32("Speed", index, i, j);
|
||||
// packet.ReadInt32("NpcTeamMemberID", index, i, j);
|
||||
|
||||
// packet.ReadInt16("BreedQuality", index, i, j);
|
||||
// packet.ReadInt16("StatusFlags", index, i, j);
|
||||
|
||||
// packet.ReadByte("Slot", index, i, j);
|
||||
|
||||
// var PetBattleActiveAbility = packet.ReadInt32("PetBattleActiveAbility", index, i, j);
|
||||
// var PetBattleActiveAura = packet.ReadInt32("PetBattleActiveAura", index, i, j);
|
||||
// var PetBattleActiveState = packet.ReadInt32("PetBattleActiveState", index, i, j);
|
||||
|
||||
// for (var k = 0; k < PetBattleActiveAbility; ++k)
|
||||
// {
|
||||
// packet.ReadInt32("AbilityID", index, i, j, k);
|
||||
// packet.ReadInt16("CooldownRemaining", index, i, j, k);
|
||||
// packet.ReadInt16("LockdownRemaining", index, i, j, k);
|
||||
// packet.ReadByte("AbilityIndex", index, i, j, k);
|
||||
// packet.ReadByte("Pboid", index, i, j, k);
|
||||
// }
|
||||
|
||||
// for (var k = 0; k < PetBattleActiveAura; ++k)
|
||||
// {
|
||||
// packet.ReadInt32("AbilityID", index, i, j, k);
|
||||
// packet.ReadInt32("InstanceID", index, i, j, k);
|
||||
// packet.ReadInt32("RoundsRemaining", index, i, j, k);
|
||||
// packet.ReadInt32("CurrentRound", index, i, j, k);
|
||||
// packet.ReadByte("CasterPBOID", index, i, j, k);
|
||||
// }
|
||||
|
||||
// for (var k = 0; k < PetBattleActiveState; ++k)
|
||||
// {
|
||||
// packet.ReadInt32("StateID", index, i, j, k);
|
||||
// packet.ReadInt32("StateValue", index, i, j, k);
|
||||
// }
|
||||
|
||||
// packet.ResetBitReader();
|
||||
// var bits57 = packet.ReadBits(7);
|
||||
// packet.ReadWoWString("CustomName", bits57, index, i, j);
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (var i = 0; i < 3; ++i)
|
||||
// {
|
||||
// var PetBattleActiveAura = packet.ReadInt32("PetBattleActiveAura", index, i);
|
||||
// var PetBattleActiveState = packet.ReadInt32("PetBattleActiveState", index, i);
|
||||
|
||||
// for (var j = 0; j < PetBattleActiveAura; ++j)
|
||||
// {
|
||||
// packet.ReadInt32("AbilityID", index, i, j);
|
||||
// packet.ReadInt32("InstanceID", index, i, j);
|
||||
// packet.ReadInt32("RoundsRemaining", index, i, j);
|
||||
// packet.ReadInt32("CurrentRound", index, i, j);
|
||||
// packet.ReadByte("CasterPBOID", index, i, j);
|
||||
// }
|
||||
|
||||
// for (var j = 0; j < PetBattleActiveState; ++j)
|
||||
// {
|
||||
// packet.ReadInt32("StateID", index, i, j);
|
||||
// packet.ReadInt32("StateValue", index, i, j);
|
||||
// }
|
||||
// }
|
||||
|
||||
// packet.ReadInt16("WaitingForFrontPetsMaxSecs", index);
|
||||
// packet.ReadInt16("PvpMaxRoundTime", index);
|
||||
|
||||
// packet.ReadInt32("CurRound", index);
|
||||
// packet.ReadInt32("NpcCreatureID", index);
|
||||
// packet.ReadInt32("NpcDisplayID", index);
|
||||
|
||||
// packet.ReadByte("CurPetBattleState");
|
||||
// packet.ReadByte("ForfeitPenalty");
|
||||
|
||||
// packet.ReadPackedGuid128("InitialWildPetGUID");
|
||||
|
||||
// packet.ReadBit("IsPVP");
|
||||
// packet.ReadBit("CanAwardXP");
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (ScenePendingInstances)
|
||||
//{
|
||||
// var SceneInstanceIDs = packet.ReadInt32("SceneInstanceIDsCount");
|
||||
|
||||
// for (var i = 0; i < SceneInstanceIDs; ++i)
|
||||
// packet.ReadInt32("SceneInstanceIDs", index, i);
|
||||
//}
|
||||
|
||||
if (GameObject const* go = ToGameObject())
|
||||
for (uint32 i = 0; i < PauseTimesCount; ++i)
|
||||
*data << uint32(go->GetGOValue()->Transport.StopFrames->at(i));
|
||||
|
||||
data->FlushBits();
|
||||
}
|
||||
|
||||
void Object::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) const
|
||||
@@ -1442,9 +1550,9 @@ void MovementInfo::OutDebug()
|
||||
TC_LOG_INFO("misc", "seat: %i", transport.seat);
|
||||
TC_LOG_INFO("misc", "time: %u", transport.time);
|
||||
if (flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT)
|
||||
TC_LOG_INFO("misc", "time2: %u", transport.time2);
|
||||
if (transport.time3)
|
||||
TC_LOG_INFO("misc", "time3: %u", transport.time3);
|
||||
TC_LOG_INFO("misc", "prevTime: %u", transport.prevTime);
|
||||
if (transport.vehicleId)
|
||||
TC_LOG_INFO("misc", "vehicleId: %u", transport.vehicleId);
|
||||
}
|
||||
|
||||
if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
|
||||
|
||||
@@ -218,14 +218,14 @@ class Object
|
||||
uint32 GetUpdateFieldData(Player const* target, uint32*& flags) const;
|
||||
uint32 GetDynamicUpdateFieldData(Player const* target, uint32*& flags) const;
|
||||
|
||||
void BuildMovementUpdate(ByteBuffer* data, uint16 flags) const;
|
||||
void BuildMovementUpdate(ByteBuffer* data, uint32 flags) const;
|
||||
virtual void BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, Player* target) const;
|
||||
virtual void BuildDynamicValuesUpdate(uint8 updatetype, ByteBuffer* data, Player* target) const;
|
||||
|
||||
uint16 m_objectType;
|
||||
|
||||
TypeID m_objectTypeId;
|
||||
uint16 m_updateFlag;
|
||||
uint32 m_updateFlag;
|
||||
|
||||
union
|
||||
{
|
||||
@@ -411,16 +411,16 @@ struct MovementInfo
|
||||
pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
seat = -1;
|
||||
time = 0;
|
||||
time2 = 0;
|
||||
time3 = 0;
|
||||
prevTime = 0;
|
||||
vehicleId = 0;
|
||||
}
|
||||
|
||||
ObjectGuid guid;
|
||||
Position pos;
|
||||
int8 seat;
|
||||
uint32 time;
|
||||
uint32 time2;
|
||||
uint32 time3;
|
||||
uint32 prevTime;
|
||||
uint32 vehicleId;
|
||||
} transport;
|
||||
|
||||
// swimming/flying
|
||||
|
||||
@@ -107,6 +107,7 @@ void PackedGuid::Set(ObjectGuid const& guid)
|
||||
{
|
||||
uint8 lowMask = 0;
|
||||
uint8 highMask = 0;
|
||||
_packedGuid.clear();
|
||||
_packedGuid << uint8(lowMask);
|
||||
_packedGuid << uint8(highMask);
|
||||
|
||||
|
||||
@@ -46,13 +46,15 @@ enum TypeMask
|
||||
{
|
||||
TYPEMASK_OBJECT = 0x0001,
|
||||
TYPEMASK_ITEM = 0x0002,
|
||||
TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004
|
||||
TYPEMASK_UNIT = 0x0008, // creature
|
||||
TYPEMASK_CONTAINER = 0x0004,
|
||||
TYPEMASK_UNIT = 0x0008,
|
||||
TYPEMASK_PLAYER = 0x0010,
|
||||
TYPEMASK_GAMEOBJECT = 0x0020,
|
||||
TYPEMASK_DYNAMICOBJECT = 0x0040,
|
||||
TYPEMASK_CORPSE = 0x0080,
|
||||
TYPEMASK_AREATRIGGER = 0x0100,
|
||||
TYPEMASK_SCENEOBJECT = 0x0200,
|
||||
TYPEMASK_CONVERSATION = 0x0400,
|
||||
TYPEMASK_SEER = TYPEMASK_PLAYER | TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT
|
||||
};
|
||||
|
||||
|
||||
@@ -47,18 +47,19 @@ bool UpdateData::BuildPacket(WorldPacket* packet)
|
||||
ASSERT(packet->empty()); // shouldn't happen
|
||||
packet->Initialize(SMSG_UPDATE_OBJECT, 2 + 4 + (m_outOfRangeGUIDs.empty() ? 0 : 1 + 4 + 9 * m_outOfRangeGUIDs.size()) + m_data.wpos());
|
||||
|
||||
*packet << uint32(m_blockCount);
|
||||
*packet << uint16(m_map);
|
||||
*packet << uint32(m_blockCount + (m_outOfRangeGUIDs.empty() ? 0 : 1));
|
||||
|
||||
if (!m_outOfRangeGUIDs.empty())
|
||||
|
||||
if (packet->WriteBit(!m_outOfRangeGUIDs.empty()))
|
||||
{
|
||||
*packet << uint8(UPDATETYPE_OUT_OF_RANGE_OBJECTS);
|
||||
*packet << uint16(0);
|
||||
*packet << uint32(m_outOfRangeGUIDs.size());
|
||||
|
||||
for (GuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
|
||||
*packet << i->WriteAsPacked();
|
||||
}
|
||||
|
||||
*packet << uint32(m_data.size());
|
||||
packet->append(m_data);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,17 +39,21 @@ enum OBJECT_UPDATE_FLAGS
|
||||
UPDATEFLAG_SELF = 0x0001,
|
||||
UPDATEFLAG_TRANSPORT = 0x0002,
|
||||
UPDATEFLAG_HAS_TARGET = 0x0004,
|
||||
UPDATEFLAG_UNKNOWN = 0x0008,
|
||||
UPDATEFLAG_LOWGUID = 0x0010,
|
||||
UPDATEFLAG_LIVING = 0x0020,
|
||||
UPDATEFLAG_STATIONARY_POSITION = 0x0040,
|
||||
UPDATEFLAG_VEHICLE = 0x0080,
|
||||
UPDATEFLAG_GO_TRANSPORT_POSITION = 0x0100,
|
||||
UPDATEFLAG_ROTATION = 0x0200,
|
||||
UPDATEFLAG_UNK3 = 0x0400,
|
||||
UPDATEFLAG_ANIMKITS = 0x0800,
|
||||
UPDATEFLAG_UNK5 = 0x1000,
|
||||
UPDATEFLAG_UNK6 = 0x2000,
|
||||
UPDATEFLAG_LIVING = 0x0008,
|
||||
UPDATEFLAG_STATIONARY_POSITION = 0x0010,
|
||||
UPDATEFLAG_VEHICLE = 0x0020,
|
||||
UPDATEFLAG_GO_TRANSPORT_POSITION = 0x0040,
|
||||
UPDATEFLAG_ROTATION = 0x0080,
|
||||
UPDATEFLAG_ANIMKITS = 0x0100,
|
||||
//UPDATEFLAG_AREATRIGGER = 0x0200,
|
||||
//UPDATEFLAG_GAMEOBJECT = 0x0400,
|
||||
//UPDATEFLAG_REPLACE_ACTIVE = 0x0800,
|
||||
//UPDATEFLAG_NO_BIRTH_ANIM = 0x1000,
|
||||
//UPDATEFLAG_ENABLE_PORTALS = 0x2000,
|
||||
//UPDATEFLAG_PLAY_HOVER_ANIM = 0x4000,
|
||||
//UPDATEFLAG_IS_SUPPRESSING_GREETINGS = 0x8000
|
||||
//UPDATEFLAG_SCENEOBJECT = 0x10000,
|
||||
//UPDATEFLAG_SCENE_PENDING_INSTANCE = 0x20000
|
||||
};
|
||||
|
||||
class UpdateData
|
||||
|
||||
@@ -27444,8 +27444,8 @@ void Player::ReadMovementInfo(WorldPacket& data, MovementInfo* mi, Movement::Ext
|
||||
bool hasTimestamp = false;
|
||||
bool hasOrientation = false;
|
||||
bool hasTransportData = false;
|
||||
bool hasTransportTime2 = false;
|
||||
bool hasTransportTime3 = false;
|
||||
bool hasTransportPrevTime = false;
|
||||
bool hasTransportVehicleId = false;
|
||||
bool hasPitch = false;
|
||||
bool hasFallData = false;
|
||||
bool hasFallDirection = false;
|
||||
@@ -27517,13 +27517,13 @@ void Player::ReadMovementInfo(WorldPacket& data, MovementInfo* mi, Movement::Ext
|
||||
case MSEHasTransportData:
|
||||
hasTransportData = data.ReadBit();
|
||||
break;
|
||||
case MSEHasTransportTime2:
|
||||
case MSEHasTransportPrevTime:
|
||||
if (hasTransportData)
|
||||
hasTransportTime2 = data.ReadBit();
|
||||
hasTransportPrevTime = data.ReadBit();
|
||||
break;
|
||||
case MSEHasTransportTime3:
|
||||
case MSEHasTransportVehicleId:
|
||||
if (hasTransportData)
|
||||
hasTransportTime3 = data.ReadBit();
|
||||
hasTransportVehicleId = data.ReadBit();
|
||||
break;
|
||||
case MSEHasPitch:
|
||||
hasPitch = !data.ReadBit();
|
||||
@@ -27590,13 +27590,13 @@ void Player::ReadMovementInfo(WorldPacket& data, MovementInfo* mi, Movement::Ext
|
||||
if (hasTransportData)
|
||||
data >> mi->transport.time;
|
||||
break;
|
||||
case MSETransportTime2:
|
||||
if (hasTransportData && hasTransportTime2)
|
||||
data >> mi->transport.time2;
|
||||
case MSETransportPrevTime:
|
||||
if (hasTransportData && hasTransportPrevTime)
|
||||
data >> mi->transport.prevTime;
|
||||
break;
|
||||
case MSETransportTime3:
|
||||
if (hasTransportData && hasTransportTime3)
|
||||
data >> mi->transport.time3;
|
||||
case MSETransportVehicleId:
|
||||
if (hasTransportData && hasTransportVehicleId)
|
||||
data >> mi->transport.vehicleId;
|
||||
break;
|
||||
case MSEPitch:
|
||||
if (hasPitch)
|
||||
|
||||
@@ -38,7 +38,7 @@ Transport::Transport() : GameObject(),
|
||||
_triggeredArrivalEvent(false), _triggeredDepartureEvent(false),
|
||||
_passengerTeleportItr(_passengers.begin()), _delayedAddModel(false)
|
||||
{
|
||||
m_updateFlag = UPDATEFLAG_TRANSPORT | UPDATEFLAG_LOWGUID | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_ROTATION;
|
||||
m_updateFlag = UPDATEFLAG_TRANSPORT | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_ROTATION;
|
||||
}
|
||||
|
||||
Transport::~Transport()
|
||||
|
||||
@@ -15603,8 +15603,8 @@ void Unit::WriteMovementInfo(WorldPacket& data, Movement::ExtraMovementStatusEle
|
||||
bool hasTransportData = !GetTransGUID().IsEmpty();
|
||||
bool hasSpline = IsSplineEnabled();
|
||||
|
||||
bool hasTransportTime2 = hasTransportData && m_movementInfo.transport.time2 != 0;
|
||||
bool hasTransportTime3 = false;
|
||||
bool hasTransportPrevTime = hasTransportData && m_movementInfo.transport.prevTime != 0;
|
||||
bool hasTransportVehicleId = hasTransportData && mi.transport.vehicleId != 0;
|
||||
bool hasPitch = HasUnitMovementFlag(MovementFlags(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || HasExtraUnitMovementFlag(MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING);
|
||||
bool hasFallDirection = HasUnitMovementFlag(MOVEMENTFLAG_FALLING);
|
||||
bool hasFallData = hasFallDirection || m_movementInfo.jump.fallTime != 0;
|
||||
@@ -15683,13 +15683,13 @@ void Unit::WriteMovementInfo(WorldPacket& data, Movement::ExtraMovementStatusEle
|
||||
case MSEHasTransportData:
|
||||
data.WriteBit(hasTransportData);
|
||||
break;
|
||||
case MSEHasTransportTime2:
|
||||
case MSEHasTransportPrevTime:
|
||||
if (hasTransportData)
|
||||
data.WriteBit(hasTransportTime2);
|
||||
data.WriteBit(hasTransportPrevTime);
|
||||
break;
|
||||
case MSEHasTransportTime3:
|
||||
case MSEHasTransportVehicleId:
|
||||
if (hasTransportData)
|
||||
data.WriteBit(hasTransportTime3);
|
||||
data.WriteBit(hasTransportVehicleId);
|
||||
break;
|
||||
case MSEHasPitch:
|
||||
data.WriteBit(!hasPitch);
|
||||
@@ -15756,13 +15756,13 @@ void Unit::WriteMovementInfo(WorldPacket& data, Movement::ExtraMovementStatusEle
|
||||
if (hasTransportData)
|
||||
data << GetTransTime();
|
||||
break;
|
||||
case MSETransportTime2:
|
||||
if (hasTransportData && hasTransportTime2)
|
||||
data << mi.transport.time2;
|
||||
case MSETransportPrevTime:
|
||||
if (hasTransportData && hasTransportPrevTime)
|
||||
data << mi.transport.prevTime;
|
||||
break;
|
||||
case MSETransportTime3:
|
||||
if (hasTransportData && hasTransportTime3)
|
||||
data << mi.transport.time3;
|
||||
case MSETransportVehicleId:
|
||||
if (hasTransportData && hasTransportVehicleId)
|
||||
data << mi.transport.vehicleId;
|
||||
break;
|
||||
case MSEPitch:
|
||||
if (hasPitch)
|
||||
|
||||
@@ -800,6 +800,7 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
|
||||
Passenger->m_movementInfo.transport.time = 0;
|
||||
Passenger->m_movementInfo.transport.seat = Seat->first;
|
||||
Passenger->m_movementInfo.transport.guid = Target->GetBase()->GetGUID();
|
||||
Passenger->m_movementInfo.transport.vehicleId = Target->GetVehicleInfo()->m_ID;
|
||||
|
||||
if (Target->GetBase()->GetTypeId() == TYPEID_UNIT && Passenger->GetTypeId() == TYPEID_PLAYER &&
|
||||
Seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -48,8 +48,8 @@ enum MovementStatusElements
|
||||
MSEHasTransportGuidByte5,
|
||||
MSEHasTransportGuidByte6,
|
||||
MSEHasTransportGuidByte7,
|
||||
MSEHasTransportTime2,
|
||||
MSEHasTransportTime3,
|
||||
MSEHasTransportPrevTime,
|
||||
MSEHasTransportVehicleId,
|
||||
MSEHasPitch,
|
||||
MSEHasFallData,
|
||||
MSEHasFallDirection,
|
||||
@@ -85,8 +85,8 @@ enum MovementStatusElements
|
||||
MSETransportOrientation,
|
||||
MSETransportSeat,
|
||||
MSETransportTime,
|
||||
MSETransportTime2,
|
||||
MSETransportTime3,
|
||||
MSETransportPrevTime,
|
||||
MSETransportVehicleId,
|
||||
MSEPitch,
|
||||
MSEFallTime,
|
||||
MSEFallVerticalSpeed,
|
||||
|
||||
@@ -149,91 +149,10 @@ namespace Movement
|
||||
WriteLinearPath(spline, data);
|
||||
}
|
||||
|
||||
void PacketBuilder::WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data)
|
||||
void PacketBuilder::WriteCreate(MoveSpline const& moveSpline, ByteBuffer& data)
|
||||
{
|
||||
if (!data.WriteBit(!moveSpline.Finalized()))
|
||||
return;
|
||||
|
||||
data.WriteBits(uint8(moveSpline.spline.mode()), 2);
|
||||
data.WriteBit(moveSpline.splineflags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation));
|
||||
data.WriteBits(moveSpline.getPath().size(), 22);
|
||||
switch (moveSpline.splineflags & MoveSplineFlag::Mask_Final_Facing)
|
||||
{
|
||||
case MoveSplineFlag::Final_Target:
|
||||
{
|
||||
ObjectGuid targetGuid(moveSpline.facing.target);
|
||||
data.WriteBits(2, 2);
|
||||
data.WriteBit(targetGuid[4]);
|
||||
data.WriteBit(targetGuid[3]);
|
||||
data.WriteBit(targetGuid[7]);
|
||||
data.WriteBit(targetGuid[2]);
|
||||
data.WriteBit(targetGuid[6]);
|
||||
data.WriteBit(targetGuid[1]);
|
||||
data.WriteBit(targetGuid[0]);
|
||||
data.WriteBit(targetGuid[5]);
|
||||
break;
|
||||
}
|
||||
case MoveSplineFlag::Final_Angle:
|
||||
data.WriteBits(0, 2);
|
||||
break;
|
||||
case MoveSplineFlag::Final_Point:
|
||||
data.WriteBits(1, 2);
|
||||
break;
|
||||
default:
|
||||
data.WriteBits(3, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
data.WriteBit((moveSpline.splineflags & MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration());
|
||||
data.WriteBits(moveSpline.splineflags.raw(), 25);
|
||||
}
|
||||
|
||||
void PacketBuilder::WriteCreateData(MoveSpline const& moveSpline, ByteBuffer& data)
|
||||
{
|
||||
if (!moveSpline.Finalized())
|
||||
{
|
||||
MoveSplineFlag const& splineFlags = moveSpline.splineflags;
|
||||
|
||||
if ((splineFlags & MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration())
|
||||
data << moveSpline.vertical_acceleration; // added in 3.1
|
||||
|
||||
data << moveSpline.timePassed();
|
||||
|
||||
if (splineFlags.final_angle)
|
||||
data << moveSpline.facing.angle;
|
||||
else if (splineFlags.final_target)
|
||||
{
|
||||
ObjectGuid facingGuid(moveSpline.facing.target);
|
||||
data.WriteByteSeq(facingGuid[5]);
|
||||
data.WriteByteSeq(facingGuid[3]);
|
||||
data.WriteByteSeq(facingGuid[7]);
|
||||
data.WriteByteSeq(facingGuid[1]);
|
||||
data.WriteByteSeq(facingGuid[6]);
|
||||
data.WriteByteSeq(facingGuid[4]);
|
||||
data.WriteByteSeq(facingGuid[2]);
|
||||
data.WriteByteSeq(facingGuid[0]);
|
||||
}
|
||||
|
||||
uint32 nodes = moveSpline.getPath().size();
|
||||
for (uint32 i = 0; i < nodes; ++i)
|
||||
{
|
||||
data << float(moveSpline.getPath()[i].z);
|
||||
data << float(moveSpline.getPath()[i].x);
|
||||
data << float(moveSpline.getPath()[i].y);
|
||||
}
|
||||
|
||||
if (splineFlags.final_point)
|
||||
data << moveSpline.facing.f.x << moveSpline.facing.f.z << moveSpline.facing.f.y;
|
||||
|
||||
data << float(1.f); // splineInfo.duration_mod_next; added in 3.1
|
||||
data << moveSpline.Duration();
|
||||
if (splineFlags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation))
|
||||
data << moveSpline.effect_start_time; // added in 3.1
|
||||
|
||||
data << float(1.f); // splineInfo.duration_mod; added in 3.1
|
||||
}
|
||||
|
||||
if (!moveSpline.isCyclic())
|
||||
data << uint32(moveSpline.GetId()); // ID
|
||||
if (!moveSpline.isCyclic()) // Destination
|
||||
{
|
||||
Vector3 dest = moveSpline.FinalDestination();
|
||||
data << float(dest.z);
|
||||
@@ -243,6 +162,62 @@ namespace Movement
|
||||
else
|
||||
data << Vector3::zero();
|
||||
|
||||
data << moveSpline.GetId();
|
||||
if (data.WriteBit(!moveSpline.Finalized())) // MovementSplineMove
|
||||
{
|
||||
MoveSplineFlag const& splineFlags = moveSpline.splineflags;
|
||||
data.FlushBits();
|
||||
|
||||
data.WriteBits(moveSpline.splineflags.raw(), 25); // SplineFlags
|
||||
data.WriteBits(uint8(moveSpline.spline.mode()), 2); // Mode
|
||||
|
||||
bool HasJumpGravity = data.WriteBit(moveSpline.splineflags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation)); // HasJumpGravity
|
||||
bool HasSpecialTime = data.WriteBit((moveSpline.splineflags & MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration()); // HasSpecialTime
|
||||
|
||||
if (splineFlags.final_angle)
|
||||
data.WriteBit(3);
|
||||
else if (splineFlags.final_target)
|
||||
data.WriteBit(2);
|
||||
else if (splineFlags.final_point)
|
||||
data.WriteBit(1);
|
||||
else
|
||||
data.WriteBit(0);
|
||||
|
||||
data.WriteBit(0); // HasSplineFilterKey
|
||||
|
||||
data << int32(moveSpline.timePassed()); // Elapsed
|
||||
data << uint32(moveSpline.Duration()); // Duration
|
||||
data << float(1.0f); // DurationModifier
|
||||
data << float(1.0f); // NextDurationModifier
|
||||
|
||||
uint32 PointsCount = moveSpline.getPath().size();
|
||||
data << uint32(PointsCount);
|
||||
|
||||
if (splineFlags.final_angle) // FaceDirection
|
||||
data << moveSpline.facing.angle;
|
||||
else if (splineFlags.final_target) // FaceGUID
|
||||
data << moveSpline.facing.target;
|
||||
else if (splineFlags.final_point) // FaceSpot
|
||||
data << moveSpline.facing.f.x << moveSpline.facing.f.y << moveSpline.facing.f.z;
|
||||
|
||||
if (HasJumpGravity)
|
||||
data << float(moveSpline.vertical_acceleration); // JumpGravity
|
||||
|
||||
if (HasSpecialTime)
|
||||
data << uint32(moveSpline.effect_start_time); // SpecialTime
|
||||
|
||||
//if (HasSplineFilterKey)
|
||||
//{
|
||||
// data << uint32(FilterKeysCount);
|
||||
// for (var i = 0; i < PointsCount; ++i)
|
||||
// {
|
||||
// data << float(In);
|
||||
// data << float(Out);
|
||||
// }
|
||||
|
||||
// data.WriteBits(FilterFlags, 2);
|
||||
//}
|
||||
|
||||
data.append<Vector3>(&moveSpline.getPath()[0], PointsCount); // Points
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace Movement
|
||||
|
||||
static void WriteMonsterMove(const MoveSpline& mov, WorldPacket& data);
|
||||
static void WriteStopMovement(Vector3 const& loc, uint32 splineId, ByteBuffer& data);
|
||||
static void WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data);
|
||||
static void WriteCreateData(MoveSpline const& moveSpline, ByteBuffer& data);
|
||||
static void WriteCreate(MoveSpline const& moveSpline, ByteBuffer& data);
|
||||
};
|
||||
}
|
||||
#endif // TRINITYSERVER_PACKET_BUILDER_H
|
||||
|
||||
Reference in New Issue
Block a user