Decompiled source of InfiniteRange v1.0.0

InfiniteRange.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
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("fast mode")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("fast mode")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("23915abe-6f1c-459d-a0cf-3186c630fe84")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.kimo.unlimitedrange", "Unlimited Range + Scroll", "1.3.0")]
public class UnlimitedRangeMod : BaseUnityPlugin
{
	[HarmonyPatch(typeof(PhysGrabber))]
	internal static class PhysGrabberPatches
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Update_Postfix(PhysGrabber __instance)
		{
			__instance.grabRange = currentRange;
			float num = currentRange * 0.85f;
			__instance.maxDistanceFromPlayer = Mathf.Clamp(num, __instance.minDistanceFromPlayer, currentRange);
		}

		[HarmonyPatch("RayCheck")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> RayCheck_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			bool flag = false;
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (!flag && val.opcode == OpCodes.Ldc_R4 && val.operand is float num && Mathf.Approximately(num, 10f))
				{
					list[i] = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(UnlimitedRangeMod), "GetCurrentRange", (Type[])null, (Type[])null));
					flag = true;
				}
			}
			if (!flag)
			{
				staticLogger.LogWarning((object)"Could not patch RayCheck constant!");
			}
			return list;
		}
	}

	public static ConfigEntry<bool> Enabled;

	public static ConfigEntry<float> ScrollSensitivity;

	private static float currentRange = 99999f;

	private static ManualLogSource staticLogger;

	private Harmony harmony;

	private void Awake()
	{
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Enabled", true, "تفعيل Unlimited Range");
		ScrollSensitivity = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Scroll Sensitivity", 12000f, "حساسية عجلة الماوس");
		staticLogger = ((BaseUnityPlugin)this).Logger;
		staticLogger.LogInfo((object)"Unlimited Range Mod Loaded with Scroll Control");
		harmony = new Harmony("com.kimo.unlimitedrange");
		harmony.PatchAll();
	}

	private void Update()
	{
		if (!Enabled.Value)
		{
			return;
		}
		float axis = Input.GetAxis("Mouse ScrollWheel");
		if (axis != 0f)
		{
			currentRange += axis * ScrollSensitivity.Value;
			currentRange = Mathf.Max(50f, currentRange);
			if (axis > 0f)
			{
				staticLogger.LogInfo((object)$"[Range ↑] {currentRange:F0}");
			}
			else
			{
				staticLogger.LogInfo((object)$"[Range ↓] {currentRange:F0}");
			}
		}
	}

	private static float GetCurrentRange()
	{
		return currentRange;
	}

	private void OnDestroy()
	{
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchSelf();
		}
	}
}