Guts.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
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("Guts")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2+50df5752f19fbb1ccfec2e05c497f6c23b05eb08")]
[assembly: AssemblyProduct("Guts")]
[assembly: AssemblyTitle("Guts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.2.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;
		}
	}
}
internal sealed class ConfigurationManagerAttributes
{
	public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput);

	public bool? ShowRangeAsPercent;

	public Action<ConfigEntryBase> CustomDrawer;

	public CustomHotkeyDrawerFunc CustomHotkeyDrawer;

	public bool? Browsable;

	public string Category;

	public object DefaultValue;

	public bool? HideDefaultButton;

	public bool? HideSettingName;

	public string Description;

	public string DispName;

	public int? Order;

	public bool? ReadOnly;

	public bool? IsAdvanced;

	public Func<object, string> ObjToStr;

	public Func<string, object> StrToObj;
}
namespace Guts
{
	[BepInPlugin("bergbok.guts", "Guts", "1.1.2")]
	[BepInProcess("Hollow Knight Silksong")]
	public class Guts : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(HeroController), "SetConfigGroup")]
		private static class HeroController_SetConfigGroupt_Patch
		{
			private static readonly Dictionary<GameObject, Vector3> originalLocalScales = new Dictionary<GameObject, Vector3>();

			[HarmonyPostfix]
			private static void Postfix(HeroController __instance, ref ConfigGroup configGroup, ref ConfigGroup overrideGroup)
			{
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				if (!PluginEnabled.Value)
				{
					if (originalLocalScales.ContainsKey(configGroup.ChargeSlash))
					{
						configGroup.ChargeSlash.transform.localScale = originalLocalScales[configGroup.ChargeSlash];
					}
					return;
				}
				if (!originalLocalScales.ContainsKey(configGroup.ChargeSlash))
				{
					originalLocalScales[configGroup.ChargeSlash] = configGroup.ChargeSlash.transform.localScale;
				}
				configGroup.ChargeSlash.transform.localScale = originalLocalScales[configGroup.ChargeSlash] * NailScale.Value;
			}
		}

		[HarmonyPatch(typeof(NailSlash), "StartSlash")]
		private static class NailSlash_StartSlash_Patch
		{
			private static readonly Dictionary<NailSlash, Vector3> originalScales = new Dictionary<NailSlash, Vector3>();

			private static readonly Dictionary<NailSlash, Vector3> originalLongNeedleScales = new Dictionary<NailSlash, Vector3>();

			[HarmonyPrefix]
			private static void Prefix(NailSlash __instance)
			{
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: 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)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				if (!PluginEnabled.Value)
				{
					if (originalScales.ContainsKey(__instance))
					{
						((NailAttackBase)__instance).scale = originalScales[__instance];
					}
					if (originalLongNeedleScales.ContainsKey(__instance))
					{
						((NailAttackBase)__instance).longNeedleScale = originalLongNeedleScales[__instance];
					}
				}
				else
				{
					if (!originalScales.ContainsKey(__instance))
					{
						originalScales[__instance] = ((NailAttackBase)__instance).scale;
						originalLongNeedleScales[__instance] = ((NailAttackBase)__instance).longNeedleScale;
					}
					((NailAttackBase)__instance).scale = originalScales[__instance] * NailScale.Value;
					((NailAttackBase)__instance).longNeedleScale = originalLongNeedleScales[__instance] * NailScale.Value;
				}
			}
		}

		internal static Guts Instance;

		internal static ConfigEntry<bool> PluginEnabled;

		internal static ConfigEntry<float> NailScale;

		private void Awake()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			PluginEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, (ConfigDescription)null);
			NailScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Nail Scale", 3f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>()));
			new Harmony("bergbok.guts").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin loaded and initialized.");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "bergbok.guts";

		public const string PLUGIN_NAME = "Guts";

		public const string PLUGIN_VERSION = "1.1.2";
	}
}