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 KnightsTemplar v1.3.0
KnightsTemplar.dll
Decompiled a year agousing System; using System.Diagnostics; 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 BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("KnightsTemplar")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("KnightsTemplar")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ac1928a5-2926-4082-b95d-80ddf3a7c55b")] [assembly: AssemblyFileVersion("1.3.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.0.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 KnightsTemplar { public static class PluginConfig { public static ConfigEntry<bool> IsModEnabled { get; private set; } public static void BindConfig(ConfigFile config) { IsModEnabled = config.Bind<bool>("_Global", "isModEnabled", true, "Globally enable or disable this mod."); } } public static class RepairController { public static readonly string BlackForge = "$piece_blackforge"; public static readonly string ShieldKnight = "$item_shield_knight"; public static readonly string SwordIronFire = "$item_sword_fire"; public static bool CanRepairItem(Player player, ItemData item) { if (!Object.op_Implicit((Object)(object)player) || item == null || !IsKnightItem(item.m_shared.m_name)) { return false; } if (player.NoCostCheat()) { return true; } CraftingStation currentCraftingStation = player.GetCurrentCraftingStation(); if (!Object.op_Implicit((Object)(object)currentCraftingStation) || currentCraftingStation.m_name != BlackForge || currentCraftingStation.GetLevel(true) < 2) { return false; } return true; } public static bool IsKnightItem(string itemName) { if (!(itemName == ShieldKnight)) { return itemName == SwordIronFire; } return true; } } [BepInPlugin("bruce.valehim.comfytools.knightstemplar", "KnightsTemplar", "1.3.0")] public sealed class KnightsTemplar : BaseUnityPlugin { public const string PluginGuid = "bruce.valehim.comfytools.knightstemplar"; public const string PluginName = "KnightsTemplar"; public const string PluginVersion = "1.3.0"; private void Awake() { PluginConfig.BindConfig(((BaseUnityPlugin)this).Config); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "bruce.valehim.comfytools.knightstemplar"); } } [HarmonyPatch(typeof(InventoryGui))] internal static class InventoryGuiPatch { [HarmonyPostfix] [HarmonyPatch("CanRepair")] private static void CanRepairPostfix(ItemData item, ref bool __result) { if (!__result && PluginConfig.IsModEnabled.Value && RepairController.CanRepairItem(Player.m_localPlayer, item)) { __result = true; } } } }