using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using EnemyFix.Patches;
using EnemyFix.Utilities;
using HarmonyLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("EnemyFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EnemyFix")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3fa5fc0f-bb81-41cd-a8f2-d473323e7326")]
[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 EnemyFix
{
[BepInPlugin("SZAKI.EnemyFix", "Enemy FIX", "1.0.0.0")]
[BepInProcess("Lethal Company.exe")]
public class Base : BaseUnityPlugin
{
private static Base _instance;
private static Harmony _harmony;
public static Base Instance
{
get
{
return _instance;
}
private set
{
_instance = value;
}
}
private void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
if (_harmony == null)
{
_harmony = new Harmony("SZAKI.EnemyFix");
}
_harmony.PatchAll(typeof(Base));
_harmony.PatchAll(typeof(RemoveEnemiesPatch));
Logger.LogInfo("Successfully awakened!");
}
}
}
namespace EnemyFix.Utilities
{
public static class Logger
{
private static ManualLogSource _mls;
private static void Log(LogLevel level, object msg)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
if (!string.IsNullOrEmpty(msg.ToString()))
{
if (_mls == null)
{
_mls = Logger.CreateLogSource("Enemy FIX");
}
_mls.Log(level, (object)(" " + msg.ToString()));
}
}
public static void LogInfo(object msg)
{
Log((LogLevel)16, msg);
}
public static void LogWarning(object msg)
{
Log((LogLevel)4, msg);
}
public static void LogError(object msg)
{
Log((LogLevel)2, msg);
}
public static void LogDebug(object msg)
{
Log((LogLevel)32, msg);
}
}
public static class PluginInfos
{
public const string GUID = "SZAKI.EnemyFix";
public const string NAME = "Enemy FIX";
public const string VERSION = "1.0.0.0";
}
}
namespace EnemyFix.Patches
{
[HarmonyPatch(typeof(StartOfRound), "EndOfGame")]
public class RemoveEnemiesPatch
{
[HarmonyPrefix]
public static void Prefix()
{
Logger.LogWarning(">>>> Despawning enemies early to fix the unspawned enemies on the map!");
RoundManager.Instance.UnloadSceneObjectsEarly();
}
}
}