Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of AutoRepair v1.0.0
plugins/AutoRepair.dll
Decompiled an hour agousing 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 BepInEx.Logging; 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: IgnoresAccessChecksTo("assembly_valheim")] [assembly: AssemblyCompany("Hoose")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright (c) Hoose 2026")] [assembly: AssemblyDescription("Automatically repairs equipment eligible at the current crafting station.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+896f20ee711cb5c9c1e236c5fb2138f9b73eb0d1")] [assembly: AssemblyProduct("Valheim AutoRepair")] [assembly: AssemblyTitle("AutoRepair")] [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 AutoRepair { [BepInPlugin("hoose.valheim.autorepair", "AutoRepair", "1.0.0")] [BepInProcess("valheim.exe")] public sealed class AutoRepairPlugin : BaseUnityPlugin { public const string PluginName = "AutoRepair"; public const string PluginAuthor = "Hoose"; public const string PluginGuid = "hoose.valheim.autorepair"; public const string PluginVersion = "1.0.0"; private Harmony _harmony; internal static ManualLogSource Log { get; private set; } 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("hoose.valheim.autorepair"); _harmony.PatchAll(typeof(AutoRepairPlugin).Assembly); MethodInfo methodInfo = AccessTools.Method(typeof(CraftingStation), "Interact", new Type[3] { typeof(Humanoid), typeof(bool), typeof(bool) }, (Type[])null); Patches obj = ((methodInfo == null) ? null : Harmony.GetPatchInfo((MethodBase)methodInfo)); if (obj == null || !obj.Postfixes.Any((Patch patch) => patch.owner == "hoose.valheim.autorepair" && patch.PatchMethod.DeclaringType == typeof(CraftingStationRepairPatch))) { _harmony.UnpatchSelf(); Log.LogError((object)"AutoRepair's crafting station patch was not registered; auto repair is disabled."); } else { Log.LogInfo((object)"AutoRepair 1.0.0 loaded; repair patch verified."); } } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } if (Log == ((BaseUnityPlugin)this).Logger) { Log = null; } } } [HarmonyPatch(typeof(CraftingStation), "Interact")] internal static class CraftingStationRepairPatch { [HarmonyPostfix] private static void AfterInteract(CraftingStation __instance, Humanoid user, bool repeat) { Player localPlayer = Player.m_localPlayer; if (repeat || (Object)(object)localPlayer == (Object)null || (Object)(object)user != (Object)(object)localPlayer || (Object)(object)localPlayer.GetCurrentCraftingStation() != (Object)(object)__instance) { return; } InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null) { return; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); if (inventory == null) { return; } int count = inventory.GetAllItems().Count; int i; for (i = 0; i < count; i++) { if (!instance.HaveRepairableItems()) { break; } instance.RepairOneItem(); } if (i > 0) { ((Character)localPlayer).Message((MessageType)2, " ", 0, (Sprite)null, false); AutoRepairPlugin.Log.LogInfo((object)$"Completed {i} repair attempts."); } if (i == count && instance.HaveRepairableItems()) { AutoRepairPlugin.Log.LogWarning((object)"Stopped auto repair at the inventory item limit; repairable items remain."); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }