using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Nessie.ATLYSS.EasySettings;
using UnityEngine;
using UnityEngine.Events;
[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("ChatX")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("ChatX")]
[assembly: AssemblyTitle("ChatX")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ChatX
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ChatX";
public const string PLUGIN_NAME = "ChatX";
public const string PLUGIN_VERSION = "1.1.0";
}
}
namespace AtlyssAlwaysChat
{
[BepInPlugin("ChatX", "ChatX", "1.1.0")]
public class AlwaysChatPlugin : BaseUnityPlugin
{
internal static ConfigEntry<bool> chatOverride;
internal static ConfigEntry<float> chatOpacity;
internal static ConfigEntry<bool> blockChat;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
Harmony val = new Harmony("ChatX");
val.PatchAll();
InitConfig();
Settings.OnInitialized.AddListener(new UnityAction(AddSettings));
Settings.OnApplySettings.AddListener((UnityAction)delegate
{
((BaseUnityPlugin)this).Config.Save();
});
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AlwaysChat Loaded Successfully!");
}
private void InitConfig()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
ConfigDefinition val = new ConfigDefinition("ChatX", "Chat Override");
ConfigDescription val2 = new ConfigDescription("Overrides chat opacity", (AcceptableValueBase)null, Array.Empty<object>());
chatOverride = ((BaseUnityPlugin)this).Config.Bind<bool>(val, true, val2);
ConfigDefinition val3 = new ConfigDefinition("ChatX", "Opacity");
ConfigDescription val4 = new ConfigDescription("Sets the desired opacity", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>());
chatOpacity = ((BaseUnityPlugin)this).Config.Bind<float>(val3, 1f, val4);
ConfigDefinition val5 = new ConfigDefinition("ChatX", "Block Chat");
ConfigDescription val6 = new ConfigDescription("Completely blocks chat messages from appearing.", (AcceptableValueBase)null, Array.Empty<object>());
blockChat = ((BaseUnityPlugin)this).Config.Bind<bool>(val5, false, val6);
}
private void AddSettings()
{
SettingsTab modTab = Settings.ModTab;
modTab.AddHeader("ChatX");
modTab.AddToggle("Chat Override", chatOverride);
modTab.AddAdvancedSlider("Opacity", chatOpacity, false);
modTab.AddToggle("Block Chat", blockChat);
}
}
[HarmonyPatch(typeof(ChatBehaviour), "New_ChatMessage")]
public static class ChatBehaviourNewMessagePatch
{
private static bool Prefix(ChatBehaviour __instance, ref string _message)
{
if (AlwaysChatPlugin.blockChat.Value)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(ChatBehaviour), "Rpc_RecieveChatMessage")]
public static class ChatBehaviourRpcMessagePatch
{
private static bool Prefix(ChatBehaviour __instance, ref string message)
{
if (AlwaysChatPlugin.blockChat.Value)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(ChatBehaviour), "Display_Chat")]
public static class ChatBehaviourPatch
{
private static FieldInfo _chatTextGroupsField;
static ChatBehaviourPatch()
{
_chatTextGroupsField = typeof(ChatBehaviour).GetField("_chatTextGroups", BindingFlags.Instance | BindingFlags.NonPublic);
}
private static void Postfix(ChatBehaviour __instance, bool _isTrue)
{
CanvasGroup[] array = _chatTextGroupsField?.GetValue(__instance) as CanvasGroup[];
float alpha = (AlwaysChatPlugin.chatOverride.Value ? AlwaysChatPlugin.chatOpacity.Value : (_isTrue ? 1f : 0f));
if (array == null)
{
return;
}
CanvasGroup[] array2 = array;
foreach (CanvasGroup val in array2)
{
if ((Object)(object)val != (Object)null)
{
val.alpha = alpha;
}
}
}
}
}