Decompiled source of redchalk v2.0.0

GDWeave/mods/officerballs.redchalk/officerballs.redchalk.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 System.Text.Json.Serialization;
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("officerballs.redchalk")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
[assembly: AssemblyProduct("officerballs.redchalk")]
[assembly: AssemblyTitle("officerballs.redchalk")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace RedChalk;

public class Config
{
	[JsonInclude]
	public bool SettingDoesNothing = true;
}
public class Mod : IMod, global::System.IDisposable
{
	public Config Config;

	public Mod(IModInterface modInterface)
	{
		Config = modInterface.ReadConfig<Config>();
		modInterface.RegisterScriptMod((IScriptMod)(object)new RedChalkMod());
		modInterface.Logger.Information("[officer balls] red chalk engaged");
	}

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

		private MultiTokenWaiter <addVar>5__1;

		private MultiTokenWaiter <onReady>5__2;

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

		private Token <token>5__4;

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

		private bool MoveNext()
		{
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Expected O, but got Unknown
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Expected O, but got Unknown
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Expected O, but got Unknown
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Expected O, but got Unknown
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Expected O, but got Unknown
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Expected O, but got Unknown
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Expected O, but got Unknown
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Expected O, but got Unknown
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Expected O, but got Unknown
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Expected O, but got Unknown
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Expected O, but got Unknown
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Expected O, but got Unknown
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Expected O, but got Unknown
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Expected O, but got Unknown
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Expected O, but got Unknown
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_0563: Expected O, but got Unknown
			//IL_0580: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Expected O, but got Unknown
			//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Expected O, but got Unknown
			//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Expected O, but got Unknown
			//IL_0601: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Expected O, but got Unknown
			//IL_0628: Unknown result type (might be due to invalid IL or missing references)
			//IL_0632: Expected O, but got Unknown
			//IL_0655: Unknown result type (might be due to invalid IL or missing references)
			//IL_065f: Expected O, but got Unknown
			//IL_0682: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Expected O, but got Unknown
			//IL_06af: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b9: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<addVar>5__1 = new MultiTokenWaiter(new Func<Token, bool>[4]
					{
						(Token t) => (int)t.Type == 59,
						delegate(Token t)
						{
							IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val4 != null && val4.Name == "current_tab";
						},
						(Token t) => (int)t.Type == 23,
						delegate(Token t)
						{
							ConstantToken val2 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							int result;
							if (val2 != null)
							{
								Variant value = val2.Value;
								IntVariant val3 = (IntVariant)(object)((value is IntVariant) ? value : null);
								if (val3 != null)
								{
									result = ((val3.Value == 0) ? 1 : 0);
									goto IL_0026;
								}
							}
							result = 0;
							goto IL_0026;
							IL_0026:
							return (byte)result != 0;
						}
					}, false, false);
					<onReady>5__2 = new MultiTokenWaiter(new Func<Token, bool>[4]
					{
						delegate(Token t)
						{
							IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val != null && val.Name == "_ready";
						},
						(Token t) => (int)t.Type == 80,
						(Token t) => (int)t.Type == 81,
						(Token t) => (int)t.Type == 86
					}, false, false);
					<>s__3 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					<>2__current = new Token((TokenType)89, (uint?)null);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -3;
					<>2__current = new Token((TokenType)53, (uint?)null);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -3;
					<>2__current = new Token((TokenType)59, (uint?)null);
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("redchalk");
					<>1__state = 5;
					return true;
				case 5:
					<>1__state = -3;
					<>2__current = new Token((TokenType)23, (uint?)null);
					<>1__state = 6;
					return true;
				case 6:
					<>1__state = -3;
					<>2__current = new Token((TokenType)87, (uint?)null);
					<>1__state = 7;
					return true;
				case 7:
					<>1__state = -3;
					<>2__current = (Token)new ConstantToken((Variant)new StringVariant("/root/officerballsredchalk"));
					<>1__state = 8;
					return true;
				case 8:
					<>1__state = -3;
					goto IL_06f2;
				case 9:
					<>1__state = -3;
					<>2__current = new Token((TokenType)89, (uint?)1u);
					<>1__state = 10;
					return true;
				case 10:
					<>1__state = -3;
					<>2__current = new Token((TokenType)87, (uint?)null);
					<>1__state = 11;
					return true;
				case 11:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("main");
					<>1__state = 12;
					return true;
				case 12:
					<>1__state = -3;
					<>2__current = new Token((TokenType)19, (uint?)null);
					<>1__state = 13;
					return true;
				case 13:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("in_game");
					<>1__state = 14;
					return true;
				case 14:
					<>1__state = -3;
					<>2__current = new Token((TokenType)84, (uint?)null);
					<>1__state = 15;
					return true;
				case 15:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("add_child");
					<>1__state = 16;
					return true;
				case 16:
					<>1__state = -3;
					<>2__current = new Token((TokenType)80, (uint?)null);
					<>1__state = 17;
					return true;
				case 17:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("redchalk");
					<>1__state = 18;
					return true;
				case 18:
					<>1__state = -3;
					<>2__current = new Token((TokenType)84, (uint?)null);
					<>1__state = 19;
					return true;
				case 19:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("redmenu");
					<>1__state = 20;
					return true;
				case 20:
					<>1__state = -3;
					<>2__current = new Token((TokenType)84, (uint?)null);
					<>1__state = 21;
					return true;
				case 21:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("instance");
					<>1__state = 22;
					return true;
				case 22:
					<>1__state = -3;
					<>2__current = new Token((TokenType)80, (uint?)null);
					<>1__state = 23;
					return true;
				case 23:
					<>1__state = -3;
					<>2__current = new Token((TokenType)81, (uint?)null);
					<>1__state = 24;
					return true;
				case 24:
					<>1__state = -3;
					<>2__current = new Token((TokenType)81, (uint?)null);
					<>1__state = 25;
					return true;
				case 25:
					<>1__state = -3;
					goto IL_06f2;
				case 26:
					{
						<>1__state = -3;
						goto IL_06f2;
					}
					IL_06f2:
					<token>5__4 = null;
					break;
				}
				if (((global::System.Collections.IEnumerator)<>s__3).MoveNext())
				{
					<token>5__4 = <>s__3.Current;
					if (<addVar>5__1.Check(<token>5__4))
					{
						<>2__current = <token>5__4;
						<>1__state = 1;
						return true;
					}
					if (<onReady>5__2.Check(<token>5__4))
					{
						<>2__current = <token>5__4;
						<>1__state = 9;
						return true;
					}
					<>2__current = <token>5__4;
					<>1__state = 26;
					return true;
				}
				<>m__Finally1();
				<>s__3 = 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__3 != null)
			{
				((global::System.IDisposable)<>s__3).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/HUD/playerhud.gdc";
	}

	[IteratorStateMachine(typeof(<Modify>d__1))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter addVar = new MultiTokenWaiter(new Func<Token, bool>[4]
		{
			(Token t) => (int)t.Type == 59,
			delegate(Token t)
			{
				IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val4 != null && val4.Name == "current_tab";
			},
			(Token t) => (int)t.Type == 23,
			delegate(Token t)
			{
				ConstantToken val2 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				int result;
				if (val2 != null)
				{
					Variant value = val2.Value;
					IntVariant val3 = (IntVariant)(object)((value is IntVariant) ? value : null);
					if (val3 != null)
					{
						result = ((val3.Value == 0) ? 1 : 0);
						goto IL_0026;
					}
				}
				result = 0;
				goto IL_0026;
				IL_0026:
				return (byte)result != 0;
			}
		}, false, false);
		MultiTokenWaiter onReady = new MultiTokenWaiter(new Func<Token, bool>[4]
		{
			delegate(Token t)
			{
				IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val != null && val.Name == "_ready";
			},
			(Token t) => (int)t.Type == 80,
			(Token t) => (int)t.Type == 81,
			(Token t) => (int)t.Type == 86
		}, false, false);
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token token = enumerator.Current;
				if (addVar.Check(token))
				{
					yield return token;
					yield return new Token((TokenType)89, (uint?)null);
					yield return new Token((TokenType)53, (uint?)null);
					yield return new Token((TokenType)59, (uint?)null);
					yield return (Token)new IdentifierToken("redchalk");
					yield return new Token((TokenType)23, (uint?)null);
					yield return new Token((TokenType)87, (uint?)null);
					yield return (Token)new ConstantToken((Variant)new StringVariant("/root/officerballsredchalk"));
				}
				else if (onReady.Check(token))
				{
					yield return token;
					yield return new Token((TokenType)89, (uint?)1u);
					yield return new Token((TokenType)87, (uint?)null);
					yield return (Token)new IdentifierToken("main");
					yield return new Token((TokenType)19, (uint?)null);
					yield return (Token)new IdentifierToken("in_game");
					yield return new Token((TokenType)84, (uint?)null);
					yield return (Token)new IdentifierToken("add_child");
					yield return new Token((TokenType)80, (uint?)null);
					yield return (Token)new IdentifierToken("redchalk");
					yield return new Token((TokenType)84, (uint?)null);
					yield return (Token)new IdentifierToken("redmenu");
					yield return new Token((TokenType)84, (uint?)null);
					yield return (Token)new IdentifierToken("instance");
					yield return new Token((TokenType)80, (uint?)null);
					yield return new Token((TokenType)81, (uint?)null);
					yield return new Token((TokenType)81, (uint?)null);
				}
				else
				{
					yield return token;
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
	}
}