Decompiled source of Mystery Button v1.2.0

plugins/MysteryButton.dll

Decompiled 2 weeks ago
using System;
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.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MysteryButton.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem.Utilities;

[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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("MysteryButton")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+fa86c88ea9995979d113e3be1a738f1d03b1090d")]
[assembly: AssemblyProduct("MysteryButton")]
[assembly: AssemblyTitle("MysteryButton")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 MysteryButton
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MysteryButton";

		public const string PLUGIN_NAME = "MysteryButton";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MysteryButton.Scripts
{
	public enum BadEffectType
	{
		StartMeteorShower,
		TeleportPlayerToRandomPosition,
		SwitchPlayersPosition,
		OpenAllSteamValveHazard,
		PlayerDrunkEffect,
		LeaveEarly,
		RandomPlayerIncreaseInsanity,
		BerserkTurrets,
		SpawnOneEnemy,
		SpawnMultipleEnemies,
		TurnOffLights,
		OpenCloseDoors
	}
	public enum EffectType
	{
		Good,
		Bad
	}
	public enum GoodEffectType
	{
		SpawnOneScrap,
		SpawnMultipleScrap,
		SpawnOneExpensiveScrap,
		SpawnMultipleExpensiveScrap,
		ExplodeLandmines,
		RevivePlayer
	}
	[BepInPlugin("MysteryButton", "MysteryButton", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MysteryButton : BaseUnityPlugin
	{
		public static List<AssetBundle> Bundles = new List<AssetBundle>();

		public static Material buttonUsedMaterial;

		public static Harmony? Harmony { get; protected set; }

		public static MysteryButtonConfig ModConfig { get; private set; }

		protected void Awake()
		{
			Patch();
			PatchNetCode();
			string text = "\n";
			text += "*         *     *\n";
			text += "    *  _______ \n";
			text += " * ___|_______|___  *\n";
			text += "  |_______________|";
			((BaseUnityPlugin)this).Logger.LogInfo((object)text);
			AddBundle("mysterybutton");
			if (Bundles.Count == 0)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded no bundles.");
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("Loaded {0} bundles : {1}", Bundles.Count, string.Join(", ", Bundles)));
			}
			ModConfig = new MysteryButtonConfig(((BaseUnityPlugin)this).Config);
			AddFromBundle<MysteryButtonAI>(Bundles.First(), "MysteryButton");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MysteryButton v1.0.0 has loaded!");
		}

		private void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("MysteryButton");
			}
			((BaseUnityPlugin)this).Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogDebug((object)"Finished patching!");
		}

		private void PatchNetCode()
		{
			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);
					}
				}
			}
		}

		private void AddBundle(string bundleName)
		{
			string location = Assembly.GetExecutingAssembly().Location;
			string directoryName = Path.GetDirectoryName(location);
			if (directoryName != null)
			{
				string text = Path.Combine(directoryName, bundleName);
				AssetBundle val = AssetBundle.LoadFromFile(text);
				if ((Object)(object)val == (Object)null)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load bundle " + bundleName));
				}
				else
				{
					Bundles.Add(val);
				}
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Assembly directory not found");
			}
		}

		private void AddFromBundle<T>(AssetBundle bundle, string modName) where T : EnemyAI
		{
			EnemyType val = bundle.LoadAsset<EnemyType>("MysteryButtonET");
			if ((Object)(object)val == (Object)null || (Object)(object)val.enemyPrefab == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Could not load enemy " + modName + " from bundle " + ((Object)bundle).name + "."));
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded enemy " + modName + " from bundle " + ((Object)bundle).name + "."));
			TerminalNode val2 = bundle.LoadAsset<TerminalNode>("MysteryButtonTN");
			if ((Object)(object)val2 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Could not load " + modName + " terminal node from " + ((Object)bundle).name + "."));
				return;
			}
			TerminalKeyword val3 = bundle.LoadAsset<TerminalKeyword>("MysteryButtonTK");
			if ((Object)(object)val3 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Could not load " + modName + " terminal keyword from " + ((Object)bundle).name + "."));
				return;
			}
			val.enemyPrefab = bundle.LoadAsset<GameObject>(modName + ".prefab");
			if ((Object)(object)val.enemyPrefab == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Could not load enemy prefab " + modName + " from bundle " + ((Object)bundle).name + "."));
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded enemy " + modName + " prefab from bundle " + ((Object)bundle).name + "."));
			T val4 = val.enemyPrefab.AddComponent<T>();
			if ((Object)(object)val4 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Could not attach AI to enemy " + modName + " from " + ((Object)bundle).name + "."));
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Attached " + typeof(T).Name + " script to enemy " + modName + " from " + ((Object)bundle).name + "."));
			buttonUsedMaterial = bundle.LoadAsset<Material>("ButtonUsedMaterial");
			if ((Object)(object)buttonUsedMaterial == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Could not load material ButtonUsedMaterial from bundle " + ((Object)bundle).name + "."));
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded material ButtonUsedMaterial from bundle " + ((Object)bundle).name + "."));
			((EnemyAI)val4).enemyType = val;
			((EnemyAI)val4).enemyType.enemyPrefab.GetComponentInChildren<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)val4;
			int value = MysteryButtonConfig.ConfigMaxAmount.Value;
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Maximum number of buttons per round set to {value}");
			((EnemyAI)val4).enemyType.MaxCount = value;
			NetworkPrefabs.RegisterNetworkPrefab(((EnemyAI)val4).enemyType.enemyPrefab);
			var (dictionary, dictionary2) = ConfigParsing(MysteryButtonConfig.ConfigRarity.Value);
			if (!MysteryButtonConfig.ConfigSpawnDisabled.Value)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Spawn enabled for MysteryButton");
				Enemies.RegisterEnemy(((EnemyAI)val4).enemyType, dictionary, dictionary2, val2, val3);
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded enemy " + val2.creatureName + " with terminal name " + val3.word + "."));
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Spawn disabled for MysteryButton");
			}
		}

		private (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			foreach (string item in from s in configMoonRarity.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (int.TryParse(array[1], out var result))
				{
					if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
					{
						dictionary[result2] = result;
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Registered spawn rate for level type {result2} to {result}");
					}
					else
					{
						dictionary2[text] = result;
						((BaseUnityPlugin)this).Logger.LogInfo((object)$"Registered spawn rate for custom level type {text} to {result}");
					}
				}
			}
			return (dictionary, dictionary2);
		}
	}
	public class MysteryButtonAI : EnemyAI, INetworkSerializable
	{
		private static int _cpt = 0;

		private const bool IsTest = false;

		private static readonly ManualLogSource Logger = Logger.CreateLogSource("MysteryButton.MysteryButtonAI");

		private static readonly int PlayUsed = Animator.StringToHash("playUsed");

		private static readonly int PlayDestroyed = Animator.StringToHash("playDestroyed");

		private static readonly int PlayIdleBouncing = Animator.StringToHash("playIdleBouncing");

		private static Dictionary<EffectType, int> GoodBadEffects;

		private static int GoodBadEffectsWeightSum;

		private static Dictionary<GoodEffectType, int> GoodEffects;

		private static int GoodEffectsWeightSum;

		private static Dictionary<GoodEffectType, bool> GoodEffectCondition;

		private static Dictionary<BadEffectType, int> BadEffects;

		private static int BadEffectsWeightSum;

		private static Dictionary<BadEffectType, bool> BadEffectCondition;

		private Random _rng;

		private NetworkVariable<bool> _isLock = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private bool _isLocalLock;

		private int _id;

		private AudioClip _buttonAppearClip;

		private AudioClip _buttonUsedClip;

		private AudioClip _buttonUsedBadClip;

		private AudioClip _teleporterBeamClip;

		private List<AudioClip> _playerBadEffectClips;

		private bool _canExplodeLandmines;

		private bool _canMakeTurretsBerserk;

		private bool _canOpenSteamValveHazard;

		private bool _canTurnOffLights;

		private EnemyVent _nearestVent;

		private Animator _animator;

		public override void Start()
		{
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			Logger.LogInfo((object)"Start");
			_isLocalLock = false;
			_animator = ((Component)this).gameObject.GetComponentInChildren<Animator>();
			float num = 10f;
			((MonoBehaviour)this).InvokeRepeating("PlayIdleAnimation", 10f, num);
			AudioSource component = ((Component)this).gameObject.GetComponent<AudioSource>();
			Logger.LogInfo((object)("AudioSource is " + (Object.op_Implicit((Object)(object)component) ? " not null" : "null")));
			base.creatureSFX = ((Component)this).gameObject.GetComponent<AudioSource>();
			AudioClip[] array = base.enemyType?.audioClips ?? Array.Empty<AudioClip>();
			_buttonAppearClip = array[0];
			_buttonUsedClip = array[1];
			_buttonUsedBadClip = array[2];
			_playerBadEffectClips = new List<AudioClip>(2)
			{
				array[3],
				array[4]
			};
			_teleporterBeamClip = array[5];
			_id = _cpt++;
			base.enemyHP = 100;
			_rng = new Random((int)((NetworkBehaviour)this).NetworkObjectId);
			if (Object.op_Implicit((Object)(object)base.creatureSFX))
			{
				base.creatureSFX.PlayOneShot(_buttonAppearClip);
			}
			List<Landmine> list = (from mine in Object.FindObjectsOfType<Landmine>()
				where !mine.hasExploded
				select mine).ToList();
			_canExplodeLandmines = list.Count > 0;
			List<SteamValveHazard> list2 = Object.FindObjectsOfType<SteamValveHazard>().ToList();
			_canOpenSteamValveHazard = list2.Count > 0;
			List<Turret> list3 = Object.FindObjectsOfType<Turret>().ToList();
			_canMakeTurretsBerserk = list3.Count > 0;
			List<EnemyVent> list4 = RoundManager.Instance.allEnemyVents.ToList();
			if (list4.Count > 0)
			{
				_nearestVent = list4[0];
				foreach (EnemyVent item in list4)
				{
					float num2 = Vector3.Distance(((Component)_nearestVent).transform.position, ((Component)this).transform.position);
					float num3 = Vector3.Distance(((Component)item).transform.position, ((Component)this).transform.position);
					if (num2 > num3)
					{
						_nearestVent = item;
					}
				}
			}
			GoodBadEffects = ConfigEffectParsing<EffectType>(MysteryButtonConfig.ConfigEffects.Value);
			GoodBadEffectsWeightSum = GoodBadEffects.Sum((KeyValuePair<EffectType, int> effect) => effect.Value);
			GoodEffects = ConfigEffectParsing<GoodEffectType>(MysteryButtonConfig.ConfigGoodEffects.Value);
			GoodEffectsWeightSum = GoodEffects.Sum((KeyValuePair<GoodEffectType, int> effect) => effect.Value);
			BadEffects = ConfigEffectParsing<BadEffectType>(MysteryButtonConfig.ConfigBadEffects.Value);
			BadEffectsWeightSum = BadEffects.Sum((KeyValuePair<BadEffectType, int> effect) => effect.Value);
			GoodEffectCondition = new Dictionary<GoodEffectType, bool> { [GoodEffectType.ExplodeLandmines] = _canExplodeLandmines };
			BadEffectCondition = new Dictionary<BadEffectType, bool>
			{
				[BadEffectType.OpenAllSteamValveHazard] = _canOpenSteamValveHazard,
				[BadEffectType.BerserkTurrets] = _canMakeTurretsBerserk,
				[BadEffectType.TurnOffLights] = _canTurnOffLights
			};
			((EnemyAI)this).Start();
		}

		private void PlayIdleAnimation()
		{
			if (Object.op_Implicit((Object)(object)_animator) && !_isLocalLock && !_isLock.Value)
			{
				_animator.SetTrigger(PlayIdleBouncing);
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			Logger.LogInfo((object)("OnNetworkSpawn, IsServer=" + ((NetworkBehaviour)this).IsServer));
			if (((NetworkBehaviour)this).IsServer)
			{
				_isLock.Value = false;
				((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback += NetworkManager_OnClientConnectedCallback;
			}
			else
			{
				NetworkVariable<bool> isLock = _isLock;
				isLock.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)isLock.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnSomeValueChanged));
			}
		}

		public override void OnNetworkDespawn()
		{
			((NetworkBehaviour)this).OnNetworkDespawn();
			if (!((NetworkBehaviour)this).IsServer)
			{
				NetworkVariable<bool> isLock = _isLock;
				isLock.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)isLock.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnSomeValueChanged));
			}
		}

		private void NetworkManager_OnClientConnectedCallback(ulong obj)
		{
			InitNetworkVariables();
		}

		private void OnSomeValueChanged(bool previous, bool current)
		{
			Logger.LogInfo((object)$"Detected NetworkVariable Change: Previous: {previous} | Current: {current}");
			_isLock.Value = current;
		}

		private void InitNetworkVariables()
		{
			_isLock.Value = false;
			((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback -= NetworkManager_OnClientConnectedCallback;
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetLockServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1942027028u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1942027028u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Logger.LogInfo((object)"SetLock");
					_isLock.Value = true;
				}
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (!_isLocalLock && !_isLock.Value)
			{
				BreakerBox val = Object.FindObjectOfType<BreakerBox>();
				_canTurnOffLights = Object.op_Implicit((Object)(object)val) && val.isPowerOn;
				_isLocalLock = true;
				Logger.LogInfo((object)("OnCollideWithPlayer, id=" + _id));
				SetLockServerRpc();
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null)
				{
					DoEffect(((Object)component).name);
				}
			}
		}

		public void DoEffect(string playerName)
		{
			int num = _rng.Next(0, GoodBadEffectsWeightSum);
			bool flag = num < GoodBadEffects.GetValueOrDefault(EffectType.Good, 50);
			if (flag)
			{
				Logger.LogInfo((object)"Good effect");
				DoGoodEffect(playerName);
			}
			else
			{
				Logger.LogInfo((object)"Bad effect");
				DoBadEffect(playerName);
			}
			KillButtonServerRpc(flag);
		}

		private void DoGoodEffect(string playerName)
		{
			GoodEffectType? randomEffect = GetRandomEffect(_rng, GoodEffectsWeightSum, GoodEffects, GoodEffectCondition);
			ManualLogSource logger = Logger;
			GoodEffectType? goodEffectType = randomEffect;
			logger.LogInfo((object)("Good effect=" + goodEffectType.ToString()));
			bool flag = false;
			switch (randomEffect)
			{
			case GoodEffectType.SpawnOneScrap:
				SpawnScrapServerRpc();
				break;
			case GoodEffectType.SpawnMultipleScrap:
				SpawnScrapServerRpc(_rng.Next(1, 6));
				break;
			case GoodEffectType.SpawnOneExpensiveScrap:
				SpawnExpensiveScrapServerRpc(1);
				break;
			case GoodEffectType.SpawnMultipleExpensiveScrap:
				SpawnExpensiveScrapServerRpc(_rng.Next(1, 11));
				break;
			case GoodEffectType.ExplodeLandmines:
				ExplodeLandminesServerRpc();
				break;
			case GoodEffectType.RevivePlayer:
				RevivePlayerServerRpc(playerName);
				break;
			default:
				SpawnScrapServerRpc();
				break;
			}
		}

		private void DoBadEffect(string playerName)
		{
			BadEffectType? randomEffect = GetRandomEffect(_rng, BadEffectsWeightSum, BadEffects, BadEffectCondition);
			ManualLogSource logger = Logger;
			BadEffectType? badEffectType = randomEffect;
			logger.LogInfo((object)("Bad effect=" + badEffectType.ToString()));
			bool flag = false;
			switch (randomEffect)
			{
			case BadEffectType.StartMeteorShower:
				StartMeteorEventServerRpc();
				break;
			case BadEffectType.TeleportPlayerToRandomPosition:
				TeleportPlayerToRandomPositionServerRpc(playerName);
				break;
			case BadEffectType.SwitchPlayersPosition:
				SwitchPlayersPositionServerRpc(playerName);
				break;
			case BadEffectType.OpenAllSteamValveHazard:
				OpenAllSteamValveHazardServerRpc();
				break;
			case BadEffectType.PlayerDrunkEffect:
				PlayerDrunkServerRpc();
				break;
			case BadEffectType.LeaveEarly:
				LeaveEarlyServerRpc();
				break;
			case BadEffectType.RandomPlayerIncreaseInsanity:
				RandomPlayerIncreaseInsanityServerRpc();
				break;
			case BadEffectType.BerserkTurrets:
				BerserkTurretServerRpc();
				break;
			case BadEffectType.SpawnOneEnemy:
				SpawnEnemyServerRpc(1);
				break;
			case BadEffectType.SpawnMultipleEnemies:
				SpawnEnemyServerRpc(_rng.Next(1, 5));
				break;
			case BadEffectType.TurnOffLights:
				TurnOffLightsServerRpc();
				break;
			case BadEffectType.OpenCloseDoors:
			{
				int num = _rng.Next(0, 100);
				if (num < 50)
				{
					OpenAllDoorsServerRpc(playerName);
				}
				else
				{
					CloseAllDoorsServerRpc(playerName);
				}
				break;
			}
			default:
				TeleportPlayerToRandomPositionServerRpc(playerName);
				break;
			}
		}

		private T? GetRandomEffect<T>(Random rng, int weightSum, Dictionary<T, int> weightDict, Dictionary<T, bool> conditions) where T : struct
		{
			int num = rng.Next(0, weightSum);
			Logger.LogInfo((object)("Effect=" + num));
			T? result = null;
			int num2 = 0;
			foreach (KeyValuePair<T, int> item in weightDict)
			{
				num2 += item.Value;
				Logger.LogInfo((object)("currentValue=" + num2 + ", key=" + item.Key.ToString() + " / value=" + item.Value));
				if (num < num2 && (!conditions.ContainsKey(item.Key) || conditions[item.Key]))
				{
					result = item.Key;
					break;
				}
			}
			if (!result.HasValue)
			{
				Logger.LogInfo((object)"No item selected, choosing random one");
				List<T> list = weightDict.Keys.Except(conditions.Keys).ToList();
				result = list[rng.Next(0, list.Count())];
			}
			return result;
		}

		[ServerRpc(RequireOwnership = false)]
		public void KillButtonServerRpc(bool isGood)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3989475145u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isGood, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3989475145u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					KillButtonClientRpc(isGood);
				}
			}
		}

		[ClientRpc]
		public void KillButtonClientRpc(bool isGood)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3439466363u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isGood, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3439466363u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Logger.LogInfo((object)"KillButtonClientRpc");
			if (Object.op_Implicit((Object)(object)base.creatureSFX))
			{
				base.creatureSFX.Stop();
				if (isGood)
				{
					base.creatureSFX.PlayOneShot(_buttonUsedClip);
				}
				else
				{
					base.creatureSFX.PlayOneShot(_buttonUsedBadClip);
				}
			}
			if (isGood)
			{
				Material buttonUsedMaterial = MysteryButton.buttonUsedMaterial;
				((Renderer)((Component)((Component)this).transform.Find("MysteryButton/SpringBones/Bone.004/MysteryButton_Bouton")).GetComponent<MeshRenderer>()).material = buttonUsedMaterial;
			}
			if (Object.op_Implicit((Object)(object)_animator))
			{
				if (isGood)
				{
					_animator.SetBool(PlayUsed, true);
				}
				else
				{
					_animator.SetBool(PlayDestroyed, true);
				}
			}
			((EnemyAI)this).KillEnemy(false);
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayerDrunkServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(210468196u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 210468196u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayerDrunkClientRpc();
				}
			}
		}

		[ClientRpc]
		private void PlayerDrunkClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3941878344u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3941878344u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Logger.LogInfo((object)"PlayerDrunkClientRpc");
			if (!((Object)(object)StartOfRound.Instance != (Object)null))
			{
				return;
			}
			foreach (PlayerControllerB activePlayer in GetActivePlayers())
			{
				Logger.LogInfo((object)("Client: Apply effect to " + activePlayer.playerUsername));
				activePlayer.drunkness = 5f;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void RevivePlayerServerRpc(string? playerName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3050727706u, val, (RpcDelivery)0);
				bool flag = playerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3050727706u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Logger.LogInfo((object)"ButtonAI:RevivePlayerServerRpc");
				PlayerControllerB playerByNameOrFirstOne = GetPlayerByNameOrFirstOne(playerName);
				List<PlayerControllerB> list = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB p) => p.isPlayerDead).ToList();
				if (list.Count > 0)
				{
					PlayerControllerB val3 = list[_rng.Next(0, list.Count)];
					RevivePlayerClientRpc(playerName, ((Object)val3).name);
					TeleportPlayerToPositionClientRpc(((Object)val3).name, ((Component)playerByNameOrFirstOne).transform.position);
				}
			}
		}

		[ClientRpc]
		private void RevivePlayerClientRpc(string? playerName, string? deadPlayerName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_00f8: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2322786277u, val, (RpcDelivery)0);
				bool flag = playerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false);
				}
				bool flag2 = deadPlayerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(deadPlayerName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2322786277u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Logger.LogInfo((object)"ButtonAI:RevivePlayerClientRpc");
			StartOfRound instance = StartOfRound.Instance;
			PlayerControllerB playerByNameOrFirstOne = GetPlayerByNameOrFirstOne(playerName);
			PlayerControllerB deadPlayer = GetPlayerByNameOrFirstOne(deadPlayerName);
			int num = ArrayHelpers.IndexOf<PlayerControllerB>(instance.allPlayerScripts, (Predicate<PlayerControllerB>)((PlayerControllerB p) => ((Object)p).name == ((Object)deadPlayer).name));
			Logger.LogInfo((object)("Client: Trying to revive " + deadPlayer.playerUsername + " with index=" + num));
			int num2 = 100;
			deadPlayer.ResetPlayerBloodObjects(deadPlayer.isPlayerDead);
			if (deadPlayer.isPlayerDead || deadPlayer.isPlayerControlled)
			{
				deadPlayer.isClimbingLadder = false;
				deadPlayer.inVehicleAnimation = false;
				deadPlayer.ResetZAndXRotation();
				((Collider)deadPlayer.thisController).enabled = true;
				deadPlayer.health = num2;
				deadPlayer.disableLookInput = false;
				if (deadPlayer.isPlayerDead)
				{
					deadPlayer.isPlayerDead = false;
					deadPlayer.isPlayerControlled = true;
					deadPlayer.isInElevator = false;
					deadPlayer.isInHangarShipRoom = false;
					deadPlayer.isInsideFactory = playerByNameOrFirstOne.isInsideFactory;
					StartOfRound.Instance.SetPlayerObjectExtrapolate(false);
					deadPlayer.setPositionOfDeadPlayer = false;
					((Behaviour)deadPlayer.helmetLight).enabled = false;
					deadPlayer.Crouch(false);
					deadPlayer.criticallyInjured = false;
					if ((Object)(object)deadPlayer.playerBodyAnimator != (Object)null)
					{
						deadPlayer.playerBodyAnimator.SetBool("Limp", false);
					}
					deadPlayer.bleedingHeavily = false;
					deadPlayer.activatingItem = false;
					deadPlayer.twoHanded = false;
					deadPlayer.inSpecialInteractAnimation = false;
					deadPlayer.disableSyncInAnimation = false;
					deadPlayer.inAnimationWithEnemy = null;
					deadPlayer.holdingWalkieTalkie = false;
					deadPlayer.speakingToWalkieTalkie = false;
					deadPlayer.isSinking = false;
					deadPlayer.isUnderwater = false;
					deadPlayer.sinkingValue = 0f;
					deadPlayer.statusEffectAudio.Stop();
					deadPlayer.DisableJetpackControlsLocally();
					deadPlayer.health = num2;
					deadPlayer.mapRadarDotAnimator.SetBool("dead", false);
					deadPlayer.deadBody = null;
					if ((Object)(object)deadPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController)
					{
						HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false);
						deadPlayer.hasBegunSpectating = false;
						HUDManager.Instance.RemoveSpectateUI();
						HUDManager.Instance.gameOverAnimator.SetTrigger("revive");
						deadPlayer.hinderedMultiplier = 1f;
						deadPlayer.isMovementHindered = 0;
						deadPlayer.sourcesCausingSinking = 0;
						HUDManager.Instance.HideHUD(false);
					}
				}
				SoundManager.Instance.earsRingingTimer = 0f;
				deadPlayer.voiceMuffledByEnemy = false;
				if ((Object)(object)deadPlayer.currentVoiceChatIngameSettings == (Object)null)
				{
					StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
				}
				if ((Object)(object)deadPlayer.currentVoiceChatIngameSettings != (Object)null)
				{
					if ((Object)(object)deadPlayer.currentVoiceChatIngameSettings.voiceAudio == (Object)null)
					{
						deadPlayer.currentVoiceChatIngameSettings.InitializeComponents();
					}
					if ((Object)(object)deadPlayer.currentVoiceChatIngameSettings.voiceAudio != (Object)null)
					{
						((Component)deadPlayer.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>().overridingLowPass = false;
					}
				}
			}
			StartOfRound instance2 = StartOfRound.Instance;
			instance2.livingPlayers++;
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)deadPlayer)
			{
				deadPlayer.bleedingHeavily = false;
				deadPlayer.criticallyInjured = false;
				Animator playerBodyAnimator = deadPlayer.playerBodyAnimator;
				if (playerBodyAnimator != null)
				{
					playerBodyAnimator.SetBool("Limp", false);
				}
				deadPlayer.health = num2;
				HUDManager.Instance.UpdateHealthUI(num2, false);
				deadPlayer.spectatedPlayerScript = null;
				((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false;
				StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, deadPlayer);
				TimeOfDay.Instance.DisableAllWeather(false);
				StartOfRound.Instance.UpdatePlayerVoiceEffects();
				((Renderer)deadPlayer.thisPlayerModel).enabled = true;
			}
			else
			{
				((Renderer)deadPlayer.thisPlayerModel).enabled = true;
				((Renderer)deadPlayer.thisPlayerModelLOD1).enabled = true;
				((Renderer)deadPlayer.thisPlayerModelLOD2).enabled = true;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void RandomPlayerIncreaseInsanityServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(891131010u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 891131010u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					RandomPlayerIncreaseInsanityClientRpc();
				}
			}
		}

		[ClientRpc]
		private void RandomPlayerIncreaseInsanityClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2239663210u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2239663210u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Logger.LogInfo((object)"RandomPlayerIncreaseInsanityClientRpc");
			if ((Object)(object)StartOfRound.Instance != (Object)null)
			{
				PlayerControllerB[] array = (from player in GetActivePlayers()
					where (!player.isPlayerDead || player.isPlayerControlled) && player.playerSteamId != 0
					select player).ToArray();
				PlayerControllerB val3 = array[_rng.Next(array.Length)];
				val3.insanityLevel = val3.maxInsanityLevel;
				val3.JumpToFearLevel(1.25f, true);
				val3.movementAudio.PlayOneShot(_playerBadEffectClips[_rng.Next(0, _playerBadEffectClips.Count)]);
				val3.JumpToFearLevel(1.25f, true);
				RoundManager.Instance.FlickerLights(false, false);
				Logger.LogInfo((object)("Client: Apply max insanity to " + val3.playerUsername));
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void OpenAllDoorsServerRpc(string? entityName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4196566876u, val, (RpcDelivery)0);
				bool flag = entityName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(entityName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4196566876u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				OpenAllDoorsClientRpc(entityName);
			}
		}

		[ClientRpc]
		private void OpenAllDoorsClientRpc(string? entityName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3377014315u, val, (RpcDelivery)0);
				bool flag = entityName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(entityName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3377014315u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Logger.LogInfo((object)"OpenAllDoorsClientRpc");
			PlayerControllerB playerByNameOrFirstOne = GetPlayerByNameOrFirstOne(entityName);
			List<DoorLock> list = Object.FindObjectsOfType<DoorLock>().ToList();
			foreach (DoorLock item in list)
			{
				bool flag2 = !item.isLocked || _rng.Next(0, 10) < 2;
				if (!(!item.isDoorOpened && flag2))
				{
					continue;
				}
				if (item.isLocked)
				{
					Logger.LogInfo((object)("Unlocking door id=" + ((NetworkBehaviour)item).NetworkObjectId));
					item.isLocked = false;
					if (Object.op_Implicit((Object)(object)item.doorLockSFX) && Object.op_Implicit((Object)(object)item.unlockSFX))
					{
						item.doorLockSFX.PlayOneShot(item.unlockSFX);
					}
				}
				item.OpenOrCloseDoor(playerByNameOrFirstOne);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void CloseAllDoorsServerRpc(string? entityName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2649300118u, val, (RpcDelivery)0);
				bool flag = entityName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(entityName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2649300118u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				CloseAllDoorsClientRpc(entityName);
			}
		}

		[ClientRpc]
		private void CloseAllDoorsClientRpc(string? entityName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(420044397u, val, (RpcDelivery)0);
				bool flag = entityName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(entityName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 420044397u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Logger.LogInfo((object)"CloseAllDoorsClientRpc");
			PlayerControllerB playerByNameOrFirstOne = GetPlayerByNameOrFirstOne(entityName);
			List<DoorLock> list = Object.FindObjectsOfType<DoorLock>().ToList();
			Logger.LogInfo((object)("CloseAllDoors: " + list.Count));
			foreach (DoorLock item in list)
			{
				if (!item.isDoorOpened)
				{
					continue;
				}
				item.OpenOrCloseDoor(playerByNameOrFirstOne);
				if (_rng.Next(0, 10) < 2)
				{
					Logger.LogInfo((object)("Locking door id=" + ((NetworkBehaviour)item).NetworkObjectId));
					if (Object.op_Implicit((Object)(object)item.doorLockSFX) && Object.op_Implicit((Object)(object)item.unlockSFX))
					{
						item.doorLockSFX.PlayOneShot(item.unlockSFX);
					}
					item.isLocked = true;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void ExplodeLandminesServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3450030733u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3450030733u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			Logger.LogInfo((object)"ExplodeLandminesServerRpc");
			List<Landmine> list = (from mine in Object.FindObjectsOfType<Landmine>()
				where !mine.hasExploded
				select mine).ToList();
			Logger.LogInfo((object)(list.Count + " landmines found"));
			foreach (Landmine item in list)
			{
				Logger.LogInfo((object)("Exploding landmine id=" + ((NetworkBehaviour)item).NetworkObjectId));
				item.ExplodeMineServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SpawnScrapServerRpc(int amount)
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(822774107u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, amount);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 822774107u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Logger.LogInfo((object)"SpawnScrapServerRpc");
					SpawnScrap(expensiveScrap: false, amount);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SpawnScrapServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3721832110u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3721832110u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Logger.LogInfo((object)"SpawnScrapServerRpc");
					SpawnScrap(expensiveScrap: false, 1);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SpawnExpensiveScrapServerRpc(int amount)
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(962351724u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, amount);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 962351724u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Logger.LogInfo((object)"SpawnExpensiveScrapServerRpc");
					SpawnScrap(expensiveScrap: true, amount);
				}
			}
		}

		private void SpawnScrap(bool expensiveScrap, int amount)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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)
			//IL_007b: 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)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			List<Item> list = StartOfRound.Instance.allItemsList.itemsList.Where((Item item) => item.isScrap && (!expensiveScrap || item.maxValue > 150)).ToList();
			for (int i = 0; i < amount; i++)
			{
				Item val = list[_rng.Next(0, list.Count)];
				Quaternion val2 = Quaternion.AngleAxis(Random.Range(0f, 360f), Vector3.up);
				Vector3 val3 = ((Component)this).transform.position + val2 * Vector3.forward * NextFloat(_rng, 0.3f, 0.6f);
				GameObject val4 = Object.Instantiate<GameObject>(val.spawnPrefab, val3, Quaternion.identity, StartOfRound.Instance.propsContainer);
				int num = _rng.Next(val.minValue, val.maxValue);
				Logger.LogInfo((object)("Spawning item=" + ((Object)val).name + ", value=" + num + ", weight=" + val.weight));
				val4.GetComponent<GrabbableObject>().fallTime = 0f;
				val4.GetComponent<GrabbableObject>().SetScrapValue(num);
				NetworkObject component = val4.GetComponent<NetworkObject>();
				component.Spawn(false);
				SpawnScrapClientRpc(component.NetworkObjectId, num);
			}
		}

		[ClientRpc]
		private void SpawnScrapClientRpc(ulong networkObjectId, int value)
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2066215269u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, networkObjectId);
					BytePacker.WriteValueBitPacked(val2, value);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2066215269u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					NetworkObject val3 = ((NetworkBehaviour)this).NetworkManager.SpawnManager.SpawnedObjects[networkObjectId];
					GrabbableObject component = ((Component)val3).GetComponent<GrabbableObject>();
					component.SetScrapValue(value);
					component.fallTime = 0f;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SpawnEnemyServerRpc(int amount)
		{
			//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)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(617259689u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, amount);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 617259689u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Logger.LogInfo((object)("SpawnEnemyServerRpc, amount=" + amount));
				List<SpawnableEnemyWithRarity> enemies = StartOfRound.Instance.currentLevel.Enemies;
				int count = enemies.Count;
				for (int i = 0; i < amount; i++)
				{
					int index = _rng.Next(0, count);
					SpawnableEnemyWithRarity val3 = enemies[index];
					Logger.LogInfo((object)("Spawning enemy=" + ((Object)val3.enemyType).name));
					GameObject val4 = Object.Instantiate<GameObject>(val3.enemyType.enemyPrefab, ((Component)_nearestVent).transform.position, Quaternion.identity);
					val4.GetComponent<NetworkObject>().Spawn(true);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void BerserkTurretServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3341186683u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3341186683u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					BerserkTurretClientRpc();
				}
			}
		}

		[ClientRpc]
		private void BerserkTurretClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2868831657u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2868831657u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Logger.LogInfo((object)"BerserkTurretClientRpc");
			List<Turret> list = Object.FindObjectsOfType<Turret>().ToList();
			Logger.LogInfo((object)(list.Count + " turrets found"));
			foreach (Turret item in list)
			{
				item.SwitchTurretMode(3);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void TeleportPlayerToRandomPositionServerRpc(string? playerName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(250709698u, val, (RpcDelivery)0);
				bool flag = playerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 250709698u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				TeleportPlayerToRandomPositionClientRpc(playerName);
			}
		}

		[ClientRpc]
		private void TeleportPlayerToRandomPositionClientRpc(string? playerName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1447768774u, val, (RpcDelivery)0);
				bool flag = playerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1447768774u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Logger.LogInfo((object)"TeleportPlayerToRandomPositionClientRpc");
				PlayerControllerB playerByNameOrFirstOne = GetPlayerByNameOrFirstOne(playerName);
				int num = _rng.Next(0, RoundManager.Instance.insideAINodes.Length);
				Vector3 position = RoundManager.Instance.insideAINodes[num].transform.position;
				if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
				{
					Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(playerByNameOrFirstOne);
				}
				playerByNameOrFirstOne.isInElevator = false;
				playerByNameOrFirstOne.isInHangarShipRoom = false;
				playerByNameOrFirstOne.isInsideFactory = true;
				playerByNameOrFirstOne.averageVelocity = 0f;
				playerByNameOrFirstOne.velocityLastFrame = Vector3.zero;
				playerByNameOrFirstOne.TeleportPlayer(position, false, 0f, false, true);
				playerByNameOrFirstOne.beamOutParticle.Play();
				playerByNameOrFirstOne.movementAudio.PlayOneShot(_teleporterBeamClip);
			}
		}

		[ClientRpc]
		private void TeleportPlayerToPositionClientRpc(string? playerName, Vector3 pos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(732321177u, val, (RpcDelivery)0);
				bool flag = playerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 732321177u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Logger.LogInfo((object)"TeleportPlayerToPositionClientRpc");
				PlayerControllerB playerByNameOrFirstOne = GetPlayerByNameOrFirstOne(playerName);
				if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
				{
					Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(playerByNameOrFirstOne);
				}
				playerByNameOrFirstOne.isInElevator = false;
				playerByNameOrFirstOne.isInHangarShipRoom = false;
				playerByNameOrFirstOne.isInsideFactory = true;
				playerByNameOrFirstOne.averageVelocity = 0f;
				playerByNameOrFirstOne.velocityLastFrame = Vector3.zero;
				playerByNameOrFirstOne.TeleportPlayer(pos, false, 0f, false, true);
				playerByNameOrFirstOne.beamOutParticle.Play();
				playerByNameOrFirstOne.movementAudio.PlayOneShot(_teleporterBeamClip);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SwitchPlayersPositionServerRpc(string? playerName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(949913192u, val, (RpcDelivery)0);
				bool flag = playerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 949913192u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SwitchPlayersPositionClientRpc(playerName);
			}
		}

		[ClientRpc]
		private void SwitchPlayersPositionClientRpc(string? playerName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3292154984u, val, (RpcDelivery)0);
				bool flag = playerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3292154984u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Logger.LogInfo((object)"SwitchPlayerPositionClientRpc");
			List<PlayerControllerB> list = (from player in GetActivePlayers()
				where !player.isPlayerDead
				where player.isPlayerControlled
				select player).ToList();
			if (list.Count >= 2)
			{
				PlayerControllerB playerByNameOrFirstOne = GetPlayerByNameOrFirstOne(playerName);
				PlayerControllerB val3;
				do
				{
					val3 = list[_rng.Next(list.Count)];
				}
				while (((NetworkBehaviour)val3).NetworkObjectId == ((NetworkBehaviour)playerByNameOrFirstOne).NetworkObjectId);
				Logger.LogInfo((object)("Switching positions of " + playerByNameOrFirstOne.playerUsername + " and " + val3.playerUsername));
				if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
				{
					Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(playerByNameOrFirstOne);
					Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val3);
				}
				Vector3 val4 = default(Vector3);
				((Vector3)(ref val4))..ctor(((Component)playerByNameOrFirstOne).transform.position.x, ((Component)playerByNameOrFirstOne).transform.position.y, ((Component)playerByNameOrFirstOne).transform.position.z);
				Vector3 val5 = default(Vector3);
				((Vector3)(ref val5))..ctor(((Component)val3).transform.position.x, ((Component)val3).transform.position.y, ((Component)val3).transform.position.z);
				playerByNameOrFirstOne.isInElevator = false;
				playerByNameOrFirstOne.isInHangarShipRoom = false;
				playerByNameOrFirstOne.isInsideFactory = true;
				playerByNameOrFirstOne.averageVelocity = 0f;
				playerByNameOrFirstOne.velocityLastFrame = Vector3.zero;
				playerByNameOrFirstOne.TeleportPlayer(val5, false, 0f, false, true);
				playerByNameOrFirstOne.beamOutParticle.Play();
				val3.isInElevator = false;
				val3.isInHangarShipRoom = false;
				val3.isInsideFactory = true;
				val3.averageVelocity = 0f;
				val3.velocityLastFrame = Vector3.zero;
				val3.TeleportPlayer(val4, false, 0f, false, true);
				val3.beamOutParticle.Play();
				ShipTeleporter val6 = Object.FindObjectOfType<ShipTeleporter>();
				if (Object.op_Implicit((Object)(object)val6))
				{
					playerByNameOrFirstOne.movementAudio.PlayOneShot(val6.teleporterBeamUpSFX);
					val3.movementAudio.PlayOneShot(val6.teleporterBeamUpSFX);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void StartMeteorEventServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3392132067u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3392132067u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Logger.LogInfo((object)"StartMeteorEventServerRpc");
					TimeOfDay instance = TimeOfDay.Instance;
					instance.meteorShowerAtTime = -1f;
					instance.MeteorWeather.SetStartMeteorShower();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void OpenAllSteamValveHazardServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2051347914u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2051347914u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					OpenAllSteamValveHazardClientRpc();
				}
			}
		}

		[ClientRpc]
		public void OpenAllSteamValveHazardClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3542808655u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3542808655u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Logger.LogInfo((object)"OpenAllSteamValveHazardClientRpc");
			List<SteamValveHazard> list = Object.FindObjectsOfType<SteamValveHazard>().ToList();
			Logger.LogInfo((object)(list.Count + " steamValve found"));
			foreach (SteamValveHazard item in list)
			{
				Logger.LogInfo((object)"Opening steamValve");
				item.BurstValve();
				item.CrackValve();
				item.valveHasBurst = true;
				item.valveHasCracked = true;
				item.valveHasBeenRepaired = false;
				item.currentFogSize = 10f;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void TurnOffLightsServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4259818166u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4259818166u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			BreakerBox val3 = Object.FindObjectOfType<BreakerBox>();
			Logger.LogInfo((object)("BreakerBox " + (((Object)(object)val3 != (Object)null) ? "found" : "not found")));
			if ((Object)(object)val3 != (Object)null)
			{
				bool flag = false;
				int num = -1;
				AnimatedObjectTrigger component;
				do
				{
					num++;
					component = ((Component)val3.breakerSwitches[num]).gameObject.GetComponent<AnimatedObjectTrigger>();
					flag |= component.boolValue;
				}
				while (!component.boolValue && num < val3.breakerSwitches.Length - 1);
				if (flag)
				{
					TurnOffLightsClientRpc(num);
				}
			}
		}

		[ClientRpc]
		public void TurnOffLightsClientRpc(int switchIndex)
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4004846892u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, switchIndex);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4004846892u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Logger.LogInfo((object)"TurnOffLightsClientRpc");
				BreakerBox val3 = Object.FindObjectOfType<BreakerBox>();
				if ((Object)(object)val3 != (Object)null)
				{
					AnimatedObjectTrigger component = ((Component)val3.breakerSwitches[switchIndex]).gameObject.GetComponent<AnimatedObjectTrigger>();
					val3.breakerSwitches[switchIndex].SetBool("turnedLeft", false);
					component.boolValue = false;
					component.setInitialState = false;
					val3.SwitchBreaker(false);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void LeaveEarlyServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4083822029u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4083822029u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Logger.LogInfo((object)"LeaveEarlyServerRpc");
					TimeOfDay instance = TimeOfDay.Instance;
					instance.votedShipToLeaveEarlyThisRound = true;
					instance.SetShipLeaveEarlyServerRpc();
				}
			}
		}

		public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref _id, default(ForPrimitives));
		}

		private static PlayerControllerB GetPlayerByNameOrFirstOne(string? entityName)
		{
			string entityName2 = entityName;
			List<PlayerControllerB> activePlayers = GetActivePlayers();
			return ((IEnumerable<PlayerControllerB>)activePlayers).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => ((Object)x).name == entityName2)) ?? StartOfRound.Instance.allPlayerScripts[0];
		}

		private static List<PlayerControllerB> GetActivePlayers()
		{
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			list.AddRange(StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB player) => ((Behaviour)player).isActiveAndEnabled && player.playerSteamId != 0).ToList());
			return list;
		}

		private static float NextFloat(Random random, float rangeMin, float rangeMax)
		{
			double num = (double)rangeMin - (double)rangeMax;
			double num2 = random.NextDouble();
			double num3 = num2 * num + (double)rangeMin;
			return (float)num3;
		}

		private static Dictionary<T, int> ConfigEffectParsing<T>(string effectsRarityStr) where T : struct
		{
			Dictionary<T, int> dictionary = new Dictionary<T, int>();
			foreach (string item in from s in effectsRarityStr.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (int.TryParse(array[1], out var result))
				{
					if (Enum.TryParse<T>(text, ignoreCase: true, out var result2))
					{
						dictionary[result2] = result;
					}
					else
					{
						Logger.LogWarning((object)("Effect " + text + " was not recognized"));
					}
				}
			}
			return dictionary;
		}

		protected override void __initializeVariables()
		{
			if (_isLock == null)
			{
				throw new Exception("MysteryButtonAI._isLock cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)_isLock).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_isLock, "_isLock");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_isLock);
			((EnemyAI)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_MysteryButtonAI()
		{
			//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