using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using ChatboxEdit; using Microsoft.CodeAnalysis; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using RoR2ChatboxEdit; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RoR2ChatboxEdit")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+bc0ed4bd549b9bceb931d8840d046abd65b62896")] [assembly: AssemblyProduct("RoR2ChatboxEdit")] [assembly: AssemblyTitle("RoR2ChatboxEdit")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } } namespace ChatboxEdit { [BepInPlugin("com.DestroyedClone.ChatboxEdit", "ChatboxEdit", "1.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ChatboxEditPlugin : BaseUnityPlugin { public enum ChatExpandMode { Disabled, Expanded, Unlimited } public static GameObject Prefab = Addressables.LoadAssetAsync((object)"RoR2/Base/UI/ChatBox, In Run.prefab").WaitForCompletion(); public static GameObject PrefabLobby = Addressables.LoadAssetAsync((object)"RoR2/Base/UI/ChatBox.prefab").WaitForCompletion(); public static ConfigEntry ScrollableChat; public static ConfigEntry ScrollableChatSensitivity; public static ConfigEntry FadeDelay; public static ConfigEntry FadeDuration; public static ConfigEntry MaxChatMessages; public static ConfigEntry cfgChatExpandeMode; public void Start() { ScrollableChat = ((BaseUnityPlugin)this).Config.Bind("Scrollable Chat", "Enable", true, "If true, allows you to scroll the chat by scrolling or clicking and dragging.\nThe very top of the chat (about 5 messages) will scroll in the opposite direction regardless of choice, weird vanilla thing."); ScrollableChat.SettingChanged += ScrollableChat_SettingChanged; ScrollableChatSensitivity = ((BaseUnityPlugin)this).Config.Bind("Scrollable Chat", "Scroll Sensitivity", 5f, "If Scrollable Chat is active, then adjusts the sensitivity of scrolling."); ScrollableChatSensitivity.SettingChanged += ScrollableChat_SettingChanged; FadeDelay = ((BaseUnityPlugin)this).Config.Bind("Other", "Chat Fade Delay", 5f, "Delay after chat message is received before chatbox fades out."); FadeDelay.SettingChanged += ScrollableChat_SettingChanged; FadeDuration = ((BaseUnityPlugin)this).Config.Bind("Other", "Chat Fade Duration", 5f, "The duration that the chatbox fades out."); FadeDuration.SettingChanged += ScrollableChat_SettingChanged; cfgChatExpandeMode = ((BaseUnityPlugin)this).Config.Bind("Other", "Chat Expand Mode", ChatExpandMode.Disabled, "0. Disabled.\nExpanded = While the input is open, your visible chat increases by about 5 lines.\nUnlimited = All messages can show up on screen, can cover your screen."); cfgChatExpandeMode.SettingChanged += ScrollableChat_SettingChanged; MaxChatMessages = ((BaseUnityPlugin)this).Config.Bind("Other", "Max Chat Messages", 30, "The max amount of chat messages in chat."); Chat.cvChatMaxMessages.value = MaxChatMessages.Value; MaxChatMessages.SettingChanged += delegate { Chat.cvChatMaxMessages.value = MaxChatMessages.Value; }; UpdatePrefab(); ModCompat.Initialize(); } private void ScrollableChat_SettingChanged(object sender, EventArgs e) { UpdatePrefab(); } public void UpdatePrefab() { ChatBox component = Prefab.GetComponent(); ChatBox component2 = PrefabLobby.GetComponent(); ChatBox instance = ChatBox.instance; SetFadeOption(component); SetFadeOption(component2); SetFadeOption(instance); switch (cfgChatExpandeMode.Value) { case ChatExpandMode.Disabled: ExpandOrUnlimitedChatbox(component, allowExpandedChatbox: false, setToTrueToLimitChatbox: true); ExpandOrUnlimitedChatbox(component2, allowExpandedChatbox: false, setToTrueToLimitChatbox: true); ExpandOrUnlimitedChatbox(instance, allowExpandedChatbox: false, setToTrueToLimitChatbox: true); break; case ChatExpandMode.Expanded: ExpandOrUnlimitedChatbox(component, allowExpandedChatbox: true, setToTrueToLimitChatbox: true); ExpandOrUnlimitedChatbox(component2, allowExpandedChatbox: true, setToTrueToLimitChatbox: true); ExpandOrUnlimitedChatbox(instance, allowExpandedChatbox: true, setToTrueToLimitChatbox: true); break; case ChatExpandMode.Unlimited: ExpandOrUnlimitedChatbox(component, allowExpandedChatbox: false, setToTrueToLimitChatbox: false); ExpandOrUnlimitedChatbox(component2, allowExpandedChatbox: false, setToTrueToLimitChatbox: false); ExpandOrUnlimitedChatbox(instance, allowExpandedChatbox: false, setToTrueToLimitChatbox: false); break; } ChatboxScrollModify(component); ChatboxScrollModify(component2); ChatboxScrollModify(instance); static void ChatboxScrollModify(ChatBox chatBox) { if (Object.op_Implicit((Object)(object)chatBox)) { ScrollRect scrollRect = chatBox.scrollRect; ((Behaviour)scrollRect).enabled = ScrollableChat.Value; scrollRect.scrollSensitivity = ScrollableChatSensitivity.Value; scrollRect.vertical = ScrollableChat.Value; } } static void ExpandOrUnlimitedChatbox(ChatBox chatBox, bool allowExpandedChatbox, bool setToTrueToLimitChatbox) { if (Object.op_Implicit((Object)(object)chatBox)) { chatBox.allowExpandedChatbox = allowExpandedChatbox; ((Behaviour)((Component)((Component)chatBox).transform.Find("StandardRect/Scroll View/Viewport/MessageArea/Text Area")).GetComponent()).enabled = setToTrueToLimitChatbox; ((Behaviour)((Component)((Component)chatBox).transform.Find("StandardRect/Scroll View/Viewport")).GetComponent()).enabled = setToTrueToLimitChatbox; ((Behaviour)((Component)((Component)chatBox).transform.Find("StandardRect/Scroll View/Viewport")).GetComponent()).enabled = setToTrueToLimitChatbox; } } static void SetFadeOption(ChatBox chatBox) { if (Object.op_Implicit((Object)(object)chatBox)) { chatBox.fadeTimer = FadeDelay.Value; chatBox.fadeDuration = FadeDuration.Value; } } } } } namespace RoR2ChatboxEdit { public static class ModCompat { public static void Initialize() { if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { RiskOfOptionsCompat(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RiskOfOptionsCompat() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_002b: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0061: 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_0071: 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_008c: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0097: 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_00a7: 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_00c2: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown ModSettingsManager.SetModDescription("Adds scrolling chat and some other stuff.", "com.DestroyedClone.ChatboxEdit", "ChatboxEdit"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ChatboxEditPlugin.ScrollableChat)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(ChatboxEditPlugin.ScrollableChatSensitivity, new StepSliderConfig { min = 1f, max = 10f, increment = 0.5f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(ChatboxEditPlugin.FadeDelay, new StepSliderConfig { min = 1f, max = 100f, increment = 0.5f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(ChatboxEditPlugin.FadeDuration, new StepSliderConfig { min = 1f, max = 100f, increment = 0.5f })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ChatboxEditPlugin.MaxChatMessages)); } } }