Decompiled source of Better Minimap v1.0.0

BepInEx/plugins/Better_Minimap.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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon.Movement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MiniPrince123")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0.6+03fe48f5cc90cf6f6f4e8306d0214af4ef5c7aa3")]
[assembly: AssemblyProduct("Better_Minimap")]
[assembly: AssemblyTitle("Better_Minimap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 MyMycoModRoot
{
	internal static class Configs
	{
		public static ConfigEntry<bool> SideObjectivesRevealed { get; private set; }

		public static ConfigEntry<bool> NorthUp { get; private set; }

		public static ConfigEntry<short> ZoomAmount { get; private set; }

		internal static void Initialize(ConfigFile configFile)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			SideObjectivesRevealed = configFile.Bind<bool>("Features", "Reveal Side Objectives", true, "If true, reveals what each side objectives are without having to go near them.");
			NorthUp = configFile.Bind<bool>("Features", "North Up", true, "If true, north will always point upwards.");
			ZoomAmount = configFile.Bind<short>("Features", "Zoom Amount", (short)180, new ConfigDescription("Changes how zoomed in the minimap is. (lower = more zoomed in)", (AcceptableValueBase)(object)new AcceptableValueRange<short>((short)1, (short)512), Array.Empty<object>()));
			ZoomAmount.SettingChanged += delegate
			{
				ZoomAmount.Value = (short)Mathf.Clamp((int)ZoomAmount.Value, 1, 512);
			};
		}
	}
	[HarmonyPatch]
	internal static class MinimapRotation
	{
		[HarmonyPatch(typeof(Minimap), "UpdatePing")]
		[HarmonyPrefix]
		private static void Prefix(ref Quaternion rotation)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (Configs.NorthUp.Value)
			{
				rotation = Quaternion.identity;
			}
		}

		[HarmonyPatch(typeof(Minimap), "UpdateMinimap")]
		[HarmonyPostfix]
		private static void Postfix(Minimap __instance)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (Configs.NorthUp.Value)
			{
				((Component)__instance.mapRenderer).transform.localRotation = Quaternion.identity;
				((Transform)__instance.playerPointer.rectTransform).localRotation = Quaternion.Euler(0f, 0f, 0f - ((Quaternion)(ref PlayerLook.Rotation)).eulerAngles.y);
			}
		}
	}
	[HarmonyPatch]
	internal static class MinimapScale
	{
		[HarmonyPatch(typeof(Minimap), "UpdateMinimap")]
		[HarmonyPostfix]
		private static void Postfix(Minimap __instance)
		{
			__instance.minimapWorldRadius = Configs.ZoomAmount.Value;
		}
	}
	[HarmonyPatch]
	internal static class MinimapSideObjectivesPatch
	{
		[HarmonyPatch(typeof(Waypoint), "EncounterWaypoint")]
		[HarmonyPostfix]
		private static void Postfix(ref Waypoint __result)
		{
			if (Configs.SideObjectivesRevealed.Value && (double)__result.NearbyIconDistance > 0.0)
			{
				__result.UseNearbyIcon = true;
			}
		}
	}
	[MycoMod(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("miniprince123.better_minimap", "Better_Minimap", "0.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin Better_Minimap (miniprince123.better_minimap 0.0.0) is loaded!");
			Configs.Initialize(((BaseUnityPlugin)this).Config);
			Logger.LogInfo((object)("Config initialized: " + $"SideObjectivesRevealed={Configs.SideObjectivesRevealed.Value}, " + $"NorthUp={Configs.NorthUp.Value}, " + $"ZoomAmount={Configs.ZoomAmount.Value}"));
			_harmony = new Harmony("miniprince123.better_minimap");
			_harmony.PatchAll();
			Logger.LogInfo((object)"Harmony patches applied");
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "miniprince123.better_minimap";

		public const string PLUGIN_NAME = "Better_Minimap";

		public const string PLUGIN_VERSION = "0.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}