using System;
using System.Diagnostics;
using System.Linq;
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;
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("blacks7ar")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.5")]
[assembly: AssemblyInformationalVersion("1.0.5")]
[assembly: AssemblyProduct("HardcoreEquipments")]
[assembly: AssemblyTitle("HardcoreEquipments")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.5.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace HardcoreEquipments
{
[BepInPlugin("blacks7ar.HardcoreEquipments", "HardcoreEquipments", "1.0.5")]
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.5";
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);
}
}
}