Decompiled source of Lethal Dismissal v1.1.1

BepInEx/plugins/lethal_dismissal.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TerminalApi;
using TerminalApi.Classes;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("lethal_dismissal")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("lethal_dismissal")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ac114624-b155-4a36-9440-1bf8df227cb0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace lethal_dismissal;

[BepInPlugin("epicsus.lethal_dismissal", "Lethal Dismissal", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(StartOfRound))]
public class Plugin : BaseUnityPlugin
{
	private static readonly Harmony harmony = new Harmony("epicsus.lethal_dismissal");

	private const string GUID = "epicsus.lethal_dismissal";

	private const string NAME = "Lethal Dismissal";

	private const string VERSION = "1.0.1";

	internal static ManualLogSource logger;

	private static Plugin instance;

	public void Awake()
	{
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: 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_00ba: Expected O, but got Unknown
		if ((Object)(object)instance == (Object)null)
		{
			instance = this;
		}
		logger = Logger.CreateLogSource("epicsus.lethal_dismissal");
		try
		{
			logger.LogInfo((object)"Applying patches...");
			harmony.PatchAll();
			logger.LogInfo((object)"Patches applied!");
		}
		catch (Exception ex)
		{
			logger.LogError((object)ex);
		}
		logger.LogInfo((object)"Plugin Lethal Dismissal loaded successfully.");
		TerminalApi.AddCommand("dismissal", new CommandInfo
		{
			DisplayTextSupplier = delegate
			{
				logger.LogWarning((object)"Executing dismissal command.");
				EjectDueToNegligance();
				return "Players have been ejected successfully!";
			},
			Category = "Other"
		}, (string)null, true);
	}

	public static void EjectDueToNegligance()
	{
		StartOfRound val = Object.FindObjectOfType<StartOfRound>();
		if ((Object)(object)val != (Object)null)
		{
			val.ManuallyEjectPlayersServerRpc();
			logger.LogInfo((object)"Players ejected successfully.");
		}
		else
		{
			logger.LogError((object)"StartOfRound object not found. Could not eject players.");
		}
	}

	[HarmonyPatch("OnStart")]
	[HarmonyPostfix]
	public static void Postfix_StartOfRound()
	{
		EjectDueToNegligance();
	}
}