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 FlamethrowerReconnectFix v1.0.0
FlamethrowerReconnectFix.dll
Decompiled 2 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("FlamethrowerReconnectFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FlamethrowerReconnectFix")] [assembly: AssemblyTitle("FlamethrowerReconnectFix")] [assembly: AssemblyVersion("1.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 FlamethrowerReconnectFix { [BepInPlugin("local.flamethrowerreconnectfix", "Flamethrower Reconnect Fix", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string Guid = "local.flamethrowerreconnectfix"; public const string Version = "1.0.0"; internal static ManualLogSource Log; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("local.flamethrowerreconnectfix"); val.PatchAll(Assembly.GetExecutingAssembly()); Log.LogInfo((object)"FlamethrowerReconnectFix cargado. Vigilando reconexiones de red..."); } } [HarmonyPatch] public static class FlamethrowerRegisterHandlersPatch { private static CustomMessagingManager _lastSeenMessagingManager; private static FieldInfo _registeredManagerField; private static bool _resolvedOnce; public static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("Y4NGZUpgrades.Weapons.FlamethrowerStreamDriver"); if (type == null) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"[FlamethrowerReconnectFix] No se encontró FlamethrowerStreamDriver. ¿Cambió BetterArmory de versión? El parche no se aplicará."); } return null; } return AccessTools.Method(type, "RegisterNetworkHandlers", (Type[])null, (Type[])null); } public static void Prefix() { NetworkManager singleton = NetworkManager.Singleton; if (!((Object)(object)singleton == (Object)null)) { CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; if (customMessagingManager != null && customMessagingManager != _lastSeenMessagingManager) { ForceReRegistration(); _lastSeenMessagingManager = customMessagingManager; } } } private static void ForceReRegistration() { if (!_resolvedOnce) { Type type = AccessTools.TypeByName("Y4NGZUpgrades.Weapons.FlamethrowerStreamDriver"); _registeredManagerField = AccessTools.Field(type, "_registeredManager"); _resolvedOnce = true; } if (!(_registeredManagerField == null)) { _registeredManagerField.SetValue(null, null); Plugin.Log.LogInfo((object)"[FlamethrowerReconnectFix] Nuevo CustomMessagingManager detectado (reconexión). Forzando re-registro de los handlers del lanzallamas."); } } } }