mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 11:43:18 -04:00
Core/PacketIO: Updated SMSG_UPDATE_OBJECT for 11.0.5
This commit is contained in:
@@ -76,6 +76,8 @@ Object::Object() : m_scriptRef(this, NoopObjectDeleter())
|
||||
m_objectType = TYPEMASK_OBJECT;
|
||||
m_updateFlag.Clear();
|
||||
|
||||
m_entityFragments.Add(WowCS::EntityFragment::CGObject, false);
|
||||
|
||||
m_inWorld = false;
|
||||
m_isNewObject = false;
|
||||
m_isDestroyedObject = false;
|
||||
@@ -182,6 +184,8 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
|
||||
std::size_t sizePos = buf.wpos();
|
||||
buf << uint32(0);
|
||||
buf << uint8(fieldFlags);
|
||||
BuildEntityFragments(&buf, m_entityFragments.GetIds());
|
||||
buf << uint8(1); // IndirectFragmentActive: CGObject
|
||||
BuildValuesCreate(&buf, fieldFlags, target);
|
||||
buf.put<uint32>(sizePos, buf.wpos() - sizePos - 4);
|
||||
|
||||
@@ -209,6 +213,15 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player const* tar
|
||||
EnumFlag<UF::UpdateFieldFlag> fieldFlags = GetUpdateFieldFlagsFor(target);
|
||||
std::size_t sizePos = buf.wpos();
|
||||
buf << uint32(0);
|
||||
buf << uint8(fieldFlags.HasFlag(UF::UpdateFieldFlag::Owner));
|
||||
buf << uint8(m_entityFragments.IdsChanged);
|
||||
if (m_entityFragments.IdsChanged)
|
||||
{
|
||||
buf << uint8(WowCS::EntityFragmentSerializationType::Full);
|
||||
BuildEntityFragments(&buf, m_entityFragments.GetIds());
|
||||
}
|
||||
buf << uint8(m_entityFragments.ContentsChangedMask);
|
||||
|
||||
BuildValuesUpdate(&buf, fieldFlags, target);
|
||||
buf.put<uint32>(sizePos, buf.wpos() - sizePos - 4);
|
||||
|
||||
@@ -221,12 +234,26 @@ void Object::BuildValuesUpdateBlockForPlayerWithFlag(UpdateData* data, UF::Updat
|
||||
|
||||
std::size_t sizePos = buf.wpos();
|
||||
buf << uint32(0);
|
||||
BuildEntityFragmentsForValuesUpdateForPlayerWithMask(&buf, flags);
|
||||
BuildValuesUpdateWithFlag(&buf, flags, target);
|
||||
buf.put<uint32>(sizePos, buf.wpos() - sizePos - 4);
|
||||
|
||||
data->AddUpdateBlock();
|
||||
}
|
||||
|
||||
void Object::BuildEntityFragments(ByteBuffer* data, std::span<WowCS::EntityFragment const> fragments)
|
||||
{
|
||||
data->append(fragments.data(), fragments.size());
|
||||
*data << WorldPackets::As<uint8>(WowCS::EntityFragment::End);
|
||||
}
|
||||
|
||||
void Object::BuildEntityFragmentsForValuesUpdateForPlayerWithMask(ByteBuffer* data, EnumFlag<UF::UpdateFieldFlag> flags)
|
||||
{
|
||||
*data << uint8(flags.HasFlag(UF::UpdateFieldFlag::Owner));
|
||||
*data << uint8(false); // m_entityFragments.IdsChanged
|
||||
*data << uint8(WowCS::CGObjectUpdateMask);
|
||||
}
|
||||
|
||||
void Object::BuildDestroyUpdateBlock(UpdateData* data) const
|
||||
{
|
||||
data->AddDestroyObject(GetGUID());
|
||||
@@ -273,6 +300,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, CreateObjectBits flags, Playe
|
||||
if (GameObject const* go = ToGameObject())
|
||||
PauseTimes = go->GetPauseTimes();
|
||||
|
||||
data->WriteBit(IsWorldObject()); // HasPositionFragment
|
||||
data->WriteBit(flags.NoBirthAnim);
|
||||
data->WriteBit(flags.EnablePortals);
|
||||
data->WriteBit(flags.PlayHoverAnim);
|
||||
@@ -469,6 +497,66 @@ void Object::BuildMovementUpdate(ByteBuffer* data, CreateObjectBits flags, Playe
|
||||
|
||||
*data << areaTrigger->GetRollPitchYaw().PositionXYZStream();
|
||||
|
||||
switch (shape.Type)
|
||||
{
|
||||
case AreaTriggerShapeType::Sphere:
|
||||
*data << int8(0);
|
||||
*data << float(shape.SphereDatas.Radius);
|
||||
*data << float(shape.SphereDatas.RadiusTarget);
|
||||
break;
|
||||
case AreaTriggerShapeType::Box:
|
||||
*data << int8(1);
|
||||
*data << float(shape.BoxDatas.Extents[0]);
|
||||
*data << float(shape.BoxDatas.Extents[1]);
|
||||
*data << float(shape.BoxDatas.Extents[2]);
|
||||
*data << float(shape.BoxDatas.ExtentsTarget[0]);
|
||||
*data << float(shape.BoxDatas.ExtentsTarget[1]);
|
||||
*data << float(shape.BoxDatas.ExtentsTarget[2]);
|
||||
break;
|
||||
case AreaTriggerShapeType::Polygon:
|
||||
*data << int8(3);
|
||||
*data << int32(shape.PolygonVertices.size());
|
||||
*data << int32(shape.PolygonVerticesTarget.size());
|
||||
*data << float(shape.PolygonDatas.Height);
|
||||
*data << float(shape.PolygonDatas.HeightTarget);
|
||||
|
||||
for (TaggedPosition<Position::XY> const& vertice : shape.PolygonVertices)
|
||||
*data << vertice;
|
||||
|
||||
for (TaggedPosition<Position::XY> const& vertice : shape.PolygonVerticesTarget)
|
||||
*data << vertice;
|
||||
break;
|
||||
case AreaTriggerShapeType::Cylinder:
|
||||
*data << int8(4);
|
||||
*data << float(shape.CylinderDatas.Radius);
|
||||
*data << float(shape.CylinderDatas.RadiusTarget);
|
||||
*data << float(shape.CylinderDatas.Height);
|
||||
*data << float(shape.CylinderDatas.HeightTarget);
|
||||
*data << float(shape.CylinderDatas.LocationZOffset);
|
||||
*data << float(shape.CylinderDatas.LocationZOffsetTarget);
|
||||
break;
|
||||
case AreaTriggerShapeType::Disk:
|
||||
*data << int8(7);
|
||||
*data << float(shape.DiskDatas.InnerRadius);
|
||||
*data << float(shape.DiskDatas.InnerRadiusTarget);
|
||||
*data << float(shape.DiskDatas.OuterRadius);
|
||||
*data << float(shape.DiskDatas.OuterRadiusTarget);
|
||||
*data << float(shape.DiskDatas.Height);
|
||||
*data << float(shape.DiskDatas.HeightTarget);
|
||||
*data << float(shape.DiskDatas.LocationZOffset);
|
||||
*data << float(shape.DiskDatas.LocationZOffsetTarget);
|
||||
break;
|
||||
case AreaTriggerShapeType::BoundedPlane:
|
||||
*data << int8(8);
|
||||
*data << float(shape.BoundedPlaneDatas.Extents[0]);
|
||||
*data << float(shape.BoundedPlaneDatas.Extents[1]);
|
||||
*data << float(shape.BoundedPlaneDatas.ExtentsTarget[0]);
|
||||
*data << float(shape.BoundedPlaneDatas.ExtentsTarget[1]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
bool hasAbsoluteOrientation = createProperties && createProperties->Flags.HasFlag(AreaTriggerCreatePropertiesFlag::HasAbsoluteOrientation);
|
||||
bool hasDynamicShape = createProperties && createProperties->Flags.HasFlag(AreaTriggerCreatePropertiesFlag::HasDynamicShape);
|
||||
bool hasAttached = createProperties && createProperties->Flags.HasFlag(AreaTriggerCreatePropertiesFlag::HasAttached);
|
||||
@@ -481,12 +569,6 @@ void Object::BuildMovementUpdate(ByteBuffer* data, CreateObjectBits flags, Playe
|
||||
bool hasMorphCurveID = createProperties && createProperties->MorphCurveId != 0;
|
||||
bool hasFacingCurveID = createProperties && createProperties->FacingCurveId != 0;
|
||||
bool hasMoveCurveID = createProperties && createProperties->MoveCurveId != 0;
|
||||
bool hasAreaTriggerSphere = shape.IsSphere();
|
||||
bool hasAreaTriggerBox = shape.IsBox();
|
||||
bool hasAreaTriggerPolygon = shape.IsPolygon();
|
||||
bool hasAreaTriggerCylinder = shape.IsCylinder();
|
||||
bool hasDisk = shape.IsDisk();
|
||||
bool hasBoundedPlane = shape.IsBoundedPlane();
|
||||
bool hasAreaTriggerSpline = areaTrigger->HasSplines();
|
||||
bool hasOrbit = areaTrigger->HasOrbit();
|
||||
bool hasMovementScript = false;
|
||||
@@ -505,12 +587,6 @@ void Object::BuildMovementUpdate(ByteBuffer* data, CreateObjectBits flags, Playe
|
||||
data->WriteBit(hasFacingCurveID);
|
||||
data->WriteBit(hasMoveCurveID);
|
||||
data->WriteBit(hasPositionalSoundKitID);
|
||||
data->WriteBit(hasAreaTriggerSphere);
|
||||
data->WriteBit(hasAreaTriggerBox);
|
||||
data->WriteBit(hasAreaTriggerPolygon);
|
||||
data->WriteBit(hasAreaTriggerCylinder);
|
||||
data->WriteBit(hasDisk);
|
||||
data->WriteBit(hasBoundedPlane);
|
||||
data->WriteBit(hasAreaTriggerSpline);
|
||||
data->WriteBit(hasOrbit);
|
||||
data->WriteBit(hasMovementScript);
|
||||
@@ -543,66 +619,6 @@ void Object::BuildMovementUpdate(ByteBuffer* data, CreateObjectBits flags, Playe
|
||||
if (hasPositionalSoundKitID)
|
||||
*data << uint32(0);
|
||||
|
||||
if (hasAreaTriggerSphere)
|
||||
{
|
||||
*data << float(shape.SphereDatas.Radius);
|
||||
*data << float(shape.SphereDatas.RadiusTarget);
|
||||
}
|
||||
|
||||
if (hasAreaTriggerBox)
|
||||
{
|
||||
*data << float(shape.BoxDatas.Extents[0]);
|
||||
*data << float(shape.BoxDatas.Extents[1]);
|
||||
*data << float(shape.BoxDatas.Extents[2]);
|
||||
*data << float(shape.BoxDatas.ExtentsTarget[0]);
|
||||
*data << float(shape.BoxDatas.ExtentsTarget[1]);
|
||||
*data << float(shape.BoxDatas.ExtentsTarget[2]);
|
||||
}
|
||||
|
||||
if (hasAreaTriggerPolygon)
|
||||
{
|
||||
*data << int32(shape.PolygonVertices.size());
|
||||
*data << int32(shape.PolygonVerticesTarget.size());
|
||||
*data << float(shape.PolygonDatas.Height);
|
||||
*data << float(shape.PolygonDatas.HeightTarget);
|
||||
|
||||
for (TaggedPosition<Position::XY> const& vertice : shape.PolygonVertices)
|
||||
*data << vertice;
|
||||
|
||||
for (TaggedPosition<Position::XY> const& vertice : shape.PolygonVerticesTarget)
|
||||
*data << vertice;
|
||||
}
|
||||
|
||||
if (hasAreaTriggerCylinder)
|
||||
{
|
||||
*data << float(shape.CylinderDatas.Radius);
|
||||
*data << float(shape.CylinderDatas.RadiusTarget);
|
||||
*data << float(shape.CylinderDatas.Height);
|
||||
*data << float(shape.CylinderDatas.HeightTarget);
|
||||
*data << float(shape.CylinderDatas.LocationZOffset);
|
||||
*data << float(shape.CylinderDatas.LocationZOffsetTarget);
|
||||
}
|
||||
|
||||
if (hasDisk)
|
||||
{
|
||||
*data << float(shape.DiskDatas.InnerRadius);
|
||||
*data << float(shape.DiskDatas.InnerRadiusTarget);
|
||||
*data << float(shape.DiskDatas.OuterRadius);
|
||||
*data << float(shape.DiskDatas.OuterRadiusTarget);
|
||||
*data << float(shape.DiskDatas.Height);
|
||||
*data << float(shape.DiskDatas.HeightTarget);
|
||||
*data << float(shape.DiskDatas.LocationZOffset);
|
||||
*data << float(shape.DiskDatas.LocationZOffsetTarget);
|
||||
}
|
||||
|
||||
if (hasBoundedPlane)
|
||||
{
|
||||
*data << float(shape.BoundedPlaneDatas.Extents[0]);
|
||||
*data << float(shape.BoundedPlaneDatas.Extents[1]);
|
||||
*data << float(shape.BoundedPlaneDatas.ExtentsTarget[0]);
|
||||
*data << float(shape.BoundedPlaneDatas.ExtentsTarget[1]);
|
||||
}
|
||||
|
||||
//if (hasMovementScript)
|
||||
// *data << *areaTrigger->GetMovementScript(); // AreaTriggerMovementScriptInfo
|
||||
|
||||
@@ -612,17 +628,32 @@ void Object::BuildMovementUpdate(ByteBuffer* data, CreateObjectBits flags, Playe
|
||||
|
||||
if (flags.GameObject)
|
||||
{
|
||||
bool bit8 = false;
|
||||
uint32 Int1 = 0;
|
||||
|
||||
GameObject const* gameObject = ToGameObject();
|
||||
Transport const* transport = gameObject->ToTransport();
|
||||
|
||||
bool bit8 = false;
|
||||
|
||||
*data << uint32(gameObject->GetWorldEffectID());
|
||||
|
||||
data->WriteBit(bit8);
|
||||
data->WriteBit(transport != nullptr);
|
||||
data->WriteBit(gameObject->GetPathProgressForClient().has_value());
|
||||
data->FlushBits();
|
||||
if (transport)
|
||||
{
|
||||
*data << uint32(transport->GetTransportPeriod());
|
||||
*data << uint32(transport->GetTimer());
|
||||
data->WriteBit(transport->IsStopRequested());
|
||||
data->WriteBit(transport->IsStopped());
|
||||
data->WriteBit(false);
|
||||
data->FlushBits();
|
||||
}
|
||||
|
||||
if (bit8)
|
||||
*data << uint32(Int1);
|
||||
*data << uint32(0);
|
||||
|
||||
if (gameObject->GetPathProgressForClient())
|
||||
*data << float(*gameObject->GetPathProgressForClient());
|
||||
}
|
||||
|
||||
if (flags.SmoothPhasing)
|
||||
@@ -806,6 +837,8 @@ void Object::AddToObjectUpdateIfNeeded()
|
||||
void Object::ClearUpdateMask(bool remove)
|
||||
{
|
||||
m_values.ClearChangesMask(&Object::m_objectData);
|
||||
m_entityFragments.IdsChanged = false;
|
||||
m_entityFragments.ContentsChangedMask = WowCS::CGObjectActiveMask;
|
||||
|
||||
if (m_objectUpdated)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user