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.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0")]
[assembly: AssemblyProduct("ChatX")]
[assembly: AssemblyTitle("ChatX")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.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.2.0";
}
}
namespace AtlyssAlwaysChat
{
[BepInPlugin("ChatX", "ChatX", "1.2.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 ChatX Loaded Successfully!");
}
private void InitConfig()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_002c: Expected O, but got Unknown
//IL_0041: 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_006e: Expected O, but got Unknown
//IL_006e: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_009e: Expected O, but got Unknown
chatOverride = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("ChatX", "Chat Override"), true, new ConfigDescription("Overrides chat opacity", (AcceptableValueBase)null, Array.Empty<object>()));
chatOpacity = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("ChatX", "Opacity"), 1f, new ConfigDescription("Sets the desired opacity", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
blockChat = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("ChatX", "Block Chat"), false, new ConfigDescription("Completely blocks chat messages from appearing.", (AcceptableValueBase)null, Array.Empty<object>()));
}
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(ref string _message)
{
if (AlwaysChatPlugin.blockChat.Value)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(ChatBehaviour), "Rpc_RecieveChatMessage")]
public static class ChatBehaviourRpcMessagePatch
{
private static bool Prefix(ref string message)
{
if (AlwaysChatPlugin.blockChat.Value)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(ChatBehaviour), "Display_Chat")]
public static class ChatBehaviourDisplayPatch
{
private static void Postfix(ChatBehaviour __instance, bool _isTrue)
{
if (!AlwaysChatPlugin.chatOverride.Value)
{
return;
}
ChatBehaviourAssets chatAssets = __instance._chatAssets;
if ((Object)(object)chatAssets == (Object)null)
{
return;
}
float value = AlwaysChatPlugin.chatOpacity.Value;
if (chatAssets._chatTextGroups != null)
{
CanvasGroup[] chatTextGroups = chatAssets._chatTextGroups;
foreach (CanvasGroup val in chatTextGroups)
{
if ((Object)(object)val != (Object)null)
{
val.alpha = value;
}
}
}
if ((Object)(object)chatAssets._chatboxTextGroup != (Object)null)
{
chatAssets._chatboxTextGroup.alpha = value;
}
if ((Object)(object)chatAssets._gameLogicGroup != (Object)null)
{
chatAssets._gameLogicGroup.alpha = value;
}
}
}
}