Decompiled source of HardcoreEquipments v1.0.4

HardcoreEquipments.dll

Decompiled 3 weeks ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("HardcoreEquipments")]
[assembly: AssemblyDescription("https://valheim.thunderstore.io/package/blacks7ar/HardcoreEquipments/")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyProduct("HardcoreEquipments")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("C084E4D8-8DD9-4D62-9CBE-90AEB5767B6A")]
[assembly: AssemblyFileVersion("1.0.4")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.0")]
[module: UnverifiableCode]
namespace HardcoreEquipments;

[BepInPlugin("blacks7ar.HardcoreEquipments", "HardcoreEquipments", "1.0.4")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch]
	public static class Patches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		private static void Awake_Postfix(ObjectDB __instance)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected I4, but got Unknown
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			foreach (ItemDrop item in __instance.m_items.Select((GameObject item) => item.GetComponent<ItemDrop>()))
			{
				if ((Object)(object)item == (Object)null)
				{
					break;
				}
				ItemType itemType = item.m_itemData.m_shared.m_itemType;
				bool flag;
				switch (itemType - 3)
				{
				case 0:
				case 1:
				case 2:
				case 3:
				case 4:
				case 8:
				case 11:
				case 12:
				case 14:
				case 15:
				case 16:
				case 17:
				case 19:
					flag = true;
					break;
				default:
					flag = false;
					break;
				}
				if (flag && item.m_itemData.m_durability > 0f)
				{
					item.m_itemData.m_shared.m_destroyBroken = true;
				}
			}
		}
	}

	private const string modGUID = "blacks7ar.HardcoreEquipments";

	public const string modName = "HardcoreEquipments";

	public const string modAuthor = "blacks7ar";

	public const string modVersion = "1.0.4";

	public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/HardcoreEquipments/";

	private static readonly Harmony _harmony = new Harmony("blacks7ar.HardcoreEquipments");

	public void Awake()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		_harmony.PatchAll(executingAssembly);
	}
}