Decompiled source of No Drop Death v1.0.0

plugins\TeflonTed.NoDropDeath.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("assembly_guiutils")]
[assembly: IgnoresAccessChecksTo("assembly_utils")]
[assembly: IgnoresAccessChecksTo("assembly_valheim")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TeflonTed.NoDropDeath")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Teflon Ted's No Drop Death — keep inventory on death")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c71b556292d9accbb4cec0877866f2464074b00d")]
[assembly: AssemblyProduct("TeflonTed.NoDropDeath")]
[assembly: AssemblyTitle("TeflonTed.NoDropDeath")]
[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 TeflonTed.NoDropDeath
{
	[BepInPlugin("com.teflonted.valheim.nodropdeath", "Teflon Ted's No Drop Death", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.teflonted.valheim.nodropdeath";

		public const string PluginName = "Teflon Ted's No Drop Death";

		public const string PluginVersion = "1.0.0";

		internal static bool InCreateTombStone;

		private void Awake()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.teflonted.valheim.nodropdeath");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Teflon Ted's No Drop Death 1.0.0 loaded");
		}
	}
	[HarmonyPatch(typeof(Player), "CreateTombStone")]
	internal static class Player_CreateTombStone_Patch
	{
		private static void Prefix()
		{
			Plugin.InCreateTombStone = true;
		}

		private static void Finalizer()
		{
			Plugin.InCreateTombStone = false;
		}
	}
	[HarmonyPatch(typeof(Inventory), "MoveInventoryToGrave")]
	internal static class Inventory_MoveInventoryToGrave_Patch
	{
		private static bool Prefix()
		{
			return !Plugin.InCreateTombStone;
		}
	}
	[HarmonyPatch(typeof(Inventory), "RemoveUnequipped")]
	internal static class Inventory_RemoveUnequipped_Patch
	{
		private static bool Prefix()
		{
			return !Plugin.InCreateTombStone;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}