using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BombRushMP.Common.Networking; using BombRushMP.Plugin; using CarJack.Common; using CarJack.Common.WhipRemix; using Microsoft.CodeAnalysis; using Reptile; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("CarJack.AllCityNetwork")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("All City Network CarJack Plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+378538fa9503b5513da6dbe7c4c8fe62d1c5de3d")] [assembly: AssemblyProduct("CarJack.AllCityNetwork")] [assembly: AssemblyTitle("CarJack.AllCityNetwork")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CarJack.AllCityNetwork { public class BallController : MonoBehaviour { [CompilerGenerated] private static class <>O { public static OnStageInitializedDelegate <0>__StageManager_OnStageInitialized; } private const float LerpMaxDistance = 10f; private const float Lerp = 10f; private const string BallSubHostPacketGUID = "CarJack-Ball-SubHost"; private const string BallHostPacketGUID = "CarJack-Ball-Host"; private const string BallPacketGUID = "CarJack-Ball"; private const float TickRate = 0.2f; private const string BallGameObjectName = "rocket ball"; private GameObject _ball; private Rigidbody _ballRB; private float _currentTick = 0.2f; private bool _host; private bool _subHost; private bool _hostFound; private bool _subHostFound; private Vector3 _receivedPosition; private Quaternion _receivedRotation; public static void Initialize() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__StageManager_OnStageInitialized; if (obj == null) { OnStageInitializedDelegate val = StageManager_OnStageInitialized; <>O.<0>__StageManager_OnStageInitialized = val; obj = (object)val; } StageManager.OnStageInitialized += (OnStageInitializedDelegate)obj; } private void Awake() { ClientController.RegisterCustomPacketHandler("CarJack-Ball", (Action)OnBallPacketReceived); ClientController.RegisterCustomPacketHandler("CarJack-Ball-Host", (Action)delegate(ushort ply, byte[] data) { OnBallHostPacketReceived(ply, data, subhost: false); }); ClientController.RegisterCustomPacketHandler("CarJack-Ball-SubHost", (Action)delegate(ushort ply, byte[] data) { OnBallHostPacketReceived(ply, data, subhost: true); }); } private void Update() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (Core.Instance.IsCorePaused || !_hostFound || !_subHostFound) { return; } if (_subHost) { _receivedPosition = _ballRB.position; _receivedRotation = _ballRB.rotation; return; } Vector3 val = _ballRB.position - _receivedPosition; if (((Vector3)(ref val)).magnitude >= 10f) { _ballRB.MovePosition(_receivedPosition); _ballRB.MoveRotation(_receivedRotation); return; } Vector3 val2 = Vector3.Lerp(_ballRB.position, _receivedPosition, 10f * Time.deltaTime); Quaternion val3 = Quaternion.Lerp(_ballRB.rotation, _receivedRotation, 10f * Time.deltaTime); _ballRB.MovePosition(val2); _ballRB.MoveRotation(val3); } private void UpdateHost() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) List playerCars = NetworkController.Instance.PlayerCars; float num = float.MaxValue; ushort num2 = ushort.MaxValue; float num3 = float.MaxValue; DrivableCar currentCar = CarController.Instance.CurrentCar; Vector3 val; if ((Object)(object)currentCar != (Object)null) { val = currentCar.Rigidbody.position - _ballRB.position; num3 = ((Vector3)(ref val)).magnitude; } foreach (PlayerCarData item in playerCars) { val = item.LastPacket.Position - _ballRB.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < num) { num = magnitude; num2 = item.PlayerID; } } if (num2 == -1) { _subHost = true; _subHostFound = true; SendBallHostPacket(ushort.MaxValue, subHost: true); } else if (num3 < num) { _subHost = true; _subHostFound = true; SendBallHostPacket(ushort.MaxValue, subHost: true); } else { _subHost = false; _subHostFound = true; SendBallHostPacket(num2, subHost: true); } } private void FixedUpdate() { if (Core.Instance.IsCorePaused || !ClientController.Instance.Connected) { return; } _currentTick -= Time.deltaTime; if (!(_currentTick <= 0f)) { return; } _currentTick = 0.2f; if (_subHost) { SendBallPacket(); } if (!_host) { Dictionary.KeyCollection keys = ClientController.Instance.Players.Keys; ushort num = ushort.MaxValue; foreach (ushort item in keys) { if (item <= num && NetworkController.Instance.PlayerHasCar(item)) { num = item; } } if (num != ushort.MaxValue) { SendBallHostPacket(num, subHost: false); _hostFound = true; } else { _hostFound = false; _subHostFound = false; } } else { UpdateHost(); } } private void OnDestroy() { ClientController.UnregisterCustomPacketHandler("CarJack-Ball"); ClientController.UnregisterCustomPacketHandler("CarJack-Ball-Host"); ClientController.UnregisterCustomPacketHandler("CarJack-Ball-SubHost"); } private void SendBallHostPacket(ushort playerID, bool subHost) { MemoryStream memoryStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write((byte)0); binaryWriter.Write(playerID); binaryWriter.Flush(); if (subHost) { ClientController.Instance.BroadcastCustomPacket(memoryStream.ToArray(), "CarJack-Ball-SubHost", (SendModes)2); } else { ClientController.Instance.BroadcastCustomPacket(memoryStream.ToArray(), "CarJack-Ball-Host", (SendModes)2); } binaryWriter.Close(); } private void SendBallPacket() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) MemoryStream memoryStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(memoryStream); Vector3 position = _ballRB.position; Quaternion rotation = _ballRB.rotation; Vector3 velocity = _ballRB.velocity; Vector3 angularVelocity = _ballRB.angularVelocity; binaryWriter.Write((byte)0); binaryWriter.Write(position.x); binaryWriter.Write(position.y); binaryWriter.Write(position.z); binaryWriter.Write(rotation.x); binaryWriter.Write(rotation.y); binaryWriter.Write(rotation.z); binaryWriter.Write(rotation.w); binaryWriter.Write(velocity.x); binaryWriter.Write(velocity.y); binaryWriter.Write(velocity.z); binaryWriter.Write(angularVelocity.x); binaryWriter.Write(angularVelocity.y); binaryWriter.Write(angularVelocity.z); binaryWriter.Flush(); ClientController.Instance.BroadcastCustomPacket(memoryStream.ToArray(), "CarJack-Ball", (SendModes)0); binaryWriter.Close(); } private void OnBallHostPacketReceived(ushort playerid, byte[] data, bool subhost) { if (playerid == ClientController.Instance.LocalID) { return; } BinaryReader binaryReader = new BinaryReader(new MemoryStream(data)); binaryReader.ReadByte(); ushort num = binaryReader.ReadUInt16(); binaryReader.Close(); if (num != ClientController.Instance.LocalID) { if (!subhost) { _host = false; _hostFound = true; } else { _subHost = false; _subHostFound = true; } } else if (!subhost) { _host = true; _hostFound = true; } else { _subHost = true; _subHostFound = true; } } private void OnBallPacketReceived(ushort playerid, byte[] data) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (playerid != ClientController.Instance.LocalID && !_subHost) { BinaryReader binaryReader = new BinaryReader(new MemoryStream(data)); binaryReader.ReadByte(); float num = binaryReader.ReadSingle(); float num2 = binaryReader.ReadSingle(); float num3 = binaryReader.ReadSingle(); float num4 = binaryReader.ReadSingle(); float num5 = binaryReader.ReadSingle(); float num6 = binaryReader.ReadSingle(); float num7 = binaryReader.ReadSingle(); float num8 = binaryReader.ReadSingle(); float num9 = binaryReader.ReadSingle(); float num10 = binaryReader.ReadSingle(); float num11 = binaryReader.ReadSingle(); float num12 = binaryReader.ReadSingle(); float num13 = binaryReader.ReadSingle(); _ballRB.velocity = new Vector3(num8, num9, num10); _ballRB.angularVelocity = new Vector3(num11, num12, num13); _receivedPosition = new Vector3(num, num2, num3); _receivedRotation = new Quaternion(num4, num5, num6, num7); binaryReader.Close(); } } private static void StageManager_OnStageInitialized() { GameObject val = GameObject.Find("rocket ball"); if (!((Object)(object)val == (Object)null)) { Create(val); } } private static BallController Create(GameObject ball) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) BallController ballController = new GameObject("Ball Controller").AddComponent(); ballController.SetBall(ball); return ballController; } private void SetBall(GameObject ball) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) _ball = ball; _ballRB = ball.GetComponentInChildren(); _receivedPosition = _ballRB.position; _receivedRotation = _ballRB.rotation; } } public class NetworkController : MonoBehaviour { [CompilerGenerated] private static class <>O { public static OnStageInitializedDelegate <0>__StageManager_OnStageInitialized; } public List PlayerCars; private static CameraBlocker _specCameraBlocker = new CameraBlocker(); private const byte KickPassengersPacketVersion = 0; private const string KickPassengersPacketGUID = "CarJack-KickPassengers"; private const float LerpMaxDistance = 20f; private const float Lerp = 5f; private const float TickRate = 0.2f; private Dictionary _playerCarsById; private float _currentTick = 0.2f; public static NetworkController Instance { get; private set; } public static void Initialize() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__StageManager_OnStageInitialized; if (obj == null) { OnStageInitializedDelegate val = StageManager_OnStageInitialized; <>O.<0>__StageManager_OnStageInitialized = val; obj = (object)val; } StageManager.OnStageInitialized += (OnStageInitializedDelegate)obj; CarCamera.Blockers.Add(_specCameraBlocker); } private static void StageManager_OnStageInitialized() { Create(); } private static NetworkController Create() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return new GameObject("CarJack Network Controller").AddComponent(); } private void Awake() { Instance = this; PlayerCars = new List(); _playerCarsById = new Dictionary(); ClientController.RegisterCustomPacketHandler("CarJack-KickPassengers", (Action)OnKickPassengersPacketReceived); ClientController.RegisterCustomPacketHandler("CarJack-PlayerCar", (Action)OnPlayerCarDataPacketReceived); CarController.OnPlayerVisualUpdated = (Action)Delegate.Combine(CarController.OnPlayerVisualUpdated, new Action(OnPlayerVisualUpdated)); CarController.OnPlayerExitingCar = (Action)Delegate.Combine(CarController.OnPlayerExitingCar, new Action(SendKickPassengersPacket)); } private void OnDestroy() { ClientController.UnregisterCustomPacketHandler("CarJack-KickPassengers"); ClientController.UnregisterCustomPacketHandler("CarJack-PlayerCar"); CarController.OnPlayerVisualUpdated = (Action)Delegate.Remove(CarController.OnPlayerVisualUpdated, new Action(OnPlayerVisualUpdated)); CarController.OnPlayerExitingCar = (Action)Delegate.Remove(CarController.OnPlayerExitingCar, new Action(SendKickPassengersPacket)); } private void OnPlayerVisualUpdated(Player player) { if (player.isAI) { MPPlayer muliplayerPlayer = MPUtility.GetMuliplayerPlayer(player); if (muliplayerPlayer != null && _playerCarsById.TryGetValue(muliplayerPlayer.ClientId, out var value) && (Object)(object)value.Car != (Object)null && (Object)(object)value.Seat != (Object)null) { value.Seat.UpdateVisual(); } } } private void SendKickPassengersPacket() { DrivableCar currentCar = CarController.Instance.CurrentCar; if (!((Object)(object)currentCar == (Object)null) && currentCar.Driving) { ClientController.Instance.BroadcastCustomPacket(new byte[1], "CarJack-KickPassengers", (SendModes)2); } } private PlayerCarData GetPlayerForCar(DrivableCar car) { foreach (KeyValuePair item in _playerCarsById) { if ((Object)(object)item.Value.Car == (Object)(object)car) { return item.Value; } } return null; } private void OnKickPassengersPacketReceived(ushort playerId, byte[] data) { if (playerId == ClientController.Instance.LocalID) { return; } using MemoryStream input = new MemoryStream(data); using BinaryReader binaryReader = new BinaryReader(input); binaryReader.ReadByte(); CarController instance = CarController.Instance; if ((Object)(object)instance == (Object)null) { return; } DrivableCar currentCar = instance.CurrentCar; if (!((Object)(object)currentCar == (Object)null) && !currentCar.Driving) { PlayerCarData playerForCar = GetPlayerForCar(currentCar); if (playerForCar != null && !((Object)(object)playerForCar.Seat != (Object)null) && playerForCar.PlayerID == playerId) { instance.ExitCar(); } } } private void OnPlayerCarDataPacketReceived(ushort playerId, byte[] data) { if (playerId == ClientController.Instance.LocalID) { return; } using MemoryStream input = new MemoryStream(data); using BinaryReader reader = new BinaryReader(input); PlayerCarPacket playerCarPacket = new PlayerCarPacket(); playerCarPacket.Deserialize(reader); if (!_playerCarsById.TryGetValue(playerId, out var value)) { value = new PlayerCarData(); value.PlayerID = playerId; PlayerCars.Add(value); _playerCarsById[playerId] = value; } value.LastPacket = playerCarPacket; MPPlayer value3; if (playerCarPacket.CarInternalName != "" || playerCarPacket.DriverPlayerID != ushort.MaxValue) { if (ClientController.Instance.Players.TryGetValue(playerId, out var value2)) { value2.CustomTransform = true; value2.CustomVisibility = true; } } else if (ClientController.Instance.Players.TryGetValue(playerId, out value3)) { value3.CustomTransform = false; value3.CustomVisibility = false; } } public bool PlayerHasCar(ushort playerId) { if (!_playerCarsById.TryGetValue(playerId, out var value)) { return false; } if ((Object)(object)value.Car != (Object)null) { return true; } return false; } public DrivableCar GetPlayersCar(ushort playerId) { if (playerId == ClientController.Instance.LocalID) { return CarController.Instance.CurrentCar; } if (!_playerCarsById.TryGetValue(playerId, out var value)) { return null; } return value.Car; } private void FixedUpdate() { if (!((Object)(object)ClientController.Instance == (Object)null) && ClientController.Instance.Connected) { _currentTick -= Time.deltaTime; if (_currentTick <= 0f) { _currentTick = 0.2f; Tick(); } } } public ushort GetDriver(DrivableCar car) { foreach (PlayerCarData playerCar in PlayerCars) { if ((Object)(object)playerCar.Car == (Object)(object)car) { return playerCar.PlayerID; } } return ushort.MaxValue; } private void Tick() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) PlayerCarPacket playerCarPacket = new PlayerCarPacket(); if ((Object)(object)CarController.Instance.CurrentCar != (Object)null) { DrivableCar currentCar = CarController.Instance.CurrentCar; if ((Object)(object)CarController.Instance.CurrentSeat == (Object)null) { playerCarPacket.CarInternalName = currentCar.InternalName; } playerCarPacket.Position = currentCar.Rigidbody.position; playerCarPacket.Rotation = currentCar.Rigidbody.rotation; playerCarPacket.Velocity = currentCar.Rigidbody.velocity; playerCarPacket.AngularVelocity = currentCar.Rigidbody.angularVelocity; playerCarPacket.ThrottleAxis = currentCar.ThrottleAxis; playerCarPacket.SteerAxis = currentCar.SteerAxis; playerCarPacket.HornHeld = currentCar.HornHeld; if ((Object)(object)CarController.Instance.CurrentSeat != (Object)null) { playerCarPacket.PassengerSeat = CarController.Instance.CurrentSeat.SeatIndex; playerCarPacket.DriverPlayerID = GetDriver(currentCar); } playerCarPacket.DoorsLocked = PlayerData.Instance.DoorsLocked; RecolorableCar component = ((Component)currentCar).GetComponent(); if ((Object)(object)component != (Object)null && component.CurrentRecolor != null) { playerCarPacket.RecolorGUID = component.CurrentRecolor.Properties.RecolorGUID; } } MemoryStream memoryStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(memoryStream); playerCarPacket.Serialize(binaryWriter); binaryWriter.Flush(); ClientController.Instance.BroadcastCustomPacket(memoryStream.ToArray(), "CarJack-PlayerCar", (SendModes)0); binaryWriter.Close(); List list = new List(); Dictionary dictionary = new Dictionary(); for (int i = 0; i < PlayerCars.Count; i++) { if (TickCar(PlayerCars[i])) { list.Add(PlayerCars[i]); dictionary[PlayerCars[i].PlayerID] = PlayerCars[i]; } } PlayerCars = list; _playerCarsById = dictionary; } private void Update() { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (Core.Instance.IsCorePaused) { return; } _specCameraBlocker.Enabled = (Object)(object)SpectatorController.Instance != (Object)null; foreach (PlayerCarData playerCar in PlayerCars) { if ((Object)(object)playerCar.Car == (Object)null || (Object)(object)playerCar.Seat != (Object)null) { continue; } if (ClientController.Instance.Players.TryGetValue(playerCar.PlayerID, out var value)) { if ((Object)(object)playerCar.Seat != (Object)null) { if ((Object)(object)value.Player != (Object)null) { ((Component)value.Player).transform.position = ((Component)playerCar.Seat).transform.position; } } else if ((Object)(object)playerCar.Car != (Object)null && (Object)(object)value.Player != (Object)null) { ((Component)value.Player).transform.position = ((Component)playerCar.Car).transform.position; } } Vector3 val = Vector3.Lerp(playerCar.Car.Rigidbody.position, playerCar.LastPacket.Position, 5f * Time.deltaTime); Quaternion val2 = Quaternion.Lerp(playerCar.Car.Rigidbody.rotation, playerCar.LastPacket.Rotation, 5f * Time.deltaTime); Vector3 val3 = playerCar.Car.Rigidbody.position - playerCar.LastPacket.Position; if (((Vector3)(ref val3)).magnitude >= 20f) { val = playerCar.LastPacket.Position; val2 = playerCar.LastPacket.Rotation; ((Component)playerCar.Car).transform.position = val; ((Component)playerCar.Car).transform.rotation = val2; } else { playerCar.Car.Rigidbody.MovePosition(val); } playerCar.Car.Rigidbody.MoveRotation(val2); } } private bool TickCar(PlayerCarData playerCarData) { //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) bool flag = false; bool result = true; if (playerCarData.LastPacket.PassengerSeat != -1) { playerCarData.LastPacket.CarInternalName = "carjack.bluecar"; } if (!ClientController.Instance.Players.ContainsKey(playerCarData.PlayerID)) { playerCarData.LastPacket.CarInternalName = ""; result = false; } Player player = Utility.GetPlayer(playerCarData.PlayerID); if (playerCarData.LastPacket.CarInternalName == "") { if ((Object)(object)player != (Object)null) { ((Component)player.characterVisual).gameObject.SetActive(true); player.EnablePlayer(false); } if ((Object)(object)playerCarData.Car != (Object)null) { if ((Object)(object)playerCarData.Seat == (Object)null) { Object.Destroy((Object)(object)((Component)playerCarData.Car).gameObject); } else if ((Object)(object)playerCarData.Seat.Player == (Object)(object)player) { playerCarData.Seat.ExitSeat(); } playerCarData.Seat = null; playerCarData.Car = null; } if ((Object)(object)playerCarData.Polo != (Object)null) { playerCarData.Polo.SetActive(true); } } else { string text = "carjack.bluecar"; if (CarDatabase.CarByInternalName.TryGetValue(playerCarData.LastPacket.CarInternalName, out var value)) { text = value.Prefab.GetComponent().InternalName; } else { flag = true; } DrivableCar currentCar = playerCarData.Car; if (playerCarData.LastPacket.PassengerSeat != -1) { DrivableCar val = (currentCar = GetPlayersCar(playerCarData.LastPacket.DriverPlayerID)); if ((Object)(object)val != (Object)null) { CarPassengerSeat passengerSeat = val.GetPassengerSeat(playerCarData.LastPacket.PassengerSeat); if ((Object)(object)passengerSeat != (Object)null) { ((Component)player).transform.position = ((Component)passengerSeat).transform.position; if ((Object)(object)passengerSeat != (Object)(object)playerCarData.Seat) { CarSeat seat = playerCarData.Seat; if ((Object)(object)seat != (Object)null && (Object)(object)seat.Player == (Object)(object)player) { seat.ExitSeat(); } ((Component)player.characterVisual).gameObject.SetActive(false); player.CompletelyStop(); player.DisablePlayer(); Transform val2 = ((Component)player).transform.Find("Mascot_Polo_street(Clone)"); if ((Object)(object)val2 != (Object)null) { playerCarData.Polo = ((Component)val2).gameObject; ((Component)val2).gameObject.SetActive(false); } playerCarData.Seat = (CarSeat)(object)passengerSeat; ((CarSeat)passengerSeat).PutInSeat(player); } } } } else { if ((Object)(object)playerCarData.Seat != (Object)null) { if ((Object)(object)playerCarData.Seat.Player == (Object)(object)player) { playerCarData.Seat.ExitSeat(); } playerCarData.Seat = null; } if ((Object)(object)currentCar == (Object)null || currentCar.InternalName != text) { if ((Object)(object)currentCar != (Object)null) { Object.Destroy((Object)(object)((Component)currentCar).gameObject); } GameObject val3 = Object.Instantiate(CarDatabase.CarByInternalName[text].Prefab); val3.transform.position = playerCarData.LastPacket.Position; val3.transform.rotation = playerCarData.LastPacket.Rotation; currentCar = val3.GetComponent(); currentCar.Initialize(); currentCar.EnterCar(player); ushort playerId = playerCarData.PlayerID; DrivableCar obj = currentCar; obj.OnHandleInput = (Action)Delegate.Combine(obj.OnHandleInput, (Action)delegate { if (_playerCarsById.TryGetValue(playerId, out var value3)) { currentCar.ThrottleAxis = value3.LastPacket.ThrottleAxis; currentCar.SteerAxis = value3.LastPacket.SteerAxis; currentCar.HornHeld = value3.LastPacket.HornHeld; } }); } if ((Object)(object)currentCar != (Object)null) { if ((Object)(object)player != (Object)null) { ((Component)player.characterVisual).gameObject.SetActive(false); ((Component)player).transform.position = ((Component)currentCar).transform.position; player.CompletelyStop(); player.DisablePlayer(); Transform val4 = ((Component)player).transform.Find("Mascot_Polo_street(Clone)"); if ((Object)(object)val4 != (Object)null) { playerCarData.Polo = ((Component)val4).gameObject; ((Component)val4).gameObject.SetActive(false); } } currentCar.Rigidbody.velocity = playerCarData.LastPacket.Velocity; currentCar.Rigidbody.angularVelocity = playerCarData.LastPacket.AngularVelocity; currentCar.DoorsLocked = flag || playerCarData.LastPacket.DoorsLocked; RecolorableCar component = ((Component)currentCar).GetComponent(); if ((Object)(object)component != (Object)null) { Recolor val5 = null; if (!string.IsNullOrEmpty(playerCarData.LastPacket.RecolorGUID) && RecolorManager.RecolorsByGUID.TryGetValue(playerCarData.LastPacket.RecolorGUID, out var value2) && value2.Properties.CarInternalName == currentCar.InternalName) { val5 = value2; } if (component.CurrentRecolor != val5) { if (val5 == null) { component.ApplyDefaultColor(); } else { component.ApplyRecolor(val5); } } } } else if ((Object)(object)player != (Object)null) { ((Component)player.characterVisual).gameObject.SetActive(true); player.EnablePlayer(false); if ((Object)(object)playerCarData.Polo != (Object)null) { playerCarData.Polo.SetActive(true); } } } playerCarData.Car = currentCar; } return result; } } public class PlayerCarData { public ushort PlayerID; public DrivableCar Car; public PlayerCarPacket LastPacket; public GameObject Polo; public CarSeat Seat; } public class PlayerCarPacket { private const byte Version = 3; public const string GUID = "CarJack-PlayerCar"; public string CarInternalName = ""; public Vector3 Position = Vector3.zero; public Quaternion Rotation = Quaternion.identity; public Vector3 Velocity = Vector3.zero; public Vector3 AngularVelocity = Vector3.zero; public float ThrottleAxis; public float SteerAxis; public bool HornHeld; public bool BrakeHeld; public float PitchAxis; public float YawAxis; public float RollAxis; public int PassengerSeat = -1; public ushort DriverPlayerID = ushort.MaxValue; public bool DoorsLocked; public string RecolorGUID = string.Empty; public void Serialize(BinaryWriter writer) { writer.Write((byte)3); writer.Write(CarInternalName); writer.Write(Position.x); writer.Write(Position.y); writer.Write(Position.z); writer.Write(Rotation.x); writer.Write(Rotation.y); writer.Write(Rotation.z); writer.Write(Rotation.w); writer.Write(Velocity.x); writer.Write(Velocity.y); writer.Write(Velocity.z); writer.Write(AngularVelocity.x); writer.Write(AngularVelocity.y); writer.Write(AngularVelocity.z); writer.Write(ThrottleAxis); writer.Write(SteerAxis); writer.Write(HornHeld); writer.Write(BrakeHeld); writer.Write(PitchAxis); writer.Write(YawAxis); writer.Write(RollAxis); writer.Write(PassengerSeat); writer.Write(DriverPlayerID); writer.Write(DoorsLocked); writer.Write(RecolorGUID); } public void Deserialize(BinaryReader reader) { //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) byte b = reader.ReadByte(); CarInternalName = reader.ReadString(); float num = reader.ReadSingle(); float num2 = reader.ReadSingle(); float num3 = reader.ReadSingle(); float num4 = reader.ReadSingle(); float num5 = reader.ReadSingle(); float num6 = reader.ReadSingle(); float num7 = reader.ReadSingle(); float num8 = reader.ReadSingle(); float num9 = reader.ReadSingle(); float num10 = reader.ReadSingle(); float num11 = reader.ReadSingle(); float num12 = reader.ReadSingle(); float num13 = reader.ReadSingle(); ThrottleAxis = reader.ReadSingle(); SteerAxis = reader.ReadSingle(); HornHeld = reader.ReadBoolean(); BrakeHeld = reader.ReadBoolean(); PitchAxis = reader.ReadSingle(); YawAxis = reader.ReadSingle(); RollAxis = reader.ReadSingle(); if (b >= 1) { PassengerSeat = reader.ReadInt32(); DriverPlayerID = reader.ReadUInt16(); if (b >= 2) { DoorsLocked = reader.ReadBoolean(); } if (b >= 3) { RecolorGUID = reader.ReadString(); } } Position = new Vector3(num, num2, num3); Rotation = new Quaternion(num4, num5, num6, num7); Velocity = new Vector3(num8, num9, num10); AngularVelocity = new Vector3(num11, num12, num13); } } public class Plugin { [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public Plugin() { if (CarController.Config.AllCityNetworkIntegration) { BallController.Initialize(); NetworkController.Initialize(); } } } public static class Utility { public static Player GetPlayer(ushort playerId) { if (ClientController.Instance.Players.TryGetValue(playerId, out var value)) { return value.Player; } return null; } } public static class PluginInfo { public const string PLUGIN_GUID = "CarJack.AllCityNetwork"; public const string PLUGIN_NAME = "CarJack.AllCityNetwork"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }