Decompiled source of SBGL CompPluginCheck v0.1.3

SBGL-CompPluginCheck.dll

Decompiled 5 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 System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json.Linq;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("GameAssembly")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SBGL-CompPluginCheck")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+9a171ae398e246e91e136508c15c434c7e536a35")]
[assembly: AssemblyProduct("Super Battle Golf Competitive Plugin Check")]
[assembly: AssemblyTitle("SBGL-CompPluginCheck")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SBGLCompPluginCheck
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SBGL-CompPluginCheck";

		public const string PLUGIN_NAME = "Super Battle Golf Competitive Plugin Check";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace SBGCompPluginCheck
{
	public class BypassCertificate : CertificateHandler
	{
		protected override bool ValidateCertificate(byte[] certificateData)
		{
			return true;
		}
	}
	public class ProSeriesEvent
	{
		public string name;

		public string event_date;
	}
	public class MatchEntry
	{
		public string match_summary;

		public string match_date;
	}
	[BepInPlugin("com.kingcox.sbgl.compplugincheck", "SBGL-CompPluginCheck", "0.0.99")]
	public class CompPluginCheck : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <AutoUpdateLoop>d__56 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CompPluginCheck <>4__this;

			private float <timer>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <AutoUpdateLoop>d__56(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					<timer>5__1 = <>4__this._configUpdateInterval.Value * 60f;
					goto IL_00e0;
				case 2:
					{
						<>1__state = -1;
						<timer>5__1 -= 1f;
						goto IL_00e0;
					}
					IL_00e0:
					if (<timer>5__1 > 0f)
					{
						<>4__this._timeUntilNextUpdate = <timer>5__1;
						<>4__this.UpdateUIReport();
						<>2__current = (object)new WaitForSeconds(1f);
						<>1__state = 2;
						return true;
					}
					break;
				}
				<>2__current = <>4__this.TriggerFullSync(<>4__this._configPlayerId.Value?.Trim());
				<>1__state = 1;
				return true;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <CheckPluginsRoutine>d__65 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CompPluginCheck <>4__this;

			private string <url>5__1;

			private UnityWebRequest <w>5__2;

			private string[] <>s__3;

			private int <>s__4;

			private string <line>5__5;

			private string[] <p>5__6;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <CheckPluginsRoutine>d__65(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<url>5__1 = null;
				<w>5__2 = null;
				<>s__3 = null;
				<line>5__5 = null;
				<p>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<url>5__1 = "https://gist.githubusercontent.com/Kingcox22/32b1bcf1bdbec4ec47d086fec70628c1/raw/allowed_mods.txt?t=" + DateTime.Now.Ticks;
						<w>5__2 = UnityWebRequest.Get(<url>5__1);
						<>1__state = -3;
						<>2__current = <w>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<w>5__2.result == 1)
						{
							<>4__this._allowedModsMap.Clear();
							<>s__3 = <w>5__2.downloadHandler.text.Split('\n');
							for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
							{
								<line>5__5 = <>s__3[<>s__4];
								if (!string.IsNullOrWhiteSpace(<line>5__5))
								{
									if (<line>5__5.Contains("|"))
									{
										<p>5__6 = <line>5__5.Split('|');
										<>4__this._allowedModsMap[<p>5__6[1].Trim()] = <p>5__6[0].Trim();
										<p>5__6 = null;
									}
									else
									{
										<>4__this._allowedModsMap[<line>5__5.Trim()] = <line>5__5.Trim();
									}
									<line>5__5 = null;
								}
							}
							<>s__3 = null;
						}
						<>m__Finally1();
						<w>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<w>5__2 != null)
				{
					((IDisposable)<w>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <DownloadProfilePic>d__64 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			public CompPluginCheck <>4__this;

			private UnityWebRequest <request>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DownloadProfilePic>d__64(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<request>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						if (string.IsNullOrEmpty(url))
						{
							return false;
						}
						if (url.StartsWith("http://"))
						{
							url = url.Replace("http://", "https://");
						}
						<request>5__1 = UnityWebRequestTexture.GetTexture(url);
						<>1__state = -3;
						<>2__current = <request>5__1.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<request>5__1.result == 1)
						{
							<>4__this._profileIcon.texture = (Texture)(object)DownloadHandlerTexture.GetContent(<request>5__1);
							<>4__this._profilePicContainer.SetActive(true);
						}
						<>m__Finally1();
						<request>5__1 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<request>5__1 != null)
				{
					((IDisposable)<request>5__1).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <FetchEvents>d__59 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CompPluginCheck <>4__this;

			private string <url>5__1;

			private UnityWebRequest <r>5__2;

			private JArray <ja>5__3;

			private DateTime <today>5__4;

			private IEnumerator<JToken> <>s__5;

			private JToken <item>5__6;

			private string <dateStr>5__7;

			private DateTime <dt>5__8;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FetchEvents>d__59(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<url>5__1 = null;
				<r>5__2 = null;
				<ja>5__3 = null;
				<>s__5 = null;
				<item>5__6 = null;
				<dateStr>5__7 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<url>5__1 = "https://sbgleague.com/api/apps/69b0f4aba3975f2440fbf070/entities/ProSeriesEvent?sort=event_date&limit=50";
						<r>5__2 = UnityWebRequest.Get(<url>5__1);
						<>1__state = -3;
						<r>5__2.SetRequestHeader("X-App-Id", "69b0f4aba3975f2440fbf070");
						<r>5__2.SetRequestHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJraW5nY294MjJAZ21haWwuY29tIiwiZXhwIjoxNzgyNzg5NDU0LCJpYXQiOjE3NzUwMTM0NTR9.2pCmAKXH98n3fvUaheN-e6kx3BoJflStfUb-Kq-i-gU");
						<r>5__2.certificateHandler = (CertificateHandler)(object)new BypassCertificate();
						<>2__current = <r>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<r>5__2.result == 1)
						{
							try
							{
								<ja>5__3 = JArray.Parse(<r>5__2.downloadHandler.text);
								<>4__this._upcomingEvents.Clear();
								<today>5__4 = DateTime.Now.Date;
								<>s__5 = <ja>5__3.GetEnumerator();
								try
								{
									while (<>s__5.MoveNext())
									{
										<item>5__6 = <>s__5.Current;
										<dateStr>5__7 = ((object)<item>5__6[(object)"event_date"])?.ToString() ?? "";
										if (DateTime.TryParse(<dateStr>5__7, out <dt>5__8) && <dt>5__8.Date >= <today>5__4)
										{
											<>4__this._upcomingEvents.Add(new ProSeriesEvent
											{
												name = (((object)<item>5__6[(object)"name"])?.ToString() ?? "Tournament"),
												event_date = <dateStr>5__7
											});
											if (<>4__this._upcomingEvents.Count >= 5)
											{
												break;
											}
										}
										<dateStr>5__7 = null;
										<item>5__6 = null;
									}
								}
								finally
								{
									if (<>s__5 != null)
									{
										<>s__5.Dispose();
									}
								}
								<>s__5 = null;
								<ja>5__3 = null;
							}
							catch
							{
							}
						}
						<>m__Finally1();
						<r>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<r>5__2 != null)
				{
					((IDisposable)<r>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <FetchLeaderboardRank>d__62 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string id;

			public CompPluginCheck <>4__this;

			private string <filter>5__1;

			private string <url>5__2;

			private UnityWebRequest <r>5__3;

			private JArray <ps>5__4;

			private int <rank>5__5;

			private IEnumerator<JToken> <>s__6;

			private JToken <p>5__7;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FetchLeaderboardRank>d__62(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<filter>5__1 = null;
				<url>5__2 = null;
				<r>5__3 = null;
				<ps>5__4 = null;
				<>s__6 = null;
				<p>5__7 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<filter>5__1 = "%7B%22matches_played%22%3A%7B%22%24gt%22%3A0%7D%7D";
						<url>5__2 = "https://sbgleague.com/api/apps/69b0f4aba3975f2440fbf070/entities/Player?q=" + <filter>5__1 + "&sort=-current_mmr";
						<r>5__3 = UnityWebRequest.Get(<url>5__2);
						<>1__state = -3;
						<r>5__3.SetRequestHeader("X-App-Id", "69b0f4aba3975f2440fbf070");
						<r>5__3.SetRequestHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJraW5nY294MjJAZ21haWwuY29tIiwiZXhwIjoxNzgyNzg5NDU0LCJpYXQiOjE3NzUwMTM0NTR9.2pCmAKXH98n3fvUaheN-e6kx3BoJflStfUb-Kq-i-gU");
						<r>5__3.certificateHandler = (CertificateHandler)(object)new BypassCertificate();
						<>2__current = <r>5__3.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<r>5__3.result == 1)
						{
							try
							{
								<ps>5__4 = JArray.Parse(<r>5__3.downloadHandler.text);
								<>4__this._totalPlayers = ((JContainer)<ps>5__4).Count.ToString();
								<rank>5__5 = 1;
								<>s__6 = <ps>5__4.GetEnumerator();
								try
								{
									while (<>s__6.MoveNext())
									{
										<p>5__7 = <>s__6.Current;
										if (((object)<p>5__7[(object)"id"])?.ToString() == id)
										{
											<>4__this._playerRank = <rank>5__5.ToString();
											break;
										}
										<rank>5__5++;
										<p>5__7 = null;
									}
								}
								finally
								{
									if (<>s__6 != null)
									{
										<>s__6.Dispose();
									}
								}
								<>s__6 = null;
								<ps>5__4 = null;
							}
							catch
							{
							}
						}
						<>m__Finally1();
						<r>5__3 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<r>5__3 != null)
				{
					((IDisposable)<r>5__3).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <FetchPlayerData>d__61 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string id;

			public CompPluginCheck <>4__this;

			private string <url>5__1;

			private UnityWebRequest <r>5__2;

			private JArray <ja>5__3;

			private JToken <p>5__4;

			private float <avg>5__5;

			private float <w>5__6;

			private float <t>5__7;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FetchPlayerData>d__61(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<url>5__1 = null;
				<r>5__2 = null;
				<ja>5__3 = null;
				<p>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Invalid comparison between Unknown and I4
				bool result;
				try
				{
					switch (<>1__state)
					{
					default:
						result = false;
						break;
					case 0:
						<>1__state = -1;
						<url>5__1 = "https://sbgleague.com/api/apps/69b0f4aba3975f2440fbf070/entities/Player?q=" + UnityWebRequest.EscapeURL("{\"id\":\"" + id + "\"}");
						<r>5__2 = UnityWebRequest.Get(<url>5__1);
						<>1__state = -3;
						<r>5__2.SetRequestHeader("X-App-Id", "69b0f4aba3975f2440fbf070");
						<r>5__2.SetRequestHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJraW5nY294MjJAZ21haWwuY29tIiwiZXhwIjoxNzgyNzg5NDU0LCJpYXQiOjE3NzUwMTM0NTR9.2pCmAKXH98n3fvUaheN-e6kx3BoJflStfUb-Kq-i-gU");
						<r>5__2.certificateHandler = (CertificateHandler)(object)new BypassCertificate();
						<>2__current = <r>5__2.SendWebRequest();
						<>1__state = 1;
						result = true;
						break;
					case 1:
						{
							<>1__state = -3;
							if ((int)<r>5__2.result == 1)
							{
								try
								{
									<ja>5__3 = JArray.Parse(<r>5__2.downloadHandler.text);
									if (((JContainer)<ja>5__3).Count != 0)
									{
										<p>5__4 = <ja>5__3[0];
										<>4__this._activeUsername = ((object)<p>5__4[(object)"display_name"])?.ToString() ?? "Player";
										<>4__this._playerMMR = ((object)<p>5__4[(object)"current_mmr"])?.ToString() ?? "0";
										<>4__this._playerPeak = ((object)<p>5__4[(object)"highest_mmr_ever"])?.ToString() ?? "0";
										<>4__this._matches = ((object)<p>5__4[(object)"matches_played"])?.ToString() ?? "0";
										<>4__this._lastChange = ((object)<p>5__4[(object)"latest_mmr_change"])?.ToString() ?? "0";
										<>4__this._top3s = ((object)<p>5__4[(object)"top_3_finishes"])?.ToString() ?? "0";
										float.TryParse(((object)<p>5__4[(object)"average_score_vs_par"])?.ToString() ?? "0", out <avg>5__5);
										<>4__this._avgScore = <avg>5__5.ToString("F1");
										<w>5__6 = 0f;
										<t>5__7 = 0f;
										float.TryParse(((object)<p>5__4[(object)"wins"])?.ToString(), out <w>5__6);
										float.TryParse(((object)<p>5__4[(object)"matches_played"])?.ToString(), out <t>5__7);
										<>4__this._winRate = ((<t>5__7 > 0f) ? $"{<w>5__6 / <t>5__7 * 100f:F0}%" : "0%");
										if (<p>5__4[(object)"profile_pic_url"] != null && !string.IsNullOrEmpty(((object)<p>5__4[(object)"profile_pic_url"]).ToString()))
										{
											((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DownloadProfilePic(((object)<p>5__4[(object)"profile_pic_url"]).ToString()));
										}
										<ja>5__3 = null;
										<p>5__4 = null;
										goto IL_03f3;
									}
									<>4__this.ResetPlayerData("Invalid ID");
									result = false;
								}
								catch
								{
									<>4__this.ResetPlayerData("Data Error");
									goto IL_03f3;
								}
								<>m__Finally1();
								break;
							}
							<>4__this.ResetPlayerData("API Offline");
							goto IL_03f3;
						}
						IL_03f3:
						<>m__Finally1();
						<r>5__2 = null;
						result = false;
						break;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
				return result;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<r>5__2 != null)
				{
					((IDisposable)<r>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <FetchRecentMatches>d__58 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string id;

			public CompPluginCheck <>4__this;

			private string <query>5__1;

			private string <url>5__2;

			private UnityWebRequest <r>5__3;

			private JArray <ja>5__4;

			private IEnumerator<JObject> <>s__5;

			private JObject <item>5__6;

			private int <pos>5__7;

			private int <adj>5__8;

			private int <par>5__9;

			private int <mmr>5__10;

			private int <post>5__11;

			private string <dtRaw>5__12;

			private string <dateStr>5__13;

			private DateTime <dt>5__14;

			private string <posStr>5__15;

			private string <mmrColor>5__16;

			private string <parSign>5__17;

			private string <summary>5__18;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FetchRecentMatches>d__58(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<query>5__1 = null;
				<url>5__2 = null;
				<r>5__3 = null;
				<ja>5__4 = null;
				<>s__5 = null;
				<item>5__6 = null;
				<dtRaw>5__12 = null;
				<dateStr>5__13 = null;
				<posStr>5__15 = null;
				<mmrColor>5__16 = null;
				<parSign>5__17 = null;
				<summary>5__18 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<query>5__1 = "{\"player_id\":\"" + id + "\"}";
						<url>5__2 = "https://sbgleague.com/api/apps/69b0f4aba3975f2440fbf070/entities/MatchEntry?q=" + UnityWebRequest.EscapeURL(<query>5__1) + "&sort=-match_date&limit=5";
						<r>5__3 = UnityWebRequest.Get(<url>5__2);
						<>1__state = -3;
						<r>5__3.SetRequestHeader("X-App-Id", "69b0f4aba3975f2440fbf070");
						<r>5__3.SetRequestHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJraW5nY294MjJAZ21haWwuY29tIiwiZXhwIjoxNzgyNzg5NDU0LCJpYXQiOjE3NzUwMTM0NTR9.2pCmAKXH98n3fvUaheN-e6kx3BoJflStfUb-Kq-i-gU");
						<r>5__3.certificateHandler = (CertificateHandler)(object)new BypassCertificate();
						<>2__current = <r>5__3.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<r>5__3.result == 1)
						{
							try
							{
								<ja>5__4 = JArray.Parse(<r>5__3.downloadHandler.text);
								<>4__this._recentMatches.Clear();
								<>s__5 = ((IEnumerable)<ja>5__4).OfType<JObject>().GetEnumerator();
								try
								{
									while (<>s__5.MoveNext())
									{
										<item>5__6 = <>s__5.Current;
										JToken obj = <item>5__6["finish_position"];
										<pos>5__7 = (int)((obj != null) ? Extensions.Value<float>((IEnumerable<JToken>)obj) : 0f);
										JToken obj2 = <item>5__6["adjusted_match_score"];
										<adj>5__8 = (int)((obj2 != null) ? Extensions.Value<float>((IEnumerable<JToken>)obj2) : 0f);
										JToken obj3 = <item>5__6["score_vs_par"];
										<par>5__9 = (int)((obj3 != null) ? Extensions.Value<float>((IEnumerable<JToken>)obj3) : 0f);
										JToken obj4 = <item>5__6["mmr_change"];
										<mmr>5__10 = (int)((obj4 != null) ? Extensions.Value<float>((IEnumerable<JToken>)obj4) : 0f);
										JToken obj5 = <item>5__6["post_match_mmr"];
										<post>5__11 = (int)((obj5 != null) ? Extensions.Value<float>((IEnumerable<JToken>)obj5) : 0f);
										<dtRaw>5__12 = ((object)<item>5__6["match_date"])?.ToString() ?? "";
										<dateStr>5__13 = (DateTime.TryParse(<dtRaw>5__12, out <dt>5__14) ? <dt>5__14.ToString("MM/dd") : "??/??");
										<posStr>5__15 = <>4__this.GetOrdinal(<pos>5__7);
										<mmrColor>5__16 = ((<mmr>5__10 >= 0) ? "#55FF55" : "#FF5555");
										<parSign>5__17 = ((<par>5__9 > 0) ? "+" : "");
										<summary>5__18 = string.Format("<color=#888888>{0}</color> | <b>Pos: {1}</b> | Score: {2} ({3}{4}) | MMR: {5} (<color={6}>{7}{8}</color>)", <dateStr>5__13, <posStr>5__15, <adj>5__8, <parSign>5__17, <par>5__9, <post>5__11, <mmrColor>5__16, (<mmr>5__10 >= 0) ? "+" : "", <mmr>5__10);
										<>4__this._recentMatches.Add(new MatchEntry
										{
											match_summary = <summary>5__18,
											match_date = <dtRaw>5__12
										});
										<dtRaw>5__12 = null;
										<dateStr>5__13 = null;
										<posStr>5__15 = null;
										<mmrColor>5__16 = null;
										<parSign>5__17 = null;
										<summary>5__18 = null;
										<item>5__6 = null;
									}
								}
								finally
								{
									if (<>s__5 != null)
									{
										<>s__5.Dispose();
									}
								}
								<>s__5 = null;
								<ja>5__4 = null;
							}
							catch
							{
							}
						}
						<>m__Finally1();
						<r>5__3 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<r>5__3 != null)
				{
					((IDisposable)<r>5__3).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <GetNetworkTime>d__63 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CompPluginCheck <>4__this;

			private string <url>5__1;

			private UnityWebRequest <webRequest>5__2;

			private JObject <json>5__3;

			private string <timeStr>5__4;

			private DateTime <dt>5__5;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetNetworkTime>d__63(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<url>5__1 = null;
				<webRequest>5__2 = null;
				<json>5__3 = null;
				<timeStr>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Invalid comparison between Unknown and I4
				bool result;
				try
				{
					switch (<>1__state)
					{
					default:
						result = false;
						break;
					case 0:
						<>1__state = -1;
						<url>5__1 = "https://timeapi.io/api/Time/current/zone?timeZone=UTC";
						<webRequest>5__2 = UnityWebRequest.Get(<url>5__1);
						<>1__state = -3;
						<webRequest>5__2.timeout = 5;
						<>2__current = <webRequest>5__2.SendWebRequest();
						<>1__state = 1;
						result = true;
						break;
					case 1:
						{
							<>1__state = -3;
							if ((int)<webRequest>5__2.result == 1)
							{
								try
								{
									<json>5__3 = JObject.Parse(<webRequest>5__2.downloadHandler.text);
									<timeStr>5__4 = ((object)<json>5__3["dateTime"])?.ToString();
									if (!DateTime.TryParse(<timeStr>5__4, out <dt>5__5))
									{
										<json>5__3 = null;
										<timeStr>5__4 = null;
										goto IL_0127;
									}
									<>4__this._lastSyncTime = <dt>5__5.ToLocalTime().ToString("HH:mm:ss");
									result = false;
								}
								catch
								{
									goto IL_0127;
								}
								<>m__Finally1();
								break;
							}
							goto IL_0127;
						}
						IL_0127:
						<>m__Finally1();
						<webRequest>5__2 = null;
						<>4__this._lastSyncTime = DateTime.Now.ToString("HH:mm:ss") + " (Local)";
						result = false;
						break;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
				return result;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<webRequest>5__2 != null)
				{
					((IDisposable)<webRequest>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <ResolvePlayerIdFromName>d__60 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string playerName;

			public CompPluginCheck <>4__this;

			private string <query>5__1;

			private string <url>5__2;

			private UnityWebRequest <r>5__3;

			private JArray <res>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ResolvePlayerIdFromName>d__60(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<query>5__1 = null;
				<url>5__2 = null;
				<r>5__3 = null;
				<res>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<query>5__1 = "{\"display_name\":{\"$regex\":\"^" + playerName + "$\",\"$options\":\"i\"}}";
						<url>5__2 = "https://sbgleague.com/api/apps/69b0f4aba3975f2440fbf070/entities/Player?q=" + UnityWebRequest.EscapeURL(<query>5__1);
						<r>5__3 = UnityWebRequest.Get(<url>5__2);
						<>1__state = -3;
						<r>5__3.SetRequestHeader("X-App-Id", "69b0f4aba3975f2440fbf070");
						<r>5__3.SetRequestHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJraW5nY294MjJAZ21haWwuY29tIiwiZXhwIjoxNzgyNzg5NDU0LCJpYXQiOjE3NzUwMTM0NTR9.2pCmAKXH98n3fvUaheN-e6kx3BoJflStfUb-Kq-i-gU");
						<r>5__3.certificateHandler = (CertificateHandler)(object)new BypassCertificate();
						<>2__current = <r>5__3.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<r>5__3.result == 1)
						{
							try
							{
								<res>5__4 = JArray.Parse(<r>5__3.downloadHandler.text);
								if (((JContainer)<res>5__4).Count > 0)
								{
									<>4__this.ResolvedID = ((object)<res>5__4[0][(object)"id"])?.ToString() ?? "None";
									<>4__this.ResolvedName = ((object)<res>5__4[0][(object)"display_name"])?.ToString() ?? "Not Found";
									if (<>4__this._configPlayerId.Value == "PASTE_ID_HERE")
									{
										<>4__this._configPlayerId.Value = <>4__this.ResolvedID;
										((BaseUnityPlugin)<>4__this).Config.Save();
									}
								}
								else
								{
									<>4__this.ResolvedID = "None";
								}
								<res>5__4 = null;
							}
							catch
							{
								<>4__this.ResolvedID = "None";
							}
						}
						<>m__Finally1();
						<r>5__3 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<r>5__3 != null)
				{
					((IDisposable)<r>5__3).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <TriggerFullSync>d__57 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string configId;

			public CompPluginCheck <>4__this;

			private string <idToUse>5__1;

			private string <steamName>5__2;

			private MenuTabs <menuTabs>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TriggerFullSync>d__57(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<idToUse>5__1 = null;
				<steamName>5__2 = null;
				<menuTabs>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (<>4__this._isSyncing)
					{
						return false;
					}
					<>4__this._isSyncing = true;
					<>4__this._syncStatus = "Syncing...";
					<>4__this.ResetPlayerData();
					<>4__this.UpdateUIReport();
					<idToUse>5__1 = "";
					<steamName>5__2 = <>4__this.GetInGameName();
					if (!string.IsNullOrEmpty(<steamName>5__2))
					{
						<>2__current = <>4__this.ResolvePlayerIdFromName(<steamName>5__2);
						<>1__state = 1;
						return true;
					}
					goto IL_0129;
				case 1:
					<>1__state = -1;
					if (<>4__this.ResolvedID != "None")
					{
						<idToUse>5__1 = <>4__this.ResolvedID;
					}
					goto IL_0129;
				case 2:
					<>1__state = -1;
					<>2__current = <>4__this.FetchPlayerData(<idToUse>5__1);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>2__current = <>4__this.FetchLeaderboardRank(<idToUse>5__1);
					<>1__state = 4;
					return true;
				case 4:
					<>1__state = -1;
					<>2__current = <>4__this.GetNetworkTime();
					<>1__state = 5;
					return true;
				case 5:
					<>1__state = -1;
					<>2__current = <>4__this.FetchEvents();
					<>1__state = 6;
					return true;
				case 6:
					<>1__state = -1;
					<>2__current = <>4__this.FetchRecentMatches(<idToUse>5__1);
					<>1__state = 7;
					return true;
				case 7:
					{
						<>1__state = -1;
						<>4__this._syncStatus = ((<>4__this._activeUsername == "Invalid ID" || <>4__this._activeUsername == "API Offline") ? "Error" : "Connected");
						break;
					}
					IL_0129:
					if ((string.IsNullOrEmpty(<idToUse>5__1) || <idToUse>5__1 == "None") && !string.IsNullOrEmpty(configId) && configId != "PASTE_ID_HERE")
					{
						<idToUse>5__1 = configId;
						<>4__this.ResolvedID = configId;
					}
					if (!string.IsNullOrEmpty(<idToUse>5__1) && <idToUse>5__1 != "None" && <idToUse>5__1 != "PASTE_ID_HERE")
					{
						<>2__current = <>4__this.CheckPluginsRoutine();
						<>1__state = 2;
						return true;
					}
					<>4__this._syncStatus = "ID Required";
					<>4__this.ResetPlayerData("Link ID in Settings");
					break;
				}
				<menuTabs>5__3 = Object.FindFirstObjectByType<MenuTabs>();
				if ((Object)(object)<menuTabs>5__3 != (Object)null)
				{
					SBGLTabManager.Inject(<menuTabs>5__3);
				}
				<>4__this._isSyncing = false;
				<>4__this.UpdateUIReport();
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private const string ALLOWED_MODS_URL = "https://gist.githubusercontent.com/Kingcox22/32b1bcf1bdbec4ec47d086fec70628c1/raw/allowed_mods.txt";

		private const string APP_ID = "69b0f4aba3975f2440fbf070";

		private const string AUTH_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJraW5nY294MjJAZ21haWwuY29tIiwiZXhwIjoxNzgyNzg5NDU0LCJpYXQiOjE3NzUwMTM0NTR9.2pCmAKXH98n3fvUaheN-e6kx3BoJflStfUb-Kq-i-gU";

		private const int SBGL_NET_CHANNEL = 2622;

		private Dictionary<ulong, string> _remotePlayerMods = new Dictionary<ulong, string>();

		private GameObject _canvasObj;

		private GameObject _profilePicContainer;

		private GameObject _bgObj;

		private GameObject _warnContainer;

		private TextMeshProUGUI _statsText;

		private TextMeshProUGUI _illegalWarningText;

		private TextMeshProUGUI _missingWarningText;

		private Image _bgImage;

		private RawImage _profileIcon;

		private RectTransform _bgRect;

		private Dictionary<string, string> _allowedModsMap = new Dictionary<string, string>();

		private List<string> _missingModNames = new List<string>();

		public List<ProSeriesEvent> _upcomingEvents = new List<ProSeriesEvent>();

		public List<MatchEntry> _recentMatches = new List<MatchEntry>();

		private bool _isSyncing = false;

		private float _timeUntilNextUpdate = 0f;

		private string _lastSyncTime = "Never";

		public ConfigEntry<float> _configX;

		public ConfigEntry<float> _configY;

		public ConfigEntry<float> _configWidth;

		public ConfigEntry<float> _configAlpha;

		public ConfigEntry<float> _configUpdateInterval;

		public ConfigEntry<bool> _configShowModList;

		public ConfigEntry<bool> _configShowLobbyMods;

		public ConfigEntry<bool> _configShowDebugWindow;

		public ConfigEntry<Key> _configToggleModsKey;

		public ConfigEntry<Key> _configRefreshKey;

		public ConfigEntry<string> _configPlayerId;

		public string _activeUsername = "Searching...";

		public string _playerRank = "N/A";

		public string _totalPlayers = "0";

		public string _playerMMR = "0";

		public string _matches = "0";

		public string _playerPeak = "0";

		public string _winRate = "0%";

		public string _lastChange = "0";

		public string _top3s = "0";

		public string _avgScore = "0.0";

		public string _syncStatus = "Idle";

		public string ResolvedName = "Not Found";

		public string ResolvedID = "None";

		private void Awake()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Expected O, but got Unknown
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Expected O, but got Unknown
			_configX = ((BaseUnityPlugin)this).Config.Bind<float>("UI Position", "X Offset", 20f, new ConfigDescription("Horizontal.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 4000f), Array.Empty<object>()));
			_configY = ((BaseUnityPlugin)this).Config.Bind<float>("UI Position", "Y Offset", 100f, new ConfigDescription("Vertical.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 4000f), Array.Empty<object>()));
			_configWidth = ((BaseUnityPlugin)this).Config.Bind<float>("UI Size", "Width", 200f, new ConfigDescription("Width.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(150f, 800f), Array.Empty<object>()));
			_configAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("UI Appearance", "Opacity", 0.85f, new ConfigDescription("Alpha.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			_configShowModList = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Appearance", "Show My Mods", false, "Toggle Local List.");
			_configShowLobbyMods = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Appearance", "Show Lobby Mods", false, "Toggle Remote Lists.");
			_configShowDebugWindow = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Appearance", "Show Debug Window", false, "Toggle Debug Window.");
			_configUpdateInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Logic", "Update Interval", 5f, new ConfigDescription("Minutes.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>()));
			_configToggleModsKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "Toggle Key", (Key)102, "F9.");
			_configRefreshKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "Refresh Key", (Key)103, "F10.");
			_configPlayerId = ((BaseUnityPlugin)this).Config.Bind<string>("League", "Player ID", "PASTE_ID_HERE", "ID.");
			Harmony val = new Harmony("com.kingcox.sbgl.compplugincheck");
			val.PatchAll();
			((MonoBehaviour)this).StartCoroutine(GetNetworkTime());
		}

		private void Start()
		{
			if (!string.IsNullOrEmpty(_configPlayerId.Value) && _configPlayerId.Value != "PASTE_ID_HERE")
			{
				ResolvedID = _configPlayerId.Value;
			}
			CreateUI();
			((MonoBehaviour)this).StartCoroutine(AutoUpdateLoop());
			SteamNetworking.OnP2PSessionRequest = delegate(SteamId steamid)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				SteamNetworking.AcceptP2PSessionWithUser(steamid);
				Debug.Log((object)$"[SBGL-Debug] Accepted P2P session from {steamid}");
			};
		}

		private void Update()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			Keyboard current = Keyboard.current;
			if (current != null)
			{
				if (((ButtonControl)current[_configToggleModsKey.Value]).wasPressedThisFrame)
				{
					_configShowModList.Value = !_configShowModList.Value;
					UpdateUIReport();
				}
				if (((ButtonControl)current[_configRefreshKey.Value]).wasPressedThisFrame)
				{
					TriggerManualSync();
				}
				if (((ButtonControl)current[(Key)104]).wasPressedThisFrame)
				{
					_configShowDebugWindow.Value = !_configShowDebugWindow.Value;
					UpdateUIReport();
				}
				if ((Object)(object)_bgRect != (Object)null)
				{
					_bgRect.anchoredPosition = new Vector2(_configX.Value, _configY.Value);
					_bgRect.sizeDelta = new Vector2(_configWidth.Value, _bgRect.sizeDelta.y);
					((Graphic)_bgImage).color = new Color(0f, 0f, 0f, _configAlpha.Value);
				}
				ListenForModReports();
				if (Time.frameCount % 600 == 0)
				{
					BroadcastMyMods();
				}
			}
		}

		private void BroadcastMyMods()
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			if (!SteamClient.IsValid)
			{
				return;
			}
			StringBuilder stringBuilder = new StringBuilder("SBGL_REPORT:");
			foreach (PluginInfo value in Chainloader.PluginInfos.Values)
			{
				if (!value.Metadata.GUID.StartsWith("BepInEx") && !value.Metadata.GUID.ToLower().Contains("compplugincheck"))
				{
					stringBuilder.Append($"{value.Metadata.Name}|{value.Metadata.Version};");
				}
			}
			byte[] bytes = Encoding.UTF8.GetBytes(stringBuilder.ToString());
			foreach (Friend friend in SteamFriends.GetFriends())
			{
				SteamNetworking.SendP2PPacket(friend.Id, bytes, -1, 2622, (P2PSend)0);
			}
		}

		private void ListenForModReports()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if (!SteamClient.IsValid)
			{
				return;
			}
			uint num = default(uint);
			while (SteamNetworking.IsP2PPacketAvailable(ref num, 2622))
			{
				byte[] array = new byte[num];
				uint num2 = 0u;
				SteamId val = default(SteamId);
				if (!SteamNetworking.ReadP2PPacket(array, ref num2, ref val, 2622))
				{
					continue;
				}
				string @string = Encoding.UTF8.GetString(array);
				if (@string.StartsWith("SBGL_REPORT:"))
				{
					ulong value = val.Value;
					if (!_remotePlayerMods.ContainsKey(value))
					{
						Debug.Log((object)$"[SBGL-Debug] Handshake: New player {value} detected. Replying...");
						_remotePlayerMods[value] = @string.Replace("SBGL_REPORT:", "");
						BroadcastMyMods();
					}
					else
					{
						_remotePlayerMods[value] = @string.Replace("SBGL_REPORT:", "");
					}
					UpdateUIReport();
				}
			}
		}

		private void DrawLobbyModWindow()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginArea(new Rect((float)(Screen.width - 350), 10f, 340f, 300f), "LOBBY MOD INSPECTOR", GUI.skin.window);
			if (_remotePlayerMods.Count == 0)
			{
				GUILayout.Label("No remote mod data received yet...", Array.Empty<GUILayoutOption>());
			}
			else
			{
				foreach (KeyValuePair<ulong, string> remotePlayerMod in _remotePlayerMods)
				{
					GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
					GUILayout.Label($"Player ID: {remotePlayerMod.Key}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) });
					GUILayout.Label("Mods: " + remotePlayerMod.Value, Array.Empty<GUILayoutOption>());
					GUILayout.EndVertical();
				}
			}
			if (GUILayout.Button("Force Manual Broadcast", Array.Empty<GUILayoutOption>()))
			{
				BroadcastMyMods();
			}
			GUILayout.EndArea();
		}

		public void TriggerManualSync()
		{
			((MonoBehaviour)this).StopAllCoroutines();
			_isSyncing = false;
			((MonoBehaviour)this).StartCoroutine(AutoUpdateLoop());
		}

		private string GetOrdinal(int number)
		{
			if (number <= 0)
			{
				return number.ToString();
			}
			int num = number % 100;
			int num2 = num;
			if ((uint)(num2 - 11) <= 2u)
			{
				return number + "th";
			}
			return (number % 10) switch
			{
				1 => number + "st", 
				2 => number + "nd", 
				3 => number + "rd", 
				_ => number + "th", 
			};
		}

		private void ResetPlayerData(string userStatus = "Updating...")
		{
			_activeUsername = userStatus;
			_playerRank = "N/A";
			_playerMMR = "0";
			_playerPeak = "0";
			_matches = "0";
			_lastChange = "0";
			_top3s = "0";
			_avgScore = "0.0";
			_winRate = "0%";
			if ((Object)(object)_profilePicContainer != (Object)null)
			{
				_profilePicContainer.SetActive(false);
			}
		}

		private string GetInGameName()
		{
			try
			{
				Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "com.rlabrecque.steamworks.net" || a.GetName().Name.Contains("Steamworks"));
				if (assembly != null)
				{
					Type type = assembly.GetType("Steamworks.SteamClient");
					if (type != null)
					{
						string text = type.GetProperty("Name", BindingFlags.Static | BindingFlags.Public)?.GetValue(null)?.ToString();
						if (!string.IsNullOrEmpty(text))
						{
							return text;
						}
					}
				}
			}
			catch (Exception ex)
			{
				Debug.Log((object)("[SBGL] Steam Reflection failed (Safe): " + ex.Message));
			}
			return "";
		}

		[IteratorStateMachine(typeof(<AutoUpdateLoop>d__56))]
		private IEnumerator AutoUpdateLoop()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AutoUpdateLoop>d__56(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<TriggerFullSync>d__57))]
		private IEnumerator TriggerFullSync(string configId)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TriggerFullSync>d__57(0)
			{
				<>4__this = this,
				configId = configId
			};
		}

		[IteratorStateMachine(typeof(<FetchRecentMatches>d__58))]
		private IEnumerator FetchRecentMatches(string id)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FetchRecentMatches>d__58(0)
			{
				<>4__this = this,
				id = id
			};
		}

		[IteratorStateMachine(typeof(<FetchEvents>d__59))]
		private IEnumerator FetchEvents()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FetchEvents>d__59(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<ResolvePlayerIdFromName>d__60))]
		private IEnumerator ResolvePlayerIdFromName(string playerName)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ResolvePlayerIdFromName>d__60(0)
			{
				<>4__this = this,
				playerName = playerName
			};
		}

		[IteratorStateMachine(typeof(<FetchPlayerData>d__61))]
		private IEnumerator FetchPlayerData(string id)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FetchPlayerData>d__61(0)
			{
				<>4__this = this,
				id = id
			};
		}

		[IteratorStateMachine(typeof(<FetchLeaderboardRank>d__62))]
		private IEnumerator FetchLeaderboardRank(string id)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FetchLeaderboardRank>d__62(0)
			{
				<>4__this = this,
				id = id
			};
		}

		[IteratorStateMachine(typeof(<GetNetworkTime>d__63))]
		private IEnumerator GetNetworkTime()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetNetworkTime>d__63(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<DownloadProfilePic>d__64))]
		private IEnumerator DownloadProfilePic(string url)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DownloadProfilePic>d__64(0)
			{
				<>4__this = this,
				url = url
			};
		}

		[IteratorStateMachine(typeof(<CheckPluginsRoutine>d__65))]
		private IEnumerator CheckPluginsRoutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CheckPluginsRoutine>d__65(0)
			{
				<>4__this = this
			};
		}

		private void UpdateUIReport()
		{
			if (!((Object)(object)_statsText != (Object)null))
			{
				return;
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("User: <color=#FFFFFF>" + _activeUsername + "</color>");
			stringBuilder.AppendLine("Rank: <color=#00FF00>#" + _playerRank + "</color> / " + _totalPlayers);
			stringBuilder.AppendLine("Win Rate: <color=#FFA500>" + _winRate + "</color>");
			float.TryParse(_lastChange, out var result);
			stringBuilder.AppendLine("MMR: <color=#00FFFF>" + _playerMMR + "</color> (<color=" + ((result >= 0f) ? "#55FF55" : "#FF5555") + ">" + ((result >= 0f) ? "+" : "") + _lastChange + "</color>)");
			stringBuilder.AppendLine("Avg. Par: <color=#CC88FF>" + _avgScore + "</color>");
			stringBuilder.AppendLine("Matches: <color=#FFFFFF>" + _matches + "</color> | Top 3s: <color=#00FF00>" + _top3s + "</color>");
			stringBuilder.AppendLine("Peak MMR: <color=#FFFF00>" + _playerPeak + "</color>");
			if (_configShowModList.Value)
			{
				stringBuilder.AppendLine("--- <color=#AAAAAA>MY MODS</color> ---");
				foreach (PluginInfo value in Chainloader.PluginInfos.Values)
				{
					if (!value.Metadata.GUID.ToLower().Contains("compplugincheck") && !value.Metadata.GUID.StartsWith("BepInEx"))
					{
						stringBuilder.AppendLine((_allowedModsMap.ContainsKey(value.Metadata.GUID) ? "<color=#00FF00>O</color>" : "<color=#FF0000>X</color>") + " <size=11>" + value.Metadata.Name + "</size>");
					}
				}
			}
			((TMP_Text)_statsText).text = stringBuilder.ToString();
		}

		private void CreateUI()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Expected O, but got Unknown
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			_canvasObj = new GameObject("SBG_Canvas");
			Canvas val = _canvasObj.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			val.sortingOrder = 99999;
			_bgObj = new GameObject("BG");
			_bgObj.transform.SetParent(_canvasObj.transform, false);
			_bgImage = _bgObj.AddComponent<Image>();
			((Graphic)_bgImage).color = new Color(0f, 0f, 0f, _configAlpha.Value);
			_bgRect = _bgObj.GetComponent<RectTransform>();
			RectTransform bgRect = _bgRect;
			RectTransform bgRect2 = _bgRect;
			Vector2 val2 = (_bgRect.pivot = Vector2.zero);
			Vector2 val5 = (bgRect.anchorMin = (bgRect2.anchorMax = val2));
			VerticalLayoutGroup val6 = _bgObj.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val6).padding = new RectOffset(10, 10, 10, 10);
			_bgObj.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			_profilePicContainer = new GameObject("PicContainer");
			_profilePicContainer.transform.SetParent(_bgObj.transform, false);
			RectTransform val7 = _profilePicContainer.AddComponent<RectTransform>();
			((Vector2)(ref val2))..ctor(1f, 1f);
			val7.pivot = val2;
			val5 = (val7.anchorMin = (val7.anchorMax = val2));
			val7.anchoredPosition = new Vector2(-10f, -10f);
			val7.sizeDelta = new Vector2(42f, 42f);
			_profilePicContainer.AddComponent<LayoutElement>().ignoreLayout = true;
			_profilePicContainer.AddComponent<RectMask2D>();
			_profileIcon = new GameObject("I").AddComponent<RawImage>();
			((Component)_profileIcon).transform.SetParent(_profilePicContainer.transform, false);
			((Graphic)_profileIcon).rectTransform.anchorMin = Vector2.zero;
			((Graphic)_profileIcon).rectTransform.anchorMax = Vector2.one;
			((Graphic)_profileIcon).rectTransform.sizeDelta = Vector2.zero;
			_profilePicContainer.SetActive(false);
			_statsText = new GameObject("S").AddComponent<TextMeshProUGUI>();
			((TMP_Text)_statsText).transform.SetParent(_bgObj.transform, false);
			((TMP_Text)_statsText).fontSize = 13f;
			((TMP_Text)_statsText).richText = true;
			_warnContainer = new GameObject("WarnContainer");
			_warnContainer.transform.SetParent(_canvasObj.transform, false);
			RectTransform val10 = _warnContainer.AddComponent<RectTransform>();
			((Vector2)(ref val5))..ctor(0.5f, 0f);
			val10.anchorMax = val5;
			val10.anchorMin = val5;
			val10.pivot = new Vector2(0.5f, 0f);
			val10.anchoredPosition = new Vector2(0f, 15f);
			val10.sizeDelta = new Vector2(1000f, 200f);
			VerticalLayoutGroup val11 = _warnContainer.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val11).childAlignment = (TextAnchor)7;
			_illegalWarningText = new GameObject("RT").AddComponent<TextMeshProUGUI>();
			((TMP_Text)_illegalWarningText).transform.SetParent(_warnContainer.transform, false);
			((TMP_Text)_illegalWarningText).text = "ILLEGAL MODS DETECTED";
			((Graphic)_illegalWarningText).color = Color.red;
			((TMP_Text)_illegalWarningText).fontSize = 32f;
			((TMP_Text)_illegalWarningText).alignment = (TextAlignmentOptions)514;
			((TMP_Text)_illegalWarningText).fontStyle = (FontStyles)1;
			((Component)_illegalWarningText).gameObject.SetActive(false);
			_missingWarningText = new GameObject("YT").AddComponent<TextMeshProUGUI>();
			((TMP_Text)_missingWarningText).transform.SetParent(_warnContainer.transform, false);
			((Graphic)_missingWarningText).color = Color.yellow;
			((TMP_Text)_missingWarningText).fontSize = 18f;
			((TMP_Text)_missingWarningText).alignment = (TextAlignmentOptions)514;
			((Component)_missingWarningText).gameObject.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)_canvasObj);
		}
	}
	[HarmonyPatch]
	public static class MenuTabsPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(MenuTabs), "Awake")]
		public static void Postfix(MenuTabs __instance)
		{
			SBGLTabManager.Inject(__instance);
		}
	}
	public static class SBGLTabManager
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<GameObject, bool> <>9__1_0;

			public static Func<GameObject, bool> <>9__1_1;

			public static UnityAction <>9__5_2;

			internal bool <Inject>b__1_0(GameObject t)
			{
				return ((Object)t).name == "SBGL";
			}

			internal bool <Inject>b__1_1(GameObject t)
			{
				return ((Object)t).name.Contains("Controls");
			}

			internal void <PopulateSBGLPage>b__5_2()
			{
				Application.OpenURL("https://sbgleague.com/AccountSettings");
			}
		}

		private const string TAB_NAME = "SBGL";

		public static void Inject(MenuTabs menuTabs)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Expected O, but got Unknown
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Expected O, but got Unknown
			if ((Object)(object)menuTabs == (Object)null)
			{
				return;
			}
			Transform val = ((Component)menuTabs).transform.Find("Menu/Options Tab");
			GameObject val2 = ((IEnumerable<GameObject>)menuTabs.tabs).FirstOrDefault((Func<GameObject, bool>)((GameObject t) => ((Object)t).name == "SBGL"));
			if ((Object)(object)val2 != (Object)null)
			{
				List<GameObject> list = new List<GameObject>();
				foreach (Transform item in val2.transform)
				{
					Transform val3 = item;
					list.Add(((Component)val3).gameObject);
				}
				list.ForEach((Action<GameObject>)Object.DestroyImmediate);
				PopulateSBGLPage(val2);
				return;
			}
			Transform val4 = ((val != null) ? val.Find("Controls") : null);
			GameObject val5 = ((IEnumerable<GameObject>)menuTabs.tabs).FirstOrDefault((Func<GameObject, bool>)((GameObject t) => ((Object)t).name.Contains("Controls")));
			if (!((Object)(object)val4 != (Object)null) || !((Object)(object)val5 != (Object)null))
			{
				return;
			}
			((HorizontalOrVerticalLayoutGroup)((Component)val).GetComponent<HorizontalLayoutGroup>()).spacing = -45f;
			Button[] tabButtons = menuTabs.tabButtons;
			foreach (Button val6 in tabButtons)
			{
				((Component)val6).transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
			}
			GameObject val7 = Object.Instantiate<GameObject>(((Component)val4).gameObject, val);
			((Object)val7).name = "SBGL";
			SetupButtonText(val7, "SBGL");
			GameObject val8 = Object.Instantiate<GameObject>(val5, val5.transform.parent);
			((Object)val8).name = "SBGL";
			if (Object.op_Implicit((Object)(object)val8.GetComponent<ControlsRebind>()))
			{
				Object.DestroyImmediate((Object)(object)val8.GetComponent<ControlsRebind>());
			}
			foreach (Transform item2 in val8.transform)
			{
				Transform val9 = item2;
				Object.DestroyImmediate((Object)(object)((Component)val9).gameObject);
			}
			PopulateSBGLPage(val8);
			menuTabs.tabButtons = menuTabs.tabButtons.Append(val7.GetComponent<Button>()).ToArray();
			menuTabs.tabs = menuTabs.tabs.Append(val8).ToArray();
			menuTabs.textColors = menuTabs.textColors.Append(new Color(0f, 0.71f, 0.5f)).ToArray();
			int newIndex = menuTabs.tabs.Length - 1;
			((UnityEventBase)val7.GetComponent<Button>().onClick).RemoveAllListeners();
			((UnityEvent)val7.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				menuTabs.SelectTab(newIndex);
			});
		}

		private static void SetupButtonText(GameObject btn, string txt)
		{
			TextMeshProUGUI componentInChildren = btn.GetComponentInChildren<TextMeshProUGUI>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((TMP_Text)componentInChildren).text = txt;
			}
		}

		private static GameObject CreateText(Transform parent, string text, Color color, int fontSize, int height)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("TextInfo", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			val.GetComponent<RectTransform>().sizeDelta = new Vector2(600f, (float)height);
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val2).text = text;
			((Graphic)val2).color = color;
			((TMP_Text)val2).fontSize = fontSize;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val2).richText = true;
			return val;
		}

		private static GameObject CreateButton(Transform parent, string text, Color color, int width, int height)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("SBGButton", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val.transform.SetParent(parent, false);
			val.GetComponent<RectTransform>().sizeDelta = new Vector2((float)width, (float)height);
			((Graphic)val.GetComponent<Image>()).color = color;
			GameObject val2 = new GameObject("BtnText", new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent(val.transform, false);
			val2.GetComponent<RectTransform>().anchorMin = Vector2.zero;
			val2.GetComponent<RectTransform>().anchorMax = Vector2.one;
			val2.GetComponent<RectTransform>().sizeDelta = Vector2.zero;
			TextMeshProUGUI val3 = val2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = text;
			((Graphic)val3).color = Color.white;
			((TMP_Text)val3).fontSize = 18f;
			((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
			return val;
		}

		private static void PopulateSBGLPage(GameObject page)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Expected O, but got Unknown
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Expected O, but got Unknown
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Expected O, but got Unknown
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Expected O, but got Unknown
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Expected O, but got Unknown
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			CompPluginCheck plugin = Object.FindFirstObjectByType<CompPluginCheck>();
			string currentId = ((!string.IsNullOrEmpty(plugin?.ResolvedID) && plugin.ResolvedID != "None") ? plugin.ResolvedID : plugin?._configPlayerId.Value);
			bool flag = !string.IsNullOrEmpty(currentId) && currentId != "PASTE_ID_HERE" && currentId != "None";
			VerticalLayoutGroup val = page.GetComponent<VerticalLayoutGroup>() ?? page.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val).padding = new RectOffset(60, 60, 20, 20);
			((HorizontalOrVerticalLayoutGroup)val).spacing = 15f;
			((LayoutGroup)val).childAlignment = (TextAnchor)1;
			bool childControlHeight = (((HorizontalOrVerticalLayoutGroup)val).childForceExpandHeight = false);
			((HorizontalOrVerticalLayoutGroup)val).childControlHeight = childControlHeight;
			CreateText(page.transform, "<b>SBG LEAGUE INTEGRATION</b>", new Color(0.16f, 0.99f, 0.75f), 32, 50);
			if (flag)
			{
				CreateText(page.transform, "<color=#222222>--- ACCOUNT ACTIVE ---</color>", Color.black, 18, 30);
				GameObject val2 = CreateButton(page.transform, "VIEW LEAGUE PROFILE", new Color(0.12f, 0.45f, 0.35f), 350, 45);
				((UnityEvent)val2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					Application.OpenURL("https://sbgleague.com/PlayerProfile?id=" + currentId);
				});
				CreateText(page.transform, "Linked to: <color=#111111>" + (plugin?.ResolvedName ?? "Found") + "</color>", Color.black, 18, 25);
				CreateText(page.transform, "<size=12>ID: " + currentId + "</size>", new Color(0.3f, 0.3f, 0.3f), 14, 20);
				CreateText(page.transform, "<b>RECENT MATCH HISTORY</b>", new Color(0.12f, 0.65f, 0.55f), 24, 40);
				if ((Object)(object)plugin != (Object)null && plugin._recentMatches.Count > 0)
				{
					foreach (MatchEntry recentMatch in plugin._recentMatches)
					{
						GameObject val3 = CreateText(page.transform, recentMatch.match_summary ?? "", Color.black, 14, 25);
						TextMeshProUGUI component = val3.GetComponent<TextMeshProUGUI>();
						if ((Object)(object)component != (Object)null)
						{
							((TMP_Text)component).textWrappingMode = (TextWrappingModes)0;
							((TMP_Text)component).overflowMode = (TextOverflowModes)0;
							((Graphic)component).raycastTarget = false;
						}
					}
				}
				else
				{
					CreateText(page.transform, "No matches found.", Color.gray, 14, 25);
				}
				((UnityEvent)CreateButton(page.transform, "REFRESH / AUTO-DETECT", new Color(0.2f, 0.2f, 0.25f), 350, 40).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					if ((Object)(object)plugin != (Object)null)
					{
						plugin._configPlayerId.Value = "PASTE_ID_HERE";
						plugin.ResolvedID = "None";
						((BaseUnityPlugin)plugin).Config.Save();
						plugin.TriggerManualSync();
					}
				});
			}
			else
			{
				CreateText(page.transform, "<color=#444444>--- MANUAL SETUP REQUIRED ---</color>", Color.black, 18, 30);
				ButtonClickedEvent onClick = CreateButton(page.transform, "FIND MY PLAYER ID", new Color(0.12f, 0.12f, 0.12f), 350, 45).GetComponent<Button>().onClick;
				object obj = <>c.<>9__5_2;
				if (obj == null)
				{
					UnityAction val4 = delegate
					{
						Application.OpenURL("https://sbgleague.com/AccountSettings");
					};
					<>c.<>9__5_2 = val4;
					obj = (object)val4;
				}
				((UnityEvent)onClick).AddListener((UnityAction)obj);
				GameObject val5 = new GameObject("Box", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				val5.transform.SetParent(page.transform, false);
				((Graphic)val5.GetComponent<Image>()).color = new Color(0.05f, 0.05f, 0.05f, 1f);
				val5.GetComponent<RectTransform>().sizeDelta = new Vector2(350f, 50f);
				GameObject val6 = new GameObject("T", new Type[1] { typeof(RectTransform) });
				val6.transform.SetParent(val5.transform, false);
				TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
				((TMP_Text)val7).fontSize = 20f;
				((Graphic)val7).color = Color.white;
				((TMP_Text)val7).alignment = (TextAlignmentOptions)514;
				TMP_InputField input = val5.AddComponent<TMP_InputField>();
				input.textComponent = (TMP_Text)(object)val7;
				input.text = (((Object)(object)plugin != (Object)null) ? plugin._configPlayerId.Value : "");
				((UnityEvent)CreateButton(page.transform, "SAVE & SYNC PROFILE", new Color(0.1f, 0.6f, 0.45f), 400, 55).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					if ((Object)(object)plugin != (Object)null)
					{
						plugin._configPlayerId.Value = input.text;
						((BaseUnityPlugin)plugin).Config.Save();
						plugin.TriggerManualSync();
					}
				});
			}
			CreateText(page.transform, "<b>PRO SERIES EVENTS</b>", new Color(0.12f, 0.65f, 0.55f), 24, 40);
			if ((Object)(object)plugin != (Object)null && plugin._upcomingEvents.Count > 0)
			{
				foreach (ProSeriesEvent upcomingEvent in plugin._upcomingEvents)
				{
					DateTime result;
					string text = (DateTime.TryParse(upcomingEvent.event_date, out result) ? result.ToString("MM/dd") : "");
					CreateText(page.transform, "<color=#111111>" + upcomingEvent.name + "</color> - <size=14>" + text + "</size>", Color.black, 18, 25);
				}
				return;
			}
			CreateText(page.transform, "No upcoming events scheduled.", Color.gray, 16, 25);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}