Decompiled source of FasterFlight v1.1.0

FasterFlight.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using ULTRAKILL.Cheats;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FasterFlight")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Allows you to edit how fast the Flight/Noclip cheats are.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+232ed007a71e71b71d08f712963f5f3b47f46a02")]
[assembly: AssemblyProduct("FasterFlight")]
[assembly: AssemblyTitle("FasterFlight")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 FasterFlight
{
	[HarmonyPatch]
	public static class Patches
	{
		[CompilerGenerated]
		private sealed class <FlightTranspiler>d__2 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private string regularSpeedFieldName;

			public string <>3__regularSpeedFieldName;

			private string boostSpeedFieldName;

			public string <>3__boostSpeedFieldName;

			private MethodInfo <get_instance>5__1;

			private MethodInfo <get_value>5__2;

			private int <floatCount>5__3;

			private IEnumerator<CodeInstruction> <>s__4;

			private CodeInstruction <instruction>5__5;

			CodeInstruction IEnumerator<CodeInstruction>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FlightTranspiler>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 3u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<get_instance>5__1 = null;
				<get_value>5__2 = null;
				<>s__4 = null;
				<instruction>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0179: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: Expected O, but got Unknown
				//IL_014d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0157: Expected O, but got Unknown
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<get_instance>5__1 = AccessTools.PropertyGetter(typeof(Plugin), "Instance");
						<get_value>5__2 = AccessTools.PropertyGetter(typeof(FloatField), "value");
						<floatCount>5__3 = 0;
						<>s__4 = instructions.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<>2__current = new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(Plugin), (<floatCount>5__3 == 1) ? regularSpeedFieldName : boostSpeedFieldName));
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -3;
						<>2__current = new CodeInstruction(OpCodes.Callvirt, (object)<get_value>5__2);
						<>1__state = 3;
						return true;
					case 3:
						<>1__state = -3;
						break;
					case 4:
						<>1__state = -3;
						<instruction>5__5 = null;
						break;
					}
					if (<>s__4.MoveNext())
					{
						<instruction>5__5 = <>s__4.Current;
						if (<instruction>5__5.opcode == OpCodes.Ldc_R4)
						{
							<floatCount>5__3++;
							if (<floatCount>5__3 <= 2)
							{
								<>2__current = new CodeInstruction(OpCodes.Callvirt, (object)<get_instance>5__1);
								<>1__state = 1;
								return true;
							}
						}
						<>2__current = <instruction>5__5;
						<>1__state = 4;
						return true;
					}
					<>m__Finally1();
					<>s__4 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>s__4 != null)
				{
					<>s__4.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<FlightTranspiler>d__2 <FlightTranspiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<FlightTranspiler>d__ = this;
				}
				else
				{
					<FlightTranspiler>d__ = new <FlightTranspiler>d__2(0);
				}
				<FlightTranspiler>d__.instructions = <>3__instructions;
				<FlightTranspiler>d__.regularSpeedFieldName = <>3__regularSpeedFieldName;
				<FlightTranspiler>d__.boostSpeedFieldName = <>3__boostSpeedFieldName;
				return <FlightTranspiler>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(Flight), "Update")]
		public static IEnumerable<CodeInstruction> FlightTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			return FlightTranspiler(instructions, "flightSpeed", "flightWeeeeSpeed");
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(Noclip), "UpdateTick")]
		public static IEnumerable<CodeInstruction> NoclipTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			return FlightTranspiler(instructions, "noclipSpeed", "noclipWeeeeSpeed");
		}

		[IteratorStateMachine(typeof(<FlightTranspiler>d__2))]
		public static IEnumerable<CodeInstruction> FlightTranspiler(IEnumerable<CodeInstruction> instructions, string regularSpeedFieldName, string boostSpeedFieldName)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FlightTranspiler>d__2(-2)
			{
				<>3__instructions = instructions,
				<>3__regularSpeedFieldName = regularSpeedFieldName,
				<>3__boostSpeedFieldName = boostSpeedFieldName
			};
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Bryan_-000-.FasterFlightmeowmrrprawr", "FasterFlight", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		public PluginConfigurator config;

		public FloatField flightSpeed;

		public FloatField flightWeeeeSpeed;

		public FloatField noclipSpeed;

		public FloatField noclipWeeeeSpeed;

		public static Plugin Instance { get; internal set; }

		public void Awake()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			LoadConfig();
			new Harmony("Bryan_-000-.FasterFlightmeowmrrprawr").PatchAll(((object)this).GetType().Assembly);
		}

		public void LoadConfig()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			config = PluginConfigurator.Create("FasterFlight", "Bryan_-000-.FasterFlightmeowmrrprawr");
			config.SetIconWithURL(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icon.png"));
			config.presetButtonHidden = true;
			ConfigDivision val = new ConfigDivision(config.rootPanel, "Flight");
			flightSpeed = new FloatField((ConfigPanel)(object)val, "Regular Flight speed", "meowmeowmeow mrrrp miaaow rawwrr :3", 1f);
			flightWeeeeSpeed = new FloatField((ConfigPanel)(object)val, "Boost Flight speed", "meow - tequilla", 2.5f);
			ConfigDivision val2 = new ConfigDivision(config.rootPanel, "Noclip");
			noclipSpeed = new FloatField((ConfigPanel)(object)val2, "Regular Noclip speed", "imhonestlytoolazytoputanythingfunnyhere", 1f);
			noclipWeeeeSpeed = new FloatField((ConfigPanel)(object)val2, "Boost Noclip speed", "rawr2.2", 2.5f);
		}
	}
	public class PluginInfo
	{
		public const string GUID = "Bryan_-000-.FasterFlightmeowmrrprawr";

		public const string Name = "FasterFlight";

		public const string Version = "1.0.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}