Decompiled source of BetterCosmeticDefaulter v0.2.0

GDWeave/mods/Nineball.BetterCosmeticDefaulter/Nineball.BetterCosmeticDefaulter.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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("Nineball.BetterCosmeticDefaulter")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0+a0cfce4a6c20edbdf2a8a7d9cd221d269cd2ff63")]
[assembly: AssemblyProduct("Nineball.BetterCosmeticDefaulter")]
[assembly: AssemblyTitle("Nineball.BetterCosmeticDefaulter")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
public class PlayerEntryPatcher : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__3 : 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 <extendsInjection>5__2;

		private FunctionWaiter <tooltipInjector>5__3;

		private int <ignoreLines>5__4;

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

		private Token <token>5__6;

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

		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__3(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if ((uint)(num - -5) > 2u && (uint)(num - 1) > 3u)
			{
				return;
			}
			try
			{
				switch (num)
				{
				case -4:
				case 1:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally2();
					}
				case -5:
				case 3:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally3();
					}
				}
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Expected O, but got Unknown
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Expected O, but got Unknown
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Expected O, but got Unknown
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Expected O, but got Unknown
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Expected O, but got Unknown
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Expected O, but got Unknown
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Expected O, but got Unknown
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Expected O, but got Unknown
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Expected O, but got Unknown
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Expected O, but got Unknown
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Expected O, but got Unknown
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Expected O, but got Unknown
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Expected O, but got Unknown
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Invalid comparison between Unknown and I4
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<extendsInjection>5__2 = new MultiTokenWaiter(new Func<Token, bool>[2]
					{
						(Token t) => (int)t.Type == 51,
						(Token t) => (int)t.Type == 89
					}, false, true);
					<tooltipInjector>5__3 = new FunctionWaiter("_setup", false);
					<ignoreLines>5__4 = 0;
					<>7__wrap4 = tokens.GetEnumerator();
					<>1__state = -3;
					goto IL_042a;
				case 1:
					<>1__state = -4;
					goto IL_0135;
				case 2:
				{
					<>1__state = -3;
					<ignoreLines>5__4 = 2;
					global::System.Collections.Generic.IEnumerable<Token> enumerable = Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>((global::System.Collections.Generic.IEnumerable<Token>)new List<Token>(), ScriptTokenizer.Tokenize("held_data = data", 1u)), ScriptTokenizer.Tokenize("var username = str(held_data[\"steam_name\"])", 1u)), ScriptTokenizer.Tokenize("var nineball__errors = Globals.nineball__cosmetic_errors.get(data[\"steam_name\"])", 1u)), (global::System.Collections.Generic.IEnumerable<Token>)(object)new Token[6]
					{
						new Token((TokenType)38, (uint?)1u),
						(Token)new IdentifierToken((TokenType)1, (uint?)1u, "nineball__errors"),
						new Token((TokenType)7, (uint?)1u),
						(Token)new ConstantToken((TokenType)2, (uint?)1u, (Variant)new NilVariant()),
						new Token((TokenType)86, (uint?)1u),
						new Token((TokenType)89, (uint?)2u)
					}), ScriptTokenizer.Tokenize("  nineball__errors = []", 2u)), ScriptTokenizer.Tokenize("if nineball__errors.size() != 0:", 1u)), ScriptTokenizer.Tokenize("  var err_tooltip = nineball__Tooltip.instance()", 2u)), ScriptTokenizer.Tokenize("  username += \" [MISSING COSMETICS]\"", 2u)), ScriptTokenizer.Tokenize("  err_tooltip.header = \"Missing Cosmetics:\"", 2u)), (global::System.Collections.Generic.IEnumerable<Token>)(object)new Token[11]
					{
						(Token)new IdentifierToken((TokenType)1, (uint?)2u, "err_tooltip"),
						new Token((TokenType)84, (uint?)2u),
						(Token)new IdentifierToken((TokenType)1, (uint?)2u, "body"),
						new Token((TokenType)23, (uint?)2u),
						(Token)new ConstantToken((TokenType)2, (uint?)2u, (Variant)new StringVariant("\n")),
						new Token((TokenType)84, (uint?)2u),
						(Token)new IdentifierToken((TokenType)1, (uint?)2u, "join"),
						new Token((TokenType)80, (uint?)2u),
						(Token)new IdentifierToken((TokenType)1, (uint?)2u, "nineball__errors"),
						new Token((TokenType)81, (uint?)2u),
						new Token((TokenType)89, (uint?)2u)
					}), ScriptTokenizer.Tokenize("  $RichTextLabel.add_child(err_tooltip)", 2u)), ScriptTokenizer.Tokenize("$RichTextLabel.text = username", 1u));
					<>7__wrap6 = enumerable.GetEnumerator();
					<>1__state = -5;
					goto IL_03c0;
				}
				case 3:
					<>1__state = -5;
					goto IL_03c0;
				case 4:
					{
						<>1__state = -3;
						<token>5__6 = null;
						goto IL_042a;
					}
					IL_03c0:
					if (((global::System.Collections.IEnumerator)<>7__wrap6).MoveNext())
					{
						Token current = <>7__wrap6.Current;
						<>2__current = current;
						<>1__state = 3;
						return true;
					}
					<>m__Finally3();
					<>7__wrap6 = null;
					goto IL_042a;
					IL_014f:
					if (<tooltipInjector>5__3.Check(<token>5__6))
					{
						<>2__current = <token>5__6;
						<>1__state = 2;
						return true;
					}
					if (<ignoreLines>5__4 > 0)
					{
						if ((int)<token>5__6.Type == 89)
						{
							<ignoreLines>5__4--;
						}
						goto IL_042a;
					}
					<>2__current = <token>5__6;
					<>1__state = 4;
					return true;
					IL_0135:
					if (((global::System.Collections.IEnumerator)<>7__wrap6).MoveNext())
					{
						Token current2 = <>7__wrap6.Current;
						<>2__current = current2;
						<>1__state = 1;
						return true;
					}
					<>m__Finally2();
					<>7__wrap6 = null;
					goto IL_014f;
					IL_042a:
					if (((global::System.Collections.IEnumerator)<>7__wrap4).MoveNext())
					{
						<token>5__6 = <>7__wrap4.Current;
						if (<extendsInjection>5__2.Check(<token>5__6))
						{
							global::System.Collections.Generic.IEnumerable<Token> enumerable2 = Enumerable.Concat<Token>((global::System.Collections.Generic.IEnumerable<Token>)new List<Token>(), ScriptTokenizer.Tokenize("var nineball__Tooltip = preload(\"res://Scenes/Singletons/Tooltips/tooltip_node.tscn\")", 0u));
							<>7__wrap6 = enumerable2.GetEnumerator();
							<>1__state = -4;
							goto IL_0135;
						}
						goto IL_014f;
					}
					<>m__Finally1();
					<>7__wrap4 = 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 (<>7__wrap4 != null)
			{
				((global::System.IDisposable)<>7__wrap4).Dispose();
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -3;
			if (<>7__wrap6 != null)
			{
				((global::System.IDisposable)<>7__wrap6).Dispose();
			}
		}

		private void <>m__Finally3()
		{
			<>1__state = -3;
			if (<>7__wrap6 != null)
			{
				((global::System.IDisposable)<>7__wrap6).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__3 <Modify>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Modify>d__ = this;
			}
			else
			{
				<Modify>d__ = new <Modify>d__3(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();
		}
	}

	private IModInterface modInterface;

	public bool ShouldRun(string path)
	{
		return path == "res://Scenes/HUD/Playerlist/player_entry.gdc";
	}

	public PlayerEntryPatcher(IModInterface modInterface)
	{
		this.modInterface = modInterface;
	}

	[IteratorStateMachine(typeof(<Modify>d__3))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter extendsInjection = new MultiTokenWaiter(new Func<Token, bool>[2]
		{
			(Token t) => (int)t.Type == 51,
			(Token t) => (int)t.Type == 89
		}, false, true);
		FunctionWaiter tooltipInjector = new FunctionWaiter("_setup", false);
		int ignoreLines = 0;
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token token = enumerator.Current;
				if (extendsInjection.Check(token))
				{
					global::System.Collections.Generic.IEnumerable<Token> enumerable = Enumerable.Concat<Token>((global::System.Collections.Generic.IEnumerable<Token>)new List<Token>(), ScriptTokenizer.Tokenize("var nineball__Tooltip = preload(\"res://Scenes/Singletons/Tooltips/tooltip_node.tscn\")", 0u));
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = enumerable.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
				}
				if (tooltipInjector.Check(token))
				{
					yield return token;
					ignoreLines = 2;
					global::System.Collections.Generic.IEnumerable<Token> enumerable2 = Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>((global::System.Collections.Generic.IEnumerable<Token>)new List<Token>(), ScriptTokenizer.Tokenize("held_data = data", 1u)), ScriptTokenizer.Tokenize("var username = str(held_data[\"steam_name\"])", 1u)), ScriptTokenizer.Tokenize("var nineball__errors = Globals.nineball__cosmetic_errors.get(data[\"steam_name\"])", 1u)), (global::System.Collections.Generic.IEnumerable<Token>)(object)new Token[6]
					{
						new Token((TokenType)38, (uint?)1u),
						(Token)new IdentifierToken((TokenType)1, (uint?)1u, "nineball__errors"),
						new Token((TokenType)7, (uint?)1u),
						(Token)new ConstantToken((TokenType)2, (uint?)1u, (Variant)new NilVariant()),
						new Token((TokenType)86, (uint?)1u),
						new Token((TokenType)89, (uint?)2u)
					}), ScriptTokenizer.Tokenize("  nineball__errors = []", 2u)), ScriptTokenizer.Tokenize("if nineball__errors.size() != 0:", 1u)), ScriptTokenizer.Tokenize("  var err_tooltip = nineball__Tooltip.instance()", 2u)), ScriptTokenizer.Tokenize("  username += \" [MISSING COSMETICS]\"", 2u)), ScriptTokenizer.Tokenize("  err_tooltip.header = \"Missing Cosmetics:\"", 2u)), (global::System.Collections.Generic.IEnumerable<Token>)(object)new Token[11]
					{
						(Token)new IdentifierToken((TokenType)1, (uint?)2u, "err_tooltip"),
						new Token((TokenType)84, (uint?)2u),
						(Token)new IdentifierToken((TokenType)1, (uint?)2u, "body"),
						new Token((TokenType)23, (uint?)2u),
						(Token)new ConstantToken((TokenType)2, (uint?)2u, (Variant)new StringVariant("\n")),
						new Token((TokenType)84, (uint?)2u),
						(Token)new IdentifierToken((TokenType)1, (uint?)2u, "join"),
						new Token((TokenType)80, (uint?)2u),
						(Token)new IdentifierToken((TokenType)1, (uint?)2u, "nineball__errors"),
						new Token((TokenType)81, (uint?)2u),
						new Token((TokenType)89, (uint?)2u)
					}), ScriptTokenizer.Tokenize("  $RichTextLabel.add_child(err_tooltip)", 2u)), ScriptTokenizer.Tokenize("$RichTextLabel.text = username", 1u));
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = enumerable2.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
				}
				else if (ignoreLines > 0)
				{
					if ((int)token.Type == 89)
					{
						ignoreLines--;
					}
				}
				else
				{
					yield return token;
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
	}
}
namespace Nineball.BetterCosmeticDefaulter;

public class Config
{
}
public class GlobalsPatcher : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__3 : 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 <extendsInjection>5__2;

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

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

		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__3(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if ((uint)(num - -4) > 1u && (uint)(num - 1) > 2u)
			{
				return;
			}
			try
			{
				if (num != -4 && num != 2)
				{
					return;
				}
				try
				{
				}
				finally
				{
					<>m__Finally2();
				}
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<extendsInjection>5__2 = new MultiTokenWaiter(new Func<Token, bool>[5]
					{
						delegate(Token t)
						{
							IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val != null && val.Name == "item_data";
						},
						(Token t) => (int)t.Type == 23,
						(Token t) => (int)t.Type == 78,
						(Token t) => (int)t.Type == 79,
						(Token t) => (int)t.Type == 89
					}, false, false);
					<>7__wrap2 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
				{
					<>1__state = -3;
					global::System.Collections.Generic.IEnumerable<Token> enumerable = Enumerable.Concat<Token>(Enumerable.Concat<Token>((global::System.Collections.Generic.IEnumerable<Token>)new List<Token>(), ScriptTokenizer.Tokenize("var nineball__cosmetic_errors = item_data.duplicate()", 0u)), ScriptTokenizer.Tokenize("var nineball__STOP_GDWEAVE_FROM_GASLIGHTING_ME = preload(\"res://Scenes/HUD/Playerlist/player_entry.gd\")", 0u));
					<>7__wrap3 = enumerable.GetEnumerator();
					<>1__state = -4;
					goto IL_01a4;
				}
				case 2:
					<>1__state = -4;
					goto IL_01a4;
				case 3:
					{
						<>1__state = -3;
						break;
					}
					IL_01a4:
					if (((global::System.Collections.IEnumerator)<>7__wrap3).MoveNext())
					{
						Token current = <>7__wrap3.Current;
						<>2__current = current;
						<>1__state = 2;
						return true;
					}
					<>m__Finally2();
					<>7__wrap3 = null;
					break;
				}
				if (((global::System.Collections.IEnumerator)<>7__wrap2).MoveNext())
				{
					Token current2 = <>7__wrap2.Current;
					if (<extendsInjection>5__2.Check(current2))
					{
						<>2__current = current2;
						<>1__state = 1;
						return true;
					}
					<>2__current = current2;
					<>1__state = 3;
					return true;
				}
				<>m__Finally1();
				<>7__wrap2 = 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 (<>7__wrap2 != null)
			{
				((global::System.IDisposable)<>7__wrap2).Dispose();
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -3;
			if (<>7__wrap3 != null)
			{
				((global::System.IDisposable)<>7__wrap3).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__3 <Modify>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Modify>d__ = this;
			}
			else
			{
				<Modify>d__ = new <Modify>d__3(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();
		}
	}

	private IModInterface modInterface;

	public bool ShouldRun(string path)
	{
		return path == "res://Scenes/Singletons/globals.gdc";
	}

	public GlobalsPatcher(IModInterface modInterface)
	{
		this.modInterface = modInterface;
	}

	[IteratorStateMachine(typeof(<Modify>d__3))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter extendsInjection = new MultiTokenWaiter(new Func<Token, bool>[5]
		{
			delegate(Token t)
			{
				IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val != null && val.Name == "item_data";
			},
			(Token t) => (int)t.Type == 23,
			(Token t) => (int)t.Type == 78,
			(Token t) => (int)t.Type == 79,
			(Token t) => (int)t.Type == 89
		}, false, false);
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token current = enumerator.Current;
				if (extendsInjection.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerable<Token> enumerable = Enumerable.Concat<Token>(Enumerable.Concat<Token>((global::System.Collections.Generic.IEnumerable<Token>)new List<Token>(), ScriptTokenizer.Tokenize("var nineball__cosmetic_errors = item_data.duplicate()", 0u)), ScriptTokenizer.Tokenize("var nineball__STOP_GDWEAVE_FROM_GASLIGHTING_ME = preload(\"res://Scenes/HUD/Playerlist/player_entry.gd\")", 0u));
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = enumerable.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
				}
				else
				{
					yield return current;
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
	}
}
public class Mod : IMod, global::System.IDisposable
{
	public Config Config;

	public Mod(IModInterface modInterface)
	{
		Config = modInterface.ReadConfig<Config>();
		modInterface.RegisterScriptMod((IScriptMod)(object)new PlayerEntryPatcher(modInterface));
		modInterface.RegisterScriptMod((IScriptMod)(object)new PlayerPatcher(modInterface));
		modInterface.RegisterScriptMod((IScriptMod)(object)new GlobalsPatcher(modInterface));
	}

	public void Dispose()
	{
	}
}
public class PlayerPatcher : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__3 : 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 FunctionWaiter <beginErrorHandleInjection>5__2;

		private MultiTokenWaiter <endErrorHandleInjection>5__3;

		private MultiTokenWaiter <usernameErrorIndicatorInjection>5__4;

		private bool <ignore>5__5;

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

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

		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__3(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if ((uint)(num - -5) > 2u && (uint)(num - 1) > 4u)
			{
				return;
			}
			try
			{
				switch (num)
				{
				case -4:
				case 2:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally2();
					}
				case -5:
				case 4:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally3();
					}
				}
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Expected O, but got Unknown
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<beginErrorHandleInjection>5__2 = new FunctionWaiter("_update_cosmetics", false);
					<endErrorHandleInjection>5__3 = new MultiTokenWaiter(new Func<Token, bool>[8]
					{
						delegate(Token t)
						{
							IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val4 != null && val4.Name == "PlayerData";
						},
						(Token t) => (int)t.Type == 84,
						delegate(Token t)
						{
							IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val3 != null && val3.Name == "FALLBACK_COSM";
						},
						(Token t) => (int)t.Type == 84,
						delegate(Token t)
						{
							IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val2 != null && val2.Name == "duplicate";
						},
						(Token t) => (int)t.Type == 80,
						(Token t) => (int)t.Type == 81,
						(Token t) => (int)t.Type == 89
					}, false, false);
					<usernameErrorIndicatorInjection>5__4 = new MultiTokenWaiter(new Func<Token, bool>[4]
					{
						delegate(Token t)
						{
							IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val != null && val.Name == "username";
						},
						(Token t) => (int)t.Type == 23,
						(Token t) => true,
						(Token t) => (int)t.Type == 89
					}, false, false);
					<ignore>5__5 = false;
					<>7__wrap5 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
				{
					<>1__state = -3;
					<ignore>5__5 = true;
					global::System.Collections.Generic.IEnumerable<Token> enumerable2 = Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>((global::System.Collections.Generic.IEnumerable<Token>)new List<Token>(), ScriptTokenizer.Tokenize("var nb_fallback = PlayerData.FALLBACK_COSM.duplicate()", 1u)), ScriptTokenizer.Tokenize("var cosm_errors = []", 1u)), ScriptTokenizer.Tokenize("var valid = true", 1u)), ScriptTokenizer.Tokenize("var recovered = false", 1u)), ScriptTokenizer.Tokenize("for key in nb_fallback.keys():", 1u)), ScriptTokenizer.Tokenize("  if !data.keys().has(key):", 2u)), ScriptTokenizer.Tokenize("    valid = false", 3u)), ScriptTokenizer.Tokenize("for key in data.keys():", 1u)), ScriptTokenizer.Tokenize("  var value = data[key]", 2u)), ScriptTokenizer.Tokenize("  if key == \"accessory\":", 2u)), ScriptTokenizer.Tokenize("    var filtered = []", 3u)), ScriptTokenizer.Tokenize("    for c in data[key]:", 3u)), ScriptTokenizer.Tokenize("      if Globals._cosmetic_exists(c):", 4u)), ScriptTokenizer.Tokenize("        filtered.append(c)", 5u)), ScriptTokenizer.Tokenize("      else:", 4u)), ScriptTokenizer.Tokenize("        cosm_errors.append(c)", 5u)), ScriptTokenizer.Tokenize("        recovered = true", 5u)), ScriptTokenizer.Tokenize("    data[key] = filtered", 3u)), ScriptTokenizer.Tokenize("  else:", 2u)), ScriptTokenizer.Tokenize("    if !Globals._cosmetic_exists(data[key]):", 3u)), ScriptTokenizer.Tokenize("      cosm_errors.append(data[key])", 4u)), ScriptTokenizer.Tokenize("      data[key] = nb_fallback[key]", 4u)), ScriptTokenizer.Tokenize("      recovered = true", 4u)), ScriptTokenizer.Tokenize("if !valid:", 1u)), ScriptTokenizer.Tokenize("  data = PlayerData.FALLBACK_COSM.duplicate()", 2u));
					<>7__wrap6 = enumerable2.GetEnumerator();
					<>1__state = -4;
					goto IL_043f;
				}
				case 2:
					<>1__state = -4;
					goto IL_043f;
				case 3:
				{
					<>1__state = -3;
					global::System.Collections.Generic.IEnumerable<Token> enumerable = Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>((global::System.Collections.Generic.IEnumerable<Token>)new List<Token>(), ScriptTokenizer.Tokenize("Globals.nineball__cosmetic_errors[username] = cosm_errors", 1u)), ScriptTokenizer.Tokenize("if !valid:", 1u)), ScriptTokenizer.Tokenize("  username += \"**\"", 2u)), ScriptTokenizer.Tokenize("elif recovered:", 1u)), ScriptTokenizer.Tokenize("  username += \"*\"", 2u));
					<>7__wrap6 = enumerable.GetEnumerator();
					<>1__state = -5;
					goto IL_053c;
				}
				case 4:
					<>1__state = -5;
					goto IL_053c;
				case 5:
					{
						<>1__state = -3;
						break;
					}
					IL_053c:
					if (((global::System.Collections.IEnumerator)<>7__wrap6).MoveNext())
					{
						Token current = <>7__wrap6.Current;
						<>2__current = current;
						<>1__state = 4;
						return true;
					}
					<>m__Finally3();
					<>7__wrap6 = null;
					break;
					IL_043f:
					if (((global::System.Collections.IEnumerator)<>7__wrap6).MoveNext())
					{
						Token current2 = <>7__wrap6.Current;
						<>2__current = current2;
						<>1__state = 2;
						return true;
					}
					<>m__Finally2();
					<>7__wrap6 = null;
					break;
				}
				while (((global::System.Collections.IEnumerator)<>7__wrap5).MoveNext())
				{
					Token current3 = <>7__wrap5.Current;
					if (<beginErrorHandleInjection>5__2.Check(current3))
					{
						<>2__current = current3;
						<>1__state = 1;
						return true;
					}
					if (<endErrorHandleInjection>5__3.Check(current3))
					{
						<ignore>5__5 = false;
						continue;
					}
					if (<usernameErrorIndicatorInjection>5__4.Check(current3))
					{
						<>2__current = current3;
						<>1__state = 3;
						return true;
					}
					if (<ignore>5__5)
					{
						continue;
					}
					<>2__current = current3;
					<>1__state = 5;
					return true;
				}
				<>m__Finally1();
				<>7__wrap5 = 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 (<>7__wrap5 != null)
			{
				((global::System.IDisposable)<>7__wrap5).Dispose();
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -3;
			if (<>7__wrap6 != null)
			{
				((global::System.IDisposable)<>7__wrap6).Dispose();
			}
		}

		private void <>m__Finally3()
		{
			<>1__state = -3;
			if (<>7__wrap6 != null)
			{
				((global::System.IDisposable)<>7__wrap6).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__3 <Modify>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Modify>d__ = this;
			}
			else
			{
				<Modify>d__ = new <Modify>d__3(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();
		}
	}

	private IModInterface modInterface;

	public bool ShouldRun(string path)
	{
		if (!(path == "res://Scenes/Entities/Player/player.gdc"))
		{
			return path == "res://mods/bizzlemip.antilag/player2.gdc";
		}
		return true;
	}

	public PlayerPatcher(IModInterface modInterface)
	{
		this.modInterface = modInterface;
	}

	[IteratorStateMachine(typeof(<Modify>d__3))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		FunctionWaiter beginErrorHandleInjection = new FunctionWaiter("_update_cosmetics", false);
		MultiTokenWaiter endErrorHandleInjection = new MultiTokenWaiter(new Func<Token, bool>[8]
		{
			delegate(Token t)
			{
				IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val4 != null && val4.Name == "PlayerData";
			},
			(Token t) => (int)t.Type == 84,
			delegate(Token t)
			{
				IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val3 != null && val3.Name == "FALLBACK_COSM";
			},
			(Token t) => (int)t.Type == 84,
			delegate(Token t)
			{
				IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val2 != null && val2.Name == "duplicate";
			},
			(Token t) => (int)t.Type == 80,
			(Token t) => (int)t.Type == 81,
			(Token t) => (int)t.Type == 89
		}, false, false);
		MultiTokenWaiter usernameErrorIndicatorInjection = new MultiTokenWaiter(new Func<Token, bool>[4]
		{
			delegate(Token t)
			{
				IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val != null && val.Name == "username";
			},
			(Token t) => (int)t.Type == 23,
			(Token t) => true,
			(Token t) => (int)t.Type == 89
		}, false, false);
		bool ignore = false;
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token current = enumerator.Current;
				if (beginErrorHandleInjection.Check(current))
				{
					yield return current;
					ignore = true;
					global::System.Collections.Generic.IEnumerable<Token> enumerable = Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>((global::System.Collections.Generic.IEnumerable<Token>)new List<Token>(), ScriptTokenizer.Tokenize("var nb_fallback = PlayerData.FALLBACK_COSM.duplicate()", 1u)), ScriptTokenizer.Tokenize("var cosm_errors = []", 1u)), ScriptTokenizer.Tokenize("var valid = true", 1u)), ScriptTokenizer.Tokenize("var recovered = false", 1u)), ScriptTokenizer.Tokenize("for key in nb_fallback.keys():", 1u)), ScriptTokenizer.Tokenize("  if !data.keys().has(key):", 2u)), ScriptTokenizer.Tokenize("    valid = false", 3u)), ScriptTokenizer.Tokenize("for key in data.keys():", 1u)), ScriptTokenizer.Tokenize("  var value = data[key]", 2u)), ScriptTokenizer.Tokenize("  if key == \"accessory\":", 2u)), ScriptTokenizer.Tokenize("    var filtered = []", 3u)), ScriptTokenizer.Tokenize("    for c in data[key]:", 3u)), ScriptTokenizer.Tokenize("      if Globals._cosmetic_exists(c):", 4u)), ScriptTokenizer.Tokenize("        filtered.append(c)", 5u)), ScriptTokenizer.Tokenize("      else:", 4u)), ScriptTokenizer.Tokenize("        cosm_errors.append(c)", 5u)), ScriptTokenizer.Tokenize("        recovered = true", 5u)), ScriptTokenizer.Tokenize("    data[key] = filtered", 3u)), ScriptTokenizer.Tokenize("  else:", 2u)), ScriptTokenizer.Tokenize("    if !Globals._cosmetic_exists(data[key]):", 3u)), ScriptTokenizer.Tokenize("      cosm_errors.append(data[key])", 4u)), ScriptTokenizer.Tokenize("      data[key] = nb_fallback[key]", 4u)), ScriptTokenizer.Tokenize("      recovered = true", 4u)), ScriptTokenizer.Tokenize("if !valid:", 1u)), ScriptTokenizer.Tokenize("  data = PlayerData.FALLBACK_COSM.duplicate()", 2u));
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = enumerable.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
				}
				else if (endErrorHandleInjection.Check(current))
				{
					ignore = false;
				}
				else if (usernameErrorIndicatorInjection.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerable<Token> enumerable2 = Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>(Enumerable.Concat<Token>((global::System.Collections.Generic.IEnumerable<Token>)new List<Token>(), ScriptTokenizer.Tokenize("Globals.nineball__cosmetic_errors[username] = cosm_errors", 1u)), ScriptTokenizer.Tokenize("if !valid:", 1u)), ScriptTokenizer.Tokenize("  username += \"**\"", 2u)), ScriptTokenizer.Tokenize("elif recovered:", 1u)), ScriptTokenizer.Tokenize("  username += \"*\"", 2u));
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = enumerable2.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
				}
				else if (!ignore)
				{
					yield return current;
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
	}
}