using System; using System.Diagnostics; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Bifrost.Cooked; using HarmonyLib; using MelonLoader; using Microsoft.CodeAnalysis; using NoDurability; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "NoDurability", "1.0.0", "Permamiss", null)] [assembly: MelonGame("ReLUGames", "MIMESIS")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NoDurability")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoDurability")] [assembly: AssemblyTitle("NoDurability")] [assembly: NeutralResourcesLanguage("en-US")] [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 NoDurability { public class Core : MelonMod { public override void OnInitializeMelon() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown ((MelonBase)this).LoggerInstance.Msg("================================================="); ((MelonBase)this).LoggerInstance.Msg("NoDurability Mod 1.0.0 is initializing..."); ((MelonBase)this).LoggerInstance.Msg("================================================="); ((MelonBase)this).LoggerInstance.Msg("Author: github.com/Permamiss"); ((MelonBase)this).LoggerInstance.Msg("Target: EquipmentItemElement"); ((MelonBase)this).LoggerInstance.Msg(""); try { Harmony val = new Harmony("com.permamiss.nodurability.mod"); ((MelonBase)this).LoggerInstance.Msg("Applying Harmony patches..."); val.PatchAll(typeof(Core)); ((MelonBase)this).LoggerInstance.Msg("================================================="); ((MelonBase)this).LoggerInstance.Msg("SUCCESS: All Harmony patches applied!"); ((MelonBase)this).LoggerInstance.Msg("================================================="); ((MelonBase)this).LoggerInstance.Msg("Active patches:"); ((MelonBase)this).LoggerInstance.Msg(" [1] SetDurability - Prefix"); ((MelonBase)this).LoggerInstance.Msg("================================================="); ((MelonBase)this).LoggerInstance.Msg(""); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("================================================="); ((MelonBase)this).LoggerInstance.Error("FAILED to apply Harmony patches!"); ((MelonBase)this).LoggerInstance.Error(" Exception: " + ex.Message); ((MelonBase)this).LoggerInstance.Error(" Stack: " + ex.StackTrace); ((MelonBase)this).LoggerInstance.Error("================================================="); ((MelonBase)this).LoggerInstance.Error("Please report this error with full log!"); ((MelonBase)this).LoggerInstance.Msg(""); } } [HarmonyPatch(typeof(EquipmentItemElement), "SetDurability")] [HarmonyPrefix] private static bool SetDurability_Prefix(EquipmentItemElement __instance, ref int durability) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) try { ItemMasterInfo itemInfo = ((DataManager)Traverse.Create((object)Hub.s).Property("dataman", (object[])null).GetValue()).ExcelDataManager.GetItemInfo(((ItemElement)__instance).ItemMasterID); if (itemInfo != null) { ItemEquipmentInfo val = (ItemEquipmentInfo)(object)((itemInfo is ItemEquipmentInfo) ? itemInfo : null); if (val != null) { Traverse.Create((object)__instance).Property("RemainDurability", (object[])null).SetValue((object)val.MaxDurability); return false; } } return true; } catch (Exception ex) { MelonLogger.Error("================================================="); MelonLogger.Error("ERROR in SetDurability_Prefix!"); MelonLogger.Error(" Exception: " + ex.Message); MelonLogger.Error(" Stack: " + ex.StackTrace); MelonLogger.Error("================================================="); MelonLogger.Error("Please report this error with full log!"); MelonLogger.Msg(""); return true; } } } }