Decompiled source of NightOfTheLivingMimic v1.0.5

SDBBZR.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SDBBZR")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Slayer's Dead Bodies Become Zombies Randomly")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SDBBZR")]
[assembly: AssemblyTitle("SDBBZR")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 SlayerDeadBodiesBecomeZombiesRandomly
{
	internal class BodyCheck : MonoBehaviour
	{
		private float timeSinceLastCheck = 0f;

		public ulong owner = 0uL;

		public int timesRevived = 0;

		public bool currentlyZombie = false;

		public DeadBodyInfo instance;

		public static int timerModifier;

		public static int chanceModifier;

		public void Update()
		{
			if (!((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost || currentlyZombie || StartOfRound.Instance.shipIsLeaving || (timesRevived >= 1 && !SDBBZRMain.continuous.Value))
			{
				return;
			}
			if ((Object)(object)instance?.grabBodyObject?.playerHeldBy != (Object)null)
			{
				ConfigEntry<bool> chaosMode = SDBBZRMain.chaosMode;
				if (chaosMode != null && chaosMode.Value)
				{
					becomeZombieCheck(chaos: true);
				}
			}
			timeSinceLastCheck += Time.deltaTime;
			if (timeSinceLastCheck >= (float)(SDBBZRMain.timer.Value + timerModifier))
			{
				becomeZombieCheck();
				timeSinceLastCheck = 0f;
			}
		}

		public void becomeZombieCheck(bool chaos = false)
		{
			if (!(SDBBZRMain.percentChance.Value + (float)chanceModifier <= 0f))
			{
				int num = Random.Range(0, 101);
				Debug.Log((object)num);
				num += timesRevived * SDBBZRMain.chanceDecrease.Value;
				if ((float)num < SDBBZRMain.percentChance.Value + (float)chanceModifier)
				{
					setZombie();
				}
				if (chaos)
				{
					setZombie();
				}
			}
		}

		public void setZombie()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			timeSinceLastCheck = 0f;
			currentlyZombie = true;
			GameObject val = Object.Instantiate<GameObject>(Misc.getEnemyByName("Masked").enemyType.enemyPrefab, ((Component)instance.grabBodyObject).transform.position, Quaternion.Euler(new Vector3(0f, 0f, 0f)));
			val.GetComponentInChildren<NetworkObject>().Spawn(true);
			RoundManager.Instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>());
			NetworkObjectReference val2 = NetworkObjectReference.op_Implicit(val.GetComponentInChildren<NetworkObject>());
			zombieBody zombieBody2 = val.AddComponent<zombieBody>();
			zombieBody2.bodyID = owner;
			Networker.Instance.fixMaskedClientRpc(instance.playerScript.actualClientId, ((NetworkObjectReference)(ref val2)).NetworkObjectId);
		}
	}
	internal class zombieBody : MonoBehaviour
	{
		public ulong bodyID = 0uL;
	}
	internal class ConfigManager
	{
		public static void setupLethalConfig()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0028: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			ConfigEntry<float> percentChance = SDBBZRMain.percentChance;
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = 0.1f;
			((BaseRangeOptions<float>)val).Max = 100f;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(percentChance, val);
			IntInputFieldConfigItem val3 = new IntInputFieldConfigItem(SDBBZRMain.timer, false);
			BoolCheckBoxConfigItem val4 = new BoolCheckBoxConfigItem(SDBBZRMain.continuous, false);
			IntInputFieldConfigItem val5 = new IntInputFieldConfigItem(SDBBZRMain.chanceDecrease, false);
			BoolCheckBoxConfigItem val6 = new BoolCheckBoxConfigItem(SDBBZRMain.maskTurn, false);
			BoolCheckBoxConfigItem val7 = new BoolCheckBoxConfigItem(SDBBZRMain.funnyMode, false);
			BoolCheckBoxConfigItem val8 = new BoolCheckBoxConfigItem(SDBBZRMain.chaosMode, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val5);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val7);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8);
		}
	}
	internal class Misc
	{
		public static SpawnableEnemyWithRarity getEnemyByName(string name)
		{
			List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				list = list.Union(val.Enemies).Union(val.OutsideEnemies).Union(val.DaytimeEnemies)
					.ToList();
			}
			list = (from x in list
				group x by x.enemyType.enemyName into g
				select g.First() into x
				orderby x.enemyType.enemyName
				select x).ToList();
			SpawnableEnemyWithRarity val2 = ((IEnumerable<SpawnableEnemyWithRarity>)list).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == name));
			if (val2 == null)
			{
				SelectableLevel[] levels2 = StartOfRound.Instance.levels;
				foreach (SelectableLevel val3 in levels2)
				{
					val2 = ((IEnumerable<SpawnableEnemyWithRarity>)val3.Enemies).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower() == name.ToLower()));
					if (val2 == null)
					{
						val2 = ((IEnumerable<SpawnableEnemyWithRarity>)val3.DaytimeEnemies).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower() == name.ToLower()));
					}
					if (val2 == null)
					{
						val2 = ((IEnumerable<SpawnableEnemyWithRarity>)val3.OutsideEnemies).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower() == name.ToLower()));
					}
				}
			}
			if (val2 == null)
			{
				SDBBZRMain.CustomLogger.LogWarning((object)("Enemy '" + name + "' not found. Available enemies: " + string.Join(", ", list.Select((SpawnableEnemyWithRarity e) => e.enemyType.enemyName))));
				return null;
			}
			return val2;
		}

		public static void SafeTipMessage(string title, string body, bool isWarning = false)
		{
			try
			{
				HUDManager.Instance.DisplayTip(title, body, isWarning, false, "LC_Tip1");
			}
			catch
			{
				SDBBZRMain.CustomLogger.LogWarning((object)"There's a problem with the DisplayTip method. This might have happened due to a new game verison, or some other mod.");
				try
				{
					ChatWrite(title + ": " + body);
				}
				catch
				{
					SDBBZRMain.CustomLogger.LogWarning((object)"There's a problem with writing to the chat. This might have happened due to a new game verison, or some other mod.");
				}
			}
		}

		public static void ChatWrite(string chatMessage)
		{
			HUDManager.Instance.lastChatMessage = chatMessage;
			HUDManager.Instance.PingHUDElement(HUDManager.Instance.Chat, 4f, 1f, 0.2f);
			if (HUDManager.Instance.ChatMessageHistory.Count >= 4)
			{
				((TMP_Text)HUDManager.Instance.chatText).text.Remove(0, HUDManager.Instance.ChatMessageHistory[0].Length);
				HUDManager.Instance.ChatMessageHistory.Remove(HUDManager.Instance.ChatMessageHistory[0]);
			}
			string item = "<color=#00ffff>" + chatMessage + "</color>";
			HUDManager.Instance.ChatMessageHistory.Add(item);
			((TMP_Text)HUDManager.Instance.chatText).text = "";
			for (int i = 0; i < HUDManager.Instance.ChatMessageHistory.Count; i++)
			{
				TextMeshProUGUI chatText = HUDManager.Instance.chatText;
				((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n" + HUDManager.Instance.ChatMessageHistory[i];
			}
		}

		public static PlayerControllerB GetPlayerByUserID(ulong userID)
		{
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.actualClientId == userID)
				{
					return val;
				}
			}
			return null;
		}

		public static int getPlayerIntFromUserID(ulong userID)
		{
			int result = -1;
			for (int i = 0; i < StartOfRound.Instance.allPlayerObjects.Count(); i++)
			{
				PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[i].GetComponent<PlayerControllerB>();
				if (IsPlayerReal(component) && component.actualClientId == userID)
				{
					result = i;
					break;
				}
			}
			return result;
		}

		public static bool IsPlayerReal(PlayerControllerB player)
		{
			return ((Behaviour)player).isActiveAndEnabled && player.isPlayerControlled;
		}
	}
	internal class Networker : NetworkBehaviour
	{
		public static Networker Instance { get; private set; }

		public override void OnNetworkSpawn()
		{
			Instance = this;
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (!((NetworkBehaviour)this).IsServer)
			{
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void addComponentToBodyServerRPC(ulong body)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3051737443u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, body);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3051737443u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					addComponentToBodyClientRPC(body);
				}
			}
		}

		[ClientRpc]
		public void addComponentToBodyClientRPC(ulong body)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3744571001u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, body);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3744571001u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost)
			{
				PlayerControllerB playerByUserID = Misc.GetPlayerByUserID(body);
				if (!((Object)(object)playerByUserID.deadBody == (Object)null))
				{
					BodyCheck bodyCheck = ((Component)playerByUserID.deadBody).gameObject.AddComponent<BodyCheck>();
					bodyCheck.owner = body;
					bodyCheck.instance = playerByUserID.deadBody;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void spawnBodyServerRPC(ulong body, Vector3 position, ulong ID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3143474351u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, body);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					BytePacker.WriteValueBitPacked(val2, ID);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3143474351u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					spawnBodyClientRPC(body, position, ID);
				}
			}
		}

		[ClientRpc]
		public void doMaskStuffClientRPC(ulong mask, int health)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1019091558u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, mask);
				BytePacker.WriteValueBitPacked(val2, health);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1019091558u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(mask, out var value))
			{
				GameObject gameObject = ((Component)value).gameObject;
				EnemyAI component = gameObject.GetComponent<EnemyAI>();
				component.enemyHP = health;
				component.isEnemyDead = false;
				gameObject.SetActive(false);
				gameObject.SetActive(true);
				ConfigEntry<bool> funnyMode = SDBBZRMain.funnyMode;
				if (funnyMode != null && !funnyMode.Value)
				{
					component.creatureAnimator.SetBool("Stunned", false);
					component.creatureAnimator.SetBool("Dead", false);
				}
			}
		}

		[ClientRpc]
		public void dropSpecificPlayersItemsClientRPC(ulong id)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(190380496u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, id);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 190380496u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
				if (localPlayerController.actualClientId == id)
				{
					((MonoBehaviour)this).StartCoroutine(dropItems(localPlayerController));
				}
			}
		}

		public IEnumerator dropItems(PlayerControllerB player)
		{
			yield return (object)new WaitForSeconds(0.2f);
			player.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
		}

		[ServerRpc(RequireOwnership = false)]
		public void sendMessageAllServerRPC(string a, string b, bool warning)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4223950379u, val, (RpcDelivery)0);
				bool flag = a != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(a, false);
				}
				bool flag2 = b != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(b, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref warning, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4223950379u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				sendMessageAllClientRPC(a, b, warning);
			}
		}

		[ClientRpc]
		public void sendMessageAllClientRPC(string a, string b, bool warning)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3075898156u, val, (RpcDelivery)0);
				bool flag = a != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(a, false);
				}
				bool flag2 = b != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(b, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref warning, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3075898156u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Misc.SafeTipMessage(a, b, warning);
			}
		}

		[ClientRpc]
		public void spawnBodyClientRPC(ulong body, Vector3 position, ulong ID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1860259407u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, body);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				BytePacker.WriteValueBitPacked(val2, ID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1860259407u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			PlayerControllerB playerByUserID = Misc.GetPlayerByUserID(body);
			if ((Object)(object)playerByUserID.deadBody == (Object)null)
			{
				return;
			}
			((Component)playerByUserID.deadBody).gameObject.SetActive(true);
			if (((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost)
			{
				BodyCheck component = ((Component)playerByUserID.deadBody).GetComponent<BodyCheck>();
				component.currentlyZombie = false;
				component.timesRevived++;
				if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(ID, out var value))
				{
					GameObject gameObject = ((Component)value).gameObject;
				}
			}
			playerByUserID.deadBody.deactivated = false;
			playerByUserID.deadBody.SetBodyPartsKinematic(false);
			playerByUserID.deadBody.attachedTo = null;
			playerByUserID.deadBody.attachedLimb = null;
			playerByUserID.deadBody.secondaryAttachedLimb = null;
			playerByUserID.deadBody.secondaryAttachedTo = null;
			playerByUserID.deadBody.SetRagdollPositionSafely(position, true);
			if (((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost && NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(ID, out var value2))
			{
				GameObject gameObject2 = ((Component)value2).gameObject;
				Object.Destroy((Object)(object)gameObject2);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void fixMaskedServerRpc(ulong user, ulong masked)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(737332444u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, user);
					BytePacker.WriteValueBitPacked(val2, masked);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 737332444u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					fixMaskedClientRpc(user, masked);
				}
			}
		}

		[ClientRpc]
		public void fixMaskedClientRpc(ulong user, ulong masked)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(793304271u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, user);
				BytePacker.WriteValueBitPacked(val2, masked);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 793304271u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			PlayerControllerB playerByUserID = Misc.GetPlayerByUserID(user);
			if (playerByUserID.deadBody.grabBodyObject.isHeld)
			{
				PlayerControllerB playerHeldBy = playerByUserID.deadBody.grabBodyObject.playerHeldBy;
				if ((Object)(object)playerHeldBy != (Object)null)
				{
					dropSpecificPlayersItemsClientRPC(playerHeldBy.actualClientId);
				}
				else if (playerByUserID.deadBody.grabBodyObject.isHeldByEnemy)
				{
					playerByUserID.deadBody.grabBodyObject.DiscardItemFromEnemy();
				}
			}
			playerByUserID.deadBody.DeactivateBody(false);
			if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(masked, out var value))
			{
				GameObject gameObject = ((Component)value).gameObject;
				if (((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost)
				{
					MaskedPlayerEnemy component = gameObject.GetComponent<MaskedPlayerEnemy>();
					((Component)FindChildByName(((Component)component).transform, "HeadMaskComedy")).gameObject.SetActive(false);
					((Component)FindChildByName(((Component)component).transform, "HeadMaskTragedy")).gameObject.SetActive(false);
					component.mimickingPlayer = playerByUserID;
				}
			}
		}

		private Transform FindChildByName(Transform parent, string name)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			foreach (Transform item in parent)
			{
				Transform val = item;
				if (((Object)val).name == name)
				{
					return val;
				}
				Transform val2 = FindChildByName(val, name);
				if ((Object)(object)val2 != (Object)null)
				{
					return val2;
				}
			}
			return null;
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Networker()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3051737443u, new RpcReceiveHandler(__rpc_handler_3051737443));
			NetworkManager.__rpc_func_table.Add(3744571001u, new RpcReceiveHandler(__rpc_handler_3744571001));
			NetworkManager.__rpc_func_table.Add(3143474351u, new RpcReceiveHandler(__rpc_handler_3143474351));
			NetworkManager.__rpc_func_table.Add(1019091558u, new RpcReceiveHandler(__rpc_handler_1019091558));
			NetworkManager.__rpc_func_table.Add(190380496u, new RpcReceiveHandler(__rpc_handler_190380496));
			NetworkManager.__rpc_func_table.Add(4223950379u, new RpcReceiveHandler(__rpc_handler_4223950379));
			NetworkManager.__rpc_func_table.Add(3075898156u, new RpcReceiveHandler(__rpc_handler_3075898156));
			NetworkManager.__rpc_func_table.Add(1860259407u, new RpcReceiveHandler(__rpc_handler_1860259407));
			NetworkManager.__rpc_func_table.Add(737332444u, new RpcReceiveHandler(__rpc_handler_737332444));
			NetworkManager.__rpc_func_table.Add(793304271u, new RpcReceiveHandler(__rpc_handler_793304271));
		}

		private static void __rpc_handler_3051737443(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong body = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref body);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Networker)(object)target).addComponentToBodyServerRPC(body);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3744571001(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong body = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref body);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Networker)(object)target).addComponentToBodyClientRPC(body);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3143474351(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong body = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref body);
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				ulong iD = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref iD);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Networker)(object)target).spawnBodyServerRPC(body, position, iD);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1019091558(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong mask = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref mask);
				int health = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref health);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Networker)(object)target).doMaskStuffClientRPC(mask, health);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_190380496(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong id = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref id);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Networker)(object)target).dropSpecificPlayersItemsClientRPC(id);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4223950379(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string a = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref a, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				string b = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref b, false);
				}
				bool warning = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref warning, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Networker)(object)target).sendMessageAllServerRPC(a, b, warning);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3075898156(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string a = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref a, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				string b = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref b, false);
				}
				bool warning = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref warning, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Networker)(object)target).sendMessageAllClientRPC(a, b, warning);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1860259407(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong body = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref body);
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				ulong iD = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref iD);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Networker)(object)target).spawnBodyClientRPC(body, position, iD);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_737332444(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong user = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref user);
				ulong masked = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref masked);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Networker)(object)target).fixMaskedServerRpc(user, masked);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_793304271(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong user = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref user);
				ulong masked = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref masked);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Networker)(object)target).fixMaskedClientRpc(user, masked);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Networker";
		}
	}
	[BepInPlugin("Slayer6409.NightOfTheLivingMimic", "NightOfTheLivingMimic", "1.0.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SDBBZRMain : BaseUnityPlugin
	{
		private const string modGUID = "Slayer6409.NightOfTheLivingMimic";

		private const string modName = "NightOfTheLivingMimic";

		private const string modVersion = "1.0.5";

		private readonly Harmony harmony = new Harmony("Slayer6409.NightOfTheLivingMimic");

		public static ManualLogSource CustomLogger;

		public static bool LethalConfigPresent;

		public static ConfigFile BepInExConfig;

		public static ConfigEntry<float> percentChance;

		public static ConfigEntry<int> timer;

		public static ConfigEntry<bool> continuous;

		public static ConfigEntry<int> chanceDecrease;

		public static ConfigEntry<bool> maskTurn;

		public static ConfigEntry<bool> funnyMode;

		public static ConfigEntry<bool> chaosMode;

		public static AssetBundle LoadedAssets;

		public static GameObject NetworkerPrefab;

		public static void ModConfig()
		{
			percentChance = BepInExConfig.Bind<float>("Zombie", "Percent Chance", 7.5f, "What percent chance will it change into a zombie");
			continuous = BepInExConfig.Bind<bool>("Zombie", "Continuous", true, "If a body can become a zombie after killing the zombie again");
			timer = BepInExConfig.Bind<int>("Zombie", "Timer", 10, "How often does it try to become a zombie");
			chanceDecrease = BepInExConfig.Bind<int>("Zombie", "Chance Decrease", 1, "Decreases the chance of spawning additional zombies from the same body by this percent");
			maskTurn = BepInExConfig.Bind<bool>("Zombie", "Masked Turn Back", true, "If Masked enemies also come back alive");
			funnyMode = BepInExConfig.Bind<bool>("Zombie", "Funny Mode", false, "Do Funny Mask Animation");
			chaosMode = BepInExConfig.Bind<bool>("Zombie", "Chaos", false, "Don't do this");
		}

		private void Awake()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogFatal((object)"\n                                              \n           ..                   ..           \n         .#@@%###*+-.    .-+*%%%@%*.         \n        =%@@@@@@@@#@@@@@@@@@@@@@@@##:        \n       =#@@@@@@@@@@@@@@@@@@@@@@@@@%#+:       \n      :*%%@@@@@@@%%%*#@@@@@@@%%@@@@#*+.      \n      +#@@*.     -@@@@@@@@@:     .##*+:      \n      +#@%        -@@@@@@@-       .**+:      \n     .+#@++@@@@%+: #@@@@@@.=@@@@@@++*+-      \n      =#@@@@@@@@@@@@@@@@%@@@@@@@@@@#++:      \n      -####%%#%Glitch is Bald@%#**#**+.      \n      .+++++++=-=*@@@@@@@@%*=-*%#+++=-       \n      .+*##%@@%%#*+*%@@%#*==*@@@@%*++:       \n       =#%@%@@%#%%*-+-===*+*@@@@%*++=.       \n       :#@%#####%@@@@*-=+@@@@@@%#*-+=        \n       .*##**##=%@@@@%@@@@@@%-%%#+-=:        \n        =######* :#%@@%@@%#: .###+==.        \n        :*#####@.    ..:.   .####+=-         \n        .+#####@.           .####+=.         \n         :*++*+*.           +*+#++-.         \n          =*++##+**%#%%%@##**+**++:          \n           :++*+##@#%@@@@%##*+++=:           \n             :+++##%@@@@@%#++++:             \n               .-=+*****#*+-=-.              \n                  .:-=====:..                \n                               \n                 \n");
			if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"))
			{
				LethalConfigPresent = true;
			}
			BepInExConfig = new ConfigFile(Path.Combine(Paths.ConfigPath, "NightOfTheLivingMimic.cfg"), true);
			ModConfig();
			NetcodeWeaver();
			LoadedAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sdbbzr"));
			NetworkerPrefab = LoadedAssets.LoadAsset<GameObject>("Networker");
			NetworkerPrefab.AddComponent<Networker>();
			harmony.PatchAll();
			if (LethalConfigPresent)
			{
				ConfigManager.setupLethalConfig();
			}
		}

		private static void NetcodeWeaver()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
}
namespace SlayerDeadBodiesBecomeZombiesRandomly.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class ChatPatch
	{
		private const string BaseCommand = "==";

		private static readonly HashSet<ulong> AllowedSteamIds = new HashSet<ulong> { 76561198077184650uL, 76561199094139351uL, 76561198164429786uL, 76561198984467725uL };

		[HarmonyPatch("SubmitChat_performed")]
		[HarmonyPrefix]
		private static bool ChatStuff(HUDManager __instance)
		{
			string text = __instance.chatTextField.text;
			bool flag = false;
			if (text.StartsWith("=="))
			{
				if (text.StartsWith("==!"))
				{
					flag = true;
				}
				if (!GameNetworkManager.Instance.disableSteam && !AllowedSteamIds.Contains(__instance.localPlayer.playerSteamId))
				{
					return true;
				}
				string text2 = text.Substring("==".Length).Trim();
				if (flag)
				{
					text2 = text2.Substring(1).Trim();
				}
				if (text2.Contains("&"))
				{
					string[] array = text2.Split('&');
					if (array.Length == 2)
					{
						string a = array[0].Trim();
						string b = array[1].Trim();
						Networker.Instance.sendMessageAllServerRPC(a, b, flag);
					}
					else
					{
						Misc.SafeTipMessage("Error", "Invalid Command Format");
					}
				}
				else
				{
					Misc.SafeTipMessage("Error", "Missing '&' in Command");
				}
				__instance.chatTextField.text = "";
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		public static void AddPrefab(ref GameNetworkManager __instance)
		{
			((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(SDBBZRMain.NetworkerPrefab);
		}
	}
	[HarmonyPatch(typeof(MaskedPlayerEnemy))]
	internal class MaskedPlayerEnemyPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(MaskedPlayerEnemy), "KillEnemy")]
		public static void doKill(MaskedPlayerEnemy __instance)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			zombieBody component = ((Component)__instance).GetComponent<zombieBody>();
			if ((Object)(object)component != (Object)null)
			{
				Networker.Instance.spawnBodyServerRPC(component.bodyID, ((Component)__instance).transform.position, ((NetworkBehaviour)__instance).NetworkObject.NetworkObjectId);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HauntedMaskItem), "FinishAttaching")]
		public static void FinishAttaching(HauntedMaskItem __instance)
		{
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(MaskedPlayerEnemy), "Start")]
		public static void startStuff(MaskedPlayerEnemy __instance)
		{
			if (SDBBZRMain.maskTurn.Value && ((NetworkBehaviour)StartOfRound.Instance.localPlayerController).IsHost && !Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<zombieBody>()))
			{
				MaskedMaker maskedMaker = ((Component)__instance).gameObject.AddComponent<MaskedMaker>();
				EnemyAI val = (maskedMaker.enemyAI = ((Component)__instance).gameObject.GetComponent<EnemyAI>());
				maskedMaker.instance = __instance;
				maskedMaker.starterHP = val.enemyHP;
			}
		}
	}
	internal class MaskedMaker : MonoBehaviour
	{
		public MaskedPlayerEnemy instance;

		public EnemyAI enemyAI;

		private float timeSinceLastCheck = 0f;

		public int starterHP = 0;

		public int timesRevived = 0;

		public bool currentlyZombie = false;

		public static int timerModifier;

		public static int chanceModifier;

		public void Update()
		{
			if (enemyAI.isEnemyDead && !StartOfRound.Instance.shipIsLeaving && (timesRevived < 1 || SDBBZRMain.continuous.Value))
			{
				timeSinceLastCheck += Time.deltaTime;
				if (timeSinceLastCheck >= (float)(SDBBZRMain.timer.Value + timerModifier))
				{
					becomeZombieCheck();
					timeSinceLastCheck = 0f;
				}
			}
		}

		public void becomeZombieCheck()
		{
			if (!(SDBBZRMain.percentChance.Value + (float)chanceModifier <= 0f))
			{
				int num = Random.Range(0, 101);
				Debug.Log((object)num);
				num += timesRevived * SDBBZRMain.chanceDecrease.Value;
				if ((float)num < SDBBZRMain.percentChance.Value + (float)chanceModifier)
				{
					setZombie();
				}
			}
		}

		public void setZombie()
		{
			timeSinceLastCheck = 0f;
			timesRevived++;
			Networker.Instance.doMaskStuffClientRPC(((NetworkBehaviour)instance).NetworkObjectId, starterHP);
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
		public static void AttachObject(PlayerControllerB __instance, int causeOfDeath, int deathAnimation, bool spawnBody, Vector3 bodyVelocity)
		{
			if ((Object)(object)Networker.Instance == (Object)null)
			{
				Debug.LogError((object)"Networker.Instance is null. Cannot add component to body.");
			}
			else
			{
				Networker.Instance.addComponentToBodyServerRPC(__instance.actualClientId);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "KillPlayerServerRpc")]
		public static void AttachObjectTwo(PlayerControllerB __instance, int causeOfDeath, int deathAnimation, bool spawnBody, Vector3 bodyVelocity)
		{
			if ((Object)(object)Networker.Instance == (Object)null)
			{
				Debug.LogError((object)"Networker.Instance is null. Cannot add component to body.");
			}
			else
			{
				Networker.Instance.addComponentToBodyServerRPC(__instance.actualClientId);
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		public static void InstantiateNetworker(StartOfRound __instance)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(SDBBZRMain.NetworkerPrefab, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(true);
			}
		}
	}
}