Created
December 11, 2011 13:02
-
-
Save LordJZ/1460491 to your computer and use it in GitHub Desktop.
SMSG_UPDATE_OBJECT movement part as of 4.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WowGuid guid; | |
this.HaveAttackingTarget = Reader.UnalignedReadBit(); | |
guid.Bytes[2] = Reader.UnalignedReadTinyInt(1); | |
this.HaveVehicleData = Reader.UnalignedReadBit(); | |
guid.Bytes[1] = Reader.UnalignedReadTinyInt(1); | |
guid.Bytes[4] = Reader.UnalignedReadTinyInt(1); | |
guid.Bytes[3] = Reader.UnalignedReadTinyInt(1); | |
this.HaveTransportExtra = Reader.UnalignedReadBit(); | |
this.HaveGameObjectPosition = Reader.UnalignedReadBit(); | |
bool field_1C8 = Reader.UnalignedReadBit(); | |
bool field_1AC = Reader.UnalignedReadBit(); | |
this.HaveGameObjectRotation = Reader.UnalignedReadBit(); | |
this.Living = Reader.UnalignedReadBit(); | |
this.HavePosition = Reader.UnalignedReadBit(); | |
var arrCounter = Reader.UnalignedReadInt(24); | |
guid.Bytes[0] = Reader.UnalignedReadTinyInt(1); | |
bool p_field_B0 = false; | |
bool havePFlags = false; | |
WowGuid p_guid; | |
uint splinePoints = 0; | |
bool field_F8 = false; | |
bool field_100 = false; | |
bool p_field_84 = false; | |
bool havePFlags2 = false; | |
bool haveOrientation = false; | |
if (this.Living) | |
{ | |
this.HaveTransportData = Reader.UnalignedReadBit(); | |
if (this.HaveTransportData) | |
{ | |
fixed (byte* bytes = this.TransportGuid.Bytes) | |
{ | |
bytes[2] = Reader.UnalignedReadTinyInt(1); | |
bytes[7] = Reader.UnalignedReadTinyInt(1); | |
bytes[5] = Reader.UnalignedReadTinyInt(1); | |
this.HaveTransportTime3 = Reader.UnalignedReadBit(); | |
bytes[3] = Reader.UnalignedReadTinyInt(1); | |
bytes[0] = Reader.UnalignedReadTinyInt(1); | |
bytes[4] = Reader.UnalignedReadTinyInt(1); | |
bytes[1] = Reader.UnalignedReadTinyInt(1); | |
this.HaveTransportTime2 = Reader.UnalignedReadBit(); | |
bytes[6] = Reader.UnalignedReadTinyInt(1); | |
} | |
} | |
p_field_B0 = Reader.UnalignedReadBit(); | |
p_guid.Bytes[7] = Reader.UnalignedReadTinyInt(1); | |
p_guid.Bytes[6] = Reader.UnalignedReadTinyInt(1); | |
p_guid.Bytes[5] = Reader.UnalignedReadTinyInt(1); | |
p_guid.Bytes[2] = Reader.UnalignedReadTinyInt(1); | |
p_guid.Bytes[4] = Reader.UnalignedReadTinyInt(1); | |
havePFlags = !Reader.UnalignedReadBit(); | |
p_guid.Bytes[1] = Reader.UnalignedReadTinyInt(1); | |
p_field_84 = Reader.UnalignedReadBit(); | |
this.TimeStamp = !Reader.UnalignedReadBit() ? 1U : 0U; | |
havePFlags2 = !Reader.UnalignedReadBit(); | |
if (p_field_B0) | |
{ | |
this.HaveSpline = Reader.UnalignedReadBit(); | |
if (this.HaveSpline) | |
{ | |
field_F8 = Reader.UnalignedReadBit(); | |
this.Spline.Flags = (SplineFlags)Reader.UnalignedReadInt(25); | |
this.Spline.SplineMode = (SplineMode)Reader.UnalignedReadTinyInt(2); | |
field_100 = Reader.UnalignedReadBit(); | |
splinePoints = Reader.UnalignedReadInt(22); | |
this.Spline.SplineType = (SplineType)Reader.UnalignedReadTinyInt(2); | |
if (this.Spline.SplineType == SplineType.FacingTarget) | |
{ | |
fixed (byte* bytes = this.Spline.FacingTarget.Bytes) | |
{ | |
bytes[7] = Reader.UnalignedReadTinyInt(1); | |
bytes[3] = Reader.UnalignedReadTinyInt(1); | |
bytes[4] = Reader.UnalignedReadTinyInt(1); | |
bytes[2] = Reader.UnalignedReadTinyInt(1); | |
bytes[1] = Reader.UnalignedReadTinyInt(1); | |
bytes[6] = Reader.UnalignedReadTinyInt(1); | |
bytes[0] = Reader.UnalignedReadTinyInt(1); | |
bytes[5] = Reader.UnalignedReadTinyInt(1); | |
} | |
} | |
} | |
} | |
p_guid.Bytes[3] = Reader.UnalignedReadTinyInt(1); | |
if (havePFlags) | |
this.Flags = (MovementFlags)Reader.UnalignedReadInt(30); | |
this.HavePitch = !Reader.UnalignedReadBit(); | |
this.HaveFallData = Reader.UnalignedReadBit(); | |
if (havePFlags2) | |
this.Flags2 = (MovementFlags2)Reader.UnalignedReadSmallInt(12); | |
p_guid.Bytes[0] = Reader.UnalignedReadTinyInt(1); | |
haveOrientation = !Reader.UnalignedReadBit(); | |
if (this.HaveFallData) | |
this.HaveFallDirection = Reader.UnalignedReadBit(); | |
this.HaveSplineElevation = !Reader.UnalignedReadBit(); | |
} | |
if (this.HaveGameObjectPosition) | |
{ | |
fixed (byte* bytes = this.TransportGuid.Bytes) | |
{ | |
Console.WriteLine("Error: Game Object Position == true !!"); | |
bytes[1] = Reader.UnalignedReadTinyInt(1); | |
this.HaveTransportTime3 = Reader.UnalignedReadBit(); | |
bytes[3] = Reader.UnalignedReadTinyInt(1); | |
bytes[2] = Reader.UnalignedReadTinyInt(1); | |
bytes[6] = Reader.UnalignedReadTinyInt(1); | |
bytes[5] = Reader.UnalignedReadTinyInt(1); | |
bytes[0] = Reader.UnalignedReadTinyInt(1); | |
bytes[4] = Reader.UnalignedReadTinyInt(1); | |
this.HaveTransportTime2 = Reader.UnalignedReadBit(); | |
bytes[7] = Reader.UnalignedReadTinyInt(1); | |
} | |
} | |
ushort field_1B2 = 0; | |
ushort field_1AE = 0; | |
ushort field_1B0 = 0; | |
if (field_1AC) | |
{ | |
field_1B2 = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0); | |
field_1AE = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0); | |
field_1B0 = (ushort)(!Reader.UnalignedReadBit() ? 1 : 0); | |
} | |
if (this.HaveAttackingTarget) | |
{ | |
fixed (byte* bytes = this.AttackingTarget.Bytes) | |
{ | |
bytes[3] = Reader.UnalignedReadTinyInt(1); | |
bytes[4] = Reader.UnalignedReadTinyInt(1); | |
bytes[6] = Reader.UnalignedReadTinyInt(1); | |
bytes[0] = Reader.UnalignedReadTinyInt(1); | |
bytes[1] = Reader.UnalignedReadTinyInt(1); | |
bytes[7] = Reader.UnalignedReadTinyInt(1); | |
bytes[5] = Reader.UnalignedReadTinyInt(1); | |
bytes[2] = Reader.UnalignedReadTinyInt(1); | |
} | |
} | |
this.UnkUInt32 = new uint[arrCounter]; | |
for (uint i = 0; i < arrCounter; ++i) | |
{ | |
this.UnkUInt32[i] = Reader.ReadUInt32(); | |
} | |
if (this.HavePosition) | |
{ | |
Reader | |
.ReadSingle(out this.Position.Z) | |
.ReadSingle(out this.Orientation) | |
.ReadSingle(out this.Position.X) | |
.ReadSingle(out this.Position.Y); | |
} | |
if (this.HaveVehicleData) | |
{ | |
Reader | |
.ReadUInt32(out this.VehicleId) | |
.ReadSingle(out this.VehicleAimAdjustement); | |
} | |
if (this.HaveGameObjectPosition) | |
{ | |
fixed (byte* bytes = this.TransportGuid.Bytes) | |
{ | |
Reader | |
.XorByte(ref bytes[1]) | |
.XorByte(ref bytes[4]) | |
.ReadSingle(out this.TransportPosition.Z); | |
if (this.HaveTransportTime3) | |
this.TransportTime3 = Reader.ReadUInt32(); | |
this.TransportTime = Reader.ReadUInt32(); | |
Reader | |
.XorByte(ref bytes[5]) | |
.XorByte(ref bytes[6]) | |
.ReadSingle(out this.TransportPosition.X) | |
.XorByte(ref bytes[2]); | |
if (this.HaveTransportTime2) | |
this.TransportTime2 = Reader.ReadUInt32(); | |
Reader | |
.ReadSByte(out this.TransportSeat) | |
.XorByte(ref bytes[3]) | |
.ReadSingle(out this.TransportPosition.Y) | |
.ReadSingle(out this.TransportFacing) | |
.XorByte(ref bytes[7]) | |
.XorByte(ref bytes[0]); | |
} | |
} | |
if (this.Living) | |
{ | |
// B0 = splinedata | |
if (p_field_B0) | |
{ | |
if (this.HaveSpline) | |
{ | |
var points = this.Spline.Points; | |
points.Capacity = (int)splinePoints; | |
for (int i = 0; i < splinePoints; i++) | |
points.Add(new Vector3() | |
{ | |
Y = Reader.ReadSingle(), | |
X = Reader.ReadSingle(), | |
Z = Reader.ReadSingle() | |
}); | |
if (field_F8) | |
{ | |
var field_FC = Reader.ReadSingle(); | |
} | |
var field_F4 = Reader.ReadSingle(); | |
if (this.Spline.SplineType == SplineType.FacingTarget) | |
{ | |
fixed (byte* bytes = this.Spline.FacingTarget.Bytes) | |
{ | |
Reader | |
.XorByte(ref bytes[3]) | |
.XorByte(ref bytes[4]) | |
.XorByte(ref bytes[5]) | |
.XorByte(ref bytes[7]) | |
.XorByte(ref bytes[2]) | |
.XorByte(ref bytes[0]) | |
.XorByte(ref bytes[6]) | |
.XorByte(ref bytes[1]); | |
} | |
} | |
if (field_100) | |
{ | |
var field_104 = Reader.ReadUInt32(); | |
} | |
var field_F0 = Reader.ReadSingle(); | |
var field_E8 = Reader.ReadUInt32(); | |
if (this.Spline.SplineType == SplineType.FacingSpot) | |
{ | |
Reader | |
.ReadSingle(out this.Spline.FacingSpot.Y) | |
.ReadSingle(out this.Spline.FacingSpot.Z) | |
.ReadSingle(out this.Spline.FacingSpot.X); | |
} | |
var field_EC = Reader.ReadUInt32(); | |
if (this.Spline.SplineType == SplineType.FacingAngle) | |
this.Spline.FacingAngle = Reader.ReadSingle(); | |
} | |
uint field_B8; | |
Reader | |
.ReadSingle(out this.Spline.EndPoint.Z) | |
.ReadSingle(out this.Spline.EndPoint.Y) | |
.ReadUInt32(out field_B8) | |
.ReadSingle(out this.Spline.EndPoint.X); | |
} | |
this.Speeds[8] = Reader.ReadSingle(); | |
// Transport Data | |
if (this.HaveTransportData) | |
{ | |
fixed (byte* bytes = this.TransportGuid.Bytes) | |
{ | |
Reader | |
.XorByte(ref bytes[4]) | |
.ReadSingle(out this.TransportPosition.Z) | |
.XorByte(ref bytes[7]) | |
.XorByte(ref bytes[5]) | |
.XorByte(ref bytes[1]) | |
.ReadSingle(out this.TransportPosition.X) | |
.XorByte(ref bytes[3]) | |
.XorByte(ref bytes[6]); | |
if (this.HaveTransportTime3) | |
this.TransportTime3 = Reader.ReadUInt32(); | |
Reader | |
.ReadSingle(out this.TransportPosition.Y) | |
.ReadSByte(out this.TransportSeat) | |
.ReadSingle(out this.TransportFacing); | |
if (this.HaveTransportTime2) | |
this.TransportTime2 = Reader.ReadUInt32(); | |
Reader | |
.XorByte(ref bytes[2]) | |
.ReadUInt32(out this.TransportTime) | |
.XorByte(ref bytes[0]); | |
} | |
} | |
Reader | |
.ReadSingle(out this.Speeds[7]) | |
.ReadSingle(out this.Position.X); | |
if (this.HavePitch) | |
Reader.ReadSingle(out this.Pitch); | |
// Fall Data | |
if (this.HaveFallData) | |
{ | |
Reader.ReadUInt32(out this.FallTime); | |
if (this.HaveFallDirection) | |
{ | |
Reader | |
.ReadSingle(out this.FallSinAngle) | |
.ReadSingle(out this.FallHorizontalSpeed) | |
.ReadSingle(out this.FallCosAngle); | |
} | |
Reader.ReadSingle(out this.FallVerticalSpeed); | |
} | |
Reader | |
.XorByte(ref p_guid.Bytes[7]) | |
.ReadSingle(out this.Speeds[4]) | |
.XorByte(ref p_guid.Bytes[0]) | |
.XorByte(ref p_guid.Bytes[5]); | |
if (this.TimeStamp != 0) | |
this.TimeStamp = Reader.ReadUInt32(); | |
Reader | |
.ReadSingle(out this.Position.Z) | |
.ReadSingle(out this.Speeds[6]) | |
.XorByte(ref p_guid.Bytes[1]) | |
.ReadSingle(out this.Speeds[2]) | |
.ReadSingle(out this.Speeds[5]) | |
.ReadSingle(out this.Speeds[3]) | |
.ReadSingle(out this.Speeds[0]) | |
.XorByte(ref p_guid.Bytes[3]) | |
.XorByte(ref p_guid.Bytes[4]) | |
.XorByte(ref p_guid.Bytes[2]) | |
.XorByte(ref p_guid.Bytes[6]); | |
if (this.HaveSplineElevation) | |
this.SplineElevation = Reader.ReadSingle(); | |
this.Position.Y = Reader.ReadSingle(); | |
if (haveOrientation) | |
this.Orientation = Reader.ReadSingle(); | |
this.Speeds[1] = Reader.ReadSingle(); | |
} | |
if (field_1C8) | |
{ | |
Reader.ReadBytes(16 * 4); // 16 floats starting at 1CC | |
var field_20C = Reader.ReadByte(); | |
} | |
// transport time | |
if (this.HaveTransportExtra) | |
Reader.ReadUInt32(out this.TransportTime); | |
// unk2 ? | |
if (field_1AC) | |
{ | |
if (field_1B0 != 0) | |
field_1B0 = Reader.ReadUInt16(); | |
if (field_1B2 != 0) | |
field_1B2 = Reader.ReadUInt16(); | |
if (field_1AE != 0) | |
field_1AE = Reader.ReadUInt16(); | |
} | |
// go rotation? | |
if (this.HaveGameObjectRotation) | |
this.GameObjectRotation = Reader.ReadUInt64().UnpackQuaternion(); | |
// target guid? | |
if (this.HaveAttackingTarget) | |
{ | |
fixed (byte* bytes = this.AttackingTarget.Bytes) | |
{ | |
Reader | |
.XorByte(ref bytes[3]) | |
.XorByte(ref bytes[5]) | |
.XorByte(ref bytes[0]) | |
.XorByte(ref bytes[7]) | |
.XorByte(ref bytes[2]) | |
.XorByte(ref bytes[4]) | |
.XorByte(ref bytes[6]) | |
.XorByte(ref bytes[1]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment