Decompiled source of Dead BEGONE v1.0.0

FixEnemy.dll

Decompiled 10 months ago
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.Logging;
using HarmonyLib;
using LC_API.ServerAPI;
using UnityEngine;
using UnityEngine.SceneManagement;

[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 = "")]
[assembly: AssemblyCompany("FixEnemy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FixEnemy")]
[assembly: AssemblyTitle("FixEnemy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace FixEnemy;

[BepInPlugin("FixEnemy", "FixEnemy", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch]
	internal class EnemyPatch
	{
		[HarmonyPatch(typeof(EnemyAI), "KillEnemy")]
		[HarmonyPostfix]
		public static void FixEnemy(EnemyAI __instance, bool __0)
		{
			Object.Destroy((Object)(object)((Component)__instance).gameObject);
		}
	}

	public static ManualLogSource logger;

	public void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin FixEnemy is loaded!");
		new Harmony("FixEnemy").PatchAll();
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		if (Utils.IsIngame())
		{
			ModdedServer.SetServerModdedOnly();
		}
	}
}
internal class Utils
{
	public static bool IsIngame()
	{
		if ((Object)(object)GameObject.Find("Environment") != (Object)null)
		{
			return true;
		}
		return false;
	}
}
public static class MyPluginInfo
{
	public const string PLUGIN_GUID = "FixEnemy";

	public const string PLUGIN_NAME = "FixEnemy";

	public const string PLUGIN_VERSION = "1.0.0";
}