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 jsonMultiversar v1.0.0
AlwaysMagnet.dll
Decompiled 4 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("None")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0.0+d57b9ab7bcb92a9352f5e2927fe38fa7645646bf")] [assembly: AssemblyProduct("AlwaysMagnet")] [assembly: AssemblyTitle("AlwaysMagnet")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.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 AlwaysMagnet { public static class Extensions { public static void Nop(this IReadOnlyList<CodeInstruction> il, int index) { il.Nop(index, index); } public static void Nop(this IReadOnlyList<CodeInstruction> il, int start, int end) { for (int i = start; i <= end; i++) { il[i].opcode = OpCodes.Nop; il[i].operand = null; } } } [BepInPlugin("greg.AlwaysMagnet", "Always Magnet", "1.0.0.0")] [UsedImplicitly] public class Plugin : BaseUnityPlugin { private const string UUID = "greg.AlwaysMagnet"; public const BindingFlags FLAGS = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static ManualLogSource logSource; public static ConfigEntry<bool> pullRosaries; public static ConfigEntry<bool> pullShards; public static ConfigEntry<bool> requireMagnetToolForShards; [UsedImplicitly] public void Awake() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) logSource = ((BaseUnityPlugin)this).Logger; pullRosaries = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Pull_Rosaries", true, "Whether or not to always pull rosaries. [Default: true]"); pullShards = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Pull_Shards", true, "Whether or not to always pull shards. [Default: true]"); requireMagnetToolForShards = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Require_Magnet_Tool_For_Shards", false, "Whether or not to require the magnet tool to be equipped, to pull shards. DEFAULT MAGNET BEHAVIOR OF PULLING ROSARIES IS UNCHANGED BY THIS. [Default: false]"); Log((LogLevel)16, "greg.AlwaysMagnet loaded."); Harmony val = new Harmony("greg.AlwaysMagnet"); val.PatchAll(); foreach (MethodBase patchedMethod in val.GetPatchedMethods()) { Log((LogLevel)16, $"Patched: {patchedMethod.DeclaringType?.FullName}:{patchedMethod}"); } Log((LogLevel)16, "greg.AlwaysMagnet patching done."); } public static void Log(LogLevel level, string msg) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) logSource.Log(level, (object)msg); } } } namespace AlwaysMagnet.Patches { [HarmonyPatch(typeof(CurrencyObjectBase), "MagnetToolIsEquipped")] [UsedImplicitly] public class AlwaysMagnet { [HarmonyPrefix] [UsedImplicitly] public static bool Prefix(ref CurrencyObjectBase __instance, ref bool __result) { bool flag = ToolItemManager.IsToolEquipped("Rosary Magnet"); string key = __instance.popupName.Key; if (!(key == "INV_NAME_COIN")) { if (key == "INV_NAME_SHARD" && Plugin.pullShards.Value) { if ((Plugin.requireMagnetToolForShards.Value && flag) || !Plugin.requireMagnetToolForShards.Value) { __result = true; return false; } return true; } } else if (Plugin.pullRosaries.Value) { __result = true; return false; } return true; } } }