Decompiled source of EpicLootPanelFix v1.0.0

EpicLootPanelFix.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
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: AssemblyTitle("EpicLootPanelFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Azumatt")]
[assembly: AssemblyProduct("EpicLootPanelFix")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 EpicLootPanelFix
{
	[BepInPlugin("Azumatt.EpicLootPanelFix", "EpicLootPanelFix", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class EpicLootPanelFixPlugin : BaseUnityPlugin
	{
		internal const string ModName = "EpicLootPanelFix";

		internal const string ModVersion = "1.0.0";

		internal const string Author = "Azumatt";

		private const string ModGUID = "Azumatt.EpicLootPanelFix";

		private readonly Harmony _harmony = new Harmony("Azumatt.EpicLootPanelFix");

		public static readonly ManualLogSource EpicLootPanelFixLogger = Logger.CreateLogSource("EpicLootPanelFix");

		private static GameObject EnchantingTableUI = null;

		private static Sprite EnchantingTableUIGUISprite = null;

		private static Image EnchantingTableUIBkg = null;

		public void Awake()
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
		}
	}
	[HarmonyPatch("EpicLoot_UnityLib.EnchantingTable, EpicLoot-UnityLib", "Interact")]
	public class ELCompat
	{
		private static GameObject EnchantingTableUI;

		[HarmonyPostfix]
		public static void ELEuiInteract(Humanoid user, bool repeat, bool alt)
		{
			if (!((Object)(object)EnchantingTableUI != (Object)null))
			{
				EnchantingTableUI = GameObject.Find("EnchantingUI(Clone)");
				((Graphic)((Component)Utils.FindChild(EnchantingTableUI.transform, "Panel", (IterativeSearchType)0)).GetComponent<Image>()).material = FejdStartupAwakePatch.originalMaterial;
			}
		}
	}
	[HarmonyPatch(typeof(FejdStartup), "Awake")]
	public static class FejdStartupAwakePatch
	{
		public static Material? originalMaterial;

		private static void Postfix(FejdStartup __instance)
		{
			AssetBundle[] array = Resources.FindObjectsOfTypeAll<AssetBundle>();
			foreach (AssetBundle val in array)
			{
				IEnumerable<Material> enumerable3;
				try
				{
					IEnumerable<Material> enumerable2;
					if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val))
					{
						IEnumerable<Material> enumerable = val.LoadAllAssets<Material>();
						enumerable2 = enumerable;
					}
					else
					{
						enumerable2 = from shader in ((IEnumerable<string>)val.GetAllAssetNames()).Select((Func<string, Material>)val.LoadAsset<Material>)
							where (Object)(object)shader != (Object)null
							select shader;
					}
					enumerable3 = enumerable2;
				}
				catch (Exception)
				{
					continue;
				}
				if (enumerable3 == null)
				{
					continue;
				}
				foreach (Material item in enumerable3)
				{
					if (Object.op_Implicit((Object)(object)item) && ((Object)item).name == "litpanel")
					{
						originalMaterial = item;
					}
				}
			}
		}
	}
}