Decompiled source of PortalDisabler v1.0.1

plugins/PortalDisabler/PortalDisabler.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Fusion;
using Microsoft.CodeAnalysis;
using On;
using PortalDisabler.Patch;

[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.6.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("PortalDisabler")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+98802b814b7c4f0a31a10abea7025b32956f1229")]
[assembly: AssemblyProduct("PortalDisabler")]
[assembly: AssemblyTitle("PortalDisabler")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 PortalDisabler
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("LloydHawkeye.PortalDisabler", "PortalDisabler", "1.0.0")]
	[BepInProcess("Lycans.exe")]
	public class PortalDisabler : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "LloydHawkeye.PortalDisabler";

		public const string PLUGIN_AUTHOR = "LloydHawkeye";

		public const string PLUGIN_NAME = "PortalDisabler";

		public const string PLUGIN_VERSION = "1.0.0";

		private void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			PortalPatch.patch();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "PortalDisabler";

		public const string PLUGIN_NAME = "PortalDisabler";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace PortalDisabler.Patch
{
	internal class PortalPatch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_StartActivationTimer <0>__Portal_StartActivationTimer;
		}

		public static void patch()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__Portal_StartActivationTimer;
			if (obj == null)
			{
				hook_StartActivationTimer val = Portal_StartActivationTimer;
				<>O.<0>__Portal_StartActivationTimer = val;
				obj = (object)val;
			}
			Portal.StartActivationTimer += (hook_StartActivationTimer)obj;
		}

		private static void Portal_StartActivationTimer(orig_StartActivationTimer orig, Portal self)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (((SimulationBehaviour)self).HasStateAuthority)
			{
				self.Active = NetworkBool.op_Implicit(false);
			}
		}
	}
}