Decompiled source of BetterMap Fixer v1.0.0

BetterMapFixer.dll

Decompiled a day ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BetterMap;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace BetterMapPatch;

[BepInPlugin("BetterMap.Fixer", "BetterMap Fixer", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BetterMapPatch : BaseUnityPlugin
{
	[HarmonyPatch(typeof(BetterMap), "AddPlayerToMap")]
	public static class AddPlayerToMapPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(PlayerAvatar playerAvatar)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)playerAvatar == (Object)null)
			{
				return true;
			}
			MapCustom obj = ((Component)playerAvatar).GetComponent<MapCustom>() ?? ((Component)playerAvatar).gameObject.AddComponent<MapCustom>();
			obj.sprite = _squareSprite;
			obj.color = Color.blue;
			return false;
		}
	}

	private static Sprite _squareSprite;

	private void Awake()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		_squareSprite = CreateSquareSprite();
		new Harmony("BetterMap.Fixer").PatchAll();
	}

	private static Sprite CreateSquareSprite()
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Expected O, but got Unknown
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(5, 5, (TextureFormat)4, false);
		Color[] array = (Color[])(object)new Color[25];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = Color.white;
		}
		val.SetPixels(array);
		val.Apply();
		return Sprite.Create(val, new Rect(0f, 0f, 5f, 5f), new Vector2(0.5f, 0.5f));
	}
}