public void HandleMonsterMovementPacket(InPacket packet) { ResetData(); updateType = ObjectUpdateType.UPDATETYPE_MOVEMENT; guid = packet.ReadPackedGuid(); byte unk = packet.ReadByte(); WorldObject worldObject = game.Objects[guid]; worldObject.Set(packet.ReadVector3()); }
void ReadMovementUpdateData(InPacket packet) { flags = (ObjectUpdateFlags)packet.ReadUInt16(); if (flags.HasFlag(ObjectUpdateFlags.UPDATEFLAG_LIVING)) { ReadMovementInfo(packet); movementSpeeds = new Dictionary<UnitMoveType,float>(); movementSpeeds[UnitMoveType.MOVE_WALK] = packet.ReadSingle(); movementSpeeds[UnitMoveType.MOVE_RUN] = packet.ReadSingle(); movementSpeeds[UnitMoveType.MOVE_RUN_BACK] = packet.ReadSingle(); movementSpeeds[UnitMoveType.MOVE_SWIM] = packet.ReadSingle(); movementSpeeds[UnitMoveType.MOVE_SWIM_BACK] = packet.ReadSingle(); movementSpeeds[UnitMoveType.MOVE_FLIGHT] = packet.ReadSingle(); movementSpeeds[UnitMoveType.MOVE_FLIGHT_BACK] = packet.ReadSingle(); movementSpeeds[UnitMoveType.MOVE_TURN_RATE] = packet.ReadSingle(); movementSpeeds[UnitMoveType.MOVE_PITCH_RATE] = packet.ReadSingle(); if (movementInfo.Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SPLINE_ENABLED)) { splineFlags = (SplineFlags)packet.ReadUInt32(); if (splineFlags.HasFlag(SplineFlags.Final_Angle)) splineFacingAngle = packet.ReadSingle(); else if (splineFlags.HasFlag(SplineFlags.Final_Target)) splineFacingTargetGuid = packet.ReadUInt64(); else if (splineFlags.HasFlag(SplineFlags.Final_Point)) splineFacingPointX = packet.ReadVector3(); splineTimePassed = packet.ReadInt32(); splineDuration = packet.ReadInt32(); splineId = packet.ReadUInt32(); packet.ReadSingle(); packet.ReadSingle(); splineVerticalAcceleration = packet.ReadSingle(); splineEffectStartTime = packet.ReadInt32(); uint splineCount = packet.ReadUInt32(); for (uint index = 0; index < splineCount; index++) splinePoints.Add(packet.ReadVector3()); splineEvaluationMode = (SplineEvaluationMode)packet.ReadByte(); splineEndPoint = packet.ReadVector3(); } } else if (flags.HasFlag(ObjectUpdateFlags.UPDATEFLAG_POSITION)) { transportGuid = packet.ReadPackedGuid(); position = packet.ReadVector3(); transportOffset = packet.ReadVector3(); o = packet.ReadSingle(); corpseOrientation = packet.ReadSingle(); } else if (flags.HasFlag(ObjectUpdateFlags.UPDATEFLAG_STATIONARY_POSITION)) { position = packet.ReadVector3(); o = packet.ReadSingle(); } if (flags.HasFlag(ObjectUpdateFlags.UPDATEFLAG_UNKNOWN)) packet.ReadUInt32(); if (flags.HasFlag(ObjectUpdateFlags.UPDATEFLAG_LOWGUID)) lowGuid = packet.ReadUInt32(); if (flags.HasFlag(ObjectUpdateFlags.UPDATEFLAG_HAS_TARGET)) targetGuid = packet.ReadPackedGuid(); if (flags.HasFlag(ObjectUpdateFlags.UPDATEFLAG_TRANSPORT)) transportTimer = packet.ReadUInt32(); if (flags.HasFlag(ObjectUpdateFlags.UPDATEFLAG_VEHICLE)) { vehicledID = packet.ReadUInt32(); vehicleOrientation = packet.ReadSingle(); } if (flags.HasFlag(ObjectUpdateFlags.UPDATEFLAG_ROTATION)) goRotation = packet.ReadInt64(); }
public MovementInfo(InPacket packet) { Flags = (MovementFlags)packet.ReadUInt32(); Flags2 = (MovementFlags2)packet.ReadUInt16(); Time = packet.ReadUInt32(); Position = packet.ReadVector3(); O = packet.ReadSingle(); if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_ONTRANSPORT)) { TransportGuid = packet.ReadPackedGuid(); TransportPosition = packet.ReadVector3(); TransportO = packet.ReadSingle(); TransportTime = packet.ReadUInt32(); TransportSeat = packet.ReadByte(); if (Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_INTERPOLATED_MOVEMENT)) TransportTime2 = packet.ReadUInt32(); } if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SWIMMING) || Flags.HasFlag(MovementFlags.MOVEMENTFLAG_FLYING) || Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING)) Pitch = packet.ReadSingle(); FallTime = packet.ReadUInt32(); if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_FALLING)) { JumpZSpeed = packet.ReadSingle(); JumpSinAngle = packet.ReadSingle(); JumpCosAngle = packet.ReadSingle(); JumpXYSpeed = packet.ReadSingle(); } if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SPLINE_ELEVATION)) SplineElevation = packet.ReadSingle(); }