Decompiled source of LieButton v1.0.4

LieButton.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using InControl;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LieButton")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LieButton")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f48cad57-8565-4b0b-900c-a3c9536af0f8")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.4.0")]
[BepInPlugin("org.sealofapproval.liebuttonmod", "lie Button Mod", "1.0.4")]
public class LieButton : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <TriggerLieDown>d__8 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public LieButton <>4__this;

		private HeroController <heroController>5__2;

		private HeroAnimationController <heroAnim>5__3;

		private float <clipLength>5__4;

		private tk2dSpriteAnimationClip <clip>5__5;

		private float <clipLength1>5__6;

		private tk2dSpriteAnimationClip <clip1>5__7;

		private float <maxTime>5__8;

		private float <elapsed>5__9;

		private float <clipLength2>5__10;

		private tk2dSpriteAnimationClip <clip2>5__11;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<heroController>5__2 = null;
			<heroAnim>5__3 = null;
			<clip>5__5 = null;
			<clip1>5__7 = null;
			<clip2>5__11 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			LieButton lieButton = <>4__this;
			HeroActions inputActions;
			KeyCode result;
			switch (num)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				lieButton.isCoroutineRunning = true;
				<heroController>5__2 = HeroController.instance;
				<heroAnim>5__3 = ((Component)<heroController>5__2).GetComponent<HeroAnimationController>();
				<heroController>5__2.IgnoreInput();
				<heroController>5__2.StopAnimationControl();
				<heroController>5__2.controlReqlinquished = true;
				<clipLength>5__4 = <heroAnim>5__3.GetClipDuration(lieButton.animKneel);
				<heroAnim>5__3.PlayClipForced(lieButton.animKneel);
				<clip>5__5 = <heroAnim>5__3.animator.CurrentClip;
				goto IL_00e7;
			case 1:
				<>1__state = -1;
				<clipLength>5__4 -= Time.deltaTime;
				goto IL_00e7;
			case 2:
				<>1__state = -1;
				<clipLength1>5__6 -= Time.deltaTime;
				goto IL_0175;
			case 3:
				<>1__state = -1;
				goto IL_03dd;
			case 4:
				<>1__state = -1;
				<clipLength2>5__10 -= Time.deltaTime;
				goto IL_02ec;
			case 5:
				<>1__state = -1;
				<clipLength2>5__10 -= Time.deltaTime;
				goto IL_038d;
			case 6:
				{
					<>1__state = -1;
					goto IL_03dd;
				}
				IL_03dd:
				if (!(<elapsed>5__9 < <maxTime>5__8))
				{
					break;
				}
				if (<heroAnim>5__3.animator.IsPlaying("Stun"))
				{
					<heroController>5__2.AcceptInput();
					<heroController>5__2.controlReqlinquished = false;
					<heroController>5__2.StartAnimationControl();
					lieButton.isCoroutineRunning = false;
					break;
				}
				inputActions = ManagerSingleton<InputHandler>.Instance.inputActions;
				if (Enum.TryParse<KeyCode>(lieButton.lieButton.Value, ignoreCase: false, out result))
				{
					if (lieButton.wakeAtkJump.Value == "true")
					{
						if (Input.GetKeyDown(result) || ((OneAxisInputControl)inputActions.Jump).WasPressed || ((OneAxisInputControl)inputActions.Attack).WasPressed)
						{
							<clipLength2>5__10 = <heroAnim>5__3.GetClipDuration(lieButton.animWake);
							<heroAnim>5__3.PlayClipForced(lieButton.animWake);
							<clip2>5__11 = <heroAnim>5__3.animator.CurrentClip;
							goto IL_02ec;
						}
					}
					else if (Input.GetKeyDown(result))
					{
						<clipLength2>5__10 = <heroAnim>5__3.GetClipDuration(lieButton.animWake);
						<heroAnim>5__3.PlayClipForced(lieButton.animWake);
						<clip2>5__11 = <heroAnim>5__3.animator.CurrentClip;
						goto IL_038d;
					}
				}
				<elapsed>5__9 += Time.deltaTime;
				<>2__current = null;
				<>1__state = 6;
				return true;
				IL_02ec:
				if (<heroAnim>5__3.animator.IsPlaying(<clip2>5__11) && <clipLength2>5__10 > 0f)
				{
					<>2__current = null;
					<>1__state = 4;
					return true;
				}
				break;
				IL_00e7:
				if (<heroAnim>5__3.animator.IsPlaying(<clip>5__5) && <clipLength>5__4 > 0f)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<clipLength1>5__6 = <heroAnim>5__3.GetClipDuration(lieButton.animFall);
				<heroAnim>5__3.PlayClipForced(lieButton.animFall);
				<clip1>5__7 = <heroAnim>5__3.animator.CurrentClip;
				goto IL_0175;
				IL_038d:
				if (<heroAnim>5__3.animator.IsPlaying(<clip2>5__11) && <clipLength2>5__10 > 0f)
				{
					<>2__current = null;
					<>1__state = 5;
					return true;
				}
				break;
				IL_0175:
				if (<heroAnim>5__3.animator.IsPlaying(<clip1>5__7) && <clipLength1>5__6 > 0f)
				{
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				<heroAnim>5__3.PlayClipForced("Prostrate");
				<maxTime>5__8 = 99999f;
				<elapsed>5__9 = 0f;
				<>2__current = null;
				<>1__state = 3;
				return true;
			}
			<heroController>5__2.AcceptInput();
			<heroController>5__2.controlReqlinquished = false;
			<heroController>5__2.StartAnimationControl();
			lieButton.isCoroutineRunning = false;
			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();
		}
	}

	private ConfigEntry<string> lieButton;

	private ConfigEntry<string> wakeAtkJump;

	private bool isCoroutineRunning;

	private string animKneel = "Collect Normal 1";

	private string animWake = "Prostrate Rise";

	private string animFall = "Kneel To Prostrate";

	protected LieButton()
	{
		lieButton = ((BaseUnityPlugin)this).Config.Bind<string>("General", "lieButton", "L", "Changes the button for lying down.");
		wakeAtkJump = ((BaseUnityPlugin)this).Config.Bind<string>("General", "wakeOnAttackOrJump", "false", "Wake up upon pressing 'Attack' or 'Jump'? true/false.");
	}

	private void Update()
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		HeroController instance = HeroController.instance;
		if ((Object)(object)instance == (Object)null)
		{
			return;
		}
		HeroControllerStates cState = instance.cState;
		if (Enum.TryParse<KeyCode>(lieButton.Value, ignoreCase: false, out KeyCode result))
		{
			HeroAnimationController component = ((Component)instance).GetComponent<HeroAnimationController>();
			if (Input.GetKeyDown(result) && !instance.controlReqlinquished && !isCoroutineRunning && !cState.transitioning && (component.animator.IsPlaying("Idle") || component.animator.IsPlaying("Idle Hurt") || component.animator.IsPlaying("LookDown") || component.animator.IsPlaying("LookDown Windy") || component.animator.IsPlaying("Hurt Look Up") || component.animator.IsPlaying("Hurt Look Up Windy") || component.animator.IsPlaying("Hurt Look Down") || component.animator.IsPlaying("Hurt Look Down Windy") || component.animator.IsPlaying("Idle Hurt Windy") || component.animator.IsPlaying("LookDown Updraft") || component.animator.IsPlaying("LookUp") || component.animator.IsPlaying("LookUp Updraft") || component.animator.IsPlaying("Look Up Half End") || component.animator.IsPlaying("LookDown Slight End") || component.animator.IsPlaying("LookUp Slight End") || component.animator.IsPlaying("Idle Rest") || component.animator.IsPlaying("Land") || component.animator.IsPlaying("Look Down Half End") || component.animator.IsPlaying("LookUp Windy") || component.animator.IsPlaying("Hurt Look Down Windy End") || component.animator.IsPlaying("HardLand") || component.animator.IsPlaying("Hurt Look Up Windy End") || component.animator.IsPlaying("Hurt Look Down End") || component.animator.IsPlaying("Hurt Look Up End") || component.animator.IsPlaying("Rage Idle") || component.animator.IsPlaying("Rage Idle End") || component.animator.IsPlaying("LookUpEnd Windy") || component.animator.IsPlaying("LookUpEnd") || component.animator.IsPlaying("LookUpEnd Updraft") || component.animator.IsPlaying("LookDownEnd") || component.animator.IsPlaying("LookDownEnd Windy") || component.animator.IsPlaying("LookDownEnd Updraft") || component.animator.IsPlaying("Idle Updraft") || component.animator.IsPlaying("Dash Down Land") || component.animator.IsPlaying("Idle Windy")))
			{
				((MonoBehaviour)this).StartCoroutine(TriggerLieDown());
			}
		}
		else
		{
			Debug.LogError((object)("Can not parse key=" + lieButton.Value));
		}
	}

	[IteratorStateMachine(typeof(<TriggerLieDown>d__8))]
	private IEnumerator TriggerLieDown()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <TriggerLieDown>d__8(0)
		{
			<>4__this = this
		};
	}
}