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 HostMoveOnly v1.0.0
HostMoveOnly.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Logging; using HarmonyLib; using HostMoveOnly.Patches; 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: AssemblyTitle("HostMoveOnly")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HostMoveOnly")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9cb19077-52bd-4047-904c-9224405e28db")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace HostMoveOnly { [BepInPlugin("WhiteSilo.HostMoveOnly", "HostMoveOnly", "1.0.0.0")] public class HostMoveOnlyBase : BaseUnityPlugin { private const string modGUID = "WhiteSilo.HostMoveOnly"; private const string modName = "HostMoveOnly"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("WhiteSilo.HostMoveOnly"); private static HostMoveOnlyBase Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("WhiteSilo.HostMoveOnly"); mls.LogInfo((object)"The test mod has awaken: "); harmony.PatchAll(typeof(HostMoveOnlyBase)); harmony.PatchAll(typeof(ShipBuildModeManagerPatch)); PatchGameNetworkManager(); } private void PatchGameNetworkManager() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(GameNetworkManager), "ConnectionApproval", (Type[])null, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(HostMoveOnlyBase), "ConnectionApprovalPostfix", (Type[])null); harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo2 = AccessTools.Method(typeof(GameNetworkManager), "SetConnectionDataBeforeConnecting", (Type[])null, (Type[])null); HarmonyMethod val2 = new HarmonyMethod(typeof(HostMoveOnlyBase), "SetConnectionDataBeforeConnectingPrefix", (Type[])null); harmony.Patch((MethodBase)methodInfo2, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void SetConnectionDataBeforeConnectingPrefix(ref GameNetworkManager __instance) { string text = "HostMoveOnlyModInstalled"; string s = __instance.gameVersionNum + "," + text; NetworkManager.Singleton.NetworkConfig.ConnectionData = Encoding.ASCII.GetBytes(s); } public static void ConnectionApprovalPostfix(ConnectionApprovalRequest request, ref ConnectionApprovalResponse response) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) string @string = Encoding.ASCII.GetString(request.Payload); string[] source = @string.Split(new char[1] { ',' }); string value = "HostMoveOnlyModInstalled"; if (!source.Contains(value)) { response.Reason = "HostMoveOnly mod is not installed."; response.Approved = false; response.Pending = false; } } } } namespace HostMoveOnly.Patches { [HarmonyPatch(typeof(ShipBuildModeManager))] internal class ShipBuildModeManagerPatch { [HarmonyPrefix] [HarmonyPatch("EnterBuildMode")] private static bool EnterBuildModePrefix() { return GameNetworkManager.Instance.isHostingGame; } } }