Decompiled source of NoDamageInShop v1.0.0

NoDamageInShop.dll

Decompiled 10 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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("NoDamageInShop")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoDamageInShop")]
[assembly: AssemblyTitle("NoDamageInShop")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 NoDamageInShop
{
	[BepInPlugin("eugenefitz.NoDamageInShop", "NoDamageInShop", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "eugenefitz.NoDamageInShop";

		public const string PluginName = "NoDamageInShop";

		public const string PluginVersion = "1.0.0";

		internal static ManualLogSource Log;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			_harmony = new Harmony("eugenefitz.NoDamageInShop");
			_harmony.PatchAll();
			Log.LogInfo((object)"NoDamageInShop v1.0.0 loaded.");
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	[HarmonyPatch(typeof(PlayerHealth), "Hurt", new Type[]
	{
		typeof(int),
		typeof(bool),
		typeof(int),
		typeof(bool)
	})]
	internal static class PlayerHealth_Hurt_Patch
	{
		[HarmonyPrefix]
		private static bool Prefix()
		{
			try
			{
				return !SemiFunc.RunIsShop();
			}
			catch
			{
				return true;
			}
		}
	}
}