Decompiled source of Something v0.3.0

Something/Snowlance.Something.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Snowlance.Something.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("Snowlance.Something")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.3.0.0")]
[assembly: AssemblyInformationalVersion("0.3.0+c263aeb1bb91b6713465a13e62d8d68692b3efcf")]
[assembly: AssemblyProduct("Something")]
[assembly: AssemblyTitle("Snowlance.Something")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Something
{
	internal class BreathingBehavior : MonoBehaviour
	{
		public Slider BreathSlider;

		public GameObject SliderObj;

		public AudioClip BreathInSFX;

		public AudioClip BreathOutSFX;

		public Sprite[] JumpscareSprites;

		public GameObject PanelObj;

		public Image PanelImage;

		private const float insanityToShowTooltip = 10f;

		private bool active;

		private bool holdingKey;

		private bool showedTooltip;

		private float multiplier = 0.5f;

		private float insanityMultiplier = 2.5f;

		private string KeyBind
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				InputBinding val = SomethingInputs.Instance.BreathKey.bindings[0];
				return InputControlPath.ToHumanReadableString(((InputBinding)(ref val)).path, (HumanReadableStringOptions)2, (InputControl)null);
			}
		}

		public void Update()
		{
			if (showedTooltip || Plugin.localPlayer.insanityLevel >= 10f)
			{
				if (Plugin.configShowBreathingTooltip.Value)
				{
					HUDManager.Instance.ChangeControlTipMultiple(new string[1] { "Breath: [" + KeyBind + "]" }, false, (Item)null);
				}
				if (!showedTooltip)
				{
					HUDManager.Instance.DisplayTip("???", "Hold [" + KeyBind + "] to breath", false, true, "SomethingModTip1");
				}
				showedTooltip = true;
			}
			if (SomethingInputs.Instance.BreathKey.WasPressedThisFrame())
			{
				Plugin.LoggerInstance.LogDebug((object)"Start Breathing");
				Plugin.localPlayer.movementAudio.Stop();
				Plugin.localPlayer.movementAudio.loop = false;
				Plugin.localPlayer.movementAudio.clip = BreathInSFX;
				Plugin.localPlayer.movementAudio.Play();
				holdingKey = true;
			}
			else if (SomethingInputs.Instance.BreathKey.WasReleasedThisFrame())
			{
				Plugin.LoggerInstance.LogDebug((object)"Stop Breathing");
				Plugin.localPlayer.movementAudio.Stop();
				Plugin.localPlayer.movementAudio.loop = false;
				Plugin.localPlayer.movementAudio.clip = BreathOutSFX;
				Plugin.localPlayer.movementAudio.Play();
				holdingKey = false;
			}
			if (holdingKey)
			{
				if (BreathSlider.value < 1f)
				{
					Slider breathSlider = BreathSlider;
					breathSlider.value += Time.deltaTime * multiplier;
					if (Plugin.localPlayer.insanityLevel > 0f)
					{
						PlayerControllerB localPlayer = Plugin.localPlayer;
						localPlayer.insanityLevel -= Time.deltaTime * insanityMultiplier;
						Plugin.LoggerInstance.LogDebug((object)("Insanity: " + Plugin.localPlayer.insanityLevel));
					}
				}
				if (BreathSlider.value > 0f && !active)
				{
					SliderObj.SetActive(true);
					active = true;
				}
			}
			else
			{
				if (BreathSlider.value > 0f)
				{
					Slider breathSlider2 = BreathSlider;
					breathSlider2.value -= Time.deltaTime * multiplier;
				}
				if (BreathSlider.value <= 0f && active)
				{
					SliderObj.SetActive(false);
					active = false;
				}
			}
		}

		public void JumpscarePlayer(float time)
		{
			PanelObj.SetActive(true);
			int num = Random.Range(0, JumpscareSprites.Length);
			PanelImage.sprite = JumpscareSprites[num];
			((MonoBehaviour)this).StartCoroutine(JumpscarePlayerCoroutine(time));
		}

		private IEnumerator JumpscarePlayerCoroutine(float time)
		{
			yield return (object)new WaitForSeconds(time);
			PanelObj.SetActive(false);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	internal class LesserSomethingAI : MonoBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public Transform turnCompass;

		public NavMeshAgent agent;

		public AudioSource creatureSFX;

		public AudioClip[] ambientSFX;

		public AudioClip[] alertSFX;

		public AudioClip[] attackSFX;

		public float AITimeInterval;

		public PlayerControllerB targetPlayer;

		private Coroutine wanderRoutine;

		public Transform spawnNode;

		private float timeSinceAIInterval;

		private float timeSpawned;

		private bool chasing;

		private float stareTime;

		public bool init;

		public float destroyTime;

		private float idleMinInterval = 3f;

		private float idleMaxInterval = 10f;

		private float maxStareTime = 1f;

		private int damage = 2;

		private float insanityMultiplier = 1f;

		private float insanityChaseMultiplier = 1.2f;

		private float chaseSpeed = 1.5f;

		private float wanderSpeed = 1f;

		private float insanityOnCollision = 5f;

		public void Start()
		{
			wanderRoutine = ((MonoBehaviour)this).StartCoroutine(WanderingCoroutine());
		}

		public void Update()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (init)
			{
				timeSinceAIInterval += Time.deltaTime;
				timeSpawned += Time.deltaTime;
				if (timeSinceAIInterval >= AITimeInterval)
				{
					timeSinceAIInterval = 0f;
					DoAIInterval();
				}
				turnCompass.LookAt(((Component)Plugin.localPlayer.gameplayCamera).transform.position);
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 10f * Time.deltaTime);
			}
		}

		public void DoAIInterval()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			bool flag = targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f);
			if (!flag && timeSpawned > destroyTime)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			if (chasing)
			{
				agent.speed = chaseSpeed;
				agent.SetDestination(((Component)targetPlayer).transform.position);
				if (flag)
				{
					PlayerControllerB obj = targetPlayer;
					obj.insanityLevel += AITimeInterval * insanityChaseMultiplier;
				}
				return;
			}
			agent.speed = wanderSpeed;
			if (flag)
			{
				PlayerControllerB obj2 = targetPlayer;
				obj2.insanityLevel += AITimeInterval * insanityMultiplier;
				stareTime += AITimeInterval;
				if (stareTime >= maxStareTime)
				{
					((MonoBehaviour)this).StopCoroutine(wanderRoutine);
					chasing = true;
					RoundManager.PlayRandomClip(creatureSFX, alertSFX, true, 1f, 0, 1000);
				}
			}
		}

		private IEnumerator WanderingCoroutine()
		{
			yield return null;
			yield return (object)new WaitUntil((Func<bool>)(() => init));
			while (true)
			{
				float timeStuck = 0f;
				float idleTime = Random.Range(idleMinInterval, idleMaxInterval);
				Vector3 position = RoundManager.Instance.GetRandomNavMeshPositionInRadius(spawnNode.position, 3f, RoundManager.Instance.navHit);
				agent.SetDestination(position);
				while (true)
				{
					yield return (object)new WaitForSeconds(AITimeInterval);
					if (!agent.hasPath || timeStuck > 1f)
					{
						break;
					}
					if (agent.velocity == Vector3.zero)
					{
						timeStuck += AITimeInterval;
					}
				}
				RoundManager.PlayRandomClip(creatureSFX, ambientSFX, true, 1f, 0, 1000);
				yield return (object)new WaitForSeconds(idleTime);
			}
		}

		public void OnTriggerEnter(Collider other)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = default(PlayerControllerB);
			if (((Component)other).CompareTag("Player") && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)val != (Object)(object)Plugin.localPlayer))
			{
				Plugin.log("Player collided with lesser something");
				Plugin.localPlayer.DamagePlayer(damage, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				PlayerControllerB localPlayer = Plugin.localPlayer;
				localPlayer.insanityLevel += insanityOnCollision;
				RoundManager.PlayRandomClip(Plugin.localPlayer.statusEffectAudio, attackSFX, true, 1f, 0, 1000);
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	internal class TESTING : MonoBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		public static void PingScan_performedPostFix()
		{
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		public static void SubmitChat_performedPrefix(HUDManager __instance)
		{
			try
			{
				string text = __instance.chatTextField.text;
				string[] array = text.Split(" ");
				switch (array[0])
				{
				case "/save":
					GameNetworkManager.Instance.SaveItemsInShip();
					break;
				case "/insanity":
					Plugin.localPlayer.insanityLevel = float.Parse(array[1]);
					break;
				case "/refresh":
					RoundManager.Instance.RefreshEnemiesList();
					HoarderBugAI.RefreshGrabbableObjectsInMapList();
					break;
				case "/levels":
				{
					SelectableLevel[] levels = StartOfRound.Instance.levels;
					foreach (SelectableLevel val2 in levels)
					{
						Plugin.log(((Object)val2).name);
					}
					break;
				}
				case "/dungeon":
					Plugin.log(((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name);
					break;
				case "/dungeons":
				{
					IndoorMapType[] dungeonFlowTypes = RoundManager.Instance.dungeonFlowTypes;
					foreach (IndoorMapType val in dungeonFlowTypes)
					{
						Plugin.log(((Object)val.dungeonFlow).name);
					}
					break;
				}
				}
			}
			catch
			{
				logger.LogError((object)"Invalid chat command");
			}
		}
	}
	[BepInPlugin("Snowlance.Something", "Something", "0.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin PluginInstance;

		public static ManualLogSource LoggerInstance;

		private readonly Harmony harmony = new Harmony("Snowlance.Something");

		public static AssetBundle? ModAssets;

		public static ConfigEntry<bool> configEnableDebugging;

		public static ConfigEntry<bool> configSpoilerFreeVersion;

		public static ConfigEntry<bool> configShowBreathingTooltip;

		public static ConfigEntry<string> configSomethingLevelRarities;

		public static ConfigEntry<string> configSomethingCustomLevelRarities;

		public static ConfigEntry<string> configRabbitLevelRarities;

		public static ConfigEntry<string> configRabbitCustomLevelRarities;

		public static ConfigEntry<bool> configEnablePolaroids;

		public static ConfigEntry<string> configGoodPolaroidLevelRarities;

		public static ConfigEntry<string> configGoodPolaroidCustomLevelRarities;

		public static ConfigEntry<int> configGoodPolaroidMinValue;

		public static ConfigEntry<int> configGoodPolaroidMaxValue;

		public static ConfigEntry<string> configBadPolaroidLevelRarities;

		public static ConfigEntry<string> configBadPolaroidCustomLevelRarities;

		public static ConfigEntry<int> configBadPolaroidMinValue;

		public static ConfigEntry<int> configBadPolaroidMaxValue;

		public static ConfigEntry<float> configBadPolaroidSomethingChance;

		public static ConfigEntry<string> configCursedPolaroidLevelRarities;

		public static ConfigEntry<string> configCursedPolaroidCustomLevelRarities;

		public static ConfigEntry<int> configCursedPolaroidMinValue;

		public static ConfigEntry<int> configCursedPolaroidMaxValue;

		public static ConfigEntry<float> configCursedPolaroidSomethingChance;

		public static ConfigEntry<string> configKeytarLevelRarities;

		public static ConfigEntry<string> configKeytarCustomLevelRarities;

		public static ConfigEntry<int> configKeytarMinValue;

		public static ConfigEntry<int> configKeytarMaxValue;

		public static ConfigEntry<string> configAubreyPlushLevelRarities;

		public static ConfigEntry<string> configAubreyPlushCustomLevelRarities;

		public static ConfigEntry<int> configAubreyPlushMinValue;

		public static ConfigEntry<int> configAubreyPlushMaxValue;

		public static ConfigEntry<string> configBasilPlushLevelRarities;

		public static ConfigEntry<string> configBasilPlushCustomLevelRarities;

		public static ConfigEntry<int> configBasilPlushMinValue;

		public static ConfigEntry<int> configBasilPlushMaxValue;

		public static ConfigEntry<string> configBunnybunLevelRarities;

		public static ConfigEntry<string> configBunnybunCustomLevelRarities;

		public static ConfigEntry<int> configBunnybunMinValue;

		public static ConfigEntry<int> configBunnybunMaxValue;

		public static ConfigEntry<string> configMailboxLevelRarities;

		public static ConfigEntry<string> configMailboxCustomLevelRarities;

		public static ConfigEntry<int> configMailboxMinValue;

		public static ConfigEntry<int> configMailboxMaxValue;

		public static PlayerControllerB localPlayer => GameNetworkManager.Instance.localPlayerController;

		public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost;

		public static PlayerControllerB PlayerFromId(ulong id)
		{
			return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == id).First();
		}

		private void Awake()
		{
			if ((Object)(object)PluginInstance == (Object)null)
			{
				PluginInstance = this;
			}
			LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
			harmony.PatchAll();
			InitializeNetworkBehaviours();
			SomethingInputs.Init();
			configEnableDebugging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debuggin", "Enable Debugging", false, "Set to true to enable debug logs");
			configSpoilerFreeVersion = ((BaseUnityPlugin)this).Config.Bind<bool>("Spoilers", "Spoiler-Free Version", true, "Replaces most spoilers for the game with alternatives.");
			configShowBreathingTooltip = ((BaseUnityPlugin)this).Config.Bind<bool>("BreathingUI", "Show Breathing Tooltip", true, "Shows the breathing tooltip on the top right when you are being haunted by Something.");
			configSomethingLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Rarities", "Something Level Rarities", "All: 40, Modded: 40", "Rarities for each level. See default for formatting.");
			configSomethingCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Rarities", "Something Custom Level Rarities", "", "Rarities for modded levels.");
			configRabbitLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Rarities", "Rabbit Level Rarities", "All: 5, Modded: 5", "Rarities for each level. See default for formatting.");
			configRabbitCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Rarities", "Rabbit Custom Level Rarities", "", "Rarities for modded levels.");
			configEnablePolaroids = ((BaseUnityPlugin)this).Config.Bind<bool>("Polaroid Rarities", "Enable Polaroids", true, "Enables polaroids from the game as scrap.");
			configGoodPolaroidLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Polaroid Rarities", "Good Polaroid Level Rarities", "All: 50, Modded: 50", "Rarities for Good Polaroids.");
			configGoodPolaroidCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Polaroid Rarities", "Good Polaroid Custom Level Rarities", "", "Custom rarities for Good Polaroids.");
			configGoodPolaroidMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("Polaroids", "Good Polaroid Min Value", 50, "Minimum value for Good Polaroid.");
			configGoodPolaroidMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("Polaroids", "Good Polaroid Max Value", 75, "Maximum value for Good Polaroid.");
			configBadPolaroidLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Polaroid Rarities", "Bad Polaroid Level Rarities", "All: 50, Modded: 50", "Rarities for Bad Polaroids.");
			configBadPolaroidCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Polaroid Rarities", "Bad Polaroid Custom Level Rarities", "", "Custom rarities for Bad Polaroids.");
			configBadPolaroidMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("Polaroids", "Bad Polaroid Min Value", 50, "Minimum value for Bad Polaroid.");
			configBadPolaroidMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("Polaroids", "Bad Polaroid Max Value", 100, "Maximum value for Bad Polaroid.");
			configBadPolaroidSomethingChance = ((BaseUnityPlugin)this).Config.Bind<float>("Polaroids", "Bad Polaroid Something Spawn Chance", 0.5f, "Chance of spawning somethiing on first player who picked up Bad Polaroid.");
			configCursedPolaroidLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Polaroid Rarities", "Cursed Polaroid Level Rarities", "All: 5, Modded: 5", "Rarities for Cursed Polaroids.");
			configCursedPolaroidCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Polaroid Rarities", "Cursed Polaroid Custom Level Rarities", "", "Custom rarities for Cursed Polaroids.");
			configCursedPolaroidMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("Polaroids", "Cursed Polaroid Min Value", 300, "Minimum value for Cursed Polaroid.");
			configCursedPolaroidMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("Polaroids", "Cursed Polaroid Max Value", 750, "Maximum value for Cursed Polaroid.");
			configCursedPolaroidSomethingChance = ((BaseUnityPlugin)this).Config.Bind<float>("Polaroids", "Cursed Polaroid Something Spawn Chance", 0.99f, "Chance of spawning somethiing on first player who picked up Cursed Polaroid.");
			configKeytarLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Keytar Rarities", "Keytar Level Rarities", "All: 10, Modded: 10", "Rarities for Keytar.");
			configKeytarCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Keytar Rarities", "Keytar Custom Level Rarities", "", "Custom rarities for Keytar.");
			configKeytarMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("Keytar", "Keytar Min Value", 10, "Minimum value for Keytar.");
			configKeytarMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("Keytar", "Keytar Max Value", 100, "Maximum value for Keytar.");
			configAubreyPlushLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("AubreyPlush Rarities", "AubreyPlush Level Rarities", "All: 20, Modded: 20", "Rarities for AubreyPlush.");
			configAubreyPlushCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("AubreyPlush Rarities", "AubreyPlush Custom Level Rarities", "", "Custom rarities for AubreyPlush.");
			configAubreyPlushMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("AubreyPlush", "AubreyPlush Min Value", 5, "Minimum value for AubreyPlush.");
			configAubreyPlushMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("AubreyPlush", "AubreyPlush Max Value", 50, "Maximum value for AubreyPlush.");
			configBasilPlushLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("BasilPlush Rarities", "BasilPlush Level Rarities", "All: 20, Modded: 20", "Rarities for BasilPlush.");
			configBasilPlushCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("BasilPlush Rarities", "BasilPlush Custom Level Rarities", "", "Custom rarities for BasilPlush.");
			configBasilPlushMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("BasilPlush", "BasilPlush Min Value", 5, "Minimum value for BasilPlush.");
			configBasilPlushMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("BasilPlush", "BasilPlush Max Value", 50, "Maximum value for BasilPlush.");
			configBunnybunLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Bunnybun Rarities", "Bunnybun Level Rarities", "All: 20, Modded: 20", "Rarities for Bunnybun.");
			configBunnybunCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Bunnybun Rarities", "Bunnybun Custom Level Rarities", "", "Custom rarities for Bunnybun.");
			configBunnybunMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("Bunnybun", "Bunnybun Min Value", 5, "Minimum value for Bunnybun.");
			configBunnybunMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("Bunnybun", "Bunnybun Max Value", 50, "Maximum value for Bunnybun.");
			configMailboxLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Mailbox Rarities", "Mailbox Level Rarities", "All: 15, Modded: 15", "Rarities for Mailbox.");
			configMailboxCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Mailbox Rarities", "Mailbox Custom Level Rarities", "", "Custom rarities for Mailbox.");
			configMailboxMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("Mailbox", "Mailbox Min Value", 15, "Minimum value for Mailbox.");
			configMailboxMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("Mailbox", "Mailbox Max Value", 150, "Maximum value for Mailbox.");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "something_assets"));
			if ((Object)(object)ModAssets == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			LoggerInstance.LogDebug((object)("Got AssetBundle at: " + Path.Combine(directoryName, "something_assets")));
			RegisterItem("GoodPolaroid", configGoodPolaroidMinValue, configGoodPolaroidMaxValue, configGoodPolaroidLevelRarities, configGoodPolaroidCustomLevelRarities);
			RegisterItem("BadPolaroid", configBadPolaroidMinValue, configBadPolaroidMaxValue, configBadPolaroidLevelRarities, configBadPolaroidCustomLevelRarities);
			RegisterItem("CursedPolaroid", configCursedPolaroidMinValue, configCursedPolaroidMaxValue, configCursedPolaroidLevelRarities, configCursedPolaroidCustomLevelRarities);
			RegisterItem("Keytar", configKeytarMinValue, configKeytarMaxValue, configKeytarLevelRarities, configKeytarCustomLevelRarities);
			RegisterItem("AubreyPlush", configAubreyPlushMinValue, configAubreyPlushMaxValue, configAubreyPlushLevelRarities, configAubreyPlushCustomLevelRarities);
			RegisterItem("BasilPlush", configBasilPlushMinValue, configBasilPlushMaxValue, configBasilPlushLevelRarities, configBasilPlushCustomLevelRarities);
			RegisterItem("Bunnybun", configBunnybunMinValue, configBunnybunMaxValue, configBunnybunLevelRarities, configBunnybunCustomLevelRarities);
			RegisterItem("Mailbox", configMailboxMinValue, configMailboxMaxValue, configMailboxLevelRarities, configMailboxCustomLevelRarities);
			EnemyType val = ModAssets.LoadAsset<EnemyType>("Assets/ModAssets/SomethingEnemy.asset");
			if ((Object)(object)val == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get Something enemy from assets");
				return;
			}
			LoggerInstance.LogDebug((object)"Got Something enemy prefab");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("Assets/ModAssets/Bestiary/SomethingTN.asset");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("Assets/ModAssets/Bestiary/SomethingTK.asset");
			LoggerInstance.LogDebug((object)"Registering enemy network prefab...");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			LoggerInstance.LogDebug((object)"Registering enemy...");
			Enemies.RegisterEnemy(val, GetLevelRarities(configSomethingLevelRarities.Value), GetCustomLevelRarities(configSomethingCustomLevelRarities.Value), val2, val3);
			EnemyType val4 = ModAssets.LoadAsset<EnemyType>("Assets/ModAssets/RabbitEnemy.asset");
			if ((Object)(object)val4 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get Rabbit enemy from assets");
				return;
			}
			LoggerInstance.LogDebug((object)"Got Rabbit enemy prefab");
			TerminalNode val5 = ModAssets.LoadAsset<TerminalNode>("Assets/ModAssets/Bestiary/RabbitTN.asset");
			TerminalKeyword val6 = ModAssets.LoadAsset<TerminalKeyword>("Assets/ModAssets/Bestiary/RabbitTK.asset");
			LoggerInstance.LogDebug((object)"Registering enemy network prefab...");
			NetworkPrefabs.RegisterNetworkPrefab(val4.enemyPrefab);
			LoggerInstance.LogDebug((object)"Registering enemy...");
			Enemies.RegisterEnemy(val4, GetLevelRarities(configRabbitLevelRarities.Value), GetCustomLevelRarities(configRabbitCustomLevelRarities.Value), val5, val6);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.Something v0.3.0 has loaded!");
		}

		private void RegisterItem(string itemName, ConfigEntry<int> minValue, ConfigEntry<int> maxValue, ConfigEntry<string> levelRarities, ConfigEntry<string> customLevelRarities)
		{
			Item val = ModAssets.LoadAsset<Item>("Assets/ModAssets/" + itemName + "Item.asset");
			if ((Object)(object)val == (Object)null)
			{
				LoggerInstance.LogError((object)("Error: Couldn't get " + itemName + "Item from assets"));
				return;
			}
			LoggerInstance.LogDebug((object)("Got " + itemName + " prefab"));
			val.minValue = minValue.Value;
			val.maxValue = maxValue.Value;
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			Items.RegisterScrap(val, GetLevelRarities(levelRarities.Value), GetCustomLevelRarities(customLevelRarities.Value));
		}

		public Dictionary<LevelTypes, int> GetLevelRarities(string levelsString)
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
				if (levelsString != null && levelsString != "")
				{
					string[] array = levelsString.Split(',');
					string[] array2 = array;
					foreach (string text in array2)
					{
						string[] array3 = text.Split(':');
						if (array3.Length == 2)
						{
							string text2 = array3[0].Trim();
							string text3 = array3[1].Trim();
							if (Enum.TryParse<LevelTypes>(text2, out LevelTypes result) && int.TryParse(text3, out var result2))
							{
								dictionary.Add(result, result2);
							}
							else
							{
								LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
							}
						}
					}
				}
				return dictionary;
			}
			catch (Exception arg)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)$"Error: {arg}");
				return null;
			}
		}

		public Dictionary<string, int> GetCustomLevelRarities(string levelsString)
		{
			try
			{
				Dictionary<string, int> dictionary = new Dictionary<string, int>();
				if (levelsString != null)
				{
					string[] array = levelsString.Split(',');
					string[] array2 = array;
					foreach (string text in array2)
					{
						string[] array3 = text.Split(':');
						if (array3.Length == 2)
						{
							string text2 = array3[0].Trim();
							string text3 = array3[1].Trim();
							if (int.TryParse(text3, out var result))
							{
								dictionary.Add(text2, result);
							}
							else
							{
								LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
							}
						}
					}
				}
				return dictionary;
			}
			catch (Exception arg)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)$"Error: {arg}");
				return null;
			}
		}

		public static void FreezePlayer(PlayerControllerB player, bool value)
		{
			player.disableInteract = value;
			player.disableLookInput = value;
			player.disableMoveInput = value;
		}

		public static void log(string msg)
		{
			if (configEnableDebugging.Value)
			{
				LoggerInstance.LogDebug((object)msg);
			}
		}

		private static void InitializeNetworkBehaviours()
		{
			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);
					}
				}
			}
			LoggerInstance.LogDebug((object)"Finished initializing network behaviours");
		}
	}
	internal class RabbitAI : EnemyAI
	{
		public enum State
		{
			Roaming
		}

		private static ManualLogSource logger = Plugin.LoggerInstance;

		public Transform turnCompass;

		public override void Start()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			Plugin.log("Rabbit spawned");
			((EnemyAI)this).Start();
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
		}

		public override void Update()
		{
			//IL_001d: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_007e: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			turnCompass.LookAt(((Component)Plugin.localPlayer.gameplayCamera).transform.position);
			((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 10f * Time.deltaTime);
			if (Plugin.localPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.25f, 80f, 5, 1f))
			{
				Plugin.localPlayer.JumpToFearLevel(1f, true);
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			//IL_002a: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if ((Object)(object)playerWhoHit != (Object)null && (Object)(object)playerWhoHit == (Object)(object)Plugin.localPlayer)
			{
				playerWhoHit.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 7, default(Vector3));
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "RabbitAI";
		}
	}
	internal class SomethingAI : EnemyAI
	{
		public enum State
		{
			Inactive,
			Chasing
		}

		private static ManualLogSource logger = Plugin.LoggerInstance;

		public Transform turnCompass;

		public GameObject[] lesserSomethingPrefabs;

		public GameObject littleOnePrefab;

		public AudioClip disappearSFX;

		public AudioClip[] ambientSFX;

		public AudioClip[] attackSFX;

		public SpriteRenderer somethingMesh;

		public GameObject ScanNode;

		public GameObject BreathingMechanicPrefab;

		private BreathingBehavior BreathingUI;

		private List<GameObject> SpawnedTinySomethings = new List<GameObject>();

		private bool enemyMeshEnabled;

		public static bool hauntingLocalPlayer;

		private float timeSinceSpawnLS;

		private float nextSpawnTimeLS;

		private float timeSinceStare;

		private float timeSinceChaseAttempt;

		private bool staring;

		private bool choosingNewPlayerToHaunt = true;

		private const float maxInsanity = 50f;

		private float lsMinSpawnTime = 10f;

		private float lsMaxSpawnTime = 30f;

		private float lsAmount = 0.1f;

		private float tsAmount = 0.5f;

		private float insanityPhase3 = 0.3f;

		private float stareCooldown = 20f;

		private float stareBufferTime = 5f;

		private float stareTime = 10f;

		private float insanityIncreaseOnLook = 10f;

		private float somethingChaseSpeed = 10f;

		private float chaseCooldown = 5f;

		private float insanityPhase1 = 0f;

		private float insanityPhase2 = 0.1f;

		public override void Start()
		{
			Plugin.log("Something spawned");
			((EnemyAI)this).Start();
			base.currentBehaviourStateIndex = 0;
			if (Plugin.IsServerOrHost)
			{
				choosingNewPlayerToHaunt = true;
				((MonoBehaviour)this).StartCoroutine(ChoosePlayerToHauntCoroutine(5f));
			}
		}

		public override void Update()
		{
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			if (Plugin.IsServerOrHost && (Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isPlayerControlled && !choosingNewPlayerToHaunt)
			{
				base.targetPlayer = null;
				choosingNewPlayerToHaunt = true;
				((MonoBehaviour)this).StartCoroutine(ChoosePlayerToHauntCoroutine(5f));
				return;
			}
			if (!((NetworkBehaviour)this).IsOwner)
			{
				if (enemyMeshEnabled)
				{
					((EnemyAI)this).EnableEnemyMesh(false, false);
				}
				return;
			}
			if ((Object)(object)base.targetPlayer != (Object)null && (Object)(object)Plugin.localPlayer != (Object)(object)base.targetPlayer)
			{
				((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
			}
			if (!((Object)(object)base.targetPlayer == (Object)null) && !base.targetPlayer.isPlayerDead && !base.targetPlayer.disconnectedMidGame && base.targetPlayer.isPlayerControlled && !base.inSpecialAnimation && !choosingNewPlayerToHaunt)
			{
				turnCompass.LookAt(((Component)Plugin.localPlayer.gameplayCamera).transform.position);
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 10f * Time.deltaTime);
				float num = base.targetPlayer.insanityLevel / 50f;
				base.targetPlayer.playersManager.fearLevel = Mathf.Max(base.targetPlayer.playersManager.fearLevel, num);
				timeSinceSpawnLS += Time.deltaTime;
				timeSinceStare += Time.deltaTime;
				timeSinceChaseAttempt += Time.deltaTime;
			}
		}

		public override void DoAIInterval()
		{
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (!((NetworkBehaviour)this).IsOwner || StartOfRound.Instance.allPlayersDead || (Object)(object)base.targetPlayer == (Object)null || base.targetPlayer.isPlayerDead || base.targetPlayer.disconnectedMidGame || !base.targetPlayer.isPlayerControlled || base.inSpecialAnimation || choosingNewPlayerToHaunt)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 0f;
				if (!base.targetPlayer.isInsideFactory)
				{
					break;
				}
				if (base.targetPlayer.insanityLevel >= 50f && timeSinceChaseAttempt > chaseCooldown)
				{
					timeSinceChaseAttempt = 0f;
					TryStartChase();
					break;
				}
				if (staring)
				{
					if (base.targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f))
					{
						PlayerControllerB targetPlayer = base.targetPlayer;
						targetPlayer.insanityLevel += insanityIncreaseOnLook;
						if (base.targetPlayer.insanityLevel >= 50f)
						{
							((EnemyAI)this).SwitchToBehaviourServerRpc(1);
							base.creatureVoice.Play();
							staring = false;
							timeSinceStare = 0f;
						}
						else
						{
							timeSinceStare = 0f;
							staring = false;
							base.creatureAnimator.SetTrigger("despawn");
							base.creatureSFX.PlayOneShot(disappearSFX);
						}
						break;
					}
				}
				else if (50f * insanityPhase3 <= base.targetPlayer.insanityLevel && timeSinceStare > stareCooldown)
				{
					Plugin.log("Attempting stare player");
					staring = true;
					StarePlayer();
				}
				if (timeSinceSpawnLS > nextSpawnTimeLS && 50f * insanityPhase1 <= base.targetPlayer.insanityLevel)
				{
					timeSinceSpawnLS = 0f;
					nextSpawnTimeLS = Random.Range(lsMinSpawnTime, lsMaxSpawnTime);
					SpawnLittleOnes(reset: false);
					if (50f * insanityPhase2 <= base.targetPlayer.insanityLevel)
					{
						SpawnLesserSomethings();
					}
				}
				break;
			case 1:
				base.agent.speed = somethingChaseSpeed;
				if (!base.targetPlayer.isPlayerAlone || !base.targetPlayer.isInsideFactory)
				{
					StopChase();
				}
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				break;
			default:
				logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex));
				break;
			}
		}

		private void TryStartChase()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			Plugin.log("Trying to start chase");
			base.targetNode = ChoosePositionInFrontOfPlayer(5f);
			if ((Object)(object)base.targetNode == (Object)null)
			{
				Plugin.log("targetNode is null!");
				return;
			}
			((MonoBehaviour)this).StartCoroutine(FreezePlayerCoroutine(3f));
			Teleport(base.targetNode.position);
			((EnemyAI)this).EnableEnemyMesh(true, false);
			staring = false;
			base.inSpecialAnimation = true;
			base.creatureAnimator.SetTrigger("spawn");
			((EnemyAI)this).SwitchToBehaviourServerRpc(1);
		}

		private void StopChase()
		{
			base.creatureVoice.Stop();
			((EnemyAI)this).EnableEnemyMesh(false, false);
			((EnemyAI)this).SwitchToBehaviourServerRpc(0);
		}

		private IEnumerator FreezePlayerCoroutine(float freezeTime)
		{
			Plugin.FreezePlayer(base.targetPlayer, value: true);
			yield return (object)new WaitForSeconds(freezeTime);
			Plugin.FreezePlayer(base.targetPlayer, value: false);
		}

		private void StarePlayer()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			base.targetNode = TryFindingHauntPosition();
			if ((Object)(object)base.targetNode == (Object)null)
			{
				Plugin.log("targetNode is null!");
				timeSinceStare = stareCooldown - stareBufferTime;
				staring = false;
			}
			else
			{
				Teleport(base.targetNode.position);
				((EnemyAI)this).EnableEnemyMesh(true, false);
				RoundManager.PlayRandomClip(base.creatureVoice, ambientSFX, true, 1f, 0, 1000);
				((MonoBehaviour)this).StartCoroutine(StopStareAfterDelay(stareTime));
			}
		}

		private IEnumerator StopStareAfterDelay(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if (enemyMeshEnabled && base.currentBehaviourStateIndex != 1)
			{
				((EnemyAI)this).EnableEnemyMesh(false, false);
				timeSinceStare = 0f;
				staring = false;
			}
		}

		private Transform? TryFindingHauntPosition(bool mustBeInLOS = true)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			if (base.targetPlayer.isInsideFactory)
			{
				for (int i = 0; i < base.allAINodes.Length; i++)
				{
					if ((!mustBeInLOS || !Physics.Linecast(((Component)base.targetPlayer.gameplayCamera).transform.position, base.allAINodes[i].transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) && !base.targetPlayer.HasLineOfSightToPosition(base.allAINodes[i].transform.position, 80f, 100, 8f))
					{
						Debug.DrawLine(((Component)base.targetPlayer.gameplayCamera).transform.position, base.allAINodes[i].transform.position, Color.green, 2f);
						Debug.Log((object)$"Player distance to haunt position: {Vector3.Distance(((Component)base.targetPlayer).transform.position, base.allAINodes[i].transform.position)}");
						return base.allAINodes[i].transform;
					}
				}
			}
			return null;
		}

		public Transform? ChoosePositionInFrontOfPlayer(float minDistance)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			Plugin.log("Choosing position in front of player");
			Transform result = null;
			Plugin.log(base.allAINodes.Count() + " ai nodes");
			GameObject[] allAINodes = base.allAINodes;
			foreach (GameObject val in allAINodes)
			{
				if (!((Object)(object)val == (Object)null))
				{
					Vector3 val2 = val.transform.position + Vector3.up * 0.5f;
					Vector3 position = ((Component)base.targetPlayer.gameplayCamera).transform.position;
					float num = Vector3.Distance(position, val2);
					if (!(num < minDistance) && !Physics.Linecast(val2, position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && base.targetPlayer.HasLineOfSightToPosition(val2, 45f, 60, -1f))
					{
						base.mostOptimalDistance = num;
						result = val.transform;
					}
				}
			}
			Plugin.log($"null: {(Object)(object)base.targetNode == (Object)null}");
			return result;
		}

		public override void EnableEnemyMesh(bool enable, bool overrideDoNotSet = false)
		{
			Plugin.log($"EnableEnemyMesh({enable})");
			((Renderer)somethingMesh).enabled = enable;
			ScanNode.SetActive(enable);
			enemyMeshEnabled = enable;
		}

		private Vector3 FindPositionOutOfLOS()
		{
			//IL_000e: 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)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			base.targetNode = ((EnemyAI)this).ChooseClosestNodeToPosition(((Component)base.targetPlayer).transform.position, true, 0);
			return RoundManager.Instance.GetNavMeshPosition(base.targetNode.position, default(NavMeshHit), 5f, -1);
		}

		private IEnumerator ChoosePlayerToHauntCoroutine(float delay)
		{
			choosingNewPlayerToHaunt = true;
			Plugin.log($"choosing player to haunt in {delay} seconds");
			yield return (object)new WaitForSeconds(delay);
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				ChoosePlayerToHaunt();
			}
			choosingNewPlayerToHaunt = false;
		}

		private void ChoosePlayerToHaunt()
		{
			if (StartOfRound.Instance.inShipPhase || StartOfRound.Instance.shipIsLeaving)
			{
				return;
			}
			Plugin.log("starting ChoosePlayerToHaunt()");
			float num = 0f;
			float num2 = 0f;
			int num3 = 0;
			int num4 = 0;
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				if (StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount > num3)
				{
					num3 = StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount;
					num4 = i;
				}
				if (StartOfRound.Instance.allPlayerScripts[i].insanityLevel > num)
				{
					num = StartOfRound.Instance.allPlayerScripts[i].insanityLevel;
					num2 = i;
				}
			}
			int[] array = new int[StartOfRound.Instance.allPlayerScripts.Length];
			for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++)
			{
				if (!StartOfRound.Instance.allPlayerScripts[j].isPlayerControlled)
				{
					array[j] = 0;
					Plugin.log($"{StartOfRound.Instance.allPlayerScripts[j].playerUsername}: {array[j]}");
					continue;
				}
				array[j] += 80;
				if (num2 == (float)j && num > 1f)
				{
					array[j] += 50;
				}
				if (num4 == j)
				{
					array[j] += 30;
				}
				if (!StartOfRound.Instance.allPlayerScripts[j].hasBeenCriticallyInjured)
				{
					array[j] += 10;
				}
				if ((Object)(object)StartOfRound.Instance.allPlayerScripts[j].currentlyHeldObjectServer != (Object)null && StartOfRound.Instance.allPlayerScripts[j].currentlyHeldObjectServer.scrapValue > 150)
				{
					array[j] += 30;
				}
				Plugin.log($"{StartOfRound.Instance.allPlayerScripts[j].playerUsername}: {array[j]}");
			}
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[RoundManager.Instance.GetRandomWeightedIndex(array, (Random)null)];
			if (val.isPlayerDead)
			{
				for (int k = 0; k < StartOfRound.Instance.allPlayerScripts.Length; k++)
				{
					if (!StartOfRound.Instance.allPlayerScripts[k].isPlayerDead)
					{
						val = StartOfRound.Instance.allPlayerScripts[k];
						break;
					}
				}
			}
			logger.LogDebug((object)$"Something: Haunting player with playerClientId: {val.playerClientId}; actualClientId: {val.actualClientId}");
			base.targetPlayer = val;
			ChangeTargetPlayerClientRpc(val.actualClientId);
		}

		public void Teleport(Vector3 position)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			Plugin.log("Teleporting to " + ((object)(Vector3)(ref position)).ToString());
			position = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 5f, -1);
			base.agent.Warp(position);
		}

		private void SpawnLesserSomethings()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			int num2 = (int)((float)base.allAINodes.Length * lsAmount);
			List<GameObject> list = base.allAINodes.ToList();
			for (int i = 0; i < num2; i++)
			{
				if (list.Count <= 0)
				{
					break;
				}
				GameObject randomAINode = GetRandomAINode(list);
				list.Remove(randomAINode);
				if ((Object)(object)randomAINode == (Object)null || base.targetPlayer.HasLineOfSightToPosition(randomAINode.transform.position, 45f, 60, -1f))
				{
					i--;
					continue;
				}
				int num3 = Random.Range(0, lesserSomethingPrefabs.Length);
				Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(randomAINode.transform.position, 10f, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1);
				LesserSomethingAI component = Object.Instantiate<GameObject>(lesserSomethingPrefabs[num3], randomNavMeshPositionInBoxPredictable, Quaternion.identity).GetComponent<LesserSomethingAI>();
				component.spawnNode = randomAINode.transform;
				component.targetPlayer = base.targetPlayer;
				component.destroyTime = nextSpawnTimeLS;
				component.init = true;
				num++;
			}
			Plugin.log($"Spawned {num}/{base.allAINodes.Length} lesser_somethings which will self destruct in {nextSpawnTimeLS} seconds");
		}

		private void SpawnLittleOnes(bool reset)
		{
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			if (SpawnedTinySomethings.Count > 0)
			{
				foreach (GameObject item in SpawnedTinySomethings.ToList())
				{
					if ((Object)(object)item == (Object)null)
					{
						SpawnedTinySomethings.Remove(item);
					}
					else if (reset || !base.targetPlayer.HasLineOfSightToPosition(item.transform.position, 45f, 60, -1f))
					{
						SpawnedTinySomethings.Remove(item);
						Object.Destroy((Object)(object)item);
					}
				}
				if (reset)
				{
					SpawnedTinySomethings.Clear();
				}
			}
			if (!hauntingLocalPlayer)
			{
				return;
			}
			int num = (int)((float)base.allAINodes.Length * tsAmount);
			List<GameObject> list = base.allAINodes.ToList();
			for (int i = 0; i < num; i++)
			{
				GameObject randomAINode = GetRandomAINode(list);
				list.Remove(randomAINode);
				if ((Object)(object)randomAINode == (Object)null || base.targetPlayer.HasLineOfSightToPosition(randomAINode.transform.position, 45f, 60, -1f))
				{
					i--;
					continue;
				}
				Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(randomAINode.transform.position, 10f, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1);
				SpawnedTinySomethings.Add(Object.Instantiate<GameObject>(littleOnePrefab, randomNavMeshPositionInBoxPredictable, Quaternion.identity));
			}
		}

		private GameObject GetRandomAINode(List<GameObject> nodes)
		{
			int index = Random.Range(0, nodes.Count);
			return nodes[index];
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			PlayerControllerB val = default(PlayerControllerB);
			if (!base.inSpecialAnimation && base.currentBehaviourStateIndex != 0 && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)Plugin.localPlayer))
			{
				base.inSpecialAnimation = true;
				((MonoBehaviour)this).StartCoroutine(KillPlayerCoroutine());
			}
		}

		private IEnumerator KillPlayerCoroutine()
		{
			Plugin.log("In KillPlayerCoroutine()");
			yield return null;
			((MonoBehaviour)this).StartCoroutine(FreezePlayerCoroutine(3f));
			((EnemyAI)this).EnableEnemyMesh(false, false);
			base.creatureVoice.Stop();
			RoundManager.PlayRandomClip(base.targetPlayer.movementAudio, attackSFX, true, 1f, 0, 1000);
			BreathingUI.JumpscarePlayer(3f);
			yield return (object)new WaitForSeconds(3f);
			Plugin.localPlayer.KillPlayer(Vector3.zero, false, (CauseOfDeath)0, 0, default(Vector3));
			PlayDisappearSFXClientRpc();
		}

		private void ResetHallucinations()
		{
			Plugin.log("Destroying little ones");
			foreach (GameObject item in SpawnedTinySomethings.ToList())
			{
				Object.Destroy((Object)(object)item);
			}
			Plugin.log("Destroying breathing UI");
			if ((Object)(object)BreathingUI != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)BreathingUI).gameObject);
			}
			((EnemyAI)this).EnableEnemyMesh(false, false);
			base.creatureVoice.Stop();
		}

		public override void OnDestroy()
		{
			ResetHallucinations();
			((EnemyAI)this).OnDestroy();
		}

		public void EndSpawnAnimation()
		{
			Plugin.log("In EndSpawnAnimation()");
			base.inSpecialAnimation = false;
			base.creatureVoice.Play();
			Plugin.FreezePlayer(base.targetPlayer, value: false);
		}

		public void EndDespawnAnimation()
		{
			Plugin.log("In EndDespawnAnimation");
			base.creatureVoice.Stop();
			base.inSpecialAnimation = false;
			((EnemyAI)this).EnableEnemyMesh(false, false);
		}

		[ClientRpc]
		public void ChangeTargetPlayerClientRpc(ulong clientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2558234219u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2558234219u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				ResetHallucinations();
				PlayerControllerB val3 = Plugin.PlayerFromId(clientId);
				val3.insanityLevel = 0f;
				base.targetPlayer = val3;
				Plugin.log($"Something: Haunting player with playerClientId: {base.targetPlayer.playerClientId}; actualClientId: {base.targetPlayer.actualClientId}");
				((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
				hauntingLocalPlayer = (Object)(object)Plugin.localPlayer == (Object)(object)base.targetPlayer;
				if (Plugin.IsServerOrHost)
				{
					((NetworkBehaviour)this).NetworkObject.ChangeOwnership(base.targetPlayer.actualClientId);
				}
				SpawnLittleOnes(reset: true);
				if (hauntingLocalPlayer)
				{
					BreathingUI = Object.Instantiate<GameObject>(BreathingMechanicPrefab).GetComponent<BreathingBehavior>();
					choosingNewPlayerToHaunt = false;
				}
			}
		}

		[ClientRpc]
		public void PlayDisappearSFXClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(218996551u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 218996551u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.creatureVoice.PlayOneShot(disappearSFX, 1f);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SomethingAI()
		{
			//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(2558234219u, new RpcReceiveHandler(__rpc_handler_2558234219));
			NetworkManager.__rpc_func_table.Add(218996551u, new RpcReceiveHandler(__rpc_handler_218996551));
		}

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

		private static void __rpc_handler_218996551(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SomethingAI)(object)target).PlayDisappearSFXClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SomethingAI";
		}
	}
	internal class SomethingInputs : LcInputActions
	{
		public static SomethingInputs Instance;

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction BreathKey { get; set; }

		public static void Init()
		{
			Instance = new SomethingInputs();
		}
	}
	internal class TinySomethingAI : MonoBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public Transform turnCompass;

		public AudioSource creatureSFX;

		public void Update()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			turnCompass.LookAt(((Component)Plugin.localPlayer.gameplayCamera).transform.position);
			((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 10f * Time.deltaTime);
		}

		public void OnTriggerEnter(Collider other)
		{
			PlayerControllerB val = default(PlayerControllerB);
			if (((Component)other).CompareTag("Player") && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)val != (Object)(object)Plugin.localPlayer))
			{
				Plugin.log("Player stepped on little one");
				PlayerControllerB localPlayer = Plugin.localPlayer;
				localPlayer.insanityLevel += 1f;
				creatureSFX.Play();
				Object.Destroy((Object)(object)((Component)this).gameObject, 0.5f);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Snowlance.Something";

		public const string PLUGIN_NAME = "Something";

		public const string PLUGIN_VERSION = "0.3.0";
	}
}
namespace Something.Patches
{
	[HarmonyPatch]
	internal class SanityPatches
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerControllerB), "NearOtherPlayers")]
		public static bool NearOtherPlayersPrefix(PlayerControllerB __instance, ref bool __result)
		{
			try
			{
				if (IsPlayerHaunted(__instance))
				{
					__result = false;
					return false;
				}
				return true;
			}
			catch
			{
				return true;
			}
		}

		public static bool IsPlayerHaunted(PlayerControllerB player)
		{
			if (StartOfRound.Instance.inShipPhase)
			{
				return false;
			}
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				if (spawnedEnemy is SomethingAI && (Object)(object)spawnedEnemy.targetPlayer == (Object)(object)player)
				{
					return true;
				}
			}
			return false;
		}
	}
}
namespace Something.Items
{
	internal class BunnyBunBehavior : PhysicsProp
	{
		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "BunnyBunBehavior";
		}
	}
	internal class KeytarBehavior : PhysicsProp
	{
		public AudioSource ItemAudio;

		public AudioClip[] songs;

		private PlayerControllerB previousPlayerHeldBy;

		private int songIndex;

		public override void EquipItem()
		{
			((PhysicsProp)this).EquipItem();
			previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
		}

		public override void DiscardItem()
		{
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
			((GrabbableObject)this).DiscardItem();
		}

		public override void PocketItem()
		{
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
			((GrabbableObject)this).PocketItem();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown)
			{
				ItemAudio.Stop();
				ItemAudio.clip = songs[songIndex];
				ItemAudio.Play();
				if (songIndex >= songs.Length - 1)
				{
					songIndex = 0;
				}
				else
				{
					songIndex++;
				}
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "KeytarBehavior";
		}
	}
	internal class SweetheartsMorgenshternBehavior : PhysicsProp
	{
		protected override void __initializeVariables()
		{
			((PhysicsProp)this).__initializeVariables();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SweetheartsMorgenshternBehavior";
		}
	}
}
namespace Something.Items.Polaroids
{
	public class BadPolaroidBehavior : PhysicsProp
	{
		public AudioSource ItemAudio;

		public GameObject SomethingPrefab;

		public SpriteRenderer renderer;

		public Sprite[] Photos;

		public Sprite[] AltPhotos;

		private int photoIndex;

		private bool wasHeld;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (Plugin.IsServerOrHost)
			{
				if (photoIndex == -1)
				{
					photoIndex = (Plugin.configSpoilerFreeVersion.Value ? Random.Range(0, AltPhotos.Length) : Random.Range(0, Photos.Length));
				}
				ChangeSpriteClientRpc(photoIndex, Plugin.configSpoilerFreeVersion.Value);
			}
		}

		public override void EquipItem()
		{
			if (Plugin.IsServerOrHost && !wasHeld && Random.Range(0f, 1f) < Plugin.configBadPolaroidSomethingChance.Value)
			{
				SpawnSomething(((GrabbableObject)this).playerHeldBy);
				ItemAudio.Play();
			}
			wasHeld = true;
			((PhysicsProp)this).EquipItem();
		}

		public void SpawnSomething(PlayerControllerB playerToHaunt)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.IsServerOrHost && !StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipIsLeaving)
			{
				SomethingAI component = Object.Instantiate<GameObject>(SomethingPrefab, Vector3.zero, Quaternion.identity).GetComponent<SomethingAI>();
				((NetworkBehaviour)component).NetworkObject.Spawn(true);
				RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)component);
				component.ChangeTargetPlayerClientRpc(playerToHaunt.actualClientId);
				PlaySomethingSFXClientRpc();
			}
		}

		public override void EnableItemMeshes(bool enable)
		{
			((GrabbableObject)this).EnableItemMeshes(enable);
			((Renderer)renderer).enabled = enable;
		}

		public override void LoadItemSaveData(int saveData)
		{
			photoIndex = saveData;
			wasHeld = true;
		}

		public override int GetItemDataToSave()
		{
			return photoIndex;
		}

		[ClientRpc]
		public void ChangeSpriteClientRpc(int index, bool spoilerFree)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1817773175u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref spoilerFree, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1817773175u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					renderer.sprite = (spoilerFree ? AltPhotos[index] : Photos[index]);
					photoIndex = index;
				}
			}
		}

		[ClientRpc]
		public void PlaySomethingSFXClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2051805452u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2051805452u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					ItemAudio.Play();
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_BadPolaroidBehavior()
		{
			//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(1817773175u, new RpcReceiveHandler(__rpc_handler_1817773175));
			NetworkManager.__rpc_func_table.Add(2051805452u, new RpcReceiveHandler(__rpc_handler_2051805452));
		}

		private static void __rpc_handler_1817773175(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				bool spoilerFree = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref spoilerFree, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BadPolaroidBehavior)(object)target).ChangeSpriteClientRpc(index, spoilerFree);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2051805452(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BadPolaroidBehavior)(object)target).PlaySomethingSFXClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "BadPolaroidBehavior";
		}
	}
	public class CursedPolaroidBehavior : PhysicsProp
	{
		public AudioSource ItemAudio;

		public AudioClip SomethingSFX;

		public Animator ItemAnimator;

		public GameObject SomethingPrefab;

		public SpriteRenderer renderer;

		private bool wasHeld;

		public PlayerControllerB? cursedPlayer;

		public override void EquipItem()
		{
			Plugin.LoggerInstance.LogDebug((object)("Item held: " + wasHeld));
			if (Plugin.IsServerOrHost && !wasHeld && Random.Range(0f, 1f) < Plugin.configCursedPolaroidSomethingChance.Value)
			{
				cursedPlayer = ((GrabbableObject)this).playerHeldBy;
				SpawnSomething(((GrabbableObject)this).playerHeldBy, !Plugin.configSpoilerFreeVersion.Value);
			}
			wasHeld = true;
			((PhysicsProp)this).EquipItem();
		}

		public override void LoadItemSaveData(int saveData)
		{
			wasHeld = true;
		}

		public override void EnableItemMeshes(bool enable)
		{
			((GrabbableObject)this).EnableItemMeshes(enable);
			((Renderer)renderer).enabled = enable;
		}

		public void SpawnSomething(PlayerControllerB playerToHaunt, bool playAnim)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.IsServerOrHost && !StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipIsLeaving)
			{
				SomethingAI component = Object.Instantiate<GameObject>(SomethingPrefab, Vector3.zero, Quaternion.identity).GetComponent<SomethingAI>();
				((NetworkBehaviour)component).NetworkObject.Spawn(true);
				RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)component);
				component.ChangeTargetPlayerClientRpc(playerToHaunt.actualClientId);
				if (playAnim)
				{
					DoAnimationClientRpc("play");
				}
			}
		}

		[ClientRpc]
		public void DoAnimationClientRpc(string animationName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1142550889u, val, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1142550889u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				ItemAnimator.SetTrigger(animationName);
				ItemAudio.Play();
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_CursedPolaroidBehavior()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1142550889u, new RpcReceiveHandler(__rpc_handler_1142550889));
		}

		private static void __rpc_handler_1142550889(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string animationName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CursedPolaroidBehavior)(object)target).DoAnimationClientRpc(animationName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CursedPolaroidBehavior";
		}
	}
	[HarmonyPatch]
	public class CursedPolaroidPatches
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")]
		public static void OnShipLandedMiscEventsPostfix()
		{
			try
			{
				if (!Plugin.IsServerOrHost)
				{
					return;
				}
				CursedPolaroidBehavior[] array = Object.FindObjectsOfType<CursedPolaroidBehavior>();
				foreach (CursedPolaroidBehavior cursedPolaroidBehavior in array)
				{
					if (!((Object)(object)cursedPolaroidBehavior.cursedPlayer == (Object)null))
					{
						cursedPolaroidBehavior.SpawnSomething(cursedPolaroidBehavior.cursedPlayer, playAnim: false);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.LoggerInstance.LogError((object)ex);
			}
		}
	}
	public class GoodPolaroidBehavior : PhysicsProp
	{
		public GameObject SomethingPrefab;

		public SpriteRenderer renderer;

		public Sprite[] Photos;

		public Sprite[] AltPhotos;

		private int photoIndex = -1;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (Plugin.IsServerOrHost)
			{
				if (photoIndex == -1)
				{
					photoIndex = (Plugin.configSpoilerFreeVersion.Value ? Random.Range(0, AltPhotos.Length) : Random.Range(0, Photos.Length));
				}
				ChangeSpriteClientRpc(photoIndex, Plugin.configSpoilerFreeVersion.Value);
			}
		}

		public override void EnableItemMeshes(bool enable)
		{
			((GrabbableObject)this).EnableItemMeshes(enable);
			((Renderer)renderer).enabled = enable;
		}

		public override void LoadItemSaveData(int saveData)
		{
			photoIndex = saveData;
		}

		public override int GetItemDataToSave()
		{
			return photoIndex;
		}

		[ClientRpc]
		public void ChangeSpriteClientRpc(int index, bool spoilerFree)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2546241137u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref spoilerFree, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2546241137u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					photoIndex = index;
					Plugin.log($"Changing sprite to {photoIndex}: {((Object)Photos[photoIndex]).name}");
					renderer.sprite = (spoilerFree ? AltPhotos[photoIndex] : Photos[photoIndex]);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_GoodPolaroidBehavior()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2546241137u, new RpcReceiveHandler(__rpc_handler_2546241137));
		}

		private static void __rpc_handler_2546241137(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				bool spoilerFree = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref spoilerFree, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((GoodPolaroidBehavior)(object)target).ChangeSpriteClientRpc(index, spoilerFree);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "GoodPolaroidBehavior";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace Snowlance.Something.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}