Decompiled source of Fortnitemod v1.4.0

BepInEx/plugins/GravityCar.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CarStuff.BindingInfo;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalCompanyInputUtils.BindingPathEnums;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GravityCar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f134b717af3b06ce5c7ac53f48c31678a0118dad")]
[assembly: AssemblyProduct("Project5")]
[assembly: AssemblyTitle("GravityCar")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 Project5
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GravityCar";

		public const string PLUGIN_NAME = "Project5";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace CarStuff
{
	public sealed class Config
	{
		private static Config instance;

		public ConfigEntry<bool> Enabled { get; set; }

		public ConfigEntry<bool> ManualSelect { get; set; }

		public ConfigEntry<bool> WasConfigFixed { get; set; }

		public ConfigEntry<bool> BuildingCar { get; set; }

		public ConfigEntry<bool> SwitchCarRotationMethod { get; set; }

		public static Config Instance
		{
			get
			{
				if (instance == null)
				{
					instance = new Config();
				}
				return instance;
			}
		}

		public void Setup()
		{
			Enabled = Project5.BepInExConfig().Bind<bool>("General", "Enabled", true, "Enables the fortnite");
			ManualSelect = Project5.BepInExConfig().Bind<bool>("General", "Gravity select mode", false, "use j, currently broken");
			WasConfigFixed = Project5.BepInExConfig().Bind<bool>("Dev", "ConfigFixed", false, "Manual select was on by default and i cant do much about it now so config to disable the config");
			BuildingCar = Project5.BepInExConfig().Bind<bool>("General", "Car go in building", true, "isnt effected by gravity control being enabled, car go building near door, dont be suprised if you fall out of the map or get stuck in a wall thats your fault my mod is flawless shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up ");
			SwitchCarRotationMethod = Project5.BepInExConfig().Bind<bool>("General", "Outer Wilds Style Rotation", false, "Makes it so the car only rotates when button is pressed");
		}
	}
	[BepInPlugin("Pandemonius.FortniteMod", "FortniteMod", "1.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Project5 : BaseUnityPlugin
	{
		internal static Project5 Instance;

		private readonly Harmony harmony = new Harmony("Pandemonius.FortniteMod");

		public static int VehicleMask = 0;

		public static bool InPhysics = false;

		public static bool AppliedJump = false;

		public static PlayerPhysicsRegion carphysics;

		public static bool ChangeGrav = false;

		public static bool SetupInput = false;

		public static bool isOutside = true;

		public static bool Jumping = false;

		public static bool FallingNoJump = false;

		public static bool FallingJump = false;

		public static bool Sliding = false;

		public static float SlidingTimer = 0f;

		public static float SlidingFriction = 0f;

		public static float Slope = 0f;

		public static float SlopeIntensity = 0f;

		public static Vector3 vector4 = default(Vector3);

		public static float TimeSinceJumping = 0f;

		public static float fall = 0f;

		public static Vector3 CollisionPoint = Vector3.zero;

		public static int AllLayersAndVehicle;

		public static Vector3 AngularAcceleration = Vector3.zero;

		public static Vector3 RotationalInput = Vector3.zero;

		public static float MaxRotationalInput = 25f;

		public static bool CamLock = true;

		public static bool RollMode = false;

		public static bool BindsSet = false;

		public static EntranceTeleport[] AllTeleports;

		public static EntranceTeleport[] outsideTeleports;

		public static EntranceTeleport[] insideTeleports;

		internal static CarBinds Bindings;

		internal static ManualLogSource Logger { get; private set; } = null;


		public static ConfigFile BepInExConfig()
		{
			return ((BaseUnityPlugin)Instance).Config;
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Config.Instance.Setup();
			harmony.PatchAll();
			Bindings = new CarBinds();
			if (Config.Instance.ManualSelect.Value & !Config.Instance.WasConfigFixed.Value)
			{
				Config.Instance.ManualSelect.Value = false;
				Config.Instance.WasConfigFixed.Value = false;
			}
		}
	}
}
namespace CarStuff.Patches
{
	[HarmonyPatch(typeof(VehicleController))]
	public class CarPatchBuilding
	{
		public static float timeAtLastUsingEntrance = 0f;

		public static Transform ClosestPoint = new Transform();

		public static float MinMagnitude = 8f;

		public static float ClosestMagnitude = MinMagnitude;

		public static bool updated = false;

		private static void RollOn(CallbackContext _)
		{
			Project5.RollMode = true;
		}

		private static void RollOff(CallbackContext _)
		{
			Project5.RollMode = false;
		}

		private static void LookOn(CallbackContext _)
		{
			Project5.CamLock = true;
		}

		private static void LookOff(CallbackContext _)
		{
			Project5.CamLock = false;
		}

		public static void SetBinds()
		{
			CarBinds.Instance.RollMode.performed += RollOn;
			CarBinds.Instance.RollMode.canceled += RollOff;
			CarBinds.Instance.Look.performed += LookOn;
			CarBinds.Instance.Look.canceled += LookOff;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void CarAngularInput(VehicleController __instance)
		{
			//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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			if (!Project5.BindsSet)
			{
				Project5.BindsSet = true;
				SetBinds();
			}
			if (!__instance.localPlayerInControl)
			{
				return;
			}
			float num = 0f;
			float num2 = 0f;
			MovementActions movement = GameNetworkManager.Instance.localPlayerController.playerActions.Movement;
			float y = ((MovementActions)(ref movement)).Look.ReadValue<Vector2>().y;
			if (Project5.RollMode)
			{
				movement = GameNetworkManager.Instance.localPlayerController.playerActions.Movement;
				num2 = ((MovementActions)(ref movement)).Look.ReadValue<Vector2>().x;
			}
			else
			{
				movement = GameNetworkManager.Instance.localPlayerController.playerActions.Movement;
				num = ((MovementActions)(ref movement)).Look.ReadValue<Vector2>().x;
			}
			Project5.AngularAcceleration = new Vector3((0f - y) * (Project5.MaxRotationalInput / 2f), num * (Project5.MaxRotationalInput * 0.75f), (0f - num2) * (Project5.MaxRotationalInput / 2f)) * (float)IngamePlayerSettings.Instance.settings.lookSensitivity;
			if (((Vector3)(ref Project5.AngularAcceleration)).sqrMagnitude > 0f)
			{
				float num3 = Project5.MaxRotationalInput * 1f;
				Project5.AngularAcceleration.x = Mathf.Clamp(Project5.AngularAcceleration.x, 0f - num3, num3);
				Project5.AngularAcceleration.y = Mathf.Clamp(Project5.AngularAcceleration.y, 0f - num3, num3);
				Project5.AngularAcceleration.z = Mathf.Clamp(Project5.AngularAcceleration.z, 0f - num3, num3);
				if (Project5.CamLock)
				{
					__instance.mainRigidbody.AddRelativeTorque(Project5.AngularAcceleration, (ForceMode)5);
				}
			}
		}

		[HarmonyPatch("FixedUpdate")]
		[HarmonyPostfix]
		public static void TeleportCar(VehicleController __instance)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: 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_024b: Unknown result type (might be due to invalid IL or missing references)
			if (!Config.Instance.BuildingCar.Value || !__instance.localPlayerInControl)
			{
				return;
			}
			Project5.isOutside = ((Component)__instance.mainRigidbody).transform.position.y > -80f;
			Project5.Logger.LogInfo((object)$"Outside = {Project5.isOutside}");
			if (((NetworkBehaviour)__instance).IsOwner & !__instance.carDestroyed & !StartOfRound.Instance.inShipPhase)
			{
				if (!(Time.realtimeSinceStartup - timeAtLastUsingEntrance > 1.8f))
				{
					return;
				}
				ClosestMagnitude = MinMagnitude;
				if (!Project5.isOutside)
				{
					int num = 0;
					EntranceTeleport[] insideTeleports = Project5.insideTeleports;
					EntranceTeleport[] array = insideTeleports;
					foreach (EntranceTeleport val in array)
					{
						if (Vector3.Distance(__instance.mainRigidbody.position, ((Component)val.entrancePoint).transform.position) < ClosestMagnitude)
						{
							ClosestMagnitude = Vector3.Distance(__instance.mainRigidbody.position, ((Component)val.entrancePoint).transform.position);
							ClosestPoint = ((Component)Project5.outsideTeleports[num]).transform;
						}
						num++;
					}
					if (ClosestMagnitude != MinMagnitude)
					{
						timeAtLastUsingEntrance = Time.realtimeSinceStartup;
						__instance.mainRigidbody.isKinematic = true;
						((Component)__instance).transform.position = ClosestPoint.position + ((Component)ClosestPoint).transform.right * 12f;
						((Component)__instance).transform.rotation = Quaternion.Euler(0f, ClosestPoint.eulerAngles.y + 90f, 0f);
						__instance.syncedPosition = ClosestPoint.position + ((Component)ClosestPoint).transform.right * 12f;
						__instance.syncedRotation = Quaternion.Euler(0f, ClosestPoint.eulerAngles.y + 90f, 0f);
					}
					return;
				}
				int num2 = 0;
				EntranceTeleport[] outsideTeleports = Project5.outsideTeleports;
				EntranceTeleport[] array2 = outsideTeleports;
				foreach (EntranceTeleport val2 in array2)
				{
					if (Vector3.Distance(__instance.mainRigidbody.position, ((Component)val2.entrancePoint).transform.position) < ClosestMagnitude)
					{
						ClosestMagnitude = Vector3.Distance(__instance.mainRigidbody.position, ((Component)val2.entrancePoint).transform.position);
						ClosestPoint = ((Component)Project5.insideTeleports[num2]).transform;
					}
					num2++;
				}
				if (ClosestMagnitude != MinMagnitude)
				{
					timeAtLastUsingEntrance = Time.realtimeSinceStartup;
					__instance.mainRigidbody.isKinematic = true;
					((Component)__instance).transform.position = ClosestPoint.position + ((Component)ClosestPoint).transform.right * 12f;
					((Component)__instance).transform.rotation = Quaternion.Euler(0f, ClosestPoint.eulerAngles.y + 90f, 0f);
					__instance.syncedPosition = ClosestPoint.position + ((Component)ClosestPoint).transform.right * 12f;
					__instance.syncedRotation = Quaternion.Euler(0f, ClosestPoint.eulerAngles.y + 90f, 0f);
				}
			}
			else
			{
				timeAtLastUsingEntrance = Time.realtimeSinceStartup;
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	public class EntrancePatchCar
	{
		[HarmonyPatch("SetLevelObjectVariables")]
		[HarmonyPostfix]
		private static void GetTeleports()
		{
			Project5.AllTeleports = Object.FindObjectsOfType<EntranceTeleport>();
			Project5.outsideTeleports = (EntranceTeleport[])(object)new EntranceTeleport[Project5.AllTeleports.Length / 2];
			Project5.insideTeleports = (EntranceTeleport[])(object)new EntranceTeleport[Project5.AllTeleports.Length / 2];
			for (int i = 0; i < Project5.AllTeleports.Length; i++)
			{
				int entranceId = Project5.AllTeleports[i].entranceId;
				if (Project5.AllTeleports[i].isEntranceToBuilding)
				{
					Project5.outsideTeleports[entranceId] = Project5.AllTeleports[i];
				}
				else
				{
					Project5.insideTeleports[entranceId] = Project5.AllTeleports[i];
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class CameraStuff
	{
		[HarmonyPatch("LookClamped")]
		[HarmonyPrefix]
		public static bool LookClamp(PlayerControllerB __instance, ref Vector2 lookInput)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				return true;
			}
			if (Project5.CamLock)
			{
				__instance.ladderCameraHorizontal = Mathf.LerpAngle(__instance.ladderCameraHorizontal, 0f, Time.deltaTime * 1f);
				__instance.cameraUp = Mathf.LerpAngle(__instance.cameraUp, 0f, Time.deltaTime * 1f);
				((Component)__instance.gameplayCamera).transform.localEulerAngles = new Vector3(__instance.cameraUp, __instance.ladderCameraHorizontal, ((Component)__instance.gameplayCamera).transform.localEulerAngles.z);
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(VehicleController))]
	public class CarControl
	{
		public static Vector3 grav = Physics.gravity;

		public static RaycastHit Carhit;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void CarGravity(VehicleController __instance)
		{
			//IL_016b: 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_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: 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_00d8: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			if ((Project5.VehicleMask == 0) & (1 << LayerMask.NameToLayer("MoldSpore") != -1))
			{
				Project5.VehicleMask = 1 << LayerMask.NameToLayer("MoldSpore");
			}
			if (Config.Instance.Enabled.Value)
			{
				Project5.carphysics = __instance.physicsRegion;
				__instance.physicsRegion.maxTippingAngle = 2.1474836E+09f;
				if (Config.Instance.ManualSelect.Value)
				{
					if (Project5.ChangeGrav & Physics.Raycast(((Component)__instance).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.forward * 1f, ref Carhit, 2048f, StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1))
					{
						Physics.gravity = Quaternion.Euler(((RaycastHit)(ref Carhit)).normal) * grav;
						Project5.ChangeGrav = false;
					}
					else
					{
						Project5.ChangeGrav = false;
					}
				}
				else
				{
					Project5.ChangeGrav = false;
					if (Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.up * -1f, ref Carhit, 6f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1))
					{
						Physics.gravity = ((Component)__instance).transform.rotation * grav;
					}
				}
			}
			else
			{
				Physics.gravity = grav;
				__instance.physicsRegion.maxTippingAngle = 180f;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class Jumper
	{
		[HarmonyPatch("IsPlayerNearGround")]
		[HarmonyPrefix]
		private static bool nearGround(PlayerControllerB __instance, ref bool __result)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0053: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			Project5.AllLayersAndVehicle = (1 << LayerMask.NameToLayer("Vehicle")) | StartOfRound.Instance.allPlayersCollideWithMask;
			float num = __instance.thisController.radius * 0.75f;
			Vector3 val = ((Component)__instance).transform.position + ((Component)__instance).transform.up * num;
			__instance.interactRay = new Ray(val, -((Component)__instance).transform.up);
			__result = Physics.SphereCast(__instance.interactRay, num, 0.15f, Project5.AllLayersAndVehicle, (QueryTriggerInteraction)1);
			return false;
		}

		[HarmonyPatch("Jump_performed")]
		[HarmonyPostfix]
		public static void JumpFix(PlayerControllerB __instance)
		{
			if (!((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController) && __instance.jumpCoroutine != null)
			{
				((MonoBehaviour)__instance).StopCoroutine(__instance.jumpCoroutine);
				Project5.TimeSinceJumping = Time.realtimeSinceStartup;
				__instance.playerBodyAnimator.SetBool("Jumping", true);
				Project5.Jumping = true;
			}
		}

		[HarmonyPatch("Crouch_performed")]
		[HarmonyPrefix]
		public static bool Croucher(ref CallbackContext context, PlayerControllerB __instance)
		{
			if ((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				return true;
			}
			if (((CallbackContext)(ref context)).performed && !__instance.quickMenuManager.isMenuOpen && !__instance.inSpecialInteractAnimation && __instance.IsPlayerNearGround() && !__instance.isTypingChat && !__instance.isJumping && !__instance.isSprinting)
			{
				__instance.crouchMeter = Mathf.Min(__instance.crouchMeter + 0.3f, 1.3f);
				__instance.Crouch(!__instance.isCrouching);
			}
			return false;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void JumpHandler(PlayerControllerB __instance)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				return;
			}
			Project5.vector4 = Vector3.zero;
			if (!__instance.IsPlayerNearGround())
			{
				Project5.fall = Mathf.Clamp(Project5.fall - 38f * Time.deltaTime, -150f, GameNetworkManager.Instance.localPlayerController.jumpForce);
				if (!Project5.Jumping && !Project5.FallingJump)
				{
					if (!Project5.FallingNoJump)
					{
						Project5.FallingNoJump = true;
						__instance.fallValue = -7f;
						__instance.fallValueUncapped = -7f;
					}
					else if (Project5.fall < -20f)
					{
						__instance.isCrouching = false;
						__instance.playerBodyAnimator.SetBool("crouching", false);
						__instance.playerBodyAnimator.SetBool("FallNoJump", true);
					}
				}
			}
			else
			{
				if (!Project5.Jumping)
				{
					if (Project5.FallingNoJump)
					{
						Project5.FallingNoJump = false;
						if (!__instance.isCrouching && Project5.fall < -9f)
						{
							__instance.playerBodyAnimator.SetTrigger("ShortFallLanding");
						}
					}
					if (!Project5.FallingJump)
					{
						__instance.fallValue = -7f - Mathf.Clamp(12f * __instance.slopeModifier, 0f, 100f);
						__instance.fallValueUncapped = -7f - Mathf.Clamp(12f * __instance.slopeModifier, 0f, 100f);
						if (!Project5.InPhysics)
						{
							Project5.fall = -7f - Mathf.Clamp(12f * __instance.slopeModifier, 0f, 100f);
						}
						else
						{
							Project5.fall = -0.1f;
						}
					}
				}
				__instance.playerBodyAnimator.SetBool("FallNoJump", false);
			}
			if (Project5.InPhysics)
			{
				__instance.ResetFallGravity();
			}
			if (Project5.Jumping)
			{
				if ((Time.realtimeSinceStartup - Project5.TimeSinceJumping >= 0.15f) & (Time.realtimeSinceStartup - Project5.TimeSinceJumping < 0.25f) & !Project5.AppliedJump)
				{
					Project5.AppliedJump = true;
					__instance.fallValue = GameNetworkManager.Instance.localPlayerController.jumpForce;
					__instance.fallValueUncapped = GameNetworkManager.Instance.localPlayerController.jumpForce;
					Project5.fall = GameNetworkManager.Instance.localPlayerController.jumpForce;
				}
				else if (Time.realtimeSinceStartup - Project5.TimeSinceJumping >= 0.25f)
				{
					Project5.AppliedJump = false;
					__instance.isJumping = false;
					__instance.isFallingFromJump = true;
					Project5.FallingJump = true;
					if (__instance.IsPlayerNearGround())
					{
						__instance.playerBodyAnimator.SetBool("Jumping", false);
						__instance.isFallingFromJump = false;
						__instance.PlayerHitGroundEffects();
						Project5.FallingJump = false;
						Project5.Jumping = false;
					}
				}
			}
			if (!__instance.inSpecialInteractAnimation || __instance.inShockingMinigame)
			{
				if (!Project5.InPhysics)
				{
					Project5.vector4 += Vector3.up * (0f - __instance.fallValue) + Vector3.up * Project5.fall;
				}
				else if (Project5.InPhysics & ((Object)(object)Project5.carphysics != (Object)null))
				{
					Project5.vector4 += Vector3.up * (0f - __instance.fallValue) + ((Component)GameNetworkManager.Instance.localPlayerController.physicsParent).transform.up * Project5.fall;
				}
				GameNetworkManager.Instance.localPlayerController.thisController.Move(Project5.vector4 * Time.deltaTime);
			}
			else if (__instance.inSpecialInteractAnimation & !__instance.inShockingMinigame)
			{
				__instance.ResetFallGravity();
				Project5.fall = -7f;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerPhysicsRegion))]
	public class PlayerFix
	{
		public static Vector3 playervel = default(Vector3);

		public static float StepOffset = 0f;

		public static PlayerControllerB LocalPlayer;

		public static Vector3 vector;

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static bool PlayerPatch(PlayerPhysicsRegion __instance)
		{
			//IL_020d: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.maxTippingAngle == 2.1474836E+09f)
			{
				LocalPlayer = GameNetworkManager.Instance.localPlayerController;
				if (GameNetworkManager.Instance.localPlayerController.thisController.stepOffset > 0f)
				{
					StepOffset = GameNetworkManager.Instance.localPlayerController.thisController.stepOffset;
				}
				if (GameNetworkManager.Instance.localPlayerController.slopeIntensity > 0f)
				{
					Project5.SlopeIntensity = GameNetworkManager.Instance.localPlayerController.slopeIntensity;
				}
				if (GameNetworkManager.Instance.localPlayerController.thisController.slopeLimit < 180f)
				{
					Project5.Slope = GameNetworkManager.Instance.localPlayerController.thisController.slopeLimit;
				}
				if (((Object)(object)__instance == (Object)(object)Project5.carphysics) & __instance.hasLocalPlayer & !GameNetworkManager.Instance.localPlayerController.inVehicleAnimation & Config.Instance.Enabled.Value)
				{
					LocalPlayer.thisController.slopeLimit = 180f;
					LocalPlayer.playerGroundNormal = Vector3.up;
					GameNetworkManager.Instance.localPlayerController.thisController.stepOffset = 0f;
					Project5.InPhysics = true;
				}
				else
				{
					GameNetworkManager.Instance.localPlayerController.slopeIntensity = Project5.SlopeIntensity;
					GameNetworkManager.Instance.localPlayerController.thisController.slopeLimit = Project5.Slope;
					GameNetworkManager.Instance.localPlayerController.thisController.stepOffset = StepOffset;
					Project5.InPhysics = false;
				}
			}
			__instance.physicsCollider.enabled = __instance.IsPhysicsRegionActive();
			if (!__instance.hasLocalPlayer)
			{
				return false;
			}
			if (__instance.checkInterval > 0.15f)
			{
				if (!__instance.removePlayerNextFrame)
				{
					__instance.removePlayerNextFrame = true;
					return false;
				}
				__instance.removePlayerNextFrame = false;
				Collider[] array = Physics.OverlapSphere(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, GameNetworkManager.Instance.localPlayerController.thisController.radius * 1.1f, Project5.VehicleMask);
				Collider[] array2 = array;
				foreach (Collider val in array2)
				{
					if ((Object)(object)val == (Object)(object)__instance.physicsCollider || !GameNetworkManager.Instance.localPlayerController.IsPlayerNearGround())
					{
						return false;
					}
				}
				__instance.hasLocalPlayer = false;
				StartOfRound.Instance.CurrentPlayerPhysicsRegions.Remove(__instance);
			}
			else
			{
				__instance.checkInterval += Time.deltaTime;
			}
			return true;
		}
	}
}
namespace CarStuff.BindingInfo
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class trueorrubbish
	{
		[HarmonyPatch("ConnectClientToPlayerObject")]
		[HarmonyPrefix]
		public static void SetupKeybindCallbacks(PlayerControllerB __instance)
		{
			if (!Project5.SetupInput)
			{
				Project5.SetupInput = true;
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class rubbishortrue
	{
		[HarmonyPatch("OnLocalDisconnect")]
		[HarmonyPrefix]
		public static void Disconnectkeybinds()
		{
			if (Project5.SetupInput)
			{
				Project5.SetupInput = false;
			}
		}
	}
	public class keybindHandler
	{
		public static void wallswitch(CallbackContext context)
		{
			if (((CallbackContext)(ref context)).performed)
			{
				Project5.ChangeGrav = true;
			}
		}
	}
	public class CarBinds : LcInputActions
	{
		public static readonly CarBinds Instance = new CarBinds();

		public InputAction Look => ((LcInputActions)this).Asset["carlook"];

		public InputAction RollMode => ((LcInputActions)this).Asset["rollmode"];

		public override void CreateInputActions(in InputActionMapBuilder builder)
		{
			builder.NewActionBinding().WithActionId("carlook").WithActionType((InputActionType)1)
				.WithKeyboardControl((KeyboardControl)60)
				.WithGamepadControl((GamepadControl)4)
				.WithBindingName("CarLook")
				.Finish();
			builder.NewActionBinding().WithActionId("rollmode").WithActionType((InputActionType)1)
				.WithKeyboardControl((KeyboardControl)38)
				.WithGamepadControl((GamepadControl)8)
				.WithBindingName("Roller")
				.Finish();
		}
	}
}