Decompiled source of officerballs StatusManager v1.0.1

BepInEx/plugins/officerballs/officerballs.StatusManager.dll

Decompiled 8 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PurrNet;
using StatusMessage.patches;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("officerballs.StatusManager")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("officerballs.StatusManager")]
[assembly: AssemblyTitle("officerballs.StatusManager")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 StatusMessage
{
	[BepInPlugin("officerballs.StatusManager", "Status Manager", "1.0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "officerballs.StatusManager";

		public const string modName = "Status Manager";

		public const string modVersion = "1.0.1.0";

		private Harmony harmony = new Harmony("officerballs.StatusManager");

		public ManualLogSource mls = Logger.CreateLogSource("officerballs.StatusManager");

		public static ConfigEntry<string> configNameBase { get; private set; }

		public static ConfigEntry<string> configBracketType { get; private set; }

		public static ConfigEntry<string> configCustomColor { get; private set; }

		public static ConfigEntry<bool> configUseBRB { get; private set; }

		public static ConfigEntry<int> configBRBTimer { get; private set; }

		public static ConfigEntry<string> configBRBMessage { get; private set; }

		public static ConfigEntry<string> configBRBColor { get; private set; }

		public static ConfigEntry<bool> configUseAFK { get; private set; }

		public static ConfigEntry<int> configAFKTimer { get; private set; }

		public static ConfigEntry<string> configAFKMessage { get; private set; }

		public static ConfigEntry<string> configAFKColor { get; private set; }

		private void Awake()
		{
			harmony.PatchAll(typeof(StatusPatch));
			harmony.PatchAll(typeof(RevertNamePatch));
			harmony.PatchAll(typeof(CharLimitPatch));
			string text = "";
			configNameBase = ((BaseUnityPlugin)this).Config.Bind<string>("General", "PlayerName", text, "Your player's name.");
			configBracketType = ((BaseUnityPlugin)this).Config.Bind<string>("General", "BracketType", "()", "How your status messages are wrapped. Two character limit.");
			configCustomColor = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CustomColor", "5ec1c7", "Colorcode to wrap custom status with.");
			configUseBRB = ((BaseUnityPlugin)this).Config.Bind<bool>("General.BRB", "UseBRB", true, "Enables auto-BRB system.");
			configBRBTimer = ((BaseUnityPlugin)this).Config.Bind<int>("General.BRB", "BRBTimer", 2, "Time in minutes before BRB applies. Must be lower than AFK timer if that's enabled.");
			configBRBMessage = ((BaseUnityPlugin)this).Config.Bind<string>("General.BRB", "BRBMessage", "BRB", "Text for the BRB status.");
			configBRBColor = ((BaseUnityPlugin)this).Config.Bind<string>("General.BRB", "BRBColor", "ffd45d", "Colorcode to wrap BRB status with.");
			configUseAFK = ((BaseUnityPlugin)this).Config.Bind<bool>("General.AFK", "UseAFK", true, "Enables auto-AFK system.");
			configAFKTimer = ((BaseUnityPlugin)this).Config.Bind<int>("General.AFK", "AFKTimer", 5, "Time in minutes before AFK applies. Must be higher than BRB timer if that's enabled.");
			configAFKMessage = ((BaseUnityPlugin)this).Config.Bind<string>("General.AFK", "AFKMessage", "AFK", "Text for the AFK status.");
			configAFKColor = ((BaseUnityPlugin)this).Config.Bind<string>("General.AFK", "AFKColor", "e97d45", "Colorcode to wrap AFK status with.");
			mls.LogInfo((object)"Status Management system online.");
		}
	}
}
namespace StatusMessage.patches
{
	[HarmonyPatch(typeof(DataManager))]
	internal class RevertNamePatch
	{
		[HarmonyPatch("LoadPlayerData")]
		[HarmonyPostfix]
		public static void SetUser()
		{
			if (Plugin.configNameBase.Value != "" && MonoSingleton<DataManager>.I.PlayerData.Name != Plugin.configNameBase.Value)
			{
				MonoSingleton<DataManager>.I.PlayerData.Name = Plugin.configNameBase.Value;
			}
			else if (Plugin.configNameBase.Value == "")
			{
				Plugin.configNameBase.Value = MonoSingleton<DataManager>.I.PlayerData.Name;
			}
		}
	}
	[HarmonyPatch(typeof(TextChannelManager))]
	internal class StatusPatch
	{
		public static string statusmsg = "";

		public static float awaytimer = 0f;

		public static bool isAFK = false;

		public static bool isBRB = false;

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		public static void TimeChecker()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			if (Input.anyKey)
			{
				bool flag = false;
				awaytimer = 0f;
				if (isBRB)
				{
					isBRB = false;
					flag = true;
				}
				if (isAFK)
				{
					isAFK = false;
					flag = true;
				}
				if (flag)
				{
					string value = Plugin.configNameBase.Value;
					MonoSingleton<DataManager>.I.PlayerData.Name = value;
					if ((Object)(object)MonoSingleton<MainSceneManager>.I != (Object)null)
					{
						NetworkSingleton<TextChannelManager>.I.MainCustomizationController.UpdatePlayerInfo(MonoSingleton<DataManager>.I.PlayerData.GetPlayerIdInfo(), default(RPCInfo));
						TextMeshProUGUI playerText = MonoSingleton<UIManager>.I.PlayerText;
						string text = (NetworkSingleton<TextChannelManager>.I.UserName = MonoSingleton<DataManager>.I.PlayerData.Name);
						string text3 = (((TMP_Text)playerText).text = text);
						string text4 = text3;
					}
				}
			}
			else
			{
				awaytimer += Time.deltaTime;
			}
			if (awaytimer >= (float)(Plugin.configAFKTimer.Value * 60) && statusmsg == "" && !isAFK && Plugin.configUseAFK.Value)
			{
				isAFK = true;
				string value2 = Plugin.configNameBase.Value;
				string text5 = Plugin.configBracketType.Value.Substring(0, 1);
				string text6 = Plugin.configBracketType.Value.Substring(1);
				string value3 = Plugin.configAFKMessage.Value;
				string value4 = Plugin.configAFKColor.Value;
				MonoSingleton<DataManager>.I.PlayerData.Name = value2 + " <color=#" + value4 + ">" + text5 + value3 + text6 + "</color>";
				if ((Object)(object)MonoSingleton<MainSceneManager>.I != (Object)null)
				{
					NetworkSingleton<TextChannelManager>.I.MainCustomizationController.UpdatePlayerInfo(MonoSingleton<DataManager>.I.PlayerData.GetPlayerIdInfo(), default(RPCInfo));
					TextMeshProUGUI playerText2 = MonoSingleton<UIManager>.I.PlayerText;
					string text = (NetworkSingleton<TextChannelManager>.I.UserName = MonoSingleton<DataManager>.I.PlayerData.Name);
					string text3 = (((TMP_Text)playerText2).text = text);
					string text8 = text3;
				}
			}
			else if (awaytimer >= (float)(Plugin.configBRBTimer.Value * 60) && statusmsg == "" && !isBRB && Plugin.configUseBRB.Value)
			{
				isBRB = true;
				string value5 = Plugin.configNameBase.Value;
				string text9 = Plugin.configBracketType.Value.Substring(0, 1);
				string text10 = Plugin.configBracketType.Value.Substring(1);
				string value6 = Plugin.configBRBMessage.Value;
				string value7 = Plugin.configBRBColor.Value;
				MonoSingleton<DataManager>.I.PlayerData.Name = value5 + " <color=#" + value7 + ">" + text9 + value6 + text10 + "</color>";
				if ((Object)(object)MonoSingleton<MainSceneManager>.I != (Object)null)
				{
					NetworkSingleton<TextChannelManager>.I.MainCustomizationController.UpdatePlayerInfo(MonoSingleton<DataManager>.I.PlayerData.GetPlayerIdInfo(), default(RPCInfo));
					TextMeshProUGUI playerText3 = MonoSingleton<UIManager>.I.PlayerText;
					string text = (NetworkSingleton<TextChannelManager>.I.UserName = MonoSingleton<DataManager>.I.PlayerData.Name);
					string text3 = (((TMP_Text)playerText3).text = text);
					string text12 = text3;
				}
			}
		}

		[HarmonyPatch("OnEnterPressed")]
		[HarmonyPrefix]
		public static bool TextChecker()
		{
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fbd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fc3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ebd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ec4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eca: Unknown result type (might be due to invalid IL or missing references)
			string text = MonoSingleton<UIManager>.I.MessageInput.text;
			if (text.Length >= 15 && text.Substring(0, 15) == "/changebrackets")
			{
				if (text.Length >= 18)
				{
					Plugin.configBracketType.Value = text.Substring(16, 2);
					if (statusmsg != "")
					{
						string value = Plugin.configNameBase.Value;
						string text2 = Plugin.configBracketType.Value.Substring(0, 1);
						string text3 = Plugin.configBracketType.Value.Substring(1);
						string value2 = Plugin.configCustomColor.Value;
						MonoSingleton<DataManager>.I.PlayerData.Name = value + " <color=#" + value2 + ">" + text2 + statusmsg + text3 + "</color>";
						if ((Object)(object)MonoSingleton<MainSceneManager>.I != (Object)null)
						{
							NetworkSingleton<TextChannelManager>.I.MainCustomizationController.UpdatePlayerInfo(MonoSingleton<DataManager>.I.PlayerData.GetPlayerIdInfo(), default(RPCInfo));
							TextMeshProUGUI playerText = MonoSingleton<UIManager>.I.PlayerText;
							string text4 = (NetworkSingleton<TextChannelManager>.I.UserName = MonoSingleton<DataManager>.I.PlayerData.Name);
							string text6 = (((TMP_Text)playerText).text = text4);
							string text7 = text6;
						}
					}
					NetworkSingleton<TextChannelManager>.I.AddNotification("Brackets changed to " + Plugin.configBracketType.Value);
				}
				else
				{
					NetworkSingleton<TextChannelManager>.I.AddNotification("Brackets currently set to " + Plugin.configBracketType.Value);
				}
				MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
				EventSystem.current.SetSelectedGameObject((GameObject)null);
				MonoSingleton<UIManager>.I.MessageInput.text = "";
				return false;
			}
			if (text.Length >= 12)
			{
				string text8 = text.Substring(0, 12);
				string text9 = text8;
				string text10 = text9;
				if (text10 == "/clearstatus")
				{
					statusmsg = "";
					MonoSingleton<DataManager>.I.PlayerData.Name = Plugin.configNameBase.Value;
					if ((Object)(object)MonoSingleton<MainSceneManager>.I != (Object)null)
					{
						NetworkSingleton<TextChannelManager>.I.MainCustomizationController.UpdatePlayerInfo(MonoSingleton<DataManager>.I.PlayerData.GetPlayerIdInfo(), default(RPCInfo));
						TextMeshProUGUI playerText2 = MonoSingleton<UIManager>.I.PlayerText;
						string text4 = (NetworkSingleton<TextChannelManager>.I.UserName = MonoSingleton<DataManager>.I.PlayerData.Name);
						string text6 = (((TMP_Text)playerText2).text = text4);
						string text12 = text6;
					}
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					NetworkSingleton<TextChannelManager>.I.AddNotification("Status message cleared.");
					return false;
				}
				if (text10 == "/statuscolor")
				{
					if (text.Length >= 19)
					{
						string text13 = text.Substring(13, 6);
						Plugin.configCustomColor.Value = text13;
						if (statusmsg != "")
						{
							string value3 = Plugin.configNameBase.Value;
							string text14 = Plugin.configBracketType.Value.Substring(0, 1);
							string text15 = Plugin.configBracketType.Value.Substring(1);
							MonoSingleton<DataManager>.I.PlayerData.Name = value3 + " <color=#" + text13 + ">" + text14 + statusmsg + text15 + "</color>";
							if ((Object)(object)MonoSingleton<MainSceneManager>.I != (Object)null)
							{
								NetworkSingleton<TextChannelManager>.I.MainCustomizationController.UpdatePlayerInfo(MonoSingleton<DataManager>.I.PlayerData.GetPlayerIdInfo(), default(RPCInfo));
								TextMeshProUGUI playerText3 = MonoSingleton<UIManager>.I.PlayerText;
								string text4 = (NetworkSingleton<TextChannelManager>.I.UserName = MonoSingleton<DataManager>.I.PlayerData.Name);
								string text6 = (((TMP_Text)playerText3).text = text4);
								string text17 = text6;
							}
							NetworkSingleton<TextChannelManager>.I.AddNotification("Status color changed to <color=#" + Plugin.configCustomColor.Value + ">" + Plugin.configCustomColor.Value + "</color>.");
						}
					}
					else
					{
						NetworkSingleton<TextChannelManager>.I.AddNotification("Status color currently set to <color=#" + Plugin.configCustomColor.Value + ">" + Plugin.configCustomColor.Value + "</color>.");
					}
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					return false;
				}
			}
			if (text.Length >= 9)
			{
				string text18 = text.Substring(0, 9);
				string text19 = "";
				string text20 = text18;
				string text21 = text20;
				if (text21 == "/brbcolor")
				{
					if (text.Length >= 16)
					{
						text19 = text.Substring(10, 6);
						Plugin.configBRBColor.Value = text19;
						MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
						EventSystem.current.SetSelectedGameObject((GameObject)null);
						MonoSingleton<UIManager>.I.MessageInput.text = "";
						NetworkSingleton<TextChannelManager>.I.AddNotification("BRB color changed to <color=#" + Plugin.configBRBColor.Value + ">" + Plugin.configBRBColor.Value + "</color>.");
						return false;
					}
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					NetworkSingleton<TextChannelManager>.I.AddNotification("BRB color currently set to <color=#" + Plugin.configBRBColor.Value + ">" + Plugin.configBRBColor.Value + "</color>.");
					return false;
				}
				if (text21 == "/afkcolor")
				{
					if (text.Length >= 16)
					{
						text19 = text.Substring(10, 6);
						Plugin.configAFKColor.Value = text19;
						MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
						EventSystem.current.SetSelectedGameObject((GameObject)null);
						MonoSingleton<UIManager>.I.MessageInput.text = "";
						NetworkSingleton<TextChannelManager>.I.AddNotification("AFK color changed to <color=#" + Plugin.configAFKColor.Value + ">" + Plugin.configAFKColor.Value + "</color>.");
						return false;
					}
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					NetworkSingleton<TextChannelManager>.I.AddNotification("AFK color currently set to <color=#" + Plugin.configAFKColor.Value + ">" + Plugin.configAFKColor.Value + "</color>.");
					return false;
				}
			}
			if (text.Length >= 9)
			{
				string text22 = text.Substring(0, 9);
				string text23 = text22;
				string text24 = text23;
				if (text24 == "/brbtimer")
				{
					if (text.Length > 10)
					{
						if (int.TryParse(text.Substring(10), out var result))
						{
							Plugin.configBRBTimer.Value = result;
							NetworkSingleton<TextChannelManager>.I.AddNotification("BRB timer changed to " + Plugin.configBRBTimer.Value + " minutes.");
						}
					}
					else
					{
						NetworkSingleton<TextChannelManager>.I.AddNotification("BRB timer currently set to " + Plugin.configBRBTimer.Value + " minutes.");
					}
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					return false;
				}
				if (text24 == "/afktimer")
				{
					if (text.Length > 10)
					{
						if (int.TryParse(text.Substring(10), out var result2))
						{
							Plugin.configAFKTimer.Value = result2;
							NetworkSingleton<TextChannelManager>.I.AddNotification("AFK timer changed to " + Plugin.configAFKTimer.Value + " minutes.");
						}
					}
					else
					{
						NetworkSingleton<TextChannelManager>.I.AddNotification("AFK timer currently set to " + Plugin.configAFKTimer.Value + " minutes.");
					}
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					return false;
				}
			}
			if (text.Length >= 8 && text.Substring(0, 8) == "/setname")
			{
				if (text.Length > 8)
				{
					string text25 = text.Substring(9);
					Plugin.configNameBase.Value = text25;
					MonoSingleton<DataManager>.I.PlayerData.Name = text25;
					if ((Object)(object)MonoSingleton<MainSceneManager>.I != (Object)null)
					{
						NetworkSingleton<TextChannelManager>.I.MainCustomizationController.UpdatePlayerInfo(MonoSingleton<DataManager>.I.PlayerData.GetPlayerIdInfo(), default(RPCInfo));
						TextMeshProUGUI playerText4 = MonoSingleton<UIManager>.I.PlayerText;
						string text4 = (NetworkSingleton<TextChannelManager>.I.UserName = MonoSingleton<DataManager>.I.PlayerData.Name);
						string text6 = (((TMP_Text)playerText4).text = text4);
						string text27 = text6;
					}
					NetworkSingleton<TextChannelManager>.I.AddNotification("Name changed to " + Plugin.configNameBase.Value + ".");
				}
				else
				{
					NetworkSingleton<TextChannelManager>.I.AddNotification("Name currently registered as " + Plugin.configNameBase.Value + ".");
				}
				MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
				EventSystem.current.SetSelectedGameObject((GameObject)null);
				MonoSingleton<UIManager>.I.MessageInput.text = "";
				return false;
			}
			if (text.Length >= 7)
			{
				switch (text.Substring(0, 7))
				{
				case "/brbmsg":
					if (text.Length > 8)
					{
						Plugin.configBRBMessage.Value = text.Substring(8);
						MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
						EventSystem.current.SetSelectedGameObject((GameObject)null);
						MonoSingleton<UIManager>.I.MessageInput.text = "";
						NetworkSingleton<TextChannelManager>.I.AddNotification("BRB message changed to " + Plugin.configBRBMessage.Value + ".");
						return false;
					}
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					NetworkSingleton<TextChannelManager>.I.AddNotification("BRB message currently set to " + Plugin.configBRBMessage.Value + ".");
					return false;
				case "/afkmsg":
					if (text.Length > 8)
					{
						Plugin.configAFKMessage.Value = text.Substring(8);
						MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
						EventSystem.current.SetSelectedGameObject((GameObject)null);
						MonoSingleton<UIManager>.I.MessageInput.text = "";
						NetworkSingleton<TextChannelManager>.I.AddNotification("AFK message changed to " + Plugin.configAFKMessage.Value + ".");
						return false;
					}
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					NetworkSingleton<TextChannelManager>.I.AddNotification("AFK message currently set to " + Plugin.configAFKMessage.Value + ".");
					return false;
				case "/status":
					if (text.Length > 8)
					{
						statusmsg = text.Substring(8);
						string value4 = Plugin.configNameBase.Value;
						string text28 = Plugin.configBracketType.Value.Substring(0, 1);
						string text29 = Plugin.configBracketType.Value.Substring(1);
						string value5 = Plugin.configCustomColor.Value;
						MonoSingleton<DataManager>.I.PlayerData.Name = value4 + " <color=#" + value5 + ">" + text28 + statusmsg + text29 + "</color>";
						if ((Object)(object)MonoSingleton<MainSceneManager>.I != (Object)null)
						{
							NetworkSingleton<TextChannelManager>.I.MainCustomizationController.UpdatePlayerInfo(MonoSingleton<DataManager>.I.PlayerData.GetPlayerIdInfo(), default(RPCInfo));
							TextMeshProUGUI playerText5 = MonoSingleton<UIManager>.I.PlayerText;
							string text4 = (NetworkSingleton<TextChannelManager>.I.UserName = MonoSingleton<DataManager>.I.PlayerData.Name);
							string text6 = (((TMP_Text)playerText5).text = text4);
							string text31 = text6;
						}
						MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
						EventSystem.current.SetSelectedGameObject((GameObject)null);
						MonoSingleton<UIManager>.I.MessageInput.text = "";
						NetworkSingleton<TextChannelManager>.I.AddNotification("Status changed to " + statusmsg + ".");
						return false;
					}
					statusmsg = "";
					MonoSingleton<DataManager>.I.PlayerData.Name = Plugin.configNameBase.Value;
					if ((Object)(object)MonoSingleton<MainSceneManager>.I != (Object)null)
					{
						NetworkSingleton<TextChannelManager>.I.MainCustomizationController.UpdatePlayerInfo(MonoSingleton<DataManager>.I.PlayerData.GetPlayerIdInfo(), default(RPCInfo));
						TextMeshProUGUI playerText6 = MonoSingleton<UIManager>.I.PlayerText;
						string text4 = (NetworkSingleton<TextChannelManager>.I.UserName = MonoSingleton<DataManager>.I.PlayerData.Name);
						string text6 = (((TMP_Text)playerText6).text = text4);
						string text33 = text6;
					}
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					NetworkSingleton<TextChannelManager>.I.AddNotification("Status message cleared.");
					return false;
				}
			}
			if (text.Length == 7)
			{
				string text34 = text;
				string text35 = text34;
				if (text35 == "/useafk")
				{
					Plugin.configUseAFK.Value = !Plugin.configUseAFK.Value;
					string text36 = (Plugin.configUseAFK.Value ? "on" : "off");
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					NetworkSingleton<TextChannelManager>.I.AddNotification("AFK system turned " + text36 + ".");
					return false;
				}
				if (text35 == "/usebrb")
				{
					Plugin.configUseBRB.Value = !Plugin.configUseBRB.Value;
					string text37 = (Plugin.configUseBRB.Value ? "on" : "off");
					MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
					EventSystem.current.SetSelectedGameObject((GameObject)null);
					MonoSingleton<UIManager>.I.MessageInput.text = "";
					NetworkSingleton<TextChannelManager>.I.AddNotification("BRB system turned " + text37 + ".");
					return false;
				}
			}
			if (text.Length == 5 && text == "/help")
			{
				NetworkSingleton<TextChannelManager>.I.AddNotification("Available commands:");
				NetworkSingleton<TextChannelManager>.I.AddNotification("/setname <color=#4394b0>name</color>");
				NetworkSingleton<TextChannelManager>.I.AddNotification("/status <color=#4394b0>anything</color>");
				NetworkSingleton<TextChannelManager>.I.AddNotification("/statuscolor <color=#9db143>123456</color>");
				NetworkSingleton<TextChannelManager>.I.AddNotification("/clearstatus");
				NetworkSingleton<TextChannelManager>.I.AddNotification("/changebrackets <color=#4394b0>()</color>");
				NetworkSingleton<TextChannelManager>.I.AddNotification("/useafk, /usebrb (same syntax applies for all below)");
				NetworkSingleton<TextChannelManager>.I.AddNotification("/afkmsg <color=#4394b0>AFK</color>");
				NetworkSingleton<TextChannelManager>.I.AddNotification("/afktimer <color=#a83131>x</color> (in minutes)");
				NetworkSingleton<TextChannelManager>.I.AddNotification("/afkcolor <color=#9db143>123456</color>");
				MonoSingleton<TaskManager>.I.SetLockState((LockState)(NetworkSingleton<MusicManager>.I.IsActive ? 5 : 0));
				EventSystem.current.SetSelectedGameObject((GameObject)null);
				MonoSingleton<UIManager>.I.MessageInput.text = "";
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(UIManager))]
	internal class CharLimitPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void limitLifter(ref TMP_InputField ____messageInputField)
		{
			____messageInputField.characterLimit = 250;
		}
	}
}