Decompiled source of MegabonkMinimap v0.3.0

MegabonkMinimap.dll

Decompiled a day 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 Assets.Scripts.Camera;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("MegabonkMinimap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Template Mod")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+ad033e99a58fd3d66536d76151c1362d165f8606")]
[assembly: AssemblyProduct("MegabonkMinimap")]
[assembly: AssemblyTitle("MegabonkMinimap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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 MegabonkMinimap
{
	[BepInPlugin("svindler_MegabonkMinimap", "MegabonkMinimap", "0.3.0")]
	public class Plugin : BasePlugin
	{
		[HarmonyPatch(typeof(MinimapUi), "UpdateScale")]
		public static class MinimapUi_UpdateScale_Patch
		{
			private static void Prefix(ref float scale)
			{
				scale = MinimapSize.Value;
			}
		}

		[HarmonyPatch(typeof(MinimapCamera), "Start")]
		public static class MinimapCamera_Start_Patch
		{
			private static void Postfix(MinimapCamera __instance)
			{
				if (!((Object)(object)((__instance != null) ? __instance.minimapCamera : null) == (Object)null))
				{
					__instance.minimapCamera.orthographicSize = MinimapZoom.Value;
				}
			}
		}

		[HarmonyPatch(typeof(MinimapCamera), "TrySpotBossSpawner")]
		public static class MinimapCamera_TrySpotBossSpawner_Patch
		{
			private static readonly PropertyInfo BossSpawnerProp = AccessTools.Property(typeof(MinimapCamera), "bossSpawner");

			private static bool Prefix(MinimapCamera __instance)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)__instance == (Object)null)
				{
					return true;
				}
				object? obj = BossSpawnerProp?.GetValue(__instance);
				Transform val = (Transform)((obj is Transform) ? obj : null);
				if ((Object)(object)val == (Object)null)
				{
					return true;
				}
				if (AlwaysShowBoss.Value && !__instance.bossSpotted)
				{
					__instance.AddArrow(val, __instance.bossColor);
					__instance.bossSpotted = true;
					return false;
				}
				return true;
			}
		}

		public const string MODNAME = "MegabonkMinimap";

		public const string AUTHOR = "svindler";

		public const string GUID = "svindler_MegabonkMinimap";

		public const string VERSION = "0.3.0";

		public static ManualLogSource log;

		internal static ConfigEntry<float> MinimapSize;

		internal static ConfigEntry<float> MinimapZoom;

		internal static ConfigEntry<bool> AlwaysShowBoss;

		public Plugin()
		{
			log = ((BasePlugin)this).Log;
		}

		public override void Load()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			MinimapSize = ((BasePlugin)this).Config.Bind<float>("Minimap", "Size", 1.5f, "Scale of the minimap UI (higher = bigger minimap on screen).");
			MinimapZoom = ((BasePlugin)this).Config.Bind<float>("Minimap", "Zoom", 110f, "Zoom level of the minimap camera.\nHigher = zoomed out (see more of the map).\nLower = zoomed in (see less).");
			AlwaysShowBoss = ((BasePlugin)this).Config.Bind<bool>("Minimap", "AlwaysShowBossArrow", false, "If true, the minimap creates the boss arrow immediately.\nIf false, the arrow only appears after the portal is spotted (default behaviour).");
			ManualLogSource obj = log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loading ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MegabonkMinimap");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("0.3.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" by ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("svindler");
			}
			obj.LogInfo(val);
			new Harmony("svindler_MegabonkMinimap").PatchAll();
			ManualLogSource obj2 = log;
			val = new BepInExInfoLogInterpolatedStringHandler(8, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MegabonkMinimap");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded.");
			}
			obj2.LogInfo(val);
		}
	}
}