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 MuchBetterTamesBarrierFix v1.0.0
MuchBetterTamesBarrierFix.dll
Decompiled 3 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("0.0.0.0")] [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 MuchBetterTamesBarrierFix { [BepInPlugin("com.thedefside.MuchBetterTamesBarrierFix", "MuchBetterTames Barrier Fix", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BarrierFixPlugin : BaseUnityPlugin { private const string TargetType = "TameCompanions.CompanionController"; private static int _hardResetDepth; private void Awake() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00a4: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown try { Type type = AccessTools.TypeByName("TameCompanions.CompanionController"); MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "HardReset", (Type[])null, (Type[])null)); MethodInfo methodInfo2 = ((type == null) ? null : AccessTools.Method(type, "ClearStatusEffects", (Type[])null, (Type[])null)); if (methodInfo == null || methodInfo2 == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"MuchBetterTames HardReset/ClearStatusEffects not found (mod changed?). Fix not applied."); return; } Harmony val = new Harmony("com.thedefside.MuchBetterTamesBarrierFix"); val.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(BarrierFixPlugin), "HardResetPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(BarrierFixPlugin), "HardResetFinalizer", (Type[])null), (HarmonyMethod)null); val.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(BarrierFixPlugin), "ClearPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Applied: status effects are no longer cleared by the MuchBetterTames stuck hard-reset."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to apply Barrier Fix: " + ex.Message)); } } private static void HardResetPrefix() { _hardResetDepth++; } private static Exception HardResetFinalizer(Exception __exception) { if (_hardResetDepth > 0) { _hardResetDepth--; } return __exception; } private static bool ClearPrefix() { return _hardResetDepth == 0; } } }