using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; 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; 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.4.5.0")] [assembly: AssemblyInformationalVersion("1.4.5+25bea43384eb7c391be45351b98c25011580742e")] [assembly: AssemblyProduct("RPNames")] [assembly: AssemblyTitle("RPNames")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.5.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.4.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Main : BaseUnityPlugin { internal enum TypewriterState { Typing, Blinking, Backspacing } private enum MenuState { Closed, Opening, Open, Closing } [CompilerGenerated] private static class <>O { public static BinaryPacketListener <0>__OnProfileUpdate; public static BinaryPacketListener <1>__OnFullSync; public static PacketListener <2>__OnSyncRequest; } public static Main instance; internal static ManualLogSource Log; internal static bool IsReady = false; private static ConfigEntry _characterProfilesJson; private static ConfigEntry _customPresetsJson; internal Dictionary AllCharacterProfiles = new Dictionary(); internal static int CurrentCharacterSlot = -1; private ConfigEntry _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; private Vector2 _presetScrollPosition = Vector2.zero; private bool _showClearConfirmation = false; private string _newPresetName = "My New Style"; internal static bool _isCodeTalkerLoaded = false; private static CharacterTitleProfile _copiedProfileBuffer = null; internal static Dictionary AllPlayerAnimators = new Dictionary(); private Color _gradientStartColorCache; private Color _gradientEndColorCache; private static readonly List _presetTitles = new List(); private static Dictionary _customPresets = new Dictionary(); private bool _showSingleColorPicker; private bool _showGradientStartPicker; private bool _showGradientEndPicker; private bool _showPronounSingleColorPicker; private bool _showPronounGradientStartPicker; private bool _showPronounGradientEndPicker; 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() { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown instance = this; Log = ((BaseUnityPlugin)this).Logger; _menuKey = ((BaseUnityPlugin)this).Config.Bind("1. General", "Menu Key", (KeyCode)289, "The key to press to show/hide the settings menu."); _characterProfilesJson = ((BaseUnityPlugin)this).Config.Bind("2. Data", "CharacterProfiles", "{}", "Stores all title profiles for all character slots in JSON format."); _customPresetsJson = ((BaseUnityPlugin)this).Config.Bind("2. Data", "CustomPresetsFull", "{}", "Stores user-defined full title profiles."); LoadProfiles(); LoadCustomPresets(); PopulatePresetTitles(); if (Type.GetType("CodeTalker.Networking.CodeTalkerNetwork, CodeTalker") != null) { _isCodeTalkerLoaded = true; object obj = <>O.<0>__OnProfileUpdate; if (obj == null) { BinaryPacketListener val = OnProfileUpdate; <>O.<0>__OnProfileUpdate = val; obj = (object)val; } CodeTalkerNetwork.RegisterBinaryListener((BinaryPacketListener)obj); object obj2 = <>O.<1>__OnFullSync; if (obj2 == null) { BinaryPacketListener val2 = OnFullSync; <>O.<1>__OnFullSync = val2; obj2 = (object)val2; } CodeTalkerNetwork.RegisterBinaryListener((BinaryPacketListener)obj2); object obj3 = <>O.<2>__OnSyncRequest; if (obj3 == null) { PacketListener val3 = OnSyncRequest; <>O.<2>__OnSyncRequest = val3; obj3 = (object)val3; } CodeTalkerNetwork.RegisterListener((PacketListener)obj3); } Harmony.CreateAndPatchAll(typeof(HarmonyPatches), (string)null); Log.LogInfo((object)"[RPNames v1.4.5] 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(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 dictionary = JsonConvert.DeserializeObject>(_characterProfilesJson.Value); if (dictionary != null) { AllCharacterProfiles = dictionary; } } catch { AllCharacterProfiles = new Dictionary(); } } private void SaveProfiles() { _characterProfilesJson.Value = JsonConvert.SerializeObject((object)AllCharacterProfiles, (Formatting)1); ((BaseUnityPlugin)this).Config.Save(); } private void LoadCustomPresets() { try { Dictionary dictionary = JsonConvert.DeserializeObject>(_customPresetsJson.Value); if (dictionary != null) { _customPresets = dictionary; } } catch { _customPresets = new Dictionary(); } } private void SaveCustomPresets() { _customPresetsJson.Value = JsonConvert.SerializeObject((object)_customPresets, (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) { PacketHeader header2 = header; if (packet is UpdateTitleProfilePacket updateTitleProfilePacket) { Player val = ((IEnumerable)Object.FindObjectsOfType()).FirstOrDefault((Func)((Player x) => x._steamID == header2.SenderID.ToString())); if ((Object)(object)val != (Object)null) { ApplyProfileUpdate(((NetworkBehaviour)val).netId, updateTitleProfilePacket.Profile); } } } public static void OnFullSync(PacketHeader header, BinaryPacketBase packet) { if (!(packet is FullSyncPacket fullSyncPacket)) { return; } List list = HarmonyPatches.PlayerProfiles.Keys.ToList(); foreach (uint item in list) { if (!fullSyncPacket.AllProfiles.ContainsKey(item)) { ApplyProfileUpdate(item, null); } } foreach (KeyValuePair allProfile in fullSyncPacket.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 (NetworkServer.active && packet is RequestAllTitlesPacket) { FullSyncPacket fullSyncPacket = new FullSyncPacket(HarmonyPatches.PlayerProfiles); CodeTalkerNetwork.SendNetworkPacket(header.SenderID, (BinaryPacketBase)(object)fullSyncPacket, (CompressionType)4, CompressionLevel.Fastest); } } public static void SendTitleUpdate(CharacterTitleProfile profile) { if (!((Object)(object)Player._mainPlayer == (Object)null)) { UpdateTitleProfilePacket updateTitleProfilePacket = new UpdateTitleProfilePacket(profile); CodeTalkerNetwork.SendNetworkPacket((BinaryPacketBase)(object)updateTitleProfilePacket); ApplyProfileUpdate(((NetworkBehaviour)Player._mainPlayer).netId, 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 "" + text + ""; case ColoringType.Rainbow: return "" + text + ""; 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($"{text[j]}"); } } 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($"{text[k]}"); } } 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($"{text[l]}"); } 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($"{text[i]}"); } 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()); 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(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_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0529: 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_0887: Unknown result type (might be due to invalid IL or missing references) //IL_088c: Unknown result type (might be due to invalid IL or missing references) //IL_0894: Unknown result type (might be due to invalid IL or missing references) //IL_08a6: Expected O, but got Unknown //IL_08db: Unknown result type (might be due to invalid IL or missing references) //IL_08e0: Unknown result type (might be due to invalid IL or missing references) //IL_08e8: Unknown result type (might be due to invalid IL or missing references) //IL_08fa: Expected O, but got Unknown //IL_0a60: Unknown result type (might be due to invalid IL or missing references) //IL_0a65: Unknown result type (might be due to invalid IL or missing references) //IL_0a6d: Unknown result type (might be due to invalid IL or missing references) //IL_0a73: Unknown result type (might be due to invalid IL or missing references) //IL_0a88: Expected O, but got Unknown if (CurrentCharacterSlot == -1) { GUILayout.FlexibleSpace(); GUILayout.Label("Please load a character to edit their profile.", Array.Empty()); GUILayout.FlexibleSpace(); GUI.DragWindow(); return; } GUILayout.Label($"Editing Profile for Slot: {CurrentCharacterSlot + 1}", Array.Empty()); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, Array.Empty()); GUILayout.Label("Title", new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontStyle = (FontStyle)1 }, Array.Empty()); _uiEditingProfile.Title = GUILayout.TextField(_uiEditingProfile.Title, 50, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Name:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) }); _newPresetName = GUILayout.TextField(_newPresetName, Array.Empty()); if (GUILayout.Button("Save Preset", Array.Empty()) && !string.IsNullOrEmpty(_newPresetName)) { CharacterTitleProfile value = JsonConvert.DeserializeObject(JsonConvert.SerializeObject((object)_uiEditingProfile)); if (_customPresets.ContainsKey(_newPresetName)) { _customPresets[_newPresetName] = value; } else { _customPresets.Add(_newPresetName, value); } SaveCustomPresets(); } GUILayout.EndHorizontal(); if (GUILayout.Button("Select a Preset", Array.Empty())) { _showPresetPicker = !_showPresetPicker; } if (_showPresetPicker) { _presetScrollPosition = GUILayout.BeginScrollView(_presetScrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(150f) }); GUILayout.Label("- Default Presets (Text Only) -", Array.Empty()); foreach (string presetTitle in _presetTitles) { if (GUILayout.Button(presetTitle, Array.Empty())) { _uiEditingProfile.Title = presetTitle; _showPresetPicker = false; } } if (_customPresets.Count > 0) { GUILayout.Label("- Custom Presets (Full Style) -", Array.Empty()); List list = new List(); foreach (KeyValuePair customPreset in _customPresets) { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(customPreset.Key, Array.Empty())) { _uiEditingProfile = JsonConvert.DeserializeObject(JsonConvert.SerializeObject((object)customPreset.Value)); _showPresetPicker = false; } if (GUILayout.Button("X", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(25f) })) { list.Add(customPreset.Key); } GUILayout.EndHorizontal(); } if (list.Count > 0) { foreach (string item in list) { _customPresets.Remove(item); } SaveCustomPresets(); } } GUILayout.EndScrollView(); } GUILayout.Space(10f); GUILayout.Label("--- Pronouns ---", new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontStyle = (FontStyle)1 }, Array.Empty()); _uiEditingProfile.ShowPronouns = GUILayout.Toggle(_uiEditingProfile.ShowPronouns, " Show Pronouns", Array.Empty()); if (_uiEditingProfile.ShowPronouns) { _uiEditingProfile.Pronouns = GUILayout.TextField(_uiEditingProfile.Pronouns, 50, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Pronoun Brackets:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (GUILayout.Button(_uiEditingProfile.PronounBracketStyle.ToString(), Array.Empty())) { _showPronounBracketPicker = !_showPronounBracketPicker; } GUILayout.EndHorizontal(); if (_showPronounBracketPicker) { string[] names = Enum.GetNames(typeof(BracketType)); int num = GUILayout.SelectionGrid((int)_uiEditingProfile.PronounBracketStyle, names, 3, Array.Empty()); 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()); _uiEditingProfile.TitleOnNewLine = GUILayout.Toggle(_uiEditingProfile.TitleOnNewLine, " Display on New Line", Array.Empty()); if (_uiEditingProfile.TitleOnNewLine) { _uiEditingProfile.AddGapAboveTitle = GUILayout.Toggle(_uiEditingProfile.AddGapAboveTitle, " Add Gap Above", Array.Empty()); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Title Brackets:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (GUILayout.Button(_uiEditingProfile.BracketStyle.ToString(), Array.Empty())) { _showBracketPicker = !_showBracketPicker; } GUILayout.EndHorizontal(); if (_showBracketPicker) { string[] names2 = Enum.GetNames(typeof(BracketType)); int num2 = GUILayout.SelectionGrid((int)_uiEditingProfile.BracketStyle, names2, 3, Array.Empty()); 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()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Animation:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (GUILayout.Button(_uiEditingProfile.TextAnimation.ToString(), Array.Empty())) { _showTextAnimPicker = !_showTextAnimPicker; } GUILayout.EndHorizontal(); if (_showTextAnimPicker) { string[] names3 = Enum.GetNames(typeof(TextAnimationType)); int num3 = GUILayout.SelectionGrid((int)_uiEditingProfile.TextAnimation, names3, 3, Array.Empty()); 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()); num4 = GUILayout.HorizontalSlider(num4, 1f, 10f, Array.Empty()); _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()); _uiEditingProfile.MarqueeWidth = (int)GUILayout.HorizontalSlider((float)_uiEditingProfile.MarqueeWidth, 5f, 40f, Array.Empty()); } GUILayout.Space(10f); GUILayout.Label("--- Title Coloring ---", new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontStyle = (FontStyle)1 }, Array.Empty()); 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()); _uiEditingProfile.ShareTitleColoring = GUILayout.Toggle(_uiEditingProfile.ShareTitleColoring, " Share Title Coloring", Array.Empty()); if (!_uiEditingProfile.ShareTitleColoring) { DrawColorCustomization(isForPronoun: true); } } GUILayout.EndScrollView(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Copy", Array.Empty())) { _copiedProfileBuffer = JsonConvert.DeserializeObject(JsonConvert.SerializeObject((object)_uiEditingProfile)); } GUI.enabled = _copiedProfileBuffer != null; if (GUILayout.Button("Paste", Array.Empty()) && _copiedProfileBuffer != null) { _uiEditingProfile = JsonConvert.DeserializeObject(JsonConvert.SerializeObject((object)_copiedProfileBuffer)); } GUI.enabled = true; GUILayout.EndHorizontal(); if (GUILayout.Button("Set & Save", Array.Empty())) { AllCharacterProfiles[CurrentCharacterSlot] = JsonConvert.DeserializeObject(JsonConvert.SerializeObject((object)_uiEditingProfile)); SaveProfiles(); CharacterTitleProfile profile = AllCharacterProfiles[CurrentCharacterSlot]; UpdateGradientCache(profile); SendTitleUpdate(profile); _menuState = MenuState.Closing; } if (_showClearConfirmation) { GUIStyle val2 = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4 }; val2.normal.textColor = Color.yellow; GUILayout.Label("Are you sure?", val2, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("YES, CLEAR", Array.Empty())) { if (AllCharacterProfiles.ContainsKey(CurrentCharacterSlot)) { AllCharacterProfiles.Remove(CurrentCharacterSlot); } SaveProfiles(); SendTitleUpdate(null); LoadUIFromProfile(CurrentCharacterSlot); _showClearConfirmation = false; } if (GUILayout.Button("CANCEL", Array.Empty())) { _showClearConfirmation = false; } GUILayout.EndHorizontal(); } else if (GUILayout.Button("Clear All", Array.Empty())) { _showClearConfirmation = true; } GUI.DragWindow(); void DrawColorCustomization(bool isForPronoun) { //IL_061a: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Expected O, but got Unknown CharacterTitleProfile p = _uiEditingProfile; Action action = delegate(ColoringType val) { if (isForPronoun) { p.PronounColoring = val; } else { p.Coloring = val; } }; Action action2 = delegate(string val) { if (isForPronoun) { p.PronounSingleHexColor = val; } else { p.SingleHexColor = val; } }; Action action3 = delegate(string val) { if (isForPronoun) { p.PronounGradientStartColor = val; } else { p.GradientStartColor = val; } }; Action action4 = delegate(string val) { if (isForPronoun) { p.PronounGradientEndColor = val; } else { p.GradientEndColor = val; } }; Action action5 = delegate(bool val) { if (isForPronoun) { p.PronounAnimateGradient = val; } else { p.AnimateGradient = val; } }; Action action6 = delegate(float val) { if (isForPronoun) { p.PronounGradientSpread = val; } else { p.GradientSpread = val; } }; Action action7 = delegate(float val) { if (isForPronoun) { p.PronounRainbowWaveSpread = val; } else { p.RainbowWaveSpread = val; } }; Action 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()); GUILayout.Label("Effect:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (GUILayout.Button(coloringType.ToString(), Array.Empty())) { reference = !reference; } GUILayout.EndHorizontal(); if (reference) { string[] names4 = Enum.GetNames(typeof(ColoringType)); int num5 = GUILayout.SelectionGrid((int)coloringType, names4, 3, Array.Empty()); if (num5 != (int)coloringType) { action((ColoringType)num5); reference = false; reference2 = (reference3 = (reference4 = false)); } } Action> action9 = delegate(string currentHex, Action setter) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00b6: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) Color white = default(Color); if (!ColorUtility.TryParseHtmlString("#" + currentHex, ref white)) { white = Color.white; } GUILayout.BeginVertical(_modSkin.box, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); float num10 = GUILayout.HorizontalSlider(white.r, 0f, 1f, Array.Empty()); float num11 = GUILayout.HorizontalSlider(white.g, 0f, 1f, Array.Empty()); float num12 = GUILayout.HorizontalSlider(white.b, 0f, 1f, Array.Empty()); GUILayout.EndVertical(); Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = white; GUIStyle val4 = new GUIStyle(); val4.normal.background = Texture2D.whiteTexture; GUILayout.Box("", val4, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(40f), GUILayout.Height(40f) }); GUI.backgroundColor = backgroundColor; GUILayout.EndHorizontal(); if (num10 != white.r || num11 != white.g || num12 != white.b) { white.r = num10; white.g = num11; white.b = num12; setter(ColorUtility.ToHtmlStringRGB(white)); } GUILayout.EndVertical(); }; if (coloringType == ColoringType.SingleColor) { GUILayout.BeginHorizontal(Array.Empty()); 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())); if (GUILayout.Button("Pick", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) })) { reference2 = !reference2; reference3 = (reference4 = false); } GUILayout.EndHorizontal(); if (reference2) { action9(text, action2); } } if (coloringType == ColoringType.Gradient) { bool flag = (isForPronoun ? p.PronounAnimateGradient : p.AnimateGradient); action5(GUILayout.Toggle(flag, "Animate Gradient", Array.Empty())); if (flag) { float num6 = (isForPronoun ? p.PronounColorAnimationSpeed : p.ColorAnimationSpeed); GUILayout.Label($"Color Speed: {num6:F1}", Array.Empty()); action8(GUILayout.HorizontalSlider(num6, 0.1f, 5f, Array.Empty())); } float num7 = (isForPronoun ? p.PronounGradientSpread : p.GradientSpread); GUILayout.Label($"Gradient Spread: {num7:F1}", Array.Empty()); action6(GUILayout.HorizontalSlider(num7, 1f, 50f, Array.Empty())); GUI.enabled = !flag; GUILayout.BeginHorizontal(Array.Empty()); 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())); if (GUILayout.Button("Pick", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) })) { reference3 = !reference3; reference2 = (reference4 = false); } GUILayout.EndHorizontal(); if (reference3) { action9(text2, action3); } GUILayout.BeginHorizontal(Array.Empty()); 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())); if (GUILayout.Button("Pick", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) })) { reference4 = !reference4; reference2 = (reference3 = false); } GUILayout.EndHorizontal(); if (reference4) { action9(text3, 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()); action8(GUILayout.HorizontalSlider(num8, 0.1f, 5f, Array.Empty())); } if (coloringType == ColoringType.Wave || coloringType == ColoringType.StaticRainbow) { float num9 = (isForPronoun ? p.PronounRainbowWaveSpread : p.RainbowWaveSpread); GUILayout.Label($"Wave Spread: {num9:F1}", Array.Empty()); action7(GUILayout.HorizontalSlider(num9, 5f, 50f, Array.Empty())); } if (coloringType == ColoringType.Gradient || coloringType == ColoringType.SingleColor) { GUIStyle val3 = new GUIStyle(_modSkin.label) { fontStyle = (FontStyle)2 }; val3.normal.textColor = Color.gray; GUILayout.Label("(RRGGBB format, no #)", val3, Array.Empty()); } } } } [HarmonyPatch] internal static class HarmonyPatches { internal static readonly Dictionary PlayerProfiles = new Dictionary(); internal static readonly Dictionary CurrentPlayerTitles = new Dictionary(); 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(); } [HarmonyPostfix] [HarmonyPatch(typeof(Player), "OnStartAuthority")] private static void OnPlayerStart_Postfix(Player __instance) { if (((NetworkBehaviour)__instance).isLocalPlayer && Main._isCodeTalkerLoaded) { 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 list = new List(); 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.4.5"; } } 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 ?? "FFFFFF"); writer.Write(profile.GradientStartColor ?? "FF0000"); writer.Write(profile.GradientEndColor ?? "0000FF"); 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 ?? "FFFFFF"); writer.Write(profile.PronounGradientStartColor ?? "FF0000"); writer.Write(profile.PronounGradientEndColor ?? "0000FF"); 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; } return new CharacterTitleProfile { Title = reader.ReadString(), BracketStyle = (BracketType)reader.ReadByte(), TextAnimation = (TextAnimationType)reader.ReadByte(), Coloring = (ColoringType)reader.ReadByte(), AnimationSpeed = reader.ReadSingle(), MarqueeWidth = reader.ReadInt32(), SingleHexColor = reader.ReadString(), GradientStartColor = reader.ReadString(), GradientEndColor = reader.ReadString(), AnimateGradient = reader.ReadBoolean(), GradientSpread = reader.ReadSingle(), RainbowWaveSpread = reader.ReadSingle(), ColorAnimationSpeed = reader.ReadSingle(), Pronouns = reader.ReadString(), ShowPronouns = reader.ReadBoolean(), PronounBracketStyle = (BracketType)reader.ReadByte(), ShareTitleColoring = reader.ReadBoolean(), PronounColoring = (ColoringType)reader.ReadByte(), PronounSingleHexColor = reader.ReadString(), PronounGradientStartColor = reader.ReadString(), PronounGradientEndColor = reader.ReadString(), PronounAnimateGradient = reader.ReadBoolean(), PronounGradientSpread = reader.ReadSingle(), PronounRainbowWaveSpread = reader.ReadSingle(), PronounColorAnimationSpeed = reader.ReadSingle(), TitleOnNewLine = reader.ReadBoolean(), AddGapAboveTitle = reader.ReadBoolean() }; } } public class UpdateTitleProfilePacket : BinaryPacketBase { public override string PacketSignature => "s0apy.RPNames.sftwre_UpdateProfile"; public CharacterTitleProfile Profile { get; set; } public UpdateTitleProfilePacket() { } public UpdateTitleProfilePacket(CharacterTitleProfile profile) { Profile = profile; } public override byte[] Serialize() { using MemoryStream memoryStream = new MemoryStream(); using (BinaryWriter writer = new BinaryWriter(memoryStream)) { ProfileSerializer.WriteProfile(writer, Profile); } return memoryStream.ToArray(); } public override void Deserialize(byte[] data) { using MemoryStream input = new MemoryStream(data); using BinaryReader reader = new BinaryReader(input); Profile = ProfileSerializer.ReadProfile(reader); } } public class FullSyncPacket : BinaryPacketBase { public override string PacketSignature => "s0apy.RPNames.sftwre_FullSync"; public Dictionary AllProfiles { get; set; } public FullSyncPacket() { } public FullSyncPacket(Dictionary profiles) { AllProfiles = profiles; } public override byte[] Serialize() { using MemoryStream memoryStream = new MemoryStream(); using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream)) { binaryWriter.Write(AllProfiles.Count); foreach (KeyValuePair 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(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) { } } }