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 BepInEx.Logging;
using CG.Ship.LogEvents;
using Gameplay.Chat;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UI.Chat;
using UnityEngine.UIElements;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("QuietChat")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("QuietChat")]
[assembly: AssemblyTitle("QuietChat")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 QuietChat
{
internal static class MyPluginInfo
{
internal const string PLUGIN_GUID = "id107.quietchat";
internal const string PLUGIN_NAME = "QuietChat";
internal const string PLUGIN_VERSION = "0.0.0";
}
[BepInPlugin("id107.quietchat", "QuietChat", "0.0.0")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BepinPlugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "id107.quietchat");
Configs.Load(this);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin id107.quietchat is loaded!");
}
}
internal class Configs
{
internal static ConfigEntry<bool> TemporaryChatConfig;
internal static void Load(BepinPlugin plugin)
{
TemporaryChatConfig = ((BaseUnityPlugin)plugin).Config.Bind<bool>("QuietChat", "TemporaryGameMessages", true, (ConfigDescription)null);
}
}
internal class GUI : ModSettingsMenu
{
public override string Name()
{
return "Quiet Chat";
}
public override void Draw()
{
bool value = Configs.TemporaryChatConfig.Value;
if (GUITools.DrawCheckbox("Temporary game messages", ref value))
{
Configs.TemporaryChatConfig.Value = value;
}
bool flag = !Configs.TemporaryChatConfig.Value;
if (GUITools.DrawCheckbox("No game messages", ref flag))
{
Configs.TemporaryChatConfig.Value = !flag;
}
}
}
[HarmonyPatch(typeof(TextChat), "OnLogEventSent")]
internal class TextChatPatch
{
private static readonly FieldInfo chatUIField = AccessTools.Field(typeof(TextChat), "_chatUI");
private static readonly FieldInfo logViewField = AccessTools.Field(typeof(TextChatVE), "logView");
private static bool Prefix(TextChat __instance, LogEvent obj)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
if (Configs.TemporaryChatConfig.Value)
{
TextChatVE val = (TextChatVE)chatUIField.GetValue(__instance);
ScrollView logView = (ScrollView)logViewField.GetValue(val);
__instance.AddLog(new Log("", obj.Message));
VisualElement log = ((VisualElement)logView).ElementAt(((VisualElement)logView).childCount - 1);
((VisualElement)val).schedule.Execute((Action)delegate
{
((VisualElement)logView).Remove(log);
}).ExecuteLater(8000L);
}
return false;
}
}
public class VoidManagerPlugin : VoidPlugin
{
public override MultiplayerType MPType => (MultiplayerType)3;
public override string Author => "18107";
public override string Description => "Removes chat messages produced by the game.\nPlayer messages are still displayed.";
}
}