Decompiled source of enemyalert v1.0.2

enemyalert.dll

Decompiled 9 months ago
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("enemyalert")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Shows a message when a new outside enemy is spawned")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("enemyalert")]
[assembly: AssemblyTitle("enemyalert")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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 enemyalert
{
	[BepInPlugin("enemyalert", "enemyalert", "1.0.2")]
	[BepInProcess("Lethal Company.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		private void Awake()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"enemyalert v. 1.0.2");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Shows a message whenever a new enemy is spawned outside the ship");
			new Harmony("enemyalert").PatchAll(Assembly.GetExecutingAssembly());
		}

		internal static void NotifyAboutEnemy(ref GameObject enemy)
		{
			string enemyName = enemy.GetComponent<EnemyAI>().enemyType.enemyName;
			string text = $"{TimeOfDay.Instance.normalizedTimeOfDay:p}";
			HUDManager.Instance.AddTextToChatOnServer("<i><color=#ff2400><size=75%>" + text + ": spawned " + enemyName + "</size></color></i>", -1);
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		[HarmonyPatch("SpawnRandomOutsideEnemy")]
		[HarmonyPostfix]
		public static void RandomOutsideEnemySpawned(ref GameObject __result)
		{
			Plugin.NotifyAboutEnemy(ref __result);
		}

		[HarmonyPatch("SpawnRandomDaytimeEnemy")]
		[HarmonyPostfix]
		public static void RandomDaytimeEnemySpawned(ref GameObject __result)
		{
			Plugin.NotifyAboutEnemy(ref __result);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "enemyalert";

		public const string PLUGIN_NAME = "enemyalert";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}