Decompiled source of SpeedTools v1.0.0

com.turtledsr.peakspeedtools.dll

Decompiled 2 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 Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Settings;

[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("com.turtledsr.peakspeedtools")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SpeedTools")]
[assembly: AssemblyTitle("com.turtledsr.peakspeedtools")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace peakspeedtools
{
	[BepInPlugin("com.turtledsr.peakspeedtools", "SpeedTools", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		public enum InputType
		{
			Hold,
			Toggle
		}

		internal static ManualLogSource Logger;

		public static SettingsHandler Settings;

		public static ConfigEntry<bool> ResetConfig;

		public static ConfigEntry<KeyCode> ResetKeybindConfig;

		public static ConfigEntry<bool> FPSConfig;

		public static ConfigEntry<int> FPSMaxConfig;

		public static ConfigEntry<KeyCode> FPSWarpKeyConfig;

		public static ConfigEntry<InputType> FPSWarpInputType;

		public static ConfigEntry<int> FPSWarpConfig;

		private void Awake()
		{
			BindConfigs();
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"SpeedTools v1.0.0 Base Loaded Succesfully!");
		}

		private void Start()
		{
			Settings = SettingsHandler.Instance;
			Logger.LogInfo((object)"Bound to Settings");
		}

		private void BindConfigs()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			ResetConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Reset", "Enabled", true, "Enable Resetting Tools");
			ResetKeybindConfig = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Reset", "Reset Key", (KeyCode)278, "Reset key");
			FPSConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("FPS", "Enabled", true, "Enable FPS Related Tools");
			FPSMaxConfig = ((BaseUnityPlugin)this).Config.Bind<int>("FPS", "Max FPS", 300, new ConfigDescription("Max FPS Overload (Supports [10 to 500])", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 500), Array.Empty<object>()));
			FPSWarpKeyConfig = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("FPS", "Warp Key", (KeyCode)99, "Warp key");
			FPSWarpInputType = ((BaseUnityPlugin)this).Config.Bind<InputType>("FPS", "Warp Key Mode", InputType.Toggle, "Warp Key Mode");
			FPSWarpConfig = ((BaseUnityPlugin)this).Config.Bind<int>("FPS", "Warp FPS", 10, new ConfigDescription("Max FPS Overload (Supports [10 to 500] For While Holding Warp Key)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 500), Array.Empty<object>()));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.turtledsr.peakspeedtools";

		public const string PLUGIN_NAME = "SpeedTools";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace peakspeedtools.include
{
	[BepInPlugin("com.turtledsr.peakspeedtools.fps", "SpeedTools.fps", "0.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Fps : BaseUnityPlugin
	{
		private static FPSCapSetting FPSCap;

		private static bool warping;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SpeedTools.fps Loaded");
		}

		private void Update()
		{
			//IL_00df: 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)
			if (!Main.FPSConfig.Value)
			{
				return;
			}
			if (FPSCap == null)
			{
				if (Main.Settings != null)
				{
					FPSCap = Main.Settings.GetSetting<FPSCapSetting>();
					((object)FPSCap).GetType().GetRuntimeProperty("MinValue").SetValue(FPSCap, 10);
					((object)FPSCap).GetType().GetRuntimeProperty("MaxValue").SetValue(FPSCap, 500);
					((FloatSetting)FPSCap).SetValue((float)Main.FPSMaxConfig.Value, (ISettingHandler)(object)Main.Settings, false);
				}
				return;
			}
			if (Main.FPSWarpInputType.Value == Main.InputType.Hold)
			{
				warping = Input.GetKey(Main.FPSWarpKeyConfig.Value);
			}
			else if (Input.GetKeyDown(Main.FPSWarpKeyConfig.Value))
			{
				warping = !warping;
			}
			if (warping)
			{
				if ((int)((FloatSetting)FPSCap).Value != Main.FPSWarpConfig.Value)
				{
					((FloatSetting)FPSCap).SetValue((float)Main.FPSWarpConfig.Value, (ISettingHandler)(object)Main.Settings, false);
				}
			}
			else if ((int)((FloatSetting)FPSCap).Value != Main.FPSMaxConfig.Value)
			{
				((FloatSetting)FPSCap).SetValue((float)Main.FPSMaxConfig.Value, (ISettingHandler)(object)Main.Settings, false);
			}
		}
	}
	[BepInPlugin("com.turtledsr.peakspeedtools.reset", "SpeedTools.reset", "0.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Reset : BaseUnityPlugin
	{
		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SpeedTools.reset Loaded");
		}

		private void Update()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (Main.ResetConfig.Value && Input.GetKeyDown(Main.ResetKeybindConfig.Value))
			{
				if (TryLoadAirport())
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading airport successfully");
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Could not load airport");
				}
			}
		}

		private bool TryLoadAirport()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			if (name != "Airport" && name != "Title" && name != "Pretitle")
			{
				SceneManager.LoadSceneAsync("Airport");
				return true;
			}
			return false;
		}
	}
}