Decompiled source of Diversity v2.1.0

Diversity/Diversity.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Diversity.Items;
using Diversity.Misc;
using Diversity.Monsters;
using Diversity.NetcodePatcher;
using Diversity.Patches;
using Diversity.Player;
using Diversity.ScriptableObjects;
using GameNetcodeStuff;
using GraphicsAPI;
using GraphicsAPI.CustomPostProcessing;
using HarmonyLib;
using LCCutscene;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using Unity.Netcode.Components;
using Unity.Netcode.Samples;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.VFX;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Diversity")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Diversity")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6163c54c-2d5b-4683-ac86-9337d16cc4fd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializable<NetworkTransformState>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<NetworkTransformState>();
	}
}
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;
		}
	}
}
public enum Condition
{
	BrokenLeg,
	BrokenArm,
	FracturedLeg,
	FracturedArm,
	Bleeding,
	Blindness,
	Concussed
}
public enum DamageType
{
	GunShotted,
	Mauled,
	Electrified,
	Falling,
	Bitten,
	Concussed,
	Burned,
	Gas
}
namespace Diversity
{
	public class Configuration
	{
		public static ConfigEntry<bool> spiderRevamp;

		public static ConfigEntry<float> spiderSlowAmount;

		public static ConfigEntry<bool> crawlerRevamp;

		public static ConfigEntry<float> crawlerSlowAmount;

		public static ConfigEntry<bool> centipedeRevamp;

		public static ConfigEntry<int> clickAmount;

		public static ConfigEntry<int> hurtChance;

		public static ConfigEntry<bool> brakenRevamp;

		public static ConfigEntry<bool> brakenSpace;

		public static ConfigEntry<bool> brakenSnatchCompatibility;

		public static ConfigEntry<float> brakenRange;

		public static ConfigEntry<bool> brakenAnger;

		public static ConfigEntry<float> brakenAngerTime;

		public static ConfigEntry<int> flickerChance;

		public static ConfigEntry<int> breakerChance;

		public static ConfigEntry<bool> apparatusAnger;

		public static ConfigEntry<bool> chaseTriggerer;

		public static ConfigEntry<bool> dressGirlRevamp;

		public static ConfigEntry<float> walkieTalkieFrequency;

		public static ConfigEntry<bool> dressGirlIsolation;

		public static ConfigEntry<bool> playerConditions;

		public static ConfigEntry<bool> fullDarkness;

		public static ConfigEntry<float> fullDarknessIntensity;

		public static ConfigEntry<float> interactRange;

		public static ConfigEntry<bool> fracturedLeg;

		public static ConfigEntry<float> fracturedLegTime;

		public static ConfigEntry<bool> fracturedArm;

		public static ConfigEntry<float> fracturedArmTime;

		public static ConfigEntry<bool> brokenLeg;

		public static ConfigEntry<bool> brokenArm;

		public static ConfigEntry<bool> bleeding;

		public static ConfigEntry<float> bleedingTime;

		public static ConfigEntry<bool> blindness;

		public static ConfigEntry<float> blindnessTime;

		public static ConfigEntry<bool> concussed;

		public static ConfigEntry<bool> walker;

		public static ConfigEntry<int> walkerChance;

		public static ConfigEntry<bool> watcher;

		public static ConfigEntry<int> watcherWeight;

		public static ConfigEntry<float> watcherSlamMultiplier;

		public static ConfigEntry<bool> speaker;

		public static ConfigEntry<bool> posters;

		public static ConfigEntry<bool> shipCutscene;

		public static ConfigEntry<bool> pufferRevamp;

		public static ConfigEntry<bool> hydrogeneRevamp;

		public static void Load()
		{
			spiderRevamp = Diversity.config.Bind<bool>("Spider", "SpiderRevamp", true, "Should spider revamp be enabled?");
			spiderSlowAmount = Diversity.config.Bind<float>("Spider", "SpiderSlow", 0.8f, "How much slown should spiders be on hit?");
			crawlerRevamp = Diversity.config.Bind<bool>("Crawler", "CrawlerRevamp", true, "Should crawler revamp be enabled?");
			crawlerSlowAmount = Diversity.config.Bind<float>("Crawler", "CrawlerSlow", 0.9f, "How much slown should crawlers be on hit?");
			centipedeRevamp = Diversity.config.Bind<bool>("Centipede", "CentipedeRevamp", true, "Should centipede revamp be enabled?");
			clickAmount = Diversity.config.Bind<int>("Centipede", "ClickAmount", 30, "How many times should you have to click to remove the centipede from someone's head?");
			hurtChance = Diversity.config.Bind<int>("Centipede", "HurtChance", 10, "Chance of hurting the player when trying to free the centipede.");
			brakenRevamp = Diversity.config.Bind<bool>("Bracken", "BrakenRevamp", true, "Should Bracken revamp be enabled?");
			brakenSpace = Diversity.config.Bind<bool>("Bracken", "BrakenPersonnalSpace", true, "Should the Bracken have his own personnal space?");
			brakenSnatchCompatibility = Diversity.config.Bind<bool>("Bracken", "Braken Snatch Compatibility", false, "Enables compatibility with snatching bracken mod. (RECOMMENDED TO DISABLE IT IN SOLO!)");
			brakenRange = Diversity.config.Bind<float>("Bracken", "BrakenRange", 15f, "From how far should the Bracken be able to turn off lights?");
			brakenAnger = Diversity.config.Bind<bool>("Bracken", "BrakenAnger", true, "Should Bracken get angered from the breaker box?");
			brakenAngerTime = Diversity.config.Bind<float>("Bracken", "BrakenAngerTime", 90f, "How long should the Bracken stay angered when fully angered?");
			flickerChance = Diversity.config.Bind<int>("Bracken", "FlickerChance", 100, "Chance on flickering and turning off lights.");
			breakerChance = Diversity.config.Bind<int>("Bracken", "BreakerChance", 75, "Chance for the Bracken to turn off the breaker box.");
			apparatusAnger = Diversity.config.Bind<bool>("Bracken", "ApparatusAnger", true, "Should taking the Apparatus anger the Bracken?");
			chaseTriggerer = Diversity.config.Bind<bool>("Bracken", "ChaseTriggerer", true, "Should the Bracken chase the one who angered him?");
			dressGirlRevamp = Diversity.config.Bind<bool>("Dress Girl", "DressGirlRevamp", true, "Should Dress girl revamp be enabled?");
			walkieTalkieFrequency = Diversity.config.Bind<float>("Dress Girl", "WalkieTalkieFrequency", 1f, "How frequent should the Dress girl haunt the walkie-talkie?");
			dressGirlIsolation = Diversity.config.Bind<bool>("Dress Girl", "DressGirlIsolation", true, "Should Dress girl be able to isolate you and give you hallucinations? (Requires DressGirlRevamp to be enabled.)");
			pufferRevamp = Diversity.config.Bind<bool>("Puffer", "Puffer Revamp", true, "Should the puffer revamp be enabled?");
			hydrogeneRevamp = Diversity.config.Bind<bool>("Hydregene", "Hydrogene Revamp", true, "Should the hydrogene revamp be enabled?");
			playerConditions = Diversity.config.Bind<bool>("Player", "PlayerConditions", true, "Should players be able to gain conditions?");
			fullDarkness = Diversity.config.Bind<bool>("Player", "FullDarkness", true, "Should players with no light source be completely in the dark?");
			fullDarknessIntensity = Diversity.config.Bind<float>("Player", "FullDarknessIntensity", 1f, "How intense should full darkness be?");
			interactRange = Diversity.config.Bind<float>("Player", "InteractRange", 3f, "How far can players remove centipede from their head?");
			fracturedLeg = Diversity.config.Bind<bool>("Conditions", "Fractured Leg", true, "Can players fracture their legs? (Will also disable broken legs.)");
			fracturedLegTime = Diversity.config.Bind<float>("Conditions", "Fractured Leg Time", 60f, "How long should fractured legs last?");
			fracturedArm = Diversity.config.Bind<bool>("Conditions", "Fractured Arm", true, "Can players fracture their arms? (Will also disable broken arms.");
			fracturedArmTime = Diversity.config.Bind<float>("Conditions", "Fractured Arm Time", 60f, "How long should fractured arms last?");
			brokenLeg = Diversity.config.Bind<bool>("Conditions", "Broken Leg", true, "Can players break their legs?");
			brokenArm = Diversity.config.Bind<bool>("Conditions", "Broken Arm", true, "Can players break their arms?");
			bleeding = Diversity.config.Bind<bool>("Conditions", "Bleeding", true, "Can players bleed?");
			bleedingTime = Diversity.config.Bind<float>("Conditions", "Bleeding Time", 300f, "How long should bleeding last?");
			blindness = Diversity.config.Bind<bool>("Conditions", "Blindness", true, "Can players be blinded?");
			blindnessTime = Diversity.config.Bind<float>("Conditions", "Blindness Time", 30f, "How long should blindness last? (in seconds)");
			concussed = Diversity.config.Bind<bool>("Conditions", "Concussed", true, "Can players concussed?");
			walker = Diversity.config.Bind<bool>("Walker", "Walker", true, "Should the Walker be enabled?");
			walkerChance = Diversity.config.Bind<int>("Walker", "Walker Spawn Chance", 10, "Rarity in % for the walker to spawn.");
			watcher = Diversity.config.Bind<bool>("Watcher", "Watcher", true, "Should the Watcher be enabled?");
			watcherWeight = Diversity.config.Bind<int>("Watcher", "Watcher Weight", 30, "Spawn weight of the Watcher.");
			watcherSlamMultiplier = Diversity.config.Bind<float>("Watcher", "Watcher Slam Multiplier", 1f, "Slam multiplier for the Watcher. (Capped between 1 to 2)");
			speaker = Diversity.config.Bind<bool>("Speaker", "Voice lines", true, "Should the speaker voice lines be enabled?");
			posters = Diversity.config.Bind<bool>("Posters", "Posters", true, "Should the posters be enabled?");
			shipCutscene = Diversity.config.Bind<bool>("Cutscene", "Ship Cutscene", true, "Should the ship cutscene be enabled?");
		}
	}
	public class Content
	{
		public static AssetBundle MainAssets;

		public static void TryLoadAssets()
		{
			if ((Object)(object)MainAssets == (Object)null)
			{
				MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "diversity"));
				Diversity.mls.LogInfo((object)"Loaded asset bundle!");
				GameNetworkManagerPatch.RegisterPrefab(MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/walker/Prefab/Walker.prefab"));
				DiversityAIManager.RegisterEnemy(MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/Watcher/Watcher.prefab"));
				Diversity.longBoiType = MainAssets.LoadAsset<EnemyType>("Assets/custom/diversity/walker/WalkerType.asset");
				Diversity.watcher = MainAssets.LoadAsset<DiversityEnemy>("Assets/custom/diversity/Watcher/Watcher.asset");
			}
		}
	}
	public class DiversityAssets : MonoBehaviour
	{
		[Serializable]
		public class RandomSoundAudioClip
		{
			public DiversitySoundManager.SoundType soundType;

			public AudioClip[] audioClips;
		}

		[Serializable]
		public class SoundAudioClip
		{
			public DiversitySoundManager.SoundType soundType;

			public AudioClip audioClip;
		}

		public SoundAudioClip[] soundAudioClipArray;

		public RandomSoundAudioClip[] randomSoundAudioClipArray;

		public static DiversityAssets Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class DiversitySoundManager : NetworkBehaviour
	{
		public enum SoundType
		{
			SteamLeak,
			LightOn,
			LightBuzz,
			Ambience,
			Fracture,
			BrokenBone,
			Hurt,
			BrackenScream,
			BrackenSpeech,
			DressGirlSpeech,
			DressGirlVoices,
			HeartBeat,
			DoorSlam,
			WalkerFootStep,
			WatcherScream,
			WatcherScreech,
			WatcherScreamHit,
			VentBanging,
			VentHit,
			GroundSlam,
			Stab,
			BloodSplat,
			HumanScream,
			SpeakerWelcome,
			SpeakerTerminal,
			SpeakerDogs,
			SpeakerShutOff,
			SpeakerEject,
			SpeakerReturn,
			SpeakerDays,
			SpeakerQuota,
			SpeakerQuotaAgain
		}

		public static GameObject oneShot;

		public static AudioSource oneShotAudio;

		public static GameObject oneShotBypass;

		public static AudioSource oneShotAudioBypass;

		public List<GameObject> current3Daudios = new List<GameObject>();

		public List<GameObject> currentGirlAudios = new List<GameObject>();

		public static DiversitySoundManager Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpeakerTerminalPlayOneShotSyncServerRpc(int random)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2908572244u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, random);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2908572244u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SpeakerTerminalPlayOneShotSyncClientRpc(random);
				}
			}
		}

		[ClientRpc]
		public void SpeakerTerminalPlayOneShotSyncClientRpc(int random)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3935703802u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, random);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3935703802u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && random != -1)
				{
					StartOfRound.Instance.speakerAudioSource.PlayOneShot(GetRandomAudioClipByTypeAndId(SoundType.SpeakerTerminal, random));
				}
			}
		}

		public static float PlaySoundFloat(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0];
			GameObject val = new GameObject("Sound");
			val.transform.position = position;
			AudioSource val2 = val.AddComponent<AudioSource>();
			val2.spatialBlend = 1f;
			val2.playOnAwake = false;
			val2.dopplerLevel = 0f;
			val2.spread = 70f;
			val2.reverbZoneMix = 1f;
			val2.outputAudioMixerGroup = outputAudioMixerGroup;
			val2.loop = loop;
			val2.panStereo = pan;
			if (random)
			{
				val2.clip = GetRandomAudioClipByType(soundType);
			}
			else
			{
				val2.clip = GetAudioClipByType(soundType);
			}
			val2.rolloffMode = (AudioRolloffMode)1;
			if (soundType == SoundType.LightOn)
			{
				val2.maxDistance = 100f;
			}
			else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz)
			{
				val2.maxDistance = 32f;
			}
			else
			{
				val2.maxDistance = 32f;
			}
			val2.volume = volume;
			val2.Play();
			if (soundType == SoundType.DressGirlSpeech)
			{
				Instance.currentGirlAudios.Add(val);
			}
			else if (!loop)
			{
				Object.Destroy((Object)(object)val, val2.clip.length);
			}
			else
			{
				Instance.current3Daudios.Add(val);
			}
			return val2.clip.length;
		}

		public static AudioSource PlaySound(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position, float range = 32f, float audioOffset = 0f, float destroyDelayOffset = 0f)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0];
			GameObject val = new GameObject("Sound");
			val.transform.position = position;
			AudioSource val2 = val.AddComponent<AudioSource>();
			val2.spatialBlend = 1f;
			val2.playOnAwake = false;
			val2.dopplerLevel = 0f;
			val2.spread = 70f;
			val2.reverbZoneMix = 1f;
			val2.outputAudioMixerGroup = outputAudioMixerGroup;
			val2.loop = loop;
			val2.panStereo = pan;
			if (random)
			{
				val2.clip = GetRandomAudioClipByType(soundType);
			}
			else
			{
				val2.clip = GetAudioClipByType(soundType);
			}
			val2.rolloffMode = (AudioRolloffMode)1;
			if (soundType == SoundType.LightOn)
			{
				val2.maxDistance = 100f;
			}
			else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz)
			{
				val2.maxDistance = 32f;
			}
			else
			{
				val2.maxDistance = range;
			}
			val2.volume = volume;
			val2.time = audioOffset;
			val2.Play();
			if (soundType == SoundType.DressGirlSpeech)
			{
				Instance.currentGirlAudios.Add(val);
			}
			else if (!loop)
			{
				float num = val2.clip.length - audioOffset + destroyDelayOffset;
				Diversity.mls.LogDebug((object)$"Audio destroy time: {num}");
				Object.Destroy((Object)(object)val, num);
			}
			else
			{
				Instance.current3Daudios.Add(val);
			}
			return val2;
		}

		public static AudioSource PlaySound(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position, Transform parent, float range = 32f, float audioOffset = 0f, float destroyDelayOffset = 0f)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0];
			GameObject val = new GameObject("Sound");
			val.transform.position = position;
			AudioSource val2 = val.AddComponent<AudioSource>();
			val2.spatialBlend = 1f;
			val2.playOnAwake = false;
			val2.dopplerLevel = 0f;
			val2.spread = 70f;
			val2.reverbZoneMix = 1f;
			val2.outputAudioMixerGroup = outputAudioMixerGroup;
			val2.loop = loop;
			val2.panStereo = pan;
			if (random)
			{
				val2.clip = GetRandomAudioClipByType(soundType);
			}
			else
			{
				val2.clip = GetAudioClipByType(soundType);
			}
			val2.rolloffMode = (AudioRolloffMode)1;
			if (soundType == SoundType.LightOn)
			{
				val2.maxDistance = 100f;
			}
			else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz)
			{
				val2.maxDistance = 32f;
			}
			else
			{
				val2.maxDistance = range;
			}
			val2.volume = volume;
			val2.time = audioOffset;
			val2.Play();
			if (soundType == SoundType.DressGirlSpeech)
			{
				Instance.currentGirlAudios.Add(val);
			}
			else if (!loop)
			{
				float num = val2.clip.length - audioOffset + destroyDelayOffset;
				Diversity.mls.LogDebug((object)$"Audio destroy time: {num}");
				Object.Destroy((Object)(object)val, num);
			}
			else
			{
				Instance.current3Daudios.Add(val);
			}
			val.transform.SetParent(parent, true);
			return val2;
		}

		public static AudioSource PlaySound(SoundType soundType, bool random, float volume, float pan)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0];
			if ((Object)(object)oneShot == (Object)null)
			{
				oneShot = new GameObject("OneShotSound");
				oneShotAudio = oneShot.AddComponent<AudioSource>();
			}
			oneShotAudio.outputAudioMixerGroup = outputAudioMixerGroup;
			oneShotAudio.panStereo = pan;
			if (random)
			{
				oneShotAudio.PlayOneShot(GetRandomAudioClipByType(soundType), volume);
			}
			else
			{
				oneShotAudio.PlayOneShot(GetAudioClipByType(soundType), volume);
			}
			return oneShotAudio;
		}

		public static void DeleteAudio(GameObject audio)
		{
			Object.Destroy((Object)(object)audio);
		}

		public static void PlaySoundBypass(SoundType soundType, bool random, float volume, float pan, bool loop, Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Sound");
			val.transform.position = position;
			AudioSource val2 = val.AddComponent<AudioSource>();
			val2.spatialBlend = 1f;
			val2.playOnAwake = false;
			val2.dopplerLevel = 0f;
			val2.spread = 70f;
			val2.reverbZoneMix = 1f;
			val2.bypassListenerEffects = true;
			val2.loop = loop;
			val2.panStereo = pan;
			if (random)
			{
				val2.clip = GetRandomAudioClipByType(soundType);
			}
			else
			{
				val2.clip = GetAudioClipByType(soundType);
			}
			val2.rolloffMode = (AudioRolloffMode)1;
			if (soundType == SoundType.LightOn)
			{
				val2.maxDistance = 100f;
			}
			else if (soundType == SoundType.SteamLeak || soundType == SoundType.LightBuzz)
			{
				val2.maxDistance = 32f;
			}
			else
			{
				val2.maxDistance = 32f;
			}
			val2.volume = volume;
			val2.Play();
			if (soundType == SoundType.DressGirlSpeech)
			{
				Instance.currentGirlAudios.Add(val);
			}
			else if (!loop)
			{
				Object.Destroy((Object)(object)val, val2.clip.length);
			}
			else
			{
				Instance.current3Daudios.Add(val);
			}
		}

		public static void PlaySoundBypass(SoundType soundType, bool random, float volume = 1f, float pan = 1f)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			if ((Object)(object)oneShotBypass == (Object)null)
			{
				oneShotBypass = new GameObject("OneShotSound");
				oneShotAudioBypass = oneShotBypass.AddComponent<AudioSource>();
				oneShotAudioBypass.bypassListenerEffects = true;
			}
			oneShotAudioBypass.panStereo = pan;
			if (random)
			{
				oneShotAudioBypass.PlayOneShot(GetRandomAudioClipByType(soundType), volume);
			}
			else
			{
				oneShotAudioBypass.PlayOneShot(GetAudioClipByType(soundType), volume);
			}
		}

		public static void StopSound()
		{
			if ((Object)(object)oneShot != (Object)null)
			{
				oneShotAudio.Stop();
			}
		}

		public static void StopSoundBypass()
		{
			if ((Object)(object)oneShot != (Object)null)
			{
				oneShotAudioBypass.Stop();
			}
		}

		public static Vector3 CheckPosition(PlayerControllerB player)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)player))
			{
				if (!player.isPlayerDead)
				{
					return ((Component)player.gameplayCamera).transform.position;
				}
				return player.spectateCameraPivot.position;
			}
			return Vector3.zero;
		}

		public static AudioClip GetAudioClipByType(SoundType soundType)
		{
			Diversity.mls.LogInfo((object)DiversityAssets.Instance.soundAudioClipArray);
			DiversityAssets.SoundAudioClip[] soundAudioClipArray = DiversityAssets.Instance.soundAudioClipArray;
			foreach (DiversityAssets.SoundAudioClip soundAudioClip in soundAudioClipArray)
			{
				if (soundAudioClip.soundType == soundType)
				{
					return soundAudioClip.audioClip;
				}
			}
			Diversity.mls.LogError((object)("No audio of type:" + soundType));
			return null;
		}

		public static AudioClip GetRandomAudioClipByType(SoundType soundType)
		{
			DiversityAssets.RandomSoundAudioClip[] randomSoundAudioClipArray = DiversityAssets.Instance.randomSoundAudioClipArray;
			foreach (DiversityAssets.RandomSoundAudioClip randomSoundAudioClip in randomSoundAudioClipArray)
			{
				if (randomSoundAudioClip.soundType == soundType)
				{
					return randomSoundAudioClip.audioClips[Random.Range(0, randomSoundAudioClip.audioClips.Length)];
				}
			}
			Diversity.mls.LogError((object)("No audio of type:" + soundType));
			return null;
		}

		public static int GetRandomAudioClipIdByType(SoundType soundType)
		{
			DiversityAssets.RandomSoundAudioClip[] randomSoundAudioClipArray = DiversityAssets.Instance.randomSoundAudioClipArray;
			foreach (DiversityAssets.RandomSoundAudioClip randomSoundAudioClip in randomSoundAudioClipArray)
			{
				if (randomSoundAudioClip.soundType == soundType)
				{
					return Random.Range(0, randomSoundAudioClip.audioClips.Length);
				}
			}
			Diversity.mls.LogError((object)("No audio of type:" + soundType));
			return -1;
		}

		public static AudioClip GetRandomAudioClipByTypeAndId(SoundType soundType, int id)
		{
			DiversityAssets.RandomSoundAudioClip[] randomSoundAudioClipArray = DiversityAssets.Instance.randomSoundAudioClipArray;
			foreach (DiversityAssets.RandomSoundAudioClip randomSoundAudioClip in randomSoundAudioClipArray)
			{
				if (randomSoundAudioClip.soundType == soundType)
				{
					return randomSoundAudioClip.audioClips[id];
				}
			}
			Diversity.mls.LogError((object)("No audio of type:" + soundType));
			return null;
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_DiversitySoundManager()
		{
			//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
			NetworkManager.__rpc_func_table.Add(2908572244u, new RpcReceiveHandler(__rpc_handler_2908572244));
			NetworkManager.__rpc_func_table.Add(3935703802u, new RpcReceiveHandler(__rpc_handler_3935703802));
		}

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

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

		protected internal override string __getTypeName()
		{
			return "DiversitySoundManager";
		}
	}
	[BepInPlugin("Chaos.Diversity", "Diversity", "2.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Diversity : BaseUnityPlugin
	{
		private const string modGUID = "Chaos.Diversity";

		private const string modName = "Diversity";

		private const string modVersion = "2.1.0";

		private readonly Harmony harmony = new Harmony("Chaos.Diversity");

		public static Diversity Instance;

		public static ManualLogSource mls;

		public static ConfigFile config;

		public static EnemyType longBoiType;

		public static DiversityEnemy watcher;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = ((BaseUnityPlugin)this).Logger;
			config = ((BaseUnityPlugin)this).Config;
			Configuration.Load();
			Content.TryLoadAssets();
			harmony.PatchAll(typeof(BaboonBirdAIPatch));
			harmony.PatchAll(typeof(BlobAIPatch));
			harmony.PatchAll(typeof(BreakerBoxPatch));
			harmony.PatchAll(typeof(CentipedeAIPatch));
			harmony.PatchAll(typeof(CrawlerAIPatch));
			harmony.PatchAll(typeof(DressGirlAIPatch));
			harmony.PatchAll(typeof(FlashlightPatch));
			harmony.PatchAll(typeof(FlowermanAIPatch));
			harmony.PatchAll(typeof(GameNetworkManagerPatch));
			harmony.PatchAll(typeof(GrabbableObjectPatch));
			harmony.PatchAll(typeof(HoarderBugAIPatch));
			harmony.PatchAll(typeof(HUDPatch));
			harmony.PatchAll(typeof(LungPropPatch));
			harmony.PatchAll(typeof(ManualCameraRendererPatch));
			harmony.PatchAll(typeof(MouthDogAIPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(PreInitPatch));
			harmony.PatchAll(typeof(PufferAIPatch));
			harmony.PatchAll(typeof(RadarBoosterItemPatch));
			harmony.PatchAll(typeof(RedLocustBeesPatch));
			harmony.PatchAll(typeof(RoundManagerPatch));
			harmony.PatchAll(typeof(SandSpiderAIPatch));
			harmony.PatchAll(typeof(ShipTeleporterPatch));
			harmony.PatchAll(typeof(SoundManagerPatch));
			harmony.PatchAll(typeof(SpringManAIPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(SteamValveHazardPatch));
			harmony.PatchAll(typeof(TerminalPatch));
			harmony.PatchAll(typeof(TimeOfDayPatch));
			harmony.PatchAll(typeof(Diversity));
			harmony.PatchAll(typeof(DiversityAIManagerRMPatch));
			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);
					}
				}
			}
			mls.LogInfo((object)"Diversity started.");
		}
	}
	public class DiversityBehaviour : MonoBehaviour
	{
		public int anger = 3;

		private void Update()
		{
		}
	}
}
namespace Diversity.ScriptableObjects
{
	[CreateAssetMenu(fileName = "Diversity Enemy", menuName = "ScriptableObjects/DiversityEnemy")]
	public class DiversityEnemy : ScriptableObject
	{
		public int enemyMaxAmount;

		public bool spawnAffectedByHazardLevel = true;

		public bool spawnAffectedByCurrentTime = true;

		public bool spawnAffectedAverageInsanity = true;
	}
}
namespace Diversity.Player
{
	public class PlayerRevamp : NetworkBehaviour
	{
		public List<Condition> conditions = new List<Condition>();

		public bool isHaunted = false;

		public bool dressGirlHaunt = false;

		public Light lastLight;

		public int lastID = 0;

		public bool kidnapped = false;

		public bool kidnapSequence = false;

		public float kidnapSequenceTime = 0f;

		public float filter = 0f;

		public float dressGirlHauntTime = 0f;

		public float heartBeatInterval = 1f;

		public float voicesTime = 0f;

		public float voicesInterval = 1f;

		public float heartBeatTime = 0f;

		public float heartBeatCooldown = 0f;

		private static float timeElapsed;

		private bool fullDarknessSet = false;

		private bool playersHidden = false;

		public List<Vector3> nearbySounds = new List<Vector3>();

		private float timeFracturedLeg = 0f;

		private float timeFracturedArm = 0f;

		private float timeBleeding = 0f;

		private float timeBlinded = 0f;

		private float soundCheckInterval = 0f;

		private bool instanciated = false;

		public bool updated = false;

		private bool unfinished = false;

		public bool sinkingFromWalker = false;

		private bool currentlySinking = false;

		private float sinkingTime = 0f;

		public float insaneMultiplier = 0f;

		public bool inStairs = false;

		public bool forceLook = false;

		public Vector3 forceLookPosition = Vector3.zero;

		public Rigidbody rb;

		public GameObject fakeWalker;

		public Animator fakeWalkerAnimator;

		private void Start()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			rb = ((Component)this).GetComponent<Rigidbody>();
			fakeWalker = Object.Instantiate<GameObject>(Content.MainAssets.LoadAsset<GameObject>("Assets/custom/diversity/walker/FakeWalker.prefab"), ((Component)this).transform);
			fakeWalker.transform.localPosition = Vector3.zero;
			fakeWalkerAnimator = fakeWalker.GetComponent<Animator>();
			fakeWalker.SetActive(false);
		}

		public void ApplyConditions(DamageType damageType, float modifier)
		{
			Diversity.mls.LogInfo((object)("Player took damage type: " + damageType));
			if (damageType == DamageType.Falling && Configuration.fracturedLeg.Value)
			{
				float value = Random.value;
				if (value <= 0.1f * modifier)
				{
					bool flag = false;
					foreach (Condition condition in conditions)
					{
						if (condition == Condition.FracturedLeg)
						{
							flag = true;
						}
					}
					if (!flag)
					{
						if (((NetworkBehaviour)this).IsOwner)
						{
							ApplyConditionServerRpc(Condition.FracturedLeg);
						}
						Diversity.mls.LogInfo((object)("Player just received condition:" + Condition.FracturedLeg));
					}
					else if (Configuration.brokenLeg.Value)
					{
						bool flag2 = false;
						foreach (Condition condition2 in conditions)
						{
							if (condition2 == Condition.BrokenLeg)
							{
								flag2 = true;
							}
						}
						if (!flag2 && ((NetworkBehaviour)this).IsOwner)
						{
							RemoveConditionServerRpc(Condition.FracturedLeg);
							ApplyConditionServerRpc(Condition.BrokenLeg);
						}
					}
				}
			}
			else if ((damageType == DamageType.GunShotted || damageType == DamageType.Mauled || damageType == DamageType.Bitten) && Configuration.bleeding.Value)
			{
				float value2 = Random.value;
				if (value2 <= 0.15f * modifier || damageType == DamageType.GunShotted)
				{
					bool flag3 = false;
					foreach (Condition condition3 in conditions)
					{
						if (condition3 == Condition.Bleeding)
						{
							flag3 = true;
						}
					}
					if (!flag3 && ((NetworkBehaviour)this).IsOwner)
					{
						ApplyConditionServerRpc(Condition.Bleeding);
					}
				}
			}
			if (damageType == DamageType.Mauled && Configuration.fracturedArm.Value)
			{
				float value3 = Random.value;
				if (value3 <= 0.15f * modifier)
				{
					bool flag4 = false;
					foreach (Condition condition4 in conditions)
					{
						if (condition4 == Condition.FracturedArm)
						{
							flag4 = true;
						}
					}
					if (!flag4 && ((NetworkBehaviour)this).IsOwner)
					{
						ApplyConditionServerRpc(Condition.FracturedArm);
					}
					if (flag4 && value3 <= 0.05f && Configuration.brokenArm.Value)
					{
						bool flag5 = false;
						foreach (Condition condition5 in conditions)
						{
							if (condition5 == Condition.BrokenArm)
							{
								flag5 = true;
							}
						}
						if (!flag5 && ((NetworkBehaviour)this).IsOwner)
						{
							RemoveConditionServerRpc(Condition.FracturedArm);
							ApplyConditionServerRpc(Condition.BrokenArm);
						}
					}
				}
			}
			if (damageType == DamageType.Gas && Configuration.blindness.Value)
			{
				float value4 = Random.value;
				if (value4 <= 0.15f * modifier)
				{
					bool flag6 = false;
					foreach (Condition condition6 in conditions)
					{
						if (condition6 == Condition.Blindness)
						{
							flag6 = true;
						}
					}
					if (!flag6 && ((NetworkBehaviour)this).IsOwner)
					{
						ApplyConditionServerRpc(Condition.Blindness);
					}
				}
			}
			if (damageType != DamageType.Concussed || !Configuration.concussed.Value)
			{
				return;
			}
			float value5 = Random.value;
			if (!(value5 <= 0.35f * modifier))
			{
				return;
			}
			bool flag7 = false;
			foreach (Condition condition7 in conditions)
			{
				if (condition7 == Condition.Concussed)
				{
					flag7 = true;
				}
			}
			if (!flag7 && ((NetworkBehaviour)this).IsOwner)
			{
				ApplyConditionServerRpc(Condition.Concussed);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ApplyConditionServerRpc(Condition condition)
		{
			//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2858412267u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<Condition>(ref condition, default(ForEnums));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2858412267u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ApplyConditionClientRpc(condition);
				}
			}
		}

		[ClientRpc]
		public void ApplyConditionClientRpc(Condition condition)
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2867273533u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<Condition>(ref condition, default(ForEnums));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2867273533u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			conditions.ToList().Add(condition);
			if ((Object)(object)((Component)this).gameObject.GetComponent<PlayerControllerB>() == (Object)(object)StartOfRound.Instance.localPlayerController)
			{
				switch (condition)
				{
				case Condition.Bleeding:
					HUDManagerRevamp.Instance.bleedingHud.SetAsFirstSibling();
					((Component)HUDManagerRevamp.Instance.bleedingHud).gameObject.SetActive(true);
					((Component)HUDManagerRevamp.Instance.bleedingHud).GetComponent<Animator>().SetBool("Visible", true);
					break;
				case Condition.Blindness:
					HUDManagerRevamp.Instance.blindnessHud.SetAsFirstSibling();
					((Component)HUDManagerRevamp.Instance.blindnessHud).gameObject.SetActive(true);
					((Component)HUDManagerRevamp.Instance.blindnessHud).GetComponent<Animator>().SetBool("Visible", true);
					break;
				case Condition.BrokenArm:
					HUDManagerRevamp.Instance.brokenArmHud.SetAsFirstSibling();
					((Component)HUDManagerRevamp.Instance.brokenArmHud).gameObject.SetActive(true);
					((Component)HUDManagerRevamp.Instance.brokenArmHud).GetComponent<Animator>().SetBool("Visible", true);
					break;
				case Condition.BrokenLeg:
					HUDManagerRevamp.Instance.brokenLegHud.SetAsFirstSibling();
					((Component)HUDManagerRevamp.Instance.brokenLegHud).gameObject.SetActive(true);
					((Component)HUDManagerRevamp.Instance.brokenLegHud).GetComponent<Animator>().SetBool("Visible", true);
					break;
				case Condition.Concussed:
					HUDManagerRevamp.Instance.concussedHud.SetAsFirstSibling();
					((Component)HUDManagerRevamp.Instance.concussedHud).gameObject.SetActive(true);
					((Component)HUDManagerRevamp.Instance.concussedHud).GetComponent<Animator>().SetBool("Visible", true);
					break;
				case Condition.FracturedArm:
					HUDManagerRevamp.Instance.fracturedArmHud.SetAsFirstSibling();
					((Component)HUDManagerRevamp.Instance.fracturedArmHud).gameObject.SetActive(true);
					((Component)HUDManagerRevamp.Instance.fracturedArmHud).GetComponent<Animator>().SetBool("Visible", true);
					break;
				case Condition.FracturedLeg:
					HUDManagerRevamp.Instance.fracturedLegHud.SetAsFirstSibling();
					((Component)HUDManagerRevamp.Instance.fracturedLegHud).gameObject.SetActive(true);
					((Component)HUDManagerRevamp.Instance.fracturedLegHud).GetComponent<Animator>().SetBool("Visible", true);
					break;
				}
			}
			Diversity.mls.LogInfo((object)("Player just received condition:" + condition));
		}

		[ServerRpc(RequireOwnership = false)]
		public void RemoveConditionServerRpc(Condition condition)
		{
			//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(707304577u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<Condition>(ref condition, default(ForEnums));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 707304577u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					RemoveConditionClientRpc(condition);
				}
			}
		}

		[ClientRpc]
		public void RemoveConditionClientRpc(Condition condition)
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(566092715u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<Condition>(ref condition, default(ForEnums));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 566092715u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			conditions.ToList().Remove(condition);
			if (((NetworkBehaviour)this).IsOwner)
			{
				switch (condition)
				{
				case Condition.Bleeding:
				{
					Animator component7 = ((Component)HUDManagerRevamp.Instance.bleedingHud).GetComponent<Animator>();
					component7.SetBool("Visible", false);
					((MonoBehaviour)this).StartCoroutine(WaitFade(component7));
					break;
				}
				case Condition.Blindness:
				{
					Animator component6 = ((Component)HUDManagerRevamp.Instance.blindnessHud).GetComponent<Animator>();
					HUDManagerRevamp.Instance.blindnessIntensity = 0f;
					component6.SetBool("Visible", false);
					((MonoBehaviour)this).StartCoroutine(WaitFade(component6));
					break;
				}
				case Condition.BrokenArm:
				{
					Animator component5 = ((Component)HUDManagerRevamp.Instance.brokenArmHud).GetComponent<Animator>();
					component5.SetBool("Visible", false);
					((MonoBehaviour)this).StartCoroutine(WaitFade(component5));
					break;
				}
				case Condition.BrokenLeg:
				{
					Animator component4 = ((Component)HUDManagerRevamp.Instance.brokenLegHud).GetComponent<Animator>();
					component4.SetBool("Visible", false);
					((MonoBehaviour)this).StartCoroutine(WaitFade(component4));
					break;
				}
				case Condition.Concussed:
				{
					Animator component3 = ((Component)HUDManagerRevamp.Instance.concussedHud).GetComponent<Animator>();
					HUDManagerRevamp.Instance.concussedIntensity = 0f;
					component3.SetBool("Visible", false);
					((MonoBehaviour)this).StartCoroutine(WaitFade(component3));
					break;
				}
				case Condition.FracturedArm:
				{
					Animator component2 = ((Component)HUDManagerRevamp.Instance.fracturedArmHud).GetComponent<Animator>();
					component2.SetBool("Visible", false);
					((MonoBehaviour)this).StartCoroutine(WaitFade(component2));
					break;
				}
				case Condition.FracturedLeg:
				{
					Animator component = ((Component)HUDManagerRevamp.Instance.fracturedLegHud).GetComponent<Animator>();
					component.SetBool("Visible", false);
					((MonoBehaviour)this).StartCoroutine(WaitFade(component));
					break;
				}
				}
			}
			Diversity.mls.LogInfo((object)("Player just lost condition:" + condition));
		}

		public IEnumerator WaitFade(Animator anim)
		{
			Animator anim2 = anim;
			yield return (object)new WaitUntil((Func<bool>)delegate
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				AnimatorStateInfo currentAnimatorStateInfo = anim2.GetCurrentAnimatorStateInfo(1);
				return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f;
			});
			((Component)anim2).gameObject.SetActive(false);
		}

		public void CheckConditions(PlayerControllerB player)
		{
			if (!Configuration.playerConditions.Value || !player.AllowPlayerDeath())
			{
				return;
			}
			using List<Condition>.Enumerator enumerator = conditions.ToList().GetEnumerator();
			while (enumerator.MoveNext())
			{
				switch (enumerator.Current)
				{
				case Condition.FracturedLeg:
					if (!((NetworkBehaviour)player).IsOwner)
					{
						break;
					}
					timeFracturedLeg += Time.deltaTime;
					if (timeFracturedLeg >= Configuration.fracturedLegTime.Value)
					{
						timeFracturedLeg = 0f;
						player.jumpForce = 13f;
						if (((NetworkBehaviour)this).IsOwner)
						{
							RemoveConditionServerRpc(Condition.FracturedLeg);
						}
					}
					else
					{
						player.jumpForce = 10f;
					}
					break;
				case Condition.BrokenLeg:
					if (((NetworkBehaviour)player).IsOwner)
					{
						player.playerBodyAnimator.SetBool("Limp", true);
						player.jumpForce = 9f;
					}
					break;
				case Condition.FracturedArm:
					timeFracturedArm += Time.deltaTime;
					if (timeFracturedArm >= Configuration.fracturedArmTime.Value)
					{
						if (((NetworkBehaviour)this).IsOwner)
						{
							RemoveConditionServerRpc(Condition.FracturedArm);
						}
						timeFracturedArm = 0f;
					}
					if ((Object)(object)player.currentlyHeldObject != (Object)null)
					{
						GrabbableObject currentlyHeldObject = player.currentlyHeldObject;
						if (!((NetworkBehaviour)player).IsOwner)
						{
							break;
						}
						Item itemProperties = currentlyHeldObject.itemProperties;
						float num = Mathf.Clamp(itemProperties.weight - 1f, 0f, 100f) * 105f;
						if (num > 25f && ((NetworkBehaviour)player).IsOwner)
						{
							if (player.timeSinceSwitchingSlots < 0.2f || player.isGrabbingObjectAnimation || player.timeSinceSwitchingSlots < 0.2f || player.isTypingChat || player.inSpecialInteractAnimation || player.activatingItem)
							{
								return;
							}
							((MonoBehaviour)player).StartCoroutine(player.waitToEndOfFrameToDiscard());
						}
					}
					else
					{
						if (!((Object)(object)player.currentlyHeldObjectServer != (Object)null))
						{
							break;
						}
						GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer;
						if (!((NetworkBehaviour)player).IsOwner)
						{
							break;
						}
						Item itemProperties2 = currentlyHeldObjectServer.itemProperties;
						float num2 = Mathf.Clamp(itemProperties2.weight - 1f, 0f, 100f) * 105f;
						if (num2 > 25f && ((NetworkBehaviour)player).IsOwner)
						{
							if (player.timeSinceSwitchingSlots < 0.2f || player.isGrabbingObjectAnimation || player.timeSinceSwitchingSlots < 0.2f || player.isTypingChat || player.inSpecialInteractAnimation || player.activatingItem)
							{
								return;
							}
							((MonoBehaviour)player).StartCoroutine(player.waitToEndOfFrameToDiscard());
						}
					}
					break;
				case Condition.BrokenArm:
					if ((Object)(object)player.currentlyHeldObject != (Object)null)
					{
						GrabbableObject currentlyHeldObject2 = player.currentlyHeldObject;
						if (!((NetworkBehaviour)player).IsOwner)
						{
							break;
						}
						Item itemProperties3 = currentlyHeldObject2.itemProperties;
						float num3 = Mathf.Clamp(itemProperties3.weight - 1f, 0f, 100f) * 105f;
						if (num3 > 15f && ((NetworkBehaviour)player).IsOwner)
						{
							if (player.timeSinceSwitchingSlots < 0.2f || player.isGrabbingObjectAnimation || player.timeSinceSwitchingSlots < 0.2f || player.isTypingChat || player.inSpecialInteractAnimation || player.activatingItem)
							{
								return;
							}
							((MonoBehaviour)player).StartCoroutine(player.waitToEndOfFrameToDiscard());
						}
					}
					else
					{
						if (!((Object)(object)player.currentlyHeldObjectServer != (Object)null))
						{
							break;
						}
						GrabbableObject currentlyHeldObjectServer2 = player.currentlyHeldObjectServer;
						if (!((NetworkBehaviour)player).IsOwner)
						{
							break;
						}
						Item itemProperties4 = currentlyHeldObjectServer2.itemProperties;
						float num4 = Mathf.Clamp(itemProperties4.weight - 1f, 0f, 100f) * 105f;
						if (num4 > 15f && ((NetworkBehaviour)player).IsOwner)
						{
							if (player.timeSinceSwitchingSlots < 0.2f || player.isGrabbingObjectAnimation || player.timeSinceSwitchingSlots < 0.2f || player.isTypingChat || player.inSpecialInteractAnimation || player.activatingItem)
							{
								return;
							}
							((MonoBehaviour)player).StartCoroutine(player.waitToEndOfFrameToDiscard());
						}
					}
					break;
				case Condition.Bleeding:
					if (!((NetworkBehaviour)player).IsOwner)
					{
						break;
					}
					timeBleeding += Time.deltaTime;
					if (timeBleeding >= Configuration.bleedingTime.Value)
					{
						timeBleeding = 0f;
						player.bleedingHeavily = false;
						if (((NetworkBehaviour)this).IsOwner)
						{
							RemoveConditionServerRpc(Condition.Bleeding);
						}
					}
					else
					{
						player.healthRegenerateTimer = 1f;
						player.bleedingHeavily = true;
					}
					break;
				case Condition.Blindness:
				{
					if (!((NetworkBehaviour)player).IsOwner)
					{
						break;
					}
					PlayerControllerB localPlayerController2 = StartOfRound.Instance.localPlayerController;
					if (!Object.op_Implicit((Object)(object)localPlayerController2) || (localPlayerController2.playerSteamId != player.playerSteamId && localPlayerController2.actualClientId != player.actualClientId))
					{
						break;
					}
					HUDManagerRevamp component2 = ((Component)HUDManager.Instance).gameObject.GetComponent<HUDManagerRevamp>();
					if (!Object.op_Implicit((Object)(object)component2))
					{
						return;
					}
					timeBlinded += Time.deltaTime;
					Diversity.mls.LogInfo((object)(timeBlinded + " >= " + Configuration.blindnessTime.Value));
					if (timeBlinded >= Configuration.blindnessTime.Value)
					{
						timeBlinded = 0f;
						component2.blindnessIntensity = 0f;
						if (((NetworkBehaviour)this).IsOwner)
						{
							RemoveConditionServerRpc(Condition.Blindness);
						}
					}
					else
					{
						component2.blindnessIntensity = 1f;
					}
					break;
				}
				case Condition.Concussed:
				{
					if (!((NetworkBehaviour)player).IsOwner)
					{
						break;
					}
					PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
					if (Object.op_Implicit((Object)(object)localPlayerController) && (localPlayerController.playerSteamId == player.playerSteamId || localPlayerController.actualClientId == player.actualClientId))
					{
						HUDManagerRevamp component = ((Component)HUDManager.Instance).gameObject.GetComponent<HUDManagerRevamp>();
						if (!Object.op_Implicit((Object)(object)component))
						{
							return;
						}
						component.concussedIntensity = 1f;
					}
					break;
				}
				}
			}
		}

		private void OnTriggerEnter(Collider col)
		{
			if (((Object)((Component)col).gameObject).name == "RoomCollider" && !updated)
			{
				BrakenRevamp[] array = Object.FindObjectsOfType<BrakenRevamp>();
				BrakenRevamp[] array2 = array;
				foreach (BrakenRevamp brakenRevamp in array2)
				{
					brakenRevamp.kidnapped = true;
				}
				kidnapped = true;
				updated = true;
			}
		}

		private void Update()
		{
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0807: Unknown result type (might be due to invalid IL or missing references)
			//IL_0809: Unknown result type (might be due to invalid IL or missing references)
			//IL_080e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0812: Unknown result type (might be due to invalid IL or missing references)
			//IL_0819: Unknown result type (might be due to invalid IL or missing references)
			//IL_0826: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0902: Unknown result type (might be due to invalid IL or missing references)
			//IL_0905: Unknown result type (might be due to invalid IL or missing references)
			//IL_090e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0962: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a68: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a79: Unknown result type (might be due to invalid IL or missing references)
			//IL_097b: Unknown result type (might be due to invalid IL or missing references)
			//IL_098a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bdc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0beb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4c: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB component = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			HUDManagerRevamp component2 = ((Component)HUDManager.Instance).gameObject.GetComponent<HUDManagerRevamp>();
			if (!Object.op_Implicit((Object)(object)component2) || !Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			if (component.isPlayerDead)
			{
				dressGirlHaunt = false;
			}
			if ((Object)(object)component == (Object)(object)localPlayerController && component.isPlayerDead)
			{
				HUDManagerRevamp.Instance.fullscreenPass2.fullscreenPassMaterial.SetFloat("_intensity", 0f);
			}
			else if (component.isPlayerDead)
			{
				inStairs = false;
			}
			if (inStairs && (Object)(object)component == (Object)(object)localPlayerController)
			{
				IngamePlayerSettings.Instance.playerInput.actions.FindAction("Sprint", false).Disable();
				IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false).Disable();
				component.sprintMeter = 0f;
				((CustomPass)HUDManagerRevamp.Instance.cameraFSPass).enabled = true;
			}
			else if ((Object)(object)component == (Object)(object)localPlayerController)
			{
				IngamePlayerSettings.Instance.playerInput.actions.FindAction("Sprint", false).Enable();
				IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false).Enable();
				((CustomPass)HUDManagerRevamp.Instance.cameraFSPass).enabled = false;
			}
			if (Configuration.fullDarkness.Value && (Object)(object)component == (Object)(object)localPlayerController && !fullDarknessSet)
			{
				Diversity.mls.LogInfo((object)("Setting full darkness to local player: " + component.playerUsername));
				component.nightVision.intensity = component.nightVision.intensity * (1f - Configuration.fullDarknessIntensity.Value);
				fullDarknessSet = true;
			}
			if (Configuration.dressGirlRevamp.Value && Configuration.dressGirlIsolation.Value)
			{
				if (dressGirlHaunt && component.actualClientId == localPlayerController.actualClientId && !component.isPlayerDead)
				{
					heartBeatTime += Time.deltaTime;
					heartBeatCooldown += Time.deltaTime;
					dressGirlHauntTime += Time.deltaTime;
					voicesTime += Time.deltaTime;
					component2.black.weight = Mathf.Lerp(0f, 1f, dressGirlHauntTime / 19f);
					filter = Mathf.Lerp(0f, 1f, dressGirlHauntTime / 19f);
					if (!playersHidden)
					{
						PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
						foreach (PlayerControllerB val in allPlayerScripts)
						{
							if ((Object)(object)val != (Object)null && val.actualClientId != StartOfRound.Instance.localPlayerController.actualClientId)
							{
								((Component)val).gameObject.SetActive(false);
							}
						}
					}
					heartBeatInterval = Mathf.Lerp(1.5f, 0.5f, dressGirlHauntTime / 19f);
					voicesInterval = Mathf.Lerp(3f, 0.75f, dressGirlHauntTime / 19f);
					if (heartBeatTime >= heartBeatInterval)
					{
						DiversitySoundManager.PlaySoundBypass(DiversitySoundManager.SoundType.HeartBeat, random: false, 1f, 0f);
						heartBeatTime = 0f;
					}
					if (voicesTime >= voicesInterval)
					{
						DiversitySoundManager.PlaySoundBypass(DiversitySoundManager.SoundType.DressGirlSpeech, random: true, Mathf.Lerp(0.6f, 0f, dressGirlHauntTime / 15f), 0f, loop: false, RoundManager.Instance.GetRandomPositionInRadius(((Component)component).transform.position, 6f, 11f, (Random)null));
						voicesTime = 0f;
					}
					playersHidden = true;
				}
				else if ((Object)(object)component == (Object)(object)localPlayerController && !dressGirlHaunt)
				{
					dressGirlHauntTime = 0f;
					component2.black.weight = 0f;
					component2.hauntedIntensity = 0f;
					filter = 0f;
					heartBeatTime = 0f;
					heartBeatCooldown = 0f;
					heartBeatInterval = 1f;
					voicesInterval = 1f;
					voicesTime = 0f;
					if (playersHidden)
					{
						PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts;
						foreach (PlayerControllerB val2 in allPlayerScripts2)
						{
							if ((Object)(object)val2 != (Object)null && val2.actualClientId != StartOfRound.Instance.localPlayerController.actualClientId)
							{
								((Component)val2).gameObject.SetActive(true);
							}
						}
					}
					playersHidden = false;
				}
			}
			if (sinkingFromWalker)
			{
				sinkingTime += Time.deltaTime;
				if (sinkingTime > 8f)
				{
					sinkingTime = 8f;
				}
				component.sinkingSpeedMultiplier = 0.1f;
				component.sinkingValue = sinkingTime / 8f * 0.9f;
				if ((Object)(object)component == (Object)(object)localPlayerController)
				{
					component2.black.weight = Mathf.Lerp(0f, 1f, sinkingTime / 9f);
					component2.sinkingIntensity = Mathf.Lerp(0f, 1f, sinkingTime / 8f);
					filter = Mathf.Lerp(0f, 1f, sinkingTime / 8f);
				}
			}
			else if (!dressGirlHaunt)
			{
				sinkingTime -= Time.deltaTime;
				if (sinkingTime > 5f)
				{
					sinkingTime = 5f;
				}
				else if (sinkingTime < 0f)
				{
					sinkingTime = 0f;
				}
				if ((Object)(object)component == (Object)(object)localPlayerController)
				{
					component2.black.weight = Mathf.Lerp(0f, 1f, sinkingTime / 5f);
					component2.sinkingIntensity = 0f;
					filter = Mathf.Lerp(0f, 1f, sinkingTime / 5f);
				}
			}
			if (kidnapSequence)
			{
				component2.black.weight = Mathf.Clamp01(Mathf.Lerp(1.3f, 0f, kidnapSequenceTime / 8f));
				filter = Mathf.Clamp01(Mathf.Lerp(1.3f, 0f, kidnapSequenceTime / 8f));
				kidnapSequenceTime += Time.deltaTime;
			}
			else
			{
				kidnapSequenceTime = 0f;
			}
			if (((Vector2)(ref component.moveInputVector)).sqrMagnitude > 0.19f)
			{
				fakeWalkerAnimator.SetBool("walk", true);
			}
			else
			{
				fakeWalkerAnimator.SetBool("walk", false);
			}
			if (!component.isPlayerControlled)
			{
				return;
			}
			if (forceLook)
			{
				Vector3 val3 = forceLookPosition - ((Component)component.gameplayCamera).transform.position;
				Vector3 val4 = ((Component)component.gameplayCamera).transform.InverseTransformDirection(val3);
				Vector2 val5 = default(Vector2);
				((Vector2)(ref val5))..ctor(val4.x, val4.y);
				component.CalculateNormalLookingInput(val5);
			}
			soundCheckInterval += Time.deltaTime;
			if (soundCheckInterval >= 0.5f)
			{
				if (!Object.op_Implicit((Object)(object)StartOfRoundRevamp.Instance) || !Object.op_Implicit((Object)(object)StartOfRound.Instance) || !Object.op_Implicit((Object)(object)StartOfRound.Instance.localPlayerController))
				{
					return;
				}
				foreach (GameObject item in StartOfRoundRevamp.Instance.steamSounds.ToList())
				{
					if (!Object.op_Implicit((Object)(object)item))
					{
						return;
					}
					bool flag = false;
					foreach (Vector3 item2 in nearbySounds.ToList())
					{
						if (item2 == item.transform.position)
						{
							flag = true;
						}
					}
					if (!flag && !instanciated)
					{
						DiversitySoundManager.CheckPosition(StartOfRound.Instance.localPlayerController);
						if (false)
						{
							return;
						}
						float num = Vector3.Distance(item.transform.position, DiversitySoundManager.CheckPosition(StartOfRound.Instance.localPlayerController));
						if (num < 32f)
						{
							DiversitySoundManager.PlaySound(DiversitySoundManager.SoundType.SteamLeak, random: false, 0.1f, 0f, loop: true, item.transform.position);
							nearbySounds.Add(item.transform.position);
							instanciated = true;
						}
					}
				}
				foreach (GameObject item3 in StartOfRoundRevamp.Instance.lightBuzz.ToList())
				{
					if (!Object.op_Implicit((Object)(object)item3))
					{
						return;
					}
					bool flag2 = false;
					foreach (Vector3 item4 in nearbySounds.ToList())
					{
						if (item4 == item3.transform.position)
						{
							flag2 = true;
						}
					}
					if (!flag2 && !instanciated)
					{
						DiversitySoundManager.CheckPosition(StartOfRound.Instance.localPlayerController);
						if (false)
						{
							return;
						}
						float num2 = Vector3.Distance(item3.transform.position, DiversitySoundManager.CheckPosition(StartOfRound.Instance.localPlayerController));
						if (num2 < 32f)
						{
							DiversitySoundManager.PlaySound(DiversitySoundManager.SoundType.LightBuzz, random: false, 0.4f, 0f, loop: true, item3.transform.position);
							nearbySounds.Add(item3.transform.position);
							instanciated = true;
						}
					}
				}
				foreach (GameObject item5 in DiversitySoundManager.Instance.current3Daudios.ToList())
				{
					if (!Object.op_Implicit((Object)(object)item5))
					{
						return;
					}
					DiversitySoundManager.CheckPosition(StartOfRound.Instance.localPlayerController);
					if (false)
					{
						return;
					}
					float num3 = Vector3.Distance(item5.transform.position, DiversitySoundManager.CheckPosition(StartOfRound.Instance.localPlayerController));
					if (num3 > 36f)
					{
						Object.Destroy((Object)(object)item5);
						DiversitySoundManager.Instance.current3Daudios.Remove(item5);
					}
				}
				soundCheckInterval = 0f;
				instanciated = false;
			}
			if (Object.op_Implicit((Object)(object)lastLight))
			{
				if (!isHaunted)
				{
					if (!unfinished)
					{
						if (timeElapsed != 1f)
						{
							timeElapsed = 1f - timeElapsed;
						}
						else
						{
							timeElapsed = 0f;
						}
						unfinished = true;
					}
					if (lastID == 0)
					{
						lastLight.intensity = Mathf.Lerp(100f, 486.8536f, timeElapsed / 1f);
					}
					else if (lastID == 1)
					{
						lastLight.intensity = Mathf.Lerp(50f, 397.9603f, timeElapsed / 1f);
					}
					timeElapsed += Time.deltaTime;
				}
				if (isHaunted)
				{
					if (unfinished)
					{
						if (timeElapsed != 1f)
						{
							timeElapsed = 1f - timeElapsed;
						}
						else
						{
							timeElapsed = 0f;
						}
						unfinished = false;
					}
					if (lastID == 0)
					{
						lastLight.intensity = Mathf.Lerp(486.8536f, 100f, timeElapsed / 1f);
					}
					else if (lastID == 1)
					{
						lastLight.intensity = Mathf.Lerp(397.9603f, 50f, timeElapsed / 1f);
					}
					timeElapsed += Time.deltaTime;
				}
				if (timeElapsed >= 1f)
				{
					timeElapsed = 1f;
				}
			}
			GrabbableObject[] itemSlots = component.ItemSlots;
			foreach (GrabbableObject val6 in itemSlots)
			{
				if ((Object)(object)val6 != (Object)null)
				{
					FlashlightRevamp component3 = ((Component)val6).gameObject.GetComponent<FlashlightRevamp>();
					if (Object.op_Implicit((Object)(object)component3))
					{
						component3.haunted = isHaunted;
					}
				}
			}
			if (dressGirlHaunt)
			{
				if (component.actualClientId == localPlayerController.actualClientId || component.playerSteamId == localPlayerController.playerSteamId)
				{
					component2.hauntedIntensity = 1f;
				}
			}
			else if (component.actualClientId == localPlayerController.actualClientId || component.playerSteamId == localPlayerController.playerSteamId)
			{
				component2.hauntedIntensity = 0f;
			}
		}

		public IEnumerator KidnapSequence(FlowermanAI bracken)
		{
			yield return (object)new WaitForSeconds(0.7f);
			kidnapSequence = true;
			((MonoBehaviour)bracken).StopCoroutine(bracken.killAnimation());
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PlayerRevamp()
		{
			//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
			NetworkManager.__rpc_func_table.Add(2858412267u, new RpcReceiveHandler(__rpc_handler_2858412267));
			NetworkManager.__rpc_func_table.Add(2867273533u, new RpcReceiveHandler(__rpc_handler_2867273533));
			NetworkManager.__rpc_func_table.Add(707304577u, new RpcReceiveHandler(__rpc_handler_707304577));
			NetworkManager.__rpc_func_table.Add(566092715u, new RpcReceiveHandler(__rpc_handler_566092715));
		}

		private static void __rpc_handler_2858412267(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Condition condition = default(Condition);
				((FastBufferReader)(ref reader)).ReadValueSafe<Condition>(ref condition, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PlayerRevamp)(object)target).ApplyConditionServerRpc(condition);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2867273533(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Condition condition = default(Condition);
				((FastBufferReader)(ref reader)).ReadValueSafe<Condition>(ref condition, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PlayerRevamp)(object)target).ApplyConditionClientRpc(condition);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_707304577(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Condition condition = default(Condition);
				((FastBufferReader)(ref reader)).ReadValueSafe<Condition>(ref condition, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PlayerRevamp)(object)target).RemoveConditionServerRpc(condition);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_566092715(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Condition condition = default(Condition);
				((FastBufferReader)(ref reader)).ReadValueSafe<Condition>(ref condition, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PlayerRevamp)(object)target).RemoveConditionClientRpc(condition);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PlayerRevamp";
		}
	}
}
namespace Diversity.Patches
{
	[HarmonyPatch(typeof(BaboonBirdAI))]
	internal class BaboonBirdAIPatch
	{
		[HarmonyPatch(typeof(BaboonBirdAI), "OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static void OnCollideWithPlayer(BaboonBirdAI __instance, Collider other)
		{
			if (__instance.timeSinceHitting < 0.5f)
			{
				return;
			}
			PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, ((EnemyAI)__instance).inSpecialAnimation || __instance.doingKillAnimation, false);
			if ((Object)(object)val != (Object)null)
			{
				PlayerRevamp component = ((Component)val).gameObject.GetComponent<PlayerRevamp>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.ApplyConditions(DamageType.Bitten, 1f + (1f - (float)(val.health / 100)));
				}
			}
		}
	}
	[HarmonyPatch(typeof(BlobAI))]
	internal class BlobAIPatch
	{
		[HarmonyPatch(typeof(BlobAI), "Start")]
		[HarmonyPrefix]
		private static void Start(BlobAI __instance)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			if (!Configuration.hydrogeneRevamp.Value)
			{
				return;
			}
			PullObjects pullObjects = ((Component)__instance).gameObject.GetComponent<PullObjects>();
			if (!Object.op_Implicit((Object)(object)pullObjects))
			{
				pullObjects = ((Component)__instance).gameObject.AddComponent<PullObjects>();
				Diversity.mls.LogInfo((object)"Adding PullObjects to blob!");
			}
			foreach (Transform item in ((Component)__instance).transform.Find("Armature"))
			{
				Transform val = item;
				BlobRevamp component = ((Component)val).gameObject.GetComponent<BlobRevamp>();
				if (!Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent<BoxCollider>()))
				{
					component = ((Component)val).gameObject.AddComponent<BlobRevamp>();
					component.pull = pullObjects;
					Diversity.mls.LogInfo((object)"Adding revamp to blob part!");
				}
			}
			if (!StartOfRoundRevamp.Instance.currentBlobs.Contains(pullObjects))
			{
				StartOfRoundRevamp.Instance.currentBlobs.Add(pullObjects);
			}
		}

		[HarmonyPatch(typeof(BlobAI), "OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static void OnCollideWithPlayer(BlobAI __instance, Collider other)
		{
			if (__instance.timeSinceHittingLocalPlayer < 0.25f || (__instance.tamedTimer > 0f && __instance.angeredTimer < 0f))
			{
				return;
			}
			PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, false, false);
			if ((Object)(object)val != (Object)null)
			{
				PlayerRevamp component = ((Component)val).gameObject.GetComponent<PlayerRevamp>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.ApplyConditions(DamageType.Burned, 1f + (1f - (float)(val.health / 100)));
				}
			}
		}
	}
	[HarmonyPatch(typeof(BreakerBox))]
	internal class BreakerBoxPatch : MonoBehaviour
	{
		[HarmonyPatch(typeof(BreakerBox), "Start")]
		[HarmonyPostfix]
		public static void Start(BreakerBox __instance)
		{
			BreakerBoxRevamp component = ((Component)__instance).gameObject.GetComponent<BreakerBoxRevamp>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				((Component)__instance).gameObject.AddComponent<BreakerBoxRevamp>();
				Diversity.mls.LogInfo((object)"Added DiversityBehaviour to the RoundManager.");
			}
		}

		[HarmonyPatch(typeof(BreakerBox), "SwitchBreaker")]
		[HarmonyPostfix]
		public static void SwitchBreaker(BreakerBox __instance)
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			int num = 3;
			BreakerBoxRevamp component = ((Component)__instance).gameObject.GetComponent<BreakerBoxRevamp>();
			if (Object.op_Implicit((Object)(object)component))
			{
				num = component.anger;
			}
			Diversity.mls.LogInfo((object)("angerMax: " + num));
			if (!Configuration.brakenAnger.Value || !__instance.isPowerOn)
			{
				return;
			}
			FlowermanAI[] array = (FlowermanAI[])(object)Object.FindObjectsOfType(typeof(FlowermanAI));
			if (!Configuration.brakenRevamp.Value)
			{
				return;
			}
			FlowermanAI[] array2 = array;
			foreach (FlowermanAI val in array2)
			{
				BrakenRevamp component2 = ((Component)val).gameObject.GetComponent<BrakenRevamp>();
				if (!Object.op_Implicit((Object)(object)component2))
				{
					break;
				}
				PlayerControllerB[] allPlayerScripts = __instance.roundManager.playersManager.allPlayerScripts;
				float num2 = 100f;
				PlayerControllerB val2 = null;
				PlayerControllerB[] array3 = allPlayerScripts;
				foreach (PlayerControllerB val3 in array3)
				{
					if ((Object)(object)val3 != (Object)null && Vector3.Distance(((Component)__instance).gameObject.transform.position, ((Component)val3).gameObject.transform.position) < num2)
					{
						num2 = Vector3.Distance(((Component)__instance).gameObject.transform.position, ((Component)val3).gameObject.transform.position);
						val2 = val3;
					}
				}
				if ((Object)(object)val2 != (Object)null)
				{
					Diversity.mls.LogInfo((object)("Closest player from breaker box is: " + ((Object)((Component)val2).gameObject).name));
				}
				if (component2.angerLevel < num && num2 < 7f)
				{
					component2.angerLevel++;
				}
				if (((NetworkBehaviour)__instance).IsOwner && num2 < 7f)
				{
					component2.CheckAnger(component, __instance.roundManager, val2);
				}
			}
		}
	}
	[HarmonyPatch(typeof(CentipedeAI))]
	internal class CentipedeAIPatch
	{
		[HarmonyPatch(typeof(CentipedeAI), "Start")]
		[HarmonyPrefix]
		public static void Start(CentipedeAI __instance)
		{
			if (Configuration.centipedeRevamp.Value)
			{
				CentipedeRevamp component = ((Component)__instance).gameObject.GetComponent<CentipedeRevamp>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					((Component)__instance).gameObject.AddComponent<CentipedeRevamp>();
					Diversity.mls.LogInfo((object)("Added CentipedeRevamp to: " + ((Object)((Component)__instance).gameObject).name));
				}
			}
		}

		[HarmonyPatch(typeof(CentipedeAI), "DamagePlayerOnIntervals")]
		[HarmonyPrefix]
		private static void DamagePlayerOnIntervals(CentipedeAI __instance)
		{
			if (__instance.damagePlayerInterval <= 0f && !__instance.inDroppingOffPlayerAnim && !(((EnemyAI)__instance).stunNormalizedTimer > 0f) && (StartOfRound.Instance.connectedPlayersAmount > 0 || __instance.clingingToPlayer.health > 15 || __instance.singlePlayerSecondChanceGiven) && (Object)(object)__instance.clingingToPlayer != (Object)null)
			{
				PlayerRevamp component = ((Component)__instance.clingingToPlayer).gameObject.GetComponent<PlayerRevamp>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.ApplyConditions(DamageType.Mauled, 1f + (1f - (float)(__instance.clingingToPlayer.health / 100)));
				}
			}
		}
	}
	[HarmonyPatch(typeof(CrawlerAI))]
	internal class CrawlerAIPatch
	{
		private static CrawlerRevamp crawler;

		[HarmonyPatch(typeof(CrawlerAI), "HitEnemy")]
		[HarmonyPrefix]
		public static void Slow(CrawlerAI __instance)
		{
			if (Configuration.crawlerRevamp.Value)
			{
				crawler = ((Component)__instance).GetComponent<CrawlerRevamp>();
				if (Object.op_Implicit((Object)(object)crawler) && !crawler.onCooldown)
				{
					crawler.hasBeenhit = true;
					crawler.onCooldown = true;
					crawler.previousAgentSpeed = ((EnemyAI)__instance).agent.speed;
					crawler.previousAgentAcceleration = ((EnemyAI)__instance).agent.acceleration;
					crawler.currentAgentSpeed = ((EnemyAI)__instance).agent.speed;
					crawler.currentAgentAcceleration = ((EnemyAI)__instance).agent.acceleration;
					Diversity.mls.LogInfo((object)"Crawler hit!");
				}
			}
		}

		[HarmonyPatch(typeof(CrawlerAI), "Start")]
		[HarmonyPrefix]
		public static void Start(CrawlerAI __instance)
		{
			if (Configuration.crawlerRevamp.Value)
			{
				crawler = ((Component)__instance).gameObject.GetComponent<CrawlerRevamp>();
				if (!Object.op_Implicit((Object)(object)crawler))
				{
					((Component)__instance).gameObject.AddComponent<CrawlerRevamp>();
					Diversity.mls.LogInfo((object)("Added CrawlerRevamp to: " + ((Object)((Component)__instance).gameObject).name));
				}
			}
		}

		[HarmonyPatch(typeof(CrawlerAI), "OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static void OnCollideWithPlayer(CrawlerAI __instance, Collider other)
		{
			if (__instance.timeSinceHittingPlayer < 0.65f)
			{
				return;
			}
			PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, false, false);
			if ((Object)(object)val != (Object)null)
			{
				PlayerRevamp component = ((Component)val).gameObject.GetComponent<PlayerRevamp>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.ApplyConditions(DamageType.Bitten, 1f + (1f - (float)(val.health / 100)));
				}
			}
		}
	}
	[HarmonyPatch(typeof(DressGirlAI))]
	internal class DressGirlAIPatch
	{
		[HarmonyPatch(typeof(DressGirlAI), "Start")]
		[HarmonyPrefix]
		private static void Start(DressGirlAI __instance)
		{
			if (Configuration.dressGirlRevamp.Value)
			{
				DressGirlRevamp component = ((Component)__instance).gameObject.GetComponent<DressGirlRevamp>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					((Component)__instance).gameObject.AddComponent<DressGirlRevamp>();
					Diversity.mls.LogInfo((object)("Added DressGirlRevamp to: " + ((Object)((Component)__instance).gameObject).name));
				}
			}
		}

		[HarmonyPatch(typeof(DressGirlAI), "Update")]
		[HarmonyPostfix]
		private static void Update(DressGirlAI __instance)
		{
			if (Configuration.dressGirlRevamp.Value)
			{
				DressGirlRevamp component = ((Component)__instance).gameObject.GetComponent<DressGirlRevamp>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.timeElapsed += Time.deltaTime;
					component.TryWalkieTalkie(__instance.hauntingPlayer);
				}
			}
		}

		[HarmonyPatch(typeof(DressGirlAI), "BeginChasing")]
		[HarmonyPostfix]
		private static void BeginChasing(DressGirlAI __instance)
		{
			if (Configuration.dressGirlRevamp.Value && Configuration.dressGirlIsolation.Value && !((Object)(object)__instance.hauntingPlayer == (Object)null))
			{
				PlayerRevamp component = ((Component)__instance.hauntingPlayer).GetComponent<PlayerRevamp>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.dressGirlHaunt = true;
				}
			}
		}

		[HarmonyPatch(typeof(DressGirlAI), "StopChasing")]
		[HarmonyPostfix]
		private static void StopChasing(DressGirlAI __instance)
		{
			if (!Configuration.dressGirlRevamp.Value || !Configuration.dressGirlIsolation.Value || (Object)(object)__instance.hauntingPlayer == (Object)null)
			{
				return;
			}
			PlayerRevamp component = ((Component)__instance.hauntingPlayer).GetComponent<PlayerRevamp>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			component.dressGirlHaunt = false;
			DiversitySoundManager.StopSoundBypass();
			if (DiversitySoundManager.Instance.currentGirlAudios.Count <= 0)
			{
				return;
			}
			foreach (GameObject item in DiversitySoundManager.Instance.currentGirlAudios.ToList())
			{
				item.GetComponent<AudioSource>().Stop();
				DiversitySoundManager.DeleteAudio(item);
				DiversitySoundManager.Instance.currentGirlAudios.Remove(item);
			}
		}
	}
	[HarmonyPatch(typeof(FlashlightItem))]
	public class FlashlightPatch : MonoBehaviour
	{
		private static bool wasHaunted;

		private static float timeElapsed;

		[HarmonyPatch(typeof(FlashlightItem), "Update")]
		[HarmonyPostfix]
		private static void Update(FlashlightItem __instance)
		{
			if (!Configuration.brakenRevamp.Value)
			{
				return;
			}
			FlashlightRevamp component = ((Component)__instance).gameObject.GetComponent<FlashlightRevamp>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			if (component.haunted)
			{
				if (!wasHaunted)
				{
					wasHaunted = true;
				}
				__instance.flashlightBulb.intensity = component.currentIntensity;
				timeElapsed = 0f;
			}
			else
			{
				timeElapsed += Time.deltaTime;
				if (timeElapsed >= 1f)
				{
					wasHaunted = false;
				}
			}
		}

		[HarmonyPatch(typeof(FlashlightItem), "Start")]
		[HarmonyPrefix]
		public static void Start(FlashlightItem __instance)
		{
			if (Configuration.brakenRevamp.Value)
			{
				FlashlightRevamp component = ((Component)__instance).gameObject.GetComponent<FlashlightRevamp>();
				Rigidbody component2 = ((Component)__instance).gameObject.GetComponent<Rigidbody>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					((Component)__instance).gameObject.AddComponent<FlashlightRevamp>();
					Diversity.mls.LogInfo((object)("Added FlashlightRevamp to: " + ((Object)((Component)__instance).gameObject).name));
				}
			}
		}
	}
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class FlowermanAIPatch
	{
		[HarmonyPatch(typeof(FlowermanAI), "Start")]
		[HarmonyPrefix]
		public static void Start(FlowermanAI __instance)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			if (Configuration.brakenRevamp.Value)
			{
				BrakenRevamp component = ((Component)__instance).gameObject.GetComponent<BrakenRevamp>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					((Component)__instance).gameObject.AddComponent<BrakenRevamp>();
					Diversity.mls.LogInfo((object)("Added BrakenRevamp to: " + ((Object)((Component)__instance).gameObject).name));
				}
				GameObject val = new GameObject("CreatureSpeech");
				AudioSource val2 = val.AddComponent<AudioSource>();
				val2.loop = false;
				((Behaviour)val2).enabled = true;
				val2.playOnAwake = false;
				val2.volume = 1f;
				val2.spatialBlend = 0f;
				val2.clip = Content.MainAssets.LoadAsset<AudioClip>("Assets/custom/diversity/bracken/you're next.mp3");
				val.transform.SetParent(((Component)__instance).gameObject.transform);
				Diversity.mls.LogInfo((object)("Added CreatureSpeech to: " + ((Object)((Component)__instance).gameObject).name));
			}
		}

		[HarmonyPatch(typeof(FlowermanAI), "killAnimation")]
		[HarmonyPostfix]
		private static void killAnimation(FlowermanAI __instance)
		{
			if (!Configuration.brakenRevamp.Value || !((Object)(object)((EnemyAI)__instance).inSpecialAnimationWithPlayer != (Object)null))
			{
				return;
			}
			Transform val = ((Component)__instance).gameObject.transform.Find("CreatureSpeech");
			if (Object.op_Implicit((Object)(object)val))
			{
				AudioSource component = ((Component)val).GetComponent<AudioSource>();
				BrakenRevamp component2 = ((Component)__instance).gameObject.GetComponent<BrakenRevamp>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					component2.TransmitWalkie(component.clip);
				}
			}
		}

		[HarmonyPatch(typeof(FlowermanAI), "OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static void OnCollideWithPlayer(FlowermanAI __instance, Collider other)
		{
			if (!Configuration.brakenSpace.Value)
			{
				return;
			}
			if (Configuration.brakenSnatchCompatibility.Value)
			{
				((MonoBehaviour)__instance).StartCoroutine(WaitForBrackenToKill(__instance, other));
				return;
			}
			BrakenRevamp component = ((Component)__instance).gameObject.GetComponent<BrakenRevamp>();
			StartOfRoundRevamp component2 = ((Component)StartOfRound.Instance).gameObject.GetComponent<StartOfRoundRevamp>();
			PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, __instance.inKillAnimation || __instance.startingKillAnimationLocalClient || __instance.carryingPlayerBody, false);
			if (!((Object)(object)val != (Object)null) || !Object.op_Implicit((Object)(object)component) || component.kidnapped)
			{
				return;
			}
			component.kidnapped = true;
			if (!Object.op_Implicit((Object)(object)component2))
			{
				return;
			}
			PlayerRevamp component3 = ((Component)val).gameObject.GetComponent<PlayerRevamp>();
			if ((Object)(object)component3 != (Object)null)
			{
				if (((NetworkBehaviour)__instance).IsOwner)
				{
					((MonoBehaviour)component3).StartCoroutine(component3.KidnapSequence(__instance));
					component2.KidnapServerRpc(val.playerClientId);
				}
				if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)(object)val)
				{
					StartOfRound.Instance.allowLocalPlayerDeath = false;
				}
				((Component)((Component)val).gameObject.transform.Find("Misc").Find("MapDot")).gameObject.SetActive(false);
				component.ResetAnimationServerRpc();
			}
		}

		public static IEnumerator WaitForBrackenToKill(FlowermanAI __instance, Collider other)
		{
			FlowermanAI __instance2 = __instance;
			BrakenRevamp braken = ((Component)__instance2).gameObject.GetComponent<BrakenRevamp>();
			StartOfRoundRevamp revamp = ((Component)StartOfRound.Instance).gameObject.GetComponent<StartOfRoundRevamp>();
			PlayerControllerB playerControllerB = ((EnemyAI)__instance2).MeetsStandardPlayerCollisionConditions(other, __instance2.inKillAnimation || __instance2.startingKillAnimationLocalClient || __instance2.carryingPlayerBody, false);
			if (!((Object)(object)playerControllerB != (Object)null))
			{
				yield break;
			}
			yield return (object)new WaitUntil((Func<bool>)(() => __instance2.carryingPlayerBody));
			yield return (object)new WaitUntil((Func<bool>)(() => __instance2.crackNeckAudio.isPlaying || !__instance2.carryingPlayerBody));
			if (!__instance2.crackNeckAudio.isPlaying || !__instance2.carryingPlayerBody || !Object.op_Implicit((Object)(object)braken) || braken.kidnapped)
			{
				yield break;
			}
			braken.kidnapped = true;
			if (!Object.op_Implicit((Object)(object)revamp))
			{
				yield break;
			}
			PlayerRevamp pRevamp = ((Component)playerControllerB).gameObject.GetComponent<PlayerRevamp>();
			if ((Object)(object)pRevamp != (Object)null)
			{
				((MonoBehaviour)pRevamp).StartCoroutine(pRevamp.KidnapSequence(__instance2));
				if (((NetworkBehaviour)__instance2).IsOwner)
				{
					revamp.KidnapServerRpc(playerControllerB.playerClientId);
				}
				StartOfRound.Instance.allowLocalPlayerDeath = false;
				((Component)((Component)playerControllerB).gameObject.transform.Find("Misc").Find("MapDot")).gameObject.SetActive(false);
				braken.ResetAnimationServerRpc();
			}
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatch
	{
		private static readonly List<GameObject> prefabs = new List<GameObject>();

		public static void RegisterPrefab(GameObject prefab)
		{
			prefabs.Add(prefab);
		}

		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		[HarmonyPostfix]
		private static void Start()
		{
			if (Configuration.walker.Value)
			{
				foreach (GameObject prefab in prefabs)
				{
					NetworkManager.Singleton.AddNetworkPrefab(prefab);
					Diversity.mls.LogInfo((object)(((Object)prefab).name + " Has been registered!"));
				}
			}
			if (!Configuration.brakenRevamp.Value)
			{
				return;
			}
			foreach (NetworkPrefab prefab2 in NetworkManager.Singleton.NetworkConfig.Prefabs.m_Prefabs)
			{
				if (((Object)prefab2.Prefab).name == "Flowerman")
				{
					prefab2.Prefab.AddComponent<BrakenRevamp>();
				}
			}
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbableObjectPatch
	{
		private static float interval;

		[HarmonyPatch(typeof(GrabbableObject), "Update")]
		[HarmonyPrefix]
		private static void Update(GrabbableObject __instance)
		{
			//IL_0078: 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)
			interval += Time.deltaTime;
			if (!(interval >= 0.25f))
			{
				return;
			}
			foreach (PullObjects item in StartOfRoundRevamp.Instance.currentBlobs.ToList())
			{
				if ((Object)(object)item == (Object)null || (Object)(object)((Component)item).gameObject == (Object)null)
				{
					return;
				}
				float num = Vector3.Distance(((Component)__instance).transform.position, ((Component)item).transform.position);
				if (item.props.Contains(((Component)__instance).gameObject) && num > 1f)
				{
					item.props.Remove(((Component)__instance).gameObject);
				}
			}
			interval = 0f;
		}
	}
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugAIPatch
	{
		[HarmonyPatch(typeof(HoarderBugAI), "OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static void OnCollideWithPlayer(HoarderBugAI __instance, Collider other)
		{
			if (!__instance.inChase || __instance.timeSinceHittingPlayer < 0.5f)
			{
				return;
			}
			PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, false, false);
			if ((Object)(object)val != (Object)null)
			{
				PlayerRevamp component = ((Component)val).gameObject.GetComponent<PlayerRevamp>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.ApplyConditions(DamageType.Mauled, 1f + (1f - (float)(val.health / 100)));
				}
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	public class HUDPatch
	{
		public static TextMeshProUGUI tipText;

		public static Image holderBar;

		public static Image clickBar;

		private static readonly string text = "Free from head : [E]";

		private static readonly Color color = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));

		[HarmonyPatch(typeof(HUDManager), "Awake")]
		[HarmonyPostfix]
		private static void Awake(ref HUDManager __instance)
		{
			HUDManagerRevamp component = ((Component)__instance).gameObject.GetComponent<HUDManagerRevamp>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				((Component)__instance).gameObject.AddComponent<HUDManagerRevamp>();
				Diversity.mls.LogInfo((object)("Added HUDManagerRevamp to: " + ((Object)((Component)__instance).gameObject).name));
			}
		}

		[HarmonyPatch(typeof(HUDManager), "Start")]
		[HarmonyPostfix]
		private static void Start(ref HUDManager __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or m