本文整理汇总了C#中WowPacketParser.Misc.MovementInfo类的典型用法代码示例。如果您正苦于以下问题:C# MovementInfo类的具体用法?C# MovementInfo怎么用?C# MovementInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MovementInfo类属于WowPacketParser.Misc命名空间,在下文中一共展示了MovementInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleUpdateFieldChangedValues
// Outdated, not using new UpdateFields. Plix rewrite.
public static void HandleUpdateFieldChangedValues(Guid guid, ObjectType objType,
Dictionary<int, UpdateField> updates, MovementInfo moves, bool updatingObject = false)
{
/* bool shouldCommit;
bool isIntValue;
bool flags;
const bool isTemplate = true;
var isCreated = false;
string sql;
string fieldName = null;
if (objType == ObjectType.Unit && guid.GetHighType() != HighGuidType.Pet)
{
if (!updatingObject)
{
SQLStore.WriteData(SQLStore.CreatureUpdates.GetCommand("speed_walk", guid.GetEntry(), moves.WalkSpeed));
SQLStore.WriteData(SQLStore.CreatureUpdates.GetCommand("speed_run", guid.GetEntry(), moves.RunSpeed));
}
foreach (var upVal in updates)
{
shouldCommit = true;
isIntValue = true;
flags = false;
var idx = (UnitField)upVal.Key;
var val = upVal.Value;
switch (idx)
{
case UnitField.UNIT_CREATED_BY_SPELL:
case UnitField.UNIT_FIELD_CREATEDBY:
case UnitField.UNIT_FIELD_SUMMONEDBY:
{
isCreated = true;
shouldCommit = false;
break;
}
case (UnitField)ObjectField.OBJECT_FIELD_SCALE_X:
{
fieldName = "scale";
isIntValue = false;
break;
}
case UnitField.UNIT_DYNAMIC_FLAGS:
{
fieldName = "dynamicflags";
flags = true;
break;
}
case UnitField.UNIT_NPC_FLAGS:
{
fieldName = "npcflag";
flags = true;
break;
}
case UnitField.UNIT_FIELD_FLAGS:
{
fieldName = "unit_flags";
flags = true;
break;
}
case UnitField.UNIT_FIELD_ATTACK_POWER:
{
fieldName = "attackpower";
break;
}
case UnitField.UNIT_FIELD_BASEATTACKTIME:
{
fieldName = "baseattacktime";
break;
}
case UnitField.UNIT_FIELD_LEVEL:
{
fieldName = "minlevel = " + val.Int32Value + ", maxlevel";
break;
}
case UnitField.UNIT_FIELD_RANGED_ATTACK_POWER:
{
fieldName = "rangedattackpower";
break;
}
case UnitField.UNIT_FIELD_RANGEDATTACKTIME:
{
fieldName = "rangeattacktime";
break;
}
case UnitField.UNIT_FIELD_FACTIONTEMPLATE:
{
fieldName = "faction_A = " + val.Int32Value + ", faction_H";
break;
}
default:
{
shouldCommit = false;
break;
}
}
//.........这里部分代码省略.........
示例2: ReadMovementUpdateBlock
private static MovementInfo ReadMovementUpdateBlock(ref Packet packet, Guid guid, int index)
{
var lines = new List<string>();
lines.Add("MovementUpdateBlock");
var moveInfo = new MovementInfo();
var flagsTypeCode = ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767) ? TypeCode.UInt16 : TypeCode.Byte;
var flags = packet.ReadEnum<UpdateFlag>("[" + index + "] Update Flags", flagsTypeCode);
lines.Add("[" + index + "] Update Flags");
if (flags.HasAnyFlag(UpdateFlag.Living))
{
moveInfo = MovementHandler.ReadMovementInfo(ref packet, guid, index);
var moveFlags = moveInfo.Flags;
var speedCount = ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056) ? 9 : 8;
int speedShift;
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_1_0_13914) &&
ClientVersion.RemovedInVersion(ClientVersionBuild.V4_2_2_14545))
speedShift = 1; // enums shifted by one
else speedShift = 0;
for (var i = 0; i < speedCount - speedShift; i++)
{
var speedType = (SpeedType)(i + speedShift);
var speed = packet.ReadSingle("["+ index + "] " + speedType + " Speed");
lines.Add("[" + index + "] " + speedType + " Speed: " + speed);
switch (speedType)
{
case SpeedType.Walk:
{
moveInfo.WalkSpeed = speed / 2.5f;
break;
}
case SpeedType.Run:
{
moveInfo.RunSpeed = speed / 7.0f;
break;
}
}
}
// Either movement flags are incorrect for 4.2.2 or this has been removed
if (ClientVersion.RemovedInVersion(ClientVersionBuild.V4_2_2_14545) && moveFlags.HasAnyFlag(MovementFlag.SplineEnabled)
|| moveInfo.HasSplineData)
{
// Temp solution
// TODO: Make Enums version friendly
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
{
var splineFlags422 = packet.ReadEnum<SplineFlag422>("Spline Flags", TypeCode.Int32, index);
lines.Add("Spline Flags: " + splineFlags422.ToString());
if (splineFlags422.HasAnyFlag(SplineFlag422.FinalTarget))
{
Misc.Guid targetGuid = packet.ReadGuid("Final Spline Target GUID", index);
lines.Add("Final Spline Target GUID: " + targetGuid.GetLow());
}
else if (splineFlags422.HasAnyFlag(SplineFlag422.FinalOrientation))
{
float orientation = packet.ReadSingle("Final Spline Orientation", index);
lines.Add("Final Spline Orientation: " + orientation);
}
else if (splineFlags422.HasAnyFlag(SplineFlag422.FinalPoint))
{
Vector3 finalCords = packet.ReadVector3("Final Spline Coords", index);
lines.Add("Final Spline Coords: " + finalCords.ToString());
}
}
else
{
var splineFlags = packet.ReadEnum<SplineFlag>("Spline Flags", TypeCode.Int32, index);
lines.Add("Spline Flags: " + splineFlags.ToString());
if (splineFlags.HasAnyFlag(SplineFlag.FinalTarget))
{
Guid targetGuid = packet.ReadGuid("Final Spline Target GUID", index);
lines.Add("Final Spline Target GUID: " + targetGuid.GetLow());
}
else if (splineFlags.HasAnyFlag(SplineFlag.FinalOrientation))
{
float orientation = packet.ReadSingle("Final Spline Orientation", index);
lines.Add("Final Spline Orientation: " + orientation);
}
else if (splineFlags.HasAnyFlag(SplineFlag.FinalPoint))
{
Vector3 finalCords = packet.ReadVector3("Final Spline Coords", index);
lines.Add("Final Spline Coords: " + finalCords.ToString());
}
}
lines.Add("Spline Time: " + packet.ReadInt32("Spline Time", index));
lines.Add("Spline Full Time: " + packet.ReadInt32("Spline Full Time", index));
packet.ReadInt32("Spline ID", index);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
{
lines.Add("Spline Duration Multiplier: " + packet.ReadSingle("Spline Duration Multiplier", index));
//.........这里部分代码省略.........
示例3: ReadMovementInfo420
private static MovementInfo ReadMovementInfo420(ref Packet packet, int index)
{
var info = new MovementInfo();
info.Flags = packet.ReadEnum<MovementFlag>("Movement Flags", 30, index);
packet.ReadEnum<MovementFlagExtra>("Extra Movement Flags", 12, index);
var onTransport = packet.ReadBit("OnTransport", index);
var hasInterpolatedMovement = false;
var time3 = false;
if (onTransport)
{
hasInterpolatedMovement = packet.ReadBit("HasInterpolatedMovement", index);
time3 = packet.ReadBit("Time3", index);
}
var swimming = packet.ReadBit("Swimming", index);
var interPolatedTurning = packet.ReadBit("InterPolatedTurning", index);
var jumping = false;
if (interPolatedTurning)
jumping = packet.ReadBit("Jumping", index);
var splineElevation = packet.ReadBit("SplineElevation", index);
info.HasSplineData = packet.ReadBit("HasSplineData", index);
packet.ResetBitReader(); // reset bitreader
packet.ReadGuid("GUID 2", index);
packet.ReadInt32("Time", index);
info.Position = packet.ReadVector3("Position", index);
info.Orientation = packet.ReadSingle("Orientation", index);
if (onTransport)
{
info.TransportGuid = packet.ReadGuid("Transport GUID", index);
info.TransportOffset = packet.ReadVector4("Transport Position", index);
packet.ReadByte("Transport Seat", index);
packet.ReadInt32("Transport Time", index);
if (hasInterpolatedMovement)
packet.ReadInt32("Transport Time 2", index);
if (time3)
packet.ReadInt32("Transport Time 3", index);
}
if (swimming)
packet.ReadSingle("Swim Pitch", index);
if (interPolatedTurning)
{
packet.ReadInt32("Time Fallen", index);
packet.ReadSingle("Fall Start Velocity", index);
if (jumping)
{
packet.ReadSingle("Jump Sin", index);
packet.ReadSingle("Jump Cos", index);
packet.ReadSingle("Jump Velocity", index);
}
}
if (splineElevation)
packet.ReadSingle("Spline Elevation", index);
return info;
}
示例4: ReadMovementInfo
public static MovementInfo ReadMovementInfo(ref Packet packet, Guid guid, int index)
{
string prefix = index < 0 ? string.Empty : "[" + index + "] ";
var info = new MovementInfo();
info.Flags = packet.ReadEnum<MovementFlag>(prefix + "Movement Flags", TypeCode.Int32);
var flagsTypeCode = ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056) ? TypeCode.Int16 : TypeCode.Byte;
var flags = packet.ReadEnum<MovementFlagExtra>(prefix + "Extra Movement Flags", flagsTypeCode);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
if (packet.ReadGuid(prefix + "GUID 2") != guid)
packet.Writer.WriteLine("GUIDS NOT EQUAL"); // Fo debuggingz
packet.ReadInt32(prefix + "Time");
var pos = packet.ReadVector4(prefix + "Position");
info.Position = new Vector3(pos.X, pos.Y, pos.Z);
info.Orientation = pos.O;
if (info.Flags.HasAnyFlag(MovementFlag.OnTransport))
{
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
packet.ReadPackedGuid(prefix + "Transport GUID");
else
packet.ReadGuid(prefix + "Transport GUID");
packet.ReadVector4(prefix + "Transport Position");
packet.ReadInt32(prefix + "Transport Time");
if (ClientVersion.AddedInVersion(ClientType.WrathOfTheLichKing))
packet.ReadByte(prefix + "Transport Seat");
if (flags.HasAnyFlag(MovementFlagExtra.InterpolateMove))
packet.ReadInt32(prefix + "Transport Time");
}
if (info.Flags.HasAnyFlag(MovementFlag.Swimming | MovementFlag.Flying) ||
flags.HasAnyFlag(MovementFlagExtra.AlwaysAllowPitching))
packet.ReadSingle(prefix + "Swim Pitch");
if (ClientVersion.RemovedInVersion(ClientType.Cataclysm))
packet.ReadInt32(prefix + "Fall Time");
if (info.Flags.HasAnyFlag(MovementFlag.Falling))
{
if (ClientVersion.AddedInVersion(ClientType.Cataclysm))
packet.ReadInt32(prefix + "Fall Time");
packet.ReadSingle(prefix + "Fall Velocity");
packet.ReadSingle(prefix + "Fall Sin angle");
packet.ReadSingle(prefix + "Fall Cos angle");
packet.ReadSingle(prefix + "Fall Speed");
}
if (info.Flags.HasAnyFlag(MovementFlag.SplineElevation))
packet.ReadSingle(prefix + "Spline Elevation");
return info;
}
示例5: ReadMovementUpdateBlock
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();
//.........这里部分代码省略.........
示例6: ReadMovementUpdateBlock510
private static MovementInfo ReadMovementUpdateBlock510(ref Packet packet, Guid guid, int index)
{
var moveInfo = new MovementInfo();
var bit654 = packet.ReadBit("Has bit654", index);
packet.ReadBit("Self", index);
var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index);
var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index);
/*var bit2 = */ packet.ReadBit();
var bit520 = packet.ReadBit("Has bit520", index);
var unkLoopCounter = packet.ReadBits(24);
var transport = packet.ReadBit("Transport", index);
var hasGameObjectPosition = packet.ReadBit("Has GameObject Position", index);
/*var bit653 = */ packet.ReadBit();
var bit784 = packet.ReadBit("Has bit784", index);
/*var bit652 = */ packet.ReadBit();
/*var bit1 = */ packet.ReadBit();
var living = packet.ReadBit("Living", index);
/*var bit3 = */ packet.ReadBit();
var bit644 = packet.ReadBit("Has bit644", index);
var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index);
var hasVehicleData = packet.ReadBit("Has Vehicle Data", index);
var bits360 = packet.ReadBits(21);
var hasAnimKits = packet.ReadBit("Has AnimKits", index);
for (var i = 0; i < bits360; ++i)
packet.ReadBits(2);
var guid2 = new byte[8];
var facingTargetGuid = new byte[8];
var unkSplineCounter = 0u;
var attackingTargetGuid = new byte[8];
var transportGuid = new byte[8];
var goTransportGuid = new byte[8];
var hasFallData = false;
var hasFallDirection = false;
var hasTimestamp = false;
var hasOrientation = false;
var hasMoveFlagsExtra = false;
var hasMovementFlags = false;
var hasPitch = false;
var hasSplineElevation = false;
var hasTransportData = false;
var hasTransportTime2 = false;
var hasTransportTime3 = false;
var hasFullSpline = false;
var hasSplineVerticalAcceleration = false;
var hasUnkSplineCounter = false;
var hasSplineStartTime = false;
var hasGOTransportTime3 = false;
var hasGOTransportTime2 = false;
var hasAnimKit1 = false;
var hasAnimKit2 = false;
var hasAnimKit3 = false;
var splineType = SplineType.Stop;
var unkLoopCounter2 = 0u;
var splineCount = 0u;
var field8 = false;
var bit540 = false;
var bit552 = false;
var bit580 = false;
var bit624 = false;
var bit147 = 0u;
var bit151 = 0u;
var bit158 = 0u;
var bit198 = 0u;
if (living)
{
guid2[3] = packet.ReadBit();
hasFallData = packet.ReadBit("Has Fall Data", index);
hasTimestamp = !packet.ReadBit("Lacks Timestamp", index);
packet.ReadBit(); // bit172
guid2[2] = packet.ReadBit();
packet.ReadBit(); // bit149
hasPitch = !packet.ReadBit("Lacks Pitch", index);
hasMoveFlagsExtra = !packet.ReadBit();
guid2[4] = packet.ReadBit();
guid2[5] = packet.ReadBit();
unkLoopCounter2 = packet.ReadBits(24);
hasSplineElevation = !packet.ReadBit();
field8 = !packet.ReadBit();
packet.ReadBit(); // bit148
guid2[0] = packet.ReadBit();
guid2[6] = packet.ReadBit();
guid2[7] = packet.ReadBit();
hasTransportData = packet.ReadBit("Has Transport Data", index);
hasOrientation = !packet.ReadBit();
if (hasTransportData)
{
transportGuid[3] = packet.ReadBit();
transportGuid[0] = packet.ReadBit();
transportGuid[4] = packet.ReadBit();
transportGuid[5] = packet.ReadBit();
transportGuid[2] = packet.ReadBit();
transportGuid[7] = packet.ReadBit();
transportGuid[1] = packet.ReadBit();
hasTransportTime2 = packet.ReadBit();
transportGuid[6] = packet.ReadBit();
//.........这里部分代码省略.........
示例7: ReadMovementUpdateBlock434
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;
//.........这里部分代码省略.........
示例8: HandleMovementSetFacing422
public static void HandleMovementSetFacing422(Packet packet)
{
var info = new MovementInfo();
var guidBytes = new byte[8];
var transportGuidBytes = new byte[8];
info.Flags = packet.ReadEnum<MovementFlag>("Movement Flags", 30);
guidBytes[4] = (byte)(packet.ReadBit() ? 1 : 0);
guidBytes[2] = (byte)(packet.ReadBit() ? 1 : 0);
info.HasSplineData = packet.ReadBit("HasSplineData");
guidBytes[3] = (byte)(packet.ReadBit() ? 1 : 0);
guidBytes[5] = (byte)(packet.ReadBit() ? 1 : 0);
packet.ReadEnum<MovementFlagExtra>("Extra Movement Flags", 12);
guidBytes[0] = (byte)(packet.ReadBit() ? 1 : 0);
guidBytes[7] = (byte)(packet.ReadBit() ? 1 : 0);
guidBytes[6] = (byte)(packet.ReadBit() ? 1 : 0);
guidBytes[1] = (byte)(packet.ReadBit() ? 1 : 0);
var splineElevation = packet.ReadBit("HaveSplineElevation");
var havePitch = packet.ReadBit("HavePitch");
var haveFallData = packet.ReadBit("HaveFallData");
var haveFallDirection = false;
if (haveFallData)
haveFallDirection = packet.ReadBit("HaveFallDirection");
var haveTransportData = packet.ReadBit("HaveTransportData");
var haveTransportTime2 = false;
var haveTransportTime3 = false;
if (haveTransportData)
{
transportGuidBytes = packet.StartBitStream(0, 6, 2, 5, 4, 1, 3, 7);
haveTransportTime2 = packet.ReadBit("HaveTransportTime2");
haveTransportTime3 = packet.ReadBit("HaveTransportTime3");
}
info.Orientation = packet.ReadSingle("Orientation");
packet.ReadUInt32("Timestamp");
info.Position = packet.ReadVector3("Position");
packet.ParseBitStream(guidBytes, 7, 5);
if (splineElevation)
packet.ReadSingle("Spline Elevation");
packet.ParseBitStream(guidBytes, 4, 1, 2);
if (havePitch)
packet.ReadSingle("Pitch");
if (haveFallData)
{
packet.ReadUInt32("Fall Time");
packet.ReadSingle("Fall Vertical Speed");
packet.ReadSingle("Fall Horizontal Speed");
if (haveFallDirection)
{
packet.ReadSingle("Fall Cos Angle");
packet.ReadSingle("Fall Sin Angle");
}
}
packet.ParseBitStream(guidBytes, 6, 0);
if (haveTransportData)
{
packet.ReadByte("Transport Seat");
packet.ReadSingle("Transport Orientation");
packet.ReadVector3("Transport Position");
packet.ReadUInt32("Transport Time");
if (haveTransportTime2)
packet.ReadUInt32("Transport Time 2");
packet.ParseBitStream(transportGuidBytes, 3, 6);
if (haveTransportTime3)
packet.ReadUInt32("Transport Time 3");
packet.ParseBitStream(transportGuidBytes, 7, 5, 2, 1, 0, 4);
}
packet.ParseBitStream(guidBytes, 3);
packet.ToGuid("Guid", guidBytes);
packet.ToGuid("Transport Guid", transportGuidBytes);
}
示例9: ReadMovementUpdateBlock
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);
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 = packet.ReadBitsE<MovementFlag>("Movement Flags", 30, index);
moveInfo.FlagsExtra = packet.ReadBitsE<MovementFlagExtra>("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);
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 (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();
//.........这里部分代码省略.........
示例10: HandleMovementSetFacing422
public static void HandleMovementSetFacing422(Packet packet)
{
var info = new MovementInfo();
var guidBytes = new byte[8];
var transportGuidBytes = new byte[8];
info.Flags = packet.ReadEnum<MovementFlag>("Movement Flags", 30);
guidBytes[4] = (byte)(packet.ReadBit() ? 1 : 0);
guidBytes[2] = (byte)(packet.ReadBit() ? 1 : 0);
info.HasSplineData = packet.ReadBit("HasSplineData");
guidBytes[3] = (byte)(packet.ReadBit() ? 1 : 0);
guidBytes[5] = (byte)(packet.ReadBit() ? 1 : 0);
packet.ReadEnum<MovementFlagExtra>("Extra Movement Flags", 12);
guidBytes[0] = (byte)(packet.ReadBit() ? 1 : 0);
guidBytes[7] = (byte)(packet.ReadBit() ? 1 : 0);
guidBytes[6] = (byte)(packet.ReadBit() ? 1 : 0);
guidBytes[1] = (byte)(packet.ReadBit() ? 1 : 0);
var splineElevation = packet.ReadBit("HaveSplineElevation");
var havePitch = packet.ReadBit("HavePitch");
var haveFallData = packet.ReadBit("HaveFallData");
var haveFallDirection = false;
if (haveFallData)
haveFallDirection = packet.ReadBit("HaveFallDirection");
var haveTransportData = packet.ReadBit("HaveTransportData");
var haveTransportTime2 = false;
var haveTransportTime3 = false;
if (haveTransportData)
{
transportGuidBytes[0] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuidBytes[6] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuidBytes[2] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuidBytes[5] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuidBytes[4] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuidBytes[1] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuidBytes[3] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuidBytes[7] = (byte)(packet.ReadBit() ? 1 : 0);
haveTransportTime2 = packet.ReadBit("HaveTransportTime2");
haveTransportTime3 = packet.ReadBit("HaveTransportTime3");
}
info.Orientation = packet.ReadSingle("Orientation");
packet.ReadUInt32("Timestamp");
info.Position = packet.ReadVector3("Position");
if (guidBytes[7] != 0) guidBytes[7] ^= packet.ReadByte();
if (guidBytes[5] != 0) guidBytes[5] ^= packet.ReadByte();
if (splineElevation)
packet.ReadSingle("Spline Elevation");
if (guidBytes[4] != 0) guidBytes[4] ^= packet.ReadByte();
if (guidBytes[1] != 0) guidBytes[1] ^= packet.ReadByte();
if (guidBytes[2] != 0) guidBytes[2] ^= packet.ReadByte();
if (havePitch)
packet.ReadSingle("Pitch");
if (haveFallData)
{
packet.ReadUInt32("Fall Time");
packet.ReadSingle("Fall Vertical Speed");
packet.ReadSingle("Fall Horizontal Speed");
if (haveFallDirection)
{
packet.ReadSingle("Fall Cos Angle");
packet.ReadSingle("Fall Sin Angle");
}
}
if (guidBytes[6] != 0)
guidBytes[6] ^= packet.ReadByte();
if (guidBytes[0] != 0)
guidBytes[0] ^= packet.ReadByte();
if (haveTransportData)
{
packet.ReadByte("Transport Seat");
packet.ReadSingle("Transport Orientation");
packet.ReadSingle("Transport Position X");
packet.ReadSingle("Transport Position Y");
packet.ReadSingle("Transport Position Z");
packet.ReadUInt32("Transport Time");
//.........这里部分代码省略.........
示例11: ReadMovementUpdateBlock
private static MovementInfo ReadMovementUpdateBlock(ref 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;
var bit28D = 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
var isSelf = 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 = packet.ReadEnum<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();
}
//.........这里部分代码省略.........
示例12: ReadMovementUpdateBlock
private static MovementInfo ReadMovementUpdateBlock(ref Packet packet, Guid guid, int 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 hasFallData = false;
var hasFallDirection = false;
var hasFullSpline = false;
var hasGOTransportTime2 = false;
var hasGOTransportTime3 = false;
var hasMovementFlags = false;
var hasMoveFlagsExtra = false;
var hasOrientation = false;
var hasParabolicAndNotEnded = false;
var hasParabolicOrAnimation = false;
var hasPitch = false;
var hasSplineElevation = false;
var hasTransportData = false;
var hasTransportTime2 = false;
var hasTransportTime3 = false;
var hasTimestamp = false;
var hasUnkSpline = false;
var hasDWordA0 = false;
var byte8C = false;
var byteA4 = false;
var byte8D = false;
var splineCount = 0u;
var Unk19BitsCounter = 0u;
var UnkSpline_21BitsCounter = 0u;
var Unk22BitsCounter = 0u;
var splineType = SplineType.Stop;
var hasVehicleData = packet.ReadBit("Has Vehicle Data", index);
var isSelf = packet.ReadBit("Self", index);
packet.ReadBit(); // fake bit
var transport = packet.ReadBit("Transport", index);
packet.ReadBit(); // fake bit
var byte2A9 = packet.ReadBit("byte2A9", index);
var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index);
var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index);
var isAreaTrigger = packet.ReadBit("Area Trigger", index);
var byte428 = packet.ReadBit("byte428", index);
var isSceneObject = packet.ReadBit("Scene Object", index);
packet.ReadBit(); // fake bit
var byte32A = packet.ReadBit("byte32A", index);
var transportFrames = packet.ReadBits(22);
var living = packet.ReadBit("Living", index);
var hasGameObjectPosition = packet.ReadBit("Has GameObject Position", index);
packet.ReadBit(); // fake bit
var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index);
var byte2A4 = packet.ReadBit("byte2A4", index);
var byte414 = packet.ReadBit("byte414", index);
var hasAnimKits = packet.ReadBit("Has AnimKits", index);
if (living)
{
// need update
guid1[5] = packet.ReadBit();
byte8D = packet.ReadBit();
hasSplineElevation = !packet.ReadBit();
guid1[6] = packet.ReadBit();
byteA4 = packet.ReadBit();
Unk19BitsCounter = packet.ReadBits(19);
if (Unk19BitsCounter != 0)
for (var i = 0; i < Unk19BitsCounter; ++i)
packet.ReadBits("Unk19BitsCounter", 2, index);
guid1[4] = packet.ReadBit();
hasOrientation = !packet.ReadBit();
hasMoveFlagsExtra = !packet.ReadBit();
hasDWordA0 = !packet.ReadBit();
guid1[2] = packet.ReadBit();
guid1[3] = packet.ReadBit();
guid1[7] = packet.ReadBit();
Unk22BitsCounter = packet.ReadBits(22);
hasMovementFlags = !packet.ReadBit();
hasTimestamp = !packet.ReadBit("Lacks timestamp", index);
hasPitch = !packet.ReadBit("Lacks pitch", index);
//.........这里部分代码省略.........
示例13: ReadMovementUpdateBlock548
private static MovementInfo ReadMovementUpdateBlock548(ref Packet packet, Guid guid, int index)
{
var moveInfo = new MovementInfo();
var guid1 = new byte[8];
var transportGuid = new byte[8];
var goTransportGuid = new byte[8];
var targetGuid = new byte[8];
var SplineFacingTargetGuid = new byte[8];
var hasFallDirection = false;
var hasOrientation = false;
var hasFallData = false;
var bit336 = false;
var hasSplineStartTime = false;
var splineCount = 0u;
var splineType = SplineType.Stop;
var hasSplineVerticalAcceleration = false;
var hasSplineUnkPart = false;
var hasTransport = false;
var hasTransportTime2 = false;
var hasTransportTime3 = false;
var hasGOTransportTime2 = false;
var hasGOTransportTime3 = false;
var hasAnimKit1 = false;
var hasAnimKit2 = false;
var hasAnimKit3 = false;
var Unk2Count = 0u;
var Unk9Count = 0u;
var loopcnt = 0u;
var unk284count = 0u;
var readUint32 = false;
var unk144count = 0u;
var hasPitch = false;
var skipInt = false;
var hasSplineElevation = false;
packet.ResetBitReader();
var hasUnk1 = packet.ReadBit("hasUnk1", index); // 676+
var hasAnimKits = packet.ReadBit("Has AnimKits", index); // 498+
var hasLiving = packet.ReadBit("Has Living", index); // 368+-
var hasUnk2 = packet.ReadBit("hasUnk2", index); // 810+
var hasUnk3 = packet.ReadBit("hasUnk3", index); // 2-
var transportFrames = packet.ReadBits("Unknown array size", 22, index); // 1068+
var hasVehicle = packet.ReadBit("Has Vehicle Data", index); // 488+
var hasUnk4 = packet.ReadBit("hasUnk4", index); // 1044+
var hasUnk5 = packet.ReadBit("hasUnk5", index); // 1
var hasUnk6 = packet.ReadBit("hasUnk6", index); // 476+
var hasGobjectRotation = packet.ReadBit("Has GameObject Rotation", index); // 512+
var hasUnk7 = packet.ReadBit("hasUnk7", index); // 3
var hasUpdateFlagSelf = packet.ReadBit("Has Update Flag Self", index); // 680-
var hasTarget = packet.ReadBit("Has Target", index); // 464+
var hasSceneObjectData = packet.ReadBit("hasSceneObjectData", index); // 1032+
var hasUnk9 = packet.ReadBit("hasUnk9", index); // 1064+
var hasUnk10 = packet.ReadBit("hasUnk10", index); // 0
var hasUnk11 = packet.ReadBit("hasUnk11", index); // 668+
var hasGOPosition = packet.ReadBit("Has goTransport Position", index); // 424+
var hasUnk12 = packet.ReadBit("hasUnk12", index); // 681-
var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index); // 448
//42bits
if (hasLiving) // 368
{
guid1[2] = packet.ReadBit(); // 10
packet.ReadBit(); // 140-
hasPitch = !packet.ReadBit("!Has Pitch", index); // 104+ if (skipFloat) dword ptr [esi+68h] = 0 else dword ptr [esi+68h] = ds:dword_D26EA8
hasTransport = packet.ReadBit("has transport", index); // 96+
packet.ReadBit(); // 164-
if (hasTransport) // 96
{
transportGuid[4] = packet.ReadBit(); // 52
transportGuid[2] = packet.ReadBit(); // 50
hasTransportTime3 = packet.ReadBit("Transport Time3", index); // 92+
transportGuid[0] = packet.ReadBit(); // 48
transportGuid[1] = packet.ReadBit(); // 49
transportGuid[3] = packet.ReadBit(); // 51
transportGuid[6] = packet.ReadBit(); // 54
transportGuid[7] = packet.ReadBit(); // 55
hasTransportTime2 = packet.ReadBit("Transport Time2", index); // 84+
transportGuid[5] = packet.ReadBit(); // 53
}
readUint32 = !packet.ReadBit("skip readunit32", index); // 24+
guid1[6] = packet.ReadBit(); // 14
guid1[4] = packet.ReadBit(); // 12
guid1[3] = packet.ReadBit(); // 11
hasOrientation = !packet.ReadBit("skip Orient", index); // 40+ if (hasOrientation) dword ptr [esi+28h] = 0 else dword ptr [esi+28h] = ds:dword_D26EA8
skipInt = !packet.ReadBit("no has Int", index); // 160*4 +
guid1[5] = packet.ReadBit(); // 13
unk144count = packet.ReadBits("Is Living Unk Counter", 22, index); // 144+
var hasMovementFlags = !packet.ReadBit("!hasMovementFlags", index); // 16*4 +
loopcnt = packet.ReadBits("IsLicingUnkLoop", 19, index); // 352+
for (var i = 0; i < loopcnt; i++ ) // 352
{
packet.ReadBits("unk356", 2, index, i); // 356
//.........这里部分代码省略.........
示例14: ReadMovementUpdateBlock434
private static MovementInfo ReadMovementUpdateBlock434(ref Packet packet, Guid guid, int 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);
/*var bit0 =*/ packet.ReadBit();
var hasVehicleData = packet.ReadBit("Has Vehicle Data", index);
var living = packet.ReadBit("Living", index);
var unkLoopCounter = packet.ReadBits(24);
/*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 bit408 = packet.ReadBit();
var hasOrientation = false;
var guid2 = new byte[8];
var dword28 = false;
var hasFallData = false;
var hasUnkFloat2 = false;
var hasTransportData = false;
var unkUInt = 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();
guid2[7] = (byte)(packet.ReadBit() ? 1 : 0);
guid2[3] = (byte)(packet.ReadBit() ? 1 : 0);
guid2[2] = (byte)(packet.ReadBit() ? 1 : 0);
if (hasMovementFlags)
moveInfo.Flags = packet.ReadEnum<MovementFlag>("Movement Flags", 30, index);
packet.ReadBit();
dword28 = !packet.ReadBit();
moveInfo.HasSplineData = packet.ReadBit("Has Spline Data", index);
hasFallData = packet.ReadBit("Has Fall Data", index);
hasUnkFloat2 = !packet.ReadBit();
guid2[5] = (byte)(packet.ReadBit() ? 1 : 0);
hasTransportData = packet.ReadBit("Has transport data", index);
unkUInt = !packet.ReadBit();
if (hasTransportData)
{
transportGuid[1] = (byte)(packet.ReadBit() ? 1 : 0);
hasTransportTime2 = packet.ReadBit();
transportGuid[4] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuid[0] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuid[6] = (byte)(packet.ReadBit() ? 1 : 0);
hasTransportTime3 = packet.ReadBit();
transportGuid[7] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuid[5] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuid[3] = (byte)(packet.ReadBit() ? 1 : 0);
transportGuid[2] = (byte)(packet.ReadBit() ? 1 : 0);
}
guid2[4] = (byte)(packet.ReadBit() ? 1 : 0);
if (moveInfo.HasSplineData)
{
bit216 = packet.ReadBit();
if (bit216)
{
/*var splineMode =*/ packet.ReadBits(2);
hasSplineStartTime = packet.ReadBit();
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;
//.........这里部分代码省略.........
示例15: ReadMovementUpdateBlock
private static MovementInfo ReadMovementUpdateBlock(ref Packet packet, Guid guid, int index)
{
if (ClientVersion.Build == ClientVersionBuild.V5_1_0_16309 || ClientVersion.Build == ClientVersionBuild.V5_1_0a_16357)
return ReadMovementUpdateBlock510(ref packet, guid, index);
if (ClientVersion.Build == ClientVersionBuild.V5_0_4_16016 || ClientVersion.Build == ClientVersionBuild.V5_0_5_16048 || ClientVersion.Build == ClientVersionBuild.V5_0_5a_16057 || ClientVersion.Build == ClientVersionBuild.V5_0_5b_16135)
return ReadMovementUpdateBlock504(ref packet, guid, index);
if (ClientVersion.Build == ClientVersionBuild.V4_3_4_15595)
return ReadMovementUpdateBlock434(ref packet, guid, index);
if (ClientVersion.Build == ClientVersionBuild.V4_3_3_15354)
return ReadMovementUpdateBlock433(ref packet, guid, index);
if (ClientVersion.Build == ClientVersionBuild.V4_3_2_15211)
return ReadMovementUpdateBlock432(ref packet, guid, index);
if (ClientVersion.Build == ClientVersionBuild.V4_3_0_15005 || ClientVersion.Build == ClientVersionBuild.V4_3_0a_15050)
return ReadMovementUpdateBlock430(ref packet, guid, index);
var moveInfo = new MovementInfo();
var flagsTypeCode = ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767) ? TypeCode.UInt16 : TypeCode.Byte;
var flags = packet.ReadEnum<UpdateFlag>("[" + index + "] Update Flags", flagsTypeCode);
if (flags.HasAnyFlag(UpdateFlag.Living))
{
moveInfo = MovementHandler.ReadMovementInfo(ref packet, guid, index);
var moveFlags = moveInfo.Flags;
for (var i = 0; i < 9; ++i)
{
var speedType = (SpeedType)i;
var speed = packet.ReadSingle(speedType + " Speed", index);
switch (speedType)
{
case SpeedType.Walk:
{
moveInfo.WalkSpeed = speed / 2.5f;
break;
}
case SpeedType.Run:
{
moveInfo.RunSpeed = speed / 7.0f;
break;
}
}
}
// Movement flags seem incorrect for 4.2.2
// guess in which version they stopped checking movement flag and used bits
if ((ClientVersion.RemovedInVersion(ClientVersionBuild.V4_2_0_14333) && moveFlags.HasAnyFlag(MovementFlag.SplineEnabled)) || moveInfo.HasSplineData)
{
// Temp solution
// TODO: Make Enums version friendly
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_0_14333))
{
var splineFlags422 = packet.ReadEnum<SplineFlag422>("Spline Flags", TypeCode.Int32, index);
if (splineFlags422.HasAnyFlag(SplineFlag422.FinalOrientation))
{
packet.ReadSingle("Final Spline Orientation", index);
}
else
{
if (splineFlags422.HasAnyFlag(SplineFlag422.FinalTarget))
packet.ReadGuid("Final Spline Target GUID", index);
else if (splineFlags422.HasAnyFlag(SplineFlag422.FinalPoint))
packet.ReadVector3("Final Spline Coords", index);
}
}
else
{
var splineFlags = packet.ReadEnum<SplineFlag>("Spline Flags", TypeCode.Int32, index);
if (splineFlags.HasAnyFlag(SplineFlag.FinalTarget))
packet.ReadGuid("Final Spline Target GUID", index);
else if (splineFlags.HasAnyFlag(SplineFlag.FinalOrientation))
packet.ReadSingle("Final Spline Orientation", index);
else if (splineFlags.HasAnyFlag(SplineFlag.FinalPoint))
packet.ReadVector3("Final Spline Coords", index);
}
packet.ReadInt32("Spline Time", index);
packet.ReadInt32("Spline Full Time", index);
packet.ReadInt32("Spline ID", index);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
{
packet.ReadSingle("Spline Duration Multiplier", index);
packet.ReadSingle("Spline Duration Multiplier Next", index);
packet.ReadSingle("Spline Vertical Acceleration", index);
packet.ReadInt32("Spline Start Time", index);
}
var splineCount = packet.ReadInt32();
for (var i = 0; i < splineCount; i++)
packet.ReadVector3("Spline Waypoint", index, i);
if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
packet.ReadEnum<SplineMode>("Spline Mode", TypeCode.Byte, index);
//.........这里部分代码省略.........