Decompiled source of HideKeyItemSlotIfNoKeyItem v1.0.0

NoKeyItemNoKeyItemSlot.dll

Decompiled 16 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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2.UI;
using RoR2;
using RoR2.UI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NoKeyItemNoKeyItemSlot")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f95478e37a95e06be339576ccc840eda6d5ec8bb")]
[assembly: AssemblyProduct("NoKeyItemNoKeyItemSlot")]
[assembly: AssemblyTitle("NoKeyItemNoKeyItemSlot")]
[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 NoKeyItemNoKeyItemSlot
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("swuff.NoKeyItemNoKeyItemSlot", "NoKeyItemNoKeyItemSlot", "1.0.0")]
	public class NoKeyItemNoKeyItemSlot : BaseUnityPlugin
	{
		public const string PluginGUID = "swuff.NoKeyItemNoKeyItemSlot";

		public const string PluginAuthor = "swuff";

		public const string PluginName = "NoKeyItemNoKeyItemSlot";

		public const string PluginVersion = "1.0.0";

		private static float initialRectTransformPositionOhMyGodBro;

		public static ConfigEntry<bool> HideSprintInvIcons { get; set; }

		public void Awake()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			MakeConfig();
			KeyItemIcon.GenerateDisplayData += new hook_GenerateDisplayData(KeyItemIcon_GenerateDisplayData);
		}

		public void MakeConfig()
		{
			HideSprintInvIcons = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "Hide Sprint and Inventory Icons", false, "If the icons showing the player the Sprint and Inventory hotkeys next to the Key Item Slot should be disabled.");
		}

		private DisplayData KeyItemIcon_GenerateDisplayData(orig_GenerateDisplayData orig, KeyItemIcon self)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Invalid comparison between Unknown and I4
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = default(RectTransform);
			if (initialRectTransformPositionOhMyGodBro == 0f && ((Component)((Component)self).gameObject.transform.parent).TryGetComponent<RectTransform>(ref val))
			{
				initialRectTransformPositionOhMyGodBro = val.anchoredPosition.x;
			}
			if (HideSprintInvIcons.Value)
			{
				Transform val2 = ((Component)self).gameObject.transform.parent.Find("SprintCluster");
				Transform val3 = ((Component)self).gameObject.transform.parent.Find("InventoryCluster");
				if (Object.op_Implicit((Object)(object)val2))
				{
					((Component)val2).gameObject.SetActive(false);
				}
				if (Object.op_Implicit((Object)(object)val3))
				{
					((Component)val3).gameObject.SetActive(false);
				}
			}
			if ((int)self.targetKeyItemSlot.keyItem == -1)
			{
				DisplayData val4 = default(DisplayData);
				((DisplayData)(ref val4))..ctor(self.targetInventory, self.targetKeyItemBodyBehavior, (KeyItemDef)null);
				val4.hideIcon = true;
				val4.iconProvider = null;
				val4.iconTint = Color.white;
				val4.tooltipContent = new TooltipContent
				{
					titleColor = Color.white,
					bodyColor = Color.gray
				};
				val4.cooldownValue = 0;
				val4.suppressFlashOnReady = true;
				DisplayData result = val4;
				RectTransform val5 = default(RectTransform);
				if (Object.op_Implicit((Object)(object)((Component)self).gameObject.transform.parent) && ((Component)((Component)self).gameObject.transform.parent).TryGetComponent<RectTransform>(ref val5))
				{
					val5.anchoredPosition = new Vector2(initialRectTransformPositionOhMyGodBro + 120f, val5.anchoredPosition.y);
				}
				return result;
			}
			RectTransform val6 = default(RectTransform);
			if (Object.op_Implicit((Object)(object)((Component)self).gameObject.transform.parent) && ((Component)((Component)self).gameObject.transform.parent).TryGetComponent<RectTransform>(ref val6))
			{
				val6.anchoredPosition = new Vector2(initialRectTransformPositionOhMyGodBro, val6.anchoredPosition.y);
			}
			return orig.Invoke(self);
		}
	}
}