Decompiled source of MoonlighterItemSpriteFix v1.0.0

MoonlighterImageFix.dll

Decompiled 7 hours 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MoonlighterImageFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Moonlighter Image Fix")]
[assembly: AssemblyTitle("MoonlighterImageFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 MoonlighterImageFix
{
	[BepInPlugin("MoonlighterImageFix", "Moonlighter Image Fix", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Image), "OnEnable")]
		private static class FixImageSizing
		{
			private static void Postfix(Image __instance)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				if (!(((Object)__instance).name != "Item"))
				{
					RectTransform rectTransform = ((Graphic)__instance).rectTransform;
					float preferredWidth = __instance.preferredWidth;
					float preferredHeight = __instance.preferredHeight;
					if (preferredWidth == 32f && preferredHeight == 32f && rectTransform.sizeDelta.x == 30f && rectTransform.sizeDelta.y == 30f)
					{
						rectTransform.sizeDelta = new Vector2(preferredWidth, preferredHeight);
					}
				}
			}
		}

		internal static ManualLogSource Logger;

		public static Harmony harmony;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin MoonlighterImageFix is loaded!");
			harmony = new Harmony("MoonlighterImageFix");
			harmony.PatchAll(Assembly.GetExecutingAssembly());
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MoonlighterImageFix";

		public const string PLUGIN_NAME = "Moonlighter Image Fix";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}