Decompiled source of SizeUnlocker v1.0.1

GDWeave/mods/SizeUnlocker/SizeUnlocker.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.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("SizeUnlocker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+361efb388420ced9d769ecbc770c55e544a918ba")]
[assembly: AssemblyProduct("SizeUnlocker")]
[assembly: AssemblyTitle("SizeUnlocker")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace SizeUnlocker;

public class Mod : IMod, global::System.IDisposable
{
	public Mod(IModInterface modInterface)
	{
		modInterface.RegisterScriptMod((IScriptMod)(object)new PlayerScriptMod());
	}

	public void Dispose()
	{
	}
}
internal class PlayerScriptMod : 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 string path;

		public string <>3__path;

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

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

		public PlayerScriptMod <>4__this;

		private MultiTokenWaiter <firstClamp>5__1;

		private MultiTokenWaiter <secondClamp>5__2;

		private int <skip>5__3;

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

		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) > 6u)
			{
				return;
			}
			try
			{
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_0428: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Expected O, but got Unknown
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Expected O, but got Unknown
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Expected O, but got Unknown
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Expected O, but got Unknown
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_0512: Expected O, but got Unknown
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Expected O, but got Unknown
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Expected O, but got Unknown
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Expected O, but got Unknown
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Expected O, but got Unknown
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Expected O, but got Unknown
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Expected O, but got Unknown
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<firstClamp>5__1 = new MultiTokenWaiter(new Func<Token, bool>[10]
					{
						delegate(Token t)
						{
							IdentifierToken val5 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val5 != null && val5.Name == "scale";
						},
						(Token t) => (int)t.Type == 23,
						(Token t) => (int)t.Type == 5,
						(Token t) => (int)t.Type == 80,
						delegate(Token t)
						{
							IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val4 != null && val4.Name == "animation_data";
						},
						(Token t) => (int)t.Type == 76,
						(Token t) => (int)t.Type == 2,
						(Token t) => (int)t.Type == 77,
						(Token t) => (int)t.Type == 82,
						(Token t) => (int)t.Type == 2
					}, false, false);
					<secondClamp>5__2 = new MultiTokenWaiter(new Func<Token, bool>[12]
					{
						delegate(Token t)
						{
							IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val3 != null && val3.Name == "scale";
						},
						(Token t) => (int)t.Type == 84,
						delegate(Token t)
						{
							IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val2 != null && val2.Name == "y";
						},
						(Token t) => (int)t.Type == 26,
						(Token t) => (int)t.Type == 5,
						(Token t) => (int)t.Type == 80,
						delegate(Token t)
						{
							IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val != null && val.Name == "animation_data";
						},
						(Token t) => (int)t.Type == 76,
						(Token t) => (int)t.Type == 2,
						(Token t) => (int)t.Type == 77,
						(Token t) => (int)t.Type == 82,
						(Token t) => (int)t.Type == 2
					}, false, false);
					<skip>5__3 = 0;
					<>s__4 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					<>2__current = new Token((TokenType)82, (uint?)null);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -3;
					<>2__current = (Token)new ConstantToken((Variant)new RealVariant(10.0, false));
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -3;
					<skip>5__3 = 2;
					goto IL_0555;
				case 4:
					<>1__state = -3;
					<>2__current = new Token((TokenType)82, (uint?)null);
					<>1__state = 5;
					return true;
				case 5:
					<>1__state = -3;
					<>2__current = (Token)new ConstantToken((Variant)new RealVariant(10.0, false));
					<>1__state = 6;
					return true;
				case 6:
					<>1__state = -3;
					<skip>5__3 = 2;
					goto IL_0555;
				case 7:
					{
						<>1__state = -3;
						goto IL_0555;
					}
					IL_0555:
					<token>5__5 = null;
					break;
				}
				while (((global::System.Collections.IEnumerator)<>s__4).MoveNext())
				{
					<token>5__5 = <>s__4.Current;
					if (<skip>5__3-- > 0)
					{
						continue;
					}
					if (<firstClamp>5__1.Check(<token>5__5))
					{
						<>2__current = (Token)new ConstantToken((Variant)new RealVariant(-2.0, false));
						<>1__state = 1;
						return true;
					}
					if (<secondClamp>5__2.Check(<token>5__5))
					{
						<>2__current = (Token)new ConstantToken((Variant)new RealVariant(-2.0, false));
						<>1__state = 4;
						return true;
					}
					<>2__current = <token>5__5;
					<>1__state = 7;
					return true;
				}
				<>m__Finally1();
				<>s__4 = 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 (<>s__4 != null)
			{
				((global::System.IDisposable)<>s__4).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)
				{
					<>4__this = <>4__this
				};
			}
			<Modify>d__.path = <>3__path;
			<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/player.gdc";
	}

	[IteratorStateMachine(typeof(<Modify>d__1))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter firstClamp = new MultiTokenWaiter(new Func<Token, bool>[10]
		{
			delegate(Token t)
			{
				IdentifierToken val5 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val5 != null && val5.Name == "scale";
			},
			(Token t) => (int)t.Type == 23,
			(Token t) => (int)t.Type == 5,
			(Token t) => (int)t.Type == 80,
			delegate(Token t)
			{
				IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val4 != null && val4.Name == "animation_data";
			},
			(Token t) => (int)t.Type == 76,
			(Token t) => (int)t.Type == 2,
			(Token t) => (int)t.Type == 77,
			(Token t) => (int)t.Type == 82,
			(Token t) => (int)t.Type == 2
		}, false, false);
		MultiTokenWaiter secondClamp = new MultiTokenWaiter(new Func<Token, bool>[12]
		{
			delegate(Token t)
			{
				IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val3 != null && val3.Name == "scale";
			},
			(Token t) => (int)t.Type == 84,
			delegate(Token t)
			{
				IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val2 != null && val2.Name == "y";
			},
			(Token t) => (int)t.Type == 26,
			(Token t) => (int)t.Type == 5,
			(Token t) => (int)t.Type == 80,
			delegate(Token t)
			{
				IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val != null && val.Name == "animation_data";
			},
			(Token t) => (int)t.Type == 76,
			(Token t) => (int)t.Type == 2,
			(Token t) => (int)t.Type == 77,
			(Token t) => (int)t.Type == 82,
			(Token t) => (int)t.Type == 2
		}, false, false);
		int skip = 0;
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token token = enumerator.Current;
				if (skip-- <= 0)
				{
					if (firstClamp.Check(token))
					{
						yield return (Token)new ConstantToken((Variant)new RealVariant(-2.0, false));
						yield return new Token((TokenType)82, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new RealVariant(10.0, false));
						skip = 2;
					}
					else if (secondClamp.Check(token))
					{
						yield return (Token)new ConstantToken((Variant)new RealVariant(-2.0, false));
						yield return new Token((TokenType)82, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new RealVariant(10.0, false));
						skip = 2;
					}
					else
					{
						yield return token;
					}
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
	}
}