Decompiled source of Cruiser Enhancement v1.0.0

Cruiser_Enhancement.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Cruiser_Enhancement")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Cruiser_Enhancement")]
[assembly: AssemblyTitle("Cruiser_Enhancement")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 Cruiser_Enhancement
{
	public static class CruiserEnhancement
	{
		[Serializable]
		private struct CruiserSyncData
		{
			public ulong vehicleNetworkId;

			public float motorTorque;

			public int gear;

			public float engineRPM;

			public float posX;

			public float posY;

			public float posZ;

			public float rotX;

			public float rotY;

			public float rotZ;

			public float rotW;

			public float velX;

			public float velY;

			public float velZ;

			public float steeringInput;

			public float steeringWheelAnimFloat;
		}

		[Serializable]
		private struct MagnetSyncData
		{
			public ulong vehicleNetworkId;

			public float posX;

			public float posY;

			public float posZ;

			public float rotX;

			public float rotY;

			public float rotZ;

			public bool magnetedToShip;
		}

		private class VehicleSyncState
		{
			public Vector3 targetPosition;

			public Quaternion targetRotation;

			public Vector3 predictedVelocity;

			public Vector3 angularVelocity;

			public Vector3 smoothedPosition;

			public Quaternion smoothedRotation;

			public Vector3 smoothDampVelocity;

			public float lastReceiveTime;

			public Vector3 lastReceivedPosition;

			public bool initialized;

			public float syncedMotorTorque;

			public float lastMotorTorqueUpdateTime;

			public float syncedSteeringInput;

			public float syncedSteeringWheelAnimFloat;

			public bool usesLethalNetworkAPI;
		}

		[CompilerGenerated]
		private sealed class <SendMagnetStateDelayed>d__178 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public VehicleController vehicle;

			public ulong clientId;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SendMagnetStateDelayed>d__178(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Expected O, but got Unknown
				//IL_00bb: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0157: 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_0171: Unknown result type (might be due to invalid IL or missing references)
				//IL_0180: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a6: 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_0127: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1.5f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					if ((Object)vehicle == (Object)null || !vehicle.magnetedToShip)
					{
						ManualLogSource logger = CruiserEnhancement.logger;
						if (logger != null)
						{
							logger.LogInfo((object)"[Cruiser_Enhancement] HOST: 자석 상태 변경됨 - 전송 취소");
						}
						return false;
					}
					if (!networkMessageInitialized || magnetSyncMessage == null)
					{
						ManualLogSource logger2 = CruiserEnhancement.logger;
						if (logger2 != null)
						{
							logger2.LogWarning((object)"[Cruiser_Enhancement] HOST: LethalNetworkAPI 초기화 안됨");
						}
						return false;
					}
					ManualLogSource logger3 = CruiserEnhancement.logger;
					if (logger3 != null)
					{
						logger3.LogInfo((object)$"[Cruiser_Enhancement] HOST: 클라이언트 {clientId}에 LethalNetworkAPI로 자석 상태 전송");
					}
					Vector3 val = Vector3.zero;
					Quaternion val2 = Quaternion.identity;
					if (magnetTargetPositionField != null)
					{
						val = (Vector3)magnetTargetPositionField.GetValue(vehicle);
					}
					if (magnetTargetRotationField != null)
					{
						val2 = (Quaternion)magnetTargetRotationField.GetValue(vehicle);
					}
					ManualLogSource logger4 = CruiserEnhancement.logger;
					if (logger4 != null)
					{
						logger4.LogInfo((object)$"[Cruiser_Enhancement] HOST: 전송 - 위치: {val}, 회전: {((Quaternion)(ref val2)).eulerAngles}");
					}
					MagnetSyncData magnetSyncData = default(MagnetSyncData);
					magnetSyncData.vehicleNetworkId = ((NetworkBehaviour)vehicle).NetworkObjectId;
					magnetSyncData.posX = val.x;
					magnetSyncData.posY = val.y;
					magnetSyncData.posZ = val.z;
					magnetSyncData.rotX = ((Quaternion)(ref val2)).eulerAngles.x;
					magnetSyncData.rotY = ((Quaternion)(ref val2)).eulerAngles.y;
					magnetSyncData.rotZ = ((Quaternion)(ref val2)).eulerAngles.z;
					magnetSyncData.magnetedToShip = true;
					MagnetSyncData magnetSyncData2 = magnetSyncData;
					magnetSyncMessage.SendClient(magnetSyncData2, clientId);
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static ManualLogSource logger;

		private static Harmony harmony;

		private static bool isCruiserImprovedLoaded = false;

		private const string CRUISER_IMPROVED_GUID = "DiggC.CruiserImproved";

		public static float cameraBackDistance = 10f;

		public static float cameraUpDistance = 4f;

		public static float cameraLookAhead = 2f;

		public static float cameraSmoothSpeed = 4f;

		public static float STEERING_MULTIPLIER = 1.2f;

		private const float STEERING_DEAD_ZONE = 0.05f;

		private static float smoothedThrottle = 0f;

		private static float smoothedReverse = 0f;

		private const float THROTTLE_SMOOTH_UP = 0.0375f;

		private const float THROTTLE_SMOOTH_DOWN = 2.5f;

		private const float REVERSE_SMOOTH_UP = 0.0075f;

		private const float REVERSE_SMOOTH_DOWN = 2f;

		private const float MAX_FORWARD_THROTTLE = 0.3f;

		private const float MAX_REVERSE_THROTTLE = 0.06f;

		public static float MAX_FORWARD_SPEED = 12f;

		public static float MAX_REVERSE_SPEED = 3f;

		private const int VANILLA_CRUISER_ID = 0;

		private const float TRUCK_MASS = 500f;

		private const float TRUCK_DRAG = 0.08f;

		private const float TRUCK_ANGULAR_DRAG = 1.5f;

		private static HashSet<int> physicsModifiedVehicles = new HashSet<int>();

		private static float idleTimer = 0f;

		private const float BRAKE_DELAY = 0.4f;

		private static bool isBraking = false;

		private static float lastHapticTime = 0f;

		private const float HAPTIC_COOLDOWN = 0.05f;

		private static float currentHapticLow = 0f;

		private static float currentHapticHigh = 0f;

		private static bool wasInVehicle = false;

		private static Camera tpCamera;

		private static VehicleController currentVehicle;

		private static bool isThirdPerson = false;

		private static Vector3 currentCameraPos;

		private static Vector3 cameraVelocity;

		private static bool wasIgnitionStarted = false;

		private static bool wasLocalPlayerInControl = false;

		private static bool wasLocalPlayerInPassenger = false;

		private static bool tipsUpdated = false;

		private static bool pendingHudUpdate = false;

		private static float hudUpdateTimer = 0f;

		private const float HUD_UPDATE_DELAY = 0.15f;

		private static bool lastInputWasController = false;

		private static Camera originalMainCamera;

		private static int cameraRetryCount = 0;

		private const int MAX_CAMERA_RETRY = 5;

		private static float cameraVerifyTimer = 0f;

		private const float CAMERA_VERIFY_INTERVAL = 0.1f;

		private static float boostHapticTimer = 0f;

		private static bool isBoostHapticActive = false;

		private static Dictionary<int, VehicleSyncState> vehicleSyncStates = new Dictionary<int, VehicleSyncState>();

		private static LNetworkMessage<CruiserSyncData> cruiserSyncMessage;

		private static LNetworkMessage<MagnetSyncData> magnetSyncMessage;

		private static bool networkMessageInitialized = false;

		private static float lastSyncSendTime = 0f;

		private const float SYNC_SEND_INTERVAL = 0.01f;

		private const float SYNC_SMOOTH_TIME = 0.06f;

		private const float SYNC_ROT_SPEED = 25f;

		private const float SYNC_SNAP_DISTANCE = 20f;

		private const float SYNC_PREDICTION_FACTOR = 0.7f;

		private const float SYNC_MAX_PREDICTION_TIME = 0.15f;

		private const float SYNC_MIN_VELOCITY = 0.5f;

		private static FieldInfo syncSpeedMultiplierField;

		private static FieldInfo syncedPositionField;

		private static FieldInfo syncedRotationField;

		private static FieldInfo mainRigidbodyField;

		private static FieldInfo magnetedToShipField;

		private static FieldInfo testingVehicleInEditorField;

		private static FieldInfo hasBeenSpawnedField;

		private static FieldInfo itemShipField;

		private static FieldInfo ragdollPhysicsBodyField;

		private static FieldInfo windwiperPhysicsBody1Field;

		private static FieldInfo windwiperPhysicsBody2Field;

		private static FieldInfo windwiper1Field;

		private static FieldInfo windwiper2Field;

		private static FieldInfo averageCountField;

		private static FieldInfo movingAverageLengthField;

		private static FieldInfo averageVelocityField;

		private static FieldInfo stabilityField;

		private static FieldInfo magnetStartPositionField;

		private static FieldInfo magnetTargetPositionField;

		private static FieldInfo magnetStartRotationField;

		private static FieldInfo magnetTargetRotationField;

		private static FieldInfo magnetPositionCurveField;

		private static FieldInfo magnetRotationCurveField;

		private static FieldInfo magnetTimeField;

		private static FieldInfo magnetRotationTimeField;

		private static FieldInfo averageVelocityAtMagnetStartField;

		private static FieldInfo finishedMagnetingField;

		private static FieldInfo syncRotationSpeedField;

		private static FieldInfo truckVelocityLastFrameField;

		private static FieldInfo syncCarPositionIntervalField;

		private static FieldInfo moveInputVectorField;

		private static FieldInfo steeringWheelAnimFloatField;

		private static MethodInfo syncCarPhysicsMethod;

		private static bool reflectionInitialized = false;

		private static Vector3 visualVehiclePosition;

		private static Quaternion visualVehicleRotation;

		private static Vector3 visualVelocity;

		private static bool visualInterpolationInitialized = false;

		private const float VISUAL_SMOOTH_TIME = 0.08f;

		private const float VISUAL_ROT_SPEED = 20f;

		private const float POSITION_SNAP_THRESHOLD = 15f;

		private static readonly FieldInfo carTooltipsField = typeof(VehicleController).GetField("carTooltips", BindingFlags.Instance | BindingFlags.NonPublic);

		private static float savedMotorTorqueLeft = 0f;

		private static float savedMotorTorqueRight = 0f;

		private static bool motorTorqueOverridden = false;

		private static float lastVehicleSpeed = 0f;

		private static bool pendingHornCheck = false;

		private static float hornCheckTimer = 0f;

		private const float HORN_CHECK_DELAY = 0.2f;

		private const float HORN_CHECK_DURATION = 0.5f;

		private static bool pendingIgnitionSwitch = false;

		private static float ignitionSwitchTimer = 0f;

		private const float IGNITION_SWITCH_DELAY = 0.3f;

		private static bool pendingPassengerExit = false;

		private static float passengerExitTimer = 0f;

		private static VehicleController pendingExitVehicle = null;

		private const float PASSENGER_EXIT_DELAY = 0.4f;

		public static bool IsThirdPersonEnabled => isThirdPerson;

		private static void InitializeNetworkMessages()
		{
			if (networkMessageInitialized)
			{
				return;
			}
			try
			{
				cruiserSyncMessage = LNetworkMessage<CruiserSyncData>.Create("Cruiser_Enhancement_CruiserSync", (Action<CruiserSyncData, ulong>)null, (Action<CruiserSyncData>)OnCruiserSyncReceived, (Action<CruiserSyncData, ulong>)OnCruiserSyncReceivedFromClient);
				Action<MagnetSyncData> action = OnMagnetSyncReceived;
				magnetSyncMessage = LNetworkMessage<MagnetSyncData>.Create("Cruiser_Enhancement_MagnetSync", (Action<MagnetSyncData, ulong>)OnMagnetSyncRequestReceived, action, (Action<MagnetSyncData, ulong>)null);
				networkMessageInitialized = true;
				ManualLogSource val = logger;
				if (val != null)
				{
					val.LogInfo((object)"[Cruiser_Enhancement] LethalNetworkAPI 메시지 초기화 완료 (motorTorque + 자석 동기화)");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource val2 = logger;
				if (val2 != null)
				{
					val2.LogError((object)("[Cruiser_Enhancement] LethalNetworkAPI 초기화 실패: " + ex.Message));
				}
			}
		}

		private static void OnMagnetSyncReceived(MagnetSyncData data)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)NetworkManager.Singleton == (Object)null)
				{
					return;
				}
				VehicleController[] array = Object.FindObjectsOfType<VehicleController>();
				Vector3 val = default(Vector3);
				VehicleController[] array2 = array;
				foreach (VehicleController val2 in array2)
				{
					if (((NetworkBehaviour)val2).NetworkObjectId == data.vehicleNetworkId)
					{
						((Vector3)(ref val))..ctor(data.posX, data.posY, data.posZ);
						Quaternion val3 = Quaternion.Euler(data.rotX, data.rotY, data.rotZ);
						if (magnetTargetPositionField != null)
						{
							magnetTargetPositionField.SetValue(val2, val);
						}
						if (magnetTargetRotationField != null)
						{
							magnetTargetRotationField.SetValue(val2, val3);
						}
						ManualLogSource val4 = logger;
						if (val4 != null)
						{
							val4.LogInfo((object)$"[Cruiser_Enhancement] 자석 동기화 수신: 위치={val}, 회전={((Quaternion)(ref val3)).eulerAngles}");
						}
						break;
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource val5 = logger;
				if (val5 != null)
				{
					val5.LogWarning((object)("[Cruiser_Enhancement] 자석 동기화 수신 오류: " + ex.Message));
				}
			}
		}

		private static void OnMagnetSyncRequestReceived(MagnetSyncData data, ulong clientId)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameNetworkManager instance = GameNetworkManager.Instance;
				if ((Object)(object)instance == (Object)null || !instance.isHostingGame)
				{
					return;
				}
				VehicleController val = StartOfRound.Instance?.attachedVehicle;
				if (!((Object)val == (Object)null) && val.magnetedToShip)
				{
					Vector3 val2 = Vector3.zero;
					Quaternion val3 = Quaternion.identity;
					if (magnetTargetPositionField != null)
					{
						val2 = (Vector3)magnetTargetPositionField.GetValue(val);
					}
					if (magnetTargetRotationField != null)
					{
						val3 = (Quaternion)magnetTargetRotationField.GetValue(val);
					}
					MagnetSyncData magnetSyncData = default(MagnetSyncData);
					magnetSyncData.vehicleNetworkId = ((NetworkBehaviour)val).NetworkObjectId;
					magnetSyncData.posX = val2.x;
					magnetSyncData.posY = val2.y;
					magnetSyncData.posZ = val2.z;
					magnetSyncData.rotX = ((Quaternion)(ref val3)).eulerAngles.x;
					magnetSyncData.rotY = ((Quaternion)(ref val3)).eulerAngles.y;
					magnetSyncData.rotZ = ((Quaternion)(ref val3)).eulerAngles.z;
					magnetSyncData.magnetedToShip = true;
					MagnetSyncData magnetSyncData2 = magnetSyncData;
					magnetSyncMessage.SendClient(magnetSyncData2, clientId);
					ManualLogSource val4 = logger;
					if (val4 != null)
					{
						val4.LogInfo((object)$"[Cruiser_Enhancement] 자석 동기화 응답 전송: 클라이언트 {clientId}");
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource val5 = logger;
				if (val5 != null)
				{
					val5.LogWarning((object)("[Cruiser_Enhancement] 자석 동기화 요청 처리 오류: " + ex.Message));
				}
			}
		}

		private static void RequestMagnetSync(VehicleController vehicle)
		{
			if (!networkMessageInitialized || magnetSyncMessage == null)
			{
				return;
			}
			GameNetworkManager instance = GameNetworkManager.Instance;
			if ((Object)(object)instance == (Object)null || instance.isHostingGame)
			{
				return;
			}
			try
			{
				MagnetSyncData magnetSyncData = default(MagnetSyncData);
				magnetSyncData.vehicleNetworkId = ((NetworkBehaviour)vehicle).NetworkObjectId;
				magnetSyncData.magnetedToShip = false;
				MagnetSyncData magnetSyncData2 = magnetSyncData;
				magnetSyncMessage.SendServer(magnetSyncData2);
				ManualLogSource val = logger;
				if (val != null)
				{
					val.LogInfo((object)"[Cruiser_Enhancement] 자석 동기화 요청 전송");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource val2 = logger;
				if (val2 != null)
				{
					val2.LogWarning((object)("[Cruiser_Enhancement] 자석 동기화 요청 실패: " + ex.Message));
				}
			}
		}

		private static void OnCruiserSyncReceived(CruiserSyncData data)
		{
			ApplyCruiserSyncData(data);
		}

		private static void OnCruiserSyncReceivedFromClient(CruiserSyncData data, ulong senderId)
		{
			ApplyCruiserSyncData(data);
		}

		private static void ApplyCruiserSyncData(CruiserSyncData data)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)NetworkManager.Singleton == (Object)null)
				{
					return;
				}
				VehicleController[] array = Object.FindObjectsOfType<VehicleController>();
				Vector3 val = default(Vector3);
				Quaternion val2 = default(Quaternion);
				Vector3 predictedVelocity = default(Vector3);
				VehicleController[] array2 = array;
				foreach (VehicleController val3 in array2)
				{
					if (((NetworkBehaviour)val3).NetworkObjectId != data.vehicleNetworkId)
					{
						continue;
					}
					if (val3.localPlayerInControl)
					{
						break;
					}
					VehicleSyncState orCreateSyncState = GetOrCreateSyncState(val3);
					orCreateSyncState.syncedMotorTorque = data.motorTorque;
					orCreateSyncState.lastMotorTorqueUpdateTime = Time.time;
					((Vector3)(ref val))..ctor(data.posX, data.posY, data.posZ);
					((Quaternion)(ref val2))..ctor(data.rotX, data.rotY, data.rotZ, data.rotW);
					((Vector3)(ref predictedVelocity))..ctor(data.velX, data.velY, data.velZ);
					float num = Time.time - orCreateSyncState.lastReceiveTime;
					if (num > 0.001f && orCreateSyncState.initialized)
					{
						Vector3 val4 = val - orCreateSyncState.targetPosition;
						orCreateSyncState.predictedVelocity = val4 / num;
					}
					else
					{
						orCreateSyncState.predictedVelocity = predictedVelocity;
					}
					orCreateSyncState.targetPosition = val;
					orCreateSyncState.targetRotation = val2;
					orCreateSyncState.lastReceivedPosition = val;
					orCreateSyncState.lastReceiveTime = Time.time;
					orCreateSyncState.usesLethalNetworkAPI = true;
					orCreateSyncState.syncedSteeringInput = data.steeringInput;
					orCreateSyncState.syncedSteeringWheelAnimFloat = data.steeringWheelAnimFloat;
					if (!orCreateSyncState.initialized)
					{
						orCreateSyncState.smoothedPosition = val;
						orCreateSyncState.smoothedRotation = val2;
						orCreateSyncState.initialized = true;
					}
					if (Time.frameCount % 300 == 0)
					{
						ManualLogSource val5 = logger;
						if (val5 != null)
						{
							val5.LogDebug((object)$"[Cruiser_Enhancement] API 수신: pos={val}, vel={((Vector3)(ref orCreateSyncState.predictedVelocity)).magnitude:F1}m/s");
						}
					}
					break;
				}
			}
			catch
			{
			}
		}

		private static void SendCruiserSyncData(VehicleController vehicle)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected I4, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
			if (!networkMessageInitialized || cruiserSyncMessage == null || (Object)vehicle == (Object)null || !vehicle.localPlayerInControl || Time.time - lastSyncSendTime < 0.01f)
			{
				return;
			}
			lastSyncSendTime = Time.time;
			try
			{
				float motorTorque = 0f;
				if ((Object)vehicle.FrontLeftWheel != (Object)null)
				{
					motorTorque = vehicle.FrontLeftWheel.motorTorque;
				}
				CruiserSyncData cruiserSyncData = default(CruiserSyncData);
				cruiserSyncData.vehicleNetworkId = ((NetworkBehaviour)vehicle).NetworkObjectId;
				cruiserSyncData.motorTorque = motorTorque;
				cruiserSyncData.gear = (int)vehicle.gear;
				cruiserSyncData.engineRPM = vehicle.EngineRPM;
				cruiserSyncData.posX = ((Component)vehicle).transform.position.x;
				cruiserSyncData.posY = ((Component)vehicle).transform.position.y;
				cruiserSyncData.posZ = ((Component)vehicle).transform.position.z;
				cruiserSyncData.rotX = ((Component)vehicle).transform.rotation.x;
				cruiserSyncData.rotY = ((Component)vehicle).transform.rotation.y;
				cruiserSyncData.rotZ = ((Component)vehicle).transform.rotation.z;
				cruiserSyncData.rotW = ((Component)vehicle).transform.rotation.w;
				CruiserSyncData cruiserSyncData2 = cruiserSyncData;
				Rigidbody mainRigidbody = vehicle.mainRigidbody;
				cruiserSyncData2.velX = (((Object)(object)mainRigidbody != (Object)null) ? mainRigidbody.velocity.x : 0f);
				Rigidbody mainRigidbody2 = vehicle.mainRigidbody;
				cruiserSyncData2.velY = (((Object)(object)mainRigidbody2 != (Object)null) ? mainRigidbody2.velocity.y : 0f);
				Rigidbody mainRigidbody3 = vehicle.mainRigidbody;
				cruiserSyncData2.velZ = (((Object)(object)mainRigidbody3 != (Object)null) ? mainRigidbody3.velocity.z : 0f);
				cruiserSyncData2.steeringInput = vehicle.steeringInput;
				cruiserSyncData2.steeringWheelAnimFloat = ((steeringWheelAnimFloatField != null) ? ((float)steeringWheelAnimFloatField.GetValue(vehicle)) : (vehicle.steeringInput / 6f));
				CruiserSyncData cruiserSyncData3 = cruiserSyncData2;
				cruiserSyncMessage.SendOtherClients(cruiserSyncData3);
			}
			catch
			{
			}
		}

		public static void Initialize(ManualLogSource log)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Expected O, but got Unknown
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Expected O, but got Unknown
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Expected O, but got Unknown
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Expected O, but got Unknown
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Expected O, but got Unknown
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Expected O, but got Unknown
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Expected O, but got Unknown
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Expected O, but got Unknown
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Expected O, but got Unknown
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Expected O, but got Unknown
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_0582: Expected O, but got Unknown
			//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Expected O, but got Unknown
			//IL_062a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Expected O, but got Unknown
			//IL_0681: Unknown result type (might be due to invalid IL or missing references)
			//IL_068d: Expected O, but got Unknown
			//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Expected O, but got Unknown
			//IL_06f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f7: Expected O, but got Unknown
			logger = log;
			ManualLogSource val = logger;
			if (val != null)
			{
				val.LogInfo((object)"[Cruiser_Enhancement] Company Cruiser 개선 모드 초기화 중...");
			}
			harmony = new Harmony("kr.Rohmoohyun.Cruiser_Enhancement");
			isCruiserImprovedLoaded = Chainloader.PluginInfos.ContainsKey("DiggC.CruiserImproved");
			if (isCruiserImprovedLoaded)
			{
				ManualLogSource val2 = logger;
				if (val2 != null)
				{
					val2.LogInfo((object)"[Cruiser_Enhancement] CruiserImproved 감지됨 - Cruiser_Enhancement이 타이어 효과 동기화 담당 (LethalNetworkAPI 우선)");
				}
			}
			try
			{
				Type typeFromHandle = typeof(VehicleController);
				MethodInfo methodInfo = AccessTools.Method(typeFromHandle, "GetVehicleInput", (Type[])null, (Type[])null);
				if (methodInfo != null)
				{
					harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "GetVehicleInput_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val3 = logger;
					if (val3 != null)
					{
						val3.LogInfo((object)"[Cruiser_Enhancement] VehicleController.GetVehicleInput 패치 성공");
					}
				}
				MethodInfo methodInfo2 = AccessTools.Method(typeFromHandle, "Update", (Type[])null, (Type[])null);
				if (methodInfo2 != null)
				{
					harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "VehicleController_Update_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val4 = logger;
					if (val4 != null)
					{
						val4.LogInfo((object)"[Cruiser_Enhancement] VehicleController.Update 패치 성공");
					}
				}
				MethodInfo methodInfo3 = AccessTools.Method(typeFromHandle, "LateUpdate", (Type[])null, (Type[])null);
				if (methodInfo3 != null)
				{
					harmony.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "VehicleController_LateUpdate_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val5 = logger;
					if (val5 != null)
					{
						val5.LogInfo((object)"[Cruiser_Enhancement] VehicleController.LateUpdate 패치 성공");
					}
				}
				InitializeReflectionFields(typeFromHandle);
				MethodInfo methodInfo4 = AccessTools.Method(typeFromHandle, "SyncCarPositionClientRpc", (Type[])null, (Type[])null);
				if (methodInfo4 != null)
				{
					harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "SyncCarPositionClientRpc_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val6 = logger;
					if (val6 != null)
					{
						val6.LogInfo((object)"[Cruiser_Enhancement] SyncCarPositionClientRpc 패치 성공 (속도 예측용)");
					}
				}
				MethodInfo methodInfo5 = AccessTools.Method(typeFromHandle, "FixedUpdate", (Type[])null, (Type[])null);
				if (methodInfo5 != null)
				{
					harmony.Patch((MethodBase)methodInfo5, new HarmonyMethod(typeof(CruiserEnhancement), "VehicleController_FixedUpdate_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val7 = logger;
					if (val7 != null)
					{
						val7.LogInfo((object)"[Cruiser_Enhancement] VehicleController.FixedUpdate 패치 성공 (속도 예측 보간)");
					}
				}
				MethodInfo methodInfo6 = AccessTools.Method(typeFromHandle, "ActivateControl", (Type[])null, (Type[])null);
				if (methodInfo6 != null)
				{
					harmony.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "ActivateControl_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val8 = logger;
					if (val8 != null)
					{
						val8.LogInfo((object)"[Cruiser_Enhancement] VehicleController.ActivateControl 패치 성공");
					}
				}
				MethodInfo methodInfo7 = AccessTools.Method(typeFromHandle, "TryIgnition", (Type[])null, (Type[])null);
				if (methodInfo7 != null)
				{
					harmony.Patch((MethodBase)methodInfo7, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "TryIgnition_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val9 = logger;
					if (val9 != null)
					{
						val9.LogInfo((object)"[Cruiser_Enhancement] VehicleController.TryIgnition 패치 성공");
					}
				}
				MethodInfo methodInfo8 = AccessTools.Method(typeof(PlayerControllerB), "Update", (Type[])null, (Type[])null);
				if (methodInfo8 != null)
				{
					harmony.Patch((MethodBase)methodInfo8, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "PlayerController_Update_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val10 = logger;
					if (val10 != null)
					{
						val10.LogInfo((object)"[Cruiser_Enhancement] PlayerControllerB.Update 패치 성공");
					}
				}
				MethodInfo methodInfo9 = AccessTools.Method(typeof(PlayerControllerB), "SetHoverTipAndCurrentInteractTrigger", (Type[])null, (Type[])null);
				if (methodInfo9 != null)
				{
					harmony.Patch((MethodBase)methodInfo9, new HarmonyMethod(typeof(CruiserEnhancement), "SetHoverTip_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val11 = logger;
					if (val11 != null)
					{
						val11.LogInfo((object)"[Cruiser_Enhancement] PlayerControllerB.SetHoverTipAndCurrentInteractTrigger 패치 성공");
					}
				}
				MethodInfo methodInfo10 = AccessTools.Method(typeof(PlayerControllerB), "Interact_performed", (Type[])null, (Type[])null);
				if (methodInfo10 != null)
				{
					harmony.Patch((MethodBase)methodInfo10, new HarmonyMethod(typeof(CruiserEnhancement), "Interact_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val12 = logger;
					if (val12 != null)
					{
						val12.LogInfo((object)"[Cruiser_Enhancement] PlayerControllerB.Interact_performed 패치 성공");
					}
				}
				MethodInfo methodInfo11 = AccessTools.Method(typeFromHandle, "DoTurboBoost", (Type[])null, (Type[])null);
				if (methodInfo11 != null)
				{
					harmony.Patch((MethodBase)methodInfo11, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "DoTurboBoost_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val13 = logger;
					if (val13 != null)
					{
						val13.LogInfo((object)"[Cruiser_Enhancement] VehicleController.DoTurboBoost 패치 성공");
					}
				}
				MethodInfo methodInfo12 = AccessTools.Method(typeof(StartOfRound), "OnDisable", (Type[])null, (Type[])null);
				if (methodInfo12 != null)
				{
					harmony.Patch((MethodBase)methodInfo12, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "OnGameEnd_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val14 = logger;
					if (val14 != null)
					{
						val14.LogInfo((object)"[Cruiser_Enhancement] StartOfRound.OnDisable 패치 성공");
					}
				}
				MethodInfo methodInfo13 = AccessTools.Method(typeof(GameNetworkManager), "Disconnect", (Type[])null, (Type[])null);
				if (methodInfo13 != null)
				{
					harmony.Patch((MethodBase)methodInfo13, new HarmonyMethod(typeof(CruiserEnhancement), "OnDisconnect_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val15 = logger;
					if (val15 != null)
					{
						val15.LogInfo((object)"[Cruiser_Enhancement] GameNetworkManager.Disconnect 패치 성공");
					}
				}
				MethodInfo methodInfo14 = AccessTools.Method(typeFromHandle, "Start", (Type[])null, (Type[])null);
				if (methodInfo14 != null)
				{
					harmony.Patch((MethodBase)methodInfo14, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "VehicleController_Start_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val16 = logger;
					if (val16 != null)
					{
						val16.LogInfo((object)"[Cruiser_Enhancement] VehicleController.Start 패치 성공 (자석 동기화)");
					}
				}
				MethodInfo methodInfo15 = AccessTools.Method(typeFromHandle, "MagnetCarServerRpc", (Type[])null, (Type[])null);
				if (methodInfo15 != null)
				{
					harmony.Patch((MethodBase)methodInfo15, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "MagnetCarServerRpc_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val17 = logger;
					if (val17 != null)
					{
						val17.LogInfo((object)"[Cruiser_Enhancement] VehicleController.MagnetCarServerRpc 패치 성공 (자석 동기화)");
					}
				}
				MethodInfo methodInfo16 = AccessTools.Method(typeof(StartOfRound), "OnClientConnect", (Type[])null, (Type[])null);
				if (methodInfo16 != null)
				{
					harmony.Patch((MethodBase)methodInfo16, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "OnClientConnect_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val18 = logger;
					if (val18 != null)
					{
						val18.LogInfo((object)"[Cruiser_Enhancement] StartOfRound.OnClientConnect 패치 성공 (자석 동기화)");
					}
				}
				MethodInfo methodInfo17 = AccessTools.Method(typeFromHandle, "SetPassengerInCar", (Type[])null, (Type[])null);
				if (methodInfo17 != null)
				{
					harmony.Patch((MethodBase)methodInfo17, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "SetPassengerInCar_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val19 = logger;
					if (val19 != null)
					{
						val19.LogInfo((object)"[Cruiser_Enhancement] VehicleController.SetPassengerInCar 패치 성공 (조수석 충돌 방지)");
					}
				}
				MethodInfo methodInfo18 = AccessTools.Method(typeFromHandle, "SyncCarPhysicsToOtherClients", (Type[])null, (Type[])null);
				if (methodInfo18 != null)
				{
					harmony.Patch((MethodBase)methodInfo18, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(CruiserEnhancement), "SyncCarPhysics_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val20 = logger;
					if (val20 != null)
					{
						val20.LogInfo((object)"[Cruiser_Enhancement] SyncCarPhysicsToOtherClients Transpiler 패치 성공 (업데이트 간격 0.12f → 0.01f)");
					}
				}
				MethodInfo methodInfo19 = AccessTools.Method(typeFromHandle, "SetCarEffects", (Type[])null, (Type[])null);
				if (methodInfo19 != null)
				{
					HarmonyMethod val21 = new HarmonyMethod(typeof(CruiserEnhancement), "SetCarEffects_Prefix", (Type[])null);
					val21.priority = 800;
					HarmonyMethod val22 = new HarmonyMethod(typeof(CruiserEnhancement), "SetCarEffects_Postfix", (Type[])null);
					val22.priority = 0;
					harmony.Patch((MethodBase)methodInfo19, val21, val22, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					ManualLogSource val23 = logger;
					if (val23 != null)
					{
						val23.LogInfo((object)"[Cruiser_Enhancement] VehicleController.SetCarEffects 패치 성공 (motorTorque 동기화, Priority 설정)");
					}
				}
				InitializeNetworkMessages();
				ManualLogSource val24 = logger;
				if (val24 != null)
				{
					val24.LogInfo((object)"[Cruiser_Enhancement] Company Cruiser 개선 모드 초기화 완료!");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource val25 = logger;
				if (val25 != null)
				{
					val25.LogError((object)("[Cruiser_Enhancement] 패치 실패: " + ex.Message + "\n" + ex.StackTrace));
				}
			}
		}

		private static void UpdateControlTips(VehicleController vehicle, bool forceUpdate = false)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if ((Object)HUDManager.Instance == (Object)null || (Object)vehicle == (Object)null)
			{
				return;
			}
			bool flag = StartOfRound.Instance?.localPlayerUsingController ?? false;
			if (lastInputWasController != flag)
			{
				lastInputWasController = flag;
				forceUpdate = true;
			}
			if (tipsUpdated && !forceUpdate)
			{
				return;
			}
			try
			{
				string[] array = (lastInputWasController ? new string[4] { "가속/후진 : [RT]/[LT]", "시점 전환 : [RS]", "운전대 놓기 : [Y]", "부스트 : [A]" } : new string[4] { "가속/후진 : [W]/[S]", "시점 전환 : [V]", "운전대 놓기 : [F]", "부스트 : [Space]" });
				HUDManager.Instance.ClearControlTips();
				HUDManager.Instance.ChangeControlTipMultiple(array, false, (Item)null);
				tipsUpdated = true;
				ManualLogSource val = logger;
				if (val != null)
				{
					val.LogDebug((object)("[Cruiser_Enhancement] 툴팁 업데이트 완료 - " + (lastInputWasController ? "컨트롤러" : "키보드")));
				}
			}
			catch (Exception ex)
			{
				ManualLogSource val2 = logger;
				if (val2 != null)
				{
					val2.LogError((object)("[Cruiser_Enhancement] 툴팁 업데이트 오류: " + ex.Message));
				}
			}
		}

		private static void ClearCustomTips()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			tipsUpdated = false;
			if ((Object)HUDManager.Instance != (Object)null)
			{
				HUDManager.Instance.ClearControlTips();
			}
		}

		private static void UpdatePassengerTips(VehicleController vehicle, bool forceUpdate = false)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if ((Object)HUDManager.Instance == (Object)null || (Object)vehicle == (Object)null)
			{
				return;
			}
			bool flag = StartOfRound.Instance?.localPlayerUsingController ?? false;
			if (lastInputWasController != flag)
			{
				lastInputWasController = flag;
				forceUpdate = true;
			}
			if (tipsUpdated && !forceUpdate)
			{
				return;
			}
			try
			{
				string[] array = (lastInputWasController ? new string[4] { "시점 전환 : [RS]", "내리기 : [Y]", "", "" } : new string[4] { "시점 전환 : [V]", "내리기 : [F]", "", "" });
				HUDManager.Instance.ClearControlTips();
				HUDManager.Instance.ChangeControlTipMultiple(array, false, (Item)null);
				tipsUpdated = true;
				ManualLogSource val = logger;
				if (val != null)
				{
					val.LogDebug((object)("[Cruiser_Enhancement] 조수석 툴팁 업데이트 완료 - " + (lastInputWasController ? "컨트롤러" : "키보드")));
				}
			}
			catch (Exception ex)
			{
				ManualLogSource val2 = logger;
				if (val2 != null)
				{
					val2.LogError((object)("[Cruiser_Enhancement] 조수석 툴팁 오류: " + ex.Message));
				}
			}
		}

		private static float SmoothThrottle(float target, float deltaTime)
		{
			target = Mathf.Min(target, 0.3f);
			if (target > smoothedThrottle)
			{
				smoothedThrottle = Mathf.MoveTowards(smoothedThrottle, target, 0.0375f * deltaTime);
			}
			else
			{
				smoothedThrottle = Mathf.MoveTowards(smoothedThrottle, target, 2.5f * deltaTime);
			}
			return smoothedThrottle;
		}

		private static float SmoothReverse(float target, float deltaTime)
		{
			target = Mathf.Min(target, 0.06f);
			if (target > smoothedReverse)
			{
				smoothedReverse = Mathf.MoveTowards(smoothedReverse, target, 0.0075f * deltaTime);
			}
			else
			{
				smoothedReverse = Mathf.MoveTowards(smoothedReverse, target, 2f * deltaTime);
			}
			return smoothedReverse;
		}

		private static void UpdateHapticFeedback(VehicleController vehicle, float steering, Gamepad gamepad)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Invalid comparison between Unknown and I4
			//IL_0115: Invalid comparison between Unknown and I4
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			if (gamepad == null || (Object)vehicle == (Object)null || Time.time - lastHapticTime < 0.05f)
			{
				return;
			}
			lastHapticTime = Time.time;
			try
			{
				if (isBoostHapticActive)
				{
					boostHapticTimer -= Time.deltaTime;
					if (!(boostHapticTimer <= 0f))
					{
						gamepad.SetMotorSpeeds(0.7f, 0.3f);
						currentHapticLow = 0.7f;
						currentHapticHigh = 0.3f;
						return;
					}
					isBoostHapticActive = false;
					boostHapticTimer = 0f;
					gamepad.SetMotorSpeeds(0f, 0f);
					currentHapticLow = 0f;
					currentHapticHigh = 0f;
				}
				Rigidbody component = ((Component)vehicle).GetComponent<Rigidbody>();
				float num = 0f;
				float num2 = 0f;
				if ((Object)component != (Object)null)
				{
					num = Mathf.Abs(((Component)vehicle).transform.InverseTransformDirection(component.velocity).z);
					num2 = (num - lastVehicleSpeed) / Mathf.Max(Time.deltaTime, 0.001f);
					lastVehicleSpeed = num;
				}
				CarGearShift gear = vehicle.gear;
				bool flag = (int)gear == 1;
				bool flag2 = (int)gear == 2;
				bool ignitionStarted = vehicle.ignitionStarted;
				float num3 = 0f;
				float num4 = 0f;
				if (ignitionStarted)
				{
					if (flag && num > 0.5f)
					{
						float num5 = Mathf.Clamp01(num / 12f);
						num3 = Mathf.Lerp(0.03f, 0.18f, num5);
						num4 = Mathf.Lerp(0.01f, 0.08f, num5);
						if (num2 > 0.5f)
						{
							float num6 = Mathf.Clamp01(num2 / 5f) * 0.06f;
							num3 += num6;
						}
					}
					else if (flag2 && num > 0.3f)
					{
						float num7 = Mathf.Clamp01(num / 3f);
						num3 = Mathf.Lerp(0.05f, 0.15f, num7);
						num4 = Mathf.Lerp(0.02f, 0.05f, num7);
						float num8 = Mathf.Sin(Time.time * 3f % 1f * MathF.PI * 2f) * 0.5f + 0.5f;
						num3 += num8 * 0.04f * num7;
					}
					float num9 = Mathf.Abs(steering);
					if (num9 > 0.3f && num > 2f)
					{
						float num10 = (num9 - 0.3f) / 0.7f;
						float num11 = Mathf.Clamp01(num / 8f);
						float num12 = num10 * num11 * 0.06f;
						num4 = Mathf.Max(num4, num12);
					}
				}
				float num13 = 10f;
				currentHapticLow = Mathf.Lerp(currentHapticLow, num3, Time.deltaTime * num13);
				currentHapticHigh = Mathf.Lerp(currentHapticHigh, num4, Time.deltaTime * num13);
				if (currentHapticLow < 0.01f)
				{
					currentHapticLow = 0f;
				}
				if (currentHapticHigh < 0.01f)
				{
					currentHapticHigh = 0f;
				}
				gamepad.SetMotorSpeeds(currentHapticLow, currentHapticHigh);
			}
			catch
			{
			}
		}

		public static void TriggerBoostHaptic()
		{
			isBoostHapticActive = true;
			boostHapticTimer = 0.08f;
		}

		private static void StopHapticFeedback()
		{
			try
			{
				Gamepad current = Gamepad.current;
				if (current != null)
				{
					current.SetMotorSpeeds(0f, 0f);
				}
				currentHapticLow = 0f;
				currentHapticHigh = 0f;
			}
			catch
			{
			}
		}

		private static void ApplyTruckPhysics(VehicleController vehicle)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			try
			{
				if ((Object)vehicle == (Object)null)
				{
					return;
				}
				if (vehicle.vehicleID != 0)
				{
					ManualLogSource val = logger;
					if (val != null)
					{
						val.LogInfo((object)$"[Cruiser_Enhancement] 모드 차량 감지 (vehicleID={vehicle.vehicleID}) - 물리 조정 스킵");
					}
					return;
				}
				int instanceID = ((Object)vehicle).GetInstanceID();
				if (physicsModifiedVehicles.Contains(instanceID))
				{
					return;
				}
				Rigidbody val2 = vehicle.mainRigidbody ?? ((Component)vehicle).GetComponent<Rigidbody>();
				if ((Object)val2 != (Object)null)
				{
					float mass = val2.mass;
					val2.mass = 500f;
					val2.drag = 0.08f;
					val2.angularDrag = 1.5f;
					ManualLogSource val3 = logger;
					if (val3 != null)
					{
						val3.LogInfo((object)$"[Cruiser_Enhancement] 묵직한 주행감 적용: {mass}kg → {500f}kg");
					}
				}
				physicsModifiedVehicles.Add(instanceID);
			}
			catch (Exception ex)
			{
				ManualLogSource val4 = logger;
				if (val4 != null)
				{
					val4.LogWarning((object)("[Cruiser_Enhancement] 물리 적용 오류: " + ex.Message));
				}
			}
		}

		private static void ResetPhysicsState()
		{
			smoothedThrottle = 0f;
			smoothedReverse = 0f;
			idleTimer = 0f;
			isBraking = false;
			isBoostHapticActive = false;
			boostHapticTimer = 0f;
			lastVehicleSpeed = 0f;
			visualInterpolationInitialized = false;
			StopHapticFeedback();
		}

		public static void ResetAllState()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			try
			{
				ManualLogSource val = logger;
				if (val != null)
				{
					val.LogInfo((object)"[Cruiser_Enhancement] 게임 종료 감지 - 상태 초기화");
				}
				StopHapticFeedback();
				if ((Object)tpCamera != (Object)null)
				{
					((Component)tpCamera).tag = "Untagged";
					((Behaviour)tpCamera).enabled = false;
				}
				isThirdPerson = false;
				wasInVehicle = false;
				wasIgnitionStarted = false;
				wasLocalPlayerInControl = false;
				wasLocalPlayerInPassenger = false;
				tipsUpdated = false;
				pendingHudUpdate = false;
				hudUpdateTimer = 0f;
				pendingIgnitionSwitch = false;
				ignitionSwitchTimer = 0f;
				cameraRetryCount = 0;
				cameraVerifyTimer = 0f;
				smoothedThrottle = 0f;
				smoothedReverse = 0f;
				idleTimer = 0f;
				isBraking = false;
				isBoostHapticActive = false;
				boostHapticTimer = 0f;
				currentHapticLow = 0f;
				currentHapticHigh = 0f;
				vehicleSyncStates.Clear();
				lastSyncSendTime = 0f;
				physicsModifiedVehicles.Clear();
				currentVehicle = null;
			}
			catch (Exception ex)
			{
				ManualLogSource val2 = logger;
				if (val2 != null)
				{
					val2.LogError((object)("[Cruiser_Enhancement] 상태 초기화 오류: " + ex.Message));
				}
			}
		}

		private static void OnGameEnd_Postfix()
		{
			ResetAllState();
		}

		private static void OnDisconnect_Prefix()
		{
			ResetAllState();
		}

		public static void ToggleCamera(VehicleController vehicle)
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			isThirdPerson = !isThirdPerson;
			currentVehicle = vehicle;
			if (isThirdPerson)
			{
				InitializeTPCamera(vehicle);
				if ((Object)tpCamera != (Object)null)
				{
					Camera val = (originalMainCamera = StartOfRound.Instance.localPlayerController.gameplayCamera);
					if ((Object)val != (Object)null)
					{
						((Component)val).tag = "Untagged";
						((Behaviour)val).enabled = false;
					}
					((Component)tpCamera).tag = "MainCamera";
					((Behaviour)tpCamera).enabled = true;
					tpCamera.depth = 100f;
				}
			}
			else
			{
				Camera gameplayCamera = StartOfRound.Instance.localPlayerController.gameplayCamera;
				if ((Object)tpCamera != (Object)null)
				{
					((Component)tpCamera).tag = "Untagged";
					((Behaviour)tpCamera).enabled = false;
				}
				if ((Object)gameplayCamera != (Object)null)
				{
					((Component)gameplayCamera).tag = "MainCamera";
					((Behaviour)gameplayCamera).enabled = true;
				}
			}
		}

		public static void EnableThirdPersonOnIgnition(VehicleController vehicle)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			if (!isThirdPerson && (Object)vehicle != (Object)null && vehicle.localPlayerInControl)
			{
				ToggleCamera(vehicle);
			}
		}

		public static void ResetToFirstPerson()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			if (isThirdPerson && (Object)tpCamera != (Object)null)
			{
				isThirdPerson = false;
				((Component)tpCamera).tag = "Untagged";
				((Behaviour)tpCamera).enabled = false;
				Camera val = StartOfRound.Instance?.localPlayerController?.gameplayCamera;
				if ((Object)val != (Object)null)
				{
					((Component)val).tag = "MainCamera";
					((Behaviour)val).enabled = true;
				}
			}
			wasIgnitionStarted = false;
			wasLocalPlayerInControl = false;
			wasLocalPlayerInPassenger = false;
			ResetPhysicsState();
			ClearCustomTips();
		}

		public static void SwitchToSpectate()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (isThirdPerson && (Object)tpCamera != (Object)null)
			{
				isThirdPerson = false;
				((Component)tpCamera).tag = "Untagged";
				((Behaviour)tpCamera).enabled = false;
				StartOfRound.Instance.SwitchCamera(StartOfRound.Instance.spectateCamera);
			}
			wasIgnitionStarted = false;
			wasLocalPlayerInControl = false;
			wasLocalPlayerInPassenger = false;
			ResetPhysicsState();
			ClearCustomTips();
		}

		private static void InitializeTPCamera(VehicleController vehicle)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			currentVehicle = vehicle;
			if ((Object)tpCamera == (Object)null)
			{
				tpCamera = new GameObject("Cruiser_Enhancement_TPCamera").AddComponent<Camera>();
				Camera gameplayCamera = StartOfRound.Instance.localPlayerController.gameplayCamera;
				tpCamera.CopyFrom(gameplayCamera);
				tpCamera.nearClipPlane = 0.1f;
				tpCamera.farClipPlane = 1000f;
			}
			visualVehiclePosition = ((Component)vehicle).transform.position;
			visualVehicleRotation = ((Component)vehicle).transform.rotation;
			visualVelocity = Vector3.zero;
			visualInterpolationInitialized = true;
			currentCameraPos = CalculateCameraPosition(vehicle, ((Component)vehicle).transform.position, ((Component)vehicle).transform.forward);
			((Component)tpCamera).transform.position = currentCameraPos;
			((Component)tpCamera).transform.LookAt(((Component)vehicle).transform.position + Vector3.up * 1.5f);
		}

		private static Vector3 CalculateCameraPosition(VehicleController vehicle, Vector3 vehiclePos, Vector3 vehicleForward)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			return vehiclePos - vehicleForward * cameraBackDistance + Vector3.up * cameraUpDistance;
		}

		private static void UpdateVisualInterpolation(VehicleController vehicle)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)vehicle).transform.position;
			Quaternion rotation = ((Component)vehicle).transform.rotation;
			float num = Vector3.Distance(visualVehiclePosition, position);
			if (!visualInterpolationInitialized || num > 15f)
			{
				visualVehiclePosition = position;
				visualVehicleRotation = rotation;
				visualVelocity = Vector3.zero;
				visualInterpolationInitialized = true;
			}
			else
			{
				visualVehiclePosition = Vector3.SmoothDamp(visualVehiclePosition, position, ref visualVelocity, 0.08f);
				visualVehicleRotation = Quaternion.Slerp(visualVehicleRotation, rotation, Time.deltaTime * 20f);
			}
		}

		public static void UpdateGTACamera(VehicleController vehicle)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			if (isThirdPerson && !((Object)tpCamera == (Object)null) && !((Object)vehicle == (Object)null))
			{
				currentVehicle = vehicle;
				bool num = (Object)GameNetworkManager.Instance != (Object)null && !GameNetworkManager.Instance.isHostingGame;
				bool flag = vehicle.localPlayerInPassengerSeat && !vehicle.localPlayerInControl;
				Vector3 position;
				Vector3 val;
				if (num && flag)
				{
					UpdateVisualInterpolation(vehicle);
					position = visualVehiclePosition;
					val = visualVehicleRotation * Vector3.forward;
				}
				else
				{
					position = ((Component)vehicle).transform.position;
					val = ((Component)vehicle).transform.forward;
					visualVehiclePosition = position;
					visualVehicleRotation = ((Component)vehicle).transform.rotation;
					visualInterpolationInitialized = true;
				}
				Vector3 val2 = CalculateCameraPosition(vehicle, position, val);
				currentCameraPos = Vector3.SmoothDamp(currentCameraPos, val2, ref cameraVelocity, 1f / cameraSmoothSpeed);
				((Component)tpCamera).transform.position = currentCameraPos;
				Quaternion val3 = Quaternion.LookRotation(position + val * cameraLookAhead + Vector3.up * 1.2f - ((Component)tpCamera).transform.position);
				((Component)tpCamera).transform.rotation = Quaternion.Slerp(((Component)tpCamera).transform.rotation, val3, Time.deltaTime * 5f);
			}
		}

		public static void ExitVehicleFromThirdPerson(VehicleController vehicle)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			if (!((Object)vehicle == (Object)null))
			{
				PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
				if ((Object)localPlayerController != (Object)null)
				{
					localPlayerController.CancelSpecialTriggerAnimations();
					ResetToFirstPerson();
				}
			}
		}

		private static void ActivateControl_Postfix(VehicleController __instance)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			try
			{
				if (!__instance.localPlayerInControl)
				{
					return;
				}
				PlayerControllerB val = StartOfRound.Instance?.localPlayerController;
				if ((Object)val == (Object)null)
				{
					return;
				}
				if (__instance.honkingHorn)
				{
					__instance.SetHonkingLocalClient(false);
					ManualLogSource val2 = logger;
					if (val2 != null)
					{
						val2.LogInfo((object)"[Cruiser_Enhancement] 운전석 탑승 시 경적 중지");
					}
				}
				if ((Object)val.hoveringOverTrigger != (Object)null)
				{
					val.hoveringOverTrigger = null;
				}
				pendingHornCheck = true;
				hornCheckTimer = 0f;
			}
			catch (Exception ex)
			{
				ManualLogSource val3 = logger;
				if (val3 != null)
				{
					val3.LogError((object)("[Cruiser_Enhancement] ActivateControl 오류: " + ex.Message));
				}
			}
		}

		private static void TryIgnition_Postfix(VehicleController __instance)
		{
			try
			{
				if (__instance.localPlayerInControl)
				{
					if (__instance.ignitionStarted && !wasIgnitionStarted && !isThirdPerson)
					{
						wasIgnitionStarted = true;
						pendingIgnitionSwitch = true;
						ignitionSwitchTimer = 0f;
					}
					else if (__instance.ignitionStarted && !isThirdPerson && !pendingIgnitionSwitch)
					{
						pendingIgnitionSwitch = true;
						ignitionSwitchTimer = 0f;
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource val = logger;
				if (val != null)
				{
					val.LogError((object)("[Cruiser_Enhancement] TryIgnition 오류: " + ex.Message));
				}
			}
		}

		private static void DoTurboBoost_Postfix(VehicleController __instance)
		{
			try
			{
				if (__instance.localPlayerInControl)
				{
					TriggerBoostHaptic();
					ManualLogSource val = logger;
					if (val != null)
					{
						val.LogDebug((object)"[Cruiser_Enhancement] 부스트 햅틱 트리거");
					}
				}
			}
			catch
			{
			}
		}

		private static void GetVehicleInput_Postfix(VehicleController __instance)
		{
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected I4, but got Unknown
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Expected O, but got Unknown
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!__instance.localPlayerInControl)
				{
					return;
				}
				float deltaTime = Time.deltaTime;
				Gamepad current = Gamepad.current;
				Keyboard current2 = Keyboard.current;
				float x = __instance.moveInputVector.x;
				float num = 0f;
				float num2 = 0f;
				float num3 = 0f;
				if (current != null)
				{
					float num4 = ((InputControl<float>)(object)current.rightTrigger).ReadValue();
					float num5 = ((InputControl<float>)(object)current.leftTrigger).ReadValue();
					num3 = ((InputControl<float>)(object)((Vector2Control)current.leftStick).x).ReadValue();
					if (!(num4 > 0.1f) && !(num5 > 0.1f))
					{
						Mathf.Abs(num3);
						_ = 0.1f;
					}
					num = ((num4 > 0.1f) ? num4 : 0f);
					num2 = ((num5 > 0.1f) ? num5 : 0f);
				}
				if (current2 != null)
				{
					if (((ButtonControl)current2.wKey).isPressed)
					{
						num = Mathf.Max(num, 1f);
					}
					if (((ButtonControl)current2.sKey).isPressed)
					{
						num2 = Mathf.Max(num2, 1f);
					}
				}
				float num6 = ((Mathf.Abs(num3) > 0.1f) ? num3 : x);
				if (Mathf.Abs(num6) > 0.05f)
				{
					__instance.steeringInput = num6 * STEERING_MULTIPLIER;
				}
				else
				{
					__instance.steeringInput = 0f;
				}
				float num7 = SmoothThrottle(num, deltaTime);
				float num8 = SmoothReverse(num2, deltaTime);
				__instance.moveInputVector = new Vector2(num6, num7 - num8);
				if (!__instance.ignitionStarted)
				{
					return;
				}
				int num9 = (int)__instance.gear;
				if (num > 0.05f)
				{
					idleTimer = 0f;
					isBraking = false;
					if (num9 != 1)
					{
						__instance.ShiftToGearAndSync(1);
					}
					__instance.drivePedalPressed = true;
					__instance.brakePedalPressed = false;
				}
				else if (num2 > 0.05f)
				{
					idleTimer = 0f;
					isBraking = false;
					if (num9 != 2)
					{
						__instance.ShiftToGearAndSync(2);
					}
					__instance.drivePedalPressed = true;
					__instance.brakePedalPressed = false;
				}
				else
				{
					idleTimer += deltaTime;
					if (idleTimer >= 0.4f)
					{
						if (!isBraking)
						{
							isBraking = true;
						}
						__instance.drivePedalPressed = false;
						__instance.brakePedalPressed = true;
					}
					else
					{
						__instance.drivePedalPressed = false;
						__instance.brakePedalPressed = false;
					}
				}
				Rigidbody component = ((Component)__instance).GetComponent<Rigidbody>();
				if ((Object)component != (Object)null)
				{
					Vector3 velocity = component.velocity;
					Vector3 val = ((Component)__instance).transform.InverseTransformDirection(velocity);
					float z = val.z;
					bool flag = false;
					if (z > MAX_FORWARD_SPEED)
					{
						val.z = MAX_FORWARD_SPEED;
						flag = true;
					}
					else if (z < 0f - MAX_REVERSE_SPEED)
					{
						val.z = 0f - MAX_REVERSE_SPEED;
						flag = true;
					}
					if (flag)
					{
						component.velocity = ((Component)__instance).transform.TransformDirection(val);
					}
				}
				if (current != null)
				{
					UpdateHapticFeedback(__instance, num6, current);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource val2 = logger;
				if (val2 != null)
				{
					val2.LogError((object)("[Cruiser_Enhancement] GetVehicleInput 오류: " + ex.Message));
				}
			}
		}

		private static void VehicleController_Update_Postfix(VehicleController __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Expected O, but got Unknown
			//IL_0627: Unknown result type (might be due to invalid IL or missing references)
			//IL_0632: Expected O, but got Unknown
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Expected O, but got Unknown
			//IL_0693: Unknown result type (might be due to invalid IL or missing references)
			//IL_069e: Expected O, but got Unknown
			try
			{
				if ((Object)(StartOfRound.Instance?.localPlayerController) == (Object)null)
				{
					return;
				}
				if (__instance.localPlayerInControl && !((NetworkBehaviour)__instance).IsOwner && __instance.ignitionStarted && syncCarPhysicsMethod != null)
				{
					try
					{
						syncCarPhysicsMethod.Invoke(__instance, null);
					}
					catch
					{
					}
				}
				if (__instance.localPlayerInControl && __instance.ignitionStarted)
				{
					SendCruiserSyncData(__instance);
				}
				if (!__instance.localPlayerInControl)
				{
					if (wasLocalPlayerInControl)
					{
						wasLocalPlayerInControl = false;
						ResetPhysicsState();
						ClearCustomTips();
					}
					if (__instance.localPlayerInPassengerSeat)
					{
						if (!wasLocalPlayerInPassenger)
						{
							wasLocalPlayerInPassenger = true;
							wasIgnitionStarted = false;
							tipsUpdated = false;
							pendingIgnitionSwitch = false;
							ignitionSwitchTimer = 0f;
							if (__instance.ignitionStarted && !isThirdPerson)
							{
								wasIgnitionStarted = true;
								pendingIgnitionSwitch = true;
								ignitionSwitchTimer = 0f;
							}
						}
						if (__instance.ignitionStarted && !wasIgnitionStarted)
						{
							wasIgnitionStarted = true;
							if (!isThirdPerson)
							{
								pendingIgnitionSwitch = true;
								ignitionSwitchTimer = 0f;
							}
						}
						else if (!__instance.ignitionStarted && wasIgnitionStarted)
						{
							wasIgnitionStarted = false;
							pendingIgnitionSwitch = false;
							ignitionSwitchTimer = 0f;
						}
						UpdatePassengerTips(__instance);
						if (pendingIgnitionSwitch && __instance.ignitionStarted)
						{
							ignitionSwitchTimer += Time.deltaTime;
							if (ignitionSwitchTimer >= 0.3f)
							{
								pendingIgnitionSwitch = false;
								ignitionSwitchTimer = 0f;
								if (!isThirdPerson)
								{
									ToggleCamera(__instance);
									cameraRetryCount = 0;
									cameraVerifyTimer = 0.1f;
									tipsUpdated = false;
									UpdatePassengerTips(__instance);
								}
							}
						}
						if (pendingPassengerExit && (Object)pendingExitVehicle != (Object)null)
						{
							passengerExitTimer += Time.deltaTime;
							if (passengerExitTimer >= 0.4f)
							{
								pendingExitVehicle.ExitPassengerSideSeat();
								pendingExitVehicle.OnPassengerExit();
								ResetToFirstPerson();
								pendingPassengerExit = false;
								passengerExitTimer = 0f;
								pendingExitVehicle = null;
								ManualLogSource val = logger;
								if (val != null)
								{
									val.LogDebug((object)"[Cruiser_Enhancement] 조수석 하차 완료");
								}
							}
						}
						if (cameraVerifyTimer > 0f && isThirdPerson && (Object)tpCamera != (Object)null)
						{
							cameraVerifyTimer -= Time.deltaTime;
							if (cameraVerifyTimer <= 0f)
							{
								if (((Component)tpCamera).tag != "MainCamera" && cameraRetryCount < 5)
								{
									cameraRetryCount++;
									Camera gameplayCamera = StartOfRound.Instance.localPlayerController.gameplayCamera;
									if ((Object)gameplayCamera != (Object)null)
									{
										((Component)gameplayCamera).tag = "Untagged";
										((Behaviour)gameplayCamera).enabled = false;
									}
									((Component)tpCamera).tag = "MainCamera";
									((Behaviour)tpCamera).enabled = true;
									cameraVerifyTimer = 0.1f;
								}
								else
								{
									cameraVerifyTimer = 0f;
								}
							}
						}
						Gamepad current = Gamepad.current;
						Keyboard current2 = Keyboard.current;
						bool flag = false;
						if (current2 != null && ((ButtonControl)current2.vKey).wasPressedThisFrame)
						{
							flag = true;
						}
						if (current != null && current.rightStickButton.wasPressedThisFrame)
						{
							flag = true;
						}
						if (flag)
						{
							ToggleCamera(__instance);
							tipsUpdated = false;
							UpdatePassengerTips(__instance, forceUpdate: true);
						}
						bool flag2 = false;
						if (current2 != null && ((ButtonControl)current2.fKey).wasPressedThisFrame)
						{
							flag2 = true;
						}
						if (current != null && current.buttonNorth.wasPressedThisFrame)
						{
							flag2 = true;
						}
						if (flag2 && !pendingPassengerExit)
						{
							if (!__instance.passengerSideDoor.boolValue)
							{
								__instance.passengerSideDoor.TriggerAnimation(StartOfRound.Instance.localPlayerController);
							}
							pendingPassengerExit = true;
							passengerExitTimer = 0f;
							pendingExitVehicle = __instance;
							ManualLogSource val2 = logger;
							if (val2 != null)
							{
								val2.LogDebug((object)"[Cruiser_Enhancement] 조수석 하차 예약 - 문 열기 애니메이션 대기");
							}
						}
					}
					else if (wasLocalPlayerInPassenger)
					{
						wasLocalPlayerInPassenger = false;
						if (isThirdPerson)
						{
							ResetToFirstPerson();
						}
						ClearCustomTips();
					}
					return;
				}
				if (!wasLocalPlayerInControl)
				{
					wasLocalPlayerInControl = true;
					wasIgnitionStarted = false;
					tipsUpdated = false;
					pendingIgnitionSwitch = false;
					ignitionSwitchTimer = 0f;
					lastInputWasController = StartOfRound.Instance?.localPlayerUsingController ?? false;
					pendingHudUpdate = true;
					hudUpdateTimer = 0f;
					if (__instance.ignitionStarted && !isThirdPerson)
					{
						wasIgnitionStarted = true;
						pendingIgnitionSwitch = true;
						ignitionSwitchTimer = 0f;
					}
				}
				if (pendingHornCheck && __instance.localPlayerInControl)
				{
					hornCheckTimer += Time.deltaTime;
					if (__instance.honkingHorn)
					{
						__instance.SetHonkingLocalClient(false);
						ManualLogSource val3 = logger;
						if (val3 != null)
						{
							val3.LogInfo((object)"[Cruiser_Enhancement] Update: 경적 강제 중지");
						}
					}
					if (hornCheckTimer >= 0.5f)
					{
						pendingHornCheck = false;
						hornCheckTimer = 0f;
					}
				}
				if (__instance.ignitionStarted && !wasIgnitionStarted)
				{
					wasIgnitionStarted = true;
					if (!isThirdPerson && !pendingIgnitionSwitch)
					{
						pendingIgnitionSwitch = true;
						ignitionSwitchTimer = 0f;
					}
					tipsUpdated = false;
				}
				else if (!__instance.ignitionStarted && wasIgnitionStarted)
				{
					wasIgnitionStarted = false;
					pendingIgnitionSwitch = false;
					ignitionSwitchTimer = 0f;
				}
				if (pendingHudUpdate)
				{
					hudUpdateTimer += Time.deltaTime;
					if (hudUpdateTimer >= 0.15f)
					{
						pendingHudUpdate = false;
						hudUpdateTimer = 0f;
						UpdateControlTips(__instance, forceUpdate: true);
					}
				}
				if (__instance.ignitionStarted && !pendingHudUpdate)
				{
					UpdateControlTips(__instance);
				}
				if (pendingIgnitionSwitch && __instance.ignitionStarted)
				{
					ignitionSwitchTimer += Time.deltaTime;
					if (ignitionSwitchTimer >= 0.3f)
					{
						pendingIgnitionSwitch = false;
						ignitionSwitchTimer = 0f;
						if (!isThirdPerson)
						{
							ToggleCamera(__instance);
							cameraRetryCount = 0;
							cameraVerifyTimer = 0.1f;
							tipsUpdated = false;
							UpdateControlTips(__instance, forceUpdate: true);
						}
					}
				}
				else if (pendingIgnitionSwitch && !__instance.ignitionStarted)
				{
					pendingIgnitionSwitch = false;
					ignitionSwitchTimer = 0f;
				}
				if (cameraVerifyTimer > 0f && isThirdPerson && (Object)tpCamera != (Object)null)
				{
					cameraVerifyTimer -= Time.deltaTime;
					if (cameraVerifyTimer <= 0f)
					{
						if (((Component)tpCamera).tag != "MainCamera" && cameraRetryCount < 5)
						{
							cameraRetryCount++;
							Camera gameplayCamera2 = StartOfRound.Instance.localPlayerController.gameplayCamera;
							if ((Object)gameplayCamera2 != (Object)null)
							{
								((Component)gameplayCamera2).tag = "Untagged";
								((Behaviour)gameplayCamera2).enabled = false;
							}
							((Component)tpCamera).tag = "MainCamera";
							((Behaviour)tpCamera).enabled = true;
							cameraVerifyTimer = 0.1f;
						}
						else
						{
							cameraVerifyTimer = 0f;
						}
					}
				}
				Gamepad current3 = Gamepad.current;
				Keyboard current4 = Keyboard.current;
				bool flag3 = false;
				if (current4 != null && ((ButtonControl)current4.vKey).wasPressedThisFrame)
				{
					flag3 = true;
				}
				if (current3 != null && current3.rightStickButton.wasPressedThisFrame)
				{
					flag3 = true;
				}
				if (flag3)
				{
					ToggleCamera(__instance);
				}
				bool flag4 = false;
				if (current4 != null && ((ButtonControl)current4.fKey).wasPressedThisFrame)
				{
					flag4 = true;
				}
				if (current3 != null && current3.buttonNorth.wasPressedThisFrame)
				{
					flag4 = true;
				}
				if (flag4)
				{
					ExitVehicleFromThirdPerson(__instance);
				}
				ApplyTireEffectsForObserver(__instance);
			}
			catch (Exception ex)
			{
				ManualLogSource val4 = logger;
				if (val4 != null)
				{
					val4.LogError((object)("[Cruiser_Enhancement] Update 오류: " + ex.Message));
				}
			}
		}

		private static void VehicleController_LateUpdate_Postfix(VehicleController __instance)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			try
			{
				if (__instance.localPlayerInControl || __instance.localPlayerInPassengerSeat)
				{
					UpdateGTACamera(__instance);
				}
				if (__instance.localPlayerInControl || !((Object)__instance.currentDriver != (Object)null))
				{
					return;
				}
				VehicleSyncState orCreateSyncState = GetOrCreateSyncState(__instance);
				if (orCreateSyncState != null && orCreateSyncState.initialized && orCreateSyncState.usesLethalNetworkAPI)
				{
					if (steeringWheelAnimFloatField != null)
					{
						steeringWheelAnimFloatField.SetValue(__instance, orCreateSyncState.syncedSteeringWheelAnimFloat);
					}
					__instance.steeringInput = orCreateSyncState.syncedSteeringInput;
				}
				ApplyTireEffectsForObserver(__instance);
			}
			catch
			{
			}
		}

		private static void ApplyTireEffectsForObserver(VehicleController vehicle)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			if (vehicle.localPlayerInControl || vehicle.carDestroyed || vehicle.magnetedToShip || !vehicle.ignitionStarted || (Object)vehicle.currentDriver == (Object)null || (Object)vehicle.tireSparks == (Object)null)
			{
				return;
			}
			VehicleSyncState orCreateSyncState = GetOrCreateSyncState(vehicle);
			if (!orCreateSyncState.initialized)
			{
				return;
			}
			float syncedMotorTorque = orCreateSyncState.syncedMotorTorque;
			float magnitude = ((Vector3)(ref orCreateSyncState.predictedVelocity)).magnitude;
			bool num = syncedMotorTorque > 900f && magnitude > 8f;
			bool flag = (syncedMotorTorque > 600f && magnitude > 5f) || (Mathf.Abs(vehicle.steeringInput) > 1.5f && magnitude > 6f);
			if (num)
			{
				if (!vehicle.tireSparks.isPlaying)
				{
					vehicle.tireSparks.Play(true);
				}
			}
			else if (vehicle.tireSparks.isPlaying)
			{
				vehicle.tireSparks.Stop(true, (ParticleSystemStopBehavior)1);
			}
			if ((Object)vehicle.skiddingAudio != (Object)null)
			{
				if (flag)
				{
					float num2 = Mathf.Clamp01((syncedMotorTorque - 600f) / 400f) * 0.5f;
					if (!vehicle.skiddingAudio.isPlaying)
					{
						vehicle.skiddingAudio.Play();
					}
					vehicle.skiddingAudio.volume = Mathf.Lerp(vehicle.skiddingAudio.volume, num2, Time.deltaTime * 5f);
				}
				else
				{
					vehicle.skiddingAudio.volume = Mathf.Lerp(vehicle.skiddingAudio.volume, 0f, Time.deltaTime * 5f);
					if (vehicle.skiddingAudio.volume < 0.01f && vehicle.skiddingAudio.isPlaying)
					{
						vehicle.skiddingAudio.Stop();
					}
				}
			}
			if (Time.frameCount % 60 == 0)
			{
				ManualLogSource val = logger;
				if (val != null)
				{
					val.LogDebug((object)$"[TireSync] Cruiser_Enhancement 제어: torque={syncedMotorTorque:F0}, vel={magnitude:F1}, sparks={vehicle.tireSparks.isPlaying}, skid={flag}");
				}
			}
		}

		private static void UpdateClientTireEffects(VehicleController vehicle)
		{
		}

		private static void SetCarEffects_Prefix(VehicleController __instance, float setSteering)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			try
			{
				if (!__instance.localPlayerInControl && !((Object)__instance.currentDriver == (Object)null) && __instance.ignitionStarted && !__instance.carDestroyed && !__instance.magnetedToShip && !((Object)__instance.FrontLeftWheel == (Object)null) && !((Object)__instance.FrontRightWheel == (Object)null))
				{
					savedMotorTorqueLeft = __instance.FrontLeftWheel.motorTorque;
					savedMotorTorqueRight = __instance.FrontRightWheel.motorTorque;
					VehicleSyncState orCreateSyncState = GetOrCreateSyncState(__instance);
					if (orCreateSyncState == null || !orCreateSyncState.initialized)
					{
						motorTorqueOverridden = false;
						return;
					}
					float syncedMotorTorque = orCreateSyncState.syncedMotorTorque;
					__instance.FrontLeftWheel.motorTorque = syncedMotorTorque;
					__instance.FrontRightWheel.motorTorque = syncedMotorTorque;
					motorTorqueOverridden = true;
				}
			}
			catch
			{
				motorTorqueOverridden = false;
			}
		}

		private static void SetCarEffects_Postfix(VehicleController __instance, float setSteering)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			try
			{
				if (!__instance.localPlayerInControl && motorTorqueOverridden)
				{
					if ((Object)__instance.FrontLeftWheel != (Object)null)
					{
						__instance.FrontLeftWheel.motorTorque = savedMotorTorqueLeft;
					}
					if ((Object)__instance.FrontRightWheel != (Object)null)
					{
						__instance.FrontRightWheel.motorTorque = savedMotorTorqueRight;
					}
					motorTorqueOverridden = false;
				}
			}
			catch
			{
				motorTorqueOverridden = false;
			}
		}

		private static void InitializeReflectionFields(Type vehicleControllerType)
		{
			if (reflectionInitialized)
			{
				return;
			}
			try
			{
				syncSpeedMultiplierField = AccessTools.Field(vehicleControllerType, "syncSpeedMultiplier");
				syncedPositionField = AccessTools.Field(vehicleControllerType, "syncedPosition");
				syncedRotationField = AccessTools.Field(vehicleControllerType, "syncedRotation");
				mainRigidbodyField = AccessTools.Field(vehicleControllerType, "mainRigidbody");
				magnetedToShipField = AccessTools.Field(vehicleControllerType, "magnetedToShip");
				testingVehicleInEditorField = AccessTools.Field(vehicleControllerType, "testingVehicleInEditor");
				hasBeenSpawnedField = AccessTools.Field(vehicleControllerType, "hasBeenSpawned");
				itemShipField = AccessTools.Field(vehicleControllerType, "itemShip");
				ragdollPhysicsBodyField = AccessTools.Field(vehicleControllerType, "ragdollPhysicsBody");
				windwiperPhysicsBody1Field = AccessTools.Field(vehicleControllerType, "windwiperPhysicsBody1");
				windwiperPhysicsBody2Field = AccessTools.Field(vehicleControllerType, "windwiperPhysicsBody2");
				windwiper1Field = AccessTools.Field(vehicleControllerType, "windwiper1");
				windwiper2Field = AccessTools.Field(vehicleControllerType, "windwiper2");
				averageCountField = AccessTools.Field(vehicleControllerType, "averageCount");
				movingAverageLengthField = AccessTools.Field(vehicleControllerType, "movingAverageLength");
				averageVelocityField = AccessTools.Field(vehicleControllerType, "averageVelocity");
				stabilityField = AccessTools.Field(vehicleControllerType, "stability");
				magnetStartPositionField = AccessTools.Field(vehicleControllerType, "magnetStartPosition");
				magnetTargetPositionField = AccessTools.Field(vehicleControllerType, "magnetTargetPosition");
				magnetStartRotationField = AccessTools.Field(vehicleControllerType, "magnetStartRotation");
				magnetTargetRotationField = AccessTools.Field(vehicleControllerType, "magnetTargetRotation");
				magnetPositionCurveField = AccessTools.Field(vehicleControllerType, "magnetPositionCurve");
				magnetRotationCurveField = AccessTools.Field(vehicleControllerType, "magnetRotationCurve");
				magnetTimeField = AccessTools.Field(vehicleControllerType, "magnetTime");
				magnetRotationTimeField = AccessTools.Field(vehicleControllerType, "magnetRotationTime");
				averageVelocityAtMagnetStartField = AccessTools.Field(vehicleControllerType, "averageVelocityAtMagnetStart");
				finishedMagnetingField = AccessTools.Field(vehicleControllerType, "finishedMagneting");
				syncRotationSpeedField = AccessTools.Field(vehicleControllerType, "syncRotationSpeed");
				truckVelocityLastFrameField = AccessTools.Field(vehicleControllerType, "truckVelocityLastFrame");
				syncCarPositionIntervalField = AccessTools.Field(vehicleControllerType, "syncCarPositionInterval");
				moveInputVectorField = AccessTools.Field(vehicleControllerType, "moveInputVector");
				steeringWheelAnimFloatField = AccessTools.Field(vehicleControllerType, "steeringWheelAnimFloat");
				syncCarPhysicsMethod = AccessTools.Method(vehicleControllerType, "SyncCarPhysicsToOtherClients", (Type[])null, (Type[])null);
				reflectionInitialized = true;
				ManualLogSource val = logger;
				if (val != null)
				{
					val.LogInfo((object)"[Cruiser_Enhancement] Reflection 필드 초기화 완료");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource val2 = logger;
				if (val2 != null)
				{
					val2.LogError((object)("[Cruiser_Enhancement] Reflection 초기화 실패: " + ex.Message));
				}
			}
		}

		private static VehicleSyncState GetOrCreateSyncState(VehicleController vehicle)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_00b9: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			int instanceID = ((Object)vehicle).GetInstanceID();
			if (!vehicleSyncStates.TryGetValue(instanceID, out var value))
			{
				Vector3 val = ((Component)vehicle).transform.position;
				Quaternion val2 = ((Component)vehicle).transform.rotation;
				try
				{
					if (syncedPositionField != null)
					{
						val = (Vector3)syncedPositionField.GetValue(vehicle);
					}
					if (syncedRotationField != null)
					{
						val2 = (Quaternion)syncedRotationField.GetValue(vehicle);
					}
				}
				catch
				{
				}
				if (val.y > 500f || ((Vector3)(ref val)).magnitude < 0.01f)
				{
					val = ((Component)vehicle).transform.position;
					val2 = ((Component)vehicle).transform.rotation;
				}
				value = new VehicleSyncState
				{
					targetPosition = val,
					targetRotation = val2,
					smoothedPosition = val,
					smoothedRotation = val2,
					predictedVelocity = Vector3.zero,
					angularVelocity = Vector3.zero,
					smoothDampVelocity = Vector3.zero,
					lastReceiveTime = Time.time,
					lastReceivedPosition = val,
					initialized = true
				};
				vehicleSyncStates[instanceID] = value;
			}
			return value;
		}

		private static void SyncCarPositionClientRpc_Postfix(VehicleController __instance, Vector3 carPosition, Vector3 carRotation)
		{
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Invalid comparison between Unknown and I4
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Invalid comparison between Unknown and I4
			try
			{
				if (__instance.localPlayerInControl)
				{
					return;