Decompiled source of PoppingBottles v2.0.0

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

public class Mod : IMod, global::System.IDisposable
{
	public Mod(IModInterface modInterface)
	{
		modInterface.Logger.Information("Loaded PoppingBottles!");
		modInterface.RegisterScriptMod((IScriptMod)(object)new Patch());
	}

	public void Dispose()
	{
	}
}
public class Patch : 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 Patch <>4__this;

		private FunctionWaiter <functionWaiter>5__1;

		private MultiTokenWaiter <growthWaiter>5__2;

		private MultiTokenWaiter <shrinkWaiter>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) > 1u)
			{
				return;
			}
			try
			{
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Expected O, but got Unknown
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<functionWaiter>5__1 = new FunctionWaiter("_consume_item", false);
					<growthWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[13]
					{
						delegate(Token t)
						{
							ConstantToken val19 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							int result8;
							if (val19 != null)
							{
								Variant value8 = val19.Value;
								StringVariant val20 = (StringVariant)(object)((value8 is StringVariant) ? value8 : null);
								if (val20 != null)
								{
									result8 = ((val20.Value == "growth") ? 1 : 0);
									goto IL_002c;
								}
							}
							result8 = 0;
							goto IL_002c;
							IL_002c:
							return (byte)result8 != 0;
						},
						(Token t) => (int)t.Type == 86,
						delegate(Token t)
						{
							IdentifierToken val18 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val18 != null && val18.Name == "player_scale";
						},
						(Token t) => (int)t.Type == 23,
						(Token t) => (int)t.Type == 5,
						(Token t) => (int)t.Type == 80,
						delegate(Token t)
						{
							IdentifierToken val17 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val17 != null && val17.Name == "player_scale";
						},
						(Token t) => (int)t.Type == 16,
						delegate(Token t)
						{
							ConstantToken val15 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							int result7;
							if (val15 != null)
							{
								Variant value7 = val15.Value;
								RealVariant val16 = (RealVariant)(object)((value7 is RealVariant) ? value7 : null);
								if (val16 != null)
								{
									result7 = ((val16.Value == 0.1) ? 1 : 0);
									goto IL_002d;
								}
							}
							result7 = 0;
							goto IL_002d;
							IL_002d:
							return (byte)result7 != 0;
						},
						(Token t) => (int)t.Type == 82,
						delegate(Token t)
						{
							ConstantToken val13 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							int result6;
							if (val13 != null)
							{
								Variant value6 = val13.Value;
								RealVariant val14 = (RealVariant)(object)((value6 is RealVariant) ? value6 : null);
								if (val14 != null)
								{
									result6 = ((val14.Value == 0.7) ? 1 : 0);
									goto IL_002d;
								}
							}
							result6 = 0;
							goto IL_002d;
							IL_002d:
							return (byte)result6 != 0;
						},
						(Token t) => (int)t.Type == 82,
						delegate(Token t)
						{
							ConstantToken val11 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							int result5;
							if (val11 != null)
							{
								Variant value5 = val11.Value;
								RealVariant val12 = (RealVariant)(object)((value5 is RealVariant) ? value5 : null);
								if (val12 != null)
								{
									result5 = ((val12.Value == 1.3) ? 1 : 0);
									goto IL_002d;
								}
							}
							result5 = 0;
							goto IL_002d;
							IL_002d:
							return (byte)result5 != 0;
						}
					}, true, true);
					<shrinkWaiter>5__3 = new MultiTokenWaiter(new Func<Token, bool>[13]
					{
						delegate(Token t)
						{
							ConstantToken val9 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							int result4;
							if (val9 != null)
							{
								Variant value4 = val9.Value;
								StringVariant val10 = (StringVariant)(object)((value4 is StringVariant) ? value4 : null);
								if (val10 != null)
								{
									result4 = ((val10.Value == "shrink") ? 1 : 0);
									goto IL_002c;
								}
							}
							result4 = 0;
							goto IL_002c;
							IL_002c:
							return (byte)result4 != 0;
						},
						(Token t) => (int)t.Type == 86,
						delegate(Token t)
						{
							IdentifierToken val8 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val8 != null && val8.Name == "player_scale";
						},
						(Token t) => (int)t.Type == 23,
						(Token t) => (int)t.Type == 5,
						(Token t) => (int)t.Type == 80,
						delegate(Token t)
						{
							IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val7 != null && val7.Name == "player_scale";
						},
						(Token t) => (int)t.Type == 17,
						delegate(Token t)
						{
							ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							int result3;
							if (val5 != null)
							{
								Variant value3 = val5.Value;
								RealVariant val6 = (RealVariant)(object)((value3 is RealVariant) ? value3 : null);
								if (val6 != null)
								{
									result3 = ((val6.Value == 0.1) ? 1 : 0);
									goto IL_002d;
								}
							}
							result3 = 0;
							goto IL_002d;
							IL_002d:
							return (byte)result3 != 0;
						},
						(Token t) => (int)t.Type == 82,
						delegate(Token t)
						{
							ConstantToken val3 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							int result2;
							if (val3 != null)
							{
								Variant value2 = val3.Value;
								RealVariant val4 = (RealVariant)(object)((value2 is RealVariant) ? value2 : null);
								if (val4 != null)
								{
									result2 = ((val4.Value == 0.7) ? 1 : 0);
									goto IL_002d;
								}
							}
							result2 = 0;
							goto IL_002d;
							IL_002d:
							return (byte)result2 != 0;
						},
						(Token t) => (int)t.Type == 82,
						delegate(Token t)
						{
							ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							int result;
							if (val != null)
							{
								Variant value = val.Value;
								RealVariant val2 = (RealVariant)(object)((value is RealVariant) ? value : null);
								if (val2 != null)
								{
									result = ((val2.Value == 1.3) ? 1 : 0);
									goto IL_002d;
								}
							}
							result = 0;
							goto IL_002d;
							IL_002d:
							return (byte)result != 0;
						}
					}, true, true);
					<>s__4 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					goto IL_04c6;
				case 2:
					{
						<>1__state = -3;
						goto IL_04c6;
					}
					IL_04c6:
					<token>5__5 = null;
					break;
				}
				if (((global::System.Collections.IEnumerator)<>s__4).MoveNext())
				{
					<token>5__5 = <>s__4.Current;
					if (<functionWaiter>5__1.Check(<token>5__5))
					{
						<growthWaiter>5__2.SetReady();
						<shrinkWaiter>5__3.SetReady();
					}
					if (<growthWaiter>5__2.Check(<token>5__5) || <shrinkWaiter>5__3.Check(<token>5__5))
					{
						<>2__current = (Token)new ConstantToken((Variant)new RealVariant(100.0, false));
						<>1__state = 1;
						return true;
					}
					<>2__current = <token>5__5;
					<>1__state = 2;
					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)
	{
		FunctionWaiter functionWaiter = new FunctionWaiter("_consume_item", false);
		MultiTokenWaiter growthWaiter = new MultiTokenWaiter(new Func<Token, bool>[13]
		{
			delegate(Token t)
			{
				ConstantToken val19 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				int result8;
				if (val19 != null)
				{
					Variant value8 = val19.Value;
					StringVariant val20 = (StringVariant)(object)((value8 is StringVariant) ? value8 : null);
					if (val20 != null)
					{
						result8 = ((val20.Value == "growth") ? 1 : 0);
						goto IL_002c;
					}
				}
				result8 = 0;
				goto IL_002c;
				IL_002c:
				return (byte)result8 != 0;
			},
			(Token t) => (int)t.Type == 86,
			delegate(Token t)
			{
				IdentifierToken val18 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val18 != null && val18.Name == "player_scale";
			},
			(Token t) => (int)t.Type == 23,
			(Token t) => (int)t.Type == 5,
			(Token t) => (int)t.Type == 80,
			delegate(Token t)
			{
				IdentifierToken val17 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val17 != null && val17.Name == "player_scale";
			},
			(Token t) => (int)t.Type == 16,
			delegate(Token t)
			{
				ConstantToken val15 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				int result7;
				if (val15 != null)
				{
					Variant value7 = val15.Value;
					RealVariant val16 = (RealVariant)(object)((value7 is RealVariant) ? value7 : null);
					if (val16 != null)
					{
						result7 = ((val16.Value == 0.1) ? 1 : 0);
						goto IL_002d;
					}
				}
				result7 = 0;
				goto IL_002d;
				IL_002d:
				return (byte)result7 != 0;
			},
			(Token t) => (int)t.Type == 82,
			delegate(Token t)
			{
				ConstantToken val13 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				int result6;
				if (val13 != null)
				{
					Variant value6 = val13.Value;
					RealVariant val14 = (RealVariant)(object)((value6 is RealVariant) ? value6 : null);
					if (val14 != null)
					{
						result6 = ((val14.Value == 0.7) ? 1 : 0);
						goto IL_002d;
					}
				}
				result6 = 0;
				goto IL_002d;
				IL_002d:
				return (byte)result6 != 0;
			},
			(Token t) => (int)t.Type == 82,
			delegate(Token t)
			{
				ConstantToken val11 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				int result5;
				if (val11 != null)
				{
					Variant value5 = val11.Value;
					RealVariant val12 = (RealVariant)(object)((value5 is RealVariant) ? value5 : null);
					if (val12 != null)
					{
						result5 = ((val12.Value == 1.3) ? 1 : 0);
						goto IL_002d;
					}
				}
				result5 = 0;
				goto IL_002d;
				IL_002d:
				return (byte)result5 != 0;
			}
		}, true, true);
		MultiTokenWaiter shrinkWaiter = new MultiTokenWaiter(new Func<Token, bool>[13]
		{
			delegate(Token t)
			{
				ConstantToken val9 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				int result4;
				if (val9 != null)
				{
					Variant value4 = val9.Value;
					StringVariant val10 = (StringVariant)(object)((value4 is StringVariant) ? value4 : null);
					if (val10 != null)
					{
						result4 = ((val10.Value == "shrink") ? 1 : 0);
						goto IL_002c;
					}
				}
				result4 = 0;
				goto IL_002c;
				IL_002c:
				return (byte)result4 != 0;
			},
			(Token t) => (int)t.Type == 86,
			delegate(Token t)
			{
				IdentifierToken val8 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val8 != null && val8.Name == "player_scale";
			},
			(Token t) => (int)t.Type == 23,
			(Token t) => (int)t.Type == 5,
			(Token t) => (int)t.Type == 80,
			delegate(Token t)
			{
				IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val7 != null && val7.Name == "player_scale";
			},
			(Token t) => (int)t.Type == 17,
			delegate(Token t)
			{
				ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				int result3;
				if (val5 != null)
				{
					Variant value3 = val5.Value;
					RealVariant val6 = (RealVariant)(object)((value3 is RealVariant) ? value3 : null);
					if (val6 != null)
					{
						result3 = ((val6.Value == 0.1) ? 1 : 0);
						goto IL_002d;
					}
				}
				result3 = 0;
				goto IL_002d;
				IL_002d:
				return (byte)result3 != 0;
			},
			(Token t) => (int)t.Type == 82,
			delegate(Token t)
			{
				ConstantToken val3 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				int result2;
				if (val3 != null)
				{
					Variant value2 = val3.Value;
					RealVariant val4 = (RealVariant)(object)((value2 is RealVariant) ? value2 : null);
					if (val4 != null)
					{
						result2 = ((val4.Value == 0.7) ? 1 : 0);
						goto IL_002d;
					}
				}
				result2 = 0;
				goto IL_002d;
				IL_002d:
				return (byte)result2 != 0;
			},
			(Token t) => (int)t.Type == 82,
			delegate(Token t)
			{
				ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				int result;
				if (val != null)
				{
					Variant value = val.Value;
					RealVariant val2 = (RealVariant)(object)((value is RealVariant) ? value : null);
					if (val2 != null)
					{
						result = ((val2.Value == 1.3) ? 1 : 0);
						goto IL_002d;
					}
				}
				result = 0;
				goto IL_002d;
				IL_002d:
				return (byte)result != 0;
			}
		}, true, true);
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token token = enumerator.Current;
				if (functionWaiter.Check(token))
				{
					growthWaiter.SetReady();
					shrinkWaiter.SetReady();
				}
				if (growthWaiter.Check(token) || shrinkWaiter.Check(token))
				{
					yield return (Token)new ConstantToken((Variant)new RealVariant(100.0, false));
				}
				else
				{
					yield return token;
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
	}
}