Decompiled source of OverprotectedFacilities v1.0.0

OverprotectedFacilities.dll

Decompiled 11 months ago
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 UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ManyMines")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ManyMines")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c6b5bcab-a476-4c3e-89d7-46fa1428ffde")]
[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 ManyMines;

[BepInPlugin("SalakStudios.OverprotectedFacilities", "OverprotectedFacilities", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private const string modGUID = "SalakStudios.OverprotectedFacilities";

	private const string modName = "OverprotectedFacilities";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("SalakStudios.OverprotectedFacilities");

	internal static Plugin Instance;

	public static ManualLogSource mls;

	public static GameObject landmine;

	public static GameObject turret;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		mls = Logger.CreateLogSource("SalakStudios.OverprotectedFacilities");
		mls.LogInfo((object)"OverprotectedFacilities Enabled");
		harmony.PatchAll(typeof(Plugin));
	}

	public static void UpdateMapObjects(SelectableLevel newLevel)
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Expected O, but got Unknown
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Expected O, but got Unknown
		SpawnableMapObject[] spawnableMapObjects = newLevel.spawnableMapObjects;
		SpawnableMapObject[] array = spawnableMapObjects;
		foreach (SpawnableMapObject val in array)
		{
			if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Landmine>() != (Object)null)
			{
				landmine = val.prefabToSpawn;
				val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
				{
					new Keyframe(0f, 100f),
					new Keyframe(1f, 100f)
				});
			}
			else if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Turret>() != (Object)null)
			{
				turret = val.prefabToSpawn;
				val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
				{
					new Keyframe(0f, 40f),
					new Keyframe(1f, 40f)
				});
			}
		}
	}

	[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
	[HarmonyPrefix]
	private static bool ModifyLevel(ref SelectableLevel newLevel)
	{
		UpdateMapObjects(newLevel);
		return true;
	}
}