Decompiled source of TitleAPI v1.0.5

GDWeave/mods/TitleAPI/TitleAPI.dll

Decompiled a day 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("TitleAPI")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+aa5f4baf2d8e149a309e75bd32309ea07a2f862c")]
[assembly: AssemblyProduct("TitleAPI")]
[assembly: AssemblyTitle("TitleAPI")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace TitleAPI;

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

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

		private MultiTokenWaiter <topOfFile>5__1;

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

		private bool MoveNext()
		{
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Expected O, but got Unknown
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Expected O, but got Unknown
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Expected O, but got Unknown
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Expected O, but got Unknown
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: 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_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Expected O, but got Unknown
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Expected O, but got Unknown
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Expected O, but got Unknown
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Expected O, but got Unknown
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Expected O, but got Unknown
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Expected O, but got Unknown
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Expected O, but got Unknown
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0537: Expected O, but got Unknown
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Expected O, but got Unknown
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Expected O, but got Unknown
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Expected O, but got Unknown
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: 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_062f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Expected O, but got Unknown
			//IL_0656: Unknown result type (might be due to invalid IL or missing references)
			//IL_0660: Expected O, but got Unknown
			//IL_065b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0665: Expected O, but got Unknown
			//IL_0689: Unknown result type (might be due to invalid IL or missing references)
			//IL_0693: Expected O, but got Unknown
			//IL_06b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c0: Expected O, but got Unknown
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Expected O, but got Unknown
			//IL_070b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0715: Expected O, but got Unknown
			//IL_0710: Unknown result type (might be due to invalid IL or missing references)
			//IL_071a: Expected O, but got Unknown
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0748: Expected O, but got Unknown
			//IL_076c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0776: Expected O, but got Unknown
			//IL_07d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e1: Expected O, but got Unknown
			//IL_0805: Unknown result type (might be due to invalid IL or missing references)
			//IL_080f: Expected O, but got Unknown
			//IL_082c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0836: Expected O, but got Unknown
			//IL_085a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0864: Expected O, but got Unknown
			//IL_0881: Unknown result type (might be due to invalid IL or missing references)
			//IL_088b: Expected O, but got Unknown
			//IL_08af: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b9: Expected O, but got Unknown
			//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e0: Expected O, but got Unknown
			//IL_0904: Unknown result type (might be due to invalid IL or missing references)
			//IL_090e: Expected O, but got Unknown
			//IL_092b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0935: Expected O, but got Unknown
			//IL_0959: Unknown result type (might be due to invalid IL or missing references)
			//IL_0963: Expected O, but got Unknown
			//IL_0983: Unknown result type (might be due to invalid IL or missing references)
			//IL_098d: Expected O, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Expected O, but got Unknown
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<topOfFile>5__1 = new MultiTokenWaiter(new Func<Token, bool>[2]
					{
						(Token t) => (int)t.Type == 89,
						(Token t) => (int)t.Type == 89
					}, false, true);
					<waiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[4]
					{
						delegate(Token t)
						{
							IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val2 != null && val2.Name == "_update_title";
						},
						(Token t) => (int)t.Type == 89,
						delegate(Token t)
						{
							IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val != null && val.Name == "label";
						},
						(Token t) => (int)t.Type == 89
					}, false, true);
					<skip>5__3 = 0;
					<>s__4 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					<>2__current = new Token((TokenType)53, (uint?)null);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -3;
					<>2__current = new Token((TokenType)59, (uint?)null);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("title_api");
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -3;
					<>2__current = new Token((TokenType)23, (uint?)null);
					<>1__state = 5;
					return true;
				case 5:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("get_node");
					<>1__state = 6;
					return true;
				case 6:
					<>1__state = -3;
					<>2__current = new Token((TokenType)80, (uint?)null);
					<>1__state = 7;
					return true;
				case 7:
					<>1__state = -3;
					<>2__current = (Token)new ConstantToken((Variant)new StringVariant("/root/TitleAPI"));
					<>1__state = 8;
					return true;
				case 8:
					<>1__state = -3;
					<>2__current = new Token((TokenType)81, (uint?)null);
					<>1__state = 9;
					return true;
				case 9:
					<>1__state = -3;
					<>2__current = new Token((TokenType)89, (uint?)null);
					<>1__state = 10;
					return true;
				case 10:
					<>1__state = -3;
					<>2__current = new Token((TokenType)48, (uint?)null);
					<>1__state = 11;
					return true;
				case 11:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("_ready");
					<>1__state = 12;
					return true;
				case 12:
					<>1__state = -3;
					<>2__current = new Token((TokenType)80, (uint?)null);
					<>1__state = 13;
					return true;
				case 13:
					<>1__state = -3;
					<>2__current = new Token((TokenType)81, (uint?)null);
					<>1__state = 14;
					return true;
				case 14:
					<>1__state = -3;
					<>2__current = new Token((TokenType)86, (uint?)null);
					<>1__state = 15;
					return true;
				case 15:
					<>1__state = -3;
					<>2__current = new Token((TokenType)89, (uint?)1u);
					<>1__state = 16;
					return true;
				case 16:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("title_api");
					<>1__state = 17;
					return true;
				case 17:
					<>1__state = -3;
					<>2__current = new Token((TokenType)84, (uint?)null);
					<>1__state = 18;
					return true;
				case 18:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("connect");
					<>1__state = 19;
					return true;
				case 19:
					<>1__state = -3;
					<>2__current = new Token((TokenType)80, (uint?)null);
					<>1__state = 20;
					return true;
				case 20:
					<>1__state = -3;
					<>2__current = (Token)new ConstantToken((Variant)new StringVariant("titles_updated"));
					<>1__state = 21;
					return true;
				case 21:
					<>1__state = -3;
					<>2__current = new Token((TokenType)82, (uint?)null);
					<>1__state = 22;
					return true;
				case 22:
					<>1__state = -3;
					<>2__current = new Token((TokenType)3, (uint?)null);
					<>1__state = 23;
					return true;
				case 23:
					<>1__state = -3;
					<>2__current = new Token((TokenType)82, (uint?)null);
					<>1__state = 24;
					return true;
				case 24:
					<>1__state = -3;
					<>2__current = (Token)new ConstantToken((Variant)new StringVariant("_update_title"));
					<>1__state = 25;
					return true;
				case 25:
					<>1__state = -3;
					<>2__current = new Token((TokenType)81, (uint?)null);
					<>1__state = 26;
					return true;
				case 26:
					<>1__state = -3;
					<>2__current = new Token((TokenType)89, (uint?)null);
					<>1__state = 27;
					return true;
				case 27:
					<>1__state = -3;
					goto IL_09ce;
				case 28:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("_name");
					<>1__state = 29;
					return true;
				case 29:
					<>1__state = -3;
					<>2__current = new Token((TokenType)23, (uint?)null);
					<>1__state = 30;
					return true;
				case 30:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("title_api");
					<>1__state = 31;
					return true;
				case 31:
					<>1__state = -3;
					<>2__current = new Token((TokenType)84, (uint?)null);
					<>1__state = 32;
					return true;
				case 32:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("resolve_name");
					<>1__state = 33;
					return true;
				case 33:
					<>1__state = -3;
					<>2__current = new Token((TokenType)80, (uint?)null);
					<>1__state = 34;
					return true;
				case 34:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("player_id");
					<>1__state = 35;
					return true;
				case 35:
					<>1__state = -3;
					<>2__current = new Token((TokenType)82, (uint?)null);
					<>1__state = 36;
					return true;
				case 36:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("_name");
					<>1__state = 37;
					return true;
				case 37:
					<>1__state = -3;
					<>2__current = new Token((TokenType)81, (uint?)null);
					<>1__state = 38;
					return true;
				case 38:
					<>1__state = -3;
					<>2__current = new Token((TokenType)89, (uint?)1u);
					<>1__state = 39;
					return true;
				case 39:
					<>1__state = -3;
					<skip>5__3 = 22;
					goto IL_09ce;
				case 40:
					{
						<>1__state = -3;
						goto IL_09ce;
					}
					IL_09ce:
					<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 (<topOfFile>5__1.Check(<token>5__5))
					{
						<>2__current = <token>5__5;
						<>1__state = 1;
						return true;
					}
					if (<waiter>5__2.Check(<token>5__5))
					{
						<>2__current = <token>5__5;
						<>1__state = 28;
						return true;
					}
					<>2__current = <token>5__5;
					<>1__state = 40;
					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_label.gdc";
	}

	[IteratorStateMachine(typeof(<Modify>d__1))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter topOfFile = new MultiTokenWaiter(new Func<Token, bool>[2]
		{
			(Token t) => (int)t.Type == 89,
			(Token t) => (int)t.Type == 89
		}, false, true);
		MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[4]
		{
			delegate(Token t)
			{
				IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val2 != null && val2.Name == "_update_title";
			},
			(Token t) => (int)t.Type == 89,
			delegate(Token t)
			{
				IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val != null && val.Name == "label";
			},
			(Token t) => (int)t.Type == 89
		}, false, true);
		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 (topOfFile.Check(token))
					{
						yield return token;
						yield return new Token((TokenType)53, (uint?)null);
						yield return new Token((TokenType)59, (uint?)null);
						yield return (Token)new IdentifierToken("title_api");
						yield return new Token((TokenType)23, (uint?)null);
						yield return (Token)new IdentifierToken("get_node");
						yield return new Token((TokenType)80, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new StringVariant("/root/TitleAPI"));
						yield return new Token((TokenType)81, (uint?)null);
						yield return new Token((TokenType)89, (uint?)null);
						yield return new Token((TokenType)48, (uint?)null);
						yield return (Token)new IdentifierToken("_ready");
						yield return new Token((TokenType)80, (uint?)null);
						yield return new Token((TokenType)81, (uint?)null);
						yield return new Token((TokenType)86, (uint?)null);
						yield return new Token((TokenType)89, (uint?)1u);
						yield return (Token)new IdentifierToken("title_api");
						yield return new Token((TokenType)84, (uint?)null);
						yield return (Token)new IdentifierToken("connect");
						yield return new Token((TokenType)80, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new StringVariant("titles_updated"));
						yield return new Token((TokenType)82, (uint?)null);
						yield return new Token((TokenType)3, (uint?)null);
						yield return new Token((TokenType)82, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new StringVariant("_update_title"));
						yield return new Token((TokenType)81, (uint?)null);
						yield return new Token((TokenType)89, (uint?)null);
					}
					else if (waiter.Check(token))
					{
						yield return token;
						yield return (Token)new IdentifierToken("_name");
						yield return new Token((TokenType)23, (uint?)null);
						yield return (Token)new IdentifierToken("title_api");
						yield return new Token((TokenType)84, (uint?)null);
						yield return (Token)new IdentifierToken("resolve_name");
						yield return new Token((TokenType)80, (uint?)null);
						yield return (Token)new IdentifierToken("player_id");
						yield return new Token((TokenType)82, (uint?)null);
						yield return (Token)new IdentifierToken("_name");
						yield return new Token((TokenType)81, (uint?)null);
						yield return new Token((TokenType)89, (uint?)1u);
						skip = 22;
					}
					else
					{
						yield return token;
					}
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
	}
}