Decompiled source of PocketHammer v1.0.0

BepInEx/plugins/PocketHammer/PocketHammer.dll

Decompiled 12 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 HarmonyLib;
using Microsoft.CodeAnalysis;

[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("PocketHammer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+99373e7f5d0ab121eefa2dbfabfa63ce6608634e")]
[assembly: AssemblyProduct("PocketHammer")]
[assembly: AssemblyTitle("PocketHammer")]
[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 PocketHammer
{
	public static class Pluginfo
	{
		public const string guid = "win.deathis.pockethammer";

		public const string name = "Pocket Hammer";

		public const string version = "1.0.0";
	}
	[BepInPlugin("win.deathis.pockethammer", "Pocket Hammer", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(CL_GameManager), "Start")]
		public static class Patch_Start
		{
			public static void Postfix()
			{
				ENT_Player.GetInventory().pockets[(DesiredPocket.Value != PocketSide.Left) ? 1 : 0].pouch.AddItemToPouch(ENT_Player.GetInventory().GetItemByTag("hammer", true, true), true);
			}
		}

		public enum PocketSide
		{
			Left,
			Right
		}

		private static ManualLogSource _logger;

		private static Harmony _harmony;

		public static ConfigEntry<PocketSide> DesiredPocket;

		private void Awake()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			_logger = ((BaseUnityPlugin)this).Logger;
			DesiredPocket = ((BaseUnityPlugin)this).Config.Bind<PocketSide>("win.deathis.pockethammer", "DesiredPocket", PocketSide.Left, "Which pocket the hammer spawns in at the start of your run");
			_harmony = new Harmony("win.deathis.pockethammer");
			_harmony.PatchAll();
			_logger.LogInfo((object)"Plugin win.deathis.pockethammer has loaded");
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			_logger.LogInfo((object)"Plugin win.deathis.pockethammer has unloaded");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "PocketHammer";

		public const string PLUGIN_NAME = "PocketHammer";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}