Decompiled source of DangerousApparatus v1.0.0

DangerousApparatus.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.Linq;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DangerousApparatus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Spawns a Bracken when the apparatus is taken from the facility.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DangerousApparatus")]
[assembly: AssemblyTitle("DangerousApparatus")]
[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 MyFirstPlugin
{
	[HarmonyPatch(typeof(LungProp), "DisconnectFromMachinery")]
	public class LungPropPatch
	{
		private static void Postfix()
		{
			Plugin.Singleton.MainLogger.LogInfo((object)"Apparatus disconnected from facility. Attempting to spawn Bracken...");
			RoundManager instance = RoundManager.Instance;
			EnemyVent val = instance.allEnemyVents.First((EnemyVent e) => !e.occupied);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Plugin.Singleton.MainLogger.LogError((object)"Couldn't spawn Bracken!");
				return;
			}
			for (int i = 0; i < instance.currentLevel.Enemies.Count; i++)
			{
				SpawnableEnemyWithRarity val2 = instance.currentLevel.Enemies[i];
				if (!(val2.enemyType.enemyName != "Flowerman"))
				{
					val.enemyType = val2.enemyType;
					val.enemyTypeIndex = i;
					instance.SpawnEnemyFromVent(val);
					Plugin.Singleton.MainLogger.LogInfo((object)"Bracken spawned!");
					break;
				}
			}
		}
	}
	[BepInPlugin("Exortile.DangerousApparatus", "DangerousApparatus", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Singleton { get; private set; }

		public ManualLogSource MainLogger { get; private set; }

		private void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			Singleton = this;
			MainLogger = Logger.CreateLogSource("DangerousApparatusLog");
			Harmony val = new Harmony("com.exortile.dangerousapparatus");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin DangerousApparatus is loaded!");
		}
	}
	[HarmonyPatch(typeof(RoundManager), "SpawnEnemyFromVent")]
	public class RoundManagerPatch
	{
		private static void Postfix(EnemyVent vent)
		{
			Plugin.Singleton.MainLogger.LogInfo((object)("Spawned " + vent.enemyType.enemyName + " at vent " + ((Object)vent).name));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "DangerousApparatus";

		public const string PLUGIN_NAME = "DangerousApparatus";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}