Decompiled source of RepoUtilityMaster v1.0.0

RepoSpeedMod_CS.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RepoSpeedMod_CS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RepoSpeedMod_CS")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fd7a9fdf-6d8e-49a3-9739-d9ea0caa8346")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RepoSpeedMod;

[BepInPlugin("com.yourname.speedmod", "Master Utility Mod", "3.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static bool IsCrouching;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Expected O, but got Unknown
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Expected O, but got Unknown
		Harmony val = new Harmony("com.yourname.speedmod");
		val.Patch((MethodBase)AccessTools.Method("PlayerController:Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(MovementPatch), "Postfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method("FlashlightController:Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(FlashlightPatch), "Postfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		string[] array = new string[4] { "FlashlightTilt", "FlashlightBob", "FlashlightSprint", "FlashlightLightAim" };
		string[] array2 = array;
		foreach (string text in array2)
		{
			MethodInfo methodInfo = AccessTools.Method(text + ":Update", (Type[])null, (Type[])null);
			if (methodInfo != null)
			{
				val.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(FlashlightPatch), "FreezePrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"QC PASS: v3.0.0 GOLD MASTER. Speed, FOV, and Flashlight Stabilized.");
	}
}
public class MovementPatch
{
	public static void Postfix(object __instance)
	{
		Traverse val = Traverse.Create(__instance);
		val.Field("MoveSpeed").SetValue((object)3.5f);
		val.Field("SprintSpeed").SetValue((object)5.5f);
	}
}
public class FlashlightPatch
{
	private static Vector3 lastModdedPos;

	private static Quaternion lastModdedRot;

	private static float transitionTimer;

	public static bool FreezePrefix()
	{
		return !Plugin.IsCrouching;
	}

	public static void Postfix(object __instance)
	{
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: 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_0226: 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_0118: Unknown result type (might be due to invalid IL or missing references)
		if (__instance == null)
		{
			return;
		}
		Traverse val = Traverse.Create(__instance);
		Traverse val2 = val.Field("PlayerAvatar");
		if (!val2.FieldExists())
		{
			val2 = val.Property("PlayerAvatar", (object[])null);
		}
		if (val2.GetValue() == null)
		{
			return;
		}
		bool value = val2.Field("isCrouching").GetValue<bool>();
		Transform value2 = val.Property("transform", (object[])null).GetValue<Transform>();
		GameObject value3 = val.Property("gameObject", (object[])null).GetValue<GameObject>();
		if (value)
		{
			Plugin.IsCrouching = true;
			transitionTimer = 0.15f;
			if ((Object)(object)value3 != (Object)null && !value3.activeSelf)
			{
				value3.SetActive(true);
			}
			Component val3 = ((value3 != null) ? value3.GetComponent("Animator") : null);
			if ((Object)(object)val3 != (Object)null)
			{
				Traverse.Create((object)val3).Property("enabled", (object[])null).SetValue((object)false);
			}
			value2.localPosition = lastModdedPos;
			value2.localRotation = lastModdedRot;
			val.Field("active").SetValue((object)true);
			val.Field("LightActive").SetValue((object)true);
			val.Field("hiddenScale").SetValue((object)1f);
			val.Field("currentState").SetValue((object)0);
			object value4 = val.Field("spotlight").GetValue();
			if (value4 != null)
			{
				Traverse val4 = Traverse.Create(value4);
				val4.Property("enabled", (object[])null).SetValue((object)true);
				val4.Property("intensity", (object[])null).SetValue((object)1f);
			}
			return;
		}
		Plugin.IsCrouching = false;
		if (transitionTimer > 0f)
		{
			transitionTimer -= Time.deltaTime;
			return;
		}
		lastModdedPos = value2.localPosition;
		lastModdedRot = value2.localRotation;
		Component val5 = ((value3 != null) ? value3.GetComponent("Animator") : null);
		if ((Object)(object)val5 != (Object)null)
		{
			Traverse.Create((object)val5).Property("enabled", (object[])null).SetValue((object)true);
		}
	}
}