public void ReadOutcoming() { PacketId = BS.ReadUInt8(); FromPlayerId = BS.ReadUInt16(); //LEFT/RIGHT KEYS bool hasLR = BS.ReadBool(); if (hasLR) { LRKey = BS.ReadUInt16(); } // UP/DOWN KEYS bool hasUD = BS.ReadBool(); if (hasUD) { UDKey = BS.ReadUInt16(); } var arguments = new List <object>() { ParamType.UInt16, "keys", ParamType.Float, "position_0", ParamType.Float, "position_1", ParamType.Float, "position_2" }; var result = BS.ReadValue(arguments.ToArray()); Keys = (int)result["keys"]; Position = new Vector3((float)result["position_0"], (float)result["position_1"], (float)result["position_2"]); Quaternion = BS.ReadNormQuat(); result = BS.ReadValue( ParamType.UInt8, "healthArmourByte", ParamType.UInt8, "weaponId", ParamType.UInt8, "specialAction" ); byte healthArmour = Convert.ToByte(((int)result["healthArmourByte"])); HealthArmour.GetFromByte(healthArmour, out int health, out int armour); Health = health; Armour = armour; WeaponId = (int)result["weaponId"]; SpecialAction = (int)result["specialAction"]; Velocity = BS.ReadVector(); bool hasSurfInfo = BS.ReadBool(); if (hasSurfInfo) { SurfingVehicleId = BS.ReadUInt16(); float offsetsX = BS.ReadFloat(); float offsetsY = BS.ReadFloat(); float offsetsZ = BS.ReadFloat(); SurfingOffsets = new Vector3(offsetsX, offsetsY, offsetsZ); } else { SurfingVehicleId = -1; } bool hasAnimation = BS.ReadBool(); if (hasAnimation) { AnimationId = BS.ReadInt32(); } }
public void ReadOutcoming() { PacketId = BS.ReadUInt8(); FromPlayerId = BS.ReadUInt16(); VehicleId = BS.ReadUInt16(); // LEFT/RIGHT KEYS LRKey = BS.ReadUInt16(); // UP/DOWN KEYS UDKey = BS.ReadUInt16(); // GENERAL KEYS Keys = BS.ReadUInt16(); // ROTATION Quaternion = BS.ReadNormQuat(); float x = BS.ReadFloat(); float y = BS.ReadFloat(); float z = BS.ReadFloat(); Position = new Vector3(x, y, z); Velocity = BS.ReadVector(); VehicleHealth = (float)BS.ReadUInt16(); byte healthArmour = Convert.ToByte(BS.ReadUInt8()); HealthArmour.GetFromByte(healthArmour, out int health, out int armour); PlayerHealth = health; PlayerArmour = armour; WeaponId = BS.ReadUInt8(); bool sirenState = BS.ReadCompressedBool(); if (sirenState) { SirenState = 1; } bool landingGear = BS.ReadCompressedBool(); if (landingGear) { LandingGearState = 1; } // HYDRA THRUST ANGLE AND TRAILER Id bool hydra = BS.ReadCompressedBool(); bool trailer = BS.ReadCompressedBool(); int trailerId_or_thrustAngle = BS.ReadUInt32(); bool train = BS.ReadCompressedBool(); if (train) { TrainSpeed = (float)BS.ReadUInt8(); } }