public static void ReadTransportData(MovementInfo moveInfo, WowGuid guid, Packet packet, object index) { packet.ResetBitReader(); moveInfo.TransportGuid = packet.ReadPackedGuid128("TransportGUID", index); moveInfo.TransportOffset = packet.ReadVector4("TransportPosition", index); var seat = packet.ReadByte("VehicleSeatIndex", index); packet.ReadUInt32("MoveTime", index); var hasPrevMoveTime = packet.ReadBit("HasPrevMoveTime", index); var hasVehicleRecID = packet.ReadBit("HasVehicleRecID", index); if (hasPrevMoveTime) { packet.ReadUInt32("PrevMoveTime", index); } if (hasVehicleRecID) { packet.ReadInt32("VehicleRecID", index); } if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory { Entry = moveInfo.TransportGuid.GetEntry(), AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan); } }
public void TestGetHighType() { var guid1 = new WowGuid(0xF130005C0500105F); var guid2 = new WowGuid(0x600000002B2D7C9); var guid3 = new WowGuid(0); Assert.AreEqual(HighGuidType.Unit, guid1.GetHighType()); Assert.AreEqual(HighGuidType.Player, guid2.GetHighType()); Assert.AreEqual(HighGuidType.None, guid3.GetHighType()); }
private static MovementInfo ReadMovementUpdateBlock(Packet packet, WowGuid guid, object index) { var moveInfo = new MovementInfo(); packet.ResetBitReader(); packet.ReadBit("NoBirthAnim", index); packet.ReadBit("EnablePortals", index); packet.ReadBit("PlayHoverAnim", index); packet.ReadBit("IsSuppressingGreetings", index); var hasMovementUpdate = packet.ReadBit("HasMovementUpdate", index); var hasMovementTransport = packet.ReadBit("HasMovementTransport", index); var hasStationaryPosition = packet.ReadBit("Stationary", index); var hasCombatVictim = packet.ReadBit("HasCombatVictim", index); var hasServerTime = packet.ReadBit("HasServerTime", index); var hasVehicleCreate = packet.ReadBit("HasVehicleCreate", index); var hasAnimKitCreate = packet.ReadBit("HasAnimKitCreate", index); var hasRotation = packet.ReadBit("HasRotation", index); var hasAreaTrigger = packet.ReadBit("HasAreaTrigger", index); var hasGameObject = packet.ReadBit("HasGameObject", index); packet.ReadBit("ThisIsYou", index); packet.ReadBit("ReplaceActive", index); var sceneObjCreate = packet.ReadBit("SceneObjCreate", index); var scenePendingInstances = packet.ReadBit("ScenePendingInstances", index); var pauseTimesCount = packet.ReadUInt32("PauseTimesCount", index); if (hasMovementUpdate) // 392 { moveInfo = ReadMovementStatusData(packet, index); moveInfo.WalkSpeed = packet.ReadSingle("WalkSpeed", index) / 2.5f; moveInfo.RunSpeed = packet.ReadSingle("RunSpeed", index) / 7.0f; packet.ReadSingle("RunBackSpeed", index); packet.ReadSingle("SwimSpeed", index); packet.ReadSingle("SwimBackSpeed", index); packet.ReadSingle("FlightSpeed", index); packet.ReadSingle("FlightBackSpeed", index); packet.ReadSingle("TurnRate", index); packet.ReadSingle("PitchRate", index); var movementForceCount = packet.ReadInt32("MovementForceCount", index); for (var i = 0; i < movementForceCount; ++i) { packet.ReadPackedGuid128("Id", index); packet.ReadVector3("Direction", index); if (ClientVersion.AddedInVersion(ClientVersionBuild.V6_1_2_19802)) // correct? { packet.ReadVector3("TransportPosition", index); } packet.ReadInt32("TransportID", index); packet.ReadSingle("Magnitude", index); packet.ReadByte("Type", index); } packet.ResetBitReader(); moveInfo.HasSplineData = packet.ReadBit("HasMovementSpline", index); if (moveInfo.HasSplineData) { packet.ReadInt32("ID", index); packet.ReadVector3("Destination", index); packet.ResetBitReader(); var hasMovementSplineMove = packet.ReadBit("MovementSplineMove", index); if (hasMovementSplineMove) { packet.ResetBitReader(); packet.ReadBitsE <SplineFlag434>("SplineFlags", ClientVersion.AddedInVersion(ClientVersionBuild.V6_2_0_20173) ? 28 : 25, index); var face = packet.ReadBits("Face", 2, index); var hasJumpGravity = packet.ReadBit("HasJumpGravity", index); var hasSpecialTime = packet.ReadBit("HasSpecialTime", index); packet.ReadBitsE <SplineMode>("Mode", 2, index); var hasSplineFilterKey = packet.ReadBit("HasSplineFilterKey", index); packet.ReadUInt32("Elapsed", index); packet.ReadUInt32("Duration", index); packet.ReadSingle("DurationModifier", index); packet.ReadSingle("NextDurationModifier", index); var pointsCount = packet.ReadUInt32("PointsCount", index); if (face == 3) // FaceDirection { packet.ReadSingle("FaceDirection", index); } if (face == 2) // FaceGUID { packet.ReadPackedGuid128("FaceGUID", index); } if (face == 1) // FaceSpot { packet.ReadVector3("FaceSpot", index); } if (hasJumpGravity) { packet.ReadSingle("JumpGravity", index); } if (hasSpecialTime) { packet.ReadInt32("SpecialTime", index); } if (hasSplineFilterKey) { var filterKeysCount = packet.ReadUInt32("FilterKeysCount", index); for (var i = 0; i < filterKeysCount; ++i) { packet.ReadSingle("In", index, i); packet.ReadSingle("Out", index, i); } if (ClientVersion.AddedInVersion(ClientVersionBuild.V6_2_0_20173)) { packet.ResetBitReader(); } packet.ReadBits("FilterFlags", 2, index); } for (var i = 0; i < pointsCount; ++i) { packet.ReadVector3("Points", index, i); } } } } if (hasMovementTransport) // 456 { moveInfo.TransportGuid = packet.ReadPackedGuid128("PassengerGUID", index); moveInfo.TransportOffset = packet.ReadVector4(); var seat = packet.ReadByte("VehicleSeatIndex", index); packet.ReadUInt32("MoveTime", index); packet.ResetBitReader(); var hasPrevMoveTime = packet.ReadBit("HasPrevMoveTime", index); var hasVehicleRecID = packet.ReadBit("HasVehicleRecID", index); if (hasPrevMoveTime) { packet.ReadUInt32("PrevMoveTime", index); } if (hasVehicleRecID) { packet.ReadInt32("VehicleRecID", index); } if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { var vehicleAccessory = new VehicleTemplateAccessory { AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessorys.Add(moveInfo.TransportGuid.GetEntry(), vehicleAccessory, packet.TimeSpan); } } if (hasStationaryPosition) // 480 { moveInfo.Position = packet.ReadVector3(); moveInfo.Orientation = packet.ReadSingle(); packet.AddValue("Stationary Position", moveInfo.Position, index); packet.AddValue("Stationary Orientation", moveInfo.Orientation, index); } if (hasCombatVictim) // 504 { packet.ReadPackedGuid128("CombatVictim Guid", index); } if (hasServerTime) // 516 { packet.ReadPackedTime("ServerTime", index); } if (hasVehicleCreate) // 528 { moveInfo.VehicleId = packet.ReadUInt32("RecID", index); packet.ReadSingle("InitialRawFacing", index); } if (hasAnimKitCreate) // 538 { packet.ReadUInt16("AiID", index); packet.ReadUInt16("MovementID", index); packet.ReadUInt16("MeleeID", index); } if (hasRotation) // 552 { packet.ReadPackedQuaternion("GameObject Rotation", index); } if (hasAreaTrigger) // 772 { // CliAreaTrigger packet.ReadInt32("ElapsedMs", index); packet.ReadVector3("RollPitchYaw1", index); packet.ResetBitReader(); packet.ReadBit("HasAbsoluteOrientation", index); packet.ReadBit("HasDynamicShape", index); packet.ReadBit("HasAttached", index); packet.ReadBit("HasFaceMovementDir", index); packet.ReadBit("HasFollowsTerrain", index); if (ClientVersion.AddedInVersion(ClientVersionBuild.V6_2_0_20173)) { packet.ReadBit("Unk bit WoD62x", 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) { AreaTriggerHandler.ReadAreaTriggerSpline(packet, index); } } if (hasGameObject) // 788 { packet.ReadInt32("WorldEffectID", index); packet.ResetBitReader(); var bit8 = packet.ReadBit("bit8", index); if (bit8) { packet.ReadInt32("Int1", index); } } if (sceneObjCreate) // 1184 { packet.ResetBitReader(); var hasSceneLocalScriptData = packet.ReadBit("HasSceneLocalScriptData", index); var petBattleFullUpdate = packet.ReadBit("HasPetBattleFullUpdate", index); if (hasSceneLocalScriptData) { packet.ResetBitReader(); var dataLength = packet.ReadBits(7); packet.ReadWoWString("Data", dataLength, index); } if (petBattleFullUpdate) { BattlePetHandler.ReadPetBattleFullUpdate(packet, index); } } if (scenePendingInstances) // 1208 { var sceneInstanceIDs = packet.ReadInt32("SceneInstanceIDsCount"); for (var i = 0; i < sceneInstanceIDs; ++i) { packet.ReadInt32("SceneInstanceIDs", index, i); } } for (var i = 0; i < pauseTimesCount; ++i) { packet.ReadInt32("PauseTimes", index, i); } return(moveInfo); }
private static MovementInfo ReadMovementUpdateBlock(Packet packet, WowGuid guid, WoWObject obj, object index) { var moveInfo = new MovementInfo(); packet.ResetBitReader(); packet.ReadBit("NoBirthAnim", index); packet.ReadBit("EnablePortals", index); packet.ReadBit("PlayHoverAnim", index); var hasMovementUpdate = packet.ReadBit("HasMovementUpdate", index); var hasMovementTransport = packet.ReadBit("HasMovementTransport", index); var hasStationaryPosition = packet.ReadBit("Stationary", index); var hasCombatVictim = packet.ReadBit("HasCombatVictim", index); var hasServerTime = packet.ReadBit("HasServerTime", index); var hasVehicleCreate = packet.ReadBit("HasVehicleCreate", index); var hasAnimKitCreate = packet.ReadBit("HasAnimKitCreate", index); var hasRotation = packet.ReadBit("HasRotation", index); var hasAreaTrigger = packet.ReadBit("HasAreaTrigger", index); var hasGameObject = packet.ReadBit("HasGameObject", index); var hasSmoothPhasing = packet.ReadBit("HasSmoothPhasing", index); packet.ReadBit("ThisIsYou", index); var sceneObjCreate = packet.ReadBit("SceneObjCreate", index); var playerCreateData = packet.ReadBit("HasPlayerCreateData", index); if (hasMovementUpdate) { packet.ResetBitReader(); packet.ReadPackedGuid128("MoverGUID", index); packet.ReadUInt32("MoveTime", index); moveInfo.Position = packet.ReadVector3("Position", index); moveInfo.Orientation = packet.ReadSingle("Orientation", index); packet.ReadSingle("Pitch", index); packet.ReadSingle("StepUpStartElevation", index); var removeForcesIDsCount = packet.ReadInt32(); packet.ReadInt32("MoveIndex", index); for (var i = 0; i < removeForcesIDsCount; i++) { packet.ReadPackedGuid128("RemoveForcesIDs", index, i); } moveInfo.Flags = (MovementFlag)packet.ReadBitsE <V6_0_2_19033.Enums.MovementFlag>("Movement Flags", 30, index); moveInfo.FlagsExtra = (MovementFlagExtra)packet.ReadBitsE <Enums.MovementFlags2>("Extra Movement Flags", 18, index); var hasTransport = packet.ReadBit("Has Transport Data", index); var hasFall = packet.ReadBit("Has Fall Data", index); packet.ReadBit("HasSpline", index); packet.ReadBit("HeightChangeFailed", index); packet.ReadBit("RemoteTimeValid", index); if (hasTransport) { packet.ResetBitReader(); moveInfo.TransportGuid = packet.ReadPackedGuid128("Transport Guid", index); moveInfo.TransportOffset = packet.ReadVector4("Transport Position", index); var seat = packet.ReadSByte("Transport Seat", index); packet.ReadInt32("Transport Time", index); var hasPrevMoveTime = packet.ReadBit("HasPrevMoveTime", index); var hasVehicleRecID = packet.ReadBit("HasVehicleRecID", index); if (hasPrevMoveTime) { packet.ReadUInt32("PrevMoveTime", index); } if (hasVehicleRecID) { packet.ReadUInt32("VehicleRecID", index); } if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory { Entry = moveInfo.TransportGuid.GetEntry(), AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan); } } if (hasFall) { packet.ResetBitReader(); packet.ReadUInt32("Fall Time", index); packet.ReadSingle("JumpVelocity", index); var hasFallDirection = packet.ReadBit("Has Fall Direction", index); if (hasFallDirection) { packet.ReadVector2("Fall", index); packet.ReadSingle("Horizontal Speed", index); } } moveInfo.WalkSpeed = packet.ReadSingle("WalkSpeed", index) / 2.5f; moveInfo.RunSpeed = packet.ReadSingle("RunSpeed", index) / 7.0f; packet.ReadSingle("RunBackSpeed", index); packet.ReadSingle("SwimSpeed", index); packet.ReadSingle("SwimBackSpeed", index); packet.ReadSingle("FlightSpeed", index); packet.ReadSingle("FlightBackSpeed", index); packet.ReadSingle("TurnRate", index); packet.ReadSingle("PitchRate", index); var movementForceCount = packet.ReadInt32("MovementForceCount", index); packet.ResetBitReader(); moveInfo.HasSplineData = packet.ReadBit("HasMovementSpline", index); for (var i = 0; i < movementForceCount; ++i) { packet.ResetBitReader(); packet.ReadPackedGuid128("Id", index); packet.ReadVector3("Origin", index); packet.ReadVector3("Direction", index); packet.ReadInt32("TransportID", index); packet.ReadSingle("Magnitude", index); packet.ReadBits("Type", 2, index); } if (moveInfo.HasSplineData) { packet.ResetBitReader(); packet.ReadInt32("ID", index); packet.ReadVector3("Destination", index); var hasMovementSplineMove = packet.ReadBit("MovementSplineMove", index); if (hasMovementSplineMove) { packet.ResetBitReader(); packet.ReadUInt32E <SplineFlag>("SplineFlags", index); packet.ReadUInt32("Elapsed", index); packet.ReadUInt32("Duration", index); packet.ReadSingle("DurationModifier", index); packet.ReadSingle("NextDurationModifier", index); var face = packet.ReadBits("Face", 2, index); var hasJumpGravity = packet.ReadBit("HasJumpGravity", index); var hasSpecialTime = packet.ReadBit("HasSpecialTime", index); var pointsCount = packet.ReadBits("PointsCount", 16, index); packet.ReadBitsE <SplineMode>("Mode", 2, index); var hasSplineFilterKey = packet.ReadBit("HasSplineFilterKey", index); var hasSpellEffectExtraData = packet.ReadBit("HasSpellEffectExtraData", index); if (hasSplineFilterKey) { packet.ResetBitReader(); var filterKeysCount = packet.ReadUInt32("FilterKeysCount", index); for (var i = 0; i < filterKeysCount; ++i) { packet.ReadSingle("In", index, i); packet.ReadSingle("Out", index, i); } packet.ReadBits("FilterFlags", 2, index); } if (face == 3) { packet.ReadSingle("FaceDirection", index); } if (face == 2) { packet.ReadPackedGuid128("FaceGUID", index); } if (face == 1) { packet.ReadVector3("FaceSpot", index); } if (hasJumpGravity) { packet.ReadSingle("JumpGravity", index); } if (hasSpecialTime) { packet.ReadInt32("SpecialTime", index); } for (var i = 0; i < pointsCount; ++i) { packet.ReadVector3("Points", index, i); } if (hasSpellEffectExtraData) { packet.ReadPackedGuid128("TargetGUID", index); packet.ReadUInt32("SpellVisualID", index); packet.ReadUInt32("ProgressCurveID", index); packet.ReadUInt32("ParabolicCurveID", index); } } } } var pauseTimesCount = packet.ReadUInt32("PauseTimesCount", index); if (hasStationaryPosition) { moveInfo.Position = packet.ReadVector3(); moveInfo.Orientation = packet.ReadSingle(); packet.AddValue("Stationary Position", moveInfo.Position, index); packet.AddValue("Stationary Orientation", moveInfo.Orientation, index); } if (hasCombatVictim) { packet.ReadPackedGuid128("CombatVictim Guid", index); } if (hasServerTime) { packet.ReadUInt32("ServerTime", index); } if (hasVehicleCreate) { moveInfo.VehicleId = packet.ReadUInt32("RecID", index); packet.ReadSingle("InitialRawFacing", index); } if (hasAnimKitCreate) { packet.ReadUInt16("AiID", index); packet.ReadUInt16("MovementID", index); packet.ReadUInt16("MeleeID", index); } if (hasRotation) { moveInfo.Rotation = packet.ReadPackedQuaternion("GameObject Rotation", index); } for (var i = 0; i < pauseTimesCount; ++i) { packet.ReadInt32("PauseTimes", index, i); } if (hasMovementTransport) { packet.ResetBitReader(); moveInfo.TransportGuid = packet.ReadPackedGuid128("TransportGUID", index); moveInfo.TransportOffset = packet.ReadVector4("TransportPosition", index); var seat = packet.ReadByte("VehicleSeatIndex", index); packet.ReadUInt32("MoveTime", index); var hasPrevMoveTime = packet.ReadBit("HasPrevMoveTime", index); var hasVehicleRecID = packet.ReadBit("HasVehicleRecID", index); if (hasPrevMoveTime) { packet.ReadUInt32("PrevMoveTime", index); } if (hasVehicleRecID) { packet.ReadInt32("VehicleRecID", index); } if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory { Entry = moveInfo.TransportGuid.GetEntry(), AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan); } } if (hasAreaTrigger && obj is SpellAreaTrigger) { AreaTriggerTemplate areaTriggerTemplate = new AreaTriggerTemplate { Id = guid.GetEntry() }; SpellAreaTrigger spellAreaTrigger = (SpellAreaTrigger)obj; spellAreaTrigger.AreaTriggerId = guid.GetEntry(); packet.ResetBitReader(); // CliAreaTrigger packet.ReadInt32("ElapsedMs", index); packet.ReadVector3("RollPitchYaw1", index); areaTriggerTemplate.Flags = 0; if (packet.ReadBit("HasAbsoluteOrientation", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasAbsoluteOrientation; } if (packet.ReadBit("HasDynamicShape", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasDynamicShape; } if (packet.ReadBit("HasAttached", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasAttached; } if (packet.ReadBit("HasFaceMovementDir", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.FaceMovementDirection; } if (packet.ReadBit("HasFollowsTerrain", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.FollowsTerrain; } if (packet.ReadBit("Unk bit WoD62x", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.Unk1; } if (packet.ReadBit("HasTargetRollPitchYaw", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasTargetRollPitchYaw; } bool hasScaleCurveID = packet.ReadBit("HasScaleCurveID", index); bool hasMorphCurveID = packet.ReadBit("HasMorphCurveID", index); bool hasFacingCurveID = packet.ReadBit("HasFacingCurveID", index); bool hasMoveCurveID = packet.ReadBit("HasMoveCurveID", index); if (packet.ReadBit("unkbit4C", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.Unk2; } if (packet.ReadBit("unkbit50", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.Unk3; } if (packet.ReadBit("unkbit58", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.Unk4; } if (packet.ReadBit("HasAreaTriggerSphere", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Sphere; } if (packet.ReadBit("HasAreaTriggerBox", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Box; } if (packet.ReadBit("HasAreaTriggerPolygon", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Polygon; } if (packet.ReadBit("HasAreaTriggerCylinder", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Cylinder; } bool hasAreaTriggerSpline = packet.ReadBit("HasAreaTriggerSpline", index); if (packet.ReadBit("HasAreaTriggerUnkType", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.Unk5; } if ((areaTriggerTemplate.Flags & (uint)AreaTriggerFlags.Unk3) != 0) { packet.ReadBit(); } if (hasAreaTriggerSpline) { AreaTriggerHandler.ReadAreaTriggerSpline(packet, index); } if ((areaTriggerTemplate.Flags & (uint)AreaTriggerFlags.HasTargetRollPitchYaw) != 0) { packet.ReadVector3("TargetRollPitchYaw", index); } if (hasScaleCurveID) { spellAreaTrigger.ScaleCurveId = packet.ReadInt32("ScaleCurveID", index); } if (hasMorphCurveID) { spellAreaTrigger.MorphCurveId = packet.ReadInt32("MorphCurveID", index); } if (hasFacingCurveID) { spellAreaTrigger.FacingCurveId = packet.ReadInt32("FacingCurveID", index); } if (hasMoveCurveID) { spellAreaTrigger.MoveCurveId = packet.ReadInt32("MoveCurveID", index); } if ((areaTriggerTemplate.Flags & (int)AreaTriggerFlags.Unk2) != 0) { packet.ReadInt32(); } if ((areaTriggerTemplate.Flags & (int)AreaTriggerFlags.Unk4) != 0) { packet.ReadUInt32(); } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Sphere) { areaTriggerTemplate.Data[0] = packet.ReadSingle("Radius", index); areaTriggerTemplate.Data[1] = packet.ReadSingle("RadiusTarget", index); } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Box) { Vector3 Extents = packet.ReadVector3("Extents", index); Vector3 ExtentsTarget = packet.ReadVector3("ExtentsTarget", index); areaTriggerTemplate.Data[0] = Extents.X; areaTriggerTemplate.Data[1] = Extents.Y; areaTriggerTemplate.Data[2] = Extents.Z; areaTriggerTemplate.Data[3] = ExtentsTarget.X; areaTriggerTemplate.Data[4] = ExtentsTarget.Y; areaTriggerTemplate.Data[5] = ExtentsTarget.Z; } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Polygon) { var verticesCount = packet.ReadInt32("VerticesCount", index); var verticesTargetCount = packet.ReadInt32("VerticesTargetCount", index); List <AreaTriggerTemplateVertices> verticesList = new List <AreaTriggerTemplateVertices>(); areaTriggerTemplate.Data[0] = packet.ReadSingle("Height", index); areaTriggerTemplate.Data[1] = packet.ReadSingle("HeightTarget", index); for (uint i = 0; i < verticesCount; ++i) { AreaTriggerTemplateVertices areaTriggerTemplateVertices = new AreaTriggerTemplateVertices { AreaTriggerId = guid.GetEntry(), Idx = i }; Vector2 vertices = packet.ReadVector2("Vertices", index, i); areaTriggerTemplateVertices.VerticeX = vertices.X; areaTriggerTemplateVertices.VerticeY = vertices.Y; verticesList.Add(areaTriggerTemplateVertices); } for (var i = 0; i < verticesTargetCount; ++i) { Vector2 verticesTarget = packet.ReadVector2("VerticesTarget", index, i); verticesList[i].VerticeTargetX = verticesTarget.X; verticesList[i].VerticeTargetY = verticesTarget.Y; } foreach (AreaTriggerTemplateVertices vertice in verticesList) { Storage.AreaTriggerTemplatesVertices.Add(vertice); } } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Cylinder) { areaTriggerTemplate.Data[0] = packet.ReadSingle("Radius", index); areaTriggerTemplate.Data[1] = packet.ReadSingle("RadiusTarget", index); areaTriggerTemplate.Data[2] = packet.ReadSingle("Height", index); areaTriggerTemplate.Data[3] = packet.ReadSingle("HeightTarget", index); areaTriggerTemplate.Data[4] = packet.ReadSingle("LocationZOffset", index); areaTriggerTemplate.Data[5] = packet.ReadSingle("LocationZOffsetTarget", index); } if ((areaTriggerTemplate.Flags & (uint)AreaTriggerFlags.Unk5) != 0) { packet.ResetBitReader(); var unk1 = packet.ReadBit("AreaTriggerUnk1"); var hasCenter = packet.ReadBit("HasCenter", index); packet.ReadBit("Unk bit 703 1", index); packet.ReadBit("Unk bit 703 2", index); packet.ReadUInt32(); packet.ReadInt32(); packet.ReadUInt32(); packet.ReadSingle("Radius", index); packet.ReadSingle("BlendFromRadius", index); packet.ReadSingle("InitialAngel", index); packet.ReadSingle("ZOffset", index); if (unk1) { packet.ReadPackedGuid128("AreaTriggerUnkGUID", index); } if (hasCenter) { packet.ReadVector3("Center", index); } } Storage.AreaTriggerTemplates.Add(areaTriggerTemplate); } if (hasGameObject) { packet.ResetBitReader(); packet.ReadInt32("WorldEffectID", index); var bit8 = packet.ReadBit("bit8", index); if (bit8) { packet.ReadInt32("Int1", index); } } if (hasSmoothPhasing) { packet.ResetBitReader(); packet.ReadBit("ReplaceActive", index); var replaceObject = packet.ReadBit(); if (replaceObject) { packet.ReadPackedGuid128("ReplaceObject", index); } } if (sceneObjCreate) { packet.ResetBitReader(); var hasSceneLocalScriptData = packet.ReadBit("HasSceneLocalScriptData", index); var petBattleFullUpdate = packet.ReadBit("HasPetBattleFullUpdate", index); if (hasSceneLocalScriptData) { packet.ResetBitReader(); var dataLength = packet.ReadBits(7); packet.ReadWoWString("Data", dataLength, index); } if (petBattleFullUpdate) { V6_0_2_19033.Parsers.BattlePetHandler.ReadPetBattleFullUpdate(packet, index); } } if (playerCreateData) { packet.ResetBitReader(); var hasSceneInstanceIDs = packet.ReadBit("ScenePendingInstances", index); var hasRuneState = packet.ReadBit("Runes", index); if (hasSceneInstanceIDs) { var sceneInstanceIDs = packet.ReadInt32("SceneInstanceIDsCount"); for (var i = 0; i < sceneInstanceIDs; ++i) { packet.ReadInt32("SceneInstanceIDs", index, i); } } if (hasRuneState) { packet.ReadByte("RechargingRuneMask", index); packet.ReadByte("UsableRuneMask", index); var runeCount = packet.ReadUInt32(); for (var i = 0; i < runeCount; ++i) { packet.ReadByte("RuneCooldown", index, i); } } } return(moveInfo); }
private static MovementInfo ReadMovementUpdateBlock(Packet packet, WowGuid guid, object index) { var moveInfo = new MovementInfo(); var guid1 = new byte[8]; var transportGuid = new byte[8]; var goTransportGuid = new byte[8]; var attackingTargetGuid = new byte[8]; var guid5 = new byte[8]; var guid6 = new byte[8]; var guid7 = new byte[8]; var bit160 = false; var bit528 = false; var bit600 = false; var bit544 = false; var bit526 = false; var bit552 = false; var bit524 = false; var bit572 = false; var bit525 = false; var bit664 = false; var bit527 = false; var bit536 = false; var bit644 = false; var bit560 = false; var hasAnimKit1 = false; var hasAnimKit2 = false; var hasAnimKit3 = false; var hasFullSpline = false; var hasSplineStartTime = false; var hasSplineVerticalAcceleration = false; var hasMovementFlags = false; var hasMoveFlagsExtra = false; var hasTimestamp = false; var hasOrientation = false; var hasTransportData = false; var hasTransportTime2 = false; var hasTransportTime3 = false; var hasGOTransportTime2 = false; var hasGOTransportTime3 = false; var hasPitch = false; var hasFallData = false; var hasFallDirection = false; var hasSplineElevation = false; var bits168 = 0u; var splineCount = 0u; var bits138 = 0u; var bits98 = 0u; var bits25C = 0u; var bits26C = 0u; var bits288 = 0u; var bits418 = 0u; var bits2AA = 0u; var splineType = SplineType.Stop; var bit676 = packet.ReadBit("bit676", index); var hasAnimKits = packet.ReadBit("Has Anim Kits", index); // 498 var isLiving = packet.ReadBit("Is Living", index); // 368 var bit810 = packet.ReadBit("bit810", index); packet.ReadBit(); //fake bit var transportFrames = packet.ReadBits("Transport Frames Count", 22, index); // 1068 var hasVehicleData = packet.ReadBit("Has Vehicle Data", index); // 488 var bit1044 = packet.ReadBit("bit1044", index); packet.ReadBit(); //fake bit var bit476 = packet.ReadBit("bit476", index); var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index); // 512 packet.ReadBit(); //fake bit var bit680 = packet.ReadBit("bit680", index); var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index); // 464 var hasSceneObjectData = packet.ReadBit("Has Scene Object Data", index); // 1032 var bit1064 = packet.ReadBit("bit1064", index); packet.ReadBit(); //fake bit var bit668 = packet.ReadBit("bit668", index); var hasTransportPosition = packet.ReadBit("Has Transport Position", index); // 424 var bit681 = packet.ReadBit("bit681", index); var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index); // 448 if (isLiving) { guid1[2] = packet.ReadBit(); var bit140 = packet.ReadBit(); hasPitch = !packet.ReadBit("Has Pitch", index); //104 hasTransportData = packet.ReadBit("Has Transport Data", index); //96 packet.ReadBit(); // 164 fake bit if (hasTransportData) { transportGuid[4] = packet.ReadBit(); transportGuid[2] = packet.ReadBit(); hasTransportTime3 = packet.ReadBit(); transportGuid[0] = packet.ReadBit(); transportGuid[1] = packet.ReadBit(); transportGuid[3] = packet.ReadBit(); transportGuid[6] = packet.ReadBit(); transportGuid[7] = packet.ReadBit(); hasTransportTime2 = packet.ReadBit(); transportGuid[5] = packet.ReadBit(); } hasTimestamp = !packet.ReadBit(); guid1[6] = packet.ReadBit(); guid1[4] = packet.ReadBit(); guid1[3] = packet.ReadBit(); hasOrientation = !packet.ReadBit(); //40 bit160 = !packet.ReadBit(); guid1[5] = packet.ReadBit(); bits98 = packet.ReadBits("bits98", 22, index); //144 hasMovementFlags = !packet.ReadBit(); bits168 = packet.ReadBits(19); //352 /*var bits356 = new uint[bits168]; * for (var i = 0; i < bits168; ++i) * { * bits356[i] = packet.ReadBits(2); * }*/ hasFallData = packet.ReadBit(); //132 if (hasMovementFlags) { moveInfo.Flags = packet.ReadBitsE <MovementFlag>("Movement Flags", 30, index); } hasSplineElevation = !packet.ReadBit("Has SplineElevation", index);//136 moveInfo.HasSplineData = packet.ReadBit("Has SplineData", index); var bit141 = packet.ReadBit(); guid1[0] = packet.ReadBit(); guid1[7] = packet.ReadBit(); guid1[1] = packet.ReadBit(); if (moveInfo.HasSplineData) { hasFullSpline = packet.ReadBit(); if (hasFullSpline) { hasSplineVerticalAcceleration = packet.ReadBit(); //260 hasSplineStartTime = packet.ReadBit(); //252 var bit304 = packet.ReadBit(); splineCount = packet.ReadBits(20); packet.ReadBitsE <SplineMode>("Spline Mode", 2, index); packet.ReadBitsE <SplineFlag434>("Spline flags", 25, index); if (bit304) { bits138 = packet.ReadBits(21); packet.ReadBits(2); } } } hasMoveFlagsExtra = !packet.ReadBit(); //20 if (hasFallData) { hasFallDirection = packet.ReadBit(); //128 } if (hasMoveFlagsExtra) { moveInfo.FlagsExtra = packet.ReadBitsE <MovementFlagExtra>("Extra Movement Flags", 13, index); } } /*if (hasSceneObjectData) * { * * }*/ if (hasTransportPosition) //424 { packet.StartBitStream(goTransportGuid, 4, 1, 0); hasGOTransportTime2 = packet.ReadBit(); // 420 packet.StartBitStream(goTransportGuid, 6, 5, 3, 2, 7); hasGOTransportTime3 = packet.ReadBit(); // 412 } if (bit668) { bit528 = packet.ReadBit(); bit600 = packet.ReadBit(); bit544 = packet.ReadBit(); bit526 = packet.ReadBit(); bit552 = packet.ReadBit(); bit524 = packet.ReadBit(); bit572 = packet.ReadBit(); bit525 = packet.ReadBit(); bit664 = packet.ReadBit(); bit527 = packet.ReadBit(); if (bit664) { bits288 = packet.ReadBits(20); } bit536 = packet.ReadBit(); bit644 = packet.ReadBit(); bit560 = packet.ReadBit(); if (bit664) { bits25C = packet.ReadBits(21); //604 bits26C = packet.ReadBits(21); //624 } } if (hasAnimKits) { hasAnimKit2 = !packet.ReadBit(); hasAnimKit3 = !packet.ReadBit(); hasAnimKit1 = !packet.ReadBit(); } if (hasAttackingTarget) { attackingTargetGuid = packet.StartBitStream(4, 6, 5, 2, 0, 1, 3, 7); } if (bit1064) { bits418 = packet.ReadBits(22); } if (bit810) { bits2AA = packet.ReadBits(7); } packet.ResetBitReader(); for (var i = 0; i < transportFrames; ++i) { packet.ReadInt32("Transport frame", index, i); } /*if (hasSceneObjectData) * { * until if ( *(_BYTE *)(v3 + 668) ) * }*/ if (isLiving) { if (hasTransportData) //96 { packet.ReadXORByte(transportGuid, 7); moveInfo.TransportOffset.X = packet.ReadSingle(); if (hasTransportTime3) { packet.ReadUInt32("Transport Time 3", index); } moveInfo.TransportOffset.O = packet.ReadSingle(); moveInfo.TransportOffset.Y = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 4); packet.ReadXORByte(transportGuid, 1); packet.ReadXORByte(transportGuid, 3); moveInfo.TransportOffset.Z = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 5); if (hasTransportTime2) { packet.ReadUInt32("Transport Time 2", index); } packet.ReadXORByte(transportGuid, 0); var seat = packet.ReadSByte("Transport Seat", index); //72 packet.ReadXORByte(transportGuid, 6); packet.ReadXORByte(transportGuid, 2); packet.ReadUInt32("Transport Time", index); //76 moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0)); packet.AddValue("Transport GUID", moveInfo.TransportGuid, index); packet.AddValue("Transport Position", moveInfo.TransportOffset, index); if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory { Entry = moveInfo.TransportGuid.GetEntry(), AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan); } } packet.ReadXORByte(guid1, 4); /*for (var i = 0; i < 10; ++i) * packet.ReadSingle("unk float"); * if (bits98 > 0) * packet.ReadBits((int)bits98);*/ //for (var i = 0; i < bits98; ++i) // packet.ReadInt32("Int9C", index, i); if (moveInfo.HasSplineData) //344 { if (hasFullSpline) //336 { packet.ReadUInt32("Spline Time", index); //232 packet.ReadSingle("Duration Mod Next", index); //244 // NYI block here packet.ReadSingle("Duration Mod", index); //240 for (uint i = 0; i < splineCount; i++) { Vector3 v = new Vector3(); v.X = packet.ReadSingle(); //0 v.Z = packet.ReadSingle(); //8 v.Y = packet.ReadSingle(); //4 packet.AddValue("Spline", v, index); } if (hasSplineStartTime) { packet.ReadUInt32("Spline Start time", index); //256 } var type = packet.ReadByte(); // 228 switch (type) { case 1: splineType = SplineType.Normal; break; case 2: splineType = SplineType.FacingSpot; break; case 3: splineType = SplineType.FacingTarget; break; case 4: splineType = SplineType.FacingAngle; break; } if (splineType == SplineType.FacingAngle) // == 4 { packet.ReadSingle("Facing Angle", index); } if (splineType == SplineType.FacingSpot) // == 2 { packet.ReadVector3("Facing spot", index); } if (hasSplineVerticalAcceleration) //252 { packet.ReadSingle("Spline Vertical Acceleration", index); } packet.ReadUInt32("Spline FULL Time", index); //236 } moveInfo.Position.X = packet.ReadSingle(); //212 moveInfo.Position.Z = packet.ReadSingle(); //220 packet.ReadUInt32("Spline ID", index); //208 moveInfo.Position.Y = packet.ReadSingle(); //216 } packet.ReadSingle("Fly Speed", index); //188 if (bit160) { packet.ReadUInt32("unk160"); } packet.ReadXORByte(guid1, 2); if (hasFallData) //132 { if (hasFallDirection) //128 { packet.ReadSingle("Jump Sin Angle", index); //124 packet.ReadSingle("Jump XY Speed", index); //116 packet.ReadSingle("Jump Cos Angle", index); //120 } packet.ReadUInt32("Jump Fall Time", index); //108 packet.ReadSingle("Jump Z Speed", index); //112 } packet.ReadXORByte(guid1, 1); packet.ReadSingle("Turn Speed", index); if (hasTimestamp) { packet.ReadUInt32("Time?", index); } packet.ReadSingle("Swim Speed", index); //176 if (hasSplineElevation) //136 { packet.ReadSingle("Spline Elevation", index); //196 } packet.ReadXORByte(guid1, 7); packet.ReadSingle("Pitch Speed", index); //200 for (var i = 0; i < bits98; ++i) { packet.ReadInt32("UNK counter", index, i); } moveInfo.Position.X = packet.ReadSingle(); //28 if (hasPitch) { packet.ReadSingle("Pitch", index); //104 } if (hasOrientation) { moveInfo.Orientation = packet.ReadSingle("Orientation", index); //40 } moveInfo.WalkSpeed = packet.ReadSingle("Walk Speed", index) / 2.5f; // 168 moveInfo.Position.Y = packet.ReadSingle(); //32 packet.ReadSingle("Fly Back Speed", index); //192 packet.ReadXORByte(guid1, 3); packet.ReadXORByte(guid1, 5); packet.ReadXORByte(guid1, 6); packet.ReadXORByte(guid1, 0); packet.ReadSingle("Run Back Speed", index); //184 moveInfo.RunSpeed = packet.ReadSingle("Run Speed", index) / 7.0f; //172 packet.ReadSingle("Swim Back Speed", index); //180 moveInfo.Position.Z = packet.ReadSingle(); //36 } packet.AddValue("Position", moveInfo.Position, index); if (bit668) { if (bit664) { for (var i = 0; i < bits288; ++i) { packet.ReadSingle("Float652+4", index, i); packet.ReadSingle("Float652", index, i); packet.ReadSingle("Float652+8", index, i); } } if (bit600) { packet.ReadSingle("Float584", index); packet.ReadSingle("Float580", index); packet.ReadSingle("Float596", index); packet.ReadSingle("Float592", index); packet.ReadSingle("Float576", index); packet.ReadSingle("Float588", index); } if (bit644) { for (var i = 0; i < bits25C; ++i) { packet.ReadSingle("Float608", index, i); packet.ReadSingle("Float608+4", index, i); } for (var i = 0; i < bits26C; ++i) { packet.ReadSingle("Float260+0", index, i); packet.ReadSingle("Float260+1", index, i); } packet.ReadSingle("Float624", index); packet.ReadSingle("Float624+4", index); } packet.ReadUInt32("unk520", index); if (bit544) { packet.ReadUInt32("unk544", index); } if (bit552) { packet.ReadUInt32("unk548", index); } if (bit536) { packet.ReadUInt32("unk532", index); } if (bit560) { packet.ReadUInt32("unk556", index); } if (bit572) { packet.ReadSingle("Float564", index); packet.ReadSingle("Float568", index); } } if (hasTransportPosition) { if (hasGOTransportTime2) { packet.ReadUInt32("Transport Time 2", index); } moveInfo.TransportOffset.Y = packet.ReadSingle(); //388 packet.ReadSByte("Transport Seat", index); //400 moveInfo.TransportOffset.X = packet.ReadSingle(); //384 packet.ReadXORBytes(goTransportGuid, 2, 4, 1); if (hasGOTransportTime3) { packet.ReadUInt32("Transport Time 3", index); //412 } packet.ReadUInt32("Transport Time", index); //404 moveInfo.TransportOffset.O = packet.ReadSingle(); //396 moveInfo.TransportOffset.Z = packet.ReadSingle(); //392 packet.ReadXORBytes(goTransportGuid, 6, 0, 5, 3, 7); moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(goTransportGuid, 0)); packet.AddValue("Transport GUID", moveInfo.TransportGuid, index); packet.AddValue("Transport Position", moveInfo.TransportOffset, index); } if (hasAttackingTarget) { packet.ParseBitStream(attackingTargetGuid, 7, 1, 5, 2, 6, 3, 0, 4); packet.WriteGuid("Attacking Target GUID", attackingTargetGuid, index); } if (hasVehicleData) { moveInfo.VehicleId = packet.ReadUInt32("Vehicle Id", index); packet.ReadSingle("Vehicle Orientation", index); } if (hasStationaryPosition) { moveInfo.Position.Y = packet.ReadSingle(); moveInfo.Position.Z = packet.ReadSingle(); moveInfo.Orientation = packet.ReadSingle("Stationary Orientation", index); moveInfo.Position.X = packet.ReadSingle(); packet.AddValue("Stationary Position", moveInfo.Position, index); } if (bit676) { packet.ReadUInt32("unk672"); } if (hasAnimKits) { if (hasAnimKit1) { packet.ReadUInt16("Anim Kit 1", index); } if (hasAnimKit3) { packet.ReadUInt16("Anim Kit 3", index); } if (hasAnimKit2) { packet.ReadUInt16("Anim Kit 2", index); } } if (bit810) { packet.ReadBytes("Bytes", (int)bits2AA); } if (bit476) { packet.ReadUInt32("unk472"); } if (bit1064) { for (var i = 0; i < bits418; ++i) { packet.ReadInt32("unk1052+4", index, i); } } if (hasGameObjectRotation) { moveInfo.Rotation = packet.ReadPackedQuaternion("GameObject Rotation", index); } if (bit1044) { packet.ReadInt32("unk1040", index); } if (isLiving && moveInfo.HasSplineData && hasFullSpline && splineType == SplineType.FacingTarget) { var facingTargetGuid = new byte[8]; packet.StartBitStream(facingTargetGuid, 4, 7, 0, 5, 1, 2, 3, 6); packet.ParseBitStream(facingTargetGuid, 4, 2, 0, 5, 6, 3, 1, 7); packet.WriteGuid("Facing Target GUID", facingTargetGuid, index); } return(moveInfo); }
private static MovementInfo ReadMovementUpdateBlock(Packet packet, WowGuid guid, object index) { var moveInfo = new MovementInfo(); var guid1 = new byte[8]; var transportGuid = new byte[8]; var goTransportGuid = new byte[8]; var attackingTargetGuid = new byte[8]; var hasAnimKit1 = false; var hasAnimKit2 = false; var hasAnimKit3 = false; var hasFullSpline = false; var hasSplineStartTime = false; var hasSplineVerticalAcceleration = false; var hasGOTransportTime2 = false; var hasGOTransportTime3 = false; var hasSplineElevation = false; var hasMovementFlags = false; var hasMoveFlagsExtra = false; var hasTimestamp = false; var hasOrientation = false; var hasTransportData = false; var hasTransportTime3 = false; var hasTransportTime2 = false; var hasPitch = false; var hasFallData = false; var hasFallDirection = false; var bit130 = false; var bitA0 = false; var bit23C = false; var bit298 = false; var bit230 = false; var bit284 = false; var bit228 = false; var bit258 = false; var bit218 = false; var bit220 = false; var bits160 = 0u; var splineCount = 0u; var bits11C = 0u; var bits90 = 0u; var bits25C = 0u; var bits26C = 0u; var bits288 = 0u; var bits418 = 0u; var bits2AA = 0u; SplineType splineType = SplineType.Stop; var hasVehicleData = packet.ReadBit("Has Vehicle Data", index); var bit2A8 = packet.ReadBit(); packet.ReadBit(); // fake 0 var bit1DC = packet.ReadBit(); packet.ReadBit(); // fake 2 var bit2A9 = packet.ReadBit(); var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index); var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index); var bit29C = packet.ReadBit(); var bit428 = packet.ReadBit(); var hasSceneObjectData = packet.ReadBit("Has Scene Object Data", index); packet.ReadBit(); // fake 1 var bit32A = packet.ReadBit(); var transportFrames = packet.ReadBits("Transport Frames Count", 22, index); var isLiving = packet.ReadBit("Is Living", index); var hasGameObjectPosition = packet.ReadBit("Has GameObject Position", index); packet.ReadBit(); // fake 3 var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index); var bit2A4 = packet.ReadBit(); var bit414 = packet.ReadBit(); var hasAnimKits = packet.ReadBit("Has Anim Kits", index); if (isLiving) { guid1[5] = packet.ReadBit(); packet.ReadBit("bit8D", index); hasPitch = !packet.ReadBit(); guid1[6] = packet.ReadBit(); packet.ReadBit("bitA4", index); bits160 = packet.ReadBits(19); for (var i = 0; i < bits160; ++i) { packet.ReadBits("bits164", 2, index, i); } guid1[4] = packet.ReadBit(); hasOrientation = !packet.ReadBit(); hasMoveFlagsExtra = !packet.ReadBit(); bitA0 = !packet.ReadBit(); packet.StartBitStream(guid1, 2, 3, 7); bits90 = packet.ReadBits(22); hasMovementFlags = !packet.ReadBit(); hasTimestamp = !packet.ReadBit(); hasSplineElevation = !packet.ReadBit(); guid1[1] = packet.ReadBit(); hasFallData = packet.ReadBit(); packet.ReadBit("bit8C", index); if (hasMoveFlagsExtra) { moveInfo.FlagsExtra = packet.ReadBitsE <MovementFlagExtra>("Extra Movement Flags", 13, index); } guid1[0] = packet.ReadBit(); moveInfo.HasSplineData = packet.ReadBit(); if (moveInfo.HasSplineData) { hasFullSpline = packet.ReadBit(); if (hasFullSpline) { packet.ReadBitsE <SplineFlag434>("Spline flags", 25, index); hasSplineStartTime = packet.ReadBit("Has Spline Start Time", index); splineCount = packet.ReadBits("SplineWaypointsCount", 20, index); bit130 = packet.ReadBit(); if (bit130) { bits11C = packet.ReadBits(21); packet.ReadBits("bits12C", 2, index); } packet.ReadBitsE <SplineMode>("Spline Mode", 2, index); hasSplineVerticalAcceleration = packet.ReadBit("has Spline Vertical Acceleration", index); } } hasTransportData = packet.ReadBit(); if (hasTransportData) { packet.StartBitStream(transportGuid, 6, 1, 2, 5); hasTransportTime3 = packet.ReadBit(); packet.StartBitStream(transportGuid, 4, 7, 0); hasTransportTime2 = packet.ReadBit(); packet.StartBitStream(transportGuid, 3); } if (hasMovementFlags) { moveInfo.Flags = packet.ReadBitsE <MovementFlag>("Movement Flags", 30, index); } if (hasFallData) { hasFallDirection = packet.ReadBit(); } } if (hasGameObjectPosition) { hasGOTransportTime3 = packet.ReadBit(); hasGOTransportTime2 = packet.ReadBit(); packet.StartBitStream(goTransportGuid, 4, 2, 7, 6, 3, 0, 1, 5); } // Sceneobject data var CreatorGUID = new byte[8]; byte[][] guid358 = null; byte[][][] guid358_6 = null; uint[] bits358_10 = null; uint[][] bits358_6_84 = null; uint[][] bits358_6_94 = null; uint[][] bits358_6_31 = null; uint[][] bits358_6_74 = null; byte[][][] bit358_6_78_9 = null; byte[][][] bit358_6_88_10 = null; bool[][][] bit358_6_88_C = null; bool[][][] bit358_6_88_8 = null; bool[][] bit358_6_2E = null; bool[][] bit358_6_30 = null; bool[] bit358_A = null; bool[] bit358_E = null; bool[] bit358_22 = null; var bit338 = false; var bit330 = false; var bit341 = false; var bit340 = false; var bit332 = false; var bit33C = false; uint[] bits388 = null; uint[] bits388_10 = null; byte[][] bit388_1_10 = null; bool[][] bit388_1_C = null; bool[][] bit388_1_8 = null; if (hasSceneObjectData) { guid358 = new byte[2][]; guid358_6 = new byte[2][][]; bits358_10 = new uint[2]; bits358_6_84 = new uint[2][]; bits358_6_94 = new uint[2][]; bits358_6_31 = new uint[2][]; bits358_6_74 = new uint[2][]; bit358_6_78_9 = new byte[2][][]; bit358_6_88_10 = new byte[2][][]; bit358_6_88_C = new bool[2][][]; bit358_6_88_8 = new bool[2][][]; bit358_6_2E = new bool[2][]; bit358_6_30 = new bool[2][]; bit358_A = new bool[2]; bit358_E = new bool[2]; bit358_22 = new bool[2]; bit332 = !packet.ReadBit(); packet.ReadBit("bit350", index); for (var i = 0; i < 2; ++i) { guid358[i] = new byte[8]; packet.StartBitStream(guid358[i], 5, 2); bit358_A[i] = !packet.ReadBit(); bits358_10[i] = packet.ReadBits(2); guid358_6[i] = new byte[bits358_10[i]][]; bits358_6_84[i] = new uint[bits358_10[i]]; bits358_6_94[i] = new uint[bits358_10[i]]; bits358_6_31[i] = new uint[bits358_10[i]]; bits358_6_74[i] = new uint[bits358_10[i]]; bit358_6_78_9[i] = new byte[bits358_10[i]][]; bit358_6_88_10[i] = new byte[bits358_10[i]][]; bit358_6_88_C[i] = new bool[bits358_10[i]][]; bit358_6_88_8[i] = new bool[bits358_10[i]][]; bit358_6_2E[i] = new bool[bits358_10[i]]; bit358_6_30[i] = new bool[bits358_10[i]]; for (var j = 0; j < bits358_10[i]; ++j) { guid358_6[i][j] = new byte[8]; bits358_6_74[i][j] = packet.ReadBits(20); bits358_6_31[i][j] = packet.ReadBits(7); bit358_6_78_9[i][j] = new byte[bits358_6_74[i][j]]; for (var k = 0; k < bits358_6_74[i][j]; ++k) { bit358_6_78_9[i][j][k] = (byte)(10 - packet.ReadBit()); } guid358_6[i][j][5] = packet.ReadBit(); bits358_6_94[i][j] = packet.ReadBits(21); packet.StartBitStream(guid358_6[i][j], 1, 3, 2, 4, 7); bit358_6_2E[i][j] = !packet.ReadBit(); bit358_6_30[i][j] = packet.ReadBit(); guid358_6[i][j][0] = packet.ReadBit(); bits358_6_84[i][j] = packet.ReadBits(21); bit358_6_88_8[i][j] = new bool[bits358_6_84[i][j]]; bit358_6_88_C[i][j] = new bool[bits358_6_84[i][j]]; bit358_6_88_10[i][j] = new byte[bits358_6_84[i][j]]; for (var k = 0; k < bits358_6_84[i][j]; ++k) { bit358_6_88_10[i][j][k] = (byte)(10 - packet.ReadBit()); bit358_6_88_C[i][j][k] = !packet.ReadBit(); bit358_6_88_8[i][j][k] = !packet.ReadBit(); } guid358_6[i][j][6] = packet.ReadBit(); } bit358_E[i] = !packet.ReadBit(); bit358_22[i] = !packet.ReadBit(); packet.StartBitStream(guid358[i], 4, 1, 7, 3, 6, 0); } packet.ReadBit(); // fake bit packet.StartBitStream(CreatorGUID, 7, 3, 2, 4, 0, 5, 6, 1); bits388 = new uint[3]; bits388_10 = new uint[3]; bit388_1_10 = new byte[3][]; bit388_1_C = new bool[3][]; bit388_1_8 = new bool[3][]; for (var i = 0; i < 3; ++i) { bits388[i] = packet.ReadBits(21); bit388_1_10[i] = new byte[bits388[i]]; bit388_1_C[i] = new bool[bits388[i]]; bit388_1_8[i] = new bool[bits388[i]]; for (var j = 0; j < bits388[i]; ++j) { bit388_1_8[i][j] = !packet.ReadBit(); bit388_1_10[i][j] = (byte)(10 - packet.ReadBit()); bit388_1_C[i][j] = !packet.ReadBit(); } bits388_10[i] = packet.ReadBits(21); } packet.ReadBit("bit351", index); bit340 = !packet.ReadBit(); bit330 = !packet.ReadBit(); bit33C = !packet.ReadBit(); bit341 = !packet.ReadBit(); bit338 = !packet.ReadBit(); } if (bit29C) { packet.ReadBit("bit20F", index); bit230 = packet.ReadBit(); bit23C = packet.ReadBit(); packet.ReadBit("bit20C", index); bit228 = packet.ReadBit(); bit218 = packet.ReadBit(); packet.ReadBit("bit20D", index); packet.ReadBit("bit20E", index); bit298 = packet.ReadBit(); bit220 = packet.ReadBit(); bit284 = packet.ReadBit(); if (bit284) { bits26C = packet.ReadBits(21); bits25C = packet.ReadBits(21); } packet.ReadBit("bit210", index); if (bit298) { bits288 = packet.ReadBits(20); } bit258 = packet.ReadBit(); } if (hasAttackingTarget) { packet.StartBitStream(attackingTargetGuid, 4, 0, 6, 2, 1, 5, 3, 7); } if (bit428) { bits418 = packet.ReadBits(22); } if (bit32A) { bits2AA = packet.ReadBits(7); } if (hasAnimKits) { hasAnimKit1 = !packet.ReadBit(); hasAnimKit2 = !packet.ReadBit(); hasAnimKit3 = !packet.ReadBit(); } packet.ResetBitReader(); for (var i = 0; i < transportFrames; ++i) { packet.ReadInt32("Transport frame", index, i); } if (hasGameObjectPosition) { packet.ReadSByte("GO Transport Seat", index); if (hasGOTransportTime2) { packet.ReadUInt32("GO Transport Time 2", index); } packet.ReadXORBytes(goTransportGuid, 4, 3); if (hasGOTransportTime3) { packet.ReadUInt32("GO Transport Time 3", index); } packet.ReadXORBytes(goTransportGuid, 7, 6, 5, 0); moveInfo.TransportOffset.Z = packet.ReadSingle(); moveInfo.TransportOffset.X = packet.ReadSingle(); packet.ReadUInt32("GO Transport Time", index); moveInfo.TransportOffset.O = packet.ReadSingle(); packet.ReadXORByte(goTransportGuid, 1); moveInfo.TransportOffset.Y = packet.ReadSingle(); packet.ReadXORByte(goTransportGuid, 2); moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(goTransportGuid, 0)); packet.AddValue("GO Transport GUID", moveInfo.TransportGuid, index); packet.AddValue("GO Transport Position", moveInfo.TransportOffset, index); } if (isLiving) { if (hasTransportData) { packet.ReadXORBytes(transportGuid, 0, 5); moveInfo.TransportOffset.O = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 1); moveInfo.TransportOffset.Y = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 2); packet.ReadUInt32("Transport Time", index); moveInfo.TransportOffset.Z = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 7); if (hasTransportTime2) { packet.ReadUInt32("Transport Time 2", index); } packet.ReadXORBytes(transportGuid, 6, 4); moveInfo.TransportOffset.X = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 3); var seat = packet.ReadSByte("Transport Seat", index); if (hasTransportTime3) { packet.ReadUInt32("Transport Time 3", index); } moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0)); packet.AddValue("Transport GUID", moveInfo.TransportGuid, index); packet.AddValue("Transport Position", moveInfo.TransportOffset, index); if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory { Entry = moveInfo.TransportGuid.GetEntry(), AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan); } } if (moveInfo.HasSplineData) { if (hasFullSpline) { if (bit130) { for (var i = 0; i < bits11C; ++i) { packet.ReadSingle("Float13C+1", index, i); packet.ReadSingle("Float13C+0", index, i); } } packet.ReadSingle("Spline Duration Multiplier Next", index); for (var i = 0u; i < splineCount; ++i) { var wp = new Vector3 { Y = packet.ReadSingle(), Z = packet.ReadSingle(), X = packet.ReadSingle() }; packet.AddValue("Spline Waypoint", wp, index, i); } packet.ReadInt32("Spline Time", index); // if need swap with "Spline Full Time" var type = packet.ReadByte(); switch (type) { case 1: splineType = SplineType.Normal; break; case 2: splineType = SplineType.FacingSpot; break; case 3: splineType = SplineType.FacingTarget; break; case 4: splineType = SplineType.FacingAngle; break; } if (splineType == SplineType.FacingAngle) { packet.ReadSingle("Facing Angle", index); } packet.ReadSingle("Spline Duration Multiplier", index); // if need swap with "Spline Duration Multiplier Next" if (hasSplineStartTime) { packet.ReadInt32("Spline Start Time", index); } if (hasSplineVerticalAcceleration) { packet.ReadSingle("Spline Vertical Acceleration", index); } if (splineType == SplineType.FacingSpot) { var point = new Vector3 { Y = packet.ReadSingle(), Z = packet.ReadSingle(), X = packet.ReadSingle() }; packet.AddValue("Facing Spot", point, index); } packet.ReadInt32("Spline Full Time", index); } packet.ReadInt32("Spline Id", index); moveInfo.Position.Y = packet.ReadSingle(); moveInfo.Position.Z = packet.ReadSingle(); moveInfo.Position.X = packet.ReadSingle(); } moveInfo.Position.Y = packet.ReadSingle(); packet.ReadXORByte(guid1, 7); for (var i = 0; i < bits160; ++i) { packet.ReadSingle("Float14", index, i); packet.ReadUInt32("Int0", index, i); packet.ReadUInt32("Int10", index, i); packet.ReadSingle("Float4", index, i); packet.ReadSingle("Float8", index, i); packet.ReadSingle("FloatC", index, i); } if (hasFallData) { packet.ReadUInt32("Time Fallen", index); if (hasFallDirection) { packet.ReadSingle("Jump Sin", index); packet.ReadSingle("Jump Cos", index); packet.ReadSingle("Jump Velocity", index); } packet.ReadSingle("Fall Start Velocity", index); } if (hasSplineElevation) { packet.ReadSingle("Spline Elevation", index); } if (bitA0) { packet.ReadInt32("Int98", index); } packet.ReadXORByte(guid1, 1); packet.ReadSingle("Turn Speed", index); packet.ReadSingle("FlyBack Speed", index); packet.ReadSingle("RunBack Speed", index); if (hasTimestamp) { packet.ReadUInt32("Time", index); } moveInfo.Position.X = packet.ReadSingle(); packet.ReadXORByte(guid1, 2); packet.ReadSingle("Swim Speed", index); packet.ReadSingle("SwimBack Speed", index); if (hasOrientation) { moveInfo.Orientation = packet.ReadSingle(); } packet.ReadSingle("Fly Speed", index); packet.ReadXORByte(guid1, 6); if (hasPitch) { packet.ReadSingle("Pitch", index); } moveInfo.RunSpeed = packet.ReadSingle("Run Speed", index) / 7.0f; packet.ReadSingle("Pitch Speed", index); packet.ReadXORBytes(guid1, 0, 5); for (var i = 0; i < bits90; ++i) { packet.ReadInt32("Int8C", index, i); } packet.ReadXORByte(guid1, 4); moveInfo.WalkSpeed = packet.ReadSingle("Walk Speed", index) / 2.5f; moveInfo.Position.Z = packet.ReadSingle(); packet.ReadXORByte(guid1, 3); packet.WriteGuid("GUID1", guid1, index); packet.AddValue("Position", moveInfo.Position, index); packet.AddValue("Orientation", moveInfo.Orientation, index); } if (hasSceneObjectData) { for (var i = 0; i < 2; ++i) { if (bit358_22[i]) { packet.ReadByte("byte358+22", index, i); } packet.ReadByte("byte358+23", index, i); for (var j = 0; j < bits358_10[i]; ++j) { packet.ReadXORByte(guid358_6[i][j], 7); packet.ReadInt32("int358+6+1C", index, i, j); packet.ReadWoWString("string358+6+31", (int)bits358_6_31[i][j], index, i, j); for (var k = 0; k < bits358_6_74[i][j]; ++k) { packet.ReadInt16("short358+6+78+6", index, i, j, k); packet.ReadInt32("int358+6+78+0", index, i, j, k); if (bit358_6_78_9[i][j][k] != 9) { packet.ReadByte("byte358+6+78+9", index, i, j, k); } packet.ReadInt16("short358+6+78+4", index, i, j, k); packet.ReadByte("byte358+6+78+8", index, i, j, k); } for (var k = 0; k < bits358_6_94[i][j]; ++k) { packet.ReadInt32("int358+6+98+4", index, i, j, k); packet.ReadInt32("int358+6+98+0", index, i, j, k); } packet.ReadXORByte(guid358_6[i][j], 6); packet.ReadInt16("short358+6+2C", index, i, j); if (bit358_6_2E[i][j]) { packet.ReadInt16("short358+6+2E", index, i, j); } for (var k = 0; k < bits358_6_84[i][j]; ++k) { if (bit358_6_88_10[i][j][k] != 9) { packet.ReadByte("byte358+6+88+10", index, i, j, k); } if (bit358_6_88_8[i][j][k]) { packet.ReadInt32("int358+6+88+8", index, i, j, k); } packet.ReadInt32("int358+6+88+0", index, i, j, k); packet.ReadInt32("int358+6+88+4", index, i, j, k); if (bit358_6_88_C[i][j][k]) { packet.ReadInt32("int358+6+88+C", index, i, j, k); } } packet.ReadInt16("short358+6+16", index, i, j); packet.ReadInt32("int358+6+8", index, i, j); packet.ReadInt16("short358+6+14", index, i, j); packet.ReadInt32("int358+6+24", index, i, j); if (!bit358_6_30[i][j]) { packet.ReadByte("byte358+6+30", index, i, j); } packet.ReadInt32("int358+6+10", index, i, j); packet.ReadXORByte(guid358_6[i][j], 3); packet.ReadInt32("int358+6+28", index, i, j); packet.ReadInt32("int358+6+18", index, i, j); packet.ReadXORBytes(guid358_6[i][j], 0, 2, 4, 5); packet.ReadInt32("int358+6+C", index, i, j); packet.ReadInt32("int358+6+20", index, i, j); packet.ReadXORByte(guid358_6[i][j], 1); packet.WriteGuid("Guid 358_6", guid358_6[i][j], index, i, j); } packet.ReadXORBytes(guid358[i], 7, 1, 4); if (bit358_E[i]) { packet.ReadInt16("short358+E", index, i); } if (bit358_A[i]) { packet.ReadInt32("int358+A", index, i); } packet.ReadXORBytes(guid358[i], 0, 5, 2, 3); packet.ReadInt32("int358+8", index, i); packet.ReadXORByte(guid358[i], 6); packet.WriteGuid("Guid358", guid358[i], index, i); } for (var i = 0; i < 3; ++i) { for (var j = 0; j < bits388[i]; ++j) { if (bit388_1_C[i][j]) { packet.ReadInt32("int388+1+C", index, i, j); } packet.ReadInt32("int388+1+4", index, i, j); packet.ReadInt32("int388+1+0", index, i, j); if (bit388_1_10[i][j] != 9) { packet.ReadByte("byte388+1+10", index, i, j); } if (bit388_1_8[i][j]) { packet.ReadInt32("int388+1+8", index, i, j); } } for (var j = 0; j < bits388_10[i]; ++j) { packet.ReadInt32("int388+6+4", index, i, j); packet.ReadInt32("int388+6+0", index, i, j); } } packet.ReadInt32("Int334", index); packet.ParseBitStream(CreatorGUID, 1, 6, 0, 5, 7, 4, 3, 2); if (bit340) { packet.ReadByte("Byte340", index); } if (bit341) { packet.ReadByte("byte341", index); } if (bit338) { packet.ReadInt32("int338", index); } if (bit332) { packet.ReadInt16("Short332", index); } if (bit33C) { packet.ReadInt32("int33C", index); } if (bit330) { packet.ReadInt16("Short318", index); } packet.WriteGuid("Creator GUID", CreatorGUID, index); } if (hasStationaryPosition) { moveInfo.Position.X = packet.ReadSingle(); moveInfo.Position.Z = packet.ReadSingle(); moveInfo.Position.Y = packet.ReadSingle(); moveInfo.Orientation = packet.ReadSingle("Stationary Orientation", index); packet.AddValue("Stationary Position", moveInfo.Position, index); } if (hasAttackingTarget) { packet.ParseBitStream(attackingTargetGuid, 1, 3, 5, 4, 7, 6, 2, 0); packet.WriteGuid("Attacking GUID", attackingTargetGuid, index); } if (bit29C) { if (bit230) { packet.ReadInt32("int22C", index); } if (bit258) { packet.ReadSingle("Float240", index); packet.ReadSingle("Float24C", index); packet.ReadSingle("Float250", index); packet.ReadSingle("Float244", index); packet.ReadSingle("Float254", index); packet.ReadSingle("Float248", index); } packet.ReadInt32("Int208", index); if (bit23C) { packet.ReadSingle("Float234", index); packet.ReadSingle("Float238", index); } if (bit220) { packet.ReadInt32("int21C", index); } if (bit284) { packet.ReadSingle("Float27C", index); packet.ReadSingle("Float280", index); for (var i = 0; i < bits25C; ++i) { packet.ReadSingle("Float260+0", index, i); packet.ReadSingle("Float260+1", index, i); } for (var i = 0; i < bits26C; ++i) { packet.ReadSingle("Float270+1", index, i); packet.ReadSingle("Float270+0", index, i); } } if (bit218) { packet.ReadInt32("int214", index); } if (bit298) { for (var i = 0; i < bits288; ++i) { packet.ReadSingle("Float28C+0", index, i); packet.ReadSingle("Float28C+1", index, i); packet.ReadSingle("Float28C+2", index, i); } } if (bit228) { packet.ReadInt32("int224", index); } } if (bit1DC) { packet.ReadInt32("int1D8", index); } if (hasAnimKits) { if (hasAnimKit2) { packet.ReadUInt16("Anim Kit 2", index); } if (hasAnimKit3) { packet.ReadUInt16("Anim Kit 3", index); } if (hasAnimKit1) { packet.ReadUInt16("Anim Kit 1", index); } } if (hasGameObjectRotation) { moveInfo.Rotation = packet.ReadPackedQuaternion("GameObject Rotation", index); } if (hasVehicleData) { moveInfo.VehicleId = packet.ReadUInt32("Vehicle Id", index); packet.ReadSingle("Vehicle Orientation", index); } if (bit32A) { packet.ReadBytes("Bytes", (int)bits2AA); } if (bit414) { packet.ReadInt32("int410", index); } if (bit2A4) { packet.ReadInt32("int2A0", index); } if (bit428) { for (var i = 0; i < bits418; ++i) { packet.ReadInt32("Int3F8", index, i); } } if (isLiving && moveInfo.HasSplineData && hasFullSpline && splineType == SplineType.FacingTarget) { var facingTargetGuid = new byte[8]; facingTargetGuid = packet.StartBitStream(5, 0, 2, 4, 1, 3, 6, 7); packet.ParseBitStream(facingTargetGuid, 5, 0, 4, 6, 3, 2, 1, 7); packet.WriteGuid("Facing Target GUID", facingTargetGuid, index); } return(moveInfo); }
private static MovementInfo ReadMovementUpdateBlock(Packet packet, WowGuid guid, object index) { var moveInfo = new MovementInfo(); var guid1 = new byte[8]; var transportGuid = new byte[8]; var goTransportGuid = new byte[8]; var attackingTargetGuid = new byte[8]; var guid5 = new byte[8]; var guid6 = new byte[8]; var guid7 = new byte[8]; var hasAnimKit1 = false; var hasAnimKit2 = false; var hasAnimKit3 = false; var hasFullSpline = false; var hasSplineStartTime = false; var hasSplineVerticalAcceleration = false; var hasGOTransportTime2 = false; var hasGOTransportTime3 = false; var hasSplineElevation = false; var hasMovementFlags = false; var hasMoveFlagsExtra = false; var hasTimestamp = false; var hasOrientation = false; var hasTransportData = false; var hasTransportTime3 = false; var hasTransportTime2 = false; var hasPitch = false; var hasFallData = false; var hasFallDirection = false; var bit95 = false; var bit94 = false; var bit134 = false; var bitA8 = false; var bit228 = false; var bit270 = false; var bit21C = false; var bit244 = false; var bits168 = 0u; var splineCount = 0u; var bits138 = 0u; var bits98 = 0u; var bits248 = 0u; var bits258 = 0u; var bits274 = 0u; var bits3F4 = 0u; var bits28F = 0u; var splineType = SplineType.Stop; packet.ReadBit(); var transportFrames = packet.ReadBits(22); var hasVehicleData = packet.ReadBit("Has Vehicle Data", index); var bit3F0 = packet.ReadBit(); var hasGameObjectPosition = packet.ReadBit("Has GameObject Position", index); packet.ReadBit(); // fake bit var isSceneObject = packet.ReadBit("Scene Object", index); var transport = packet.ReadBit("On transport", index); var bit284 = packet.ReadBit(); var bit208 = packet.ReadBit(); var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index); var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index); packet.ReadBit(); // fake bit packet.ReadBit(); // fake bit packet.ReadBit("Self", index); packet.ReadBit(); // fake bit var living = packet.ReadBit("Living", index); var bit3E8 = packet.ReadBit(); // something with scene object var bit28E = packet.ReadBit(); var hasAnimKits = packet.ReadBit("Has AnimKits", index); var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index); if (living) { guid1[0] = packet.ReadBit(); hasSplineElevation = !packet.ReadBit(); packet.StartBitStream(guid1, 4, 7); hasMoveFlagsExtra = !packet.ReadBit(); packet.StartBitStream(guid1, 5, 2); moveInfo.HasSplineData = packet.ReadBit("Has spline data", index); hasMovementFlags = !packet.ReadBit(); hasTimestamp = !packet.ReadBit("Lacks timestamp", index); bit95 = packet.ReadBit(); bit94 = packet.ReadBit(); hasOrientation = !packet.ReadBit(); if (hasMovementFlags) { moveInfo.Flags = (uint)packet.ReadBitsE <MovementFlag>("Movement Flags", 30, index); } hasTransportData = packet.ReadBit("Has Transport Data", index); if (hasTransportData) { packet.StartBitStream(transportGuid, 1, 0, 6); hasTransportTime3 = packet.ReadBit(); packet.StartBitStream(transportGuid, 2, 7, 4, 3); hasTransportTime2 = packet.ReadBit(); transportGuid[5] = packet.ReadBit(); } hasPitch = !packet.ReadBit("Lacks pitch", index); guid1[6] = packet.ReadBit(); bits168 = packet.ReadBits(19); for (var i = 0; i < bits168; ++i) { packet.ReadBits("bits168", 2, index); } guid1[1] = packet.ReadBit(); if (moveInfo.HasSplineData) { hasFullSpline = packet.ReadBit(); if (hasFullSpline) { hasSplineStartTime = packet.ReadBit(); bit134 = packet.ReadBit(); packet.ReadBitsE <SplineMode>("Spline Mode", 2, index); splineCount = packet.ReadBits("SplineWaypointsCount", 20, index); hasSplineVerticalAcceleration = packet.ReadBit("Has Spline Vertical Acceleration", index); if (bit134) { bits138 = packet.ReadBits(21); packet.ReadBits("bits148", 2, index); } packet.ReadBitsE <SplineFlag434>("Spline flags", 25, index); } } bitA8 = !packet.ReadBit(); guid1[3] = packet.ReadBit(); bits98 = packet.ReadBits(22); if (hasMoveFlagsExtra) { moveInfo.Flags2 = (uint)packet.ReadBitsE <MovementFlag2>("Extra Movement Flags", 13, index); } hasFallData = packet.ReadBit("Has Fall Data", index); if (hasFallData) { hasFallDirection = packet.ReadBit("Has Fall Direction", index); } packet.ReadBit("bitAC", index); } if (hasGameObjectPosition) { packet.StartBitStream(goTransportGuid, 7, 3); hasGOTransportTime2 = packet.ReadBit(); packet.StartBitStream(goTransportGuid, 1, 4, 0, 2, 6); hasGOTransportTime3 = packet.ReadBit(); goTransportGuid[5] = packet.ReadBit(); } if (hasAnimKits) { hasAnimKit2 = !packet.ReadBit(); hasAnimKit3 = !packet.ReadBit(); hasAnimKit1 = !packet.ReadBit(); } if (hasAttackingTarget) { attackingTargetGuid = packet.StartBitStream(7, 3, 6, 1, 5, 4, 0, 2); } if (bit208) { packet.ReadBit("bit21A", index); bit228 = packet.ReadBit(); bit270 = packet.ReadBit(); packet.ReadBit("bit219", index); packet.ReadBit("bit218", index); bit21C = packet.ReadBit(); bit244 = packet.ReadBit(); if (bit244) { bits248 = packet.ReadBits(21); bits258 = packet.ReadBits(21); } if (bit270) { bits274 = packet.ReadBits(20); } packet.ReadBit("bit21B", index); } // Sceneobject data var CreatorGUID = new byte[8]; byte[][] guid310 = null; byte[][][] guid34C_4 = null; uint[] bits34C_0 = null; uint[][] bits34C_4_84 = null; uint[][] bits34C_4_94 = null; uint[][] bits34C_4_31 = null; uint[][] bits34C_4_74 = null; byte[][][] bit34C_4_78_9 = null; byte[][][] bit34C_4_88_10 = null; bool[][][] bit34C_4_88_C = null; bool[][][] bit34C_4_88_8 = null; bool[][] bit34C_4_2E = null; bool[][] bit34C_4_30 = null; bool[] bit34C_4 = null; bool[] bit34C_8 = null; var bit318 = false; var bit31A = false; var bit329 = false; var bit320 = false; var bit328 = false; var bit324 = false; uint[] bits388 = null; uint[] bits388_10 = null; byte[][] bit388_1_10 = null; bool[][] bit388_1_C = null; bool[][] bit388_1_8 = null; if (isSceneObject) { guid310 = new byte[2][]; guid34C_4 = new byte[2][][]; bits34C_0 = new uint[2]; bits34C_4_84 = new uint[2][]; bits34C_4_94 = new uint[2][]; bits34C_4_31 = new uint[2][]; bits34C_4_74 = new uint[2][]; bit34C_4_78_9 = new byte[2][][]; bit34C_4_88_10 = new byte[2][][]; bit34C_4_88_C = new bool[2][][]; bit34C_4_88_8 = new bool[2][][]; bit34C_4_2E = new bool[2][]; bit34C_4_30 = new bool[2][]; bit34C_4 = new bool[2]; bit34C_8 = new bool[2]; for (var i = 0; i < 2; ++i) { guid310[i] = new byte[8]; packet.StartBitStream(guid310[i], 7, 6); bits34C_0[i] = packet.ReadBits(2); guid34C_4[i] = new byte[bits34C_0[i]][]; bits34C_4_84[i] = new uint[bits34C_0[i]]; bits34C_4_94[i] = new uint[bits34C_0[i]]; bits34C_4_31[i] = new uint[bits34C_0[i]]; bits34C_4_74[i] = new uint[bits34C_0[i]]; bit34C_4_78_9[i] = new byte[bits34C_0[i]][]; bit34C_4_88_10[i] = new byte[bits34C_0[i]][]; bit34C_4_88_C[i] = new bool[bits34C_0[i]][]; bit34C_4_88_8[i] = new bool[bits34C_0[i]][]; bit34C_4_2E[i] = new bool[bits34C_0[i]]; bit34C_4_30[i] = new bool[bits34C_0[i]]; for (var j = 0; j < bits34C_0[i]; ++j) { guid34C_4[i][j] = new byte[8]; bit34C_4_2E[i][j] = !packet.ReadBit(); packet.StartBitStream(guid34C_4[i][j], 7, 0, 6, 3); bits34C_4_84[i][j] = packet.ReadBits(21); bit34C_4_88_8[i][j] = new bool[bits34C_4_84[i][j]]; bit34C_4_88_C[i][j] = new bool[bits34C_4_84[i][j]]; bit34C_4_88_10[i][j] = new byte[bits34C_4_84[i][j]]; for (var k = 0; k < bits34C_4_84[i][j]; ++k) { bit34C_4_88_10[i][j][k] = (byte)(10 - packet.ReadBit()); bit34C_4_88_C[i][j][k] = !packet.ReadBit(); bit34C_4_88_8[i][j][k] = !packet.ReadBit(); } bits34C_4_94[i][j] = packet.ReadBits(21); packet.StartBitStream(guid34C_4[i][j], 2); bit34C_4_30[i][j] = packet.ReadBit(); packet.StartBitStream(guid34C_4[i][j], 5, 4, 1); bits34C_4_74[i][j] = packet.ReadBits(20); bit34C_4_78_9[i][j] = new byte[bits34C_4_74[i][j]]; for (var k = 0; k < bits34C_4_74[i][j]; ++k) { bit34C_4_78_9[i][j][k] = (byte)(10 - packet.ReadBit()); } bits34C_4_31[i][j] = packet.ReadBits(7); } bit34C_8[i] = !packet.ReadBit(); packet.StartBitStream(guid310[i], 3, 5, 2); bit34C_4[i] = packet.ReadBit(); packet.StartBitStream(guid310[i], 1, 0, 4); } bits388 = new uint[3]; bits388_10 = new uint[3]; bit388_1_10 = new byte[3][]; bit388_1_C = new bool[3][]; bit388_1_8 = new bool[3][]; for (var i = 0; i < 3; ++i) { bits388[i] = packet.ReadBits(21); bit388_1_10[i] = new byte[bits388[i]]; bit388_1_C[i] = new bool[bits388[i]]; bit388_1_8[i] = new bool[bits388[i]]; for (var j = 0; j < bits388[i]; ++j) { bit388_1_10[i][j] = (byte)(10 - packet.ReadBit()); bit388_1_C[i][j] = packet.ReadBit(); bit388_1_8[i][j] = packet.ReadBit(); } bits388_10[i] = packet.ReadBits(21); } bit31A = !packet.ReadBit(); bit329 = !packet.ReadBit(); bit320 = !packet.ReadBit(); bit328 = !packet.ReadBit(); packet.ReadBit(); // fake bit packet.StartBitStream(CreatorGUID, 7, 1, 0, 2, 3, 6, 4, 5); bit324 = !packet.ReadBit(); bit318 = !packet.ReadBit(); } if (bit3F0) { bits3F4 = packet.ReadBits(22); } if (bit28E) { bits28F = packet.ReadBits(7); } packet.ResetBitReader(); for (var i = 0; i < transportFrames; ++i) { packet.ReadInt32("Transport frame", i, index); } if (living) { if (hasTimestamp) { packet.ReadUInt32("Time", index); } for (var i = 0; i < bits168; ++i) { packet.ReadSingle("Float16C+5", index); packet.ReadInt32("Int16C+4", index); packet.ReadSingle("Float16C+1", index); packet.ReadInt32("Int16C+0", index); packet.ReadSingle("Float16C+2", index); packet.ReadSingle("Float16C+3", index); } if (moveInfo.HasSplineData) { if (hasFullSpline) { if (hasSplineStartTime) { packet.ReadInt32("Spline Start Time", index); } packet.ReadSingle("Spline Duration Multiplier", index); if (hasSplineVerticalAcceleration) { packet.ReadSingle("Spline Vertical Acceleration", index); } packet.ReadInt32("Spline Time", index); for (var i = 0u; i < splineCount; ++i) { var wp = new Vector3 { Z = packet.ReadSingle(), Y = packet.ReadSingle(), X = packet.ReadSingle() }; packet.AddValue("Spline Waypoint", wp, index, i); } if (bit134) { for (var i = 0; i < bits138; ++i) { packet.ReadSingle("Float13C+1", index, i); packet.ReadSingle("Float13C+0", index, i); } } packet.ReadSingle("Spline Duration Multiplier Next", index); var type = packet.ReadByte(); switch (type) { case 1: splineType = SplineType.Normal; break; case 2: splineType = SplineType.FacingSpot; break; case 3: splineType = SplineType.FacingTarget; break; case 4: splineType = SplineType.FacingAngle; break; } if (splineType == SplineType.FacingAngle) { packet.ReadSingle("Facing Angle", index); } if (splineType == SplineType.FacingSpot) { var point = new Vector3 { X = packet.ReadSingle(), Z = packet.ReadSingle(), Y = packet.ReadSingle() }; packet.AddValue("Facing Spot", point, index); } packet.ReadInt32("Spline Full Time", index); } moveInfo.Position.Y = packet.ReadSingle(); moveInfo.Position.Z = packet.ReadSingle(); packet.ReadInt32("Spline Id", index); moveInfo.Position.X = packet.ReadSingle(); } if (hasTransportData) { moveInfo.Transport = new MovementInfo.TransportInfo(); packet.ReadXORByte(transportGuid, 4); moveInfo.Transport.Offset.Z = packet.ReadSingle(); moveInfo.Transport.Offset.Y = packet.ReadSingle(); packet.ReadUInt32("Transport Time", index); var seat = packet.ReadByte("Transport Seat", index); packet.ReadXORBytes(transportGuid, 3, 1, 6); if (hasTransportTime2) { packet.ReadUInt32("Transport Time 2", index); } packet.ReadXORByte(transportGuid, 5); moveInfo.Transport.Offset.O = packet.ReadSingle(); moveInfo.Transport.Offset.X = packet.ReadSingle(); packet.ReadXORBytes(transportGuid, 2, 0, 7); if (hasTransportTime3) { packet.ReadUInt32("Transport Time 3", index); } moveInfo.Transport.Guid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0)); packet.AddValue("Transport GUID", moveInfo.Transport.Guid, index); packet.AddValue("Transport Position", moveInfo.Transport.Offset, index); if (moveInfo.Transport.Guid.HasEntry() && moveInfo.Transport.Guid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory { Entry = moveInfo.Transport.Guid.GetEntry(), AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan); } } packet.ReadXORBytes(guid1, 2, 1); packet.ReadSingle("RunBack Speed", index); packet.ReadSingle("Fly Speed", index); packet.ReadXORBytes(guid1, 0, 3); packet.ReadSingle("SwimBack Speed", index); if (hasFallData) { if (hasFallDirection) { packet.ReadSingle("Jump Sin", index); packet.ReadSingle("Jump Velocity", index); packet.ReadSingle("Jump Cos", index); } packet.ReadSingle("Fall Start Velocity", index); packet.ReadUInt32("Time Fallen", index); } packet.ReadSingle("Turn Speed", index); packet.ReadXORByte(guid1, 5); moveInfo.Position.Z = packet.ReadSingle(); if (hasOrientation) { moveInfo.Orientation = packet.ReadSingle(); } packet.ReadXORByte(guid1, 6); if (hasSplineElevation) { packet.ReadSingle("Spline Elevation", index); } packet.ReadSingle("Pitch Speed", index); if (hasPitch) { packet.ReadSingle("Pitch", index); } for (var i = 0; i < bits98; ++i) { packet.ReadInt32("Int9C", index, i); } moveInfo.WalkSpeed = packet.ReadSingle("Walk Speed", index) / 2.5f; if (bitA8) { packet.ReadInt32("IntA8", index); } moveInfo.Position.Y = packet.ReadSingle(); packet.ReadSingle("Swim Speed", index); packet.ReadSingle("FlyBack Speed", index); packet.ReadXORByte(guid1, 7); moveInfo.RunSpeed = packet.ReadSingle("Run Speed", index) / 7.0f; moveInfo.Position.X = packet.ReadSingle(); packet.ReadXORByte(guid1, 4); packet.WriteGuid("GUID1", guid1, index); packet.AddValue("Position", moveInfo.Position, index); packet.AddValue("Orientation", moveInfo.Orientation, index); } if (isSceneObject) { if (bit318) { packet.ReadInt16("Short318", index); } for (var i = 0; i < 2; ++i) { for (var j = 0; j < bits34C_0[i]; ++j) { packet.ReadXORBytes(guid34C_4[i][j], 0, 2); packet.ReadInt32("Int34C+4+8", index, i, j); packet.ReadXORBytes(guid34C_4[i][j], 5, 7); packet.ReadInt32("Int34C+4+18", index, i, j); for (var k = 0; k < bits34C_4_84[i][j]; ++k) { if (bit34C_4_88_C[i][j][k]) { packet.ReadInt32("int34C+4+88+C", index, i, j, k); } if (bit34C_4_88_8[i][j][k]) { packet.ReadInt32("int34C+4+88+8", index, i, j, k); } if (bit34C_4_88_10[i][j][k] != 9) { packet.ReadByte("byte34C+4+88+10", index, i, j, k); } packet.ReadInt32("int34C+4+88+0", index, i, j, k); packet.ReadInt32("int34C+4+88+4", index, i, j, k); } packet.ReadInt32("int34C+4+28", index, i, j); for (var k = 0; k < bits34C_4_94[i][j]; ++k) { packet.ReadInt32("int34C+4+98+0", index, i, j, k); packet.ReadInt32("int34C+4+98+4", index, i, j, k); } packet.ReadBytes("Bytes34C+4+31", (int)bits34C_4_31[i][j], index, i, j); packet.ReadXORByte(guid34C_4[i][j], 6); for (var k = 0; k < bits34C_4_74[i][j]; ++k) { packet.ReadInt32("int34C+4+78+0", index, i, j, k); packet.ReadByte("byte34C+4+78+8", index, i, j, k); packet.ReadInt16("short34C+4+78+3", index, i, j, k); packet.ReadInt16("short34C+4+78+2", index, i, j, k); if (bit34C_4_78_9[i][j][k] != 9) { packet.ReadByte("byte34C+4+78+9", index, i, j, k); } } if (bit34C_4_2E[i][j]) { packet.ReadInt16("short34C+4+2E", index, i, j); } packet.ReadXORByte(guid34C_4[i][j], 4); packet.ReadInt32("int34C+4+24", index, i, j); packet.ReadXORBytes(guid34C_4[i][j], 1, 3); packet.ReadInt16("short34C+4+16", index, i, j); packet.ReadInt32("int34C+4+C", index, i, j); packet.ReadInt32("int34C+4+10", index, i, j); if (!bit34C_4_30[i][j]) { packet.ReadByte("byte34C+4+30", index, i, j); } packet.ReadInt32("int34C+4+20", index, i, j); packet.ReadInt32("int34C+4+1C", index, i, j); packet.ReadInt16("short34C+4+14", index, i, j); packet.ReadInt16("short34C+4+2C", index, i, j); packet.WriteGuid("Guid 34C_4", guid34C_4[i][j]); } if (!bit34C_4[i]) { packet.ReadByte("byte34C-4", index, i); } packet.ReadXORBytes(guid310[i], 6, 3, 7); packet.ReadInt32("int34C-12", index, i); packet.ReadXORBytes(guid310[i], 5, 1, 4, 0); packet.ReadByte("byte34C+16", index, i); if (bit34C_8[i]) { packet.ReadInt32("int34C-8", index, i); } packet.ReadXORByte(guid310[i], 2); packet.WriteGuid("Guid34C-20", guid310[i], index, i); } packet.ParseBitStream(CreatorGUID, 2, 5, 4, 7, 3, 1, 0, 6); packet.WriteGuid("Creator GUID", CreatorGUID); if (bit329) { packet.ReadByte("byte329", index); } for (var i = 0; i < 3; ++i) { for (var j = 0; j < bits388_10[i]; ++j) { packet.ReadByte("byte388+4+4", index, i, j); packet.ReadByte("byte388+4+0", index, i, j); } for (var j = 0; j < bits388[i]; ++j) { if (bit388_1_10[i][j] != 9) { packet.ReadByte("byte388+1+10", index, i, j); } if (bit388_1_C[i][j]) { packet.ReadInt32("int388+1+C", index, i, j); } packet.ReadInt32("int388+1+4", index, i, j); packet.ReadInt32("int388+1+0", index, i, j); if (bit388_1_8[i][j]) { packet.ReadInt32("int388+1+8", index, i, j); } } } if (bit320) { packet.ReadInt32("int320", index); } if (bit31A) { packet.ReadInt16("short31A", index); } packet.ReadInt32("int31C", index); if (bit324) { packet.ReadInt32("int324", index); } if (bit328) { packet.ReadByte("byte328", index); } } if (hasGameObjectPosition) { moveInfo.Transport = new MovementInfo.TransportInfo(); packet.ReadUInt32("GO Transport Time", index); packet.ReadXORByte(goTransportGuid, 7); moveInfo.Transport.Offset.Y = packet.ReadSingle(); packet.ReadXORByte(goTransportGuid, 0); if (hasGOTransportTime3) { packet.ReadUInt32("GO Transport Time 3", index); } packet.ReadXORByte(goTransportGuid, 3); packet.ReadSByte("GO Transport Seat", index); packet.ReadXORByte(goTransportGuid, 1); moveInfo.Transport.Offset.Z = packet.ReadSingle(); moveInfo.Transport.Offset.O = packet.ReadSingle(); if (hasGOTransportTime2) { packet.ReadUInt32("GO Transport Time 2", index); } moveInfo.Transport.Offset.X = packet.ReadSingle(); packet.ReadXORBytes(goTransportGuid, 2, 4, 5, 6); moveInfo.Transport.Guid = new WowGuid64(BitConverter.ToUInt64(goTransportGuid, 0)); packet.AddValue("GO Transport GUID", moveInfo.Transport.Guid, index); packet.AddValue("GO Transport Position", moveInfo.Transport.Offset, index); } if (bit208) { if (bit21C) { packet.ReadSingle("Float224", index); packet.ReadSingle("Float220", index); } packet.ReadSingle("Float210", index); if (bit244) { for (var i = 0; i < bits258; ++i) { packet.ReadSingle("Float25C+1", index); packet.ReadSingle("Float25C+0", index); } for (var i = 0; i < bits248; ++i) { packet.ReadSingle("Float24C+0", index); packet.ReadSingle("Float24C+1", index); } packet.ReadSingle("Float26C", index); packet.ReadSingle("Float268", index); } if (bit228) { packet.ReadSingle("Float22C", index); packet.ReadSingle("Float230", index); packet.ReadSingle("Float23C", index); packet.ReadSingle("Float234", index); packet.ReadSingle("Float238", index); packet.ReadSingle("Float240", index); } if (bit270) { for (var i = 0; i < bits274; ++i) { packet.ReadSingle("Float277+1", index); packet.ReadSingle("Float277+0", index); packet.ReadSingle("Float277+2", index); } } packet.ReadSingle("Float214", index); packet.ReadInt32("Int20C", index); } if (hasVehicleData) { packet.ReadSingle("Vehicle Orientation", index); moveInfo.VehicleId = packet.ReadUInt32("Vehicle Id", index); } if (hasAttackingTarget) { packet.ParseBitStream(attackingTargetGuid, 7, 1, 4, 6, 0, 2, 5, 3); packet.WriteGuid("Attacking GUID", attackingTargetGuid, index); } if (hasGameObjectRotation) { moveInfo.Rotation = packet.ReadPackedQuaternion("GameObject Rotation", index); } if (hasAnimKits) { if (hasAnimKit2) { packet.ReadUInt16("Anim Kit 2", index); } if (hasAnimKit1) { packet.ReadUInt16("Anim Kit 1", index); } if (hasAnimKit3) { packet.ReadUInt16("Anim Kit 3", index); } } if (bit28E) { packet.ReadBytes("Bytes", (int)bits28F, index); } if (hasStationaryPosition) { moveInfo.Position.X = packet.ReadSingle(); moveInfo.Position.Z = packet.ReadSingle(); moveInfo.Orientation = packet.ReadSingle("Stationary Orientation", index); moveInfo.Position.Y = packet.ReadSingle(); packet.AddValue("Stationary Position", moveInfo.Position, index); } if (transport) { packet.ReadInt32("Transport path timer", index); } if (bit3F0) { for (var i = 0; i < bits3F4; ++i) { packet.ReadInt32("Int3F8", index, i); } } if (bit284) { packet.ReadInt32("Int288", index); } if (bit3E8) { packet.ReadInt32("Int3EC", index); } if (living && moveInfo.HasSplineData && hasFullSpline && splineType == SplineType.FacingTarget) { var facingTargetGuid = new byte[8]; facingTargetGuid = packet.StartBitStream(2, 4, 6, 3, 1, 5, 7, 0); packet.ParseBitStream(facingTargetGuid, 1, 3, 6, 7, 2, 4, 5, 0); packet.WriteGuid("Facing Target GUID", facingTargetGuid, index); } return(moveInfo); }
private static MovementInfo ReadMovementUpdateBlock434(Packet packet, WowGuid guid, object index) { var moveInfo = new MovementInfo(); // bits /*var bit3 =*/ packet.ReadBit(); /*var bit4 =*/ packet.ReadBit(); var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index); var hasAnimKits = packet.ReadBit("Has AnimKits", index); var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index); packet.ReadBit("Self", index); var hasVehicleData = packet.ReadBit("Has Vehicle Data", index); var living = packet.ReadBit("Living", index); var unkLoopCounter = packet.ReadBits("Unknown array size", 24, index); /*var bit1 =*/ packet.ReadBit(); var hasGameObjectPosition = packet.ReadBit("Has GameObject Position", index); var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index); var bit456 = packet.ReadBit(); /*var bit2 =*/ packet.ReadBit(); var transport = packet.ReadBit("Transport", index); var hasOrientation = false; var guid2 = new byte[8]; var hasPitch = false; var hasFallData = false; var hasSplineElevation = false; var hasTransportData = false; var hasTimestamp = false; var transportGuid = new byte[8]; var hasTransportTime2 = false; var hasTransportTime3 = false; var bit216 = false; var hasSplineStartTime = false; var splineCount = 0u; var splineType = SplineType.Stop; var facingTargetGuid = new byte[8]; var hasSplineVerticalAcceleration = false; var hasFallDirection = false; var goTransportGuid = new byte[8]; var hasGOTransportTime2 = false; var hasGOTransportTime3 = false; var attackingTargetGuid = new byte[8]; var hasAnimKit1 = false; var hasAnimKit2 = false; var hasAnimKit3 = false; if (living) { var hasMovementFlags = !packet.ReadBit(); hasOrientation = !packet.ReadBit("Lacks orientation", index); guid2[7] = packet.ReadBit(); guid2[3] = packet.ReadBit(); guid2[2] = packet.ReadBit(); if (hasMovementFlags) { moveInfo.Flags = (MovementFlag)packet.ReadBitsE <Enums.MovementFlag>("Movement Flags", 30, index); } packet.ReadBit("Has MovementInfo spline", index); hasPitch = !packet.ReadBit("Lacks pitch", index); moveInfo.HasSplineData = packet.ReadBit("Has Spline Data", index); hasFallData = packet.ReadBit("Has Fall Data", index); hasSplineElevation = !packet.ReadBit("Lacks spline elevation", index); guid2[5] = packet.ReadBit(); hasTransportData = packet.ReadBit("Has Transport Data", index); hasTimestamp = !packet.ReadBit("Lacks timestamp", index); if (hasTransportData) { transportGuid[1] = packet.ReadBit(); hasTransportTime2 = packet.ReadBit(); transportGuid[4] = packet.ReadBit(); transportGuid[0] = packet.ReadBit(); transportGuid[6] = packet.ReadBit(); hasTransportTime3 = packet.ReadBit(); transportGuid[7] = packet.ReadBit(); transportGuid[5] = packet.ReadBit(); transportGuid[3] = packet.ReadBit(); transportGuid[2] = packet.ReadBit(); } guid2[4] = packet.ReadBit(); if (moveInfo.HasSplineData) { bit216 = packet.ReadBit("Has extended spline data", index); if (bit216) { /*var splineMode =*/ packet.ReadBitsE <SplineMode>("Spline Mode", 2, index); hasSplineStartTime = packet.ReadBit("Has spline start time", index); splineCount = packet.ReadBits("Spline Waypoints", 22, index); var bits57 = packet.ReadBits(2); switch (bits57) { case 0: splineType = SplineType.FacingAngle; break; case 1: splineType = SplineType.FacingSpot; break; case 2: splineType = SplineType.FacingTarget; break; case 3: splineType = SplineType.Normal; break; } if (splineType == SplineType.FacingTarget) { facingTargetGuid = packet.StartBitStream(4, 3, 7, 2, 6, 1, 0, 5); } hasSplineVerticalAcceleration = packet.ReadBit("Has spline vertical acceleration", index); packet.AddValue("Spline type", splineType, index); /*splineFlags =*/ packet.ReadBitsE <SplineFlag434>("Spline flags", 25, index); } } guid2[6] = packet.ReadBit(); if (hasFallData) { hasFallDirection = packet.ReadBit("Has Fall Direction", index); } guid2[0] = packet.ReadBit(); guid2[1] = packet.ReadBit(); packet.ReadBit(); if (!packet.ReadBit()) { moveInfo.FlagsExtra = packet.ReadBitsE <MovementFlagExtra>("Extra Movement Flags", 12, index); } } if (hasGameObjectPosition) { goTransportGuid[5] = packet.ReadBit(); hasGOTransportTime3 = packet.ReadBit(); goTransportGuid[0] = packet.ReadBit(); goTransportGuid[3] = packet.ReadBit(); goTransportGuid[6] = packet.ReadBit(); goTransportGuid[1] = packet.ReadBit(); goTransportGuid[4] = packet.ReadBit(); goTransportGuid[2] = packet.ReadBit(); hasGOTransportTime2 = packet.ReadBit(); goTransportGuid[7] = packet.ReadBit(); } if (hasAttackingTarget) { attackingTargetGuid = packet.StartBitStream(2, 7, 0, 4, 5, 6, 1, 3); } if (hasAnimKits) { hasAnimKit1 = !packet.ReadBit(); hasAnimKit2 = !packet.ReadBit(); hasAnimKit3 = !packet.ReadBit(); } packet.ResetBitReader(); // Reading data for (var i = 0u; i < unkLoopCounter; ++i) { packet.ReadUInt32("Unk UInt32", index, (int)i); } if (living) { packet.ReadXORByte(guid2, 4); packet.ReadSingle("RunBack Speed", index); if (hasFallData) { if (hasFallDirection) { packet.ReadSingle("Jump XY Speed", index); packet.ReadSingle("Jump Cos", index); packet.ReadSingle("Jump Sin", index); } packet.ReadInt32("Time Fallen", index); packet.ReadSingle("Fall Z Speed", index); } packet.ReadSingle("SwimBack Speed", index); if (hasSplineElevation) { packet.ReadSingle("Spline Elevation", index); } if (moveInfo.HasSplineData) { if (bit216) { if (hasSplineVerticalAcceleration) { packet.ReadSingle("Spline Vertical Acceleration", index); } packet.ReadUInt32("Spline Time", index); if (splineType == SplineType.FacingAngle) { packet.ReadSingle("Facing Angle", index); } else if (splineType == SplineType.FacingTarget) { packet.ParseBitStream(facingTargetGuid, 5, 3, 7, 1, 6, 4, 2, 0); packet.WriteGuid("Facing Target GUID", facingTargetGuid, index); } for (var i = 0u; i < splineCount; ++i) { var wp = new Vector3 { Z = packet.ReadSingle(), X = packet.ReadSingle(), Y = packet.ReadSingle() }; packet.AddValue("Spline Waypoint", wp, index, i); } if (splineType == SplineType.FacingSpot) { var point = new Vector3 { X = packet.ReadSingle(), Z = packet.ReadSingle(), Y = packet.ReadSingle() }; packet.AddValue("Facing Spot", point, index); } packet.ReadSingle("Spline Duration Multiplier Next", index); packet.ReadUInt32("Spline Full Time", index); if (hasSplineStartTime) { packet.ReadUInt32("Spline Start time", index); } packet.ReadSingle("Spline Duration Multiplier", index); } var endPoint = new Vector3 { Z = packet.ReadSingle(), X = packet.ReadSingle(), Y = packet.ReadSingle() }; packet.ReadUInt32("Spline Id", index); packet.AddValue("Spline Endpoint:", endPoint, index); } moveInfo.Position.Z = packet.ReadSingle(); packet.ReadXORByte(guid2, 5); if (hasTransportData) { packet.ReadXORByte(transportGuid, 5); packet.ReadXORByte(transportGuid, 7); packet.ReadUInt32("Transport Time", index); moveInfo.TransportOffset.O = packet.ReadSingle(); if (hasTransportTime2) { packet.ReadUInt32("Transport Time 2", index); } moveInfo.TransportOffset.Y = packet.ReadSingle(); moveInfo.TransportOffset.X = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 3); moveInfo.TransportOffset.Z = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 0); if (hasTransportTime3) { packet.ReadUInt32("Transport Time 3", index); } var seat = packet.ReadSByte("Transport Seat", index); packet.ReadXORByte(transportGuid, 1); packet.ReadXORByte(transportGuid, 6); packet.ReadXORByte(transportGuid, 2); packet.ReadXORByte(transportGuid, 4); moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0)); packet.AddValue("Transport GUID", moveInfo.TransportGuid, index); packet.AddValue("Transport Position", moveInfo.TransportOffset, index); if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { var vehicleAccessory = new VehicleTemplateAccessory(); vehicleAccessory.AccessoryEntry = guid.GetEntry(); vehicleAccessory.SeatId = seat; Storage.VehicleTemplateAccessorys.Add(moveInfo.TransportGuid.GetEntry(), vehicleAccessory, packet.TimeSpan); } } moveInfo.Position.X = packet.ReadSingle(); packet.ReadSingle("Pitch Speed", index); packet.ReadXORByte(guid2, 3); packet.ReadXORByte(guid2, 0); packet.ReadSingle("Swim Speed", index); moveInfo.Position.Y = packet.ReadSingle(); packet.ReadXORByte(guid2, 7); packet.ReadXORByte(guid2, 1); packet.ReadXORByte(guid2, 2); moveInfo.WalkSpeed = packet.ReadSingle("Walk Speed", index) / 2.5f; if (hasTimestamp) { packet.ReadUInt32("Time", index); } packet.ReadSingle("FlyBack Speed", index); packet.ReadXORByte(guid2, 6); packet.ReadSingle("Turn Speed", index); if (hasOrientation) { moveInfo.Orientation = packet.ReadSingle(); } moveInfo.RunSpeed = packet.ReadSingle("Run Speed", index) / 7.0f; if (hasPitch) { packet.ReadSingle("Pitch", index); } packet.ReadSingle("Fly Speed", index); packet.WriteGuid("GUID 2", guid2); packet.AddValue("Position", moveInfo.Position, index); packet.AddValue("Orientation", moveInfo.Orientation, index); } if (hasVehicleData) { packet.ReadSingle("Vehicle Orientation", index); moveInfo.VehicleId = packet.ReadUInt32("Vehicle Id", index); } if (hasGameObjectPosition) { packet.ReadXORByte(goTransportGuid, 0); packet.ReadXORByte(goTransportGuid, 5); if (hasGOTransportTime3) { packet.ReadUInt32("GO Transport Time 3", index); } packet.ReadXORByte(goTransportGuid, 3); moveInfo.TransportOffset.X = packet.ReadSingle(); packet.ReadXORByte(goTransportGuid, 4); packet.ReadXORByte(goTransportGuid, 6); packet.ReadXORByte(goTransportGuid, 1); packet.ReadSingle("GO Transport Time", index); moveInfo.TransportOffset.Y = packet.ReadSingle(); packet.ReadXORByte(goTransportGuid, 2); packet.ReadXORByte(goTransportGuid, 7); moveInfo.TransportOffset.Z = packet.ReadSingle(); packet.ReadByte("GO Transport Seat", index); moveInfo.TransportOffset.O = packet.ReadSingle(); if (hasGOTransportTime2) { packet.ReadUInt32("GO Transport Time 2", index); } moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(goTransportGuid, 0)); packet.AddValue("GO Transport GUID", moveInfo.TransportGuid, index); packet.AddValue("GO Transport Position", moveInfo.TransportOffset, index); } if (hasGameObjectRotation) { packet.ReadPackedQuaternion("GameObject Rotation", index); } if (bit456) { // float[] arr = new float[16]; // ordering: 13, 4, 7, 15, BYTE, 10, 11, 3, 5, 14, 6, 1, 8, 12, 0, 2, 9 packet.ReadBytes(4 * 16 + 1); } if (hasStationaryPosition) { moveInfo.Orientation = packet.ReadSingle("Stationary Orientation", index); moveInfo.Position = packet.ReadVector3("Stationary Position", index); } if (hasAttackingTarget) { packet.ParseBitStream(attackingTargetGuid, 4, 0, 3, 5, 7, 6, 2, 1); packet.WriteGuid("Attacking Target GUID", attackingTargetGuid, index); } if (hasAnimKits) { if (hasAnimKit1) { packet.ReadUInt16("AI Anim Kit Id", index); } if (hasAnimKit2) { packet.ReadUInt16("Movement Anim Kit Id", index); } if (hasAnimKit3) { packet.ReadUInt16("Melee Anim Kit Id", index); } } if (transport) { packet.ReadUInt32("Transport path timer", index); } return(moveInfo); }
private static MovementInfo ReadMovementUpdateBlock(Packet packet, WowGuid guid, object index) { var moveInfo = new MovementInfo(); var guid1 = new byte[8]; var transportGuid = new byte[8]; var goTransportGuid = new byte[8]; var attackingTargetGuid = new byte[8]; var guid5 = new byte[8]; var guid6 = new byte[8]; var guid7 = new byte[8]; var hasAnimKit1 = false; var hasAnimKit2 = false; var hasAnimKit3 = false; var hasFullSpline = false; var hasSplineStartTime = false; var hasSplineVerticalAcceleration = false; var hasMovementFlags = false; var hasMoveFlagsExtra = false; var hasTimestamp = false; var hasOrientation = false; var hasTransportData = false; var hasTransportTime2 = false; var hasTransportTime3 = false; var hasGOTransportTime2 = false; var hasGOTransportTime3 = false; var hasPitch = false; var hasFallData = false; var hasFallDirection = false; var hasSplineElevation = false; var bit134 = false; var bitA8 = false; var bit23C = false; var bit298 = false; var bit230 = false; var bit284 = false; var bit228 = false; var bit258 = false; var bit218 = false; var bit220 = false; var bits168 = 0u; var splineCount = 0u; var bits138 = 0u; var bits98 = 0u; var bits25C = 0u; var bits26C = 0u; var bits288 = 0u; var bits418 = 0u; var bits2AA = 0u; var splineType = SplineType.Stop; var bit2A4 = packet.ReadBit(); // 676 var hasVehicleData = packet.ReadBit("Has Vehicle Data", index); // 488 var bit414 = packet.ReadBit(); // 1044 var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index); // 512 packet.ReadBit(); // fake 0 var isLiving = packet.ReadBit("Is Living", index); // 368 var hasSceneObjectData = packet.ReadBit("Has Scene Object Data", index); // 1032 packet.ReadBit(); // fake 2 var bit29C = packet.ReadBit(); // 668 var bit2A8 = packet.ReadBit(); // 680 var bit2A9 = packet.ReadBit(); // 681 packet.ReadBit(); // fake 1 var hasTransportPosition = packet.ReadBit("Has Transport Position", index); // 424 var bit1DC = packet.ReadBit(); // 476 var hasAnimKits = packet.ReadBit("Has Anim Kits", index); // 498 var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index); // 448 var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index); // 464 packet.ReadBit(); // fake 3 var transportFrames = packet.ReadBits("Transport Frames Count", 22, index); // 1068 var bit32A = packet.ReadBit(); // 810 var bit428 = packet.ReadBit(); // 1064 if (bit428) { bits418 = packet.ReadBits(22); } if (hasTransportPosition) { packet.StartBitStream(goTransportGuid, 3, 5, 2, 1, 4); hasGOTransportTime3 = packet.ReadBit(); hasGOTransportTime2 = packet.ReadBit(); packet.StartBitStream(goTransportGuid, 0, 6, 7); } if (isLiving) { hasTransportData = packet.ReadBit("Has Transport Data", index); if (hasTransportData) { transportGuid[4] = packet.ReadBit(); transportGuid[0] = packet.ReadBit(); transportGuid[5] = packet.ReadBit(); transportGuid[2] = packet.ReadBit(); transportGuid[3] = packet.ReadBit(); hasTransportTime2 = packet.ReadBit(); transportGuid[7] = packet.ReadBit(); transportGuid[6] = packet.ReadBit(); transportGuid[1] = packet.ReadBit(); hasTransportTime3 = packet.ReadBit(); } hasPitch = !packet.ReadBit("Has Pitch", index); packet.ReadBit(); bits168 = packet.ReadBits(19); guid1[1] = packet.ReadBit(); hasMoveFlagsExtra = !packet.ReadBit(); packet.ReadBit(); hasSplineElevation = !packet.ReadBit("Has SplineElevation", index); if (hasMoveFlagsExtra) { moveInfo.FlagsExtra = packet.ReadBitsE <MovementFlagExtra>("Extra Movement Flags", 13, index); } hasOrientation = !packet.ReadBit(); hasTimestamp = !packet.ReadBit(); hasMovementFlags = !packet.ReadBit(); bitA8 = !packet.ReadBit("bitA8", index); guid1[2] = packet.ReadBit(); guid1[6] = packet.ReadBit(); hasFallData = packet.ReadBit(); guid1[5] = packet.ReadBit(); guid1[4] = packet.ReadBit(); guid1[0] = packet.ReadBit(); if (hasMovementFlags) { moveInfo.Flags = packet.ReadBitsE <MovementFlag>("Movement Flags", 30, index); } packet.ReadBit(); if (hasFallData) { hasFallDirection = packet.ReadBit(); } bits98 = packet.ReadBits("bits98", 22, index); guid1[7] = packet.ReadBit(); moveInfo.HasSplineData = packet.ReadBit(); guid1[3] = packet.ReadBit(); if (moveInfo.HasSplineData) { hasFullSpline = packet.ReadBit(); if (hasFullSpline) { hasSplineVerticalAcceleration = packet.ReadBit(); packet.ReadBitsE <SplineMode>("Spline Mode", 2, index); splineCount = packet.ReadBits(20); packet.ReadBitsE <SplineFlag434>("Spline flags", 25, index); hasSplineStartTime = packet.ReadBit(); bit134 = packet.ReadBit(); if (bit134) { bits138 = packet.ReadBits(21); packet.ReadBits(2); } } } } if (bit29C) { bit230 = packet.ReadBit(); bit258 = packet.ReadBit(); packet.ReadBit("bit20E", index); packet.ReadBit("bit20F", index); bit228 = packet.ReadBit(); packet.ReadBit("bit20C", index); bit218 = packet.ReadBit(); packet.ReadBit("bit20D", index); bit284 = packet.ReadBit(); if (bit284) { bits25C = packet.ReadBits(21); bits26C = packet.ReadBits(21); } bit298 = packet.ReadBit(); if (bit298) { bits288 = packet.ReadBits(20); } bit23C = packet.ReadBit(); packet.ReadBit("bit210", index); bit220 = packet.ReadBit(); } if (hasAttackingTarget) { attackingTargetGuid = packet.StartBitStream(4, 6, 3, 5, 0, 2, 7, 1); } if (hasAnimKits) { hasAnimKit1 = !packet.ReadBit(); hasAnimKit2 = !packet.ReadBit(); hasAnimKit3 = !packet.ReadBit(); } if (bit32A) { bits2AA = packet.ReadBits(7); } packet.ResetBitReader(); for (var i = 0; i < transportFrames; ++i) { packet.ReadInt32("Transport frame", index, i); } if (bit29C) { if (bit23C) { packet.ReadSingle("Float234", index); packet.ReadSingle("Float238", index); } if (bit284) { for (var i = 0; i < bits26C; ++i) { packet.ReadSingle("Float270+0", index, i); packet.ReadSingle("Float270+1", index, i); } packet.ReadSingle("Float27C", index); for (var i = 0; i < bits25C; ++i) { packet.ReadSingle("Float260+0", index, i); packet.ReadSingle("Float260+1", index, i); } packet.ReadSingle("Float280", index); } if (bit258) { packet.ReadSingle("Float244", index); packet.ReadSingle("Float250", index); packet.ReadSingle("Float254", index); packet.ReadSingle("Float248", index); packet.ReadSingle("Float240", index); packet.ReadSingle("Float24C", index); } packet.ReadInt32("Int208", index); if (bit298) { for (var i = 0; i < bits288; ++i) { packet.ReadSingle("Float28C+0", index, i); packet.ReadSingle("Float28C+1", index, i); packet.ReadSingle("Float28C+2", index, i); } } if (bit220) { packet.ReadInt32("int21C", index); } if (bit218) { packet.ReadInt32("int214", index); } if (bit230) { packet.ReadInt32("int22C", index); } if (bit228) { packet.ReadInt32("int224", index); } } if (isLiving) { if (hasFallData) { if (hasFallDirection) { packet.ReadSingle("Jump Sin Angle", index); packet.ReadSingle("Jump Cos Angle", index); packet.ReadSingle("Jump XY Speed", index); } packet.ReadSingle("Jump Z Speed", index); packet.ReadUInt32("Jump Fall Time", index); } if (moveInfo.HasSplineData) { if (hasFullSpline) { packet.ReadSingle("Duration Mod Next", index); for (uint i = 0; i < splineCount; i++) { Vector3 v = new Vector3(); v.Z = packet.ReadSingle(); v.Y = packet.ReadSingle(); v.X = packet.ReadSingle(); packet.AddValue("Spline", v, index); } var type = packet.ReadByte(); switch (type) { case 1: splineType = SplineType.Normal; break; case 2: splineType = SplineType.FacingSpot; break; case 3: splineType = SplineType.FacingTarget; break; case 4: splineType = SplineType.FacingAngle; break; } packet.ReadSingle("Duration Mod", index); // NYI block here if (splineType == SplineType.FacingSpot) { packet.ReadVector3("Facing spot", index); } if (hasSplineVerticalAcceleration) { packet.ReadSingle("Spline Vertical Acceleration", index); } if (splineType == SplineType.FacingAngle) { packet.ReadSingle("Facing Angle", index); } packet.ReadUInt32("Spline FULL Time", index); if (hasSplineStartTime) { packet.ReadUInt32("Spline Start time", index); } packet.ReadUInt32("Spline Time", index); } packet.ReadUInt32("Spline ID", index); packet.ReadVector3("Spline Endpoint", index); } /*for (var i = 0; i < 10; ++i) * packet.ReadSingle("unk float"); * if (bits98 > 0) * packet.ReadBits((int)bits98);*/ //for (var i = 0; i < bits98; ++i) // packet.ReadInt32("Int9C", index, i); moveInfo.Position.Z = packet.ReadSingle(); moveInfo.Position.Y = packet.ReadSingle(); packet.ReadSingle("Fly Speed", index); packet.ReadXORByte(guid1, 6); packet.ReadSingle("Fly Back Speed", index); if (hasTransportData) { packet.ReadXORByte(transportGuid, 7); packet.ReadXORByte(transportGuid, 4); if (hasTransportTime3) { packet.ReadUInt32("Transport Time 3", index); } packet.ReadUInt32("Transport Time", index); if (hasTransportTime2) { packet.ReadUInt32("Transport Time 2", index); } moveInfo.TransportOffset.O = packet.ReadSingle(); moveInfo.TransportOffset.X = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 6); packet.ReadXORByte(transportGuid, 3); packet.ReadXORByte(transportGuid, 2); moveInfo.TransportOffset.Z = packet.ReadSingle(); moveInfo.TransportOffset.Y = packet.ReadSingle(); var seat = packet.ReadSByte("Transport Seat", index); packet.ReadXORByte(transportGuid, 1); packet.ReadXORByte(transportGuid, 0); packet.ReadXORByte(transportGuid, 5); moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0)); packet.AddValue("Transport GUID", moveInfo.TransportGuid, index); packet.AddValue("Transport Position", moveInfo.TransportOffset, index); if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory { Entry = moveInfo.TransportGuid.GetEntry(), AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan); } } moveInfo.Position.X = packet.ReadSingle(); packet.AddValue("Position", moveInfo.Position, index); packet.ReadXORByte(guid1, 2); if (hasPitch) { packet.ReadSingle("Pitch", index); } packet.ReadSingle("Swim Speed", index); packet.ReadXORByte(guid1, 1); packet.ReadSingle("Run Back Speed", index); packet.ReadSingle("Swim Back Speed", index); packet.ReadXORByte(guid1, 5); if (hasSplineElevation) { packet.ReadSingle("Spline Elevation", index); } if (bitA8) { packet.ReadInt32("IntA8", index); } packet.ReadSingle("Turn Speed", index); packet.ReadXORByte(guid1, 3); moveInfo.RunSpeed = packet.ReadSingle("Run Speed", index) / 7.0f; packet.ReadXORByte(guid1, 7); moveInfo.WalkSpeed = packet.ReadSingle("Walk Speed", index) / 2.5f; packet.ReadSingle("Pitch Speed", index); if (hasTimestamp) { packet.ReadUInt32("Time?", index); } packet.ReadXORByte(guid1, 4); packet.ReadXORByte(guid1, 0); packet.WriteGuid("GUID2", guid1); if (hasOrientation) { moveInfo.Orientation = packet.ReadSingle("Orientation", index); } } if (hasAttackingTarget) { packet.ParseBitStream(attackingTargetGuid, 5, 1, 2, 0, 3, 4, 6, 7); packet.WriteGuid("Attacking Target GUID", attackingTargetGuid, index); } if (hasStationaryPosition) { moveInfo.Orientation = packet.ReadSingle("Stationary Orientation", index); moveInfo.Position = packet.ReadVector3("Stationary Position", index); } if (hasTransportPosition) { packet.ReadSByte("Transport Seat", index); moveInfo.TransportOffset.X = packet.ReadSingle(); packet.ReadXORBytes(goTransportGuid, 1, 0, 2, 6, 5, 4); if (hasGOTransportTime2) { packet.ReadUInt32("Transport Time 3", index); } packet.ReadXORByte(goTransportGuid, 7); moveInfo.TransportOffset.O = packet.ReadSingle(); moveInfo.TransportOffset.Z = packet.ReadSingle(); moveInfo.TransportOffset.Y = packet.ReadSingle(); if (hasGOTransportTime3) { packet.ReadUInt32("Transport Time 2", index); } packet.ReadXORByte(goTransportGuid, 3); packet.ReadUInt32("Transport Time", index); moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(goTransportGuid, 0)); packet.AddValue("Transport GUID", moveInfo.TransportGuid, index); packet.AddValue("Transport Position", moveInfo.TransportOffset, index); } if (bit1DC) { packet.ReadInt32("int1D8", index); } if (bit2A4) { packet.ReadInt32("int2A0", index); } if (bit32A) { packet.ReadBytes("Bytes", (int)bits2AA); } if (hasGameObjectRotation) { moveInfo.Rotation = packet.ReadPackedQuaternion("GameObject Rotation", index); } if (hasVehicleData) { moveInfo.VehicleId = packet.ReadUInt32("Vehicle Id", index); packet.ReadSingle("Vehicle Orientation", index); } if (bit414) { packet.ReadInt32("int410", index); } if (hasAnimKits) { if (hasAnimKit1) { packet.ReadUInt16("Anim Kit 1", index); } if (hasAnimKit2) { packet.ReadUInt16("Anim Kit 2", index); } if (hasAnimKit3) { packet.ReadUInt16("Anim Kit 3", index); } } if (bit428) { for (var i = 0; i < bits418; ++i) { packet.ReadInt32("Int3F8", index, i); } } if (isLiving && moveInfo.HasSplineData && hasFullSpline && splineType == SplineType.FacingTarget) { var facingTargetGuid = new byte[8]; packet.StartBitStream(facingTargetGuid, 6, 7, 3, 0, 5, 1, 4, 2); packet.ParseBitStream(facingTargetGuid, 4, 2, 5, 6, 0, 7, 1, 3); packet.WriteGuid("Facing Target GUID", facingTargetGuid, index); } return(moveInfo); }
private static MovementInfo ReadMovementUpdateBlock(Packet packet, CreateObject createObject, WowGuid guid, WoWObject obj, object index) { var moveInfo = new MovementInfo(); packet.ResetBitReader(); packet.ReadBit("NoBirthAnim", index); packet.ReadBit("EnablePortals", index); packet.ReadBit("PlayHoverAnim", index); var hasMovementUpdate = packet.ReadBit("HasMovementUpdate", index); var hasMovementTransport = packet.ReadBit("HasMovementTransport", index); var hasStationaryPosition = packet.ReadBit("Stationary", index); var hasCombatVictim = packet.ReadBit("HasCombatVictim", index); var hasServerTime = packet.ReadBit("HasServerTime", index); var hasVehicleCreate = packet.ReadBit("HasVehicleCreate", index); var hasAnimKitCreate = packet.ReadBit("HasAnimKitCreate", index); var hasRotation = packet.ReadBit("HasRotation", index); var hasAreaTrigger = packet.ReadBit("HasAreaTrigger", index); var hasGameObject = packet.ReadBit("HasGameObject", index); var hasSmoothPhasing = packet.ReadBit("HasSmoothPhasing", index); packet.ReadBit("ThisIsYou", index); var sceneObjCreate = packet.ReadBit("SceneObjCreate", index); var playerCreateData = packet.ReadBit("HasPlayerCreateData", index); var hasConversation = packet.ReadBit("HasConversation", index); if (hasMovementUpdate) { var movementUpdate = createObject.Movement = new(); packet.ResetBitReader(); movementUpdate.Mover = packet.ReadPackedGuid128("MoverGUID", index); movementUpdate.MoveTime = packet.ReadUInt32("MoveTime", index); movementUpdate.Position = moveInfo.Position = packet.ReadVector3("Position", index); movementUpdate.Orientation = moveInfo.Orientation = packet.ReadSingle("Orientation", index); movementUpdate.Pitch = packet.ReadSingle("Pitch", index); movementUpdate.StepUpStartElevation = packet.ReadSingle("StepUpStartElevation", index); var removeForcesIDsCount = packet.ReadInt32(); movementUpdate.MoveIndex = packet.ReadInt32("MoveIndex", index); for (var i = 0; i < removeForcesIDsCount; i++) { packet.ReadPackedGuid128("RemoveForcesIDs", index, i); } moveInfo.Flags = (MovementFlag)packet.ReadBitsE <V6_0_2_19033.Enums.MovementFlag>("Movement Flags", 30, index); moveInfo.FlagsExtra = (MovementFlagExtra)packet.ReadBitsE <V8_0_1_27101.Enums.MovementFlags2>("Extra Movement Flags", 18, index); var hasTransport = packet.ReadBit("Has Transport Data", index); var hasFall = packet.ReadBit("Has Fall Data", index); packet.ReadBit("HasSpline", index); packet.ReadBit("HeightChangeFailed", index); packet.ReadBit("RemoteTimeValid", index); if (hasTransport) { movementUpdate.Transport = V8_0_1_27101.Parsers.UpdateHandler.ReadTransportData(moveInfo, guid, packet, index); } if (hasFall) { packet.ResetBitReader(); movementUpdate.FallTime = packet.ReadUInt32("Fall Time", index); movementUpdate.JumpVelocity = packet.ReadSingle("JumpVelocity", index); var hasFallDirection = packet.ReadBit("Has Fall Direction", index); if (hasFallDirection) { packet.ReadVector2("Fall", index); packet.ReadSingle("Horizontal Speed", index); } } movementUpdate.WalkSpeed = moveInfo.WalkSpeed = packet.ReadSingle("WalkSpeed", index) / 2.5f; movementUpdate.RunSpeed = moveInfo.RunSpeed = packet.ReadSingle("RunSpeed", index) / 7.0f; packet.ReadSingle("RunBackSpeed", index); packet.ReadSingle("SwimSpeed", index); packet.ReadSingle("SwimBackSpeed", index); packet.ReadSingle("FlightSpeed", index); packet.ReadSingle("FlightBackSpeed", index); packet.ReadSingle("TurnRate", index); packet.ReadSingle("PitchRate", index); var movementForceCount = packet.ReadInt32("MovementForceCount", index); packet.ResetBitReader(); moveInfo.HasSplineData = packet.ReadBit("HasMovementSpline", index); for (var i = 0; i < movementForceCount; ++i) { packet.ResetBitReader(); packet.ReadPackedGuid128("Id", index); packet.ReadVector3("Origin", index); packet.ReadVector3("Direction", index); packet.ReadInt32("TransportID", index); packet.ReadSingle("Magnitude", index); packet.ReadBits("Type", 2, index); } if (moveInfo.HasSplineData) { var splineData = movementUpdate.SplineData = new(); packet.ResetBitReader(); splineData.Id = packet.ReadInt32("ID", index); splineData.Destination = packet.ReadVector3("Destination", index); var hasMovementSplineMove = packet.ReadBit("MovementSplineMove", index); if (hasMovementSplineMove) { var splineMove = splineData.MoveData = new(); packet.ResetBitReader(); splineMove.Flags = packet.ReadUInt32E <SplineFlag>("SplineFlags", index).ToUniversal(); splineMove.Elapsed = packet.ReadInt32("Elapsed", index); splineMove.Duration = packet.ReadUInt32("Duration", index); splineMove.DurationModifier = packet.ReadSingle("DurationModifier", index); splineMove.NextDurationModifier = packet.ReadSingle("NextDurationModifier", index); var face = packet.ReadBits("Face", 2, index); var hasSpecialTime = packet.ReadBit("HasSpecialTime", index); var pointsCount = packet.ReadBits("PointsCount", 16, index); packet.ReadBitsE <SplineMode>("Mode", 2, index); var hasSplineFilterKey = packet.ReadBit("HasSplineFilterKey", index); var hasSpellEffectExtraData = packet.ReadBit("HasSpellEffectExtraData", index); var hasJumpExtraData = packet.ReadBit("HasJumpExtraData", index); if (hasSplineFilterKey) { packet.ResetBitReader(); var filterKeysCount = packet.ReadUInt32("FilterKeysCount", index); for (var i = 0; i < filterKeysCount; ++i) { packet.ReadSingle("In", index, i); packet.ReadSingle("Out", index, i); } packet.ReadBits("FilterFlags", 2, index); } switch (face) { case 1: splineMove.LookPosition = packet.ReadVector3("FaceSpot", index); break; case 2: splineMove.LookTarget = new() { Target = packet.ReadPackedGuid128("FaceGUID", index) }; break; case 3: splineMove.LookOrientation = packet.ReadSingle("FaceDirection", index); break; default: break; } if (hasSpecialTime) { packet.ReadUInt32("SpecialTime", index); } for (var i = 0; i < pointsCount; ++i) { splineMove.Points.Add(packet.ReadVector3("Points", index, i)); } if (hasSpellEffectExtraData) { V8_0_1_27101.Parsers.MovementHandler.ReadMonsterSplineSpellEffectExtraData(packet, index); } if (hasJumpExtraData) { splineMove.Jump = V8_0_1_27101.Parsers.MovementHandler.ReadMonsterSplineJumpExtraData(packet, index); } } } } var pauseTimesCount = packet.ReadUInt32("PauseTimesCount", index); if (hasStationaryPosition) { moveInfo.Position = packet.ReadVector3(); moveInfo.Orientation = packet.ReadSingle(); packet.AddValue("Stationary Position", moveInfo.Position, index); packet.AddValue("Stationary Orientation", moveInfo.Orientation, index); createObject.Stationary = new() { Position = moveInfo.Position, Orientation = moveInfo.Orientation }; } if (hasCombatVictim) { packet.ReadPackedGuid128("CombatVictim Guid", index); } if (hasServerTime) { packet.ReadUInt32("ServerTime", index); } if (hasVehicleCreate) { var vehicle = createObject.Vehicle = new(); moveInfo.VehicleId = packet.ReadUInt32("RecID", index); vehicle.VehicleId = (int)moveInfo.VehicleId; vehicle.InitialRawFacing = packet.ReadSingle("InitialRawFacing", index); } if (hasAnimKitCreate) { packet.ReadUInt16("AiID", index); packet.ReadUInt16("MovementID", index); packet.ReadUInt16("MeleeID", index); } if (hasRotation) { createObject.Rotation = moveInfo.Rotation = packet.ReadPackedQuaternion("GameObject Rotation", index); } for (var i = 0; i < pauseTimesCount; ++i) { packet.ReadInt32("PauseTimes", index, i); } if (hasMovementTransport) { var transport = createObject.Transport = new(); packet.ResetBitReader(); transport.TransportGuid = moveInfo.TransportGuid = packet.ReadPackedGuid128("TransportGUID", index); transport.Position = moveInfo.TransportOffset = packet.ReadVector4("TransportPosition", index); var seat = packet.ReadByte("VehicleSeatIndex", index); transport.Seat = seat; transport.MoveTime = packet.ReadUInt32("MoveTime", index); var hasPrevMoveTime = packet.ReadBit("HasPrevMoveTime", index); var hasVehicleRecID = packet.ReadBit("HasVehicleRecID", index); if (hasPrevMoveTime) { transport.PrevMoveTime = packet.ReadUInt32("PrevMoveTime", index); } if (hasVehicleRecID) { transport.VehicleId = packet.ReadInt32("VehicleRecID", index); } if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory { Entry = moveInfo.TransportGuid.GetEntry(), AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan); } } if (hasAreaTrigger && obj is AreaTriggerCreateProperties) { AreaTriggerTemplate areaTriggerTemplate = new AreaTriggerTemplate { Id = guid.GetEntry() }; AreaTriggerCreateProperties spellAreaTrigger = (AreaTriggerCreateProperties)obj; spellAreaTrigger.AreaTriggerId = guid.GetEntry(); packet.ResetBitReader(); // CliAreaTrigger packet.ReadUInt32("ElapsedMs", index); packet.ReadVector3("RollPitchYaw", index); areaTriggerTemplate.Flags = 0; if (packet.ReadBit("HasAbsoluteOrientation", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasAbsoluteOrientation; } if (packet.ReadBit("HasDynamicShape", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasDynamicShape; } if (packet.ReadBit("HasAttached", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasAttached; } if (packet.ReadBit("HasFaceMovementDir", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.FaceMovementDirection; } if (packet.ReadBit("HasFollowsTerrain", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.FollowsTerrain; } if (packet.ReadBit("Unk bit WoD62x", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.Unk1; } if (packet.ReadBit("HasTargetRollPitchYaw", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasTargetRollPitchYaw; } bool hasScaleCurveID = packet.ReadBit("HasScaleCurveID", index); bool hasMorphCurveID = packet.ReadBit("HasMorphCurveID", index); bool hasFacingCurveID = packet.ReadBit("HasFacingCurveID", index); bool hasMoveCurveID = packet.ReadBit("HasMoveCurveID", index); if (packet.ReadBit("HasAnimID", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasAnimId; } if (packet.ReadBit("HasAnimKitID", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasAnimKitId; } if (packet.ReadBit("unkbit50", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.Unk3; } bool hasAnimProgress = packet.ReadBit("HasAnimProgress", index); if (packet.ReadBit("HasAreaTriggerSphere", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Sphere; } if (packet.ReadBit("HasAreaTriggerBox", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Box; } if (packet.ReadBit("HasAreaTriggerPolygon", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Polygon; } if (packet.ReadBit("HasAreaTriggerCylinder", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Cylinder; } bool hasAreaTriggerSpline = packet.ReadBit("HasAreaTriggerSpline", index); if (packet.ReadBit("HasAreaTriggerOrbit", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasOrbit; } if ((areaTriggerTemplate.Flags & (uint)AreaTriggerFlags.Unk3) != 0) { packet.ReadBit(); } if (hasAreaTriggerSpline) { foreach (var splinePoint in V7_0_3_22248.Parsers.AreaTriggerHandler.ReadAreaTriggerSpline((AreaTriggerCreateProperties)obj, packet, index, "AreaTriggerSpline")) { Storage.AreaTriggerCreatePropertiesSplinePoints.Add(splinePoint); } } if ((areaTriggerTemplate.Flags & (uint)AreaTriggerFlags.HasTargetRollPitchYaw) != 0) { packet.ReadVector3("TargetRollPitchYaw", index); } if (hasScaleCurveID) { spellAreaTrigger.ScaleCurveId = (int)packet.ReadUInt32("ScaleCurveID", index); } if (hasMorphCurveID) { spellAreaTrigger.MorphCurveId = (int)packet.ReadUInt32("MorphCurveID", index); } if (hasFacingCurveID) { spellAreaTrigger.FacingCurveId = (int)packet.ReadUInt32("FacingCurveID", index); } if (hasMoveCurveID) { spellAreaTrigger.MoveCurveId = (int)packet.ReadUInt32("MoveCurveID", index); } if ((areaTriggerTemplate.Flags & (int)AreaTriggerFlags.HasAnimId) != 0) { spellAreaTrigger.AnimId = packet.ReadInt32("AnimId", index); } if ((areaTriggerTemplate.Flags & (int)AreaTriggerFlags.HasAnimKitId) != 0) { spellAreaTrigger.AnimKitId = packet.ReadInt32("AnimKitId", index); } if (hasAnimProgress) { packet.ReadUInt32("AnimProgress", index); } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Sphere) { areaTriggerTemplate.Data[0] = packet.ReadSingle("Radius", index); areaTriggerTemplate.Data[1] = packet.ReadSingle("RadiusTarget", index); } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Box) { Vector3 Extents = packet.ReadVector3("Extents", index); Vector3 ExtentsTarget = packet.ReadVector3("ExtentsTarget", index); areaTriggerTemplate.Data[0] = Extents.X; areaTriggerTemplate.Data[1] = Extents.Y; areaTriggerTemplate.Data[2] = Extents.Z; areaTriggerTemplate.Data[3] = ExtentsTarget.X; areaTriggerTemplate.Data[4] = ExtentsTarget.Y; areaTriggerTemplate.Data[5] = ExtentsTarget.Z; } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Polygon) { var verticesCount = packet.ReadUInt32("VerticesCount", index); var verticesTargetCount = packet.ReadUInt32("VerticesTargetCount", index); List <AreaTriggerCreatePropertiesPolygonVertex> verticesList = new List <AreaTriggerCreatePropertiesPolygonVertex>(); areaTriggerTemplate.Data[0] = packet.ReadSingle("Height", index); areaTriggerTemplate.Data[1] = packet.ReadSingle("HeightTarget", index); for (uint i = 0; i < verticesCount; ++i) { AreaTriggerCreatePropertiesPolygonVertex spellAreatriggerVertices = new AreaTriggerCreatePropertiesPolygonVertex { areatriggerGuid = guid, Idx = i }; Vector2 vertices = packet.ReadVector2("Vertices", index, i); spellAreatriggerVertices.VerticeX = vertices.X; spellAreatriggerVertices.VerticeY = vertices.Y; verticesList.Add(spellAreatriggerVertices); } for (var i = 0; i < verticesTargetCount; ++i) { Vector2 verticesTarget = packet.ReadVector2("VerticesTarget", index, i); verticesList[i].VerticeTargetX = verticesTarget.X; verticesList[i].VerticeTargetY = verticesTarget.Y; } foreach (AreaTriggerCreatePropertiesPolygonVertex vertice in verticesList) { Storage.AreaTriggerCreatePropertiesPolygonVertices.Add(vertice); } } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Cylinder) { areaTriggerTemplate.Data[0] = packet.ReadSingle("Radius", index); areaTriggerTemplate.Data[1] = packet.ReadSingle("RadiusTarget", index); areaTriggerTemplate.Data[2] = packet.ReadSingle("Height", index); areaTriggerTemplate.Data[3] = packet.ReadSingle("HeightTarget", index); areaTriggerTemplate.Data[4] = packet.ReadSingle("LocationZOffset", index); areaTriggerTemplate.Data[5] = packet.ReadSingle("LocationZOffsetTarget", index); } if ((areaTriggerTemplate.Flags & (uint)AreaTriggerFlags.HasOrbit) != 0) { Storage.AreaTriggerCreatePropertiesOrbits.Add(V7_0_3_22248.Parsers.AreaTriggerHandler.ReadAreaTriggerOrbit(guid, packet, index, "AreaTriggerOrbit")); } spellAreaTrigger.Shape = areaTriggerTemplate.Type; Array.Copy(areaTriggerTemplate.Data, spellAreaTrigger.ShapeData, Math.Min(areaTriggerTemplate.Data.Length, spellAreaTrigger.ShapeData.Length)); Storage.AreaTriggerTemplates.Add(areaTriggerTemplate); } if (hasGameObject) { packet.ResetBitReader(); packet.ReadInt32("WorldEffectID", index); var bit8 = packet.ReadBit("bit8", index); if (bit8) { packet.ReadInt32("Int1", index); } } if (hasSmoothPhasing) { packet.ResetBitReader(); packet.ReadBit("ReplaceActive", index); var replaceObject = packet.ReadBit(); if (replaceObject) { packet.ReadPackedGuid128("ReplaceObject", index); } } if (sceneObjCreate) { packet.ResetBitReader(); var hasSceneLocalScriptData = packet.ReadBit("HasSceneLocalScriptData", index); var petBattleFullUpdate = packet.ReadBit("HasPetBattleFullUpdate", index); if (hasSceneLocalScriptData) { packet.ResetBitReader(); var dataLength = packet.ReadBits(7); packet.ReadWoWString("Data", dataLength, index); } if (petBattleFullUpdate) { V6_0_2_19033.Parsers.BattlePetHandler.ReadPetBattleFullUpdate(packet, index); } } if (playerCreateData) { packet.ResetBitReader(); var hasSceneInstanceIDs = packet.ReadBit("ScenePendingInstances", index); var hasRuneState = packet.ReadBit("Runes", index); var hasActionButtons = packet.ReadBit("Unk1132", index); if (hasSceneInstanceIDs) { var sceneInstanceIDs = packet.ReadInt32("SceneInstanceIDsCount"); for (var i = 0; i < sceneInstanceIDs; ++i) { packet.ReadInt32("SceneInstanceIDs", index, i); } } if (hasRuneState) { packet.ReadByte("RechargingRuneMask", index); packet.ReadByte("UsableRuneMask", index); var runeCount = packet.ReadUInt32(); for (var i = 0; i < runeCount; ++i) { packet.ReadByte("RuneCooldown", index, i); } } if (hasActionButtons) { for (int i = 0; i < 132; i++) { packet.ReadInt32("Action", index, i); } } } if (hasConversation) { packet.ResetBitReader(); if (packet.ReadBit("HasTextureKitID", index)) { (obj as ConversationTemplate).TextureKitId = packet.ReadUInt32("TextureKitID", index); } } return(moveInfo); } }
private static MovementInfo ReadMovementUpdateBlock(ref Packet packet, WowGuid guid, object index) { var moveInfo = new MovementInfo(); packet.ResetBitReader(); packet.ReadBit("NoBirthAnim", index); packet.ReadBit("EnablePortals", index); packet.ReadBit("PlayHoverAnim", index); packet.ReadBit("IsSuppressingGreetings", index); var hasMovementUpdate = packet.ReadBit("HasMovementUpdate", index); var hasMovementTransport = packet.ReadBit("HasMovementTransport", index); var hasStationaryPosition = packet.ReadBit("Stationary", index); var hasCombatVictim = packet.ReadBit("HasCombatVictim", index); var hasServerTime = packet.ReadBit("HasServerTime", index); var hasVehicleCreate = packet.ReadBit("HasVehicleCreate", index); var hasAnimKitCreate = packet.ReadBit("HasAnimKitCreate", index); var hasRotation = packet.ReadBit("HasRotation", index); var hasAreaTrigger = packet.ReadBit("HasAreaTrigger", index); var hasGameObject = packet.ReadBit("HasGameObject", index); packet.ReadBit("ThisIsYou", index); packet.ReadBit("ReplaceActive", index); var sceneObjCreate = packet.ReadBit("SceneObjCreate", index); var scenePendingInstances = packet.ReadBit("ScenePendingInstances", index); var pauseTimesCount = packet.ReadUInt32("PauseTimesCount", index); if (hasMovementUpdate) // 392 { moveInfo = ReadMovementStatusData(ref packet, index); moveInfo.WalkSpeed = packet.ReadSingle("WalkSpeed", index) / 2.5f; moveInfo.RunSpeed = packet.ReadSingle("RunSpeed", index) / 7.0f; packet.ReadSingle("RunBackSpeed", index); packet.ReadSingle("SwimSpeed", index); packet.ReadSingle("SwimBackSpeed", index); packet.ReadSingle("FlightSpeed", index); packet.ReadSingle("FlightBackSpeed", index); packet.ReadSingle("TurnRate", index); packet.ReadSingle("PitchRate", index); var movementForceCount = packet.ReadInt32("MovementForceCount", index); for (var i = 0; i < movementForceCount; ++i) { packet.ReadPackedGuid128("Id", index); packet.ReadVector3("Direction", index); packet.ReadInt32("TransportID", index); packet.ReadSingle("Magnitude", index); packet.ReadByte("Type", index); } packet.ResetBitReader(); moveInfo.HasSplineData = packet.ReadBit("HasMovementSpline", index); if (moveInfo.HasSplineData) { packet.ReadInt32("ID", index); packet.ReadVector3("Destination", index); packet.ResetBitReader(); var hasMovementSplineMove = packet.ReadBit("MovementSplineMove", index); if (hasMovementSplineMove) { packet.ResetBitReader(); packet.ReadEnum <SplineFlag434>("SplineFlags", 25, index); var face = packet.ReadBits("Face", 2, index); var hasJumpGravity = packet.ReadBit("HasJumpGravity", index); var hasSpecialTime = packet.ReadBit("HasSpecialTime", index); packet.ReadEnum <SplineMode>("Mode", 2, index); var hasSplineFilterKey = packet.ReadBit("HasSplineFilterKey", index); packet.ReadUInt32("Elapsed", index); packet.ReadUInt32("Duration", index); packet.ReadSingle("DurationModifier", index); packet.ReadSingle("NextDurationModifier", index); var pointsCount = packet.ReadUInt32("PointsCount", index); if (face == 3) // FaceDirection { packet.ReadSingle("FaceDirection", index); } if (face == 2) // FaceGUID { packet.ReadPackedGuid128("FaceGUID", index); } if (face == 1) // FaceSpot { packet.ReadVector3("FaceSpot", index); } if (hasJumpGravity) { packet.ReadSingle("JumpGravity", index); } if (hasSpecialTime) { packet.ReadInt32("SpecialTime", index); } if (hasSplineFilterKey) { var filterKeysCount = packet.ReadUInt32("FilterKeysCount", index); for (var i = 0; i < filterKeysCount; ++i) { packet.ReadSingle("In", index, i); packet.ReadSingle("Out", index, i); } packet.ReadBits("FilterFlags", 2, index); } for (var i = 0; i < pointsCount; ++i) { packet.ReadVector3("Points", index, i); } } } } if (hasMovementTransport) // 456 { moveInfo.TransportGuid = packet.ReadPackedGuid128("PassengerGUID", index); moveInfo.TransportOffset = packet.ReadVector4(); var seat = packet.ReadByte("VehicleSeatIndex", index); packet.ReadUInt32("MoveTime", index); packet.ResetBitReader(); var hasPrevMoveTime = packet.ReadBit("HasPrevMoveTime", index); var hasVehicleRecID = packet.ReadBit("HasVehicleRecID", index); if (hasPrevMoveTime) { packet.ReadUInt32("PrevMoveTime", index); } if (hasVehicleRecID) { packet.ReadInt32("VehicleRecID", index); } if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { var vehicleAccessory = new VehicleTemplateAccessory { AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessorys.Add(moveInfo.TransportGuid.GetEntry(), vehicleAccessory, packet.TimeSpan); } } if (hasStationaryPosition) // 480 { moveInfo.Position = packet.ReadVector3(); moveInfo.Orientation = packet.ReadSingle(); packet.AddValue("Stationary Position", moveInfo.Position, index); } if (hasCombatVictim) // 504 { packet.ReadPackedGuid128("CombatVictim Guid", index); } if (hasServerTime) // 516 { packet.ReadPackedTime("ServerTime", index); } if (hasVehicleCreate) // 528 { moveInfo.VehicleId = packet.ReadUInt32("RecID", index); packet.ReadSingle("InitialRawFacing", index); } if (hasAnimKitCreate) // 538 { packet.ReadUInt16("AiID", index); packet.ReadUInt16("MovementID", index); packet.ReadUInt16("MeleeID", index); } if (hasRotation) // 552 { packet.ReadPackedQuaternion("GameObject Rotation", index); } if (hasAreaTrigger) // 772 { // CliAreaTrigger packet.ReadInt32("ElapsedMs", index); packet.ReadVector3("RollPitchYaw1", index); packet.ResetBitReader(); packet.ReadBit("HasAbsoluteOrientation", index); packet.ReadBit("HasDynamicShape", index); packet.ReadBit("HasAttached", index); packet.ReadBit("HasFaceMovementDir", index); 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 (hasGameObject) // 788 { packet.ReadInt32("WorldEffectID", index); packet.ResetBitReader(); var bit8 = packet.ReadBit("bit8", index); if (bit8) { packet.ReadInt32("Int1", index); } } if (sceneObjCreate) // 1184 { packet.ResetBitReader(); var hasSceneLocalScriptData = packet.ReadBit("HasSceneLocalScriptData", index); var petBattleFullUpdate = packet.ReadBit("HasPetBattleFullUpdate", index); if (hasSceneLocalScriptData) { 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) // 1208 { var sceneInstanceIDs = packet.ReadInt32("SceneInstanceIDsCount"); for (var i = 0; i < sceneInstanceIDs; ++i) { packet.ReadInt32("SceneInstanceIDs", index, i); } } for (var i = 0; i < pauseTimesCount; ++i) { packet.ReadInt32("PauseTimes", index, i); } return(moveInfo); }
public static void HandlePetSpells(Packet packet) { WowGuid guid = packet.ReadGuid("GUID"); // Equal to "Clear spells" pre cataclysm if (guid.IsEmpty()) { return; } if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { packet.ReadUInt16E <CreatureFamily>("Pet Family"); // vehicles -> 0 } if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_1_0_16309)) { packet.ReadUInt16("Unk UInt16"); } packet.ReadUInt32("Expiration Time"); ReadPetFlags(packet); bool isPet = guid.GetHighType() == HighGuidType.Pet; bool isVehicle = guid.GetHighType() == HighGuidType.Vehicle; bool isMinion = guid.GetHighType() == HighGuidType.Creature; const int maxCreatureSpells = 10; var spells = new List <uint?>(maxCreatureSpells); for (int i = 0; i < maxCreatureSpells; i++) // Read pet/vehicle spell ids { ushort spell16 = packet.ReadUInt16(); byte spell8 = packet.ReadByte(); int spellId = spell16 + (spell8 << 16); byte slot = packet.ReadByte("Slot", i); if (spellId <= 4) { packet.AddValue("Action", spellId, i); } else { packet.AddValue("Spell", StoreGetters.GetName(StoreNameType.Spell, spellId), i); } // Spells for pets are on DBCs; also no entry in guid // We don't need the actions sent for minions (slots lower than 8) if (!isPet && (isVehicle || (isMinion && slot >= 8))) { spells.Add((uint)spellId); } } if (spells.Count != 0) { if (!Storage.SpellsX.ContainsKey(guid.GetEntry())) { Storage.SpellsX.Add(guid.GetEntry(), spells); } } byte spellCount = packet.ReadByte("Spell Count"); // vehicles -> 0, pets -> != 0. Could this be auras? for (int i = 0; i < spellCount; i++) { packet.ReadUInt16 <SpellId>("Spell", i); packet.ReadInt16("Active", i); } byte cdCount = packet.ReadByte("Cooldown count"); for (int i = 0; i < cdCount; i++) { if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { packet.ReadUInt32 <SpellId>("Spell", i); } else { packet.ReadUInt16 <SpellId>("Spell", i); } packet.ReadUInt16("Category", i); packet.ReadUInt32("Cooldown", i); packet.ReadUInt32("Category Cooldown", i); } if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_1_0_16309)) { byte unkLoopCounter = packet.ReadByte("Unk count"); for (int i = 0; i < unkLoopCounter; i++) { packet.ReadUInt32("Unk UInt32 1", i); packet.ReadByte("Unk Byte", i); packet.ReadUInt32("Unk UInt32 2", i); } } }
private static MovementInfo ReadMovementUpdateBlock(Packet packet, WowGuid guid, WoWObject obj, object index) { var moveInfo = new MovementInfo(); packet.ResetBitReader(); packet.ReadBit("NoBirthAnim", index); packet.ReadBit("EnablePortals", index); packet.ReadBit("PlayHoverAnim", index); var hasMovementUpdate = packet.ReadBit("HasMovementUpdate", index); var hasMovementTransport = packet.ReadBit("HasMovementTransport", index); var hasStationaryPosition = packet.ReadBit("Stationary", index); var hasCombatVictim = packet.ReadBit("HasCombatVictim", index); var hasServerTime = packet.ReadBit("HasServerTime", index); var hasVehicleCreate = packet.ReadBit("HasVehicleCreate", index); var hasAnimKitCreate = packet.ReadBit("HasAnimKitCreate", index); var hasRotation = packet.ReadBit("HasRotation", index); var hasAreaTrigger = packet.ReadBit("HasAreaTrigger", index); var hasGameObject = packet.ReadBit("HasGameObject", index); var hasSmoothPhasing = packet.ReadBit("HasSmoothPhasing", index); var isSelf = packet.ReadBit("ThisIsYou", index); var sceneObjCreate = packet.ReadBit("SceneObjCreate", index); var playerCreateData = packet.ReadBit("HasPlayerCreateData", index); var hasConversation = packet.ReadBit("HasConversation", index); if (hasMovementUpdate) { packet.ResetBitReader(); packet.ReadPackedGuid128("MoverGUID", index); if (ClientVersion.AddedInVersion(ClientVersionBuild.V2_5_3_41812)) { moveInfo.Flags = (uint)packet.ReadUInt32E <MovementFlag>("Movement Flags", index); moveInfo.Flags2 = (uint)packet.ReadUInt32E <MovementFlag2>("Movement Flags 2", index); moveInfo.Flags3 = (uint)packet.ReadUInt32E <MovementFlag3>("Movement Flags 3", index); } packet.ReadUInt32("MoveTime", index); moveInfo.Position = packet.ReadVector3("Position", index); moveInfo.Orientation = packet.ReadSingle("Orientation", index); packet.ReadSingle("Pitch", index); packet.ReadSingle("StepUpStartElevation", index); var removeForcesIDsCount = packet.ReadInt32(); packet.ReadInt32("MoveIndex", index); for (var i = 0; i < removeForcesIDsCount; i++) { packet.ReadPackedGuid128("RemoveForcesIDs", index, i); } if (ClientVersion.RemovedInVersion(ClientVersionBuild.V2_5_3_41812)) { moveInfo.Flags = (uint)packet.ReadBitsE <MovementFlag>("Movement Flags", 30, index); moveInfo.Flags2 = (uint)packet.ReadBitsE <MovementFlag2>("Extra Movement Flags", 18, index); } var hasTransport = packet.ReadBit("Has Transport Data", index); var hasFall = packet.ReadBit("Has Fall Data", index); packet.ReadBit("HasSpline", index); packet.ReadBit("HeightChangeFailed", index); packet.ReadBit("RemoteTimeValid", index); var hasInertia = ClientVersion.AddedInVersion(ClientVersionBuild.V2_5_3_41812) && packet.ReadBit("Has Inertia", index); if (hasTransport) { V8_0_1_27101.Parsers.UpdateHandler.ReadTransportData(moveInfo, guid, packet, index); } if (hasInertia) { packet.ReadPackedGuid128("GUID", index, "Inertia"); packet.ReadVector3("Force", index, "Inertia"); packet.ReadUInt32("Lifetime", index, "Inertia"); } if (hasFall) { packet.ResetBitReader(); packet.ReadUInt32("Jump Fall Time", index); packet.ReadSingle("Jump Vertical Speed", index); var hasFallDirection = packet.ReadBit("Has Fall Direction", index); if (hasFallDirection) { packet.ReadSingle("Jump Sin Angle", index); packet.ReadSingle("Jump Cos Angle", index); packet.ReadSingle("Jump Horizontal Speed", index); } } moveInfo.WalkSpeed = packet.ReadSingle("WalkSpeed", index); moveInfo.RunSpeed = packet.ReadSingle("RunSpeed", index); packet.ReadSingle("RunBackSpeed", index); packet.ReadSingle("SwimSpeed", index); packet.ReadSingle("SwimBackSpeed", index); packet.ReadSingle("FlightSpeed", index); packet.ReadSingle("FlightBackSpeed", index); packet.ReadSingle("TurnRate", index); packet.ReadSingle("PitchRate", index); var movementForceCount = packet.ReadInt32("MovementForceCount", index); packet.ReadSingle("MovementForcesModMagnitude", index); packet.ResetBitReader(); moveInfo.HasSplineData = packet.ReadBit("HasMovementSpline", index); for (var i = 0; i < movementForceCount; ++i) { packet.ResetBitReader(); packet.ReadPackedGuid128("Id", index); packet.ReadVector3("Origin", index); packet.ReadVector3("Direction", index); packet.ReadUInt32("TransportID", index); packet.ReadSingle("Magnitude", index); packet.ReadBits("Type", 2, index); } if (moveInfo.HasSplineData) { packet.ResetBitReader(); packet.ReadInt32("ID", index); packet.ReadVector3("Destination", index); var hasMovementSplineMove = packet.ReadBit("MovementSplineMove", index); if (hasMovementSplineMove) { packet.ResetBitReader(); packet.ReadUInt32E <SplineFlag>("SplineFlags", index); packet.ReadInt32("Elapsed", index); packet.ReadUInt32("Duration", index); packet.ReadSingle("DurationModifier", index); packet.ReadSingle("NextDurationModifier", index); var face = packet.ReadBits("Face", 2, index); var hasSpecialTime = packet.ReadBit("HasSpecialTime", index); var pointsCount = packet.ReadBits("PointsCount", 16, index); var hasSplineFilterKey = packet.ReadBit("HasSplineFilterKey", index); var hasSpellEffectExtraData = packet.ReadBit("HasSpellEffectExtraData", index); var hasJumpExtraData = packet.ReadBit("HasJumpExtraData", index); var hasAnimationTierTransition = packet.ReadBit("HasAnimationTierTransition", index); var hasUnknown901 = packet.ReadBit("Unknown901", index); if (hasSplineFilterKey) { packet.ResetBitReader(); var filterKeysCount = packet.ReadUInt32("FilterKeysCount", index); for (var i = 0; i < filterKeysCount; ++i) { packet.ReadSingle("In", index, i); packet.ReadSingle("Out", index, i); } packet.ReadBits("FilterFlags", 2, index); } float orientation = 100; switch (face) { case 1: var faceSpot = packet.ReadVector3("FaceSpot", index); orientation = GetAngle(moveInfo.Position.X, moveInfo.Position.Y, faceSpot.X, faceSpot.Y); break; case 2: packet.ReadPackedGuid128("FaceGUID", index); break; case 3: orientation = packet.ReadSingle("FaceDirection", index); break; default: break; } if (hasSpecialTime) { packet.ReadUInt32("SpecialTime", index); } for (var i = 0; i < pointsCount; ++i) { var spot = packet.ReadVector3("Points", index, i); } if (hasSpellEffectExtraData) { V8_0_1_27101.Parsers.MovementHandler.ReadMonsterSplineSpellEffectExtraData(packet, index); } if (hasJumpExtraData) { V8_0_1_27101.Parsers.MovementHandler.ReadMonsterSplineJumpExtraData(packet, index); } if (hasAnimationTierTransition) { packet.ReadInt32("TierTransitionID", index); packet.ReadInt32("StartTime", index); packet.ReadInt32("EndTime", index); packet.ReadByte("AnimTier", index); } if (hasUnknown901) { for (var i = 0; i < 16; ++i) { packet.ReadInt32("Unknown1", index, "Unknown901", i); packet.ReadInt32("Unknown2", index, "Unknown901", i); packet.ReadInt32("Unknown3", index, "Unknown901", i); packet.ReadInt32("Unknown4", index, "Unknown901", i); } } } } } var pauseTimesCount = packet.ReadUInt32("PauseTimesCount", index); if (hasStationaryPosition) { moveInfo.Position = packet.ReadVector3(); moveInfo.Orientation = packet.ReadSingle(); packet.AddValue("Stationary Position", moveInfo.Position, index); packet.AddValue("Stationary Orientation", moveInfo.Orientation, index); } if (hasCombatVictim) { packet.ReadPackedGuid128("CombatVictim Guid", index); } if (hasServerTime) { packet.ReadUInt32("ServerTime", index); } if (hasVehicleCreate) { moveInfo.VehicleId = packet.ReadUInt32("RecID", index); packet.ReadSingle("InitialRawFacing", index); } if (hasAnimKitCreate) { packet.ReadUInt16("AiID", index); packet.ReadUInt16("MovementID", index); packet.ReadUInt16("MeleeID", index); } if (hasRotation) { moveInfo.Rotation = packet.ReadPackedQuaternion("GameObject Rotation", index); } for (var i = 0; i < pauseTimesCount; ++i) { packet.ReadInt32("PauseTimes", index, i); } if (hasMovementTransport) { moveInfo.Transport = new MovementInfo.TransportInfo(); packet.ResetBitReader(); moveInfo.Transport.Guid = packet.ReadPackedGuid128("TransportGUID", index); moveInfo.Transport.Offset = packet.ReadVector4("TransportPosition", index); sbyte seat; if (ClientVersion.RemovedInVersion(ClientVersionBuild.V2_5_3_41812)) { seat = (sbyte)packet.ReadByte("VehicleSeatIndex", index); } else { seat = packet.ReadSByte("VehicleSeatIndex", index); } packet.ReadUInt32("MoveTime", index); var hasPrevMoveTime = packet.ReadBit("HasPrevMoveTime", index); var hasVehicleRecID = packet.ReadBit("HasVehicleRecID", index); if (hasPrevMoveTime) { packet.ReadUInt32("PrevMoveTime", index); } if (hasVehicleRecID) { packet.ReadInt32("VehicleRecID", index); } if (moveInfo.Transport.Guid.HasEntry() && moveInfo.Transport.Guid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory { Entry = moveInfo.Transport.Guid.GetEntry(), AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan); } } if (hasAreaTrigger && obj is AreaTriggerCreateProperties) { AreaTriggerTemplate areaTriggerTemplate = new AreaTriggerTemplate { Id = guid.GetEntry() }; AreaTriggerCreateProperties spellAreaTrigger = (AreaTriggerCreateProperties)obj; spellAreaTrigger.AreaTriggerId = guid.GetEntry(); packet.ResetBitReader(); // CliAreaTrigger packet.ReadUInt32("ElapsedMs", index); packet.ReadVector3("RollPitchYaw", index); areaTriggerTemplate.Flags = 0; if (packet.ReadBit("HasAbsoluteOrientation", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasAbsoluteOrientation; } if (packet.ReadBit("HasDynamicShape", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasDynamicShape; } if (packet.ReadBit("HasAttached", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasAttached; } if (packet.ReadBit("HasFaceMovementDir", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.FaceMovementDirection; } if (packet.ReadBit("HasFollowsTerrain", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.FollowsTerrain; } if (packet.ReadBit("Unk bit WoD62x", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.Unk1; } if (packet.ReadBit("HasTargetRollPitchYaw", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasTargetRollPitchYaw; } bool hasScaleCurveID = packet.ReadBit("HasScaleCurveID", index); bool hasMorphCurveID = packet.ReadBit("HasMorphCurveID", index); bool hasFacingCurveID = packet.ReadBit("HasFacingCurveID", index); bool hasMoveCurveID = packet.ReadBit("HasMoveCurveID", index); if (packet.ReadBit("HasAnimID", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasAnimId; } if (packet.ReadBit("HasAnimKitID", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasAnimKitId; } if (packet.ReadBit("unkbit50", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.Unk3; } bool hasAnimProgress = packet.ReadBit("HasAnimProgress", index); if (packet.ReadBit("HasAreaTriggerSphere", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Sphere; } if (packet.ReadBit("HasAreaTriggerBox", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Box; } if (packet.ReadBit("HasAreaTriggerPolygon", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Polygon; } if (packet.ReadBit("HasAreaTriggerCylinder", index)) { areaTriggerTemplate.Type = (byte)AreaTriggerType.Cylinder; } bool hasAreaTriggerSpline = packet.ReadBit("HasAreaTriggerSpline", index); if (packet.ReadBit("HasAreaTriggerOrbit", index)) { areaTriggerTemplate.Flags |= (uint)AreaTriggerFlags.HasOrbit; } if ((areaTriggerTemplate.Flags & (uint)AreaTriggerFlags.Unk3) != 0) { packet.ReadBit(); } if (hasAreaTriggerSpline) { V7_0_3_22248.Parsers.AreaTriggerHandler.ReadAreaTriggerSpline(spellAreaTrigger, packet, index); } if ((areaTriggerTemplate.Flags & (uint)AreaTriggerFlags.HasTargetRollPitchYaw) != 0) { packet.ReadVector3("TargetRollPitchYaw", index); } if (hasScaleCurveID) { spellAreaTrigger.ScaleCurveId = (int)packet.ReadUInt32("ScaleCurveID", index); } if (hasMorphCurveID) { spellAreaTrigger.MorphCurveId = (int)packet.ReadUInt32("MorphCurveID", index); } if (hasFacingCurveID) { spellAreaTrigger.FacingCurveId = (int)packet.ReadUInt32("FacingCurveID", index); } if (hasMoveCurveID) { spellAreaTrigger.MoveCurveId = (int)packet.ReadUInt32("MoveCurveID", index); } if ((areaTriggerTemplate.Flags & (int)AreaTriggerFlags.HasAnimId) != 0) { spellAreaTrigger.AnimId = packet.ReadInt32("AnimId", index); } if ((areaTriggerTemplate.Flags & (int)AreaTriggerFlags.HasAnimKitId) != 0) { spellAreaTrigger.AnimKitId = packet.ReadInt32("AnimKitId", index); } if (hasAnimProgress) { packet.ReadUInt32("AnimProgress", index); } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Sphere) { areaTriggerTemplate.Data[0] = packet.ReadSingle("Radius", index); areaTriggerTemplate.Data[1] = packet.ReadSingle("RadiusTarget", index); } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Box) { Vector3 Extents = packet.ReadVector3("Extents", index); Vector3 ExtentsTarget = packet.ReadVector3("ExtentsTarget", index); areaTriggerTemplate.Data[0] = Extents.X; areaTriggerTemplate.Data[1] = Extents.Y; areaTriggerTemplate.Data[2] = Extents.Z; areaTriggerTemplate.Data[3] = ExtentsTarget.X; areaTriggerTemplate.Data[4] = ExtentsTarget.Y; areaTriggerTemplate.Data[5] = ExtentsTarget.Z; } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Polygon) { var verticesCount = packet.ReadUInt32("VerticesCount", index); var verticesTargetCount = packet.ReadUInt32("VerticesTargetCount", index); areaTriggerTemplate.Data[0] = packet.ReadSingle("Height", index); areaTriggerTemplate.Data[1] = packet.ReadSingle("HeightTarget", index); for (uint i = 0; i < verticesCount; ++i) { Vector2 vertices = packet.ReadVector2("Vertices", index, i); } for (var i = 0; i < verticesTargetCount; ++i) { Vector2 verticesTarget = packet.ReadVector2("VerticesTarget", index, i); } } if (areaTriggerTemplate.Type == (byte)AreaTriggerType.Cylinder) { areaTriggerTemplate.Data[0] = packet.ReadSingle("Radius", index); areaTriggerTemplate.Data[1] = packet.ReadSingle("RadiusTarget", index); areaTriggerTemplate.Data[2] = packet.ReadSingle("Height", index); areaTriggerTemplate.Data[3] = packet.ReadSingle("HeightTarget", index); areaTriggerTemplate.Data[4] = packet.ReadSingle("LocationZOffset", index); areaTriggerTemplate.Data[5] = packet.ReadSingle("LocationZOffsetTarget", index); } if ((areaTriggerTemplate.Flags & (uint)AreaTriggerFlags.HasOrbit) != 0) { V7_0_3_22248.Parsers.AreaTriggerHandler.ReadAreaTriggerOrbit(guid, packet, "Orbit"); } Storage.AreaTriggerTemplates.Add(areaTriggerTemplate); } if (hasGameObject) { packet.ResetBitReader(); packet.ReadInt32("WorldEffectID", index); var bit8 = packet.ReadBit("bit8", index); if (bit8) { packet.ReadInt32("Int1", index); } } if (hasSmoothPhasing) { packet.ResetBitReader(); packet.ReadBit("ReplaceActive", index); var replaceObject = packet.ReadBit(); if (replaceObject) { packet.ReadPackedGuid128("ReplaceObject", index); } } if (sceneObjCreate) { packet.ResetBitReader(); var hasSceneLocalScriptData = packet.ReadBit("HasSceneLocalScriptData", index); var petBattleFullUpdate = packet.ReadBit("HasPetBattleFullUpdate", index); if (hasSceneLocalScriptData) { packet.ResetBitReader(); var dataLength = packet.ReadBits(7); packet.ReadWoWString("Data", dataLength, index); } if (petBattleFullUpdate) { V6_0_2_19033.Parsers.BattlePetHandler.ReadPetBattleFullUpdate(packet, index); } } if (playerCreateData) { packet.ResetBitReader(); var hasSceneInstanceIDs = packet.ReadBit("ScenePendingInstances", index); var hasRuneState = packet.ReadBit("Runes", index); var hasActionButtons = packet.ReadBit("Unk1132", index); if (hasSceneInstanceIDs) { var sceneInstanceIDs = packet.ReadInt32("SceneInstanceIDsCount"); for (var i = 0; i < sceneInstanceIDs; ++i) { packet.ReadInt32("SceneInstanceIDs", index, i); } } if (hasRuneState) { packet.ReadByte("RechargingRuneMask", index); packet.ReadByte("UsableRuneMask", index); var runeCount = packet.ReadUInt32(); for (var i = 0; i < runeCount; ++i) { packet.ReadByte("RuneCooldown", index, i); } } if (hasActionButtons) { for (int i = 0; i < 132; i++) { packet.ReadInt32("Action", index, i); } } } if (hasConversation) { packet.ResetBitReader(); if (packet.ReadBit("HasTextureKitID", index)) { (obj as ConversationTemplate).TextureKitId = packet.ReadUInt32("TextureKitID", index); } } return(moveInfo); }