Decompiled source of ScaleMapArrow v1.2.0

ValheimScaleMapArrow.dll

Decompiled 4 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
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("Aidin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Valheim that allows scaling the size of the local player arrow on both the minimap and large map")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+b2198a6d745d657740ff4fc6a7f4d7138aa121a5")]
[assembly: AssemblyProduct("ScaleMapArrow")]
[assembly: AssemblyTitle("ValheimScaleMapArrow")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/aidinabedi/ValheimScaleMapArrow")]
[assembly: AssemblyVersion("1.2.0.0")]
[BepInPlugin("ValheimScaleMapArrow", "ScaleMapArrow", "1.2.0")]
[BepInProcess("valheim.exe")]
public class ScaleMapArrowPlugin : BaseUnityPlugin
{
	private readonly Harmony harmony = new Harmony("ValheimScaleMapArrow");

	private static ConfigEntry<float> minimapScale;

	private static ConfigEntry<float> largemapScale;

	private void Awake()
	{
		minimapScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Minimap Local Player Scale", 1.5f, (ConfigDescription)null);
		largemapScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Largemap Local Player Scale", 1.5f, (ConfigDescription)null);
		minimapScale.SettingChanged += Scale_SettingChanged;
		largemapScale.SettingChanged += Scale_SettingChanged;
		harmony.PatchAll(typeof(ScaleMapArrowPlugin));
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(Minimap), "Start")]
	private static void MinimapStartPostfix(Minimap __instance)
	{
		//IL_0024: 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)
		((Transform)__instance.m_smallMarker).localScale = new Vector3(minimapScale.Value, minimapScale.Value, minimapScale.Value);
		((Transform)__instance.m_largeMarker).localScale = new Vector3(largemapScale.Value, largemapScale.Value, largemapScale.Value);
	}

	private void Scale_SettingChanged(object sender, EventArgs e)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)Minimap.instance))
		{
			((Transform)Minimap.instance.m_smallMarker).localScale = new Vector3(minimapScale.Value, minimapScale.Value, minimapScale.Value);
			((Transform)Minimap.instance.m_largeMarker).localScale = new Vector3(largemapScale.Value, largemapScale.Value, largemapScale.Value);
		}
	}
}
internal static class Manifest
{
	public const string ProjectName = "ValheimScaleMapArrow";

	public const string Product = "ScaleMapArrow";

	public const string Description = "Valheim that allows scaling the size of the local player arrow on both the minimap and large map";

	public const string Version = "1.2.0";

	public const string Authors = "Aidin";
}