Decompiled source of V73dcfix v1.0.5

BepInEx/plugins/huluoboV73dcfix.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
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.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace huluoboV73dcfix;

[BepInPlugin("hlb.V73dcfix", "huluoboV73dcfix", "1.0.5")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Singleton_OnClientDisconnectCallback")]
		[HarmonyPostfix]
		[HarmonyWrapSafe]
		private static void OnClientDisconnectCallbackPrefix(GameNetworkManager __instance, ulong clientId)
		{
			try
			{
				if (!((Object)(object)NetworkManager.Singleton == (Object)null))
				{
					bool flag = clientId == 0;
					bool flag2 = clientId == NetworkManager.Singleton.LocalClientId;
					if ((flag || flag2) && NetworkManager.Singleton.IsClient && !NetworkManager.Singleton.IsServer)
					{
						GameNetworkManager.Instance.disconnectReason = 1;
						GameNetworkManager.Instance.Disconnect();
					}
				}
			}
			catch
			{
			}
		}
	}

	private const string GUID = "hlb.V73dcfix";

	private const string Name = "huluoboV73dcfix";

	private const string Version = "1.0.5";

	private Harmony harmony;

	public static ManualLogSource Log;

	private void Awake()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		harmony = new Harmony("hlb.V73dcfix");
		harmony.PatchAll();
	}
}