Decompiled source of AFKTestFX v1.1.0

AFKTextFX.dll

Decompiled a year ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using AFKTextFX.Data;
using AFKTextFX.UI;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Steamworks;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AFKTextFX")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("AFKTextFX")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 AFKTextFX
{
	[BepInPlugin("AFKTextFX", "My first plugin", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <WaitForSteamAndInit>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Plugin <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!SteamAPI.IsSteamRunning())
				{
					Logger.LogInfo((object)"Waiting for SteamAPI to initialize...");
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				BannedWordsManager.LoadBannedWords();
				ConfigManager.Init(((BaseUnityPlugin)<>4__this).Config);
				<>4__this.textFXUI = new TextFXUI();
				<>4__this.harmony = new Harmony("AFKTextFX");
				<>4__this.harmony.PatchAll();
				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();
			}
		}

		internal static ManualLogSource Logger;

		private TextFXUI textFXUI;

		private Harmony harmony;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin AFKTextFX is loaded!");
			((MonoBehaviour)this).StartCoroutine(WaitForSteamAndInit());
		}

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

		private void Update()
		{
			textFXUI.Update();
		}

		private void OnGUI()
		{
			textFXUI.OnGUI();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "AFKTextFX";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace AFKTextFX.UI
{
	public class TextFXUI
	{
		private bool showGUI = false;

		private Rect guiRect = new Rect(0f, 0f, 400f, 200f);

		private string lobbyNameInput = ConfigManager.LobbyName;

		private string playerNameInput = ConfigManager.PlayerName;

		private string rankInput = ConfigManager.Rank;

		private string hexColorInput = ConfigManager.MessageColor;

		private Color currentPreviewColor = Color.white;

		private Texture2D colorPreviewTexture;

		public TextFXUI()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			colorPreviewTexture = new Texture2D(1, 1);
			colorPreviewTexture.SetPixel(0, 0, Color.white);
			colorPreviewTexture.Apply();
			UpdateColorPreview();
		}

		public void Update()
		{
			if (Input.GetKeyDown((KeyCode)282))
			{
				showGUI = !showGUI;
			}
			if (showGUI && Input.GetKeyDown((KeyCode)27))
			{
				showGUI = false;
			}
		}

		public void OnGUI()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (showGUI)
			{
				guiRect = GUI.Window(0, guiRect, new WindowFunction(DrawGuiWindow), "AFK Text FX Tool");
				UpdateColorPreview();
			}
		}

		private void UpdateColorPreview()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			string text = hexColorInput.TrimStart('#').ToUpper();
			Color val = default(Color);
			if (text.Length == 6 && ColorUtility.TryParseHtmlString("#" + text, ref val))
			{
				currentPreviewColor = val;
			}
			else
			{
				currentPreviewColor = Color.clear;
			}
		}

		private void DrawGuiWindow(int windowID)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			GUI.Label(new Rect(20f, 30f, 100f, 20f), "Lobby Name:");
			lobbyNameInput = GUI.TextField(new Rect(130f, 30f, 200f, 20f), lobbyNameInput);
			GUI.Label(new Rect(20f, 60f, 100f, 20f), "Player Name:");
			playerNameInput = GUI.TextField(new Rect(130f, 60f, 200f, 20f), playerNameInput);
			GUI.Label(new Rect(20f, 90f, 100f, 20f), "Custom Rank:");
			rankInput = GUI.TextField(new Rect(130f, 90f, 200f, 20f), rankInput);
			GUI.Label(new Rect(20f, 120f, 100f, 20f), "Chat Color:");
			hexColorInput = GUI.TextField(new Rect(130f, 120f, 100f, 20f), hexColorInput);
			string text = hexColorInput.TrimStart('#').ToUpper();
			if (currentPreviewColor != Color.clear)
			{
				GUI.color = currentPreviewColor;
				GUI.DrawTexture(new Rect(240f, 120f, 40f, 20f), (Texture)(object)colorPreviewTexture);
				GUI.color = Color.white;
			}
			else
			{
				GUI.Label(new Rect(240f, 120f, 100f, 20f), "Invalid hex");
			}
			if (GUI.Button(new Rect(150f, 160f, 100f, 30f), "Apply"))
			{
				Plugin.Logger.LogInfo((object)("Lobby Name: " + ConfigManager.LobbyName));
				Plugin.Logger.LogInfo((object)("Player Name: " + ConfigManager.PlayerName));
				Plugin.Logger.LogInfo((object)("Custom Rank: " + ConfigManager.Rank));
				Plugin.Logger.LogInfo((object)("Chat Color: #" + text));
				ConfigManager.SetLobbyName(lobbyNameInput);
				ConfigManager.SetPlayerName(playerNameInput);
				ConfigManager.SetRank(rankInput);
				ConfigManager.SetMessageColor(text);
				showGUI = false;
			}
			if (GUI.Button(new Rect(260f, 160f, 100f, 30f), "Reset"))
			{
				ConfigManager.Reset();
				lobbyNameInput = ConfigManager.LobbyName;
				playerNameInput = ConfigManager.PlayerName;
				rankInput = ConfigManager.Rank;
				hexColorInput = ConfigManager.MessageColor;
				UpdateColorPreview();
			}
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f));
		}
	}
}
namespace AFKTextFX.Patches
{
	[HarmonyPatch(typeof(BootstrapNetworkManager), "ionknowbruhther")]
	public class IonknowbruhtherPatch
	{
		[CompilerGenerated]
		private sealed class <CustomWaitforClientToStart>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public MonoBehaviour instance;

			public string PlayerName;

			private FieldInfo <cooldownField>5__1;

			private float <cooldown>5__2;

			private MethodInfo <call>5__3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<cooldownField>5__1 = null;
				<call>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!AccessTools.Property(((object)instance).GetType(), "IsClientInitialized").GetValue(instance).Equals(true))
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<cooldownField>5__1 = AccessTools.Field(((object)instance).GetType(), "cooldown");
				<cooldown>5__2 = (float)<cooldownField>5__1.GetValue(instance);
				if (Time.time - <cooldown>5__2 > 1f)
				{
					<cooldownField>5__1.SetValue(instance, Time.time);
					<call>5__3 = AccessTools.Method(((object)instance).GetType(), "ServerJoinHatsCall", (Type[])null, (Type[])null);
					MethodInfo methodInfo = <call>5__3;
					MonoBehaviour obj = instance;
					object[] obj2 = new object[3]
					{
						ConfigManager.PlayerName,
						ConfigManager.Rank,
						null
					};
					CSteamID steamID = SteamUser.GetSteamID();
					obj2[2] = ((object)(CSteamID)(ref steamID)).ToString();
					methodInfo.Invoke(obj, obj2);
					<call>5__3 = null;
				}
				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 static bool Prefix(object __instance, string PlayerName)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			try
			{
				((MonoBehaviour)__instance).StartCoroutine(CustomWaitforClientToStart((MonoBehaviour)__instance, PlayerName));
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("Error in [AFKTextFX] - IonknowbruhtherPatch: " + ex.Message));
				return true;
			}
		}

		[IteratorStateMachine(typeof(<CustomWaitforClientToStart>d__1))]
		private static IEnumerator CustomWaitforClientToStart(MonoBehaviour instance, string PlayerName)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CustomWaitforClientToStart>d__1(0)
			{
				instance = instance,
				PlayerName = PlayerName
			};
		}
	}
	[HarmonyPatch(typeof(MainMenuManagerNetworked), "JoinTeam")]
	public class JoinTeamPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(MainMenuManagerNetworked __instance, string playername, int teamtojoin)
		{
			try
			{
				AccessTools.Field(typeof(MainMenuManagerNetworked), "localplayername").SetValue(__instance, playername);
				int num = (int)AccessTools.Field(typeof(MainMenuManagerNetworked), "currentLocalTeam").GetValue(__instance);
				if (teamtojoin != num)
				{
					string rank = ConfigManager.Rank;
					MethodInfo methodInfo = AccessTools.Method(typeof(MainMenuManagerNetworked), "ServerJoinTeam", (Type[])null, (Type[])null);
					methodInfo.Invoke(__instance, new object[3] { playername, teamtojoin, rank });
				}
				else
				{
					__instance.mmm.hasSwappedteam = true;
				}
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("Error in [AFKTextFX] - JoinTeamPatch: " + ex.Message));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(BootstrapManager), "OnLobbyCreated")]
	public class OnLobbyCreatedPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(MainMenuManagerNetworked __instance, LobbyCreated_t callback)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Invalid comparison between Unknown and I4
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Plugin.Logger.LogInfo((object)("Starting lobby creation: " + ((object)(EResult)(ref callback.m_eResult)).ToString()));
				if ((int)callback.m_eResult != 1)
				{
					Plugin.Logger.LogDebug((object)"[AFKTextFX] Lobby creation failed.");
					return true;
				}
				Type type = ((object)__instance).GetType();
				AccessTools.Field(type, "haslobbyStarted")?.SetValue(__instance, false);
				AccessTools.Field(type, "CurrentLobbyID")?.SetValue(__instance, callback.m_ulSteamIDLobby);
				CSteamID val = default(CSteamID);
				((CSteamID)(ref val))..ctor(callback.m_ulSteamIDLobby);
				CSteamID val2 = val;
				CSteamID steamID = SteamUser.GetSteamID();
				SteamMatchmaking.SetLobbyData(val2, "HostAddress", ((object)(CSteamID)(ref steamID)).ToString());
				string version = Application.version;
				SteamMatchmaking.SetLobbyData(val, "Version", version);
				Plugin.Logger.LogDebug((object)("[AFKTextFX] Set lobby version: " + version));
				SteamMatchmaking.SetLobbyData(val, "name", ConfigManager.LobbyName);
				FieldInfo fieldInfo = AccessTools.Field(type, "islobbyprivate");
				bool flag = fieldInfo != null && (bool)fieldInfo.GetValue(__instance);
				SteamMatchmaking.SetLobbyData(val, "closed", flag ? "2" : "0");
				object obj = AccessTools.Field(type, "_fishySteamworks")?.GetValue(__instance);
				if (obj != null)
				{
					MethodInfo methodInfo = AccessTools.Method(obj.GetType(), "SetClientAddress", (Type[])null, (Type[])null);
					MethodInfo methodInfo2 = AccessTools.Method(obj.GetType(), "StartConnection", (Type[])null, (Type[])null);
					if ((object)methodInfo != null)
					{
						object[] array = new object[1];
						steamID = SteamUser.GetSteamID();
						array[0] = ((object)(CSteamID)(ref steamID)).ToString();
						methodInfo.Invoke(obj, array);
					}
					methodInfo2?.Invoke(obj, new object[1] { true });
				}
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("Error in [AFKTextFX] - JoinTeamPatch: " + ex.Message));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(MainMenuManager), "SendLobbyChatMessage")]
	public class SendLobbyChatMessagePatch
	{
		[HarmonyPrefix]
		public static bool Prefix(MainMenuManagerNetworked __instance, ref float ___chatcd, TMP_InputField ___chatInputFieldText)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (Time.time - ___chatcd > 0.1f && !string.IsNullOrWhiteSpace(___chatInputFieldText.text))
				{
					___chatcd = Time.time;
					string messageColor = ConfigManager.MessageColor;
					string text = ___chatInputFieldText.text;
					string s = "<color=#" + messageColor + ">" + text + "</color>";
					byte[] bytes = Encoding.UTF8.GetBytes(s);
					SteamMatchmaking.SendLobbyChatMsg(new CSteamID(BootstrapManager.CurrentLobbyID), bytes, bytes.Length);
					___chatInputFieldText.text = "";
				}
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("Error in [AFKTextFX] - JoinTeamPatch: " + ex.Message));
				return true;
			}
		}
	}
}
namespace AFKTextFX.Data
{
	public static class BannedWordsManager
	{
		private static HashSet<string> bannedWords = new HashSet<string>();

		public static void LoadBannedWords()
		{
			List<string> list = new List<string>();
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string text = "AFKTextFX.banned_words.txt";
			using Stream stream = executingAssembly.GetManifestResourceStream(text);
			if (stream == null)
			{
				Plugin.Logger.LogError((object)("Could not find embedded resource: " + text));
				return;
			}
			using StreamReader streamReader = new StreamReader(stream);
			while (!streamReader.EndOfStream)
			{
				string text2 = streamReader.ReadLine()?.Trim();
				if (!string.IsNullOrEmpty(text2) && !text2.StartsWith("#"))
				{
					bannedWords.Add(text2.ToLower());
				}
			}
		}

		public static bool ContainsBannedWord(string message)
		{
			string[] array = message.ToLower().Split(' ');
			foreach (string item in array)
			{
				if (bannedWords.Contains(item))
				{
					return true;
				}
			}
			return false;
		}
	}
	public static class ConfigManager
	{
		private static ConfigEntry<string> _rank;

		private static ConfigEntry<string> _playerName;

		private static ConfigEntry<string> _lobbyName;

		private static ConfigEntry<string> _messageColor;

		public static string Rank => _rank.Value;

		public static string PlayerName => _playerName.Value;

		public static string LobbyName => _lobbyName.Value;

		public static string MessageColor => _messageColor.Value;

		public static void Init(ConfigFile config)
		{
			_rank = config.Bind<string>("AFKTextFX", "CustomRank", getDefaultRankText(), "Rank");
			_playerName = config.Bind<string>("AFKTextFX", "PlayerName", getDefaultPlayerName(), "Player name");
			_lobbyName = config.Bind<string>("AFKTextFX", "LobbyName", getDefaultLobbyName(), "Lobby name");
			_messageColor = config.Bind<string>("AFKTextFX", "MessageColor", "FFFFFF", "Color of chat messages sent");
		}

		public static void SetRank(string rank)
		{
			if (BannedWordsManager.ContainsBannedWord(rank))
			{
				_rank.Value = "RankContainsBannedWord";
			}
			else
			{
				_rank.Value = rank;
			}
		}

		public static void SetPlayerName(string name)
		{
			if (BannedWordsManager.ContainsBannedWord(name))
			{
				_playerName.Value = "PlayerNameContainsBannedWord";
			}
			else
			{
				_playerName.Value = name;
			}
		}

		public static void SetLobbyName(string lobby)
		{
			if (BannedWordsManager.ContainsBannedWord(lobby))
			{
				_lobbyName.Value = "LobbyNameContainsBannedWord";
			}
			else
			{
				_lobbyName.Value = lobby;
			}
		}

		public static void SetMessageColor(string hexColor)
		{
			Color val = default(Color);
			if (ColorUtility.TryParseHtmlString("#" + hexColor.TrimStart('#'), ref val))
			{
				_messageColor.Value = hexColor;
				return;
			}
			throw new ArgumentException("Invalid color format. Use hex format like 'FFFFFF'.");
		}

		private static string getDefaultLobbyName()
		{
			return getDefaultPlayerName() + "'s Lobby";
		}

		private static string getDefaultPlayerName()
		{
			try
			{
				return SteamFriends.GetPersonaName();
			}
			catch (Exception)
			{
				return "DefaultPlayerName";
			}
		}

		private static string getDefaultRankText()
		{
			try
			{
				string text = "lvl ";
				int num = default(int);
				text = ((!SteamUserStats.GetStat("level", ref num)) ? (text + num) : (text + 0));
				Type typeFromHandle = typeof(BootstrapNetworkManager);
				Type nestedType = typeFromHandle.GetNestedType("WizardRank", BindingFlags.NonPublic);
				int num2 = default(int);
				return (!SteamUserStats.GetStat("rank", ref num2)) ? (text + " Lacky") : (text + " " + Enum.ToObject(nestedType, Mathf.Clamp(num2, 0, 9)));
			}
			catch (Exception)
			{
				return "DefaultRank";
			}
		}

		public static void Reset()
		{
			_rank.Value = getDefaultRankText();
			_playerName.Value = getDefaultPlayerName();
			_lobbyName.Value = getDefaultLobbyName();
		}
	}
}