Decompiled source of NeverFailFlip v1.0.0

Plugins/com.ara22.neverfailbackflip.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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: AssemblyCompany("com.ara22.neverfailbackflip")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("com.ara22.neverfailbackflip")]
[assembly: AssemblyTitle("NeverFaiFlip")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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.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;
		}
	}
}
[BepInPlugin("com.ara22.neverfailflip", "NeverFailflip", "1.2.0")]
public class BackflipMasterPlugin : BaseUnityPlugin
{
	public static BackflipMasterPlugin Instance;

	private void Awake()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		Instance = this;
		new Harmony("com.ara22.neverfailflip").PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"NeverFailflip v1.2.0:Loaded.");
	}
}
[HarmonyPatch(typeof(CharacterAnimations), "BackflipRoutine")]
public static class BackflipSuccessPatch
{
	[CompilerGenerated]
	private sealed class <CustomBackflipRoutine>d__1 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public CharacterAnimations anims;

		private FieldInfo <characterField>5__1;

		private Character <character>5__2;

		private Bodypart <hip>5__3;

		private Vector3 <forceVec>5__4;

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

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

		[DebuggerHidden]
		public <CustomBackflipRoutine>d__1(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<characterField>5__1 = null;
			<character>5__2 = null;
			<hip>5__3 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<characterField>5__1 = typeof(CharacterAnimations).GetField("character", BindingFlags.Instance | BindingFlags.NonPublic);
				if (<characterField>5__1 == null)
				{
					return false;
				}
				<character>5__2 = (Character)<characterField>5__1.GetValue(anims);
				if ((Object)(object)<character>5__2 == (Object)null)
				{
					return false;
				}
				<>2__current = (object)new WaitForSeconds(0.35f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (<character>5__2.IsLocal)
				{
					<hip>5__3 = <character>5__2.GetBodypart((BodypartType)0);
					if ((Object)(object)<hip>5__3 != (Object)null)
					{
						<forceVec>5__4 = -((Component)<hip>5__3).transform.forward;
						<forceVec>5__4.y = 0f;
						<character>5__2.AddForceAtPosition((((Vector3)(ref <forceVec>5__4)).normalized + Vector3.up) * 200f, ((Component)<hip>5__3).transform.position, 5f);
					}
					<hip>5__3 = null;
				}
				<>2__current = (object)new WaitForSeconds(0.15f);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				return false;
			}
		}

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

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

	[HarmonyPrefix]
	public static bool Prefix(CharacterAnimations __instance, ref IEnumerator __result)
	{
		__result = CustomBackflipRoutine(__instance);
		return false;
	}

	[IteratorStateMachine(typeof(<CustomBackflipRoutine>d__1))]
	private static IEnumerator CustomBackflipRoutine(CharacterAnimations anims)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CustomBackflipRoutine>d__1(0)
		{
			anims = anims
		};
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}