Decompiled source of TurnThatGuitarOff v1.0.0

GDWeave/mods/ZephiaLux.TurnThatGuitarOff/ZephiaLux.TurnThatGuitarOff.dll

Decompiled 5 hours 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 GDWeave;
using GDWeave.Godot;
using GDWeave.Godot.Variants;
using GDWeave.Modding;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("ZephiaLux.TurnThatGuitarOff")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ZephiaLux.TurnThatGuitarOff")]
[assembly: AssemblyTitle("ZephiaLux.TurnThatGuitarOff")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace ZephiaLux.TurnThatGuitarOff;

public class Mod : IMod, global::System.IDisposable
{
	public Mod(IModInterface modInterface)
	{
		modInterface.Logger.Information("TURN THAT GUITAR OFF");
		modInterface.RegisterScriptMod((IScriptMod)(object)new PlayerPatcher());
	}

	public void Dispose()
	{
	}
}
internal class PlayerPatcher : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__1 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private Token <>2__current;

		private int <>l__initialThreadId;

		private global::System.Collections.Generic.IEnumerable<Token> tokens;

		public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

		private MultiTokenWaiter <func_waiter>5__2;

		private MultiTokenWaiter <index_waiter>5__3;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap3;

		private Token <token>5__5;

		Token global::System.Collections.Generic.IEnumerator<Token>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

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

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

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || (uint)(num - 1) <= 2u)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
		}

		private bool MoveNext()
		{
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<func_waiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[2]
					{
						(Token t) => (int)t.Type == 48,
						delegate(Token t)
						{
							IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val4 != null && val4.Name == "_play_at_point";
						}
					}, false, false);
					<index_waiter>5__3 = new MultiTokenWaiter(new Func<Token, bool>[4]
					{
						(Token t) => (int)t.Type == 59,
						delegate(Token t)
						{
							IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val3 != null && val3.Name == "index";
						},
						(Token t) => (int)t.Type == 23,
						delegate(Token t)
						{
							ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							if (val != null)
							{
								Variant value = val.Value;
								IntVariant val2 = (IntVariant)(object)((value is IntVariant) ? value : null);
								if (val2 != null)
								{
									return val2.Value == 0;
								}
							}
							return false;
						}
					}, false, false);
					<>7__wrap3 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					if (<index_waiter>5__3.Matched)
					{
						break;
					}
					if (<func_waiter>5__2.Matched)
					{
						if (<index_waiter>5__3.Check(<token>5__5))
						{
							<>2__current = new Token((TokenType)89, (uint?)1u);
							<>1__state = 2;
							return true;
						}
					}
					else
					{
						<func_waiter>5__2.Check(<token>5__5);
					}
					goto IL_0201;
				case 2:
					<>1__state = -3;
					<>2__current = new Token((TokenType)46, (uint?)null);
					<>1__state = 3;
					return true;
				case 3:
					{
						<>1__state = -3;
						goto IL_0201;
					}
					IL_0201:
					<token>5__5 = null;
					break;
				}
				if (((global::System.Collections.IEnumerator)<>7__wrap3).MoveNext())
				{
					<token>5__5 = <>7__wrap3.Current;
					<>2__current = <token>5__5;
					<>1__state = 1;
					return true;
				}
				<>m__Finally1();
				<>7__wrap3 = null;
				return false;
			}
			catch
			{
				//try-fault
				((global::System.IDisposable)this).Dispose();
				throw;
			}
		}

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

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>7__wrap3 != null)
			{
				((global::System.IDisposable)<>7__wrap3).Dispose();
			}
		}

		[DebuggerHidden]
		void global::System.Collections.IEnumerator.Reset()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
		{
			<Modify>d__1 <Modify>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Modify>d__ = this;
			}
			else
			{
				<Modify>d__ = new <Modify>d__1(0);
			}
			<Modify>d__.tokens = <>3__tokens;
			return <Modify>d__;
		}

		[DebuggerHidden]
		global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
		{
			return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
		}
	}

	public bool ShouldRun(string path)
	{
		return path == "res://Scenes/Entities/Player/guitar_string_sound.gdc";
	}

	[IteratorStateMachine(typeof(<Modify>d__1))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter func_waiter = new MultiTokenWaiter(new Func<Token, bool>[2]
		{
			(Token t) => (int)t.Type == 48,
			delegate(Token t)
			{
				IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val4 != null && val4.Name == "_play_at_point";
			}
		}, false, false);
		MultiTokenWaiter index_waiter = new MultiTokenWaiter(new Func<Token, bool>[4]
		{
			(Token t) => (int)t.Type == 59,
			delegate(Token t)
			{
				IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val3 != null && val3.Name == "index";
			},
			(Token t) => (int)t.Type == 23,
			delegate(Token t)
			{
				ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				if (val != null)
				{
					Variant value = val.Value;
					IntVariant val2 = (IntVariant)(object)((value is IntVariant) ? value : null);
					if (val2 != null)
					{
						return val2.Value == 0;
					}
				}
				return false;
			}
		}, false, false);
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token token = enumerator.Current;
				yield return token;
				if (index_waiter.Matched)
				{
					continue;
				}
				if (func_waiter.Matched)
				{
					if (index_waiter.Check(token))
					{
						yield return new Token((TokenType)89, (uint?)1u);
						yield return new Token((TokenType)46, (uint?)null);
					}
				}
				else
				{
					func_waiter.Check(token);
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
	}
}