using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GUIFramework; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: AssemblyFileVersion("3.0.0")] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyProduct("RpChatter")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("")] [assembly: AssemblyTitle("RpChatter")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("Arielle")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.0.0.0")] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [CompilerGenerated] internal sealed class <30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [Embedded] [CompilerGenerated] internal sealed class <235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContextAttribute : Attribute { public readonly byte Flag; public <235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContextAttribute(byte P_0) { Flag = P_0; } } [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] [Embedded] [CompilerGenerated] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RpChatter { [Serializable] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public class DbLog { public string p { get; set; } public string i { get; set; } public string a { get; set; } public string c { get; set; } public string r { get; set; } } [Serializable] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public class DbPlayer { public string player { get; set; } } internal class Api { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static IEnumerator LogInsert(string json) { UnityWebRequest request = new UnityWebRequest("http://localhost:3333/db/log/insert", "POST"); try { byte[] bytes = Encoding.UTF8.GetBytes(json); request.uploadHandler = (UploadHandler)new UploadHandlerRaw(bytes); request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); request.SetRequestHeader("Content-Type", "application/json"); yield return request.SendWebRequest(); } finally { ((IDisposable)request)?.Dispose(); } } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class PluginConfig { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] [HarmonyPatch(typeof(FejdStartup))] private static class FejdStartupPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePostfix() { while (_fejdStartupBindConfigQueue.Count > 0) { _fejdStartupBindConfigQueue.Dequeue()?.Invoke(Config); } } } public static readonly ConfigSync ConfigSync = new ConfigSync("RpChatter") { DisplayName = "RpChatter", CurrentVersion = "3.0.0", MinimumRequiredVersion = "3.0.0" }; private static readonly Queue> _fejdStartupBindConfigQueue = new Queue>(); public static ConfigFile Config { get; private set; } public static ConfigEntry IsModEnabled { get; private set; } public static ConfigEntry ShoutDistance { get; private set; } public static ConfigEntry SayDistance { get; private set; } public static ConfigEntry WhisperDistance { get; private set; } public static ConfigEntry ChatPanelPosition { get; private set; } public static ConfigEntry ChatPanelSizeDelta { get; private set; } public static ConfigEntry ChatPanelBackgroundColor { get; private set; } public static ConfigEntry HideChatPanelDelay { get; private set; } public static ConfigEntry HideChatPanelAlpha { get; private set; } public static ConfigEntry ScrollContentUpShortcut { get; private set; } public static ConfigEntry ScrollContentDownShortcut { get; private set; } public static ConfigEntry ScrollContentOffsetInterval { get; private set; } public static ConfigEntry ShowMessageHudCenterMessages { get; private set; } public static ConfigEntry ShowChatPanelMessageDividers { get; private set; } public static ConfigEntry ChatPanelContentSingleRowSpacing { get; private set; } public static ConfigEntry ChatPanelDefaultMessageTypeToUse { get; private set; } public static ConfigEntry ChatPanelContentRowTogglesToEnable { get; private set; } public static ConfigEntry ChatMessageShowTimestamp { get; private set; } public static ConfigEntry ChatMessageTextDefaultColor { get; private set; } public static ConfigEntry ChatMessageTextSayColor { get; private set; } public static ConfigEntry ChatMessageTextShoutColor { get; private set; } public static ConfigEntry ChatMessageTextWhisperColor { get; private set; } public static ConfigEntry ChatMessageTextEmoteColor { get; private set; } public static ConfigEntry ChatMessageTextGestureColor { get; private set; } public static ConfigEntry ChatMessageTextGameColor { get; private set; } public static ConfigEntry ChatMessageTextPingColor { get; private set; } public static ConfigEntry ChatMessageTextMessageHudColor { get; private set; } public static ConfigEntry ChatMessageUsernameColor { get; private set; } public static ConfigEntry ChatMessageTimestampColor { get; private set; } public static ConfigEntry ChatMessageUsernamePrefix { get; private set; } public static ConfigEntry ChatMessageUsernamePostfix { get; private set; } public static StringListConfigEntry SayTextFilterList { get; private set; } public static StringListConfigEntry ShoutTextFilterList { get; private set; } public static StringListConfigEntry WhisperTextFilterList { get; private set; } public static StringListConfigEntry EmoteTextFilterList { get; private set; } public static StringListConfigEntry GameTextFilterList { get; private set; } public static StringListConfigEntry HudCenterTextFilterList { get; private set; } public static StringListConfigEntry OtherTextFilterList { get; private set; } public static ConfigEntry FilterInWorldShoutText { get; private set; } public static ConfigEntry ChatMessageFontAsset { get; private set; } public static ConfigEntry ChatMessageFontSize { get; private set; } public static void BindConfig(ConfigFile config) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_0709: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_07c9: Unknown result type (might be due to invalid IL or missing references) //IL_07ce: Unknown result type (might be due to invalid IL or missing references) Config = config; IsModEnabled = config.Bind("_Global", "isModEnabled", true, "Globally enable or disable this mod."); IsModEnabled.OnSettingChanged(ChatPanelController.ToggleChatter); ShoutDistance = config.BindInOrder("ChatDistance", "Shout", 150f, "The distance you can hear a shout. [Server Sync]"); SayDistance = config.BindInOrder("ChatDistance", "Say", 25f, "The distance you can hear normal talking. [Server Sync]"); WhisperDistance = config.BindInOrder("ChatDistance", "Whisper", 5f, "The distance you can hear a whisper. [Server Sync]"); ChatPanelPosition = config.BindInOrder("ChatPanel", "chatPanelPosition", new Vector2(-10f, 125f), "The Vector2 position of the ChatPanel."); ChatPanelPosition.OnSettingChanged(delegate(Vector2 position) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) ChatPanelController.ChatPanel?.PanelRectTransform.SetPosition(position); }); ChatPanelSizeDelta = config.BindInOrder("ChatPanel", "chatPanelSizeDelta", new Vector2(500f, 500f), "The size (width, height) of the ChatPanel."); ChatPanelSizeDelta.OnSettingChanged(delegate(Vector2 sizeDelta) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) ChatPanelController.ChatPanel?.PanelRectTransform.SetSizeDelta(sizeDelta); }); ChatPanelBackgroundColor = config.BindInOrder("ChatPanel", "chatPanelBackgroundColor", new Color(0f, 0f, 0f, 0.125f), "The background color for the ChatPanel."); ChatPanelBackgroundColor.OnSettingChanged(delegate(Color color) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) ChatPanel chatPanel = ChatPanelController.ChatPanel; if (chatPanel != null) { ImageExtensions.SetColor(chatPanel.PanelBackground, color); } }); HideChatPanelDelay = config.BindInOrder("ChatPanel.Behaviour", "hideChatPanelDelay", 5, "Delay (in seconds) before hiding the ChatPanel.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 180)); HideChatPanelAlpha = config.BindInOrder("ChatPanel.Behaviour", "hideChatPanelAlpha", 0f, "Color alpha (in %) for the ChatPanel when hidden.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f)); ScrollContentUpShortcut = config.BindInOrder("ChatPanel.Scrolling", "scrollContentUpShortcut", new KeyboardShortcut((KeyCode)280, Array.Empty()), "Keyboard shortcut to scroll the ChatPanel content up."); ScrollContentDownShortcut = config.BindInOrder("ChatPanel.Scrolling", "scrollContentDownShortcut", new KeyboardShortcut((KeyCode)281, Array.Empty()), "Keyboard shortcut to scroll the ChatPanel content down."); ScrollContentOffsetInterval = config.BindInOrder("ChatPanel.Scrolling", "scrollContentOffsetInterval", 200f, "Interval (in pixels) to scroll the ChatPanel content up/down.", (AcceptableValueBase)(object)new AcceptableValueRange(-1000f, 1000f)); ShowMessageHudCenterMessages = config.BindInOrder("ChatPanel.Content", "showMessageHudCenterMessages", defaultValue: true, "Show messages from the MessageHud that display in the top-center (usually boss messages)."); ShowChatPanelMessageDividers = config.BindInOrder("ChatPanel.Content", "showChatPanelMessageDividers", defaultValue: true, "Show the horizontal dividers between groups of messages."); ShowChatPanelMessageDividers.OnSettingChanged(ContentRowManager.ToggleMessageDividers); ChatPanelContentSingleRowSpacing = config.BindInOrder("ChatPanel.Spacing", "chatPanelContentSingleRowSpacing", 10f, "Spacing (in pixels) to use between rows when using 'SingleRow' layout.", (AcceptableValueBase)(object)new AcceptableValueRange(-100f, 100f)); ChatPanelContentSingleRowSpacing.OnSettingChanged((Action)delegate { ChatPanelController.ChatPanel?.SetContentSpacing(); }); ChatPanelDefaultMessageTypeToUse = config.BindInOrder("ChatPanel.Defaults", "chatPanelDefaultMessageTypeToUse", (Type)1, "ChatPanel input default message type to use on game start. Ping value is ignored."); ChatPanelContentRowTogglesToEnable = config.BindInOrder("ChatPanel.Defaults", "chatPanelContentRowTogglesToEnable", ChatMessageType.Game | ChatMessageType.HudCenter | ChatMessageType.Shout, "ChatPanel content row toggles to enable on game start."); ChatMessageShowTimestamp = config.BindInOrder("ChatMessage.Layout", "chatMessageShowTimestamp", defaultValue: false, "Show a timestamp for each group of chat messages (except system/default)."); ChatMessageShowTimestamp.OnSettingChanged(ContentRowManager.ToggleShowTimestamp); ChatMessageTextDefaultColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageTextDefaultColor", new Color(0.596f, 0.592f, 0.286f, 1f), "Color for default/system chat messages."); ChatMessageTextDefaultColor.OnSettingChanged(delegate(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ContentRowManager.SetMessageTextColor(color, ChatMessageType.Text); }); ChatMessageTextSayColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageTextSayColor", new Color(0.596f, 0.592f, 0.286f, 1f), "Color for 'normal/say' chat messages."); ChatMessageTextSayColor.OnSettingChanged(delegate(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ContentRowManager.SetMessageTextColor(color, ChatMessageType.Say); }); ChatMessageTextShoutColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageTextShoutColor", Color.yellow, "Color for 'shouting' chat messages."); ChatMessageTextShoutColor.OnSettingChanged(delegate(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ContentRowManager.SetMessageTextColor(color, ChatMessageType.Shout); }); ChatMessageTextWhisperColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageTextWhisperColor", new Color(0.6f, 0.65f, 0.75f, 1f), "Color for 'whisper' chat messages."); ChatMessageTextWhisperColor.OnSettingChanged(delegate(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ContentRowManager.SetMessageTextColor(color, ChatMessageType.Whisper); }); ChatMessageTextEmoteColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageTextMeColor", new Color(0.596f, 0.592f, 0.286f, 1f), "Color for 'emote' chat messages like /me."); ChatMessageTextEmoteColor.OnSettingChanged(delegate(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ContentRowManager.SetMessageTextColor(color, ChatMessageType.Emote); }); ChatMessageTextGestureColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageTextGesColor", new Color(0.52f, 0.52f, 0.48f, 1f), "Color for 'emote' chat messages like /ges."); ChatMessageTextGestureColor.OnSettingChanged(delegate(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ContentRowManager.SetMessageTextColor(color, ChatMessageType.Gesture); }); ChatMessageTextGameColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageTextGameColor", new Color(0.882f, 0.678f, 0.129f, 1f), "Color for 'game' chat messages like /roll."); ChatMessageTextGameColor.OnSettingChanged(delegate(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ContentRowManager.SetMessageTextColor(color, ChatMessageType.Game); }); ChatMessageTextPingColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageTextPingColor", Color.cyan, "Color for 'ping' chat messages."); ChatMessageTextPingColor.OnSettingChanged(delegate(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ContentRowManager.SetMessageTextColor(color, ChatMessageType.Ping); }); ChatMessageTextMessageHudColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageTextMessageHudColor", new Color(0.6f, 0.6f, 0.6f, 1f), "Color for 'MessageHud' chat messages."); ChatMessageTextMessageHudColor.OnSettingChanged(delegate(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ContentRowManager.SetMessageTextColor(color, ChatMessageType.HudCenter); }); ChatMessageUsernameColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageUsernameColor", new Color(0.839f, 0.345f, 0.016f, 1f), "Color for the username shown in chat messages."); ChatMessageUsernameColor.OnSettingChanged((Action)ContentRowManager.SetUsernameTextColor); ChatMessageTimestampColor = config.BindInOrder("ChatMessage.Text.Colors", "chatMessageTimestampColor", Color32.op_Implicit(new Color32((byte)244, (byte)246, (byte)247, byte.MaxValue)), "Color for any timestamp shown in the chat messages."); ChatMessageTimestampColor.OnSettingChanged((Action)ContentRowManager.SetTimestampTextColor); if (ConfigSync != null) { ConfigSync.AddConfigEntry(ShoutDistance); ConfigSync.AddConfigEntry(SayDistance); ConfigSync.AddConfigEntry(WhisperDistance); } BindFilters(config); LateBindConfig(BindChatMessageFontConfig); } private static void BindFilters(ConfigFile config) { SayTextFilterList = config.BindInOrder("Filters", "sayTextFilterList", "Filter list for Say message texts.", "\t"); ShoutTextFilterList = config.BindInOrder("Filters", "shoutTextFilterList", "Filter list for Shout message texts.", "\t"); FilterInWorldShoutText = config.BindInOrder("Filters", "filterInWorldShoutText", defaultValue: false, "If true, will also filter in-world Shout message texts."); WhisperTextFilterList = config.BindInOrder("Filters", "whisperTextFilterList", "Filter list for Whipser message texts.", "\t"); EmoteTextFilterList = config.BindInOrder("Filters", "emoteTextFilterList", "Filter list for Emote message texts.", "\t"); GameTextFilterList = config.BindInOrder("Filters", "gameTextFilterList", "Filter list for Game message texts.", "\t"); HudCenterTextFilterList = config.BindInOrder("Filters", "messageHudTextFilterList", "Filter list for MessageHud.Center message texts.", "\t"); OtherTextFilterList = config.BindInOrder("Filters", "otherHudTextFilterList", "Filter list for all other message texts.", "\t"); } public static void BindChatMessageFontConfig(ConfigFile config) { string[] array = (from f in Resources.FindObjectsOfTypeAll() select ((Object)f).name into f orderby f select f).Distinct().ToArray(); ChatMessageFontAsset = config.BindInOrder("ChatMessage.Text.Font", "chatMessageTextFontAsset", "Valheim-AveriaSansLibre", "FontAsset (TMP) to use for ChatMessage text.", (AcceptableValueBase)(object)new AcceptableValueList(array)); ChatMessageFontAsset.OnSettingChanged([<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (string fontName) => { ChatPanelController.ChatPanel?.SetContentFontAsset(UIFonts.GetFontAssetByName(fontName)); }); ChatMessageFontSize = config.BindInOrder("ChatMessage.Text.Font", "chatMessageTextFontSize", 16f, "The font size to use for chat messages.", (AcceptableValueBase)(object)new AcceptableValueRange(6f, 64f)); ChatMessageFontSize.OnSettingChanged(delegate(float fontSize) { ChatPanelController.ChatPanel?.SetContentFontSize(fontSize); }); } public static void LateBindConfig(Action lateBindConfigAction) { _fejdStartupBindConfigQueue.Enqueue(lateBindConfigAction); } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public sealed class StringListConfigEntry { private readonly List _valuesCache = new List(); private string _lastFocusedControl; private string _editingValue; private static readonly Lazy _richTextLabelStyle = new Lazy((Func)(() => new GUIStyle(GUI.skin.label) { richText = true })); private static readonly Lazy _labelStyle = new Lazy((Func)(() => new GUIStyle(GUI.skin.label) { padding = new RectOffset(5, 5, 5, 5) })); private static readonly Lazy _horizontalStyle = new Lazy((Func)(() => new GUIStyle { padding = new RectOffset(10, 10, 0, 0) })); private static readonly Lazy _buttonStyle = new Lazy((Func)(() => new GUIStyle(GUI.skin.button) { padding = new RectOffset(10, 10, 5, 5) })); private static readonly Lazy _textFieldStyle = new Lazy((Func)(() => new GUIStyle(GUI.skin.textField) { padding = new RectOffset(5, 5, 5, 5), wordWrap = false })); public ConfigEntry ConfigEntry { get; } public string[] ValuesSeparator { get; } public List Values { get { string[] array = ConfigEntry.Value.Split(ValuesSeparator, StringSplitOptions.RemoveEmptyEntries); List list = new List(array.Length); list.AddRange(array); return list; } } public List CachedValues { get; } public event EventHandler> ValuesChangedEvent; public StringListConfigEntry(ConfigFile configFile, string section, string key, string description, string valuesSeparator) { ConfigEntry = configFile.BindInOrder(section, key, string.Empty, description, (Action)Drawer, browsable: true, hideDefaultButton: true, hideSettingName: true, isAdvanced: false, readOnly: false); ValuesSeparator = new string[1] { valuesSeparator }; List values = Values; List list = new List(values.Count); list.AddRange(values); CachedValues = list; } private void Drawer(ConfigEntryBase entry) { GUILayout.BeginVertical(Array.Empty()); GUILayout.BeginHorizontal(_horizontalStyle.Value, Array.Empty()); GUILayout.Label("" + entry.Definition.Key + "\n" + entry.Description.Description + "", _richTextLabelStyle.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUILayout.EndHorizontal(); _valuesCache.Clear(); if (!string.IsNullOrEmpty(entry.BoxedValue.ToString())) { _valuesCache.AddRange(entry.BoxedValue.ToString().Split(ValuesSeparator, StringSplitOptions.None)); } int num = -1; bool flag = false; if (!string.IsNullOrEmpty(entry.BoxedValue.ToString())) { for (int i = 0; i < _valuesCache.Count; i++) { GUILayout.BeginHorizontal(_horizontalStyle.Value, Array.Empty()); GUILayout.Space(5f); GUILayout.Label($"#{i:D2}", _labelStyle.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); GUILayout.Space(5f); string name = $"{entry.Definition.Key}.{i}"; string value = _valuesCache[i]; if (ShowTextField(name, ref value) && _valuesCache[i] != value) { _valuesCache[i] = value; flag = true; } GUILayout.Space(10f); if (GUILayout.Button("Delete", _buttonStyle.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { num = i; } GUILayout.EndHorizontal(); } } GUILayout.BeginHorizontal(_horizontalStyle.Value, Array.Empty()); GUILayout.Space(10f); if (GUILayout.Button("Add new entry", _buttonStyle.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { _valuesCache.Add("changemeplease"); flag = true; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (num >= 0 && num < _valuesCache.Count) { _valuesCache.RemoveAt(num); flag = true; } if (flag) { entry.BoxedValue = string.Join(ValuesSeparator[0], _valuesCache); CachedValues.Clear(); CachedValues.AddRange(Values); this.ValuesChangedEvent?.Invoke(this, Values); } } private bool ShowTextField(string name, ref string value) { //IL_009f: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Invalid comparison between Unknown and I4 //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Invalid comparison between Unknown and I4 //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Invalid comparison between Unknown and I4 //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Invalid comparison between Unknown and I4 //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Invalid comparison between Unknown and I4 GUI.SetNextControlName(name); if (GUI.GetNameOfFocusedControl() != name) { if (_lastFocusedControl == name) { value = _editingValue; GUILayout.TextField(value, _textFieldStyle.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); return true; } GUILayout.TextField(value, _textFieldStyle.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); return false; } if (_lastFocusedControl != name) { _lastFocusedControl = name; _editingValue = value; } bool result = false; if (Event.current.isKey) { KeyCode keyCode = Event.current.keyCode; if ((int)keyCode <= 13) { if ((int)keyCode == 9 || (int)keyCode == 13) { goto IL_00c3; } } else if ((int)keyCode == 27 || (int)keyCode == 271) { goto IL_00c3; } } goto IL_00d7; IL_00c3: value = _editingValue; result = true; Event.current.Use(); goto IL_00d7; IL_00d7: _editingValue = GUILayout.TextField(_editingValue, _textFieldStyle.Value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); return result; } } public static class StringListConfigEntryExtensions { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static StringListConfigEntry BindInOrder(this ConfigFile config, string section, string key, string description, string valuesSeparator) { return new StringListConfigEntry(config, section, key, description, valuesSeparator); } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public sealed class ChatMessage { public ChatMessageType MessageType { get; set; } = ChatMessageType.Text; public DateTime Timestamp { get; set; } = DateTime.MinValue; public long SenderId { get; set; } public Vector3 Position { get; set; } = Vector3.zero; public Type TalkerType { get; set; } = (Type)1; public string Username { get; set; } = string.Empty; public string Text { get; set; } = string.Empty; } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class ChatPanelController { public static ChatPanel ChatPanel { get; private set; } public static GuiInputField VanillaInputField { get; set; } public static void ToggleChatter(bool toggleOn) { ToggleChatter(Chat.m_instance, toggleOn); } public static void ToggleChatter(Chat chat, bool toggleOn) { TerminalCommands.ToggleCommands(toggleOn); if (Object.op_Implicit((Object)(object)chat)) { ToggleVanillaChat(chat, !toggleOn); ToggleChatPanel(chat, toggleOn); ((Terminal)chat).m_input = (toggleOn ? ChatPanel.TextInput.InputField : VanillaInputField); } } public static void ToggleVanillaChat(Chat chat, bool toggleOn) { ((Component)((TMP_Text)((Terminal)chat).m_output).transform.parent).gameObject.SetActive(toggleOn); ((Component)((Terminal)chat).m_output).gameObject.SetActive(toggleOn); } public static void ToggleChatPanel(Chat chat, bool toggleOn) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ChatPanel?.Panel)) { ChatPanel = new ChatPanel(((Component)Hud.m_instance).transform); ((Transform)ChatPanel.Panel.GetComponent().SetAnchorMin(Vector2.right).SetAnchorMax(Vector2.right) .SetPivot(Vector2.right) .SetPosition(PluginConfig.ChatPanelPosition.Value) .SetSizeDelta(PluginConfig.ChatPanelSizeDelta.Value)).SetAsFirstSibling(); ChatPanel.PanelDragger.OnEndDragEvent += OnChatterChatPanelEndDrag; ChatPanel.PanelResizer.OnEndDragEvent += OnChatterChatPanelEndResize; ((UnityEvent)(object)((TMP_InputField)ChatPanel.TextInput.InputField).onSubmit).AddListener((UnityAction)OnChatterTextInputFieldSubmit); ChatPanel.SetChatTextInputPrefix(PluginConfig.ChatPanelDefaultMessageTypeToUse.Value); ChatPanel.SetupContentRowToggles(PluginConfig.ChatPanelContentRowTogglesToEnable.Value); ChatPanel.SetContentSpacing(); ContentRowManager.RebuildContentRows(); } ChatPanel.Panel.SetActive(toggleOn); } public static bool TryGetChatPanel(out ChatPanel chatPanel) { chatPanel = ChatPanel; return Object.op_Implicit((Object)(object)chatPanel?.Panel); } private static void OnChatterChatPanelEndDrag(object sender, Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) PluginConfig.ChatPanelPosition.Value = Vector2.op_Implicit(position); } private static void OnChatterChatPanelEndResize(object send, Vector2 sizeDelta) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) PluginConfig.ChatPanelSizeDelta.Value = sizeDelta; } private static void OnChatterTextInputFieldSubmit(string input) { Chat.m_instance.SendInput(); } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class ContentRowManager { public static CircularQueue MessageRows { get; } = new CircularQueue(50, DestroyContentRow); public static void CreateContentRow(ChatMessage message) { if (!Object.op_Implicit((Object)(object)ChatPanelController.ChatPanel?.Content)) { return; } if (ShouldCreateContentRow(message)) { ContentRow contentRow = new ContentRow(message, MessageLayoutType.SingleRow, ChatPanelController.ChatPanel.Content.transform); MessageRows.EnqueueItem(contentRow); SetupContentRow(contentRow); bool flag = ChatPanelController.ChatPanel.IsMessageTypeToggleActive(message.MessageType); GameObject obj = contentRow.Divider.Ref(); if (obj != null) { obj.SetActive(flag && PluginConfig.ShowChatPanelMessageDividers.Value); } contentRow.Row.SetActive(flag); } TextMeshProUGUI obj2 = MessageRows.LastItem.AddBodyLabel(message); ((TMP_Text)obj2).font = UIFonts.GetFontAssetByName(PluginConfig.ChatMessageFontAsset.Value); ((TMP_Text)obj2).fontSize = PluginConfig.ChatMessageFontSize.Value; } public static bool ShouldCreateContentRow(ChatMessage message) { return true; } public static void DestroyContentRow(ContentRow row) { if (Object.op_Implicit((Object)(object)row.Row)) { Object.Destroy((Object)(object)row.Row); } if (Object.op_Implicit((Object)(object)row.Divider)) { Object.Destroy((Object)(object)row.Divider); } } public static void RebuildContentRows() { MessageRows.ClearItems(); if (!Object.op_Implicit((Object)(object)ChatPanelController.ChatPanel?.Panel)) { return; } foreach (ChatMessage item in ChatMessageUtils.MessageHistory) { CreateContentRow(item); } } public static void SetupContentRow(ContentRow row) { if (row.LayoutType == MessageLayoutType.SingleRow) { row.RowLayoutGroup.SetSpacing(PluginConfig.ChatPanelContentSingleRowSpacing.Value); } } public static void ToggleContentRows(bool toggleOn, ChatMessageType messageType) { foreach (ContentRow messageRow in MessageRows) { if (messageRow.Message.MessageType == messageType) { GameObject obj = messageRow.Row.Ref(); if (obj != null) { obj.SetActive(toggleOn); } GameObject obj2 = messageRow.Divider.Ref(); if (obj2 != null) { obj2.SetActive(toggleOn); } } } } public static void SetContentRowSpacing(float spacing) { foreach (ContentRow messageRow in MessageRows) { messageRow?.RowLayoutGroup.Ref()?.SetSpacing(spacing); } } public static void SetMessageTextColor(Color color, ChatMessageType messageType) { } public static void SetUsernameTextColor(Color color) { RebuildContentRows(); } public static void SetTimestampTextColor(Color color) { RebuildContentRows(); } public static void ToggleShowTimestamp(bool toggleOn) { RebuildContentRows(); } public static void ToggleMessageDividers(bool toggleOn) { foreach (ContentRow messageRow in MessageRows) { if (messageRow != null) { GameObject obj = messageRow.Divider.Ref(); if (obj != null) { obj.SetActive(toggleOn); } } } } } public enum CardSuit { Spades, Hearts, Diamonds, Clubs } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public readonly struct PlayingCard { public readonly CardSuit Suit; public readonly int Rank; public string RankString { get { switch (Rank) { case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: { int rank = Rank; return rank.ToString(); } case 11: return "J"; case 12: return "Q"; case 13: return "K"; case 14: return "A"; default: return "?"; } } } public string SuitSymbol => Suit switch { CardSuit.Spades => "♠", CardSuit.Hearts => "♥", CardSuit.Diamonds => "♦", CardSuit.Clubs => "♣", _ => "?", }; public PlayingCard(CardSuit suit, int rank) { Suit = suit; Rank = rank; } public override string ToString() { return RankString + SuitSymbol; } } [Flags] public enum ChatMessageType { None = 0, Text = 1, HudCenter = 2, Say = 4, Shout = 8, Whisper = 0x10, Gesture = 0x11, Emote = 0x14, Game = 0x15, Ping = 0x20 } public enum MessageLayoutType { SingleRow } public enum TarotSuit { Cups, Coins, Swords, Wands } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public readonly struct TarotCard { public readonly bool IsMajor; public readonly int Rank; public readonly TarotSuit Suit; public readonly bool IsReversed; public string MajorName => Rank switch { 0 => "The Fool", 1 => "The Magician", 2 => "The High Priestess", 3 => "The Empress", 4 => "The Emperor", 5 => "The Hierophant", 6 => "The Lovers", 7 => "The Chariot", 8 => "Strength", 9 => "The Hermit", 10 => "Wheel of Fortune", 11 => "Justice", 12 => "The Hanged Man", 13 => "Death", 14 => "Temperance", 15 => "The Devil", 16 => "The Tower", 17 => "The Star", 18 => "The Moon", 19 => "The Sun", 20 => "Judgement", 21 => "The World", _ => "?", }; public string MinorRankString { get { switch (Rank) { case 1: return "Ace"; case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: { int rank = Rank; return rank.ToString(); } case 11: return "Page"; case 12: return "Knight"; case 13: return "Queen"; case 14: return "King"; default: return "?"; } } } public string Name { get { if (!IsMajor) { return $"{MinorRankString} of {Suit} {SuitSymbolOf(Suit)}"; } return MajorName; } } public TarotCard(int majorRank, bool reversed) { IsMajor = true; Rank = majorRank; Suit = TarotSuit.Cups; IsReversed = reversed; } public TarotCard(TarotSuit suit, int minorRank, bool reversed) { IsMajor = false; Rank = minorRank; Suit = suit; IsReversed = reversed; } public static string SuitSymbolOf(TarotSuit s) { return s switch { TarotSuit.Cups => "\ud83c\udf77", TarotSuit.Coins => "\ud83e\ude99", TarotSuit.Swords => "⚔", TarotSuit.Wands => "\ud83e\ude84", _ => "?", }; } public override string ToString() { if (!IsReversed) { return Name; } return Name + "⁽ʳ⁾"; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] internal sealed class TarotDeck { private readonly object _lock = new object(); private readonly Stack _drawPile = new Stack(78); public int Count { get { lock (_lock) { return _drawPile.Count; } } } public void Shuffle(int reversalPercent = 50) { List list = new List(78); for (int i = 0; i <= 21; i++) { bool reversed = RollUnder(reversalPercent); list.Add(new TarotCard(i, reversed)); } foreach (TarotSuit value3 in Enum.GetValues(typeof(TarotSuit))) { for (int j = 1; j <= 14; j++) { bool reversed2 = RollUnder(reversalPercent); list.Add(new TarotCard(value3, j, reversed2)); } } for (int num = list.Count - 1; num > 0; num--) { int num2 = GamesPatch.RandomRoll(0, num); List list2 = list; int index = num; List list3 = list; int index2 = num2; TarotCard value = list[num2]; TarotCard value2 = list[num]; list2[index] = value; list3[index2] = value2; } lock (_lock) { _drawPile.Clear(); foreach (TarotCard item in list) { _drawPile.Push(item); } } } public bool TryDraw(out TarotCard card) { lock (_lock) { if (_drawPile.Count == 0) { card = default(TarotCard); return false; } card = _drawPile.Pop(); return true; } } public int TryDrawMany(int count, List drawn) { if (count <= 0) { return 0; } if (drawn == null) { drawn = new List(count); } lock (_lock) { int num = Math.Min(count, _drawPile.Count); for (int i = 0; i < num; i++) { drawn.Add(_drawPile.Pop()); } return num; } } private static bool RollUnder(int percent) { percent = Mathf.Clamp(percent, 0, 100); return GamesPatch.RandomRoll(0, 99) < percent; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] internal static class LocalTarot { private static TarotDeck _deck; public static bool HasDeck => _deck != null; public static int Remaining { get { if (!HasDeck) { return 0; } return _deck.Count; } } public static void Reset(int reversalPercent) { _deck = new TarotDeck(); _deck.Shuffle(reversalPercent); } public static bool TryDraw(out TarotCard card) { card = default(TarotCard); if (!HasDeck) { return false; } return _deck.TryDraw(out card); } public static int TryDrawMany(int count, List drawn) { if (!HasDeck) { return 0; } return _deck.TryDrawMany(count, drawn); } } internal static class RpMarkers { public const char EmoteChar = '\u200b'; public const char GameChar = '\u200c'; public const char GestureChar = '\u200d'; public static bool IsMarkerChar(char c) { if (c != '\u200b' && c != '\u200c') { return c == '\u200d'; } return true; } public static bool NoBubbleChar(char c) { if (c != '\u200b' && c != '\u200c') { return c == '\u200d'; } return true; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class TerminalCommands { [CompilerGenerated] private static class <>O { [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEvent <0>__RunShoutCommand; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEvent <1>__RunWhisperCommand; } private static readonly List _commands = new List(); public static void ToggleCommands(bool toggleOn) { DeregisterCommands(_commands); _commands.Clear(); if (toggleOn) { _commands.AddRange(RegisterCommands()); } UpdateCommandLists(); } private static ConsoleCommand[] RegisterCommands() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown ConsoleCommand[] array = new ConsoleCommand[2]; object obj = <>O.<0>__RunShoutCommand; if (obj == null) { ConsoleEvent val = RunShoutCommand; <>O.<0>__RunShoutCommand = val; obj = (object)val; } array[0] = new ConsoleCommand("shout", "(Chatter) shout ", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>O.<1>__RunWhisperCommand; if (obj2 == null) { ConsoleEvent val2 = RunWhisperCommand; <>O.<1>__RunWhisperCommand = val2; obj2 = (object)val2; } array[1] = new ConsoleCommand("whisper", "(Chatter) whisper ", (ConsoleEvent)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); return (ConsoleCommand[])(object)array; } public static void RunShoutCommand(ConsoleEventArgs args) { if (args.FullLine.Length < 7) { ChatPanelController.ChatPanel?.SetChatTextInputPrefix((Type)2); } else if (Object.op_Implicit((Object)(object)Chat.m_instance)) { Chat.m_instance.SendText((Type)2, args.FullLine.Substring(6)); } } public static void RunWhisperCommand(ConsoleEventArgs args) { if (args.FullLine.Length < 9) { ChatPanelController.ChatPanel?.SetChatTextInputPrefix((Type)0); } else if (Object.op_Implicit((Object)(object)Chat.m_instance)) { Chat.m_instance.SendText((Type)0, args.FullLine.Substring(8)); } } private static void DeregisterCommands(List commands) { foreach (ConsoleCommand command in commands) { if (Terminal.commands[command.Command] == command) { Terminal.commands.Remove(command.Command); } } } private static void UpdateCommandLists() { Terminal[] array = Object.FindObjectsOfType(true); for (int i = 0; i < array.Length; i++) { array[i].updateCommandList(); } } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public sealed class ChatPanel { public GameObject Panel { get; private set; } public RectTransform PanelRectTransform { get; private set; } public Image PanelBackground { get; private set; } public CanvasGroup PanelCanvasGroup { get; private set; } public RectTransformDragger PanelDragger { get; private set; } public GameObject ContentViewport { get; private set; } public GameObject Content { get; private set; } public VerticalLayoutGroup ContentLayoutGroup { get; private set; } public ScrollRect ContentScrollRect { get; private set; } public InputFieldCell TextInput { get; private set; } public ToggleRow MessageTypeToggleRow { get; private set; } public ResizeCell ResizerCell { get; private set; } public RectTransformResizer PanelResizer { get; private set; } public ChatPanel(Transform parentTransform) { Panel = CreateChildPanel(parentTransform); PanelRectTransform = Panel.GetComponent(); PanelBackground = Panel.GetComponent(); PanelCanvasGroup = Panel.GetComponent(); PanelDragger = Panel.GetComponent(); ContentViewport = CreateChildViewport(Panel.transform); Content = CreateChildContent(ContentViewport.transform); ContentLayoutGroup = Content.GetComponent(); ContentScrollRect = CreateChildScrollRect(ContentViewport, Content); TextInput = new InputFieldCell(Panel.transform); LayoutElement layoutElement = TextInput.Cell.AddComponent().SetFlexible((float?)1f, (float?)null); float? height = 35f; layoutElement.SetPreferred((float?)null, height); MessageTypeToggleRow = new ToggleRow(Panel.transform); MessageTypeToggleRow.Row.AddComponent().SetIgnoreLayout(ignoreLayout: true); ResizerCell = new ResizeCell(MessageTypeToggleRow.Row.transform); ResizerCell.Cell.AddComponent().SetIgnoreLayout(ignoreLayout: true); PanelResizer = ResizerCell.Cell.AddComponent().SetTargetRectTransform(Panel.GetComponent()); } private GameObject CreateChildPanel(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ChatPanel", new Type[1] { typeof(RectTransform) }); val.SetParent(parentTransform); val.AddComponent(); val.GetComponent().SetAnchorMin(new Vector2(0.5f, 0.5f)).SetAnchorMax(new Vector2(0.5f, 0.5f)) .SetPivot(new Vector2(0.5f, 0.5f)) .SetPosition(Vector2.zero) .SetSizeDelta(new Vector2(400f, 400f)); val.AddComponent().SetChildControl((bool?)true, (bool?)true).SetChildForceExpand((bool?)false, (bool?)false) .SetPadding((int?)8, (int?)8, (int?)8, (int?)8) .SetSpacing(10f); ImageExtensions.SetColor(val.AddComponent().SetType((Type)1).SetSprite(UISpriteBuilder.CreateSuperellipse(400, 400, 15f)), new Color(0f, 0f, 0f, 0.4f)); val.AddComponent().SetAlpha(1f).SetBlocksRaycasts(blocksRaycasts: true); val.AddComponent().SetTargetRectTransform(val.GetComponent()); return val; } private GameObject CreateChildViewport(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown GameObject val = new GameObject("Viewport", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); ImageExtensions.SetColor(val.AddComponent().SetType((Type)3), Color.clear); val.AddComponent(); val.AddComponent().SetFlexible((float?)1f, (float?)1f); return val; } private GameObject CreateChildContent(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown GameObject val = new GameObject("Content", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.GetComponent().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.right) .SetPivot(Vector2.zero) .SetPosition(Vector2.zero) .SetSizeDelta(Vector2.zero); val.AddComponent().SetChildControl((bool?)true, (bool?)true).SetChildForceExpand((bool?)false, (bool?)false) .SetPadding((int?)8, (int?)8, (int?)null, (int?)null) .SetSpacing(10f); val.AddComponent().SetHorizontalFit((FitMode)0).SetVerticalFit((FitMode)2); return val; } private ScrollRect CreateChildScrollRect(GameObject viewport, GameObject content) { ScrollRect obj = viewport.AddComponent(); obj.viewport = viewport.GetComponent(); obj.content = content.GetComponent(); obj.horizontal = false; obj.vertical = true; obj.movementType = (MovementType)1; obj.scrollSensitivity = 20f; return obj; } public void OffsetContentVerticalScrollPosition(float offset) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) Transform transform = Content.transform; float num = offset / ((RectTransform)((transform is RectTransform) ? transform : null)).sizeDelta.y; ScrollRect contentScrollRect = ContentScrollRect; contentScrollRect.verticalNormalizedPosition += num; } public void SetContentVerticalScrollPosition(float position) { ContentScrollRect.verticalNormalizedPosition = position; } public void ToggleGrabber(bool toggleOn) { MessageTypeToggleRow.Row.SetActive(toggleOn); } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public sealed class ContentRow { public ChatMessage Message { get; private set; } public MessageLayoutType LayoutType { get; private set; } public GameObject Row { get; private set; } public VerticalLayoutGroup RowLayoutGroup { get; private set; } public GameObject Divider { get; private set; } public GameObject Header { get; private set; } public TextMeshProUGUI HeaderLeftLabel { get; private set; } public TextMeshProUGUI HeaderRightLabel { get; private set; } public ContentRow(ChatMessage message, MessageLayoutType layoutType, Transform parentTransform) { Message = message; LayoutType = layoutType; Row = CreateChildRow(parentTransform); RowLayoutGroup = Row.GetComponent(); } public TextMeshProUGUI AddBodyLabel(ChatMessage message) { TextMeshProUGUI obj = CreateChildBodyLabel(Row.transform); ((TMP_Text)obj).text = ChatMessageUtils.GetContentRowBodyText(message); return obj; } private GameObject CreateChildRow(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown GameObject val = new GameObject("Message", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.GetComponent().SetSizeDelta(Vector2.zero); val.AddComponent().SetChildControl((bool?)true, (bool?)true).SetChildForceExpand((bool?)true, (bool?)false) .SetSpacing(2f); return val; } private GameObject CreateDivider(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown GameObject val = new GameObject("Divider", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); ImageExtensions.SetColor(val.AddComponent().SetSprite(UISpriteBuilder.CreateRect(10, 10, Color32.op_Implicit(Color.white))).SetType((Type)3), new Color(1f, 1f, 1f, 0.0625f)).SetRaycastTarget(raycastTarget: true).SetMaskable(maskable: true); LayoutElement layoutElement = val.AddComponent().SetFlexible((float?)1f, (float?)null); float? height = 1f; layoutElement.SetPreferred((float?)null, height); return val; } [return: <30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(new byte[] { 0, 1, 1, 1 })] private (GameObject header, TextMeshProUGUI leftCell, TextMeshProUGUI rightCell) CreateHeader(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown GameObject val = new GameObject("Header", new Type[1] { typeof(RectTransform) }); val.SetParent(parentTransform); val.AddComponent().SetChildControl((bool?)true, (bool?)true).SetChildForceExpand((bool?)false, (bool?)false) .SetPadding((int?)0, (int?)0, (int?)0, (int?)0); TextMeshProUGUI val2 = UIBuilder.CreateLabel(val.transform); ((Object)val2).name = "HeaderLeftLabel"; ((TMP_Text)val2).text = "LeftLabel"; ((TMP_Text)val2).alignment = (TextAlignmentOptions)513; GameObject val3 = new GameObject("Spacer", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val3, val.transform); val3.AddComponent().SetFlexible((float?)1f, (float?)null); TextMeshProUGUI val4 = UIBuilder.CreateLabel(val.transform); ((Object)val4).name = "HeaderRightLabel"; ((TMP_Text)val4).text = "RightLabel"; ((TMP_Text)val4).alignment = (TextAlignmentOptions)516; return (val, val2, val4); } private TextMeshProUGUI CreateChildBodyLabel(Transform parentTransform) { TextMeshProUGUI obj = UIBuilder.CreateLabel(parentTransform); ((Object)obj).name = "BodyLabel"; ((TMP_Text)obj).alignment = (TextAlignmentOptions)513; ((TMP_Text)obj).textWrappingMode = (TextWrappingModes)1; return obj; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public sealed class InputFieldCell { public GameObject Cell { get; private set; } public Image Background { get; private set; } public GuiInputField InputField { get; private set; } public TextMeshProUGUI InputFieldPlaceholder { get; private set; } public InputFieldCell(Transform parentTransform) { Cell = CreateChildCell(parentTransform); Background = Cell.GetComponent(); InputField = CreateChildInputField(Cell.transform); InputFieldPlaceholder = ((Component)((TMP_InputField)InputField).placeholder).GetComponent(); InputField.SetTargetGraphic((Graphic)(object)Background).SetTransition((Transition)1).SetNavigationMode((Mode)0); } private GameObject CreateChildCell(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0072: Expected O, but got Unknown GameObject val = new GameObject("Cell", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); ImageExtensions.SetColor(val.AddComponent().SetType((Type)1).SetSprite(UISpriteBuilder.CreateSuperellipse(128, 128, 10f)), new Color(0.1f, 0.1f, 0.1f, 0.3f)); val.AddComponent(); return val; } private GuiInputField CreateChildInputField(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Text Area", new Type[1] { typeof(RectTransform) }); val.SetParent(parentTransform); val.GetComponent().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one) .SetPivot(new Vector2(0.5f, 0.5f)) .SetSizeDelta(new Vector2(-16f, -8f)) .SetPosition(Vector2.zero); TextMeshProUGUI val2 = UIBuilder.CreateLabel(val.transform); val2.SetName("Text"); ((TMP_Text)val2).rectTransform.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one).SetSizeDelta(Vector2.zero) .SetPosition(Vector2.zero); ((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)val2).overflowMode = (TextOverflowModes)2; ((TMP_Text)val2).richText = false; ((TMP_Text)val2).alignment = (TextAlignmentOptions)513; ((Graphic)val2).color = Color.white; ((TMP_Text)val2).text = string.Empty; TextMeshProUGUI val3 = UIBuilder.CreateLabel(val.transform); val3.SetName("Placeholder"); ((TMP_Text)val3).rectTransform.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one).SetSizeDelta(Vector2.zero) .SetPosition(Vector2.zero); ((TMP_Text)val3).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)val3).overflowMode = (TextOverflowModes)2; ((TMP_Text)val3).richText = true; ((TMP_Text)val3).alignment = (TextAlignmentOptions)513; ((Graphic)val3).color = new Color(1f, 1f, 1f, 0.3f); ((TMP_Text)val3).text = "..."; GuiInputField obj = ((Component)parentTransform).gameObject.AddComponent(); ((TMP_InputField)obj).textViewport = val.GetComponent(); ((TMP_InputField)obj).textComponent = (TMP_Text)(object)val2; ((TMP_InputField)obj).placeholder = (Graphic)(object)val3; ((TMP_InputField)obj).onFocusSelectAll = false; obj.OnInputLayoutChanged(); ((TMP_InputField)obj).MoveToStartOfLine(false, false); return obj; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public sealed class ResizeCell { public GameObject Cell { get; private set; } public Image Background { get; private set; } public TMP_Text Label { get; private set; } public ResizeCell(Transform parentTransform) { Cell = CreateChildCell(parentTransform); Background = Cell.GetComponent(); Label = CreateChildLabel(Cell.transform); } private GameObject CreateChildCell(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00cc: Expected O, but got Unknown GameObject val = new GameObject("Resizer", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.GetComponent().SetAnchorMin(new Vector2(0f, 0.5f)).SetAnchorMax(new Vector2(0f, 0.5f)) .SetPivot(new Vector2(0f, 0.5f)) .SetSizeDelta(new Vector2(42.5f, 42.5f)) .SetPosition(new Vector2(5f, 0f)); ImageExtensions.SetColor(val.AddComponent().SetType((Type)1).SetSprite(UIResources.GetSprite("button")), new Color(1f, 1f, 1f, 0.95f)); return val; } private TMP_Text CreateChildLabel(Transform parentTransform) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = UIBuilder.CreateLabel(parentTransform); ((Component)obj).GetComponent().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one) .SetPivot(new Vector2(0.5f, 0.5f)) .SetSizeDelta(Vector2.zero); ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).fontSize = 24f; ((TMP_Text)obj).text = "↔"; return (TMP_Text)(object)obj; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public sealed class ToggleCell { public static readonly Color BackgroundColorOn = new Color(1f, 1f, 1f, 0.95f); public static readonly Color BackgroundColorOff = new Color(0.5f, 0.5f, 0.5f, 0.95f); public static readonly Color LabelColorOn = Color.white; public static readonly Color LabelColorOff = Color.gray; public GameObject Cell { get; private set; } public Image Background { get; private set; } public TextMeshProUGUI Label { get; private set; } public Toggle Toggle { get; private set; } public ToggleCell(Transform parentTransform) { Cell = CreateChildCell(parentTransform); Background = Cell.GetComponent(); Label = CreateChildLabel(Cell.transform); Toggle = Cell.AddComponent(); ((UnityEvent)(object)Toggle.onValueChanged).AddListener((UnityAction)OnToggleValueChanged); Toggle.SetNavigationMode((Mode)0).SetTargetGraphic((Graphic)(object)Background).SetIsOnWithoutNotify(false); Cell.AddComponent(); OnToggleValueChanged(isOn: false); } private GameObject CreateChildCell(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown GameObject val = new GameObject("Toggle", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.GetComponent().SetSizeDelta(Vector2.zero); ImageExtensions.SetColor(val.AddComponent().SetType((Type)1).SetSprite(UIResources.GetSprite("button")), BackgroundColorOn); return val; } private TextMeshProUGUI CreateChildLabel(Transform parentTransform) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = UIBuilder.CreateLabel(parentTransform); ((TMP_Text)TextMeshProExtensions.SetColor(obj.SetAlignment((TextAlignmentOptions)514).SetFontSize(14f), LabelColorOn)).SetText("Toggle"); ((TMP_Text)obj).rectTransform.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one).SetSizeDelta(Vector2.zero) .SetPosition(Vector2.zero); return obj; } public void SetToggleIsOn(bool isOn) { Toggle.isOn = isOn; } public bool GetToggleIsOn() { return Toggle.isOn; } private void OnToggleValueChanged(bool isOn) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) ((Graphic)Background).color = (isOn ? BackgroundColorOn : BackgroundColorOff); ((Graphic)Label).color = (isOn ? LabelColorOn : LabelColorOff); } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public sealed class ToggleRow { public GameObject Row { get; private set; } public Image Background { get; private set; } public ToggleCell SayToggle { get; private set; } public ToggleCell ShoutToggle { get; private set; } public ToggleCell WhisperToggle { get; private set; } public ToggleCell PingToggle { get; private set; } public ToggleCell EmoteToggle { get; private set; } public ToggleCell GameToggle { get; private set; } public ToggleCell MessageHudToggle { get; private set; } public ToggleCell TextToggle { get; private set; } public ToggleRow(Transform parentTransform) { Row = CreateChildRow(parentTransform); Background = Row.GetComponent(); SayToggle = CreateChildToggle(Row.transform, "Say"); ShoutToggle = CreateChildToggle(Row.transform, "Shout"); WhisperToggle = CreateChildToggle(Row.transform, "Whisper"); EmoteToggle = CreateChildToggle(Row.transform, "Emote"); PingToggle = CreateChildToggle(Row.transform, "Ping"); MessageHudToggle = CreateChildToggle(Row.transform, "Hud"); GameToggle = CreateChildToggle(Row.transform, "Game"); TextToggle = CreateChildToggle(Row.transform, "Text"); } private GameObject CreateChildRow(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown GameObject val = new GameObject("ToggleRow", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.GetComponent().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.right) .SetPivot(new Vector2(0.5f, 0f)) .SetPosition(new Vector2(0f, -55f)) .SetSizeDelta(new Vector2(0f, 45f)); ImageExtensions.SetColor(val.AddComponent().SetType((Type)1).SetSprite(UISpriteBuilder.CreateRoundedCornerSprite(256, 256, 16, (FilterMode)1)), new Color(0.5f, 0.5f, 0.5f, 0.25f)); val.AddComponent().SetChildControl((bool?)true, (bool?)true).SetChildForceExpand((bool?)false, (bool?)false) .SetSpacing(5f) .SetPadding((int?)5, (int?)5, (int?)4, (int?)4) .SetChildAlignment((TextAnchor)5); return val; } private ToggleCell CreateChildToggle(Transform parentTransform, string toggleText) { ToggleCell toggleCell = new ToggleCell(parentTransform); ((TMP_Text)toggleCell.Label).text = toggleText; LayoutElement layoutElement = toggleCell.Cell.AddComponent().SetPreferred((float?)(((TMP_Text)toggleCell.Label).GetPreferredWidth() + 25f), (float?)null); float? height = 0.9f; layoutElement.SetFlexible((float?)null, height); return toggleCell; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public sealed class RectTransformDragger : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler { private Vector2 _lastMousePosition; [field: SerializeField] public RectTransform TargetRectTransform { get; private set; } public event EventHandler OnEndDragEvent; public RectTransformDragger SetTargetRectTransform(RectTransform rectTransform) { TargetRectTransform = rectTransform; return this; } public void OnBeginDrag(PointerEventData eventData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _lastMousePosition = eventData.position; } public void OnDrag(PointerEventData eventData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0045: Unknown result type (might be due to invalid IL or missing references) Vector2 val = eventData.position - _lastMousePosition; RectTransform targetRectTransform = TargetRectTransform; ((Transform)targetRectTransform).position = ((Transform)targetRectTransform).position + new Vector3(val.x, val.y, 0f); _lastMousePosition = eventData.position; } public void OnEndDrag(PointerEventData eventData) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) this.OnEndDragEvent?.Invoke(this, Vector2.op_Implicit(TargetRectTransform.anchoredPosition)); } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public sealed class RectTransformResizer : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler { private Vector2 _lastMousePosition; [field: SerializeField] public RectTransform TargetRectTransform { get; private set; } public event EventHandler OnEndDragEvent; public RectTransformResizer SetTargetRectTransform(RectTransform rectTransform) { TargetRectTransform = rectTransform; return this; } public void OnBeginDrag(PointerEventData eventData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _lastMousePosition = eventData.position; } public void OnDrag(PointerEventData eventData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //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) Vector2 val = _lastMousePosition - eventData.position; RectTransform targetRectTransform = TargetRectTransform; targetRectTransform.anchoredPosition += new Vector2(0f, 0f - val.y); RectTransform targetRectTransform2 = TargetRectTransform; targetRectTransform2.sizeDelta += new Vector2(val.x, val.y); _lastMousePosition = eventData.position; } public void OnEndDrag(PointerEventData eventData) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) this.OnEndDragEvent?.Invoke(this, TargetRectTransform.sizeDelta); } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class ChatMessageUtils { public static readonly CircularQueue MessageHistory = new CircularQueue(50, delegate { }); public static bool IsChatMessageFiltered { get; set; } public static bool IsChatMessageQueued { get; set; } public static bool AddChatMessage(ChatMessage message) { if (ShouldShowText(message.MessageType, message.Text)) { MessageHistory.EnqueueItem(message); ContentRowManager.CreateContentRow(message); return true; } return false; } public static ChatMessageType GetChatMessageType(Type talkerType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected I4, but got Unknown return (int)talkerType switch { 1 => ChatMessageType.Say, 2 => ChatMessageType.Shout, 0 => ChatMessageType.Whisper, 3 => ChatMessageType.Ping, _ => ChatMessageType.Text, }; } public static string GetContentRowBodyText(ChatMessage message) { return JoinIgnoringEmpty(PluginConfig.ChatMessageShowTimestamp.Value ? GetTimestampText(message.Timestamp) : string.Empty, GetUsernameText(message.Username), GetMessageText(message)); } private static string JoinIgnoringEmpty(params string[] values) { return string.Join(" ", values.Where([<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (string value) => !string.IsNullOrEmpty(value))); } public static string GetUsernameText(string username) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (username.Length <= 0) { return string.Empty; } return "" + username + ""; } public static string GetTimestampText(DateTime timestamp) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) return PluginConfig.ChatMessageShowTimestamp.Value ? $"{timestamp:t}" : string.Empty; } public static string GetMessageText(ChatMessage message) { //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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) return message.MessageType switch { ChatMessageType.Ping => $"Ping! {message.Position}", ChatMessageType.Game => "\ud83c\udfb2 " + message.Text + "", ChatMessageType.Emote => " " + message.Text + "", ChatMessageType.Gesture => " " + message.Text + "", ChatMessageType.Whisper => "whispers, \"" + message.Text + "\"", ChatMessageType.Say => "says, \"" + message.Text + "\"", ChatMessageType.Shout => "yells, \"" + message.Text + "\"", ChatMessageType.HudCenter => "" + message.Text + "", ChatMessageType.Text => "" + message.Text + "", _ => message.Text, }; } public static Color GetMessageTextColor(ChatMessageType messageType) { //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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) return (Color)(messageType switch { ChatMessageType.Text => PluginConfig.ChatMessageTextDefaultColor.Value, ChatMessageType.HudCenter => PluginConfig.ChatMessageTextMessageHudColor.Value, ChatMessageType.Say => PluginConfig.ChatMessageTextSayColor.Value, ChatMessageType.Shout => PluginConfig.ChatMessageTextShoutColor.Value, ChatMessageType.Whisper => PluginConfig.ChatMessageTextWhisperColor.Value, ChatMessageType.Ping => PluginConfig.ChatMessageTextPingColor.Value, ChatMessageType.Emote => PluginConfig.ChatMessageTextEmoteColor.Value, ChatMessageType.Gesture => PluginConfig.ChatMessageTextGestureColor.Value, ChatMessageType.Game => PluginConfig.ChatMessageTextGameColor.Value, _ => PluginConfig.ChatMessageTextDefaultColor.Value, }); } public static bool ShouldShowText(ChatMessageType messageType, string text) { return messageType switch { ChatMessageType.Say => ShouldShowText(text, PluginConfig.SayTextFilterList.CachedValues), ChatMessageType.Shout => ShouldShowText(text, PluginConfig.ShoutTextFilterList.CachedValues), ChatMessageType.Whisper => ShouldShowText(text, PluginConfig.WhisperTextFilterList.CachedValues), ChatMessageType.Emote => ShouldShowText(text, PluginConfig.EmoteTextFilterList.CachedValues), ChatMessageType.Gesture => ShouldShowText(text, PluginConfig.WhisperTextFilterList.CachedValues), ChatMessageType.Game => ShouldShowText(text, PluginConfig.GameTextFilterList.CachedValues), ChatMessageType.HudCenter => ShouldShowText(text, PluginConfig.HudCenterTextFilterList.CachedValues), ChatMessageType.Text => ShouldShowText(text, PluginConfig.OtherTextFilterList.CachedValues), _ => true, }; } public static bool ShouldShowText(string text, List filters) { if (filters.Count == 0) { return true; } int i = 0; for (int count = filters.Count; i < count; i++) { if (text.IndexOf(filters[i], 0, StringComparison.OrdinalIgnoreCase) >= 0) { return false; } } return true; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class ChatPanelUtils { public static void ShowOrHideChatPanel(this ChatPanel chatPanel, bool isVisible) { if (isVisible != chatPanel.PanelCanvasGroup.blocksRaycasts) { if (isVisible) { chatPanel.PanelCanvasGroup.SetAlpha(1f).SetBlocksRaycasts(blocksRaycasts: true); return; } chatPanel.PanelCanvasGroup.SetAlpha(Hud.IsUserHidden() ? 0f : PluginConfig.HideChatPanelAlpha.Value).SetBlocksRaycasts(blocksRaycasts: false); chatPanel.SetContentVerticalScrollPosition(0f); } } public static void EnableOrDisableChatPanel(this ChatPanel chatPanel, bool isEnabled) { chatPanel.TextInput.InputField.Ref()?.SetEnabled(isEnabled); } public static void SetContentSpacing(this ChatPanel chatPanel) { chatPanel.ContentLayoutGroup.SetSpacing(PluginConfig.ChatPanelContentSingleRowSpacing.Value); } public static void SetContentFontAsset(this ChatPanel chatPanel, TMP_FontAsset fontAsset) { if (Object.op_Implicit((Object)(object)chatPanel?.Content) && Object.op_Implicit((Object)(object)fontAsset)) { TMP_Text[] componentsInChildren = chatPanel.Content.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].font = fontAsset; } } } public static void SetContentFontSize(this ChatPanel chatPanel, float fontSize) { if (Object.op_Implicit((Object)(object)chatPanel?.Content)) { TMP_Text[] componentsInChildren = chatPanel.Content.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].fontSize = fontSize; } } } public static void SetupContentRowToggles(this ChatPanel chatPanel, ChatMessageType togglesToEnable) { ToggleRow messageTypeToggleRow = chatPanel.MessageTypeToggleRow; ((UnityEvent)(object)messageTypeToggleRow.SayToggle.Toggle.onValueChanged).AddListener((UnityAction)delegate(bool isOn) { ContentRowManager.ToggleContentRows(isOn, ChatMessageType.Say); }); ((UnityEvent)(object)messageTypeToggleRow.ShoutToggle.Toggle.onValueChanged).AddListener((UnityAction)delegate(bool isOn) { ContentRowManager.ToggleContentRows(isOn, ChatMessageType.Shout); }); ((UnityEvent)(object)messageTypeToggleRow.PingToggle.Toggle.onValueChanged).AddListener((UnityAction)delegate(bool isOn) { ContentRowManager.ToggleContentRows(isOn, ChatMessageType.Ping); }); ((UnityEvent)(object)messageTypeToggleRow.WhisperToggle.Toggle.onValueChanged).AddListener((UnityAction)delegate(bool isOn) { ContentRowManager.ToggleContentRows(isOn, ChatMessageType.Whisper); }); ((UnityEvent)(object)messageTypeToggleRow.MessageHudToggle.Toggle.onValueChanged).AddListener((UnityAction)delegate(bool isOn) { ContentRowManager.ToggleContentRows(isOn, ChatMessageType.HudCenter); }); ((UnityEvent)(object)messageTypeToggleRow.EmoteToggle.Toggle.onValueChanged).AddListener((UnityAction)delegate(bool isOn) { ContentRowManager.ToggleContentRows(isOn, ChatMessageType.Emote); }); ((UnityEvent)(object)messageTypeToggleRow.GameToggle.Toggle.onValueChanged).AddListener((UnityAction)delegate(bool isOn) { ContentRowManager.ToggleContentRows(isOn, ChatMessageType.Game); }); ((UnityEvent)(object)messageTypeToggleRow.TextToggle.Toggle.onValueChanged).AddListener((UnityAction)delegate(bool isOn) { ContentRowManager.ToggleContentRows(isOn, ChatMessageType.Text); }); messageTypeToggleRow.SayToggle.SetToggleIsOn(togglesToEnable.HasFlag(ChatMessageType.Say)); messageTypeToggleRow.ShoutToggle.SetToggleIsOn(togglesToEnable.HasFlag(ChatMessageType.Shout)); messageTypeToggleRow.PingToggle.SetToggleIsOn(togglesToEnable.HasFlag(ChatMessageType.Ping)); messageTypeToggleRow.WhisperToggle.SetToggleIsOn(togglesToEnable.HasFlag(ChatMessageType.Whisper)); messageTypeToggleRow.MessageHudToggle.SetToggleIsOn(togglesToEnable.HasFlag(ChatMessageType.HudCenter)); messageTypeToggleRow.GameToggle.SetToggleIsOn(togglesToEnable.HasFlag(ChatMessageType.Game)); messageTypeToggleRow.EmoteToggle.SetToggleIsOn(togglesToEnable.HasFlag(ChatMessageType.Emote)); messageTypeToggleRow.TextToggle.SetToggleIsOn(togglesToEnable.HasFlag(ChatMessageType.Text)); } public static bool IsMessageTypeToggleActive(this ChatPanel chatPanel, ChatMessageType messageType) { ToggleRow messageTypeToggleRow = chatPanel.MessageTypeToggleRow; return messageType switch { ChatMessageType.Text => messageTypeToggleRow.TextToggle.GetToggleIsOn(), ChatMessageType.HudCenter => messageTypeToggleRow.MessageHudToggle.GetToggleIsOn(), ChatMessageType.Say => messageTypeToggleRow.SayToggle.GetToggleIsOn(), ChatMessageType.Shout => messageTypeToggleRow.ShoutToggle.GetToggleIsOn(), ChatMessageType.Whisper => messageTypeToggleRow.WhisperToggle.GetToggleIsOn(), ChatMessageType.Ping => messageTypeToggleRow.PingToggle.GetToggleIsOn(), ChatMessageType.Game => messageTypeToggleRow.GameToggle.GetToggleIsOn(), ChatMessageType.Gesture => messageTypeToggleRow.EmoteToggle.GetToggleIsOn(), ChatMessageType.Emote => messageTypeToggleRow.EmoteToggle.GetToggleIsOn(), _ => true, }; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class ChatTextInputUtils { public static string ChatTextInputPrefix { get; private set; } = "say "; public static void SetChatTextInputPrefix(this ChatPanel chatPanel, Type talkerType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0042: Unknown result type (might be due to invalid IL or missing references) //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) string chatTextInputPrefix = (((int)talkerType == 0) ? "w " : (((int)talkerType != 2) ? "say " : "s ")); ChatTextInputPrefix = chatTextInputPrefix; chatTextInputPrefix = (((int)talkerType == 0) ? "/whisper" : (((int)talkerType != 2) ? "/say " : "/shout")); string text = chatTextInputPrefix; Color val = (((int)talkerType == 0) ? PluginConfig.ChatMessageTextWhisperColor.Value : (((int)talkerType != 2) ? PluginConfig.ChatMessageTextSayColor.Value : PluginConfig.ChatMessageTextShoutColor.Value)); Color color = val; ((Graphic)((TMP_InputField)chatPanel.TextInput.InputField).textComponent).color = color; ((TMP_Text)chatPanel.TextInput.InputFieldPlaceholder).text = text; ((Graphic)chatPanel.TextInput.InputFieldPlaceholder).color = color.SetAlpha(0.3f); } } public static class WorldTextUtils { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static GameObject CreateWorldTextTemplate(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown GameObject val = new GameObject("WorldText", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.GetComponent().SetAnchorMin(new Vector2(0.5f, 0f)).SetAnchorMax(new Vector2(0.5f, 0f)) .SetPivot(new Vector2(0.5f, 0f)) .SetPosition(Vector2.zero) .SetSizeDelta(new Vector2(400f, 100f)); TextMeshProUGUI obj = UIBuilder.CreateLabel(val.transform); ((Object)obj).name = "Text"; ((TMP_Text)obj).rectTransform.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one).SetPivot(new Vector2(0.5f, 0.5f)) .SetPosition(Vector2.zero) .SetSizeDelta(Vector2.zero); ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).fontSize = 18f; return val; } } public static class CodeMatcherExtensions { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static CodeMatcher CopyOperand<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(2)] T>(this CodeMatcher matcher, out T target) { target = (T)matcher.Operand; return matcher; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class ConfigFileExtensions { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal sealed class ConfigurationManagerAttributes { [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(1)] public Action CustomDrawer; public bool? Browsable; public bool? HideDefaultButton; public bool? HideSettingName; public bool? IsAdvanced; public int? Order; public bool? ReadOnly; } private static readonly Dictionary _sectionToSettingOrder = new Dictionary(); private static int GetSettingOrder(string section) { if (!_sectionToSettingOrder.TryGetValue(section, out var value)) { value = 0; } _sectionToSettingOrder[section] = value - 1; return value; } public static ConfigEntry BindInOrder<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(2)] T>(this ConfigFile config, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false, bool isAdvanced = false, bool readOnly = false) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown return config.Bind(section, key, defaultValue, new ConfigDescription(description, acceptableValues, new object[1] { new ConfigurationManagerAttributes { Browsable = browsable, CustomDrawer = null, HideDefaultButton = hideDefaultButton, HideSettingName = hideSettingName, IsAdvanced = isAdvanced, Order = GetSettingOrder(section), ReadOnly = readOnly } })); } public static ConfigEntry BindInOrder<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(2)] T>(this ConfigFile config, string section, string key, T defaultValue, string description, Action customDrawer = null, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false, bool isAdvanced = false, bool readOnly = false) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown return config.Bind(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Browsable = browsable, CustomDrawer = customDrawer, HideDefaultButton = hideDefaultButton, HideSettingName = hideSettingName, IsAdvanced = isAdvanced, Order = GetSettingOrder(section), ReadOnly = readOnly } })); } public static void OnSettingChanged<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(2)] T>(this ConfigEntry configEntry, Action settingChangedHandler) { configEntry.SettingChanged += [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (object _, EventArgs _) => { settingChangedHandler(); }; } public static void OnSettingChanged<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(2)] T>(this ConfigEntry configEntry, Action settingChangedHandler) { configEntry.SettingChanged += [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (object _, EventArgs eventArgs) => { //IL_0007: Unknown result type (might be due to invalid IL or missing references) settingChangedHandler((T)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue); }; } public static void OnSettingChanged<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(2)] T>(this ConfigEntry configEntry, Action> settingChangedHandler) { configEntry.SettingChanged += [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (object _, EventArgs eventArgs) => { //IL_0007: Unknown result type (might be due to invalid IL or missing references) settingChangedHandler((ConfigEntry)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue); }; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class StringExtensions { public static readonly char[] CommaSeparator = new char[1] { ',' }; public static readonly char[] ColonSeparator = new char[1] { ':' }; public static bool TryParseValue<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(2)] T>(this string text, out T value) { //IL_0052: 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_00c8: Unknown result type (might be due to invalid IL or missing references) try { Vector2 value2; Vector3 value3; ZDOID value4; if (typeof(T) == typeof(string)) { value = (T)(object)text; } else if (typeof(T) == typeof(Vector2) && text.TryParseVector2(out value2)) { value = (T)(object)value2; } else if (typeof(T) == typeof(Vector3) && text.TryParseVector3(out value3)) { value = (T)(object)value3; } else if (typeof(T) == typeof(ZDOID) && text.TryParseZDOID(out value4)) { value = (T)(object)value4; } else if (typeof(T).IsEnum) { value = (T)Enum.Parse(typeof(T), text); } else { value = (T)Convert.ChangeType(text, typeof(T)); } return true; } catch (Exception arg) { Debug.LogError((object)$"Failed to convert value '{text}' to type {typeof(T)}: {arg}"); } value = default(T); return false; } public static bool TryParseVector2(this string text, out Vector2 value) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) string[] array = text.Split(CommaSeparator, 2, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 2 && float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2)) { value = new Vector2(result, result2); return true; } value = default(Vector2); return false; } public static bool TryParseVector3(this string text, out Vector3 value) { //IL_0067: 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_005f: Unknown result type (might be due to invalid IL or missing references) string[] array = text.Split(CommaSeparator, 3, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 3 && float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) && float.TryParse(array[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3)) { value = new Vector3(result, result2, result3); return true; } value = default(Vector3); return false; } public static bool TryParseZDOID(this string text, out ZDOID value) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //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) string[] array = text.Split(ColonSeparator, 2, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 2 && long.TryParse(array[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) && uint.TryParse(array[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2)) { value = new ZDOID(result, result2); return true; } value = default(ZDOID); return false; } } public static class BehaviourExtensions { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static T SetEnabled<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T behaviour, bool enabled) where T : Behaviour { ((Behaviour)behaviour).enabled = enabled; return behaviour; } } public static class GameObjectExtensions { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static GameObject SetParent(this GameObject gameObject, Transform transform, bool worldPositionStays = false) { gameObject.transform.SetParent(transform, worldPositionStays); return gameObject; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class ObjectExtensions { public static T FirstByNameOrThrow<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this IEnumerable unityObjects, string name) where T : Object { foreach (T unityObject in unityObjects) { if (((Object)unityObject).name == name) { return unityObject; } } throw new InvalidOperationException($"Could not find Unity object of type {typeof(T)} with name: {name}"); } public static T Ref<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T unityObject) where T : Object { if (!Object.op_Implicit((Object)(object)unityObject)) { return default(T); } return unityObject; } public static T SetName<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T unityObject, string name) where T : Object { ((Object)unityObject).name = name; return unityObject; } } public sealed class DummyIgnoreDrag : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IEndDragHandler, IDragHandler { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public void OnBeginDrag(PointerEventData eventData) { } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public void OnDrag(PointerEventData eventData) { } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public void OnEndDrag(PointerEventData eventData) { } } public static class UIBuilder { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static TextMeshProUGUI CreateLabel(Transform parentTransform) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = Object.Instantiate(UnifiedPopup.instance.bodyText, parentTransform, false); ((Object)obj).name = "Label"; ((TMP_Text)obj).fontSize = 16f; ((TMP_Text)obj).richText = true; ((Graphic)obj).color = Color.white; ((TMP_Text)obj).enableAutoSizing = false; ((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)obj).overflowMode = (TextOverflowModes)0; ((TMP_Text)obj).text = string.Empty; return obj; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class CanvasGroupExtensions { public static CanvasGroup SetAlpha(this CanvasGroup canvasGroup, float alpha) { canvasGroup.alpha = alpha; return canvasGroup; } public static CanvasGroup SetBlocksRaycasts(this CanvasGroup canvasGroup, bool blocksRaycasts) { canvasGroup.blocksRaycasts = blocksRaycasts; return canvasGroup; } } public static class ColorExtensions { public static Color SetAlpha(this Color color, float alpha) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) color.a = alpha; return color; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class ContentSizeFitterExtensions { public static ContentSizeFitter SetHorizontalFit(this ContentSizeFitter fitter, FitMode fitMode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) fitter.horizontalFit = fitMode; return fitter; } public static ContentSizeFitter SetVerticalFit(this ContentSizeFitter fitter, FitMode fitMode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) fitter.verticalFit = fitMode; return fitter; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class LayoutGroupExtensions { public static T SetChildAlignment<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T layoutGroup, TextAnchor alignment) where T : HorizontalOrVerticalLayoutGroup { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((LayoutGroup)(object)layoutGroup).childAlignment = alignment; return layoutGroup; } public static T SetChildControl<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T layoutGroup, bool? width = null, bool? height = null) where T : HorizontalOrVerticalLayoutGroup { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlWidth = width.Value; } if (height.HasValue) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlHeight = height.Value; } return layoutGroup; } public static T SetChildForceExpand<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T layoutGroup, bool? width = null, bool? height = null) where T : HorizontalOrVerticalLayoutGroup { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandWidth = width.Value; } if (height.HasValue) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandHeight = height.Value; } return layoutGroup; } public static T SetPadding<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T layoutGroup, int? left = null, int? right = null, int? top = null, int? bottom = null) where T : HorizontalOrVerticalLayoutGroup { if (!left.HasValue && !right.HasValue && !top.HasValue && !bottom.HasValue) { throw new ArgumentException("Value for left, right, top or bottom must be provided."); } if (left.HasValue) { ((LayoutGroup)(object)layoutGroup).padding.left = left.Value; } if (right.HasValue) { ((LayoutGroup)(object)layoutGroup).padding.right = right.Value; } if (top.HasValue) { ((LayoutGroup)(object)layoutGroup).padding.top = top.Value; } if (bottom.HasValue) { ((LayoutGroup)(object)layoutGroup).padding.bottom = bottom.Value; } return layoutGroup; } public static T SetSpacing<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T layoutGroup, float spacing) where T : HorizontalOrVerticalLayoutGroup { ((HorizontalOrVerticalLayoutGroup)layoutGroup).spacing = spacing; return layoutGroup; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class ImageExtensions { public static T SetColor<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, Color color) where T : Image { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Graphic)(object)image).color = color; return image; } public static T SetFillAmount<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, float amount) where T : Image { ((Image)image).fillAmount = amount; return image; } public static T SetFillCenter<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, bool fillCenter) where T : Image { ((Image)image).fillCenter = fillCenter; return image; } public static T SetFillMethod<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, FillMethod fillMethod) where T : Image { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Image)image).fillMethod = fillMethod; return image; } public static T SetFillOrigin<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, OriginHorizontal origin) where T : Image { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected I4, but got Unknown ((Image)image).fillOrigin = (int)origin; return image; } public static T SetFillOrigin<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, OriginVertical origin) where T : Image { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected I4, but got Unknown ((Image)image).fillOrigin = (int)origin; return image; } public static T SetMaskable<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, bool maskable) where T : Image { ((MaskableGraphic)(object)image).maskable = maskable; return image; } public static T SetMaterial<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, Material material) where T : Image { ((Graphic)(object)image).material = material; return image; } public static T SetPixelsPerUnitMultiplier<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, float pixelsPerUnitMultiplier) where T : Image { ((Image)image).pixelsPerUnitMultiplier = pixelsPerUnitMultiplier; return image; } public static T SetPreserveAspect<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, bool preserveAspect) where T : Image { ((Image)image).preserveAspect = preserveAspect; return image; } public static T SetRaycastTarget<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, bool raycastTarget) where T : Image { ((Graphic)(object)image).raycastTarget = raycastTarget; return image; } public static T SetSprite<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, Sprite sprite) where T : Image { ((Image)image).sprite = sprite; return image; } public static T SetType<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T image, Type type) where T : Image { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Image)image).type = type; return image; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class LayoutElementExtensions { public static T SetFlexible<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T layoutElement, float? width = null, float? height = null) where T : LayoutElement { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { ((LayoutElement)layoutElement).flexibleWidth = width.Value; } if (height.HasValue) { ((LayoutElement)layoutElement).flexibleHeight = height.Value; } return layoutElement; } public static T SetIgnoreLayout<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T layoutElement, bool ignoreLayout) where T : LayoutElement { ((LayoutElement)layoutElement).ignoreLayout = ignoreLayout; return layoutElement; } public static T SetMinimum<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T layoutElement, float? width = null, float? height = null) where T : LayoutElement { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { ((LayoutElement)layoutElement).minWidth = width.Value; } if (height.HasValue) { ((LayoutElement)layoutElement).minHeight = height.Value; } return layoutElement; } public static T SetPreferred<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T layoutElement, float? width = null, float? height = null) where T : LayoutElement { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { ((LayoutElement)layoutElement).preferredWidth = width.Value; } if (height.HasValue) { ((LayoutElement)layoutElement).preferredHeight = height.Value; } return layoutElement; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class RectTransformExtensions { public static RectTransform SetAnchorMin(this RectTransform rectTransform, Vector2 anchorMin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchorMin = anchorMin; return rectTransform; } public static RectTransform SetAnchorMax(this RectTransform rectTransform, Vector2 anchorMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchorMax = anchorMax; return rectTransform; } public static RectTransform SetPivot(this RectTransform rectTransform, Vector2 pivot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.pivot = pivot; return rectTransform; } public static RectTransform SetPosition(this RectTransform rectTransform, Vector2 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchoredPosition = position; return rectTransform; } public static RectTransform SetSizeDelta(this RectTransform rectTransform, Vector2 sizeDelta) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.sizeDelta = sizeDelta; return rectTransform; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class ScrollbarExtensions { public static T SetDirection<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollbar, Direction direction) where T : Scrollbar { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Scrollbar)scrollbar).direction = direction; return scrollbar; } public static T SetHandleRect<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollbar, RectTransform handleRect) where T : Scrollbar { ((Scrollbar)scrollbar).handleRect = handleRect; return scrollbar; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class SelectableExtensions { public static T SetColors<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T selectable, ColorBlock colors) where T : Selectable { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Selectable)selectable).colors = colors; return selectable; } public static T SetImage<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T selectable, Image image) where T : Selectable { ((Selectable)selectable).image = image; return selectable; } public static T SetInteractable<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T selectable, bool interactable) where T : Selectable { ((Selectable)selectable).interactable = interactable; return selectable; } public static T SetSpriteState<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T selectable, SpriteState spriteState) where T : Selectable { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Selectable)selectable).spriteState = spriteState; return selectable; } public static T SetTargetGraphic<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T selectable, Graphic graphic) where T : Selectable { ((Selectable)selectable).targetGraphic = graphic; return selectable; } public static T SetTransition<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T selectable, Transition transition) where T : Selectable { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Selectable)selectable).transition = transition; return selectable; } public static T SetNavigationMode<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T selectable, Mode mode) where T : Selectable { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Navigation navigation = ((Selectable)selectable).navigation; ((Navigation)(ref navigation)).mode = mode; ((Selectable)selectable).navigation = navigation; return selectable; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class SliderExtensions { public static T SetDirection<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T slider, Direction direction) where T : Slider { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Slider)slider).direction = direction; return slider; } public static T SetFillRect<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T slider, RectTransform fillRect) where T : Slider { ((Slider)slider).fillRect = fillRect; return slider; } public static T SetHandleRect<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T slider, RectTransform handleRect) where T : Slider { ((Slider)slider).handleRect = handleRect; return slider; } public static T SetMaxValue<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T slider, float maxValue) where T : Slider { ((Slider)slider).maxValue = maxValue; return slider; } public static T SetMinValue<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T slider, float minValue) where T : Slider { ((Slider)slider).minValue = minValue; return slider; } public static T SetWholeNumbers<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T slider, bool wholeNumbers) where T : Slider { ((Slider)slider).wholeNumbers = wholeNumbers; return slider; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class ScrollRectExtensions { public static T SetContent<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollRect, RectTransform content) where T : ScrollRect { ((ScrollRect)scrollRect).content = content; return scrollRect; } public static T SetHorizontal<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollRect, bool horizontal) where T : ScrollRect { ((ScrollRect)scrollRect).horizontal = horizontal; return scrollRect; } public static T SetMovementType<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollRect, MovementType movementType) where T : ScrollRect { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((ScrollRect)scrollRect).movementType = movementType; return scrollRect; } public static T SetScrollSensitivity<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollRect, float sensitivity) where T : ScrollRect { ((ScrollRect)scrollRect).scrollSensitivity = sensitivity; return scrollRect; } public static T SetVertical<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollRect, bool vertical) where T : ScrollRect { ((ScrollRect)scrollRect).vertical = vertical; return scrollRect; } public static T SetVerticalScrollbar<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollRect, Scrollbar verticalScrollbar) where T : ScrollRect { ((ScrollRect)scrollRect).verticalScrollbar = verticalScrollbar; return scrollRect; } public static T SetVerticalScrollPosition<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollRect, float position) where T : ScrollRect { ((ScrollRect)scrollRect).verticalNormalizedPosition = position; return scrollRect; } public static T SetVerticalScrollbarVisibility<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollRect, ScrollbarVisibility visibility) where T : ScrollRect { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((ScrollRect)scrollRect).verticalScrollbarVisibility = visibility; return scrollRect; } public static T SetViewport<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T scrollRect, RectTransform viewport) where T : ScrollRect { ((ScrollRect)scrollRect).viewport = viewport; return scrollRect; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class TextMeshProExtensions { public static T SetAlignment<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, TextAlignmentOptions alignment) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).alignment = alignment; return tmpText; } public static T SetColor<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, Color color) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Graphic)(object)tmpText).color = color; return tmpText; } public static T SetEnableAutoSizing<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, bool enableAutoSizing) where T : TMP_Text { ((TMP_Text)tmpText).enableAutoSizing = enableAutoSizing; return tmpText; } public static T SetFont<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, TMP_FontAsset font) where T : TMP_Text { ((TMP_Text)tmpText).font = font; return tmpText; } public static T SetFontSize<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, float fontSize) where T : TMP_Text { ((TMP_Text)tmpText).fontSize = fontSize; return tmpText; } public static T SetFontMaterial<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, Material fontMaterial) where T : TMP_Text { ((TMP_Text)tmpText).fontMaterial = fontMaterial; return tmpText; } public static T SetLineSpacing<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, float lineSpacing) where T : TMP_Text { ((TMP_Text)tmpText).lineSpacing = lineSpacing; return tmpText; } public static T SetMargin<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, Vector4 margin) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).margin = margin; return tmpText; } public static T SetOverflowMode<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, TextOverflowModes overflowMode) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).overflowMode = overflowMode; return tmpText; } public static T SetRichText<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, bool richText) where T : TMP_Text { ((TMP_Text)tmpText).richText = richText; return tmpText; } public static T SetTextWrappingMode<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T tmpText, TextWrappingModes textWrappingMode) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).textWrappingMode = textWrappingMode; return tmpText; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class Texture2DExtensions { public static Texture2D SetFilterMode(this Texture2D texture, FilterMode filterMode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((Texture)texture).filterMode = filterMode; return texture; } public static Texture2D SetWrapMode(this Texture2D texture, TextureWrapMode wrapMode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((Texture)texture).wrapMode = wrapMode; return texture; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class ToggleExtensions { public static T SetGraphic<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T toggle, Graphic graphic) where T : Toggle { ((Toggle)toggle).graphic = graphic; return toggle; } public static T SetIsOn<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T toggle, bool isOn) where T : Toggle { ((Toggle)toggle).isOn = isOn; return toggle; } public static T SetToggleTransition<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T>(this T toggle, ToggleTransition toggleTransition) where T : Toggle { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Toggle)toggle).toggleTransition = toggleTransition; return toggle; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class UIFonts { public static readonly Lazy> OsFontMap = new Lazy>(delegate { Dictionary dictionary = new Dictionary(); string[] pathsToOSFonts = Font.GetPathsToOSFonts(); foreach (string text in pathsToOSFonts) { dictionary[Path.GetFileNameWithoutExtension(text)] = text; } return dictionary; }); public static readonly string ValheimAveriaSansLibreFont = "Valheim-AveriaSansLibre"; public static readonly string ValheimNorseFont = "Valheim-Norse"; public static readonly string ValheimNorseboldFont = "Valheim-Norsebold"; public static readonly string FallbackNotoSansNormal = "Fallback-NotoSansNormal"; private static readonly Dictionary _fontAssetCache = new Dictionary(); public static TMP_FontAsset ValheimAveriaSansLibreFontAsset => ((TMP_Text)UnifiedPopup.instance.bodyText).font; public static TMP_FontAsset GetFontAssetByName(string fontAssetName) { if (!_fontAssetCache.TryGetValue(fontAssetName, out var value)) { value = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)([<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (TMP_FontAsset f) => ((Object)f).name == fontAssetName)); if (fontAssetName != ValheimNorseFont && fontAssetName != ValheimNorseboldFont) { ((TMP_Asset)value).material.SetFloat(ShaderUtilities.ID_OutlineWidth, 0.175f); ((TMP_Asset)value).material.SetFloat(ShaderUtilities.ID_FaceDilate, 0.175f); } _fontAssetCache[fontAssetName] = value; } return value; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class UIResources { public static readonly ResourceCache SpriteCache = new ResourceCache(); public static readonly ResourceCache MaterialCache = new ResourceCache(); public static Sprite GetSprite(string spriteName) { return SpriteCache.GetResource(spriteName); } public static Material GetMaterial(string materialName) { return MaterialCache.GetResource(materialName); } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public sealed class ResourceCache<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] T> where T : Object { private readonly Dictionary _cache = new Dictionary(); public T GetResource(string resourceName) { if (!_cache.TryGetValue(resourceName, out var value)) { value = Resources.FindObjectsOfTypeAll().FirstByNameOrThrow(resourceName); _cache[resourceName] = value; } return value; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static class UISpriteBuilder { public static readonly Color32 ColorWhite = Color32.op_Implicit(Color.white); public static readonly Color32 ColorClear = Color32.op_Implicit(Color.clear); private static readonly Dictionary _spriteCache = new Dictionary(); public static Sprite CreateRect(int width, int height, Color32 color) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_009a: Unknown result type (might be due to invalid IL or missing references) string text = $"Rectangle-{width}w-{height}h-{color}c"; if (_spriteCache.TryGetValue(text, out var value)) { return value; } Texture2D val = new Texture2D(width, height) { name = text, wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)0 }; Color32[] array = (Color32[])(object)new Color32[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = color; } val.SetPixels32(array); val.Apply(); value = Sprite.Create(val, new Rect(0f, 0f, (float)width, (float)height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0); ((Object)value).name = text; _spriteCache[text] = value; return value; } public static Sprite CreateRoundedCornerSprite(int width, int height, int radius, FilterMode filterMode = 1) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) string text = $"RoundedCorner-{width}w-{height}h-{radius}r"; if (_spriteCache.TryGetValue(text, out var value)) { return value; } Texture2D val = ObjectExtensions.SetName(new Texture2D(width, height), text).SetWrapMode((TextureWrapMode)1).SetFilterMode(filterMode); Color32[] array = (Color32[])(object)new Color32[width * height]; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { array[i * width + j] = (IsCornerPixel(j, i, width, height, radius) ? ColorClear : ColorWhite); } } val.SetPixels32(array); val.Apply(); int k; for (k = 0; k < width && !(Color32.op_Implicit(array[k]) == Color.white); k++) { } int l; for (l = 0; l < height && !(Color32.op_Implicit(array[l * width]) == Color.white); l++) { } value = Sprite.Create(val, new Rect(0f, 0f, (float)width, (float)height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)k, (float)l, (float)k, (float)l)).SetName(text); _spriteCache[text] = value; return value; } public static Sprite CreateSuperellipse(int width, int height, float exponent) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0195: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: 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_01cb: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) string text = $"Superellipse-{width}w-{height}h-{exponent}e"; if (_spriteCache.TryGetValue(text, out var value)) { return value; } Texture2D val = new Texture2D(width, height) { name = text, wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)0 }; Color32[] array = (Color32[])(object)new Color32[width * height]; int num = width / 2; int num2 = height / 2; float num3 = 1f * ((float)width / 2f); float num4 = 1f * ((float)height / 2f); for (int i = 0; i < num; i++) { for (int j = 0; j < num2; j++) { Color32 val2 = ((Mathf.Pow(Mathf.Abs((float)i / num3), exponent) + Mathf.Pow(Mathf.Abs((float)j / num4), exponent) > 1f) ? ColorClear : ColorWhite); int x2 = i + num; int x3 = -i + num - 1; int y2 = -j + num2 - 1; int y3 = j + num2; array[XYToIndex(x2, y3)] = val2; array[XYToIndex(x2, y2)] = val2; array[XYToIndex(x3, y2)] = val2; array[XYToIndex(x3, y3)] = val2; } } val.SetPixels32(array); val.Apply(); int k; for (k = 0; k < width && !(Color32.op_Implicit(array[k]) == Color.white); k++) { } int l; for (l = 0; l < height && !(Color32.op_Implicit(array[l * width]) == Color.white); l++) { } value = Sprite.Create(val, new Rect(0f, 0f, (float)width, (float)height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)k, (float)l, (float)k, (float)l)); ((Object)value).name = text; _spriteCache[text] = value; return value; int XYToIndex(int x, int y) { return x + y * width; } } private static bool IsCornerPixel(int x, int y, int w, int h, int rad) { if (rad == 0) { return false; } int num = Math.Min(x, w - x); int num2 = Math.Min(y, h - y); if (num == 0 && num2 == 0) { return true; } if (num > rad || num2 > rad) { return false; } num = rad - num; num2 = rad - num2; return Math.Round(Math.Sqrt(num * num + num2 * num2)) > (double)rad; } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(new byte[] { 0, 1 })] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public sealed class CircularQueue<[<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(2)] T> : ConcurrentQueue { private readonly int _capacity; private readonly Action _dequeueFunc; private T _lastItem; public T LastItem => _lastItem; public CircularQueue(int capacity, Action dequeueFunc) { _capacity = capacity; _dequeueFunc = dequeueFunc; } public void EnqueueItem(T item) { while (base.Count + 1 > _capacity) { if (TryDequeue(out var result)) { _dequeueFunc(result); } } Enqueue(item); _lastItem = item; } public void ClearItems() { T result; while (TryDequeue(out result)) { _dequeueFunc(result); } _lastItem = default(T); } } public class AliasPatch { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static string GetDisplayName(string playerName) { Player val = null; foreach (Player s_player in Player.s_players) { if (s_player.GetPlayerName().Equals(playerName)) { val = s_player; break; } } if ((Object)(object)val == (Object)null || (Object)(object)((Character)val).m_nview == (Object)null) { return playerName; } ZDO zDO = ((Character)val).m_nview.GetZDO(); if (zDO == null) { return playerName; } bool @bool = zDO.GetBool("isAnonymous", false); string @string = zDO.GetString("secretName", playerName); if (!@bool) { return playerName; } return @string; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [HarmonyPatch(typeof(Terminal))] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] internal static class AliasCommandsPatch { [Serializable] [CompilerGenerated] private sealed class <>c { [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static readonly <>c <>9 = new <>c(); [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEventFailable <>9__1_0; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEventFailable <>9__2_0; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEventFailable <>9__3_0; [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal object b__1_0(ConsoleEventArgs args) { ZDO localZdo = GetLocalZdo(); if (localZdo == null) { LocalMsg("No local player."); return true; } bool flag = !localZdo.GetBool("isAnonymous", false); string text = localZdo.GetString("secretName", "???"); if (string.IsNullOrWhiteSpace(text)) { text = "???"; } localZdo.Set("isAnonymous", flag); localZdo.Set("secretName", text); LocalMsg(flag ? ("[RP] Hide enabled (alias: " + text + ")") : "[RP] Hide disabled (using real name)"); return true; } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal object b__2_0(ConsoleEventArgs args) { ZDO localZdo = GetLocalZdo(); if (localZdo == null) { LocalMsg("No local player."); return true; } if (args.Length < 2) { LocalMsg("Usage: /setalias "); return true; } string text = string.Join(" ", args.Args, 1, args.Length - 1).Trim(); if (!IsValidName(text)) { LocalMsg("Invalid alias. Letters and spaces only."); return true; } localZdo.Set("secretName", text); localZdo.Set("isAnonymous", true); LocalMsg("[RP] Alias set to '" + text + "'. Hide enabled."); return true; } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal object b__3_0(ConsoleEventArgs args) { ZDO localZdo = GetLocalZdo(); if (localZdo == null) { LocalMsg("No local player."); return true; } localZdo.Set("secretName", "???"); localZdo.Set("isAnonymous", false); LocalMsg("[RP] Alias cleared. Hide disabled."); return true; } } [HarmonyPostfix] [HarmonyPatch("InitTerminal")] private static void RegisterAliasCommands() { RegisterHide(); RegisterSetAlias(); RegisterClearAlias(); } private static void RegisterHide() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Terminal.commands.ContainsKey("hide")) { return; } object obj = <>c.<>9__1_0; if (obj == null) { ConsoleEventFailable val = [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (ConsoleEventArgs args) => { ZDO localZdo = GetLocalZdo(); if (localZdo == null) { LocalMsg("No local player."); return true; } bool flag = !localZdo.GetBool("isAnonymous", false); string text = localZdo.GetString("secretName", "???"); if (string.IsNullOrWhiteSpace(text)) { text = "???"; } localZdo.Set("isAnonymous", flag); localZdo.Set("secretName", text); LocalMsg(flag ? ("[RP] Hide enabled (alias: " + text + ")") : "[RP] Hide disabled (using real name)"); return true; }; <>c.<>9__1_0 = val; obj = (object)val; } new ConsoleCommand("hide", "Toggle hiding your identity (alias).", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void RegisterSetAlias() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Terminal.commands.ContainsKey("setalias")) { return; } object obj = <>c.<>9__2_0; if (obj == null) { ConsoleEventFailable val = [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (ConsoleEventArgs args) => { ZDO localZdo = GetLocalZdo(); if (localZdo == null) { LocalMsg("No local player."); return true; } if (args.Length < 2) { LocalMsg("Usage: /setalias "); return true; } string text = string.Join(" ", args.Args, 1, args.Length - 1).Trim(); if (!IsValidName(text)) { LocalMsg("Invalid alias. Letters and spaces only."); return true; } localZdo.Set("secretName", text); localZdo.Set("isAnonymous", true); LocalMsg("[RP] Alias set to '" + text + "'. Hide enabled."); return true; }; <>c.<>9__2_0 = val; obj = (object)val; } new ConsoleCommand("setalias", "Set your RP alias. Usage: /setalias ", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void RegisterClearAlias() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Terminal.commands.ContainsKey("clearalias")) { return; } object obj = <>c.<>9__3_0; if (obj == null) { ConsoleEventFailable val = [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (ConsoleEventArgs args) => { ZDO localZdo = GetLocalZdo(); if (localZdo == null) { LocalMsg("No local player."); return true; } localZdo.Set("secretName", "???"); localZdo.Set("isAnonymous", false); LocalMsg("[RP] Alias cleared. Hide disabled."); return true; }; <>c.<>9__3_0 = val; obj = (object)val; } new ConsoleCommand("clearalias", "Clear your RP alias and show your real name.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static ZDO GetLocalZdo() { Player localPlayer = Player.m_localPlayer; if (localPlayer == null) { return null; } ZNetView nview = ((Character)localPlayer).m_nview; if (nview == null) { return null; } return nview.GetZDO(); } private static void LocalMsg(string msg) { Chat instance = Chat.m_instance; if (instance != null) { ((Terminal)instance).AddString(msg); } } private static bool IsValidName(string input) { if (!string.IsNullOrWhiteSpace(input)) { return Regex.IsMatch(input, "^[\\p{L}\\s]+$"); } return false; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] internal sealed class Deck { private readonly object _lock = new object(); private readonly Stack _drawPile = new Stack(52); public int Count { get { lock (_lock) { return _drawPile.Count; } } } public void Shuffle() { List list = new List(52); foreach (CardSuit value3 in Enum.GetValues(typeof(CardSuit))) { for (int i = 2; i <= 14; i++) { list.Add(new PlayingCard(value3, i)); } } for (int num = list.Count - 1; num > 0; num--) { int num2 = GamesPatch.RandomRoll(0, num); List list2 = list; int index = num; List list3 = list; int index2 = num2; PlayingCard value = list[num2]; PlayingCard value2 = list[num]; list2[index] = value; list3[index2] = value2; } lock (_lock) { _drawPile.Clear(); foreach (PlayingCard item in list) { _drawPile.Push(item); } } } public bool TryDraw(out PlayingCard card) { lock (_lock) { if (_drawPile.Count == 0) { card = default(PlayingCard); return false; } card = _drawPile.Pop(); return true; } } public int TryDrawMany(int count, List drawn) { if (count <= 0) { return 0; } if (drawn == null) { drawn = new List(count); } lock (_lock) { int num = Math.Min(count, _drawPile.Count); for (int i = 0; i < num; i++) { drawn.Add(_drawPile.Pop()); } return num; } } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] internal static class LocalDeck { private static Deck _deck; public static bool HasDeck => _deck != null; public static int Remaining { get { if (!HasDeck) { return 0; } return _deck.Count; } } public static void Reset() { _deck = new Deck(); _deck.Shuffle(); } public static bool TryDraw(out PlayingCard card) { card = default(PlayingCard); if (!HasDeck) { return false; } return _deck.TryDraw(out card); } public static int TryDrawMany(int count, List drawn) { if (!HasDeck) { return 0; } return _deck.TryDrawMany(count, drawn); } } [HarmonyPatch(typeof(Terminal))] public static class CardsLocalPatch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEventFailable <>9__0_0; public static ConsoleEventFailable <>9__0_1; internal object b__0_0(ConsoleEventArgs args) { LocalDeck.Reset(); Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, $"{'\u200c'} shuffled a new deck."); } return true; } internal object b__0_1(ConsoleEventArgs args) { if (!LocalDeck.HasDeck) { Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, $"{'\u200c'} No deck yet. Use /shuffle."); } return true; } int result = 1; if (args.Length >= 2 && !int.TryParse(args[1], out result)) { result = 1; } result = Mathf.Clamp(result, 1, 10); List list = new List(result); int num = LocalDeck.TryDrawMany(result, list); if (num <= 0) { Chat instance2 = Chat.m_instance; if (instance2 != null) { instance2.SendText((Type)1, $"{'\u200c'} No cards remain. Use /shuffle."); } return true; } string text = string.Join(", ", list); Chat instance3 = Chat.m_instance; if (instance3 != null) { instance3.SendText((Type)1, string.Format("{0} draws {1} card{2}: {3}", '\u200c', num, (num == 1) ? "" : "s", text)); } return true; } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] [HarmonyPostfix] private static void RegisterLocalCardCommands() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown if (!Terminal.commands.ContainsKey("shuffle")) { object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEventFailable val = delegate { LocalDeck.Reset(); Chat instance4 = Chat.m_instance; if (instance4 != null) { instance4.SendText((Type)1, $"{'\u200c'} shuffled a new deck."); } return true; }; <>c.<>9__0_0 = val; obj = (object)val; } new ConsoleCommand("shuffle", "Creates a fresh shuffled 52-card deck (your personal dealer deck).", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } if (Terminal.commands.ContainsKey("draw")) { return; } object obj2 = <>c.<>9__0_1; if (obj2 == null) { ConsoleEventFailable val2 = delegate(ConsoleEventArgs args) { if (!LocalDeck.HasDeck) { Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, $"{'\u200c'} No deck yet. Use /shuffle."); } return true; } int result = 1; if (args.Length >= 2 && !int.TryParse(args[1], out result)) { result = 1; } result = Mathf.Clamp(result, 1, 10); List list = new List(result); int num = LocalDeck.TryDrawMany(result, list); if (num <= 0) { Chat instance2 = Chat.m_instance; if (instance2 != null) { instance2.SendText((Type)1, $"{'\u200c'} No cards remain. Use /shuffle."); } return true; } string text = string.Join(", ", list); Chat instance3 = Chat.m_instance; if (instance3 != null) { instance3.SendText((Type)1, string.Format("{0} draws {1} card{2}: {3}", '\u200c', num, (num == 1) ? "" : "s", text)); } return true; }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } new ConsoleCommand("draw", "Draws cards from your deck. Usage: /draw [count] (default 1, max 10).", (ConsoleEventFailable)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [HarmonyPatch(typeof(Chat))] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] internal static class ChatPatch { [HarmonyPatch(typeof(Talker), "Awake")] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] private static class TalkerRangePatch { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] private static void Postfix(Talker __instance) { __instance.m_normalDistance = PluginConfig.SayDistance.Value; __instance.m_visperDistance = PluginConfig.WhisperDistance.Value; __instance.m_shoutDistance = PluginConfig.ShoutDistance.Value; } } [HarmonyPostfix] [HarmonyPatch("Awake")] private static void AwakePostfix(Chat __instance) { ((MonoBehaviour)__instance).StartCoroutine(DelayedAwakePostfix()); } private static IEnumerator DelayedAwakePostfix() { while (!Object.op_Implicit((Object)(object)Hud.m_instance)) { yield return null; } Chat instance = Chat.m_instance; ContentRowManager.MessageRows.ClearItems(); ChatPanelController.VanillaInputField = ((Terminal)instance).m_input; ChatPanelController.ToggleChatter(instance, PluginConfig.IsModEnabled.Value); SetupWorldText(instance); } private static void SetupWorldText(Chat chat) { chat.m_worldTextBase = WorldTextUtils.CreateWorldTextTemplate(chat.m_worldTextBase.transform.parent); chat.m_worldTextBase.SetActive(false); } [HarmonyTranspiler] [HarmonyPatch("InputText")] private static IEnumerable InputTextTranspiler(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"say ", (string)null) }).ThrowIfInvalid("Could not patch Chat.InputText()! (prefix-say)") .Advance(1) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ChatPatch), "PrefixSayDelegate", (Type[])null, (Type[])null)) }) .InstructionEnumeration(); } private static string PrefixSayDelegate(string value) { if (!PluginConfig.IsModEnabled.Value) { return value; } return ChatTextInputUtils.ChatTextInputPrefix; } [HarmonyPrefix] [HarmonyPatch("OnNewChatMessage")] private static void OnNewChatMessagePrefix(Chat __instance, long senderID, Vector3 pos, Type type, UserInfo sender, string text, ref float __state) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (PluginConfig.IsModEnabled.Value) { char c = '\0'; if (!string.IsNullOrEmpty(text) && RpMarkers.IsMarkerChar(text[0])) { c = text[0]; text = text.Substring(1); } string displayName = AliasPatch.GetDisplayName(sender?.Name ?? string.Empty); ChatMessageType chatMessageType = ChatMessageUtils.GetChatMessageType(type); ChatMessageType messageType = c switch { '\u200c' => ChatMessageType.Game, '\u200b' => ChatMessageType.Emote, '\u200d' => ChatMessageType.Gesture, _ => chatMessageType, }; ChatMessage message = new ChatMessage { MessageType = messageType, Timestamp = DateTime.Now, SenderId = senderID, Position = pos, TalkerType = type, Username = displayName, Text = text }; ChatMessageUtils.IsChatMessageQueued = true; ChatMessageUtils.IsChatMessageFiltered = !ChatMessageUtils.AddChatMessage(message); __state = __instance.m_hideTimer; } } [HarmonyPostfix] [HarmonyPatch("OnNewChatMessage")] private static void OnNewChatMessagePostfix(Chat __instance, float __state) { if (PluginConfig.IsModEnabled.Value) { ChatMessageUtils.IsChatMessageQueued = false; if (ChatMessageUtils.IsChatMessageFiltered) { __instance.m_hideTimer = __state; } } } [HarmonyTranspiler] [HarmonyPatch("Update")] private static IEnumerable UpdateTranspiler1(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[6] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(Chat), "m_hideTimer"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(Chat), "m_hideDelay"), (string)null), new CodeMatch((OpCode?)OpCodes.Clt, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(GameObject), "SetActive", (Type[])null, (Type[])null), (string)null) }).ThrowIfInvalid("Could not patch Chat.Update()! (hide-chat-panel)") .Advance(6) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(Chat), "m_hideTimer")), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ChatPatch), "HideChatPanelDelegate", (Type[])null, (Type[])null)) }) .InstructionEnumeration(); } [HarmonyTranspiler] [HarmonyPatch("Update")] private static IEnumerable UpdateTranspiler2(IEnumerable instructions) { //IL_0002: 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_0027: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[9] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(Terminal), "m_input"), (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(Component), "get_gameObject", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(GameObject), "SetActive", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Chat), "TryShowTextCommunicationRestrictedSystemPopup", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(Chat), "m_doubleOpenForVirtualKeyboard"), (string)null) }).ThrowIfInvalid("Could not patch Chat.Update()! (enable-chat-panel)") .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ChatPatch), "EnableChatPanelDelegate", (Type[])null, (Type[])null)) }) .InstructionEnumeration(); } [HarmonyPatch("Update")] [HarmonyTranspiler] private static IEnumerable UpdateTranspiler3(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[8] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(Terminal), "m_input"), (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(Component), "get_gameObject", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(GameObject), "SetActive", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(Terminal), "m_focused"), (string)null) }).ThrowIfInvalid("Could not patch Chat.Update()! (disable-chat-panel)") .Advance(4) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ChatPatch), "DisableChatPanelDelegate", (Type[])null, (Type[])null)) }) .InstructionEnumeration(); } private static void HideChatPanelDelegate(float hideTimer) { if (PluginConfig.IsModEnabled.Value && ChatPanelController.TryGetChatPanel(out var chatPanel)) { bool isVisible = (hideTimer < (float)PluginConfig.HideChatPanelDelay.Value || Menu.IsVisible()) && !Hud.IsUserHidden(); chatPanel.ShowOrHideChatPanel(isVisible); } } private static void EnableChatPanelDelegate() { if (PluginConfig.IsModEnabled.Value && ChatPanelController.TryGetChatPanel(out var chatPanel)) { chatPanel.EnableOrDisableChatPanel(isEnabled: true); } } private static bool DisableChatPanelDelegate(bool active) { if (PluginConfig.IsModEnabled.Value) { if (!Menu.IsVisible() && ChatPanelController.TryGetChatPanel(out var chatPanel)) { chatPanel.EnableOrDisableChatPanel(isEnabled: false); } return true; } return active; } [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePostfix(Chat __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (PluginConfig.IsModEnabled.Value && ChatPanelController.TryGetChatPanel(out var chatPanel)) { KeyboardShortcut value = PluginConfig.ScrollContentUpShortcut.Value; if (((KeyboardShortcut)(ref value)).IsDown() && chatPanel.Panel.activeInHierarchy) { chatPanel.OffsetContentVerticalScrollPosition(PluginConfig.ScrollContentOffsetInterval.Value); __instance.m_hideTimer = 0f; } value = PluginConfig.ScrollContentDownShortcut.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { chatPanel.OffsetContentVerticalScrollPosition(0f - PluginConfig.ScrollContentOffsetInterval.Value); __instance.m_hideTimer = 0f; } } } [HarmonyPatch("SendInput")] [HarmonyTranspiler] private static IEnumerable SendInputTranspiler(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(GameObject), "SetActive", (Type[])null, (Type[])null), (string)null) }).ThrowIfInvalid("Could not patch Chat.SendInput()! (set-active)") .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ChatPatch), "DisableChatPanelDelegate", (Type[])null, (Type[])null)) }) .InstructionEnumeration(); } [HarmonyPostfix] [HarmonyPatch("SendInput")] private static void SendInputPostfix() { if (PluginConfig.IsModEnabled.Value && ChatPanelController.TryGetChatPanel(out var chatPanel)) { chatPanel.SetContentVerticalScrollPosition(0f); } } [HarmonyPostfix] [HarmonyPatch("HasFocus")] private static void HasFocusPostfix(Chat __instance, ref bool __result) { if (PluginConfig.IsModEnabled.Value && ChatPanelController.TryGetChatPanel(out var chatPanel)) { __result = chatPanel.Panel.activeInHierarchy && ((TMP_InputField)((Terminal)__instance).m_input).isFocused; } } [HarmonyPrefix] [HarmonyPatch(typeof(Chat), "AddInworldText")] private static bool AddInworldTextPrefix(string text) { if (!PluginConfig.IsModEnabled.Value) { return true; } if (!string.IsNullOrEmpty(text) && RpMarkers.NoBubbleChar(text[0])) { return false; } return true; } [HarmonyPatch(typeof(Chat), "AddInworldText")] [HarmonyTranspiler] private static IEnumerable AddInworldTextTranspiler(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(string), "ToUpper", (Type[])null, (Type[])null), (string)null) }).ThrowIfInvalid("Could not patch Chat.AddInworldText()! (to-upper)") .SetInstructionAndAdvance(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ChatPatch), "ToUpperDelegate", (Type[])null, (Type[])null))) .InstructionEnumeration(); } private static string ToUpperDelegate(string text) { if (!PluginConfig.IsModEnabled.Value) { return text.ToUpper(); } return text; } } [HarmonyPatch(typeof(Terminal))] public static class EmotePatch { [HarmonyPostfix] [HarmonyPatch("InitTerminal")] private static void RegisterEmoteCommands() { RegisterEmote("me", (Type)1, "/me — emote in normal chat"); RegisterEmote("ges", (Type)0, "/ges — subtle emote (whisper)"); } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] private static void RegisterEmote(string cmd, Type channel, string help) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (Terminal.commands.ContainsKey(cmd)) { return; } new ConsoleCommand(cmd, help, (ConsoleEventFailable)delegate(ConsoleEventArgs args) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) string text = ((args.Length > 1) ? string.Join(" ", args.Args, 1, args.Length - 1).Trim() : string.Empty); if (string.IsNullOrEmpty(text)) { if (ChatPanelController.TryGetChatPanel(out var chatPanel)) { chatPanel.SetChatTextInputPrefix(channel); } return true; } Chat instance = Chat.m_instance; if (instance != null) { instance.SendText(channel, "\u200b" + text); } return true; }, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } internal sealed class FarkleGame { public int TotalScore; public int TurnScore; public int DiceRemaining = 6; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(1)] public List CurrentDice = new List(); public void ResetTurn() { TurnScore = 0; DiceRemaining = 6; CurrentDice.Clear(); } public void Start() { TotalScore = 0; ResetTurn(); } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] internal static class LocalFarkle { private static FarkleGame _game; public static bool HasGame => _game != null; public static FarkleGame Game { get { if (_game == null) { Start(); } return _game; } } public static void Start() { _game = new FarkleGame(); _game.Start(); } public static void End() { _game = null; } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] internal static class FarkleUtils { public static string DiceIcon(int v) { return v switch { 1 => "[1]", 2 => "[2]", 3 => "[3]", 4 => "[4]", 5 => "[5]", 6 => "[6]", _ => "?", }; } public static List RollDice(int count) { List list = new List(count); for (int i = 0; i < count; i++) { list.Add(GamesPatch.RandomRoll(1, 6)); } return list; } [return: <30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(new byte[] { 0, 1 })] public static (int score, List invalidDice) ScoreDice(List dice) { if (dice == null || dice.Count == 0) { return (0, dice); } Dictionary dictionary = (from x in dice group x by x).ToDictionary([<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (IGrouping g) => g.Key, [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (IGrouping g) => g.Count()); List list = new List(); int num = 0; if (dice.Count == 6 && dictionary.Count == 6) { return (1500, list); } if (dice.Count == 6 && dictionary.Values.Count((int v) => v == 2) == 3) { return (1500, list); } if (dice.Count == 6 && dictionary.Values.Count((int v) => v == 3) == 2) { return (2500, list); } foreach (KeyValuePair item in dictionary) { switch (item.Value) { case 6: num += 3000; break; case 5: num += 2000; break; case 4: num += 1000; break; case 3: num += ((item.Key == 1) ? 1000 : (item.Key * 100)); break; case 1: case 2: if (item.Key == 1) { num += item.Value * 100; break; } if (item.Key == 5) { num += item.Value * 50; break; } if (item.Value == 2) { list.Add(item.Key); } list.Add(item.Key); break; } } if (list.Count > 0) { string text = string.Join(", ", list) + " do not score unless 3 or more."; Chat instance = Chat.m_instance; if (instance != null) { ((Terminal)instance).AddString(text); } } return (num, list); } } [HarmonyPatch(typeof(Terminal))] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class FarklePatch { [Serializable] [CompilerGenerated] private sealed class <>c { [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static readonly <>c <>9 = new <>c(); [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEventFailable <>9__3_0; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEventFailable <>9__4_0; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static Func> <>9__5_1; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static Func <>9__5_2; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEventFailable <>9__5_0; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEventFailable <>9__6_0; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEventFailable <>9__7_0; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEventFailable <>9__8_0; [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] public static ConsoleEventFailable <>9__9_0; [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal object b__3_0(ConsoleEventArgs args) { LocalFarkle.Start(); Send($"{'\u200c'} is ready to play Farkle."); return true; } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal object b__4_0(ConsoleEventArgs args) { FarkleGame game = LocalFarkle.Game; game.CurrentDice = FarkleUtils.RollDice(game.DiceRemaining); string arg = string.Join(" ", game.CurrentDice.Select(FarkleUtils.DiceIcon)); Send($"{'\u200c'} rolls: {arg}"); var (num, source) = FarkleUtils.ScoreDice(game.CurrentDice); if (num == 0 && source.Count() == game.CurrentDice.Count()) { Send($"{'\u200c'} \ud83d\udc80 FARKLE!"); game.ResetTurn(); } return true; } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal object b__5_0(ConsoleEventArgs args) { if (args.Length < 2) { Send("Usage: /farkle.keep 155"); return true; } List list = (from c in args.Args.Skip(1).SelectMany([<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (string a) => a.Where(char.IsDigit)) select int.Parse(c.ToString())).ToList(); if (list.Count == 0) { Send("Invalid dice selection."); return true; } FarkleGame game = LocalFarkle.Game; List list2 = new List(game.CurrentDice); foreach (int item in list) { if (!list2.Remove(item)) { Send($"{'\u200c'} Do not cheat you farkle fucker! End of turn."); game.ResetTurn(); return true; } } var (num, list3) = FarkleUtils.ScoreDice(list); if (list3.Count > 0) { foreach (int item2 in list3) { list.Remove(item2); } } if (num == 0) { Send($"{'\u200c'} Those dice do not score."); return true; } game.TurnScore += num; foreach (int item3 in list) { game.CurrentDice.Remove(item3); } game.DiceRemaining -= list.Count; Send($"{'\u200c'} keeps {args[1]} for {num} points. Turn total: {game.TurnScore}"); if (game.DiceRemaining <= 0) { game.DiceRemaining = 6; Send($"{'\u200c'} \ud83d\udd25 Hot dice! You roll another 6!"); } return true; } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal IEnumerable b__5_1(string a) { return a.Where(char.IsDigit); } internal int b__5_2(char c) { return int.Parse(c.ToString()); } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal object b__6_0(ConsoleEventArgs args) { LocalMsg("FARKLE - Dice Game Rules"); LocalMsg("Start a new game /farkle.start"); LocalMsg("Each turn:"); LocalMsg("1. Roll dice and keep dice to raise your turn score. /farkle.roll"); LocalMsg("2. Mark the dice to keep and continue to roll until you bank or farkle (your dice cannot score)/farkle.keep"); LocalMsg("3. If you farkle your turn score goes to 0 and ends your turn. no scoring dice → FARKLE!"); LocalMsg("4. If you bank your turn score adds to your total score and ends your turn. /farkle.bank"); LocalMsg("Check your score at any time /farkle.score"); LocalMsg("Play continues until a player reaches 10,000. Afterwards, all players get one final turn to beat the high score."); LocalMsg("Scoring:"); LocalMsg("1 = 100 | 5 = 50"); LocalMsg("Three 1s = 1000"); LocalMsg("Three 2-6 = face value × 100 (200,300,400,etc)"); LocalMsg("Four of a kind = 1,000 | Five of a kind = 2,000 | Six of a Kind = 3,000"); LocalMsg("Straight (1-6) | 3 pairs = 1,500 | Two triplets = 2,500"); return true; } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal object b__7_0(ConsoleEventArgs args) { FarkleGame game = LocalFarkle.Game; game.TotalScore += game.TurnScore; Send($"{'\u200c'} banks {game.TurnScore}. Total: {game.TotalScore}"); game.ResetTurn(); return true; } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal object b__8_0(ConsoleEventArgs args) { FarkleGame game = LocalFarkle.Game; Send($"{'\u200c'} Farkle → Total: {game.TotalScore} | Turn: {game.TurnScore}"); return true; } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] internal object b__9_0(ConsoleEventArgs args) { LocalFarkle.End(); Send($"{'\u200c'} ends the Farkle game."); return true; } } private static void Send(string msg) { Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, msg); } } private static void LocalMsg(string msg) { Chat instance = Chat.m_instance; if (instance != null) { ((Terminal)instance).AddString(msg); } } [HarmonyPostfix] [HarmonyPatch(typeof(Terminal), "InitTerminal")] private static void RegisterLocalFarkleCommands() { RegisterHelp(); RegisterStart(); RegisterRoll(); RegisterKeep(); RegisterBank(); RegisterScore(); RegisterEnd(); } private static void RegisterStart() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Terminal.commands.ContainsKey("farkle.start")) { return; } object obj = <>c.<>9__3_0; if (obj == null) { ConsoleEventFailable val = [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (ConsoleEventArgs args) => { LocalFarkle.Start(); Send($"{'\u200c'} is ready to play Farkle."); return true; }; <>c.<>9__3_0 = val; obj = (object)val; } new ConsoleCommand("farkle.start", "Start a new game of Farkle.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void RegisterRoll() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Terminal.commands.ContainsKey("farkle.roll")) { return; } object obj = <>c.<>9__4_0; if (obj == null) { ConsoleEventFailable val = [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (ConsoleEventArgs args) => { FarkleGame game = LocalFarkle.Game; game.CurrentDice = FarkleUtils.RollDice(game.DiceRemaining); string arg = string.Join(" ", game.CurrentDice.Select(FarkleUtils.DiceIcon)); Send($"{'\u200c'} rolls: {arg}"); var (num, source) = FarkleUtils.ScoreDice(game.CurrentDice); if (num == 0 && source.Count() == game.CurrentDice.Count()) { Send($"{'\u200c'} \ud83d\udc80 FARKLE!"); game.ResetTurn(); } return true; }; <>c.<>9__4_0 = val; obj = (object)val; } new ConsoleCommand("farkle.roll", "Roll the dice to try and score.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void RegisterKeep() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Terminal.commands.ContainsKey("farkle.keep")) { return; } object obj = <>c.<>9__5_0; if (obj == null) { ConsoleEventFailable val = [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (ConsoleEventArgs args) => { if (args.Length < 2) { Send("Usage: /farkle.keep 155"); return true; } List list = (from c in args.Args.Skip(1).SelectMany([<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (string a) => a.Where(char.IsDigit)) select int.Parse(c.ToString())).ToList(); if (list.Count == 0) { Send("Invalid dice selection."); return true; } FarkleGame game = LocalFarkle.Game; List list2 = new List(game.CurrentDice); foreach (int item in list) { if (!list2.Remove(item)) { Send($"{'\u200c'} Do not cheat you farkle fucker! End of turn."); game.ResetTurn(); return true; } } var (num, list3) = FarkleUtils.ScoreDice(list); if (list3.Count > 0) { foreach (int item2 in list3) { list.Remove(item2); } } if (num == 0) { Send($"{'\u200c'} Those dice do not score."); return true; } game.TurnScore += num; foreach (int item3 in list) { game.CurrentDice.Remove(item3); } game.DiceRemaining -= list.Count; Send($"{'\u200c'} keeps {args[1]} for {num} points. Turn total: {game.TurnScore}"); if (game.DiceRemaining <= 0) { game.DiceRemaining = 6; Send($"{'\u200c'} \ud83d\udd25 Hot dice! You roll another 6!"); } return true; }; <>c.<>9__5_0 = val; obj = (object)val; } new ConsoleCommand("farkle.keep", "Keep dice (example: /farkle.keep 155).", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void RegisterHelp() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Terminal.commands.ContainsKey("farkle.help")) { return; } object obj = <>c.<>9__6_0; if (obj == null) { ConsoleEventFailable val = [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (ConsoleEventArgs args) => { LocalMsg("FARKLE - Dice Game Rules"); LocalMsg("Start a new game /farkle.start"); LocalMsg("Each turn:"); LocalMsg("1. Roll dice and keep dice to raise your turn score. /farkle.roll"); LocalMsg("2. Mark the dice to keep and continue to roll until you bank or farkle (your dice cannot score)/farkle.keep"); LocalMsg("3. If you farkle your turn score goes to 0 and ends your turn. no scoring dice → FARKLE!"); LocalMsg("4. If you bank your turn score adds to your total score and ends your turn. /farkle.bank"); LocalMsg("Check your score at any time /farkle.score"); LocalMsg("Play continues until a player reaches 10,000. Afterwards, all players get one final turn to beat the high score."); LocalMsg("Scoring:"); LocalMsg("1 = 100 | 5 = 50"); LocalMsg("Three 1s = 1000"); LocalMsg("Three 2-6 = face value × 100 (200,300,400,etc)"); LocalMsg("Four of a kind = 1,000 | Five of a kind = 2,000 | Six of a Kind = 3,000"); LocalMsg("Straight (1-6) | 3 pairs = 1,500 | Two triplets = 2,500"); return true; }; <>c.<>9__6_0 = val; obj = (object)val; } new ConsoleCommand("farkle.help", "Show how to play Farkle.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void RegisterBank() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Terminal.commands.ContainsKey("farkle.bank")) { return; } object obj = <>c.<>9__7_0; if (obj == null) { ConsoleEventFailable val = [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (ConsoleEventArgs args) => { FarkleGame game = LocalFarkle.Game; game.TotalScore += game.TurnScore; Send($"{'\u200c'} banks {game.TurnScore}. Total: {game.TotalScore}"); game.ResetTurn(); return true; }; <>c.<>9__7_0 = val; obj = (object)val; } new ConsoleCommand("farkle.bank", "Bank your current turn score.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void RegisterScore() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Terminal.commands.ContainsKey("farkle.score")) { return; } object obj = <>c.<>9__8_0; if (obj == null) { ConsoleEventFailable val = [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (ConsoleEventArgs args) => { FarkleGame game = LocalFarkle.Game; Send($"{'\u200c'} Farkle → Total: {game.TotalScore} | Turn: {game.TurnScore}"); return true; }; <>c.<>9__8_0 = val; obj = (object)val; } new ConsoleCommand("farkle.score", "Show your current Farkle score.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void RegisterEnd() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Terminal.commands.ContainsKey("farkle.end")) { return; } object obj = <>c.<>9__9_0; if (obj == null) { ConsoleEventFailable val = [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] (ConsoleEventArgs args) => { LocalFarkle.End(); Send($"{'\u200c'} ends the Farkle game."); return true; }; <>c.<>9__9_0 = val; obj = (object)val; } new ConsoleCommand("farkle.end", "End the current Farkle game.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } [HarmonyPatch(typeof(Terminal))] public static class GamesPatch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEventFailable <>9__0_0; public static ConsoleEventFailable <>9__0_1; public static ConsoleEventFailable <>9__0_2; internal object b__0_0(ConsoleEventArgs args) { int num = 1; int num2 = 100; int result2; int result3; if (args.Length == 2 && int.TryParse(args[1], out var result)) { num2 = result; } else if (args.Length >= 3 && int.TryParse(args[1], out result2) && int.TryParse(args[2], out result3)) { num = result2; num2 = result3; } int num3 = RandomRoll(num, num2); Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, $"{'\u200c'} rolls a {num3} ({num}-{num2})"); } return true; } internal object b__0_1(ConsoleEventArgs args) { string arg = (((float)RandomRoll(1, 2) > 1f) ? "Heads" : "Tails"); Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, $"{'\u200c'} flips a coin: {arg}"); } return true; } internal object b__0_2(ConsoleEventArgs args) { int num = RandomRoll(0, 1); int num2 = RandomRoll(0, 1); int num3 = RandomRoll(0, 1); int num4 = RandomRoll(0, 1); int num5 = num + num2 + num3 + num4; string text = ((num == 1) ? "●" : "○") + " " + ((num2 == 1) ? "●" : "○") + " " + ((num3 == 1) ? "●" : "○") + " " + ((num4 == 1) ? "●" : "○"); string arg = ((num5 > 0) ? $"rolled {num5} {text}" : ("rolled 0 " + text + ". Lose your turn.")); Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, $"{'\u200c'} rolls Ur dice: {arg}"); } return true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Terminal), "InitTerminal")] private static void RegisterGameCommands() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00d6: 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_00cd: Expected O, but got Unknown if (Terminal.commands.ContainsKey("roll")) { return; } object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEventFailable val = delegate(ConsoleEventArgs args) { int num6 = 1; int num7 = 100; int result2; int result3; if (args.Length == 2 && int.TryParse(args[1], out var result)) { num7 = result; } else if (args.Length >= 3 && int.TryParse(args[1], out result2) && int.TryParse(args[2], out result3)) { num6 = result2; num7 = result3; } int num8 = RandomRoll(num6, num7); Chat instance3 = Chat.m_instance; if (instance3 != null) { instance3.SendText((Type)1, $"{'\u200c'} rolls a {num8} ({num6}-{num7})"); } return true; }; <>c.<>9__0_0 = val; obj = (object)val; } new ConsoleCommand("roll", "Rolls a random number. Usage: /roll [max] or /roll [min] [max]", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); if (!Terminal.commands.ContainsKey("coinflip")) { object obj2 = <>c.<>9__0_1; if (obj2 == null) { ConsoleEventFailable val2 = delegate { string arg2 = (((float)RandomRoll(1, 2) > 1f) ? "Heads" : "Tails"); Chat instance2 = Chat.m_instance; if (instance2 != null) { instance2.SendText((Type)1, $"{'\u200c'} flips a coin: {arg2}"); } return true; }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } new ConsoleCommand("coinflip", "Flips a coin.", (ConsoleEventFailable)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } if (Terminal.commands.ContainsKey("ur")) { return; } object obj3 = <>c.<>9__0_2; if (obj3 == null) { ConsoleEventFailable val3 = delegate { int num = RandomRoll(0, 1); int num2 = RandomRoll(0, 1); int num3 = RandomRoll(0, 1); int num4 = RandomRoll(0, 1); int num5 = num + num2 + num3 + num4; string text = ((num == 1) ? "●" : "○") + " " + ((num2 == 1) ? "●" : "○") + " " + ((num3 == 1) ? "●" : "○") + " " + ((num4 == 1) ? "●" : "○"); string arg = ((num5 > 0) ? $"rolled {num5} {text}" : ("rolled 0 " + text + ". Lose your turn.")); Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, $"{'\u200c'} rolls Ur dice: {arg}"); } return true; }; <>c.<>9__0_2 = val3; obj3 = (object)val3; } new ConsoleCommand("ur", "Roll four tetrahedral dice.", (ConsoleEventFailable)obj3, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } public static int RandomRoll(int min = 1, int max = 100) { if (min < 0) { min = 1; } if (max < 0) { max = 100; } if (min > max) { int num = max; max = min; min = num; } return new Random(Environment.TickCount ^ Guid.NewGuid().GetHashCode()).Next(min, max + 1); } } public class LogPatch { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static void SendModerationLog(string player, string item, string action, string creator, string raw) { string input = JsonConvert.SerializeObject((object)new DbLog { p = player, i = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(item)), a = action, c = creator, r = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(raw)) }); input = Regex.Replace(input, "[^\\u0009\\u000A\\u000D\\u0020-\\u007E]", ""); if (ZRoutedRpc.instance != null && !ZRoutedRpc.instance.m_server) { ZRoutedRpc.instance.InvokeRoutedRPC("ServerModerationLog", new object[1] { input }); } } } [HarmonyPatch(typeof(Menu))] internal static class MenuPatch { [HarmonyPostfix] [HarmonyPatch("Show")] private static void ShowPostfix() { if (PluginConfig.IsModEnabled.Value && ChatPanelController.TryGetChatPanel(out var chatPanel)) { Chat.m_instance.m_hideTimer = 0f; chatPanel.EnableOrDisableChatPanel(isEnabled: true); chatPanel.ToggleGrabber(toggleOn: true); } } [HarmonyPostfix] [HarmonyPatch("Hide")] private static void HidePostfix() { if (PluginConfig.IsModEnabled.Value && ChatPanelController.TryGetChatPanel(out var chatPanel)) { chatPanel.SetContentVerticalScrollPosition(0f); chatPanel.ToggleGrabber(toggleOn: false); } } } [HarmonyPatch(typeof(MessageHud))] internal static class MessageHudPatch { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [HarmonyPostfix] [HarmonyPatch("ShowMessage")] private static void ShowMessagePostfix(MessageType type, string text) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 if (PluginConfig.IsModEnabled.Value && (int)type == 2 && PluginConfig.ShowMessageHudCenterMessages.Value) { ChatMessageUtils.AddChatMessage(new ChatMessage { MessageType = ChatMessageType.HudCenter, Timestamp = DateTime.Now, Text = text }); } } } [HarmonyPatch(typeof(Minimap), "UpdatePingPins")] public static class PingPatch { private const float MaxPingDistance = 25f; [HarmonyPostfix] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] private static void Postfix(Minimap __instance) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)__instance == (Object)null || (Object)(object)localPlayer == (Object)null) { return; } List pingPins = __instance.m_pingPins; if (pingPins == null || pingPins.Count == 0) { return; } for (int num = pingPins.Count - 1; num >= 0; num--) { PinData val = pingPins[num]; if (val != null) { string text = val.m_name ?? string.Empty; int num2 = text.IndexOf(':'); string playerName = ((num2 >= 0) ? text.Substring(0, num2).Trim() : text); string text2 = ((num2 >= 0) ? text.Substring(num2 + 1).TrimStart(Array.Empty()) : string.Empty); string displayName = AliasPatch.GetDisplayName(playerName); string text3 = (string.IsNullOrEmpty(text2) ? displayName : (displayName + ": " + text2)); if (text3 != val.m_name) { val.m_name = text3; PinNameData namePinData = val.m_NamePinData; if ((Object)(object)((namePinData != null) ? namePinData.PinNameText : null) != (Object)null) { val.m_NamePinData.PinNameText.text = Localization.instance.Localize(text3); } } } } } } public class ServerPatches { [HarmonyPatch(new Type[] { typeof(int) })] [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(ZDOMan))] public static class AddCustomeRPCHere { private static void Postfix() { int stableHashCode = StringExtensionMethods.GetStableHashCode("ServerModerationLog"); if (!ZRoutedRpc.instance.m_functions.ContainsKey(stableHashCode)) { ZRoutedRpc.instance.Register("ServerModerationLog", (Action)RPC_ModerationLog); } } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static void SendModerationLog(string player, string item, string action, string creator, string raw) { string input = JsonConvert.SerializeObject((object)new DbLog { p = player, i = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(item)), a = action, c = creator, r = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(raw)) }); input = Regex.Replace(input, "[^\\u0009\\u000A\\u000D\\u0020-\\u007E]", ""); if (ZRoutedRpc.instance != null && !ZRoutedRpc.instance.m_server) { ZRoutedRpc.instance.InvokeRoutedRPC("ServerModerationLog", new object[1] { input }); } } [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static void RPC_ModerationLog(long sender, string logjson) { if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()) { ((MonoBehaviour)ZNet.instance).StartCoroutine(Api.LogInsert(logjson)); } } } [BepInPlugin("Arielle.RpChatter", "RpChatter", "3.0.0")] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public class RpChatterPlugin : BaseUnityPlugin { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(0)] public enum Toggle { On = 1, Off = 0 } internal const string ModName = "RpChatter"; internal const string ModVersion = "3.0.0"; internal const string Author = "Arielle"; internal const string ModGUID = "Arielle.RpChatter"; internal static string ConnectionError = ""; public static readonly ManualLogSource RpChatterLogger = Logger.CreateLogSource("RpChatter"); public static Harmony HarmonyInstance { get; private set; } public void Awake() { PluginConfig.BindConfig(((BaseUnityPlugin)this).Config); HarmonyInstance = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Arielle.RpChatter"); } } public static class KeyboardExtensions { public static bool IsKeyDown(this KeyboardShortcut shortcut) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey)) { return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func)Input.GetKey); } return false; } public static bool IsKeyHeld(this KeyboardShortcut shortcut) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey)) { return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func)Input.GetKey); } return false; } } [HarmonyPatch(typeof(Terminal))] public static class TarotPatch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEventFailable <>9__0_0; public static ConsoleEventFailable <>9__0_1; internal object b__0_0(ConsoleEventArgs args) { int num = 50; if (args.Length >= 2 && int.TryParse(args[1], out var result)) { num = Mathf.Clamp(result, 0, 100); } LocalTarot.Reset(num); Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, $"{'\u200c'} shuffled a new Tarot deck (reversals {num}%)."); } return true; } internal object b__0_1(ConsoleEventArgs args) { if (!LocalTarot.HasDeck) { Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, $"{'\u200c'} No Tarot deck yet. Use /tarot.shuffle."); } return true; } int result = 1; if (args.Length >= 2 && !int.TryParse(args[1], out result)) { result = 1; } result = Mathf.Clamp(result, 1, 10); List list = new List(result); int num = LocalTarot.TryDrawMany(result, list); if (num <= 0) { Chat instance2 = Chat.m_instance; if (instance2 != null) { instance2.SendText((Type)1, $"{'\u200c'} No Tarot cards remain. Use /tarot.shuffle."); } return true; } string text = string.Join(", ", list); Chat instance3 = Chat.m_instance; if (instance3 != null) { instance3.SendText((Type)1, string.Format("{0} draws {1} card{2}: {3}", '\u200c', num, (num == 1) ? "" : "s", text)); } return true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Terminal), "InitTerminal")] private static void RegisterTarotCommands() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown if (!Terminal.commands.ContainsKey("tarot.shuffle")) { object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEventFailable val = delegate(ConsoleEventArgs args) { int num2 = 50; if (args.Length >= 2 && int.TryParse(args[1], out var result2)) { num2 = Mathf.Clamp(result2, 0, 100); } LocalTarot.Reset(num2); Chat instance4 = Chat.m_instance; if (instance4 != null) { instance4.SendText((Type)1, $"{'\u200c'} shuffled a new Tarot deck (reversals {num2}%)."); } return true; }; <>c.<>9__0_0 = val; obj = (object)val; } new ConsoleCommand("tarot.shuffle", "Creates a fresh shuffled 78-card Tarot deck. Usage: /tarot.shuffle [reversal%] (default 50).", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } if (Terminal.commands.ContainsKey("tarot.draw")) { return; } object obj2 = <>c.<>9__0_1; if (obj2 == null) { ConsoleEventFailable val2 = delegate(ConsoleEventArgs args) { if (!LocalTarot.HasDeck) { Chat instance = Chat.m_instance; if (instance != null) { instance.SendText((Type)1, $"{'\u200c'} No Tarot deck yet. Use /tarot.shuffle."); } return true; } int result = 1; if (args.Length >= 2 && !int.TryParse(args[1], out result)) { result = 1; } result = Mathf.Clamp(result, 1, 10); List list = new List(result); int num = LocalTarot.TryDrawMany(result, list); if (num <= 0) { Chat instance2 = Chat.m_instance; if (instance2 != null) { instance2.SendText((Type)1, $"{'\u200c'} No Tarot cards remain. Use /tarot.shuffle."); } return true; } string text = string.Join(", ", list); Chat instance3 = Chat.m_instance; if (instance3 != null) { instance3.SendText((Type)1, string.Format("{0} draws {1} card{2}: {3}", '\u200c', num, (num == 1) ? "" : "s", text)); } return true; }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } new ConsoleCommand("tarot.draw", "Draws Tarot cards from your deck. Usage: /tarot.draw [count] (default 1, max 10).", (ConsoleEventFailable)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } [HarmonyPatch(typeof(Terminal))] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] internal static class TerminalPatch { private static bool _patched; [HarmonyPostfix] [HarmonyPatch("InitTerminal")] private static void InitTerminalPostfix() { if (PluginConfig.IsModEnabled.Value && !_patched) { _patched = true; PatchCommand("say", "SayDelegatePostfix"); PatchCommand("s", "ShoutDelegatePostfix"); PatchCommand("w", "WhisperDelegatePostfix"); PatchCommand("bc", "BroadcastDelegatePostfix"); PatchCommand("roll", "RollDelegatePostfix"); PatchCommand("coinflip", "CoinflipDelegatePostfix"); PatchCommand("ges", "GestureDelegatePostfix"); PatchCommand("me", "MeDelegatePostfix"); } } private static void PatchCommand(string key, string postfixName) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if (Terminal.commands.TryGetValue(key, out var value) && value != null && TryGetDelegateMethod(value, out var method) && method != null) { RpChatterPlugin.HarmonyInstance.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(TerminalPatch), postfixName, (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static bool TryGetDelegateMethod(ConsoleCommand command, out MethodInfo method) { method = ((Delegate)(object)command?.actionFailable)?.Method ?? ((Delegate)(object)command?.action)?.Method; return method != null; } [HarmonyPostfix] [HarmonyPatch("AddString", new Type[] { typeof(string) })] private static void AddStringPostfix(Terminal __instance, string text) { if (PluginConfig.IsModEnabled.Value && __instance is Chat && !ChatMessageUtils.IsChatMessageQueued) { ChatMessageUtils.AddChatMessage(new ChatMessage { MessageType = ChatMessageType.Text, Timestamp = DateTime.Now, Text = text }); } } private static void SayDelegatePostfix(ref object __result) { SetPrefixIfUnconsumed(ref __result, (Type)1); } private static void ShoutDelegatePostfix(ref object __result) { SetPrefixIfUnconsumed(ref __result, (Type)1); } private static void BroadcastDelegatePostfix(ref object __result) { SetPrefixIfUnconsumed(ref __result, (Type)2); } private static void WhisperDelegatePostfix(ref object __result) { SetPrefixIfUnconsumed(ref __result, (Type)0); } private static void RollDelegatePostfix(ref object __result) { SetPrefixIfUnconsumed(ref __result, (Type)1); } private static void CoinflipDelegatePostfix(ref object __result) { SetPrefixIfUnconsumed(ref __result, (Type)1); } private static void MeDelegatePostfix(ref object __result) { SetPrefixIfUnconsumed(ref __result, (Type)1); } private static void GestureDelegatePostfix(ref object __result) { SetPrefixIfUnconsumed(ref __result, (Type)0); } private static void SetPrefixIfUnconsumed(ref object __result, Type type) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (PluginConfig.IsModEnabled.Value) { object obj = __result; bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } if (!(num == 0 || flag) && ChatPanelController.TryGetChatPanel(out var chatPanel)) { chatPanel.SetChatTextInputPrefix(type); __result = true; } } } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] public static class RegisterAndCheckVersion { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] private static void Prefix(ZNetPeer peer, ref ZNet __instance) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown RpChatterPlugin.RpChatterLogger.LogDebug((object)"Registering version RPC handler"); peer.m_rpc.Register("RpChatter_VersionCheck", (Action)RpcHandlers.RPC_RpChatter_Version); RpChatterPlugin.RpChatterLogger.LogInfo((object)"Invoking version check"); ZPackage val = new ZPackage(); val.Write("3.0.0"); peer.m_rpc.Invoke("RpChatter_VersionCheck", new object[1] { val }); } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class VerifyClient { private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance) { if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc)) { return true; } RpChatterPlugin.RpChatterLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting")); rpc.Invoke("Error", new object[1] { 3 }); return false; } private static void Postfix(ZNet __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "RpChatterRequestAdminSync", new object[1] { (object)new ZPackage() }); } } [HarmonyPatch(typeof(FejdStartup), "ShowConnectError")] public class ShowConnectionError { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] private static void Postfix(FejdStartup __instance) { if (__instance.m_connectionFailedPanel.activeSelf) { __instance.m_connectionFailedError.fontSizeMax = 25f; __instance.m_connectionFailedError.fontSizeMin = 15f; TMP_Text connectionFailedError = __instance.m_connectionFailedError; connectionFailedError.text = connectionFailedError.text + "\n" + RpChatterPlugin.ConnectionError; } } } [HarmonyPatch(typeof(ZNet), "Disconnect")] public static class RemoveDisconnectedPeerFromVerified { [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] private static void Prefix(ZNetPeer peer, ref ZNet __instance) { if (__instance.IsServer()) { RpChatterPlugin.RpChatterLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list")); RpcHandlers.ValidatedPeers.Remove(peer.m_rpc); } } } [<30ea76a9-0cb6-42f7-8a3b-4c05ef4a33a2>Nullable(0)] [<235e2840-11ab-40c1-85e0-a1ba85921bf5>NullableContext(1)] public static class RpcHandlers { public static readonly List ValidatedPeers = new List(); public static void RPC_RpChatter_Version(ZRpc rpc, ZPackage pkg) { string text = pkg.ReadString(); RpChatterPlugin.RpChatterLogger.LogInfo((object)("Version check, local: 3.0.0, remote: " + text)); if (text != "3.0.0") { RpChatterPlugin.ConnectionError = "RpChatter Installed: 3.0.0\n Needed: " + text; if (ZNet.instance.IsServer()) { RpChatterPlugin.RpChatterLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting...")); rpc.Invoke("Error", new object[1] { 3 }); } } else if (!ZNet.instance.IsServer()) { RpChatterPlugin.RpChatterLogger.LogInfo((object)"Received same version from server!"); } else { RpChatterPlugin.RpChatterLogger.LogInfo((object)("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list")); ValidatedPeers.Add(rpc); } } public static string ComputeHashForMod() { using SHA256 sHA = SHA256.Create(); byte[] array = sHA.ComputeHash(File.ReadAllBytes(Assembly.GetExecutingAssembly().Location)); StringBuilder stringBuilder = new StringBuilder(); byte[] array2 = array; foreach (byte b in array2) { stringBuilder.Append(b.ToString("X2")); } return stringBuilder.ToString(); } } } 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] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [Microsoft.CodeAnalysis.Embedded] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [Microsoft.CodeAnalysis.Embedded] [CompilerGenerated] [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 ServerSync { [PublicAPI] internal abstract class OwnConfigEntryBase { public object? LocalBaseValue; public bool SynchronizedConfig = true; public abstract ConfigEntryBase BaseConfig { get; } } [PublicAPI] internal class SyncedConfigEntry : OwnConfigEntryBase { public readonly ConfigEntry SourceConfig; public override ConfigEntryBase BaseConfig => (ConfigEntryBase)(object)SourceConfig; public T Value { get { return SourceConfig.Value; } set { SourceConfig.Value = value; } } public SyncedConfigEntry(ConfigEntry sourceConfig) { SourceConfig = sourceConfig; base..ctor(); } public void AssignLocalValue(T value) { if (LocalBaseValue == null) { Value = value; } else { LocalBaseValue = value; } } } internal abstract class CustomSyncedValueBase { public object? LocalBaseValue; public readonly string Identifier; public readonly Type Type; private object? boxedValue; protected bool localIsOwner; public readonly int Priority; public object? BoxedValue { get { return boxedValue; } set { boxedValue = value; this.ValueChanged?.Invoke(); } } public event Action? ValueChanged; protected CustomSyncedValueBase(ConfigSync configSync, string identifier, Type type, int priority) { Priority = priority; Identifier = identifier; Type = type; configSync.AddCustomValue(this); localIsOwner = configSync.IsSourceOfTruth; configSync.SourceOfTruthChanged += delegate(bool truth) { localIsOwner = truth; }; } } [PublicAPI] internal sealed class CustomSyncedValue : CustomSyncedValueBase { public T Value { get { return (T)base.BoxedValue; } set { base.BoxedValue = value; } } public CustomSyncedValue(ConfigSync configSync, string identifier, T value = default(T), int priority = 0) : base(configSync, identifier, typeof(T), priority) { Value = value; } public void AssignLocalValue(T value) { if (localIsOwner) { Value = value; } else { LocalBaseValue = value; } } } internal class ConfigurationManagerAttributes { [UsedImplicitly] public bool? ReadOnly = false; } [PublicAPI] internal class ConfigSync { [HarmonyPatch(typeof(ZRpc), "HandlePackage")] private static class SnatchCurrentlyHandlingRPC { public static ZRpc? currentRpc; [HarmonyPrefix] private static void Prefix(ZRpc __instance) { currentRpc = __instance; } } [HarmonyPatch(typeof(ZNet), "Awake")] internal static class RegisterRPCPatch { [HarmonyPostfix] private static void Postfix(ZNet __instance) { isServer = __instance.IsServer(); foreach (ConfigSync configSync2 in configSyncs) { ZRoutedRpc.instance.Register(configSync2.Name + " ConfigSync", (Action)configSync2.RPC_FromOtherClientConfigSync); if (isServer) { configSync2.InitialSyncDone = true; Debug.Log((object)("Registered '" + configSync2.Name + " ConfigSync' RPC - waiting for incoming connections")); } } if (isServer) { ((MonoBehaviour)__instance).StartCoroutine(WatchAdminListChanges()); } static void SendAdmin(List peers, bool isAdmin) { ZPackage package = ConfigsToPackage(null, null, new PackageEntry[1] { new PackageEntry { section = "Internal", key = "lockexempt", type = typeof(bool), value = isAdmin } }); ConfigSync configSync = configSyncs.First(); if (configSync != null) { ((MonoBehaviour)ZNet.instance).StartCoroutine(configSync.sendZPackage(peers, package)); } } static IEnumerator WatchAdminListChanges() { MethodInfo listContainsId = AccessTools.DeclaredMethod(typeof(ZNet), "ListContainsId", (Type[])null, (Type[])null); SyncedList adminList = (SyncedList)AccessTools.DeclaredField(typeof(ZNet), "m_adminList").GetValue(ZNet.instance); List CurrentList = new List(adminList.GetList()); while (true) { yield return (object)new WaitForSeconds(30f); if (!adminList.GetList().SequenceEqual(CurrentList)) { CurrentList = new List(adminList.GetList()); List adminPeer = ZNet.instance.GetPeers().Where(delegate(ZNetPeer p) { string hostName = p.m_rpc.GetSocket().GetHostName(); return ((object)listContainsId == null) ? adminList.Contains(hostName) : ((bool)listContainsId.Invoke(ZNet.instance, new object[2] { adminList, hostName })); }).ToList(); List nonAdminPeer = ZNet.instance.GetPeers().Except(adminPeer).ToList(); SendAdmin(nonAdminPeer, isAdmin: false); SendAdmin(adminPeer, isAdmin: true); } } } } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] private static class RegisterClientRPCPatch { [HarmonyPostfix] private static void Postfix(ZNet __instance, ZNetPeer peer) { if (__instance.IsServer()) { return; } foreach (ConfigSync configSync in configSyncs) { peer.m_rpc.Register(configSync.Name + " ConfigSync", (Action)configSync.RPC_FromServerConfigSync); } } } private class ParsedConfigs { public readonly Dictionary configValues = new Dictionary(); public readonly Dictionary customValues = new Dictionary(); } [HarmonyPatch(typeof(ZNet), "Shutdown")] private class ResetConfigsOnShutdown { [HarmonyPostfix] private static void Postfix() { ProcessingServerUpdate = true; foreach (ConfigSync configSync in configSyncs) { configSync.resetConfigsFromServer(); configSync.IsSourceOfTruth = true; configSync.InitialSyncDone = false; } ProcessingServerUpdate = false; } } [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] private class SendConfigsAfterLogin { private class BufferingSocket : ZPlayFabSocket, ISocket { public volatile bool finished = false; public volatile int versionMatchQueued = -1; public readonly List Package = new List(); public readonly ISocket Original; public BufferingSocket(ISocket original) { Original = original; ((ZPlayFabSocket)this)..ctor(); } public bool IsConnected() { return Original.IsConnected(); } public ZPackage Recv() { return Original.Recv(); } public int GetSendQueueSize() { return Original.GetSendQueueSize(); } public int GetCurrentSendRate() { return Original.GetCurrentSendRate(); } public bool IsHost() { return Original.IsHost(); } public void Dispose() { Original.Dispose(); } public bool GotNewData() { return Original.GotNewData(); } public void Close() { Original.Close(); } public string GetEndPointString() { return Original.GetEndPointString(); } public void GetAndResetStats(out int totalSent, out int totalRecv) { Original.GetAndResetStats(ref totalSent, ref totalRecv); } public void GetConnectionQuality(out float localQuality, out float remoteQuality, out int ping, out float outByteSec, out float inByteSec) { Original.GetConnectionQuality(ref localQuality, ref remoteQuality, ref ping, ref outByteSec, ref inByteSec); } public ISocket Accept() { return Original.Accept(); } public int GetHostPort() { return Original.GetHostPort(); } public bool Flush() { return Original.Flush(); } public string GetHostName() { return Original.GetHostName(); } public void VersionMatch() { if (finished) { Original.VersionMatch(); } else { versionMatchQueued = Package.Count; } } public void Send(ZPackage pkg) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown int pos = pkg.GetPos(); pkg.SetPos(0); int num = pkg.ReadInt(); if ((num == StringExtensionMethods.GetStableHashCode("PeerInfo") || num == StringExtensionMethods.GetStableHashCode("RoutedRPC") || num == StringExtensionMethods.GetStableHashCode("ZDOData")) && !finished) { ZPackage val = new ZPackage(pkg.GetArray()); val.SetPos(pos); Package.Add(val); } else { pkg.SetPos(pos); Original.Send(pkg); } } } [HarmonyPriority(800)] [HarmonyPrefix] private static void Prefix(ref Dictionary? __state, ZNet __instance, ZRpc rpc) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 if (!__instance.IsServer()) { return; } BufferingSocket bufferingSocket = new BufferingSocket(rpc.GetSocket()); AccessTools.DeclaredField(typeof(ZRpc), "m_socket").SetValue(rpc, bufferingSocket); object? obj = AccessTools.DeclaredMethod(typeof(ZNet), "GetPeer", new Type[1] { typeof(ZRpc) }, (Type[])null).Invoke(__instance, new object[1] { rpc }); ZNetPeer val = (ZNetPeer)((obj is ZNetPeer) ? obj : null); if (val != null && (int)ZNet.m_onlineBackend > 0) { FieldInfo fieldInfo = AccessTools.DeclaredField(typeof(ZNetPeer), "m_socket"); object? value = fieldInfo.GetValue(val); ZPlayFabSocket val2 = (ZPlayFabSocket)((value is ZPlayFabSocket) ? value : null); if (val2 != null) { typeof(ZPlayFabSocket).GetField("m_remotePlayerId").SetValue(bufferingSocket, val2.m_remotePlayerId); } fieldInfo.SetValue(val, bufferingSocket); } if (__state == null) { __state = new Dictionary(); } __state[Assembly.GetExecutingAssembly()] = bufferingSocket; } [HarmonyPostfix] private static void Postfix(Dictionary __state, ZNet __instance, ZRpc rpc) { ZRpc rpc2 = rpc; ZNet __instance2 = __instance; Dictionary __state2 = __state; ZNetPeer peer; if (__instance2.IsServer()) { object obj = AccessTools.DeclaredMethod(typeof(ZNet), "GetPeer", new Type[1] { typeof(ZRpc) }, (Type[])null).Invoke(__instance2, new object[1] { rpc2 }); peer = (ZNetPeer)((obj is ZNetPeer) ? obj : null); if (peer == null) { SendBufferedData(); } else { ((MonoBehaviour)__instance2).StartCoroutine(sendAsync()); } } void SendBufferedData() { if (rpc2.GetSocket() is BufferingSocket bufferingSocket) { AccessTools.DeclaredField(typeof(ZRpc), "m_socket").SetValue(rpc2, bufferingSocket.Original); object? obj2 = AccessTools.DeclaredMethod(typeof(ZNet), "GetPeer", new Type[1] { typeof(ZRpc) }, (Type[])null).Invoke(__instance2, new object[1] { rpc2 }); ZNetPeer val = (ZNetPeer)((obj2 is ZNetPeer) ? obj2 : null); if (val != null) { AccessTools.DeclaredField(typeof(ZNetPeer), "m_socket").SetValue(val, bufferingSocket.Original); } } BufferingSocket bufferingSocket2 = __state2[Assembly.GetExecutingAssembly()]; bufferingSocket2.finished = true; for (int i = 0; i < bufferingSocket2.Package.Count; i++) { if (i == bufferingSocket2.versionMatchQueued) { bufferingSocket2.Original.VersionMatch(); } bufferingSocket2.Original.Send(bufferingSocket2.Package[i]); } if (bufferingSocket2.Package.Count == bufferingSocket2.versionMatchQueued) { bufferingSocket2.Original.VersionMatch(); } } IEnumerator sendAsync() { foreach (ConfigSync configSync in configSyncs) { List entries = new List(); if (configSync.CurrentVersion != null) { entries.Add(new PackageEntry { section = "Internal", key = "serverversion", type = typeof(string), value = configSync.CurrentVersion }); } MethodInfo listContainsId = AccessTools.DeclaredMethod(typeof(ZNet), "ListContainsId", (Type[])null, (Type[])null); SyncedList adminList = (SyncedList)AccessTools.DeclaredField(typeof(ZNet), "m_adminList").GetValue(ZNet.instance); entries.Add(new PackageEntry { section = "Internal", key = "lockexempt", type = typeof(bool), value = (((object)listContainsId == null) ? ((object)adminList.Contains(rpc2.GetSocket().GetHostName())) : listContainsId.Invoke(ZNet.instance, new object[2] { adminList, rpc2.GetSocket().GetHostName() })) }); ZPackage package = ConfigsToPackage(configSync.allConfigs.Select((OwnConfigEntryBase c) => c.BaseConfig), configSync.allCustomValues, entries, partial: false); yield return ((MonoBehaviour)__instance2).StartCoroutine(configSync.sendZPackage(new List { peer }, package)); } SendBufferedData(); } } } private class PackageEntry { public string section = null; public string key = null; public Type type = null; public object? value; } [HarmonyPatch(typeof(ConfigEntryBase), "GetSerializedValue")] private static class PreventSavingServerInfo { [HarmonyPrefix] private static bool Prefix(ConfigEntryBase __instance, ref string __result) { OwnConfigEntryBase ownConfigEntryBase = configData(__instance); if (ownConfigEntryBase == null || isWritableConfig(ownConfigEntryBase)) { return true; } __result = TomlTypeConverter.ConvertToString(ownConfigEntryBase.LocalBaseValue, __instance.SettingType); return false; } } [HarmonyPatch(typeof(ConfigEntryBase), "SetSerializedValue")] private static class PreventConfigRereadChangingValues { [HarmonyPrefix] private static bool Prefix(ConfigEntryBase __instance, string value) { OwnConfigEntryBase ownConfigEntryBase = configData(__instance); if (ownConfigEntryBase == null || ownConfigEntryBase.LocalBaseValue == null) { return true; } try { ownConfigEntryBase.LocalBaseValue = TomlTypeConverter.ConvertToValue(value, __instance.SettingType); } catch (Exception ex) { Debug.LogWarning((object)$"Config value of setting \"{__instance.Definition}\" could not be parsed and will be ignored. Reason: {ex.Message}; Value: {value}"); } return false; } } private class InvalidDeserializationTypeException : Exception { public string expected = null; public string received = null; public string field = ""; } public static bool ProcessingServerUpdate; public readonly string Name; public string? DisplayName; public string? CurrentVersion; public string? MinimumRequiredVersion; public bool ModRequired = false; private bool? forceConfigLocking; private bool isSourceOfTruth = true; private static readonly HashSet configSyncs; private readonly HashSet allConfigs = new HashSet(); private HashSet allCustomValues = new HashSet(); private static bool isServer; private static bool lockExempt; private OwnConfigEntryBase? lockedConfig = null; private const byte PARTIAL_CONFIGS = 1; private const byte FRAGMENTED_CONFIG = 2; private const byte COMPRESSED_CONFIG = 4; private readonly Dictionary> configValueCache = new Dictionary>(); private readonly List> cacheExpirations = new List>(); private static long packageCounter; public bool IsLocked { get { bool? flag = forceConfigLocking; bool num; if (!flag.HasValue) { if (lockedConfig == null) { goto IL_0052; } num = ((IConvertible)lockedConfig.BaseConfig.BoxedValue).ToInt32(CultureInfo.InvariantCulture) != 0; } else { num = flag.GetValueOrDefault(); } if (!num) { goto IL_0052; } int result = ((!lockExempt) ? 1 : 0); goto IL_0053; IL_0053: return (byte)result != 0; IL_0052: result = 0; goto IL_0053; } set { forceConfigLocking = value; } } public bool IsAdmin => lockExempt || isSourceOfTruth; public bool IsSourceOfTruth { get { return isSourceOfTruth; } private set { if (value != isSourceOfTruth) { isSourceOfTruth = value; this.SourceOfTruthChanged?.Invoke(value); } } } public bool InitialSyncDone { get; private set; } = false; public event Action? SourceOfTruthChanged; private event Action? lockedConfigChanged; static ConfigSync() { ProcessingServerUpdate = false; configSyncs = new HashSet(); lockExempt = false; packageCounter = 0L; RuntimeHelpers.RunClassConstructor(typeof(VersionCheck).TypeHandle); } public ConfigSync(string name) { Name = name; configSyncs.Add(this); new VersionCheck(this); } public SyncedConfigEntry AddConfigEntry(ConfigEntry configEntry) { ConfigEntry configEntry2 = configEntry; OwnConfigEntryBase ownConfigEntryBase = configData((ConfigEntryBase)(object)configEntry2); SyncedConfigEntry syncedEntry = ownConfigEntryBase as SyncedConfigEntry; if (syncedEntry == null) { syncedEntry = new SyncedConfigEntry(configEntry2); AccessTools.DeclaredField(typeof(ConfigDescription), "k__BackingField").SetValue(((ConfigEntryBase)configEntry2).Description, new object[1] { new ConfigurationManagerAttributes() }.Concat(((ConfigEntryBase)configEntry2).Description.Tags ?? Array.Empty()).Concat(new SyncedConfigEntry[1] { syncedEntry }).ToArray()); configEntry2.SettingChanged += delegate { if (!ProcessingServerUpdate && syncedEntry.SynchronizedConfig) { Broadcast(ZRoutedRpc.Everybody, (ConfigEntryBase)configEntry2); } }; allConfigs.Add(syncedEntry); } return syncedEntry; } public SyncedConfigEntry AddLockingConfigEntry(ConfigEntry lockingConfig) where T : IConvertible { if (lockedConfig != null) { throw new Exception("Cannot initialize locking ConfigEntry twice"); } lockedConfig = AddConfigEntry(lockingConfig); lockingConfig.SettingChanged += delegate { this.lockedConfigChanged?.Invoke(); }; return (SyncedConfigEntry)lockedConfig; } internal void AddCustomValue(CustomSyncedValueBase customValue) { CustomSyncedValueBase customValue2 = customValue; if (allCustomValues.Select((CustomSyncedValueBase v) => v.Identifier).Concat(new string[1] { "serverversion" }).Contains(customValue2.Identifier)) { throw new Exception("Cannot have multiple settings with the same name or with a reserved name (serverversion)"); } allCustomValues.Add(customValue2); allCustomValues = new HashSet(allCustomValues.OrderByDescending((CustomSyncedValueBase v) => v.Priority)); customValue2.ValueChanged += delegate { if (!ProcessingServerUpdate) { Broadcast(ZRoutedRpc.Everybody, customValue2); } }; } private void RPC_FromServerConfigSync(ZRpc rpc, ZPackage package) { lockedConfigChanged += serverLockedSettingChanged; IsSourceOfTruth = false; if (HandleConfigSyncRPC(0L, package, clientUpdate: false)) { InitialSyncDone = true; } } private void RPC_FromOtherClientConfigSync(long sender, ZPackage package) { HandleConfigSyncRPC(sender, package, clientUpdate: true); } private bool HandleConfigSyncRPC(long sender, ZPackage package, bool clientUpdate) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown try { if (isServer && IsLocked) { ZRpc? currentRpc = SnatchCurrentlyHandlingRPC.currentRpc; object obj; if (currentRpc == null) { obj = null; } else { ISocket socket = currentRpc.GetSocket(); obj = ((socket != null) ? socket.GetHostName() : null); } string text = (string)obj; if (text != null) { MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(ZNet), "ListContainsId", (Type[])null, (Type[])null); SyncedList val = (SyncedList)AccessTools.DeclaredField(typeof(ZNet), "m_adminList").GetValue(ZNet.instance); if (!(((object)methodInfo == null) ? val.Contains(text) : ((bool)methodInfo.Invoke(ZNet.instance, new object[2] { val, text })))) { return false; } } } cacheExpirations.RemoveAll(delegate(KeyValuePair kv) { if (kv.Key < DateTimeOffset.Now.Ticks) { configValueCache.Remove(kv.Value); return true; } return false; }); byte b = package.ReadByte(); if ((b & 2u) != 0) { long num = package.ReadLong(); string text2 = sender.ToString() + num; if (!configValueCache.TryGetValue(text2, out SortedDictionary value)) { value = new SortedDictionary(); configValueCache[text2] = value; cacheExpirations.Add(new KeyValuePair(DateTimeOffset.Now.AddSeconds(60.0).Ticks, text2)); } int key = package.ReadInt(); int num2 = package.ReadInt(); value.Add(key, package.ReadByteArray()); if (value.Count < num2) { return false; } configValueCache.Remove(text2); package = new ZPackage(value.Values.SelectMany((byte[] a) => a).ToArray()); b = package.ReadByte(); } ProcessingServerUpdate = true; if ((b & 4u) != 0) { byte[] buffer = package.ReadByteArray(); MemoryStream stream = new MemoryStream(buffer); MemoryStream memoryStream = new MemoryStream(); using (DeflateStream deflateStream = new DeflateStream(stream, CompressionMode.Decompress)) { deflateStream.CopyTo(memoryStream); } package = new ZPackage(memoryStream.ToArray()); b = package.ReadByte(); } if ((b & 1) == 0) { resetConfigsFromServer(); } ParsedConfigs parsedConfigs = ReadConfigsFromPackage(package); ConfigFile val2 = null; bool saveOnConfigSet = false; foreach (KeyValuePair configValue in parsedConfigs.configValues) { if (!isServer && configValue.Key.LocalBaseValue == null) { configValue.Key.LocalBaseValue = configValue.Key.BaseConfig.BoxedValue; } if (val2 == null) { val2 = configValue.Key.BaseConfig.ConfigFile; saveOnConfigSet = val2.SaveOnConfigSet; val2.SaveOnConfigSet = false; } configValue.Key.BaseConfig.BoxedValue = configValue.Value; } if (val2 != null) { val2.SaveOnConfigSet = saveOnConfigSet; } foreach (KeyValuePair customValue in parsedConfigs.customValues) { if (!isServer) { CustomSyncedValueBase key2 = customValue.Key; if (key2.LocalBaseValue == null) { key2.LocalBaseValue = customValue.Key.BoxedValue; } } customValue.Key.BoxedValue = customValue.Value; } Debug.Log((object)string.Format("Received {0} configs and {1} custom values from {2} for mod {3}", parsedConfigs.configValues.Count, parsedConfigs.customValues.Count, (isServer || clientUpdate) ? $"client {sender}" : "the server", DisplayName ?? Name)); if (!isServer) { serverLockedSettingChanged(); } return true; } finally { ProcessingServerUpdate = false; } } private ParsedConfigs ReadConfigsFromPackage(ZPackage package) { ParsedConfigs parsedConfigs = new ParsedConfigs(); Dictionary dictionary = allConfigs.Where((OwnConfigEntryBase c) => c.SynchronizedConfig).ToDictionary((OwnConfigEntryBase c) => c.BaseConfig.Definition.Section + "_" + c.BaseConfig.Definition.Key, (OwnConfigEntryBase c) => c); Dictionary dictionary2 = allCustomValues.ToDictionary((CustomSyncedValueBase c) => c.Identifier, (CustomSyncedValueBase c) => c); int num = package.ReadInt(); for (int i = 0; i < num; i++) { string text = package.ReadString(); string text2 = package.ReadString(); string text3 = package.ReadString(); Type type = Type.GetType(text3); if (text3 == "" || type != null) { object obj; try { obj = ((text3 == "") ? null : ReadValueWithTypeFromZPackage(package, type)); } catch (InvalidDeserializationTypeException ex) { Debug.LogWarning((object)("Got unexpected struct internal type " + ex.received + " for field " + ex.field + " struct " + text3 + " for " + text2 + " in section " + text + " for mod " + (DisplayName ?? Name) + ", expecting " + ex.expected)); continue; } OwnConfigEntryBase value2; if (text == "Internal") { CustomSyncedValueBase value; if (text2 == "serverversion") { if (obj?.ToString() != CurrentVersion) { Debug.LogWarning((object)("Received server version is not equal: server version = " + (obj?.ToString() ?? "null") + "; local version = " + (CurrentVersion ?? "unknown"))); } } else if (text2 == "lockexempt") { if (obj is bool flag) { lockExempt = flag; } } else if (dictionary2.TryGetValue(text2, out value)) { if ((text3 == "" && (!value.Type.IsValueType || Nullable.GetUnderlyingType(value.Type) != null)) || GetZPackageTypeString(value.Type) == text3) { parsedConfigs.customValues[value] = obj; continue; } Debug.LogWarning((object)("Got unexpected type " + text3 + " for internal value " + text2 + " for mod " + (DisplayName ?? Name) + ", expecting " + value.Type.AssemblyQualifiedName)); } } else if (dictionary.TryGetValue(text + "_" + text2, out value2)) { Type type2 = configType(value2.BaseConfig); if ((text3 == "" && (!type2.IsValueType || Nullable.GetUnderlyingType(type2) != null)) || GetZPackageTypeString(type2) == text3) { parsedConfigs.configValues[value2] = obj; continue; } Debug.LogWarning((object)("Got unexpected type " + text3 + " for " + text2 + " in section " + text + " for mod " + (DisplayName ?? Name) + ", expecting " + type2.AssemblyQualifiedName)); } else { Debug.LogWarning((object)("Received unknown config entry " + text2 + " in section " + text + " for mod " + (DisplayName ?? Name) + ". This may happen if client and server versions of the mod do not match.")); } continue; } Debug.LogWarning((object)("Got invalid type " + text3 + ", abort reading of received configs")); return new ParsedConfigs(); } return parsedConfigs; } private static bool isWritableConfig(OwnConfigEntryBase config) { OwnConfigEntryBase config2 = config; ConfigSync configSync = configSyncs.FirstOrDefault((ConfigSync cs) => cs.allConfigs.Contains(config2)); if (configSync == null) { return true; } return configSync.IsSourceOfTruth || !config2.SynchronizedConfig || config2.LocalBaseValue == null || (!configSync.IsLocked && (config2 != configSync.lockedConfig || lockExempt)); } private void serverLockedSettingChanged() { foreach (OwnConfigEntryBase allConfig in allConfigs) { configAttribute(allConfig.BaseConfig).ReadOnly = !isWritableConfig(allConfig); } } private void resetConfigsFromServer() { ConfigFile val = null; bool saveOnConfigSet = false; foreach (OwnConfigEntryBase item in allConfigs.Where((OwnConfigEntryBase config) => config.LocalBaseValue != null)) { if (val == null) { val = item.BaseConfig.ConfigFile; saveOnConfigSet = val.SaveOnConfigSet; val.SaveOnConfigSet = false; } item.BaseConfig.BoxedValue = item.LocalBaseValue; item.LocalBaseValue = null; } if (val != null) { val.SaveOnConfigSet = saveOnConfigSet; } foreach (CustomSyncedValueBase item2 in allCustomValues.Where((CustomSyncedValueBase config) => config.LocalBaseValue != null)) { item2.BoxedValue = item2.LocalBaseValue; item2.LocalBaseValue = null; } lockedConfigChanged -= serverLockedSettingChanged; serverLockedSettingChanged(); } private IEnumerator distributeConfigToPeers(ZNetPeer peer, ZPackage package) { ZNetPeer peer2 = peer; ZRoutedRpc rpc = ZRoutedRpc.instance; if (rpc == null) { yield break; } byte[] data = package.GetArray(); if (data != null && data.LongLength > 250000) { int fragments = (int)(1 + (data.LongLength - 1) / 250000); long packageIdentifier = ++packageCounter; int fragment = 0; while (fragment < fragments) { foreach (bool item in waitForQueue()) { yield return item; } if (peer2.m_socket.IsConnected()) { ZPackage fragmentedPackage = new ZPackage(); fragmentedPackage.Write((byte)2); fragmentedPackage.Write(packageIdentifier); fragmentedPackage.Write(fragment); fragmentedPackage.Write(fragments); fragmentedPackage.Write(data.Skip(250000 * fragment).Take(250000).ToArray()); SendPackage(fragmentedPackage); if (fragment != fragments - 1) { yield return true; } int num = fragment + 1; fragment = num; continue; } break; } yield break; } foreach (bool item2 in waitForQueue()) { yield return item2; } SendPackage(package); void SendPackage(ZPackage pkg) { string text = Name + " ConfigSync"; if (isServer) { peer2.m_rpc.Invoke(text, new object[1] { pkg }); } else { rpc.InvokeRoutedRPC(peer2.m_server ? 0 : peer2.m_uid, text, new object[1] { pkg }); } } IEnumerable waitForQueue() { float timeout = Time.time + 30f; while (peer2.m_socket.GetSendQueueSize() > 20000) { if (Time.time > timeout) { Debug.Log((object)$"Disconnecting {peer2.m_uid} after 30 seconds config sending timeout"); peer2.m_rpc.Invoke("Error", new object[1] { (object)(ConnectionStatus)5 }); ZNet.instance.Disconnect(peer2); break; } yield return false; } } } private IEnumerator sendZPackage(long target, ZPackage package) { if (!Object.op_Implicit((Object)(object)ZNet.instance)) { return Enumerable.Empty().GetEnumerator(); } List list = (List)AccessTools.DeclaredField(typeof(ZRoutedRpc), "m_peers").GetValue(ZRoutedRpc.instance); if (target != ZRoutedRpc.Everybody) { list = list.Where((ZNetPeer p) => p.m_uid == target).ToList(); } return sendZPackage(list, package); } private IEnumerator sendZPackage(List peers, ZPackage package) { ZPackage package2 = package; if (!Object.op_Implicit((Object)(object)ZNet.instance)) { yield break; } byte[] rawData = package2.GetArray(); if (rawData != null && rawData.LongLength > 10000) { ZPackage compressedPackage = new ZPackage(); compressedPackage.Write((byte)4); MemoryStream output = new MemoryStream(); using (DeflateStream deflateStream = new DeflateStream(output, CompressionLevel.Optimal)) { deflateStream.Write(rawData, 0, rawData.Length); } compressedPackage.Write(output.ToArray()); package2 = compressedPackage; } List> writers = (from peer in peers where peer.IsReady() select peer into p select distributeConfigToPeers(p, package2)).ToList(); writers.RemoveAll((IEnumerator writer) => !writer.MoveNext()); while (writers.Count > 0) { yield return null; writers.RemoveAll((IEnumerator writer) => !writer.MoveNext()); } } private void Broadcast(long target, params ConfigEntryBase[] configs) { if (!IsLocked || isServer) { ZPackage package = ConfigsToPackage(configs); ZNet instance = ZNet.instance; if (instance != null) { ((MonoBehaviour)instance).StartCoroutine(sendZPackage(target, package)); } } } private void Broadcast(long target, params CustomSyncedValueBase[] customValues) { if (!IsLocked || isServer) { ZPackage package = ConfigsToPackage(null, customValues); ZNet instance = ZNet.instance; if (instance != null) { ((MonoBehaviour)instance).StartCoroutine(sendZPackage(target, package)); } } } private static OwnConfigEntryBase? configData(ConfigEntryBase config) { return config.Description.Tags?.OfType().SingleOrDefault(); } public static SyncedConfigEntry? ConfigData(ConfigEntry config) { return ((ConfigEntryBase)config).Description.Tags?.OfType>().SingleOrDefault(); } private static T configAttribute(ConfigEntryBase config) { return config.Description.Tags.OfType().First(); } private static Type configType(ConfigEntryBase config) { return configType(config.SettingType); } private static Type configType(Type type) { return type.IsEnum ? Enum.GetUnderlyingType(type) : type; } private static ZPackage ConfigsToPackage(IEnumerable? configs = null, IEnumerable? customValues = null, IEnumerable? packageEntries = null, bool partial = true) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown List list = configs?.Where((ConfigEntryBase config) => configData(config).SynchronizedConfig).ToList() ?? new List(); List list2 = customValues?.ToList() ?? new List(); ZPackage val = new ZPackage(); val.Write((byte)(partial ? 1 : 0)); val.Write(list.Count + list2.Count + (packageEntries?.Count() ?? 0)); foreach (PackageEntry item in packageEntries ?? Array.Empty()) { AddEntryToPackage(val, item); } foreach (CustomSyncedValueBase item2 in list2) { AddEntryToPackage(val, new PackageEntry { section = "Internal", key = item2.Identifier, type = item2.Type, value = item2.BoxedValue }); } foreach (ConfigEntryBase item3 in list) { AddEntryToPackage(val, new PackageEntry { section = item3.Definition.Section, key = item3.Definition.Key, type = configType(item3), value = item3.BoxedValue }); } return val; } private static void AddEntryToPackage(ZPackage package, PackageEntry entry) { package.Write(entry.section); package.Write(entry.key); package.Write((entry.value == null) ? "" : GetZPackageTypeString(entry.type)); AddValueToZPackage(package, entry.value); } private static string GetZPackageTypeString(Type type) { return type.AssemblyQualifiedName; } private static void AddValueToZPackage(ZPackage package, object? value) { Type type = value?.GetType(); if (value is Enum) { value = ((IConvertible)value).ToType(Enum.GetUnderlyingType(value.GetType()), CultureInfo.InvariantCulture); } else { if (value is ICollection collection) { package.Write(collection.Count); { foreach (object item in collection) { AddValueToZPackage(package, item); } return; } } if ((object)type != null && type.IsValueType && !type.IsPrimitive) { FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); package.Write(fields.Length); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { package.Write(GetZPackageTypeString(fieldInfo.FieldType)); AddValueToZPackage(package, fieldInfo.GetValue(value)); } return; } } ZRpc.Serialize(new object[1] { value }, ref package); } private static object ReadValueWithTypeFromZPackage(ZPackage package, Type type) { if ((object)type != null && type.IsValueType && !type.IsPrimitive && !type.IsEnum) { FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); int num = package.ReadInt(); if (num != fields.Length) { throw new InvalidDeserializationTypeException { received = $"(field count: {num})", expected = $"(field count: {fields.Length})" }; } object uninitializedObject = FormatterServices.GetUninitializedObject(type); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { string text = package.ReadString(); if (text != GetZPackageTypeString(fieldInfo.FieldType)) { throw new InvalidDeserializationTypeException { received = text, expected = GetZPackageTypeString(fieldInfo.FieldType), field = fieldInfo.Name }; } fieldInfo.SetValue(uninitializedObject, ReadValueWithTypeFromZPackage(package, fieldInfo.FieldType)); } return uninitializedObject; } if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<, >)) { int num2 = package.ReadInt(); IDictionary dictionary = (IDictionary)Activator.CreateInstance(type); Type type2 = typeof(KeyValuePair<, >).MakeGenericType(type.GenericTypeArguments); FieldInfo field = type2.GetField("key", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field2 = type2.GetField("value", BindingFlags.Instance | BindingFlags.NonPublic); for (int j = 0; j < num2; j++) { object obj = ReadValueWithTypeFromZPackage(package, type2); dictionary.Add(field.GetValue(obj), field2.GetValue(obj)); } return dictionary; } if (type != typeof(List) && type.IsGenericType) { Type type3 = typeof(ICollection<>).MakeGenericType(type.GenericTypeArguments[0]); if ((object)type3 != null && type3.IsAssignableFrom(type)) { int num3 = package.ReadInt(); object obj2 = Activator.CreateInstance(type); MethodInfo method = type3.GetMethod("Add"); for (int k = 0; k < num3; k++) { method.Invoke(obj2, new object[1] { ReadValueWithTypeFromZPackage(package, type.GenericTypeArguments[0]) }); } return obj2; } } ParameterInfo parameterInfo = (ParameterInfo)FormatterServices.GetUninitializedObject(typeof(ParameterInfo)); AccessTools.DeclaredField(typeof(ParameterInfo), "ClassImpl").SetValue(parameterInfo, type); List source = new List(); ZRpc.Deserialize(new ParameterInfo[2] { null, parameterInfo }, package, ref source); return source.First(); } } [PublicAPI] [HarmonyPatch] internal class VersionCheck { private static readonly HashSet versionChecks; private static readonly Dictionary notProcessedNames; public string Name; private string? displayName; private string? currentVersion; private string? minimumRequiredVersion; public bool ModRequired = true; private string? ReceivedCurrentVersion; private string? ReceivedMinimumRequiredVersion; private readonly List ValidatedClients = new List(); private ConfigSync? ConfigSync; public string DisplayName { get { return displayName ?? Name; } set { displayName = value; } } public string CurrentVersion { get { return currentVersion ?? "0.0.0"; } set { currentVersion = value; } } public string MinimumRequiredVersion { get { return minimumRequiredVersion ?? (ModRequired ? CurrentVersion : "0.0.0"); } set { minimumRequiredVersion = value; } } private static void PatchServerSync() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown Patches patchInfo = PatchProcessor.GetPatchInfo((MethodBase)AccessTools.DeclaredMethod(typeof(ZNet), "Awake", (Type[])null, (Type[])null)); if (patchInfo != null && patchInfo.Postfixes.Count((Patch p) => p.PatchMethod.DeclaringType == typeof(ConfigSync.RegisterRPCPatch)) > 0) { return; } Harmony val = new Harmony("org.bepinex.helpers.ServerSync"); foreach (Type item in from t in typeof(ConfigSync).GetNestedTypes(BindingFlags.NonPublic).Concat(new Type[1] { typeof(VersionCheck) }) where t.IsClass select t) { val.PatchAll(item); } } static VersionCheck() { versionChecks = new HashSet(); notProcessedNames = new Dictionary(); typeof(ThreadingHelper).GetMethod("StartSyncInvoke").Invoke(ThreadingHelper.Instance, new object[1] { new Action(PatchServerSync) }); } public VersionCheck(string name) { Name = name; ModRequired = true; versionChecks.Add(this); } public VersionCheck(ConfigSync configSync) { ConfigSync = configSync; Name = ConfigSync.Name; versionChecks.Add(this); } public void Initialize() { ReceivedCurrentVersion = null; ReceivedMinimumRequiredVersion = null; if (ConfigSync != null) { Name = ConfigSync.Name; DisplayName = ConfigSync.DisplayName; CurrentVersion = ConfigSync.CurrentVersion; MinimumRequiredVersion = ConfigSync.MinimumRequiredVersion; ModRequired = ConfigSync.ModRequired; } } private bool IsVersionOk() { if (ReceivedMinimumRequiredVersion == null || ReceivedCurrentVersion == null) { return !ModRequired; } bool flag = new Version(CurrentVersion) >= new Version(ReceivedMinimumRequiredVersion); bool flag2 = new Version(ReceivedCurrentVersion) >= new Version(MinimumRequiredVersion); return flag && flag2; } private string ErrorClient() { if (ReceivedMinimumRequiredVersion == null) { return DisplayName + " is not installed on the server."; } return (new Version(CurrentVersion) >= new Version(ReceivedMinimumRequiredVersion)) ? (DisplayName + " may not be higher than version " + ReceivedCurrentVersion + ". You have version " + CurrentVersion + ".") : (DisplayName + " needs to be at least version " + ReceivedMinimumRequiredVersion + ". You have version " + CurrentVersion + "."); } private string ErrorServer(ZRpc rpc) { return "Disconnect: The client (" + rpc.GetSocket().GetHostName() + ") doesn't have the correct " + DisplayName + " version " + MinimumRequiredVersion; } private string Error(ZRpc? rpc = null) { return (rpc == null) ? ErrorClient() : ErrorServer(rpc); } private static VersionCheck[] GetFailedClient() { return versionChecks.Where((VersionCheck check) => !check.IsVersionOk()).ToArray(); } private static VersionCheck[] GetFailedServer(ZRpc rpc) { ZRpc rpc2 = rpc; return versionChecks.Where((VersionCheck check) => check.ModRequired && !check.ValidatedClients.Contains(rpc2)).ToArray(); } private static void Logout() { Game.instance.Logout(true, true); AccessTools.DeclaredField(typeof(ZNet), "m_connectionStatus").SetValue(null, (object)(ConnectionStatus)3); } private static void DisconnectClient(ZRpc rpc) { rpc.Invoke("Error", new object[1] { 3 }); } private static void CheckVersion(ZRpc rpc, ZPackage pkg) { CheckVersion(rpc, pkg, null); } private static void CheckVersion(ZRpc rpc, ZPackage pkg, Action? original) { string text = pkg.ReadString(); string text2 = pkg.ReadString(); string text3 = pkg.ReadString(); bool flag = false; foreach (VersionCheck versionCheck in versionChecks) { if (!(text != versionCheck.Name)) { Debug.Log((object)("Received " + versionCheck.DisplayName + " version " + text3 + " and minimum version " + text2 + " from the " + (ZNet.instance.IsServer() ? "client" : "server") + ".")); versionCheck.ReceivedMinimumRequiredVersion = text2; versionCheck.ReceivedCurrentVersion = text3; if (ZNet.instance.IsServer() && versionCheck.IsVersionOk()) { versionCheck.ValidatedClients.Add(rpc); } flag = true; } } if (flag) { return; } pkg.SetPos(0); if (original != null) { original(rpc, pkg); if (pkg.GetPos() == 0) { notProcessedNames.Add(text, text3); } } } [HarmonyPrefix] [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] private static bool RPC_PeerInfo(ZRpc rpc, ZNet __instance) { VersionCheck[] array = (__instance.IsServer() ? GetFailedServer(rpc) : GetFailedClient()); if (array.Length == 0) { return true; } VersionCheck[] array2 = array; foreach (VersionCheck versionCheck in array2) { Debug.LogWarning((object)versionCheck.Error(rpc)); } if (__instance.IsServer()) { DisconnectClient(rpc); } else { Logout(); } return false; } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] [HarmonyPrefix] private static void RegisterAndCheckVersion(ZNetPeer peer, ZNet __instance) { //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown notProcessedNames.Clear(); IDictionary dictionary = (IDictionary)typeof(ZRpc).GetField("m_functions", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(peer.m_rpc); if (dictionary.Contains(StringExtensionMethods.GetStableHashCode("ServerSync VersionCheck"))) { object obj = dictionary[StringExtensionMethods.GetStableHashCode("ServerSync VersionCheck")]; Action action = (Action)obj.GetType().GetField("m_action", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(obj); peer.m_rpc.Register("ServerSync VersionCheck", (Action)delegate(ZRpc rpc, ZPackage pkg) { CheckVersion(rpc, pkg, action); }); } else { peer.m_rpc.Register("ServerSync VersionCheck", (Action)CheckVersion); } foreach (VersionCheck versionCheck in versionChecks) { versionCheck.Initialize(); if (versionCheck.ModRequired || __instance.IsServer()) { Debug.Log((object)("Sending " + versionCheck.DisplayName + " version " + versionCheck.CurrentVersion + " and minimum version " + versionCheck.MinimumRequiredVersion + " to the " + (__instance.IsServer() ? "client" : "server") + ".")); ZPackage val = new ZPackage(); val.Write(versionCheck.Name); val.Write(versionCheck.MinimumRequiredVersion); val.Write(versionCheck.CurrentVersion); peer.m_rpc.Invoke("ServerSync VersionCheck", new object[1] { val }); } } } [HarmonyPatch(typeof(ZNet), "Disconnect")] [HarmonyPrefix] private static void RemoveDisconnected(ZNetPeer peer, ZNet __instance) { if (!__instance.IsServer()) { return; } foreach (VersionCheck versionCheck in versionChecks) { versionCheck.ValidatedClients.Remove(peer.m_rpc); } } [HarmonyPatch(typeof(FejdStartup), "ShowConnectError")] [HarmonyPostfix] private static void ShowConnectionError(FejdStartup __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) if (!__instance.m_connectionFailedPanel.activeSelf || (int)ZNet.GetConnectionStatus() != 3) { return; } bool flag = false; VersionCheck[] failedClient = GetFailedClient(); if (failedClient.Length != 0) { string text = string.Join("\n", failedClient.Select((VersionCheck check) => check.Error())); TMP_Text connectionFailedError = __instance.m_connectionFailedError; connectionFailedError.text = connectionFailedError.text + "\n" + text; flag = true; } foreach (KeyValuePair item in notProcessedNames.OrderBy, string>((KeyValuePair kv) => kv.Key)) { if (!__instance.m_connectionFailedError.text.Contains(item.Key)) { TMP_Text connectionFailedError2 = __instance.m_connectionFailedError; connectionFailedError2.text = connectionFailedError2.text + "\nServer expects you to have " + item.Key + " (Version: " + item.Value + ") installed."; flag = true; } } if (flag) { RectTransform component = ((Component)__instance.m_connectionFailedPanel.transform.Find("Image")).GetComponent(); Vector2 sizeDelta = component.sizeDelta; sizeDelta.x = 675f; component.sizeDelta = sizeDelta; __instance.m_connectionFailedError.ForceMeshUpdate(false, false); float num = __instance.m_connectionFailedError.renderedHeight + 105f; RectTransform component2 = ((Component)((Component)component).transform.Find("ButtonOk")).GetComponent(); component2.anchoredPosition = new Vector2(component2.anchoredPosition.x, component2.anchoredPosition.y - (num - component.sizeDelta.y) / 2f); sizeDelta = component.sizeDelta; sizeDelta.y = num; component.sizeDelta = sizeDelta; } } } }