Decompiled source of TrappedWolfCanHit v1.0.1

plugins/TrappedWolfCanHit/TrappedWolfCanHit.dll

Decompiled 7 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 Managers;
using Microsoft.CodeAnalysis;
using On;
using TrappedWolfCanHit.Patch;
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 = "")]
[assembly: AssemblyCompany("TrappedWolfCanHit")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+eb86fb9e7b15dd437c7a6bc0f4fba8ab6cef331a")]
[assembly: AssemblyProduct("TrappedWolfCanHit")]
[assembly: AssemblyTitle("TrappedWolfCanHit")]
[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 TrappedWolfCanHit
{
	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.TrappedWolfCanHit", "TrappedWolfCanHit", "1.0.0")]
	[BepInProcess("Lycans.exe")]
	public class TrappedWolfCanHit : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "LloydHawkeye.TrappedWolfCanHit";

		public const string PLUGIN_AUTHOR = "LloydHawkeye";

		public const string PLUGIN_NAME = "TrappedWolfCanHit";

		public const string PLUGIN_VERSION = "1.0.0";

		private void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			TrapPatcher.Patch();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TrappedWolfCanHit";

		public const string PLUGIN_NAME = "TrappedWolfCanHit";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace TrappedWolfCanHit.Patch
{
	internal class TrapPatcher
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_CheckPlayerRayCast <0>__PlayerController_CheckPlayerRayCast;
		}

		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>__PlayerController_CheckPlayerRayCast;
			if (obj == null)
			{
				hook_CheckPlayerRayCast val = PlayerController_CheckPlayerRayCast;
				<>O.<0>__PlayerController_CheckPlayerRayCast = val;
				obj = (object)val;
			}
			PlayerController.CheckPlayerRayCast += (hook_CheckPlayerRayCast)obj;
		}

		private static bool PlayerController_CheckPlayerRayCast(orig_CheckPlayerRayCast orig, PlayerController self, PlayerController targetPlayer, float distance)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			bool flag = distance < 1.5f;
			bool result = false;
			if (flag)
			{
				bool flag2 = NetworkBool.op_Implicit(targetPlayer.PlayerEffectManager.Invisible);
				bool flag3 = NetworkBool.op_Implicit(PlayerController.Local.LocalCameraHandler.PovPlayer.PlayerEffectManager.Paranoia);
				GameManager.Instance.gameUI.UpdateUsername((NetworkBool.op_Implicit(targetPlayer.IsWolf) || flag2 || flag3) ? "???" : ((object)targetPlayer.PlayerData.Username).ToString());
				GameManager.Instance.gameUI.ShowUsername(true);
			}
			if (NetworkBool.op_Implicit(self.IsWolf))
			{
				if (flag && !self.IsAttacking && !NetworkBool.op_Implicit(targetPlayer.IsDead) && (int)targetPlayer.Role != 1)
				{
					GameManager.Instance.gameUI.UpdateInteraction("UI_KILL", Color.white, (InputActionName)0, Array.Empty<object>());
					result = true;
				}
			}
			else if (self.IdVoted == -1 && NetworkBool.op_Implicit(GameManager.Instance.CanVote) && !NetworkBool.op_Implicit(targetPlayer.IsDead))
			{
				GameManager.Instance.gameUI.UpdateInteraction("UI_VOTE_FOR", Color.white, (InputActionName)4, new object[1] { ((object)targetPlayer.PlayerData.Username).ToString() });
				result = true;
			}
			return result;
		}
	}
}