Decompiled source of RPNames v1.3.7

RPNames.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Configuration;
using BepInEx.Logging;
using CodeTalker.Networking;
using CodeTalker.Packets;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
using Newtonsoft.Json;
using RPNames.Packets;
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("s0apy.RPNames.sftwre")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.3.7.0")]
[assembly: AssemblyInformationalVersion("1.3.7+78fa11de36931d41f452dd4ee2578bd84075e1b6")]
[assembly: AssemblyProduct("RPNames")]
[assembly: AssemblyTitle("RPNames")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.7.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 RPNames
{
	public class CharacterTitleProfile
	{
		[JsonIgnore]
		public uint TargetNetID { get; set; }

		public string Title { get; set; } = "";


		public BracketType BracketStyle { get; set; } = BracketType.Parentheses;


		public TextAnimationType TextAnimation { get; set; } = TextAnimationType.Static;


		public ColoringType Coloring { get; set; } = ColoringType.None;


		public float AnimationSpeed { get; set; } = 0.25f;


		public int MarqueeWidth { get; set; } = 16;


		public string SingleHexColor { get; set; } = "FFFFFF";


		public string GradientStartColor { get; set; } = "FF0000";


		public string GradientEndColor { get; set; } = "0000FF";


		public bool AnimateGradient { get; set; } = false;


		public float GradientSpread { get; set; } = 10f;


		public float RainbowWaveSpread { get; set; } = 15f;


		public float ColorAnimationSpeed { get; set; } = 1f;


		public string Pronouns { get; set; } = "";


		public bool ShowPronouns { get; set; } = false;


		public BracketType PronounBracketStyle { get; set; } = BracketType.Parentheses;


		public bool ShareTitleColoring { get; set; } = true;


		public ColoringType PronounColoring { get; set; } = ColoringType.None;


		public string PronounSingleHexColor { get; set; } = "FFFFFF";


		public string PronounGradientStartColor { get; set; } = "FF0000";


		public string PronounGradientEndColor { get; set; } = "0000FF";


		public bool PronounAnimateGradient { get; set; } = false;


		public float PronounGradientSpread { get; set; } = 10f;


		public float PronounRainbowWaveSpread { get; set; } = 15f;


		public float PronounColorAnimationSpeed { get; set; } = 1f;


		public bool TitleOnNewLine { get; set; } = true;


		public bool AddGapAboveTitle { get; set; } = true;

	}
	public enum TextAnimationType
	{
		Static,
		Scroll,
		Marquee,
		Typewriter
	}
	public enum ColoringType
	{
		None,
		SingleColor,
		Rainbow,
		Gradient,
		Wave,
		StaticRainbow
	}
	public enum BracketType
	{
		None,
		Parentheses,
		SquareBrackets,
		Tilde,
		Dash,
		Plus,
		Equals,
		Asterisk,
		Dollar,
		Hash,
		Exclamation,
		Pipe
	}
	internal class PlayerTitleAnimator
	{
		public uint NetId;

		public float AnimationTimer = 0f;

		public int AnimationIndex = 0;

		public bool IsAnimatingForward = true;

		public float RainbowHue = 0f;

		public Main.TypewriterState TypewriterState = Main.TypewriterState.Typing;

		public float TypewriterPauseTimer = 0f;

		public bool TypewriterCursorVisible = true;

		public float TypewriterBlinkTimer = 0f;

		public PlayerTitleAnimator(uint netId)
		{
			NetId = netId;
		}
	}
	[BepInPlugin("s0apy.RPNames.sftwre", "RPNames", "1.3.7")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		internal enum TypewriterState
		{
			Typing,
			Blinking,
			Backspacing
		}

		private enum MenuState
		{
			Closed,
			Opening,
			Open,
			Closing
		}

		public static Main instance;

		internal static ManualLogSource Log;

		internal static bool IsReady = false;

		private static ConfigEntry<string> _characterProfilesJson;

		internal Dictionary<int, CharacterTitleProfile> AllCharacterProfiles = new Dictionary<int, CharacterTitleProfile>();

		internal static int CurrentCharacterSlot = -1;

		private ConfigEntry<KeyCode> _menuKey;

		private Rect _windowRect = new Rect(20f, 20f, 360f, 850f);

		private CharacterTitleProfile _uiEditingProfile = new CharacterTitleProfile();

		private bool _showTextAnimPicker;

		private bool _showColoringPicker;

		private bool _showBracketPicker;

		private bool _showPronounBracketPicker;

		private bool _showPresetPicker;

		private bool _showPronounColoringPicker;

		private Vector2 _scrollPosition = Vector2.zero;

		internal static bool _isCodeTalkerLoaded = false;

		private static CharacterTitleProfile _copiedProfileBuffer = null;

		internal static Dictionary<uint, PlayerTitleAnimator> AllPlayerAnimators = new Dictionary<uint, PlayerTitleAnimator>();

		private Color _gradientStartColorCache;

		private Color _gradientEndColorCache;

		private static readonly List<string> _presetTitles = new List<string>();

		private bool _showSingleColorPicker;

		private bool _showGradientStartPicker;

		private bool _showGradientEndPicker;

		private bool _showPronounSingleColorPicker;

		private bool _showPronounGradientStartPicker;

		private bool _showPronounGradientEndPicker;

		private Color _uiEditingColor;

		private MenuState _menuState = MenuState.Closed;

		private float _animationProgress = 0f;

		private const float AnimationDuration = 0.25f;

		private bool _stylesInitialized = false;

		private GUISkin _modSkin;

		public static GUISkin OriginalSkin;

		private void Awake()
		{
			instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			_menuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("1. General", "Menu Key", (KeyCode)289, "The key to press to show/hide the settings menu.");
			_characterProfilesJson = ((BaseUnityPlugin)this).Config.Bind<string>("2. Data", "CharacterProfiles", "{}", "Stores all title profiles for all character slots in JSON format.");
			LoadProfiles();
			PopulatePresetTitles();
			if (Type.GetType("CodeTalker.Networking.CodeTalkerNetwork, CodeTalker") != null)
			{
				_isCodeTalkerLoaded = true;
			}
			Harmony.CreateAndPatchAll(typeof(HarmonyPatches), (string)null);
			Log.LogInfo((object)"[RPNames v1.3.7] has loaded.");
		}

		private void InitializeGUIStyles()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Expected O, but got Unknown
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Expected O, but got Unknown
			//IL_02ce: Expected O, but got Unknown
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Expected O, but got Unknown
			//IL_02fb: Expected O, but got Unknown
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Expected O, but got Unknown
			//IL_03cd: Expected O, but got Unknown
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: 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)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Expected O, but got Unknown
			//IL_0429: Expected O, but got Unknown
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Expected O, but got Unknown
			if ((Object)(object)OriginalSkin == (Object)null)
			{
				OriginalSkin = GUI.skin;
			}
			_modSkin = Object.Instantiate<GUISkin>(GUI.skin);
			GUISkin modSkin = _modSkin;
			GUIStyle val = new GUIStyle(GUI.skin.window);
			val.normal.background = MakeTex(new Color(0.1f, 0.12f, 0.15f, 0.97f));
			val.normal.textColor = new Color(0.9f, 0.9f, 0.9f);
			val.onNormal.background = MakeTex(new Color(0.1f, 0.12f, 0.15f, 0.97f));
			val.onNormal.textColor = new Color(0.9f, 0.9f, 0.9f);
			val.padding = new RectOffset(15, 15, 30, 15);
			val.border = new RectOffset(2, 2, 2, 2);
			val.alignment = (TextAnchor)1;
			val.fontSize = 16;
			val.fontStyle = (FontStyle)1;
			modSkin.window = val;
			GUISkin modSkin2 = _modSkin;
			GUIStyle val2 = new GUIStyle(GUI.skin.box);
			val2.normal.background = MakeTex(new Color(0.2f, 0.22f, 0.25f, 0.5f));
			modSkin2.box = val2;
			_modSkin.label.normal.textColor = new Color(0.85f, 0.85f, 0.85f);
			GUISkin modSkin3 = _modSkin;
			GUIStyle val3 = new GUIStyle(GUI.skin.button);
			val3.normal.background = MakeTex(new Color(0.3f, 0.35f, 0.4f));
			val3.normal.textColor = Color.white;
			val3.hover.background = MakeTex(new Color(0.4f, 0.45f, 0.5f));
			val3.hover.textColor = Color.white;
			val3.active.background = MakeTex(new Color(0.2f, 0.25f, 0.3f));
			val3.active.textColor = Color.white;
			val3.onNormal.background = MakeTex(new Color(0.5f, 0.55f, 0.6f));
			val3.onNormal.textColor = Color.white;
			val3.onHover.background = MakeTex(new Color(0.55f, 0.6f, 0.65f));
			val3.onHover.textColor = Color.white;
			val3.border = new RectOffset(4, 4, 4, 4);
			val3.padding = new RectOffset(8, 8, 8, 8);
			modSkin3.button = val3;
			_modSkin.toggle = new GUIStyle(_modSkin.toggle)
			{
				padding = new RectOffset(25, 0, 3, 3)
			};
			_modSkin.toggle.normal.background = MakeToggleTex(on: false);
			_modSkin.toggle.onNormal.background = MakeToggleTex(on: true);
			_modSkin.toggle.hover.background = MakeToggleTex(on: false);
			_modSkin.toggle.onHover.background = MakeToggleTex(on: true);
			GUISkin modSkin4 = _modSkin;
			GUIStyle val4 = new GUIStyle(GUI.skin.textField);
			val4.normal.background = MakeTex(new Color(0.05f, 0.05f, 0.05f));
			val4.normal.textColor = Color.white;
			val4.padding = new RectOffset(5, 5, 5, 5);
			modSkin4.textField = val4;
			GUISkin modSkin5 = _modSkin;
			GUIStyle val5 = new GUIStyle(GUI.skin.horizontalSlider);
			val5.normal.background = MakeTex(new Color(0.15f, 0.17f, 0.2f));
			val5.fixedHeight = 10f;
			val5.border = new RectOffset(2, 2, 2, 2);
			modSkin5.horizontalSlider = val5;
			GUISkin modSkin6 = _modSkin;
			GUIStyle val6 = new GUIStyle(GUI.skin.horizontalSliderThumb);
			val6.normal.background = MakeTex(new Color(0.6f, 0.65f, 0.7f));
			val6.hover.background = MakeTex(new Color(0.7f, 0.75f, 0.8f));
			val6.active.background = MakeTex(new Color(0.5f, 0.55f, 0.6f));
			val6.fixedHeight = 18f;
			val6.fixedWidth = 10f;
			modSkin6.horizontalSliderThumb = val6;
			_stylesInitialized = true;
			static Texture2D MakeTex(Color col)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Expected O, but got Unknown
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				Texture2D val11 = new Texture2D(1, 1);
				val11.SetPixel(0, 0, col);
				val11.Apply();
				((Object)val11).hideFlags = (HideFlags)61;
				return val11;
			}
			static Texture2D MakeToggleTex(bool on)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Expected O, but got Unknown
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				Texture2D val7 = new Texture2D(16, 16);
				Color val8 = default(Color);
				((Color)(ref val8))..ctor(0.2f, 0.22f, 0.25f);
				Color val9 = default(Color);
				((Color)(ref val9))..ctor(0.4f, 0.45f, 0.5f);
				Color val10 = default(Color);
				((Color)(ref val10))..ctor(0.8f, 0.85f, 0.9f);
				for (int i = 0; i < 16; i++)
				{
					for (int j = 0; j < 16; j++)
					{
						if (j < 1 || j > 14 || i < 1 || i > 14)
						{
							val7.SetPixel(j, i, val9);
						}
						else
						{
							val7.SetPixel(j, i, val8);
						}
					}
				}
				if (on)
				{
					for (int k = 4; k < 12; k++)
					{
						for (int l = 4; l < 12; l++)
						{
							val7.SetPixel(l, k, val10);
						}
					}
				}
				val7.Apply();
				((Object)val7).hideFlags = (HideFlags)61;
				return val7;
			}
		}

		private void LoadProfiles()
		{
			try
			{
				Dictionary<int, CharacterTitleProfile> dictionary = JsonConvert.DeserializeObject<Dictionary<int, CharacterTitleProfile>>(_characterProfilesJson.Value);
				if (dictionary != null)
				{
					AllCharacterProfiles = dictionary;
				}
			}
			catch
			{
				AllCharacterProfiles = new Dictionary<int, CharacterTitleProfile>();
			}
		}

		private void SaveProfiles()
		{
			_characterProfilesJson.Value = JsonConvert.SerializeObject((object)AllCharacterProfiles, (Formatting)1);
			((BaseUnityPlugin)this).Config.Save();
		}

		private void PopulatePresetTitles()
		{
			_presetTitles.Clear();
			_presetTitles.AddRange(new string[14]
			{
				"The Explorer", "The Patient", "Dragonslayer", "Scarab Lord", "The Undying", "The Insane", "Grand Marshal", "High Warlord", "Arena Master", "Salty",
				"Chef", "Guardian of Cenarius", "Hand of A'dal", "Master Angler"
			});
		}

		public static void OnProfileUpdate(PacketHeader header, BinaryPacketBase packet)
		{
			if (packet is UpdateTitleProfilePacket updateTitleProfilePacket)
			{
				ApplyProfileUpdate(updateTitleProfilePacket.TargetNetID, updateTitleProfilePacket.Profile);
			}
		}

		public static void OnFullSync(PacketHeader header, BinaryPacketBase packet)
		{
			if (!(packet is SyncAllProfilesPacket syncAllProfilesPacket))
			{
				return;
			}
			foreach (KeyValuePair<uint, CharacterTitleProfile> allProfile in syncAllProfilesPacket.AllProfiles)
			{
				ApplyProfileUpdate(allProfile.Key, allProfile.Value);
			}
		}

		private static void ApplyProfileUpdate(uint netId, CharacterTitleProfile profile)
		{
			if (profile == null || (string.IsNullOrEmpty(profile.Title) && (!profile.ShowPronouns || string.IsNullOrEmpty(profile.Pronouns))))
			{
				if (HarmonyPatches.PlayerProfiles.ContainsKey(netId))
				{
					HarmonyPatches.PlayerProfiles.Remove(netId);
				}
				if (HarmonyPatches.CurrentPlayerTitles.ContainsKey(netId))
				{
					HarmonyPatches.CurrentPlayerTitles.Remove(netId);
				}
				if (AllPlayerAnimators.ContainsKey(netId))
				{
					AllPlayerAnimators.Remove(netId);
				}
				return;
			}
			profile.TargetNetID = netId;
			if (HarmonyPatches.PlayerProfiles.ContainsKey(netId))
			{
				HarmonyPatches.PlayerProfiles[netId] = profile;
			}
			else
			{
				HarmonyPatches.PlayerProfiles.Add(netId, profile);
			}
			if (AllPlayerAnimators.ContainsKey(netId))
			{
				AllPlayerAnimators.Remove(netId);
			}
			if (instance.ShouldAnimate(profile))
			{
				PlayerTitleAnimator playerTitleAnimator = new PlayerTitleAnimator(netId);
				AllPlayerAnimators.Add(netId, playerTitleAnimator);
				string animatedText = instance.GetAnimatedText(profile, playerTitleAnimator);
				if (HarmonyPatches.CurrentPlayerTitles.ContainsKey(netId))
				{
					HarmonyPatches.CurrentPlayerTitles[netId] = animatedText;
				}
				else
				{
					HarmonyPatches.CurrentPlayerTitles.Add(netId, animatedText);
				}
			}
			else if (HarmonyPatches.CurrentPlayerTitles.ContainsKey(netId))
			{
				HarmonyPatches.CurrentPlayerTitles[netId] = profile.Title;
			}
			else
			{
				HarmonyPatches.CurrentPlayerTitles.Add(netId, profile.Title);
			}
		}

		public static void OnSyncRequest(PacketHeader header, PacketBase packet)
		{
			if (packet is RequestAllTitlesPacket)
			{
				CodeTalkerNetwork.SendBinaryNetworkPacket((BinaryPacketBase)(object)new SyncAllProfilesPacket(HarmonyPatches.PlayerProfiles));
			}
		}

		public static void SendTitleUpdate(CharacterTitleProfile profile)
		{
			Player mainPlayer = Player._mainPlayer;
			uint num = ((mainPlayer != null) ? ((NetworkBehaviour)mainPlayer).netId : 0u);
			if (num != 0)
			{
				if (_isCodeTalkerLoaded)
				{
					CodeTalkerNetwork.SendBinaryNetworkPacket((BinaryPacketBase)(object)new UpdateTitleProfilePacket(num, profile));
				}
				ApplyProfileUpdate(num, profile);
			}
		}

		public static void RequestFullTitleSync()
		{
			if (_isCodeTalkerLoaded)
			{
				CodeTalkerNetwork.SendNetworkPacket((PacketBase)(object)new RequestAllTitlesPacket());
			}
		}

		private void Update()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			switch (_menuState)
			{
			case MenuState.Opening:
				_animationProgress = Mathf.Clamp01(_animationProgress + Time.unscaledDeltaTime / 0.25f);
				if (_animationProgress >= 1f)
				{
					_menuState = MenuState.Open;
				}
				break;
			case MenuState.Closing:
				_animationProgress = Mathf.Clamp01(_animationProgress - Time.unscaledDeltaTime / 0.25f);
				if (_animationProgress <= 0f)
				{
					_menuState = MenuState.Closed;
				}
				break;
			}
			if (Input.GetKeyDown(_menuKey.Value))
			{
				if (_menuState == MenuState.Open || _menuState == MenuState.Opening)
				{
					_menuState = MenuState.Closing;
					_showTextAnimPicker = (_showColoringPicker = (_showBracketPicker = (_showPresetPicker = (_showPronounBracketPicker = (_showPronounColoringPicker = false)))));
				}
				else
				{
					_menuState = MenuState.Opening;
					LoadUIFromProfile((CurrentCharacterSlot >= 0) ? CurrentCharacterSlot : 0);
				}
			}
			foreach (PlayerTitleAnimator item in AllPlayerAnimators.Values.ToList())
			{
				if (!HarmonyPatches.PlayerProfiles.TryGetValue(item.NetId, out CharacterTitleProfile value) || value == null)
				{
					AllPlayerAnimators.Remove(item.NetId);
					continue;
				}
				bool flag = false;
				item.AnimationTimer += Time.deltaTime;
				if (item.AnimationTimer >= value.AnimationSpeed)
				{
					item.AnimationTimer = 0f;
					flag = true;
				}
				bool flag2 = false;
				if (ShouldAnimateColor(value) || ShouldAnimatePronounColor(value))
				{
					item.RainbowHue = (item.RainbowHue + Time.deltaTime * value.ColorAnimationSpeed * 0.1f) % 1f;
					flag2 = true;
				}
				if (value.TextAnimation == TextAnimationType.Typewriter && item.TypewriterState == TypewriterState.Blinking)
				{
					item.TypewriterPauseTimer += Time.deltaTime;
					item.TypewriterBlinkTimer += Time.deltaTime;
					if (item.TypewriterBlinkTimer >= 0.5f)
					{
						item.TypewriterBlinkTimer = 0f;
						item.TypewriterCursorVisible = !item.TypewriterCursorVisible;
						flag = true;
					}
					if (item.TypewriterPauseTimer >= 5f)
					{
						item.TypewriterPauseTimer = 0f;
						item.TypewriterState = TypewriterState.Backspacing;
					}
				}
				if (flag)
				{
					switch (value.TextAnimation)
					{
					case TextAnimationType.Scroll:
						if (item.IsAnimatingForward)
						{
							item.AnimationIndex++;
							if (item.AnimationIndex >= value.Title.Length)
							{
								item.AnimationIndex = value.Title.Length;
								item.IsAnimatingForward = false;
							}
						}
						else
						{
							item.AnimationIndex--;
							if (item.AnimationIndex <= 1)
							{
								item.AnimationIndex = 1;
								item.IsAnimatingForward = true;
							}
						}
						break;
					case TextAnimationType.Marquee:
					{
						string text = new string(' ', value.MarqueeWidth);
						string text2 = text + value.Title + text;
						item.AnimationIndex = (item.AnimationIndex + 1) % (text2.Length - value.MarqueeWidth);
						break;
					}
					case TextAnimationType.Typewriter:
						switch (item.TypewriterState)
						{
						case TypewriterState.Typing:
							if (item.AnimationIndex < value.Title.Length)
							{
								item.AnimationIndex++;
								break;
							}
							item.TypewriterState = TypewriterState.Blinking;
							item.TypewriterPauseTimer = (item.TypewriterBlinkTimer = 0f);
							item.TypewriterCursorVisible = true;
							break;
						case TypewriterState.Backspacing:
							if (item.AnimationIndex > 0)
							{
								item.AnimationIndex--;
							}
							else
							{
								item.TypewriterState = TypewriterState.Typing;
							}
							break;
						}
						break;
					}
				}
				if (flag || flag2)
				{
					string animatedText = GetAnimatedText(value, item);
					if (HarmonyPatches.CurrentPlayerTitles.ContainsKey(item.NetId))
					{
						HarmonyPatches.CurrentPlayerTitles[item.NetId] = animatedText;
					}
					else
					{
						HarmonyPatches.CurrentPlayerTitles.Add(item.NetId, animatedText);
					}
				}
			}
		}

		internal string GetAnimatedText(CharacterTitleProfile profile, PlayerTitleAnimator animator)
		{
			if (string.IsNullOrEmpty(profile.Title))
			{
				return "";
			}
			switch (profile.TextAnimation)
			{
			case TextAnimationType.Scroll:
				return profile.Title.Substring(0, animator.AnimationIndex);
			case TextAnimationType.Marquee:
			{
				string text2 = new string(' ', profile.MarqueeWidth);
				string text3 = text2 + profile.Title + text2;
				return text3.Substring(animator.AnimationIndex, profile.MarqueeWidth);
			}
			case TextAnimationType.Typewriter:
			{
				if (animator.AnimationIndex > profile.Title.Length)
				{
					animator.AnimationIndex = profile.Title.Length;
				}
				string text = profile.Title.Substring(0, animator.AnimationIndex);
				if (animator.TypewriterState == TypewriterState.Blinking)
				{
					return profile.Title + (animator.TypewriterCursorVisible ? "|" : "");
				}
				return text + "|";
			}
			default:
				return profile.Title;
			}
		}

		internal string ApplyColoring(string text, CharacterTitleProfile p, PlayerTitleAnimator a, bool isForPronoun)
		{
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: 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_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(text))
			{
				return "";
			}
			if (isForPronoun && p.ShareTitleColoring)
			{
				isForPronoun = false;
			}
			float num = a?.RainbowHue ?? 0f;
			ColoringType coloringType = (isForPronoun ? p.PronounColoring : p.Coloring);
			string text2 = (isForPronoun ? p.PronounSingleHexColor : p.SingleHexColor);
			string text3 = (isForPronoun ? p.PronounGradientStartColor : p.GradientStartColor);
			string text4 = (isForPronoun ? p.PronounGradientEndColor : p.GradientEndColor);
			bool flag = (isForPronoun ? p.PronounAnimateGradient : p.AnimateGradient);
			float num2 = (isForPronoun ? p.PronounGradientSpread : p.GradientSpread);
			float num3 = (isForPronoun ? p.PronounRainbowWaveSpread : p.RainbowWaveSpread);
			switch (coloringType)
			{
			case ColoringType.SingleColor:
				return "<color=#" + text2.Replace("#", "") + ">" + text + "</color>";
			case ColoringType.Rainbow:
				return "<color=#" + ColorUtility.ToHtmlStringRGB(Color.HSVToRGB(num, 1f, 1f)) + ">" + text + "</color>";
			case ColoringType.Gradient:
			{
				Color val = default(Color);
				ColorUtility.TryParseHtmlString("#" + text3, ref val);
				Color val2 = default(Color);
				ColorUtility.TryParseHtmlString("#" + text4, ref val2);
				StringBuilder stringBuilder2 = new StringBuilder();
				if (flag)
				{
					for (int j = 0; j < text.Length; j++)
					{
						float num5 = num + (float)j / num2;
						float num6 = 1f - Mathf.Abs(num5 * 2f % 2f - 1f);
						Color val3 = Color.Lerp(val, val2, num6);
						stringBuilder2.Append($"<color=#{ColorUtility.ToHtmlStringRGB(val3)}>{text[j]}</color>");
					}
				}
				else
				{
					for (int k = 0; k < text.Length; k++)
					{
						float num7 = ((text.Length <= 1) ? 0f : ((float)k / (float)(text.Length - 1)));
						Color val4 = Color.Lerp(val, val2, num7);
						stringBuilder2.Append($"<color=#{ColorUtility.ToHtmlStringRGB(val4)}>{text[k]}</color>");
					}
				}
				return stringBuilder2.ToString();
			}
			case ColoringType.Wave:
			{
				StringBuilder stringBuilder3 = new StringBuilder();
				for (int l = 0; l < text.Length; l++)
				{
					float num8 = (num + (float)l / num3) % 1f;
					stringBuilder3.Append($"<color=#{ColorUtility.ToHtmlStringRGB(Color.HSVToRGB(num8, 1f, 1f))}>{text[l]}</color>");
				}
				return stringBuilder3.ToString();
			}
			case ColoringType.StaticRainbow:
			{
				StringBuilder stringBuilder = new StringBuilder();
				for (int i = 0; i < text.Length; i++)
				{
					float num4 = (float)i / num3 % 1f;
					stringBuilder.Append($"<color=#{ColorUtility.ToHtmlStringRGB(Color.HSVToRGB(num4, 1f, 1f))}>{text[i]}</color>");
				}
				return stringBuilder.ToString();
			}
			default:
				return text;
			}
		}

		internal void UpdateGradientCache(CharacterTitleProfile profile)
		{
			ColorUtility.TryParseHtmlString("#" + profile.GradientStartColor, ref _gradientStartColorCache);
			ColorUtility.TryParseHtmlString("#" + profile.GradientEndColor, ref _gradientEndColorCache);
		}

		internal bool ShouldAnimate(CharacterTitleProfile p)
		{
			return p != null && !string.IsNullOrEmpty(p.Title) && (p.TextAnimation != 0 || ShouldAnimateColor(p) || ShouldAnimatePronounColor(p));
		}

		internal bool ShouldAnimateColor(CharacterTitleProfile p)
		{
			return p.Coloring == ColoringType.Rainbow || p.Coloring == ColoringType.Wave || (p.Coloring == ColoringType.Gradient && p.AnimateGradient);
		}

		internal bool ShouldAnimatePronounColor(CharacterTitleProfile p)
		{
			return p.ShowPronouns && (p.ShareTitleColoring ? ShouldAnimateColor(p) : (p.PronounColoring == ColoringType.Rainbow || p.PronounColoring == ColoringType.Wave || (p.PronounColoring == ColoringType.Gradient && p.PronounAnimateGradient)));
		}

		private void OnGUI()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00a9: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			if (_menuState == MenuState.Closed)
			{
				return;
			}
			if (!_stylesInitialized)
			{
				try
				{
					InitializeGUIStyles();
				}
				catch (Exception)
				{
				}
			}
			GUI.skin = _modSkin;
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
			float num = easeOut(_animationProgress);
			float num2 = 0f - ((Rect)(ref _windowRect)).width;
			float num3 = 20f;
			Rect windowRect = _windowRect;
			((Rect)(ref windowRect)).x = Mathf.Lerp(num2, num3, num);
			_windowRect = GUILayout.Window(1863, windowRect, new WindowFunction(DrawSettingsWindow), "RPNames Settings", Array.Empty<GUILayoutOption>());
			GUI.skin = OriginalSkin;
			static float easeOut(float t)
			{
				return 1f - Mathf.Pow(1f - t, 3f);
			}
		}

		private void LoadUIFromProfile(int slot)
		{
			if (slot == -1)
			{
				_uiEditingProfile = new CharacterTitleProfile();
				return;
			}
			if (!AllCharacterProfiles.TryGetValue(slot, out CharacterTitleProfile value))
			{
				value = new CharacterTitleProfile();
			}
			_uiEditingProfile = JsonConvert.DeserializeObject<CharacterTitleProfile>(JsonConvert.SerializeObject((object)value));
		}

		private void DrawSettingsWindow(int windowID)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: 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_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Expected O, but got Unknown
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Expected O, but got Unknown
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_0676: Unknown result type (might be due to invalid IL or missing references)
			//IL_067e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Expected O, but got Unknown
			//IL_06c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Expected O, but got Unknown
			if (CurrentCharacterSlot == -1)
			{
				GUILayout.FlexibleSpace();
				GUILayout.Label("Please load a character to edit their profile.", Array.Empty<GUILayoutOption>());
				GUILayout.FlexibleSpace();
				GUI.DragWindow();
				return;
			}
			GUILayout.Label($"Editing Profile for Slot: {CurrentCharacterSlot + 1}", Array.Empty<GUILayoutOption>());
			_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Title", new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			}, Array.Empty<GUILayoutOption>());
			_uiEditingProfile.Title = GUILayout.TextField(_uiEditingProfile.Title, 50, Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Select a Preset", Array.Empty<GUILayoutOption>()))
			{
				_showPresetPicker = !_showPresetPicker;
			}
			if (_showPresetPicker)
			{
				Vector2 zero = Vector2.zero;
				zero = GUILayout.BeginScrollView(zero, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(100f) });
				foreach (string presetTitle in _presetTitles)
				{
					if (GUILayout.Button(presetTitle, Array.Empty<GUILayoutOption>()))
					{
						_uiEditingProfile.Title = presetTitle;
						_showPresetPicker = false;
					}
				}
				GUILayout.EndScrollView();
			}
			GUILayout.Space(10f);
			GUILayout.Label("--- Pronouns ---", new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			}, Array.Empty<GUILayoutOption>());
			_uiEditingProfile.ShowPronouns = GUILayout.Toggle(_uiEditingProfile.ShowPronouns, " Show Pronouns", Array.Empty<GUILayoutOption>());
			if (_uiEditingProfile.ShowPronouns)
			{
				_uiEditingProfile.Pronouns = GUILayout.TextField(_uiEditingProfile.Pronouns, 50, Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("Pronoun Brackets:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
				if (GUILayout.Button(_uiEditingProfile.PronounBracketStyle.ToString(), Array.Empty<GUILayoutOption>()))
				{
					_showPronounBracketPicker = !_showPronounBracketPicker;
				}
				GUILayout.EndHorizontal();
				if (_showPronounBracketPicker)
				{
					string[] names = Enum.GetNames(typeof(BracketType));
					int num = GUILayout.SelectionGrid((int)_uiEditingProfile.PronounBracketStyle, names, 3, Array.Empty<GUILayoutOption>());
					if (num != (int)_uiEditingProfile.PronounBracketStyle)
					{
						_uiEditingProfile.PronounBracketStyle = (BracketType)num;
						_showPronounBracketPicker = false;
					}
				}
			}
			GUILayout.Space(10f);
			GUILayout.Label("--- Display Options ---", new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			}, Array.Empty<GUILayoutOption>());
			_uiEditingProfile.TitleOnNewLine = GUILayout.Toggle(_uiEditingProfile.TitleOnNewLine, " Display on New Line", Array.Empty<GUILayoutOption>());
			if (_uiEditingProfile.TitleOnNewLine)
			{
				_uiEditingProfile.AddGapAboveTitle = GUILayout.Toggle(_uiEditingProfile.AddGapAboveTitle, " Add Gap Above", Array.Empty<GUILayoutOption>());
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Title Brackets:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			if (GUILayout.Button(_uiEditingProfile.BracketStyle.ToString(), Array.Empty<GUILayoutOption>()))
			{
				_showBracketPicker = !_showBracketPicker;
			}
			GUILayout.EndHorizontal();
			if (_showBracketPicker)
			{
				string[] names2 = Enum.GetNames(typeof(BracketType));
				int num2 = GUILayout.SelectionGrid((int)_uiEditingProfile.BracketStyle, names2, 3, Array.Empty<GUILayoutOption>());
				if (num2 != (int)_uiEditingProfile.BracketStyle)
				{
					_uiEditingProfile.BracketStyle = (BracketType)num2;
					_showBracketPicker = false;
				}
			}
			GUILayout.Space(10f);
			GUILayout.Label("--- Title Animation ---", new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			}, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Animation:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			if (GUILayout.Button(_uiEditingProfile.TextAnimation.ToString(), Array.Empty<GUILayoutOption>()))
			{
				_showTextAnimPicker = !_showTextAnimPicker;
			}
			GUILayout.EndHorizontal();
			if (_showTextAnimPicker)
			{
				string[] names3 = Enum.GetNames(typeof(TextAnimationType));
				int num3 = GUILayout.SelectionGrid((int)_uiEditingProfile.TextAnimation, names3, 3, Array.Empty<GUILayoutOption>());
				if (num3 != (int)_uiEditingProfile.TextAnimation)
				{
					_uiEditingProfile.TextAnimation = (TextAnimationType)num3;
					_showTextAnimPicker = false;
				}
			}
			if (_uiEditingProfile.TextAnimation != 0)
			{
				float num4 = Mathf.Lerp(10f, 1f, Mathf.InverseLerp(0.05f, 0.5f, _uiEditingProfile.AnimationSpeed));
				GUILayout.Label($"Animation Speed: {num4:F1}", Array.Empty<GUILayoutOption>());
				num4 = GUILayout.HorizontalSlider(num4, 1f, 10f, Array.Empty<GUILayoutOption>());
				_uiEditingProfile.AnimationSpeed = Mathf.Lerp(0.5f, 0.05f, Mathf.InverseLerp(1f, 10f, num4));
			}
			if (_uiEditingProfile.TextAnimation == TextAnimationType.Marquee)
			{
				GUILayout.Label($"Marquee Width: {_uiEditingProfile.MarqueeWidth}", Array.Empty<GUILayoutOption>());
				_uiEditingProfile.MarqueeWidth = (int)GUILayout.HorizontalSlider((float)_uiEditingProfile.MarqueeWidth, 5f, 40f, Array.Empty<GUILayoutOption>());
			}
			GUILayout.Space(10f);
			GUILayout.Label("--- Title Coloring ---", new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			}, Array.Empty<GUILayoutOption>());
			DrawColorCustomization(isForPronoun: false);
			if (_uiEditingProfile.ShowPronouns)
			{
				GUILayout.Space(10f);
				GUILayout.Label("--- Pronoun Coloring ---", new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontStyle = (FontStyle)1
				}, Array.Empty<GUILayoutOption>());
				_uiEditingProfile.ShareTitleColoring = GUILayout.Toggle(_uiEditingProfile.ShareTitleColoring, " Share Title Coloring", Array.Empty<GUILayoutOption>());
				if (!_uiEditingProfile.ShareTitleColoring)
				{
					DrawColorCustomization(isForPronoun: true);
				}
			}
			GUILayout.EndScrollView();
			GUILayout.FlexibleSpace();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Copy", Array.Empty<GUILayoutOption>()))
			{
				_copiedProfileBuffer = JsonConvert.DeserializeObject<CharacterTitleProfile>(JsonConvert.SerializeObject((object)_uiEditingProfile));
			}
			GUI.enabled = _copiedProfileBuffer != null;
			if (GUILayout.Button("Paste", Array.Empty<GUILayoutOption>()) && _copiedProfileBuffer != null)
			{
				_uiEditingProfile = JsonConvert.DeserializeObject<CharacterTitleProfile>(JsonConvert.SerializeObject((object)_copiedProfileBuffer));
			}
			GUI.enabled = true;
			GUILayout.EndHorizontal();
			if (GUILayout.Button("Set & Save", Array.Empty<GUILayoutOption>()))
			{
				AllCharacterProfiles[CurrentCharacterSlot] = JsonConvert.DeserializeObject<CharacterTitleProfile>(JsonConvert.SerializeObject((object)_uiEditingProfile));
				SaveProfiles();
				CharacterTitleProfile profile = AllCharacterProfiles[CurrentCharacterSlot];
				UpdateGradientCache(profile);
				SendTitleUpdate(profile);
				_menuState = MenuState.Closing;
			}
			if (GUILayout.Button("Clear All", Array.Empty<GUILayoutOption>()))
			{
				if (AllCharacterProfiles.ContainsKey(CurrentCharacterSlot))
				{
					AllCharacterProfiles.Remove(CurrentCharacterSlot);
				}
				SaveProfiles();
				SendTitleUpdate(null);
				LoadUIFromProfile(CurrentCharacterSlot);
			}
			GUI.DragWindow();
			void DrawColorCustomization(bool isForPronoun)
			{
				//IL_029b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_06d5: Expected O, but got Unknown
				//IL_0497: Unknown result type (might be due to invalid IL or missing references)
				//IL_049c: Unknown result type (might be due to invalid IL or missing references)
				//IL_057c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0581: Unknown result type (might be due to invalid IL or missing references)
				CharacterTitleProfile p = _uiEditingProfile;
				Action<ColoringType> action = delegate(ColoringType val)
				{
					if (isForPronoun)
					{
						p.PronounColoring = val;
					}
					else
					{
						p.Coloring = val;
					}
				};
				Action<string> action2 = delegate(string val)
				{
					if (isForPronoun)
					{
						p.PronounSingleHexColor = val;
					}
					else
					{
						p.SingleHexColor = val;
					}
				};
				Action<string> action3 = delegate(string val)
				{
					if (isForPronoun)
					{
						p.PronounGradientStartColor = val;
					}
					else
					{
						p.GradientStartColor = val;
					}
				};
				Action<string> action4 = delegate(string val)
				{
					if (isForPronoun)
					{
						p.PronounGradientEndColor = val;
					}
					else
					{
						p.GradientEndColor = val;
					}
				};
				Action<bool> action5 = delegate(bool val)
				{
					if (isForPronoun)
					{
						p.PronounAnimateGradient = val;
					}
					else
					{
						p.AnimateGradient = val;
					}
				};
				Action<float> action6 = delegate(float val)
				{
					if (isForPronoun)
					{
						p.PronounGradientSpread = val;
					}
					else
					{
						p.GradientSpread = val;
					}
				};
				Action<float> action7 = delegate(float val)
				{
					if (isForPronoun)
					{
						p.PronounRainbowWaveSpread = val;
					}
					else
					{
						p.RainbowWaveSpread = val;
					}
				};
				Action<float> action8 = delegate(float val)
				{
					if (isForPronoun)
					{
						p.PronounColorAnimationSpeed = val;
					}
					else
					{
						p.ColorAnimationSpeed = val;
					}
				};
				ref bool reference = ref isForPronoun ? ref _showPronounColoringPicker : ref _showColoringPicker;
				ref bool reference2 = ref isForPronoun ? ref _showPronounSingleColorPicker : ref _showSingleColorPicker;
				ref bool reference3 = ref isForPronoun ? ref _showPronounGradientStartPicker : ref _showGradientStartPicker;
				ref bool reference4 = ref isForPronoun ? ref _showPronounGradientEndPicker : ref _showGradientEndPicker;
				ColoringType coloringType = (isForPronoun ? p.PronounColoring : p.Coloring);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("Effect:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
				if (GUILayout.Button(coloringType.ToString(), Array.Empty<GUILayoutOption>()))
				{
					reference = !reference;
				}
				GUILayout.EndHorizontal();
				if (reference)
				{
					string[] names4 = Enum.GetNames(typeof(ColoringType));
					int num5 = GUILayout.SelectionGrid((int)coloringType, names4, 3, Array.Empty<GUILayoutOption>());
					if (num5 != (int)coloringType)
					{
						action((ColoringType)num5);
						reference = false;
						reference2 = (reference3 = (reference4 = false));
					}
				}
				Action<Action<string>> action9 = delegate(Action<string> setter)
				{
					//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c0: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
					//IL_010d: Expected O, but got Unknown
					//IL_010e: Unknown result type (might be due to invalid IL or missing references)
					//IL_011d: Unknown result type (might be due to invalid IL or missing references)
					GUILayout.BeginVertical(_modSkin.box, Array.Empty<GUILayoutOption>());
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
					_uiEditingColor.r = GUILayout.HorizontalSlider(_uiEditingColor.r, 0f, 1f, Array.Empty<GUILayoutOption>());
					_uiEditingColor.g = GUILayout.HorizontalSlider(_uiEditingColor.g, 0f, 1f, Array.Empty<GUILayoutOption>());
					_uiEditingColor.b = GUILayout.HorizontalSlider(_uiEditingColor.b, 0f, 1f, Array.Empty<GUILayoutOption>());
					GUILayout.EndVertical();
					Color backgroundColor = GUI.backgroundColor;
					GUI.backgroundColor = _uiEditingColor;
					GUIStyle val3 = new GUIStyle();
					val3.normal.background = Texture2D.whiteTexture;
					GUILayout.Box("", val3, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(40f),
						GUILayout.Height(40f)
					});
					GUI.backgroundColor = backgroundColor;
					GUILayout.EndHorizontal();
					setter(ColorUtility.ToHtmlStringRGB(_uiEditingColor));
					GUILayout.EndVertical();
				};
				if (coloringType == ColoringType.SingleColor)
				{
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					GUILayout.Label("Hex Color", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
					string text = (isForPronoun ? p.PronounSingleHexColor : p.SingleHexColor);
					action2(GUILayout.TextField(text, 7, Array.Empty<GUILayoutOption>()));
					if (GUILayout.Button("Pick", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
					{
						reference2 = !reference2;
						reference3 = (reference4 = false);
						if (reference2 && !ColorUtility.TryParseHtmlString("#" + text, ref _uiEditingColor))
						{
							_uiEditingColor = Color.white;
						}
					}
					GUILayout.EndHorizontal();
					if (reference2)
					{
						action9(action2);
					}
				}
				if (coloringType == ColoringType.Gradient)
				{
					bool flag = (isForPronoun ? p.PronounAnimateGradient : p.AnimateGradient);
					action5(GUILayout.Toggle(flag, "Animate Gradient", Array.Empty<GUILayoutOption>()));
					if (flag)
					{
						float num6 = (isForPronoun ? p.PronounColorAnimationSpeed : p.ColorAnimationSpeed);
						GUILayout.Label($"Color Speed: {num6:F1}", Array.Empty<GUILayoutOption>());
						action8(GUILayout.HorizontalSlider(num6, 0.1f, 5f, Array.Empty<GUILayoutOption>()));
					}
					float num7 = (isForPronoun ? p.PronounGradientSpread : p.GradientSpread);
					GUILayout.Label($"Gradient Spread: {num7:F1}", Array.Empty<GUILayoutOption>());
					action6(GUILayout.HorizontalSlider(num7, 1f, 50f, Array.Empty<GUILayoutOption>()));
					GUI.enabled = !flag;
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					GUILayout.Label("Start", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
					string text2 = (isForPronoun ? p.PronounGradientStartColor : p.GradientStartColor);
					action3(GUILayout.TextField(text2, 7, Array.Empty<GUILayoutOption>()));
					if (GUILayout.Button("Pick", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
					{
						reference3 = !reference3;
						reference2 = (reference4 = false);
						if (reference3 && !ColorUtility.TryParseHtmlString("#" + text2, ref _uiEditingColor))
						{
							_uiEditingColor = Color.white;
						}
					}
					GUILayout.EndHorizontal();
					if (reference3)
					{
						action9(action3);
					}
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					GUILayout.Label("End", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
					string text3 = (isForPronoun ? p.PronounGradientEndColor : p.GradientEndColor);
					action4(GUILayout.TextField(text3, 7, Array.Empty<GUILayoutOption>()));
					if (GUILayout.Button("Pick", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
					{
						reference4 = !reference4;
						reference2 = (reference3 = false);
						if (reference4 && !ColorUtility.TryParseHtmlString("#" + text3, ref _uiEditingColor))
						{
							_uiEditingColor = Color.white;
						}
					}
					GUILayout.EndHorizontal();
					if (reference4)
					{
						action9(action4);
					}
					GUI.enabled = true;
				}
				if (coloringType == ColoringType.Wave || coloringType == ColoringType.Rainbow)
				{
					float num8 = (isForPronoun ? p.PronounColorAnimationSpeed : p.ColorAnimationSpeed);
					GUILayout.Label($"Color Speed: {num8:F1}", Array.Empty<GUILayoutOption>());
					action8(GUILayout.HorizontalSlider(num8, 0.1f, 5f, Array.Empty<GUILayoutOption>()));
				}
				if (coloringType == ColoringType.Wave || coloringType == ColoringType.StaticRainbow)
				{
					float num9 = (isForPronoun ? p.PronounRainbowWaveSpread : p.RainbowWaveSpread);
					GUILayout.Label($"Wave Spread: {num9:F1}", Array.Empty<GUILayoutOption>());
					action7(GUILayout.HorizontalSlider(num9, 5f, 50f, Array.Empty<GUILayoutOption>()));
				}
				if (coloringType == ColoringType.Gradient || coloringType == ColoringType.SingleColor)
				{
					GUIStyle val2 = new GUIStyle(_modSkin.label)
					{
						fontStyle = (FontStyle)2
					};
					val2.normal.textColor = Color.gray;
					GUILayout.Label("(RRGGBB format, no #)", val2, Array.Empty<GUILayoutOption>());
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class HarmonyPatches
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static BinaryPacketListener <0>__OnProfileUpdate;

			public static BinaryPacketListener <1>__OnFullSync;

			public static PacketListener <2>__OnSyncRequest;
		}

		private static bool _listenersInitialized = false;

		internal static readonly Dictionary<uint, CharacterTitleProfile> PlayerProfiles = new Dictionary<uint, CharacterTitleProfile>();

		internal static readonly Dictionary<uint, string> CurrentPlayerTitles = new Dictionary<uint, string>();

		private static readonly FieldInfo _globalNicknameTextMeshField = AccessTools.Field(typeof(Player), "_globalNicknameTextMesh");

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "OnGameConditionChange")]
		private static void OnGameConditionChange_Postfix(Player __instance, GameCondition _newCondition)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			if ((Object)(object)__instance != (Object)(object)Player._mainPlayer)
			{
				return;
			}
			Main.IsReady = (int)_newCondition == 1;
			if (Main.IsReady)
			{
				Main.CurrentCharacterSlot = ProfileDataManager._current.SelectedFileIndex;
				if (Main.instance.AllCharacterProfiles.TryGetValue(Main.CurrentCharacterSlot, out CharacterTitleProfile value))
				{
					Main.instance.UpdateGradientCache(value);
					Main.SendTitleUpdate(value);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(AtlyssNetworkManager), "OnStopClient")]
		private static void OnStopClient_Postfix()
		{
			Main.IsReady = false;
			Main.CurrentCharacterSlot = -1;
			PlayerProfiles.Clear();
			CurrentPlayerTitles.Clear();
			Main.AllPlayerAnimators.Clear();
			_listenersInitialized = false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "OnStartAuthority")]
		private static void OnPlayerStart_Postfix(Player __instance)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			if (!((NetworkBehaviour)__instance).isLocalPlayer || !Main._isCodeTalkerLoaded)
			{
				return;
			}
			if (!_listenersInitialized)
			{
				object obj = <>O.<0>__OnProfileUpdate;
				if (obj == null)
				{
					BinaryPacketListener val = Main.OnProfileUpdate;
					<>O.<0>__OnProfileUpdate = val;
					obj = (object)val;
				}
				CodeTalkerNetwork.RegisterBinaryListener<UpdateTitleProfilePacket>((BinaryPacketListener)obj);
				object obj2 = <>O.<1>__OnFullSync;
				if (obj2 == null)
				{
					BinaryPacketListener val2 = Main.OnFullSync;
					<>O.<1>__OnFullSync = val2;
					obj2 = (object)val2;
				}
				CodeTalkerNetwork.RegisterBinaryListener<SyncAllProfilesPacket>((BinaryPacketListener)obj2);
				if (__instance._isHostPlayer)
				{
					object obj3 = <>O.<2>__OnSyncRequest;
					if (obj3 == null)
					{
						PacketListener val3 = Main.OnSyncRequest;
						<>O.<2>__OnSyncRequest = val3;
						obj3 = (object)val3;
					}
					CodeTalkerNetwork.RegisterListener<RequestAllTitlesPacket>((PacketListener)obj3);
				}
				_listenersInitialized = true;
			}
			Main.RequestFullTitleSync();
		}

		private static string GetFormattedStringWithBrackets(string content, BracketType bracketType)
		{
			if (string.IsNullOrEmpty(content))
			{
				return "";
			}
			return bracketType switch
			{
				BracketType.Parentheses => "(" + content + ")", 
				BracketType.SquareBrackets => "[" + content + "]", 
				BracketType.Tilde => "~" + content + "~", 
				BracketType.Dash => "-" + content + "-", 
				BracketType.Plus => "+" + content + "+", 
				BracketType.Equals => "=" + content + "=", 
				BracketType.Asterisk => "*" + content + "*", 
				BracketType.Dollar => "$" + content + "$", 
				BracketType.Hash => "#" + content + "#", 
				BracketType.Exclamation => "!" + content + "!", 
				BracketType.Pipe => "|" + content + "|", 
				_ => content, 
			};
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Handle_ClientParameters")]
		private static void Handle_ClientParameters_Postfix(Player __instance)
		{
			object? value = _globalNicknameTextMeshField.GetValue(__instance);
			TextMeshPro val = (TextMeshPro)((value is TextMeshPro) ? value : null);
			if (val == null)
			{
				return;
			}
			if (!((TMP_Text)val).richText)
			{
				((TMP_Text)val).richText = true;
			}
			CurrentPlayerTitles.TryGetValue(((NetworkBehaviour)__instance).netId, out string value2);
			PlayerProfiles.TryGetValue(((NetworkBehaviour)__instance).netId, out CharacterTitleProfile value3);
			if (value3 == null)
			{
				value3 = new CharacterTitleProfile();
			}
			Main.AllPlayerAnimators.TryGetValue(((NetworkBehaviour)__instance).netId, out PlayerTitleAnimator value4);
			bool flag = !string.IsNullOrEmpty(value2);
			bool flag2 = value3.ShowPronouns && !string.IsNullOrEmpty(value3.Pronouns);
			string text5;
			if (!string.IsNullOrEmpty(__instance._globalNickname) || flag || flag2)
			{
				string content = Main.instance.ApplyColoring(value2, value3, value4, isForPronoun: false);
				string content2 = Main.instance.ApplyColoring(value3.Pronouns, value3, value4, isForPronoun: true);
				string formattedStringWithBrackets = GetFormattedStringWithBrackets(content, value3.BracketStyle);
				string text = (flag2 ? GetFormattedStringWithBrackets(content2, value3.PronounBracketStyle) : "");
				string text2 = "";
				if (flag && flag2)
				{
					text2 = formattedStringWithBrackets + " " + text;
				}
				else if (flag)
				{
					text2 = formattedStringWithBrackets;
				}
				else if (flag2)
				{
					text2 = text;
				}
				string text3 = ((!string.IsNullOrEmpty(__instance._globalNickname)) ? ("@" + __instance._globalNickname) : ((flag || flag2) ? "@." : ""));
				string text4 = ((value3.AddGapAboveTitle && value3.TitleOnNewLine) ? "\n" : "");
				string separator = (value3.TitleOnNewLine ? "\n" : " ");
				List<string> list = new List<string>();
				if (!string.IsNullOrEmpty(text3))
				{
					list.Add(text3);
				}
				if (!string.IsNullOrEmpty(text2))
				{
					list.Add(text2);
				}
				text5 = text4 + string.Join(separator, list);
			}
			else
			{
				text5 = "";
			}
			if (((TMP_Text)val).text != text5)
			{
				((TMP_Text)val).text = text5;
			}
		}
	}
	internal static class ModInfo
	{
		public const string GUID = "s0apy.RPNames.sftwre";

		public const string NAME = "RPNames";

		public const string VERSION = "1.3.7";
	}
}
namespace RPNames.Packets
{
	internal static class ProfileSerializer
	{
		public static void WriteProfile(BinaryWriter writer, CharacterTitleProfile profile)
		{
			if (profile == null)
			{
				writer.Write(value: false);
				return;
			}
			writer.Write(value: true);
			writer.Write(profile.Title);
			writer.Write((byte)profile.BracketStyle);
			writer.Write((byte)profile.TextAnimation);
			writer.Write((byte)profile.Coloring);
			writer.Write(profile.AnimationSpeed);
			writer.Write(profile.MarqueeWidth);
			writer.Write(profile.SingleHexColor);
			writer.Write(profile.GradientStartColor);
			writer.Write(profile.GradientEndColor);
			writer.Write(profile.AnimateGradient);
			writer.Write(profile.GradientSpread);
			writer.Write(profile.RainbowWaveSpread);
			writer.Write(profile.ColorAnimationSpeed);
			writer.Write(profile.Pronouns);
			writer.Write(profile.ShowPronouns);
			writer.Write((byte)profile.PronounBracketStyle);
			writer.Write(profile.ShareTitleColoring);
			writer.Write((byte)profile.PronounColoring);
			writer.Write(profile.PronounSingleHexColor);
			writer.Write(profile.PronounGradientStartColor);
			writer.Write(profile.PronounGradientEndColor);
			writer.Write(profile.PronounAnimateGradient);
			writer.Write(profile.PronounGradientSpread);
			writer.Write(profile.PronounRainbowWaveSpread);
			writer.Write(profile.PronounColorAnimationSpeed);
			writer.Write(profile.TitleOnNewLine);
			writer.Write(profile.AddGapAboveTitle);
		}

		public static CharacterTitleProfile ReadProfile(BinaryReader reader)
		{
			if (!reader.ReadBoolean())
			{
				return null;
			}
			CharacterTitleProfile characterTitleProfile = new CharacterTitleProfile();
			characterTitleProfile.Title = reader.ReadString();
			characterTitleProfile.BracketStyle = (BracketType)reader.ReadByte();
			characterTitleProfile.TextAnimation = (TextAnimationType)reader.ReadByte();
			characterTitleProfile.Coloring = (ColoringType)reader.ReadByte();
			characterTitleProfile.AnimationSpeed = reader.ReadSingle();
			characterTitleProfile.MarqueeWidth = reader.ReadInt32();
			characterTitleProfile.SingleHexColor = reader.ReadString();
			characterTitleProfile.GradientStartColor = reader.ReadString();
			characterTitleProfile.GradientEndColor = reader.ReadString();
			characterTitleProfile.AnimateGradient = reader.ReadBoolean();
			characterTitleProfile.GradientSpread = reader.ReadSingle();
			characterTitleProfile.RainbowWaveSpread = reader.ReadSingle();
			characterTitleProfile.ColorAnimationSpeed = reader.ReadSingle();
			characterTitleProfile.Pronouns = reader.ReadString();
			characterTitleProfile.ShowPronouns = reader.ReadBoolean();
			characterTitleProfile.PronounBracketStyle = (BracketType)reader.ReadByte();
			characterTitleProfile.ShareTitleColoring = reader.ReadBoolean();
			characterTitleProfile.PronounColoring = (ColoringType)reader.ReadByte();
			characterTitleProfile.PronounSingleHexColor = reader.ReadString();
			characterTitleProfile.PronounGradientStartColor = reader.ReadString();
			characterTitleProfile.PronounGradientEndColor = reader.ReadString();
			characterTitleProfile.PronounAnimateGradient = reader.ReadBoolean();
			characterTitleProfile.PronounGradientSpread = reader.ReadSingle();
			characterTitleProfile.PronounRainbowWaveSpread = reader.ReadSingle();
			characterTitleProfile.PronounColorAnimationSpeed = reader.ReadSingle();
			characterTitleProfile.TitleOnNewLine = reader.ReadBoolean();
			characterTitleProfile.AddGapAboveTitle = reader.ReadBoolean();
			return characterTitleProfile;
		}
	}
	public class UpdateTitleProfilePacket : BinaryPacketBase
	{
		public override string PacketSignature => "s0apy.RPNames.sftwre_UpdateProfile";

		public uint TargetNetID { get; set; }

		public CharacterTitleProfile Profile { get; set; }

		public UpdateTitleProfilePacket()
		{
		}

		public UpdateTitleProfilePacket(uint targetId, CharacterTitleProfile profile)
		{
			TargetNetID = targetId;
			Profile = profile;
		}

		public override byte[] Serialize()
		{
			using MemoryStream memoryStream = new MemoryStream();
			using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
			{
				binaryWriter.Write(TargetNetID);
				ProfileSerializer.WriteProfile(binaryWriter, Profile);
			}
			return memoryStream.ToArray();
		}

		public override void Deserialize(byte[] data)
		{
			using MemoryStream input = new MemoryStream(data);
			using BinaryReader binaryReader = new BinaryReader(input);
			TargetNetID = binaryReader.ReadUInt32();
			Profile = ProfileSerializer.ReadProfile(binaryReader);
		}
	}
	public class SyncAllProfilesPacket : BinaryPacketBase
	{
		public override string PacketSignature => "s0apy.RPNames.sftwre_SyncAll";

		public Dictionary<uint, CharacterTitleProfile> AllProfiles { get; set; }

		public SyncAllProfilesPacket()
		{
		}

		public SyncAllProfilesPacket(Dictionary<uint, CharacterTitleProfile> profiles)
		{
			AllProfiles = profiles;
		}

		public override byte[] Serialize()
		{
			using MemoryStream memoryStream = new MemoryStream();
			using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream))
			{
				binaryWriter.Write(AllProfiles.Count);
				foreach (KeyValuePair<uint, CharacterTitleProfile> allProfile in AllProfiles)
				{
					binaryWriter.Write(allProfile.Key);
					ProfileSerializer.WriteProfile(binaryWriter, allProfile.Value);
				}
			}
			return memoryStream.ToArray();
		}

		public override void Deserialize(byte[] data)
		{
			using MemoryStream input = new MemoryStream(data);
			using BinaryReader binaryReader = new BinaryReader(input);
			int num = binaryReader.ReadInt32();
			AllProfiles = new Dictionary<uint, CharacterTitleProfile>(num);
			for (int i = 0; i < num; i++)
			{
				AllProfiles.Add(binaryReader.ReadUInt32(), ProfileSerializer.ReadProfile(binaryReader));
			}
		}
	}
	public class RequestAllTitlesPacket : PacketBase
	{
		public override string PacketSourceGUID => "s0apy.RPNames.sftwre";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}