Decompiled source of TrapWolves v1.0.0

plugins/TrapWolves/TrapWolves.dll

Decompiled 5 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 TrapWolves.Patches;
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.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("TrapWolves")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TrapWolves")]
[assembly: AssemblyTitle("TrapWolves")]
[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 TrapWolves
{
	internal static class Log
	{
		private const string PREFIX = "Lycans Cards > ";

		private static ManualLogSource _logSource;

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

		internal static void Debug(object data)
		{
			_logSource.LogDebug((object)("Lycans Cards > " + data));
		}

		internal static void Error(object data)
		{
			_logSource.LogError((object)("Lycans Cards > " + data));
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal((object)("Lycans Cards > " + data));
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo((object)("Lycans Cards > " + data));
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage((object)("Lycans Cards > " + data));
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning((object)("Lycans Cards > " + data));
		}
	}
	[BepInPlugin("new-systems.lycans-cards", "Trap Wolves", "1.0.0")]
	[BepInProcess("Lycans.exe")]
	public class TrapWolves : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "new-systems.lycans-cards";

		public const string PLUGIN_AUTHOR = "New Systems";

		public const string PLUGIN_NAME = "Trap Wolves";

		public const string PLUGIN_VERSION = "1.0.0";

		private void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			Trap.Patch();
		}

		private void Update()
		{
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TrapWolves";

		public const string PLUGIN_NAME = "TrapWolves";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace TrapWolves.Patches
{
	public class Trap
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnTriggerEnter <0>__Trap_OnTriggerEnter;
		}

		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>__Trap_OnTriggerEnter;
			if (obj == null)
			{
				hook_OnTriggerEnter val = Trap_OnTriggerEnter;
				<>O.<0>__Trap_OnTriggerEnter = val;
				obj = (object)val;
			}
			Trap.OnTriggerEnter += (hook_OnTriggerEnter)obj;
		}

		private static void Trap_OnTriggerEnter(orig_OnTriggerEnter orig, Trap trap, Collider other)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Invalid comparison between Unknown and I4
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			if (!(trap.TrappedPlayer == PlayerRef.None) || (int)GameManager.State.Current != 2)
			{
				return;
			}
			GameObject gameObject = ((Component)trap).gameObject;
			PlayerController component = ((Component)other).gameObject.GetComponent<PlayerController>();
			if ((Object)(object)component != (Object)null && !NetworkBool.op_Implicit(component.PlayerEffectManager.Giant) && !NetworkBool.op_Implicit(component.IsDead) && (component.Ref != trap.Owner || component.IsWolfMeshEnabled()))
			{
				trap.animator.SetBool(TrapItem.Closing, true);
				trap.TrappedPlayer = component.Ref;
				component.IsTrapped = NetworkBool.op_Implicit(true);
				component.IsClimbing = NetworkBool.op_Implicit(false);
				component.MovementAction = 0;
				component.CharacterMovementHandler.TeleportData = new NetworkTeleportData(gameObject.transform.position, ((Component)component).transform.rotation, false);
				if (((SimulationBehaviour)trap).HasStateAuthority)
				{
					GameManager.Rpc_BroadcastFollowSound(((SimulationBehaviour)trap).Runner, NetworkString<_16>.op_Implicit("TRAP_CLOSING"), gameObject.transform.position, 20f, 1f);
					trap.TrappedTimer = TickTimer.CreateFromSeconds(((SimulationBehaviour)trap).Runner, 20f);
				}
			}
		}
	}
}