Please disclose if your mod was created primarily 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 NoPortalUsage v0.0.1
NoPortalUsage.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; 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("TrueVikings")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("TrueVikings")] [assembly: AssemblyCopyright("Copyright © Microsoft 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("da58d6cf-f76b-414a-ba2c-2b1be539eb5d")] [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 TrueVikings { [BepInPlugin("NoPortalUsage", "NoPortalUsage", "0.0.1")] public class TrueVikings : BaseUnityPlugin { public const string version = "0.0.1"; public static Harmony harmony = new Harmony("mod.NoPortalUsage"); private void Awake() { harmony.PatchAll(); Debug.Log((object)"NoPortalUsage mod started"); } } } namespace TrueVikings.Patches { [HarmonyPatch] public static class ZNetPatch { [HarmonyPatch(typeof(ZNet), "OnNewConnection")] public static class Patch { public static void Postfix(ref ZNet __instance, ZNetPeer peer) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (__instance.IsServer()) { peer.m_rpc.Register("TrueVikingServerHandShake", new Method(RPC_TrueVikingServerHandShake)); } else { peer.m_rpc.Register("TrueVikingClientHandShake", new Method(RPC_TrueVikingClientHandShake)); } } private static void RPC_TrueVikingServerHandShake(ZRpc rpc) { ServerHandshake(ZNet.instance, rpc); } private static void RPC_TrueVikingClientHandShake(ZRpc rpc) { rpc.Invoke("TrueVikingServerHandShake", Array.Empty<object>()); } private static void ServerHandshake(ZNet __instance, ZRpc rpc) { ZNetPeer peer = GetPeer(__instance, rpc); if (peer != null) { ZLog.Log((object)("Got handshake from client " + peer.m_socket.GetEndPointString())); ((object)__instance).GetType().GetMethod("ClearPlayerData", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[1] { typeof(ZNetPeer) }, null).Invoke(__instance, new object[1] { peer }); bool flag = !string.IsNullOrEmpty((string)((object)__instance).GetType().GetField("m_serverPassword", BindingFlags.Static | BindingFlags.NonPublic).GetValue(__instance)); peer.m_rpc.Invoke("ClientHandshake", new object[1] { flag }); } } } [HarmonyPatch(typeof(ZNet), "RPC_ServerHandshake")] public static class Patch3 { public static bool Prefix(ref ZNet __instance, ZRpc rpc) { rpc.Invoke("TrueVikingClientHandShake", Array.Empty<object>()); return false; } } private static ZNetPeer GetPeer(ZNet __instance, ZRpc rpc) { foreach (ZNetPeer connectedPeer in __instance.GetConnectedPeers()) { if (connectedPeer.m_rpc == rpc) { return connectedPeer; } } return null; } } [HarmonyPatch(typeof(TeleportWorld), "Teleport", new Type[] { typeof(Player) })] public static class TeleportPatch { private static bool Prefix(ref TeleportWorld __instance) { MessageHud.instance.ShowMessage((MessageType)2, "Nutze die Stadt Teleporter.", 0, (Sprite)null); __instance.m_exitDistance = 0f; __instance.m_activationRange = 0f; return false; } } }