Decompiled source of UncappedSoda v1.1.0

GDWeave/mods/UncappedSoda.dll

Decompiled 2 weeks 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("UncappedSoda")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b9c9d5992d66ecc1e3e58f575edf62e55a892034")]
[assembly: AssemblyProduct("UncappedSoda")]
[assembly: AssemblyTitle("UncappedSoda")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace UncappedSoda;

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

	public void Dispose()
	{
	}
}
public class PlayerPatch : 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 <growthMatch>5__2;

		private MultiTokenWaiter <shrinkMatch>5__3;

		private TokenConsumer <newlineConsumer>5__4;

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

		private Token <token>5__6;

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

		private bool MoveNext()
		{
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Expected O, but got Unknown
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Expected O, but got Unknown
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Expected O, but got Unknown
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Expected O, but got Unknown
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Expected O, but got Unknown
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Expected O, but got Unknown
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Expected O, but got Unknown
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<growthMatch>5__2 = new MultiTokenWaiter(new Func<Token, bool>[4]
					{
						delegate(Token t)
						{
							ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							if (val5 != null)
							{
								Variant value2 = val5.Value;
								StringVariant val6 = (StringVariant)(object)((value2 is StringVariant) ? value2 : null);
								if (val6 != null)
								{
									return val6.Value == "growth";
								}
							}
							return false;
						},
						(Token t) => (int)t.Type == 86,
						delegate(Token t)
						{
							IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val4 != null && val4.Name == "player_scale";
						},
						(Token t) => (int)t.Type == 23
					}, false, false);
					<shrinkMatch>5__3 = new MultiTokenWaiter(new Func<Token, bool>[4]
					{
						delegate(Token t)
						{
							ConstantToken val2 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							if (val2 != null)
							{
								Variant value = val2.Value;
								StringVariant val3 = (StringVariant)(object)((value is StringVariant) ? value : null);
								if (val3 != null)
								{
									return val3.Value == "shrink";
								}
							}
							return false;
						},
						(Token t) => (int)t.Type == 86,
						delegate(Token t)
						{
							IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val != null && val.Name == "player_scale";
						},
						(Token t) => (int)t.Type == 23
					}, false, false);
					<newlineConsumer>5__4 = new TokenConsumer((Func<Token, bool>)((Token t) => (int)t.Type == 89));
					<>7__wrap4 = tokens.GetEnumerator();
					<>1__state = -3;
					goto IL_03f2;
				case 1:
					<>1__state = -3;
					<newlineConsumer>5__4.Reset();
					goto IL_0226;
				case 2:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("player_scale");
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -3;
					<>2__current = new Token((TokenType)16, (uint?)null);
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -3;
					<>2__current = (Token)new ConstantToken((Variant)new RealVariant(0.1, false));
					<>1__state = 5;
					return true;
				case 5:
					<>1__state = -3;
					<growthMatch>5__2.Reset();
					<newlineConsumer>5__4.SetReady();
					goto IL_03eb;
				case 6:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("player_scale");
					<>1__state = 7;
					return true;
				case 7:
					<>1__state = -3;
					<>2__current = new Token((TokenType)17, (uint?)null);
					<>1__state = 8;
					return true;
				case 8:
					<>1__state = -3;
					<>2__current = (Token)new ConstantToken((Variant)new RealVariant(0.1, false));
					<>1__state = 9;
					return true;
				case 9:
					<>1__state = -3;
					<growthMatch>5__2.Reset();
					<newlineConsumer>5__4.SetReady();
					goto IL_03eb;
				case 10:
					{
						<>1__state = -3;
						goto IL_03eb;
					}
					IL_03eb:
					<token>5__6 = null;
					goto IL_03f2;
					IL_0226:
					if (<growthMatch>5__2.Check(<token>5__6))
					{
						<>2__current = <token>5__6;
						<>1__state = 2;
						return true;
					}
					if (<shrinkMatch>5__3.Check(<token>5__6))
					{
						<>2__current = <token>5__6;
						<>1__state = 6;
						return true;
					}
					<>2__current = <token>5__6;
					<>1__state = 10;
					return true;
					IL_03f2:
					do
					{
						if (((global::System.Collections.IEnumerator)<>7__wrap4).MoveNext())
						{
							<token>5__6 = <>7__wrap4.Current;
							continue;
						}
						<>m__Finally1();
						<>7__wrap4 = null;
						return false;
					}
					while (<newlineConsumer>5__4.Check(<token>5__6));
					if (<newlineConsumer>5__4.Ready)
					{
						<>2__current = <token>5__6;
						<>1__state = 1;
						return true;
					}
					goto IL_0226;
				}
			}
			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__wrap4 != null)
			{
				((global::System.IDisposable)<>7__wrap4).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/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 growthMatch = new MultiTokenWaiter(new Func<Token, bool>[4]
		{
			delegate(Token t)
			{
				ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				if (val5 != null)
				{
					Variant value2 = val5.Value;
					StringVariant val6 = (StringVariant)(object)((value2 is StringVariant) ? value2 : null);
					if (val6 != null)
					{
						return val6.Value == "growth";
					}
				}
				return false;
			},
			(Token t) => (int)t.Type == 86,
			delegate(Token t)
			{
				IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val4 != null && val4.Name == "player_scale";
			},
			(Token t) => (int)t.Type == 23
		}, false, false);
		MultiTokenWaiter shrinkMatch = new MultiTokenWaiter(new Func<Token, bool>[4]
		{
			delegate(Token t)
			{
				ConstantToken val2 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				if (val2 != null)
				{
					Variant value = val2.Value;
					StringVariant val3 = (StringVariant)(object)((value is StringVariant) ? value : null);
					if (val3 != null)
					{
						return val3.Value == "shrink";
					}
				}
				return false;
			},
			(Token t) => (int)t.Type == 86,
			delegate(Token t)
			{
				IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val != null && val.Name == "player_scale";
			},
			(Token t) => (int)t.Type == 23
		}, false, false);
		TokenConsumer newlineConsumer = new TokenConsumer((Func<Token, bool>)((Token t) => (int)t.Type == 89));
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token token = enumerator.Current;
				if (!newlineConsumer.Check(token))
				{
					if (newlineConsumer.Ready)
					{
						yield return token;
						newlineConsumer.Reset();
					}
					if (growthMatch.Check(token))
					{
						yield return token;
						yield return (Token)new IdentifierToken("player_scale");
						yield return new Token((TokenType)16, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new RealVariant(0.1, false));
						growthMatch.Reset();
						newlineConsumer.SetReady();
					}
					else if (shrinkMatch.Check(token))
					{
						yield return token;
						yield return (Token)new IdentifierToken("player_scale");
						yield return new Token((TokenType)17, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new RealVariant(0.1, false));
						growthMatch.Reset();
						newlineConsumer.SetReady();
					}
					else
					{
						yield return token;
					}
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
	}
}