Decompiled source of TinyTaurenMurder v1.0.1

LethalMurder.dll

Decompiled 4 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LC_API.GameInterfaceAPI;
using LC_API.GameInterfaceAPI.Events.EventArgs.Player;
using LC_API.GameInterfaceAPI.Events.Handlers;
using LC_API.GameInterfaceAPI.Features;
using LethalNetworkAPI;
using LethalNetworkAPI.Utils;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[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.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyCompany("LethalMurder")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("LethalMurder")]
[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 LethalMurder
{
	[HarmonyPatch(typeof(BlobAI))]
	internal class BlobPatch
	{
		[HarmonyPatch("OnCollideWithPlayer")]
		[HarmonyPostfix]
		private static void OnCollideWithPlayerPatch(Collider other, BlobAI __instance)
		{
			PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, false, false);
			if (!((Object)(object)val == (Object)null) && !val.isPlayerDead)
			{
				Plugin.Instance.modManager.TeleportPlayerAtRandomLocation(val);
			}
		}
	}
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class BugPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatch(ref PlayerControllerB ___angryAtPlayer)
		{
			if (!((Object)(object)Plugin.Instance.modManager == (Object)null) && !((Object)(object)___angryAtPlayer == (Object)null) && Plugin.Instance.modManager.playerList.Count >= (int)LethalNetworkExtensions.GetClientId(___angryAtPlayer) && Plugin.Instance.modManager.playerList[(int)LethalNetworkExtensions.GetClientId(___angryAtPlayer)].role == ModManager.ERoles.Impostor)
			{
				___angryAtPlayer = null;
			}
		}
	}
	[HarmonyPatch(typeof(HauntedMaskItem))]
	internal class HauntedMaskPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePatch(HauntedMaskItem __instance, ref bool ___attaching, ref PlayerControllerB ___previousPlayerHeldBy, ref bool ___maskOn, ref bool ___holdingLastFrame, ref bool ___finishedAttaching, ref float ___lastIntervalCheck)
		{
			if (!((!__instance.maskIsHaunted || !((NetworkBehaviour)__instance).IsOwner || (Object)(object)___previousPlayerHeldBy == (Object)null || !___maskOn || !___holdingLastFrame) | ___finishedAttaching) && !___attaching && !StartOfRound.Instance.shipIsLeaving && (!StartOfRound.Instance.inShipPhase || !((Object)(object)StartOfRound.Instance.testRoom == (Object)null)) && !((double)Time.realtimeSinceStartup <= (double)___lastIntervalCheck))
			{
				__instance.BeginAttachment();
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePatch(HUDManager __instance)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Invalid comparison between Unknown and I4
			if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !GameNetworkManager.Instance.localPlayerController.isPlayerDead && !((Object)(object)Plugin.Instance.modManager == (Object)null))
			{
				if ((int)GameState.ShipState == 0)
				{
					((TMP_Text)__instance.weightCounter).text = "Otarie <3";
				}
				else
				{
					((TMP_Text)__instance.weightCounter).text = Plugin.Instance.modManager.m_Role.ToString();
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartMatchLever))]
	internal class MatchLeverPatch
	{
		[HarmonyPatch("LeverAnimation")]
		[HarmonyPrefix]
		private static bool blockingLevelShipPatch()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)GameState.ShipState == 1)
			{
				if (!Plugin.Instance.modManager.canShipLever)
				{
					Player.LocalPlayer.QueueTip("YOU CANT RUN THE SHIP", "The IMPOSTOR is still alive", 5f, 0, true, false, "LC_Tip1");
				}
				return Plugin.Instance.modManager.canShipLever;
			}
			return true;
		}
	}
	internal class ModManager : MonoBehaviour
	{
		public enum ERoles
		{
			Crewmate,
			Impostor
		}

		public struct FPlayer
		{
			public ulong playerID;

			public ERoles role;

			public PlayerControllerB playerScript;

			public Player API_Player;

			public FPlayer()
			{
				playerID = 0uL;
				role = ERoles.Crewmate;
				playerScript = null;
				API_Player = null;
			}

			public FPlayer(ulong playerID, ERoles role, PlayerControllerB playerScript, Player apiPlayer)
			{
				this.playerID = playerID;
				this.role = role;
				this.playerScript = playerScript;
				API_Player = apiPlayer;
			}
		}

		internal ERoles m_Role = ERoles.Crewmate;

		internal bool isRoleReceived = false;

		internal bool canShipLever = false;

		internal bool canInstantKill = false;

		internal float killCooldown = 160f;

		internal LethalClientMessage<ulong> CloseKillMessage;

		internal LNetworkMessage<ulong> TryKillMessage;

		internal LNetworkMessage<float> KillCoolDownMessage;

		internal LNetworkMessage<int> RoleMessage;

		internal LNetworkMessage<string> ServerInfoMessage;

		internal LNetworkMessage<bool> PlayerDiedMessage;

		internal LNetworkMessage<bool> CanShipLeverMessage;

		internal LNetworkMessage<Vector3> SpawnEnemyOnPlayerPositionMessage;

		internal List<FPlayer> playerList = new List<FPlayer>();

		internal int impostorCount = 0;

		internal int crewMateCount = 0;

		private void Awake()
		{
			CloseKillMessage = new LethalClientMessage<ulong>("closeKillMessage", (Action<ulong>)null, (Action<ulong, ulong>)null);
			TryKillMessage = LNetworkMessage<ulong>.Create("TryKillMessage", (Action<ulong, ulong>)null, (Action<ulong>)null, (Action<ulong, ulong>)null);
			KillCoolDownMessage = LNetworkMessage<float>.Create("KillCoolDownMessage", (Action<float, ulong>)null, (Action<float>)null, (Action<float, ulong>)null);
			RoleMessage = LNetworkMessage<int>.Create("RoleMessageServer", (Action<int, ulong>)null, (Action<int>)null, (Action<int, ulong>)null);
			ServerInfoMessage = LNetworkMessage<string>.Create("ServerInfoMessage", (Action<string, ulong>)null, (Action<string>)null, (Action<string, ulong>)null);
			PlayerDiedMessage = LNetworkMessage<bool>.Create("ImpostorDeathMessage", (Action<bool, ulong>)null, (Action<bool>)null, (Action<bool, ulong>)null);
			CanShipLeverMessage = LNetworkMessage<bool>.Create("CanShipLeverMessage", (Action<bool, ulong>)null, (Action<bool>)null, (Action<bool, ulong>)null);
			SpawnEnemyOnPlayerPositionMessage = LNetworkMessage<Vector3>.Create("SpawnEnemyOnPlayerPositionMessage", (Action<Vector3, ulong>)null, (Action<Vector3>)null, (Action<Vector3, ulong>)null);
		}

		private void OnEnable()
		{
			Debug.Log((object)"ModManager OnEnable");
			CloseKillMessage.OnReceivedFromClient += OnCloseKillClientReceived;
			RoleMessage.OnClientReceived += OnRoleReceivedForClient;
			ServerInfoMessage.OnServerReceived += InfoMessageServerReception;
			ServerInfoMessage.OnClientReceived += InfoMessageClientReception;
			TryKillMessage.OnServerReceived += OntryKillServerCalculations;
			TryKillMessage.OnClientReceived += OnClientKill;
			KillCoolDownMessage.OnClientReceived += RunKillCoolDownOnClient;
			PlayerDiedMessage.OnServerReceived += OnPlayerDeathServer;
			CanShipLeverMessage.OnClientReceived += ShipLeverModif;
			SpawnEnemyOnPlayerPositionMessage.OnServerReceived += SpawnEnemyServerSide;
			GameState.LandOnMoon += LandOnMoonEvent;
			Player.Died += OnPlayerDied;
		}

		private void OnDisable()
		{
			CloseKillMessage.OnReceivedFromClient -= OnCloseKillClientReceived;
			RoleMessage.OnClientReceived -= OnRoleReceivedForClient;
			ServerInfoMessage.OnServerReceived -= InfoMessageServerReception;
			ServerInfoMessage.OnClientReceived -= InfoMessageClientReception;
			TryKillMessage.OnServerReceived -= OntryKillServerCalculations;
			TryKillMessage.OnClientReceived -= OnClientKill;
			CanShipLeverMessage.OnClientReceived -= ShipLeverModif;
			SpawnEnemyOnPlayerPositionMessage.OnServerReceived -= SpawnEnemyServerSide;
			GameState.LandOnMoon -= LandOnMoonEvent;
			Player.Died -= OnPlayerDied;
			PlayerDiedMessage.OnServerReceived -= OnPlayerDeathServer;
		}

		private void LandOnMoonEvent()
		{
			isRoleReceived = false;
			Debug.Log((object)"LandOnMoonEvent");
			if (Player.LocalPlayer.IsHost)
			{
				CreatingRoles();
			}
		}

		private void UpdatingPlayerScripts()
		{
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.isPlayerControlled)
				{
					playerList.Add(new FPlayer(LethalNetworkExtensions.GetClientId(val), ERoles.Crewmate, val, Player.Get(val)));
				}
			}
		}

		private void CreatingRoles()
		{
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			UpdatingPlayerScripts();
			int num = Random.Range(0, playerList.Count);
			for (int i = 0; i < playerList.Count; i++)
			{
				if (i == num)
				{
					playerList[i] = new FPlayer(playerList[i].playerID, ERoles.Impostor, playerList[i].playerScript, playerList[i].API_Player);
					impostorCount++;
					continue;
				}
				if (Random.Range(0f, 1f) > 0.8f)
				{
				}
				crewMateCount++;
			}
			Debug.Log((object)"LISTING EVERY PLAYERS ROLES AND ID  ");
			foreach (FPlayer player in playerList)
			{
				ulong playerID = player.playerID;
				string text = playerID.ToString();
				ERoles role = player.role;
				Debug.Log((object)("Player ID: " + text + " Role: " + role));
			}
			Debug.Log((object)"SENDING ROLES ");
			foreach (FPlayer player2 in playerList)
			{
				RoleMessage.SendClient((int)player2.role, player2.playerID);
			}
			foreach (FPlayer player3 in playerList)
			{
				Item.CreateAndSpawnItem("Shovel", true, ((Component)player3.playerScript).transform.position, Quaternion.identity);
			}
		}

		private void ShipLeverModif(bool CanShipLever)
		{
			Debug.Log((object)("Ship Lever Modif to : " + CanShipLever));
			canShipLever = CanShipLever;
		}

		private void GiveItemToPlayer(string itemString, ulong PlayerID)
		{
			if (PlayerID == Player.HostPlayer.ClientId)
			{
				try
				{
					Item.CreateAndGiveItem(itemString, Player.HostPlayer, true, true);
					return;
				}
				catch (NullReferenceException ex)
				{
					Debug.Log((object)("tema l'erreur " + ex.Message));
					return;
				}
			}
			Item.CreateAndGiveItem(itemString, Player.Get(PlayerID), true, true);
		}

		private void InfoMessageServerReception(string param, ulong ClientID)
		{
			Debug.Log((object)("Server Received Info Message " + param + " and client id :  " + ClientID));
		}

		private void InfoMessageClientReception(string message)
		{
			Player.LocalPlayer.QueueTip("INFO MESSAGE", message, 10f, 0, false, false, "LC_Tip1");
		}

		private void OnPlayerDied(DiedEventArgs ev)
		{
			if (ev.Player.IsLocalPlayer)
			{
				Debug.Log((object)"Player Died");
				if (m_Role == ERoles.Impostor)
				{
					PlayerDiedMessage.SendServer(true);
				}
				else
				{
					PlayerDiedMessage.SendServer(false);
				}
			}
		}

		private void OnPlayerDeathServer(bool isImpostor, ulong ClientID)
		{
			if (isImpostor)
			{
				Debug.Log((object)"Impostor Died");
				impostorCount--;
				if (impostorCount <= 0)
				{
					ServerInfoMessage.SendClients("the impostors are dead, the crewmates win!");
					CanShipLeverMessage.SendClients(true);
				}
			}
			else
			{
				crewMateCount--;
				if (crewMateCount <= 0)
				{
					ServerInfoMessage.SendClients("the crewmates are all dead, the impostors win!");
					CanShipLeverMessage.SendClients(true);
				}
			}
		}

		private void OnRoleReceivedForClient(int Role)
		{
			if (!isRoleReceived)
			{
				isRoleReceived = true;
				m_Role = (ERoles)Role;
				Debug.Log((object)("I AM  :  " + m_Role));
				if (m_Role == ERoles.Impostor)
				{
					RunKillCooldown(killCooldown);
				}
				Player.LocalPlayer.QueueTip("YOUR ROLE IS ", m_Role.ToString(), 15f, 1, true, false, "LC_Tip1");
			}
		}

		private void RunKillCoolDownOnClient(float cooldown)
		{
			if (m_Role == ERoles.Impostor)
			{
				RunKillCooldown(killCooldown);
			}
		}

		private void OntryKillServerCalculations(ulong param, ulong ClientID)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)("Server Received Try Kill Message " + param + " and client id :  " + ClientID));
			PlayerControllerB playerController = LethalNetworkExtensions.GetPlayerController(ClientID);
			if (!playerController.isPlayerControlled)
			{
				return;
			}
			RaycastHit[] array = Physics.RaycastAll(((Component)playerController.gameplayCamera).transform.position, ((Component)playerController.gameplayCamera).transform.forward, playerController.grabDistance, 8);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val = array2[i];
				if (((Component)((RaycastHit)(ref val)).collider).gameObject.CompareTag("Player") && (Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponent<PlayerControllerB>() != (Object)null && ((Component)((RaycastHit)(ref val)).collider).GetComponent<PlayerControllerB>().isPlayerControlled && LethalNetworkExtensions.GetClientId(((Component)((RaycastHit)(ref val)).collider).GetComponent<PlayerControllerB>()) != ClientID)
				{
					ulong clientId = LethalNetworkExtensions.GetClientId(((Component)((RaycastHit)(ref val)).collider).GetComponent<PlayerControllerB>());
					Debug.Log((object)("Player" + clientId + "  Hit"));
					TryKillMessage.SendClient(clientId, clientId);
					KillCoolDownMessage.SendClient(killCooldown, ClientID);
					break;
				}
			}
		}

		private void OnClientKill(ulong param)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)("Client Received Try Kill Message " + param));
			Player.LocalPlayer.Kill(Vector3.one * 5f, true, (CauseOfDeath)0, 0, default(Vector3));
		}

		internal void RunKillCooldown(float time)
		{
			canInstantKill = false;
			((MonoBehaviour)this).StartCoroutine(KillCooldown(time));
		}

		private IEnumerator KillCooldown(float time)
		{
			_ = time / 4f;
			yield return (object)new WaitForSeconds(time * 0.75f);
			Player.LocalPlayer.QueueTip("KILL COOLDOWN", "ENDS IN " + time * 0.25f + " SECONDS", 5f, 0, false, false, "LC_Tip1");
			yield return (object)new WaitForSeconds(time * 0.25f);
			Player.LocalPlayer.QueueTip("YOU CAN INSTANT KILL", "Just Press E on a Player", 10f, 0, false, false, "LC_Tip1");
			canInstantKill = true;
		}

		internal void TeleportPlayerAtRandomLocation()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if ((int)GameState.ShipState == 1)
			{
				Random random = new Random();
				Vector3 position = RoundManager.Instance.insideAINodes[random.Next(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
				RoundManager instance = RoundManager.Instance;
				Random random2 = random;
				Vector3 randomNavMeshPositionInBoxPredictable = instance.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), random2, -1);
				Player.LocalPlayer.PlayerController.TeleportPlayer(randomNavMeshPositionInBoxPredictable, false, 0f, false, true);
			}
		}

		internal void TeleportPlayerAtRandomLocation(PlayerControllerB playerController)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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)
			if ((int)GameState.ShipState == 1)
			{
				Random random = new Random();
				Vector3 position = RoundManager.Instance.insideAINodes[random.Next(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
				RoundManager instance = RoundManager.Instance;
				Random random2 = random;
				Vector3 randomNavMeshPositionInBoxPredictable = instance.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), random2, -1);
				playerController.TeleportPlayer(randomNavMeshPositionInBoxPredictable, false, 0f, false, true);
			}
		}

		internal void CustomSpawnEnemy()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (Player.LocalPlayer.IsHost)
			{
				SpawnEnemyServerSide(Player.LocalPlayer.Position, 0uL);
			}
			else
			{
				SpawnEnemyClientSide();
			}
		}

		internal void SpawnEnemyServerSide(Vector3 position, ulong senderID)
		{
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (Player.LocalPlayer.IsInFactory)
			{
				if (RoundManager.Instance.currentLevel.Enemies.Count != 0)
				{
					int num = Random.Range(0, RoundManager.Instance.currentLevel.Enemies.Count);
					GameObject enemyPrefab = RoundManager.Instance.currentLevel.Enemies[0].enemyType.enemyPrefab;
					GameObject val = Object.Instantiate<GameObject>(enemyPrefab, position, Quaternion.Euler(Vector3.zero));
					val.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
					RoundManager.Instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>());
					EnemyType enemyType = val.GetComponent<EnemyAI>().enemyType;
					enemyType.numberSpawned++;
				}
			}
			else if (RoundManager.Instance.currentLevel.OutsideEnemies.Count != 0)
			{
				int num2 = Random.Range(0, RoundManager.Instance.currentLevel.OutsideEnemies.Count);
				GameObject enemyPrefab2 = RoundManager.Instance.currentLevel.OutsideEnemies[0].enemyType.enemyPrefab;
				GameObject val2 = Object.Instantiate<GameObject>(enemyPrefab2, position, Quaternion.Euler(Vector3.zero));
				val2.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
				RoundManager.Instance.SpawnedEnemies.Add(val2.GetComponent<EnemyAI>());
				EnemyType enemyType2 = val2.GetComponent<EnemyAI>().enemyType;
				enemyType2.numberSpawned++;
			}
		}

		internal void SpawnEnemyClientSide()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			SpawnEnemyOnPlayerPositionMessage.SendServer(Player.LocalPlayer.Position);
		}

		private void OnCloseKillClientReceived(ulong parameter, ulong clientID)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)("Client Received Close Kill Message " + parameter + " and client id :  " + clientID));
			ulong clientId = Player.LocalPlayer.ClientId;
			Debug.Log((object)("Distance between players is " + Vector3.Distance(((Component)LethalNetworkExtensions.GetPlayerController(clientId)).transform.position, ((Component)LethalNetworkExtensions.GetPlayerController(clientID)).transform.position)));
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private ManualLogSource Logger;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void infiniteSprint(ref float ___sprintMeter)
		{
			if (___sprintMeter < 1f)
			{
				___sprintMeter += 0.03f * Time.deltaTime;
			}
		}

		[HarmonyPatch("KillPlayer")]
		[HarmonyPrefix]
		private static bool KillPlayerPatch(CauseOfDeath causeOfDeath)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Invalid comparison between Unknown and I4
			Debug.Log((object)("cause of death : " + ((object)(CauseOfDeath)(ref causeOfDeath)).ToString()));
			if (Plugin.Instance.modManager.m_Role == ModManager.ERoles.Impostor)
			{
				if ((int)causeOfDeath == 2 && Player.LocalPlayer.IsInFactory)
				{
					Plugin.Instance.modManager.TeleportPlayerAtRandomLocation();
					return false;
				}
				if (Random.Range(0f, 1f) > 0.5f)
				{
					Plugin.Instance.modManager.CustomSpawnEnemy();
				}
			}
			return true;
		}

		[HarmonyPatch("Interact_performed")]
		[HarmonyPostfix]
		private static void InteractPerformedPatch(ref ulong ___actualClientId, PlayerControllerB __instance)
		{
			if (Plugin.Instance.modManager.canInstantKill)
			{
				Plugin.Instance.modManager.TryKillMessage.SendServer(___actualClientId);
			}
		}

		[HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")]
		[HarmonyPostfix]
		private static void InteractTriggerPatch(PlayerControllerB __instance)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.isGrabbingObjectAnimation || __instance.inSpecialMenu || __instance.quickMenuManager.isMenuOpen)
			{
				return;
			}
			int num = 8;
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward);
			RaycastHit[] array = Physics.RaycastAll(val, __instance.grabDistance, num);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val2 = array2[i];
				if (((Component)((RaycastHit)(ref val2)).collider).gameObject.CompareTag("Player") && (Object)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponent<PlayerControllerB>() != (Object)null && ((Component)((RaycastHit)(ref val2)).collider).GetComponent<PlayerControllerB>().isPlayerControlled && LethalNetworkExtensions.GetClientId(((Component)((RaycastHit)(ref val2)).collider).GetComponent<PlayerControllerB>()) != LethalNetworkExtensions.GetClientId(__instance) && Plugin.Instance.modManager.m_Role == ModManager.ERoles.Impostor)
				{
					if (Plugin.Instance.modManager.canInstantKill)
					{
						((Behaviour)__instance.cursorIcon).enabled = true;
						__instance.cursorIcon.sprite = __instance.grabItemIcon;
						((TMP_Text)__instance.cursorTip).text = "Murder : [E]";
					}
					else
					{
						((TMP_Text)__instance.cursorTip).text = "You cannot kill yet";
					}
					break;
				}
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("TinyTaurenMurder", "TinyTaurenMurder", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "TinyTaurenMurder";

		private const string NAME = "TinyTaurenMurder";

		private const string VERSION = "1.0.1";

		private Harmony m_Harmony = new Harmony("TinyTaurenMurder");

		internal static ManualLogSource Logger;

		public static Plugin Instance;

		internal ModManager modManager;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin TinyTaurenMurder  is loaded!");
			m_Harmony.PatchAll(typeof(Plugin));
			m_Harmony.PatchAll(typeof(PlayerControllerBPatch));
			m_Harmony.PatchAll(typeof(MatchLeverPatch));
			m_Harmony.PatchAll(typeof(TurretPatch));
			m_Harmony.PatchAll(typeof(BlobPatch));
			m_Harmony.PatchAll(typeof(BugPatch));
			m_Harmony.PatchAll(typeof(HauntedMaskPatch));
			m_Harmony.PatchAll(typeof(HUDManagerPatch));
			Task.Delay(10).ContinueWith(delegate
			{
				CreateModManager();
			});
		}

		public void LogMessage(string message)
		{
			Logger.LogInfo((object)message);
		}

		internal static void CreateModManager()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			Debug.Log((object)"Creating ModManager");
			Logger.LogInfo((object)"Creating ModManager");
			Logger.LogInfo((object)"Swaaaaaaaaaaag");
			GameObject val = new GameObject("ModManager");
			Object.DontDestroyOnLoad((Object)(object)val);
			((Object)val).hideFlags = (HideFlags)61;
			ModManager modManager = val.AddComponent<ModManager>();
			Instance.modManager = modManager;
		}

		internal static ulong GetMyPlayerID()
		{
			ulong[] otherConnectedClients = LNetworkUtils.OtherConnectedClients;
			return 6uL;
		}
	}
	[HarmonyPatch(typeof(Turret))]
	internal class TurretPatch
	{
		[HarmonyPatch("CheckForPlayersInLineOfSight")]
		[HarmonyPostfix]
		private static PlayerControllerB CheckLineSightPatch(PlayerControllerB playerOutput)
		{
			if ((Object)(object)playerOutput == (Object)null)
			{
				return null;
			}
			if ((Object)(object)Plugin.Instance.modManager == (Object)null)
			{
				return playerOutput;
			}
			if (Plugin.Instance.modManager.playerList[(int)LethalNetworkExtensions.GetClientId(playerOutput)].role == ModManager.ERoles.Impostor)
			{
				return null;
			}
			return playerOutput;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LethalMurder";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}