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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Scandal.PatchesNeat.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
[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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("Scandal.PatchesNeat")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScandalsProject")]
[assembly: AssemblyTitle("Scandal.PatchesNeat")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
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 ScandalsProject
{
[BepInPlugin("Scandal.PatchesNeat", "ScandalsProject", "1.0.0")]
public class ScandalsProject : BaseUnityPlugin
{
public static ScandalsProject Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
NetcodePatcher();
Patch();
Logger.LogInfo((object)"Scandal.PatchesNeat v1.0.0 has loaded!");
}
internal static void Patch()
{
//IL_000d: 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_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("Scandal.PatchesNeat");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
private void NetcodePatcher()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Scandal.PatchesNeat";
public const string PLUGIN_NAME = "ScandalsProject";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LCScandalous_patch.Patches
{
[HarmonyPatch(typeof(VehicleController))]
public class VehicleController_scPatch : NetworkBehaviour
{
[HarmonyPatch("SetCarEffects")]
[HarmonyPostfix]
public static void SetCarEffects_Prefix(VehicleController __instance, ref float setSteering)
{
MatchWheelMeshToCollider_Postfix(__instance, __instance.leftWheelMesh, __instance.FrontLeftWheel);
MatchWheelMeshToCollider_Postfix(__instance, __instance.rightWheelMesh, __instance.FrontRightWheel);
MatchWheelMeshToCollider_Postfix(__instance, __instance.backLeftWheelMesh, __instance.BackLeftWheel);
MatchWheelMeshToCollider_Postfix(__instance, __instance.backRightWheelMesh, __instance.BackRightWheel);
if (__instance.localPlayerInControl)
{
float num = 0.5f;
float num2 = __instance.steeringWheelAnimFloat + 0.5f;
__instance.steeringWheelAnimator.SetFloat("steeringWheelTurn", num2);
float num3 = 1f;
float num4 = Mathf.Abs(__instance.steeringWheelAnimFloat + num) * num3;
if ((Object)(object)__instance.currentDriver != (Object)null)
{
__instance.currentDriver.playerBodyAnimator.SetFloat("animationSpeed", num4);
}
}
}
[HarmonyPatch("SetWheelFriction")]
[HarmonyPostfix]
private static void SetWheelFriction_Postfix(VehicleController __instance)
{
//IL_0003: 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_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: 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_00d2: 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)
WheelFrictionCurve val = default(WheelFrictionCurve);
((WheelFrictionCurve)(ref val)).extremumSlip = 0.2f;
((WheelFrictionCurve)(ref val)).extremumValue = 1f;
((WheelFrictionCurve)(ref val)).asymptoteSlip = 0.8f;
((WheelFrictionCurve)(ref val)).asymptoteValue = 1f;
((WheelFrictionCurve)(ref val)).stiffness = 2f;
__instance.FrontRightWheel.forwardFriction = val;
__instance.FrontLeftWheel.forwardFriction = val;
((WheelFrictionCurve)(ref val)).stiffness = 2f;
__instance.BackRightWheel.forwardFriction = val;
__instance.BackLeftWheel.forwardFriction = val;
((WheelFrictionCurve)(ref val)).stiffness = 2f;
((WheelFrictionCurve)(ref val)).asymptoteValue = 1f;
((WheelFrictionCurve)(ref val)).extremumSlip = 0.7f;
__instance.FrontRightWheel.sidewaysFriction = val;
__instance.FrontLeftWheel.sidewaysFriction = val;
__instance.BackRightWheel.sidewaysFriction = val;
__instance.BackLeftWheel.sidewaysFriction = val;
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void Start_Postfix(VehicleController __instance)
{
SetWheelFriction_Postfix(__instance);
__instance.FrontLeftWheel.brakeTorque = 1000f;
__instance.FrontRightWheel.brakeTorque = 1000f;
__instance.BackLeftWheel.brakeTorque = 1000f;
__instance.BackRightWheel.brakeTorque = 1000f;
}
[HarmonyPatch("MatchWheelMeshToCollider")]
[HarmonyPostfix]
private static void MatchWheelMeshToCollider_Postfix(VehicleController __instance, MeshRenderer wheelMesh, WheelCollider wheelCollider)
{
//IL_0064: 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_0077: 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_007d: 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_008b: 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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_00d6: 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_00f7: 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_0121: 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_0131: 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_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: Unknown result type (might be due to invalid IL or missing references)
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(-1.33f, -1.275f, 3.015f);
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(1.33f, -1.275f, 3.015f);
Vector3 val3 = default(Vector3);
((Vector3)(ref val3))..ctor(1.33f, -1.275f, -2.35f);
Vector3 val4 = default(Vector3);
((Vector3)(ref val4))..ctor(-1.33f, -1.275f, -2.35f);
Vector3 position = ((Component)__instance.mainRigidbody).transform.TransformPoint(val);
Vector3 position2 = ((Component)__instance.mainRigidbody).transform.TransformPoint(val2);
Vector3 position3 = ((Component)__instance.mainRigidbody).transform.TransformPoint(val3);
Vector3 position4 = ((Component)__instance.mainRigidbody).transform.TransformPoint(val4);
((Component)__instance.FrontLeftWheel).transform.position = position;
((Component)__instance.FrontRightWheel).transform.position = position2;
((Component)__instance.BackLeftWheel).transform.position = position3;
((Component)__instance.BackRightWheel).transform.position = position4;
Vector3 position5 = ((Component)wheelCollider).transform.position;
Vector3 localScale = default(Vector3);
((Vector3)(ref localScale))..ctor(0.95f, 0.95f, 0.95f);
float num = 10f;
Vector3 velocity = __instance.mainRigidbody.velocity;
float magnitude = ((Vector3)(ref velocity)).magnitude;
float num2 = Mathf.Sign(Vector3.Dot(velocity, ((Component)__instance).transform.forward));
float num3 = num2 * magnitude;
float num4 = 1f;
float num5 = Mathf.Round(num3 * num4) / num4;
float num6 = num5 / num;
float num7 = __instance.steeringWheelAnimFloat * 50f;
Vector3 up = ((Component)wheelCollider).transform.up;
wheelCollider.radius = 0.7275f;
if (Physics.Raycast(position5, -up, ref __instance.hit, wheelCollider.suspensionDistance + wheelCollider.radius, 2304))
{
((Component)wheelMesh).transform.position = ((RaycastHit)(ref __instance.hit)).point + up * wheelCollider.radius;
}
else
{
((Component)wheelMesh).transform.position = position5 - up * wheelCollider.suspensionDistance;
}
((Component)wheelMesh).transform.localScale = localScale;
Quaternion localRotation;
if ((Object)(object)wheelMesh == (Object)(object)__instance.leftWheelMesh)
{
((Component)__instance.leftWheelMesh).transform.rotation = ((Component)__instance.backLeftWheelMesh).transform.rotation;
localRotation = ((Component)__instance.leftWheelMesh).transform.localRotation;
Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles;
((Component)__instance.leftWheelMesh).transform.localRotation = Quaternion.Euler(eulerAngles.x, eulerAngles.y + num7, eulerAngles.z);
}
else if ((Object)(object)wheelMesh == (Object)(object)__instance.rightWheelMesh)
{
((Component)__instance.rightWheelMesh).transform.rotation = ((Component)__instance.backRightWheelMesh).transform.rotation;
localRotation = ((Component)__instance.rightWheelMesh).transform.localRotation;
Vector3 eulerAngles2 = ((Quaternion)(ref localRotation)).eulerAngles;
((Component)__instance.rightWheelMesh).transform.localRotation = Quaternion.Euler(eulerAngles2.x, eulerAngles2.y + num7, eulerAngles2.z);
}
else if ((Object)(object)wheelMesh == (Object)(object)__instance.backLeftWheelMesh)
{
((Component)__instance.backLeftWheelMesh).transform.Rotate(Vector3.right, num6, (Space)1);
}
else if ((Object)(object)wheelMesh == (Object)(object)__instance.backRightWheelMesh)
{
((Component)__instance.backRightWheelMesh).transform.Rotate(Vector3.right, num6, (Space)1);
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "VehicleController_scPatch";
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace Scandal.PatchesNeat.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}