Decompiled source of SCP956 v1.0.0

SCP956.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using SCP956.NetcodePatcher;
using SCP956.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UIElements;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SCP956")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d187908809e4d72a13a4fe3c032e2eb8bb497b7e")]
[assembly: AssemblyProduct("SCP956")]
[assembly: AssemblyTitle("SCP956")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 SCP956
{
	internal class CakeBehavior : PhysicsProp
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown)
			{
				logger.LogDebug((object)"Eating cake");
				HUDManager.Instance.UIAudio.PlayOneShot(Plugin.EatCakesfx, 1f);
				StatusEffectController.Instance.HealPlayer(Plugin.config559HealAmount.Value);
				((GrabbableObject)this).playerHeldBy.DespawnHeldObject();
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CakeBehavior";
		}
	}
	internal class CandyBagBehavior : PhysicsProp
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public Dictionary<string, List<bool>> CandyBag = new Dictionary<string, List<bool>>
		{
			{
				"Blue Candy",
				new List<bool>()
			},
			{
				"Green Candy",
				new List<bool>()
			},
			{
				"Pink Candy",
				new List<bool>()
			},
			{
				"Purple Candy",
				new List<bool>()
			},
			{
				"Rainbow Candy",
				new List<bool>()
			},
			{
				"Red Candy",
				new List<bool>()
			},
			{
				"Yellow Candy",
				new List<bool>()
			},
			{
				"Black Candy",
				new List<bool>()
			}
		};

		private PlayerControllerB localPlayer => StartOfRound.Instance.localPlayerController;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0035: 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)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown)
			{
				CandyBagUIController component = ((Component)this).GetComponent<CandyBagUIController>();
				logger.LogDebug((object)"Got uiController");
				_ = component.veMain.style.display;
				if (false)
				{
					logger.LogDebug((object)"veMain.style.display is null");
				}
				else if (component.veMain.style.display == StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1))
				{
					logger.LogDebug((object)"Showing UI");
					component.ShowUI(CandyBag);
				}
			}
		}

		public void CandySelected(string candyName, bool right)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			if (right)
			{
				logger.LogDebug((object)"Taking candy out of bag");
				bool pinataCandy = CandyBag[candyName].Last();
				CandyBag[candyName].Remove(CandyBag[candyName].Last());
				NetworkHandler.Instance.SpawnItemServerRpc(localPlayer.actualClientId, candyName, 0, ((Component)localPlayer).transform.position, Quaternion.identity, grabItem: true, pinataCandy);
			}
			else
			{
				logger.LogDebug((object)"Eating candy from bag");
				bool pinataCandy2 = CandyBag[candyName].Last();
				CandyBag[candyName].Remove(CandyBag[candyName].Last());
				CandyBehavior.ActivateCandy(candyName, pinataCandy2);
			}
			if (!CandyBag.Where<KeyValuePair<string, List<bool>>>((KeyValuePair<string, List<bool>> x) => x.Value.Count() > 0).Any())
			{
				logger.LogDebug((object)"Candy bag empty");
				((GrabbableObject)this).playerHeldBy.DespawnHeldObject();
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CandyBagBehavior";
		}
	}
	public class CandyBagUIController : MonoBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public static CandyBagUIController Instance;

		public VisualElement veMain;

		public Button btnBlue;

		public Button btnGreen;

		public Button btnPink;

		public Button btnPurple;

		public Button btnRainbow;

		public Button btnRed;

		public Button btnYellow;

		public Button btnBlack;

		private void Start()
		{
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			logger.LogDebug((object)"UIController: Start()");
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger.LogDebug((object)"Getting UIDocument");
			UIDocument component = ((Component)this).GetComponent<UIDocument>();
			if ((Object)(object)component == (Object)null)
			{
				logger.LogError((object)"uiDocument not found.");
				return;
			}
			logger.LogDebug((object)"Getting visual tree asset");
			if ((Object)(object)component.visualTreeAsset == (Object)null)
			{
				logger.LogError((object)"visualTreeAsset not found.");
				return;
			}
			VisualElement val = (VisualElement)(object)component.visualTreeAsset.Instantiate();
			if (val == null)
			{
				logger.LogError((object)"root is null!");
				return;
			}
			logger.LogDebug((object)"Adding root");
			component.rootVisualElement.Add(val);
			if (component.rootVisualElement == null)
			{
				logger.LogError((object)"uiDocument.rootVisualElement not found.");
				return;
			}
			logger.LogDebug((object)"Got root");
			val = component.rootVisualElement;
			veMain = UQueryExtensions.Q<VisualElement>(component.rootVisualElement, "veMain", (string)null);
			veMain.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1);
			if (veMain == null)
			{
				logger.LogError((object)"veMain not found.");
				return;
			}
			btnBlue = UQueryExtensions.Q<Button>(val, "btnBlue", (string)null);
			if (btnBlue == null)
			{
				logger.LogError((object)"btnBlue not found.");
				return;
			}
			btnGreen = UQueryExtensions.Q<Button>(val, "btnGreen", (string)null);
			if (btnGreen == null)
			{
				logger.LogError((object)"btnGreen not found.");
				return;
			}
			btnPink = UQueryExtensions.Q<Button>(val, "btnPink", (string)null);
			if (btnPink == null)
			{
				logger.LogError((object)"btnPink not found.");
				return;
			}
			btnPurple = UQueryExtensions.Q<Button>(val, "btnPurple", (string)null);
			if (btnPurple == null)
			{
				logger.LogError((object)"btnPurple not found.");
				return;
			}
			btnRainbow = UQueryExtensions.Q<Button>(val, "btnRainbow", (string)null);
			if (btnRainbow == null)
			{
				logger.LogError((object)"btnRainbow not found.");
				return;
			}
			btnRed = UQueryExtensions.Q<Button>(val, "btnRed", (string)null);
			if (btnRed == null)
			{
				logger.LogError((object)"btnRed not found.");
				return;
			}
			btnYellow = UQueryExtensions.Q<Button>(val, "btnYellow", (string)null);
			if (btnYellow == null)
			{
				logger.LogError((object)"btnYellow not found.");
				return;
			}
			btnBlack = UQueryExtensions.Q<Button>(val, "btnBlack", (string)null);
			if (btnBlack == null)
			{
				logger.LogError((object)"btnBlack not found.");
				return;
			}
			logger.LogDebug((object)"Got Controls for UI");
			btnBlue.clickable.clicked += delegate
			{
				ButtonClicked("Blue Candy", Convert.ToInt32(((TextElement)btnBlue).text));
			};
			btnGreen.clickable.clicked += delegate
			{
				ButtonClicked("Green Candy", Convert.ToInt32(((TextElement)btnGreen).text));
			};
			btnPink.clickable.clicked += delegate
			{
				ButtonClicked("Pink Candy", Convert.ToInt32(((TextElement)btnPink).text));
			};
			btnPurple.clickable.clicked += delegate
			{
				ButtonClicked("Purple Candy", Convert.ToInt32(((TextElement)btnPurple).text));
			};
			btnRainbow.clickable.clicked += delegate
			{
				ButtonClicked("Rainbow Candy", Convert.ToInt32(((TextElement)btnRainbow).text));
			};
			btnRed.clickable.clicked += delegate
			{
				ButtonClicked("Red Candy", Convert.ToInt32(((TextElement)btnRed).text));
			};
			btnYellow.clickable.clicked += delegate
			{
				ButtonClicked("Yellow Candy", Convert.ToInt32(((TextElement)btnYellow).text));
			};
			btnBlack.clickable.clicked += delegate
			{
				ButtonClicked("Black Candy", Convert.ToInt32(((TextElement)btnBlack).text));
			};
			((CallbackEventHandler)btnBlue).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent evt)
			{
				if (((PointerEventBase<PointerDownEvent>)(object)evt).button == 1)
				{
					ButtonRightClicked("Blue Candy", Convert.ToInt32(((TextElement)btnBlue).text));
				}
			}, (TrickleDown)0);
			((CallbackEventHandler)btnGreen).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent evt)
			{
				if (((PointerEventBase<PointerDownEvent>)(object)evt).button == 1)
				{
					ButtonRightClicked("Green Candy", Convert.ToInt32(((TextElement)btnGreen).text));
				}
			}, (TrickleDown)0);
			((CallbackEventHandler)btnPink).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent evt)
			{
				if (((PointerEventBase<PointerDownEvent>)(object)evt).button == 1)
				{
					ButtonRightClicked("Pink Candy", Convert.ToInt32(((TextElement)btnPink).text));
				}
			}, (TrickleDown)0);
			((CallbackEventHandler)btnPurple).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent evt)
			{
				if (((PointerEventBase<PointerDownEvent>)(object)evt).button == 1)
				{
					ButtonRightClicked("Purple Candy", Convert.ToInt32(((TextElement)btnPurple).text));
				}
			}, (TrickleDown)0);
			((CallbackEventHandler)btnRainbow).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent evt)
			{
				if (((PointerEventBase<PointerDownEvent>)(object)evt).button == 1)
				{
					ButtonRightClicked("Rainbow Candy", Convert.ToInt32(((TextElement)btnRainbow).text));
				}
			}, (TrickleDown)0);
			((CallbackEventHandler)btnRed).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent evt)
			{
				if (((PointerEventBase<PointerDownEvent>)(object)evt).button == 1)
				{
					ButtonRightClicked("Red Candy", Convert.ToInt32(((TextElement)btnRed).text));
				}
			}, (TrickleDown)0);
			((CallbackEventHandler)btnYellow).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent evt)
			{
				if (((PointerEventBase<PointerDownEvent>)(object)evt).button == 1)
				{
					ButtonRightClicked("Yellow Candy", Convert.ToInt32(((TextElement)btnYellow).text));
				}
			}, (TrickleDown)0);
			((CallbackEventHandler)btnBlack).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent evt)
			{
				if (((PointerEventBase<PointerDownEvent>)(object)evt).button == 1)
				{
					ButtonRightClicked("Black Candy", Convert.ToInt32(((TextElement)btnBlack).text));
				}
			}, (TrickleDown)0);
			logger.LogDebug((object)"UIControllerScript: Start() complete");
		}

		private void Update()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (veMain.style.display == StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)0) && (((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame || ((ButtonControl)Keyboard.current.tabKey).wasPressedThisFrame))
			{
				HideUI();
			}
		}

		public void ShowUI(Dictionary<string, List<bool>> CandyBag)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			logger.LogDebug((object)"Showing UI");
			veMain.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)0);
			((TextElement)btnBlue).text = CandyBag["Blue Candy"].Count.ToString();
			((TextElement)btnGreen).text = CandyBag["Green Candy"].Count.ToString();
			((TextElement)btnPink).text = CandyBag["Pink Candy"].Count.ToString();
			((TextElement)btnPurple).text = CandyBag["Purple Candy"].Count.ToString();
			((TextElement)btnRainbow).text = CandyBag["Rainbow Candy"].Count.ToString();
			((TextElement)btnRed).text = CandyBag["Red Candy"].Count.ToString();
			((TextElement)btnYellow).text = CandyBag["Yellow Candy"].Count.ToString();
			((TextElement)btnBlack).text = CandyBag["Black Candy"].Count.ToString();
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
			IngamePlayerSettings.Instance.playerInput.DeactivateInput();
			StartOfRound.Instance.localPlayerController.disableLookInput = true;
		}

		public void HideUI()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			logger.LogDebug((object)"Hiding UI");
			veMain.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1);
			Cursor.lockState = (CursorLockMode)1;
			Cursor.visible = false;
			IngamePlayerSettings.Instance.playerInput.ActivateInput();
			StartOfRound.Instance.localPlayerController.disableLookInput = false;
		}

		private void ButtonClicked(string candyName, int amount)
		{
			logger.LogDebug((object)"Button clicked");
			if (amount > 0)
			{
				((Component)this).GetComponent<CandyBagBehavior>().CandySelected(candyName, right: false);
				HideUI();
			}
		}

		private void ButtonRightClicked(string candyName, int amount)
		{
			logger.LogDebug((object)"Button right clicked");
			if (amount > 0)
			{
				((Component)this).GetComponent<CandyBagBehavior>().CandySelected(candyName, right: true);
				HideUI();
			}
		}
	}
	public class CandyBehavior : PhysicsProp
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public bool pinataCandy = true;

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

		public override void EquipItem()
		{
			((PhysicsProp)this).EquipItem();
			if (Plugin.configEnableCandyBag.Value)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true;
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if (Plugin.configEnableCandyBag.Value)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			}
		}

		public override void ItemInteractLeftRight(bool right)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (!right && Plugin.configEnableCandyBag.Value)
			{
				logger.LogDebug((object)"Putting candy in bag");
				((GrabbableObject)this).playerHeldBy.DespawnHeldObject();
				if ((Object)(object)((GrabbableObject)this).playerHeldBy.ItemSlots.Where((GrabbableObject x) => (Object)(object)x != (Object)null && ((Object)x.itemProperties).name == "BagOfCandyItem").FirstOrDefault() == (Object)null)
				{
					NetworkHandler.Instance.SpawnItemServerRpc(((GrabbableObject)this).playerHeldBy.actualClientId, "Candy Bag", 0, ((Component)((GrabbableObject)this).playerHeldBy).transform.position, Quaternion.identity, grabItem: true);
				}
				GrabbableObject val = ((GrabbableObject)this).playerHeldBy.ItemSlots.Where((GrabbableObject x) => (Object)(object)x != (Object)null && ((Object)x.itemProperties).name == "BagOfCandyItem").FirstOrDefault();
				if ((Object)(object)val == (Object)null)
				{
					logger.LogError((object)"Candy bag not found");
					return;
				}
				CandyBagBehavior component = ((Component)val).gameObject.GetComponent<CandyBagBehavior>();
				component.CandyBag[((GrabbableObject)this).itemProperties.itemName].Add(pinataCandy);
			}
		}

		public override void GrabItem()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).GrabItem();
			if (Plugin.configSecretLab.Value && StartOfRound.Instance.localPlayerController.isInsideFactory && (Object)(object)RoundManager.Instance.SpawnedEnemies.Where((EnemyAI x) => x.enemyType.enemyName == "SCP-956").FirstOrDefault() == (Object)null)
			{
				NetworkHandler.Instance.SpawnPinataNearbyServerRpc(((Component)StartOfRound.Instance.localPlayerController).transform.position);
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			logger.LogDebug((object)"Item activate used");
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown)
			{
				logger.LogDebug((object)"Eating candy");
				((GrabbableObject)this).playerHeldBy.DespawnHeldObject();
				ActivateCandy(((GrabbableObject)this).itemProperties.itemName, pinataCandy);
			}
		}

		public static void ActivateCandy(string candyName, bool pinataCandy)
		{
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_03c0: Unknown result type (might be due to invalid IL or missing references)
			HUDManager.Instance.UIAudio.PlayOneShot(Plugin.CandyCrunchsfx, 1f);
			if (!pinataCandy || Plugin.PlayerAge >= 12)
			{
				if (pinataCandy && Random.Range(0, 101) < Plugin.configCandyDeathChance.Value)
				{
					Plugin.localPlayer.KillPlayer(default(Vector3), true, (CauseOfDeath)0, 3);
				}
				else
				{
					if (pinataCandy && !Plugin.configSecretLab.Value)
					{
						return;
					}
					logger.LogDebug((object)"Activating candy effects...");
					switch (candyName)
					{
					case "Blue Candy":
						logger.LogDebug((object)"Candy blue");
						if (Plugin.configEnableCustomStatusEffects.Value)
						{
							StatusEffectController.Instance.ApplyCandyEffects(Plugin.configCandyBlueEffects.Value);
						}
						else
						{
							StatusEffectController.Instance.HealPlayer(30, overHeal: true);
						}
						break;
					case "Green Candy":
						logger.LogDebug((object)"Candy green");
						if (Plugin.configEnableCustomStatusEffects.Value)
						{
							StatusEffectController.Instance.ApplyCandyEffects(Plugin.configCandyGreenEffects.Value);
							break;
						}
						StatusEffectController.Instance.StatusNegation(30);
						StatusEffectController.Instance.HealthRegen(1, 80);
						break;
					case "Purple Candy":
						logger.LogDebug((object)"Candy purple");
						if (Plugin.configEnableCustomStatusEffects.Value)
						{
							StatusEffectController.Instance.ApplyCandyEffects(Plugin.configCandyPurpleEffects.Value);
							break;
						}
						StatusEffectController.Instance.DamageReduction(15, 20, timeStackable: true);
						StatusEffectController.Instance.HealthRegen(2, 10);
						break;
					case "Red Candy":
						logger.LogDebug((object)"Candy red");
						if (Plugin.configEnableCustomStatusEffects.Value)
						{
							StatusEffectController.Instance.ApplyCandyEffects(Plugin.configCandyRedEffects.Value);
						}
						else
						{
							StatusEffectController.Instance.HealthRegen(9, 5);
						}
						break;
					case "Yellow Candy":
						logger.LogDebug((object)"Candy yellow");
						if (Plugin.configEnableCustomStatusEffects.Value)
						{
							StatusEffectController.Instance.ApplyCandyEffects(Plugin.configCandyYellowEffects.Value);
							break;
						}
						StatusEffectController.Instance.RestoreStamina(25);
						StatusEffectController.Instance.InfiniteSprint(8);
						StatusEffectController.Instance.IncreasedMovementSpeed(8, 2, timeStackable: true, stackable: true);
						break;
					case "Pink Candy":
						logger.LogDebug((object)"Candy pink");
						Landmine.SpawnExplosion(((Component)Plugin.localPlayer).transform.position, true, 3f, 3f, 50, 0f, (GameObject)null);
						break;
					case "Rainbow Candy":
						logger.LogDebug((object)"Candy rainbow");
						StatusEffectController.Instance.HealPlayer(15);
						StatusEffectController.Instance.InfiniteSprint(5, timeStackable: true);
						StatusEffectController.Instance.bulletProofMultiplier++;
						StatusEffectController.Instance.StatusNegation(10);
						StatusEffectController.Instance.HealPlayer(20, overHeal: true);
						break;
					case "Black Candy":
						logger.LogDebug((object)"Candy black");
						ActivateCandy(Plugin.CandyNames.Where((string x) => x != "Black Candy").ToList()[Random.Range(0, Plugin.CandyNames.Count - 1)], pinataCandy);
						break;
					default:
						logger.LogDebug((object)"Candy not found");
						break;
					}
				}
			}
			else if (Plugin.configEnablePinata.Value)
			{
				Plugin.localPlayer.KillPlayer(default(Vector3), false, (CauseOfDeath)0, 3);
				int num = RoundManager.Instance.currentLevel.Enemies.FindIndex((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == "SCP-956");
				RoundManager.Instance.SpawnEnemyOnServer(((Component)Plugin.localPlayer).transform.position, Plugin.localPlayer.previousYRot, num);
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CandyBehavior";
		}
	}
	public class NetworkHandler : NetworkBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public NetworkList<ulong> FrozenPlayers = new NetworkList<ulong>();

		public static NetworkHandler Instance { get; private set; }

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

		public static PlayerControllerB PlayerFromId(ulong id)
		{
			return StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[id]];
		}

		public override void OnNetworkSpawn()
		{
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				NetworkHandler instance = Instance;
				if (instance != null)
				{
					((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
				}
				logger.LogDebug((object)"Despawned network object");
			}
			Instance = this;
			logger.LogDebug((object)"set instance to this");
			((NetworkBehaviour)this).OnNetworkSpawn();
			logger.LogDebug((object)"base.OnNetworkSpawn");
		}

		[ClientRpc]
		private void GrabObjectClientRpc(ulong id, 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: 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(3831750306u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, id);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3831750306u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && clientId == localPlayer.actualClientId && localPlayer.ItemSlots.Where((GrabbableObject x) => (Object)(object)x == (Object)null).Any())
				{
					GrabbableObject component = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[id]).gameObject.GetComponent<GrabbableObject>();
					PlayerControllerB obj = localPlayer;
					obj.carryWeight += Mathf.Clamp(component.itemProperties.weight - 1f, 0f, 10f);
					localPlayer.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)component).NetworkObject));
					component.parentObject = localPlayer.localItemHolder;
					component.GrabItemOnClient();
				}
			}
		}

		[ClientRpc]
		private void ChangePlayerSizeClientRpc(ulong clientId, float size)
		{
			//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)
			//IL_0109: 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(1231335968u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1231335968u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[clientId]];
				val3.thisPlayerBody.localScale = new Vector3(size, size, size);
				if (size < 1f)
				{
					val3.movementSpeed = 8.5f;
					val3.sprintTime = 22f;
				}
				else
				{
					val3.movementSpeed = 4.6f;
					val3.sprintTime = 11f;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnPinataServerRpc(Vector3 pos = default(Vector3))
		{
			//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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4004141108u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4004141108u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || (!NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsServer) || !Plugin.configEnablePinata.Value)
			{
				return;
			}
			SpawnableEnemyWithRarity val3 = RoundManager.Instance.currentLevel.Enemies.Where((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == "SCP-956").FirstOrDefault();
			if (val3 != null)
			{
				int num = RoundManager.Instance.currentLevel.Enemies.IndexOf(val3);
				Vector3 val4 = pos;
				Vector3 val5 = default(Vector3);
				if (val4 != val5)
				{
					ManualLogSource obj = logger;
					val5 = pos;
					obj.LogDebug((object)("Spawning SCP-956 at: " + ((object)(Vector3)(ref val5)).ToString()));
					RoundManager.Instance.SpawnEnemyOnServer(pos, Quaternion.identity.y, num);
					return;
				}
				List<EnemyVent> list = RoundManager.Instance.allEnemyVents.ToList();
				logger.LogDebug((object)("Found vents: " + list.Count));
				EnemyVent val6 = list[Random.Range(0, list.Count)];
				logger.LogDebug((object)("Selected vent: " + (object)val6));
				val6.enemyTypeIndex = num;
				val6.enemyType = val3.enemyType;
				logger.LogDebug((object)("Updated vent with enemy type index: " + val6.enemyTypeIndex + " and enemy type: " + (object)val6.enemyType));
				RoundManager.Instance.SpawnEnemyFromVent(val6);
				logger.LogDebug((object)"Spawning SCP-956 from vent");
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnPinataNearbyServerRpc(Vector3 playerPos)
		{
			//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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(535466337u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerPos);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 535466337u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && Plugin.configEnablePinata.Value)
			{
				Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(playerPos, (float)Plugin.config956SpawnRadius.Value, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1);
				int num = RoundManager.Instance.currentLevel.Enemies.FindIndex((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == "SCP-956");
				RoundManager.Instance.SpawnEnemyOnServer(randomNavMeshPositionInBoxPredictable, Random.Range(0f, 360f), num);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ChangePlayerSizeServerRpc(ulong clientId, float size)
		{
			//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3944937462u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3944937462u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
				{
					ChangePlayerSizeClientRpc(clientId, size);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void AddToFrozenPlayersListServerRpc(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)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1857563953u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1857563953u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
				{
					logger.LogDebug((object)$"Adding {clientId} to frozen players list");
					FrozenPlayers.Add(clientId);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnItemServerRpc(ulong clientId, string _itemName, int newValue, Vector3 pos, Quaternion rot, bool grabItem = false, bool pinataCandy = true)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2783041630u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				bool flag = _itemName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(_itemName, false);
				}
				BytePacker.WriteValueBitPacked(val2, newValue);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref grabItem, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref pinataCandy, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2783041630u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			string _itemName2 = _itemName;
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				Item val3 = StartOfRound.Instance.allItemsList.itemsList.Where((Item x) => x.itemName == _itemName2).FirstOrDefault();
				logger.LogDebug((object)"Got item");
				GameObject val4 = Object.Instantiate<GameObject>(val3.spawnPrefab, pos, rot, StartOfRound.Instance.propsContainer);
				val4.GetComponent<GrabbableObject>().fallTime = 0f;
				if (newValue != 0)
				{
					val4.GetComponent<GrabbableObject>().SetScrapValue(newValue);
				}
				val4.GetComponent<NetworkObject>().Spawn(false);
				if (Plugin.CandyNames.Contains(_itemName2) && !pinataCandy)
				{
					val4.GetComponent<CandyBehavior>().pinataCandy = false;
				}
				if (grabItem)
				{
					GrabObjectClientRpc(val4.GetComponent<NetworkObject>().NetworkObjectId, clientId);
					logger.LogDebug((object)"Grabbed obj");
				}
				if (_itemName2 == "SCP-559")
				{
					val4.GetComponent<AudioSource>().PlayOneShot(Plugin.CakeAppearsfx);
					logger.LogDebug((object)"Played cake sfx");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DespawnDeadPlayerServerRpc(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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1736492914u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1736492914u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			ulong clientId2 = clientId;
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == clientId2).FirstOrDefault();
				if (!((Object)(object)val3 == (Object)null))
				{
					Object.Destroy((Object)(object)((Component)val3.deadBody).gameObject);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_NetworkHandler()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3831750306u, new RpcReceiveHandler(__rpc_handler_3831750306));
			NetworkManager.__rpc_func_table.Add(1231335968u, new RpcReceiveHandler(__rpc_handler_1231335968));
			NetworkManager.__rpc_func_table.Add(4004141108u, new RpcReceiveHandler(__rpc_handler_4004141108));
			NetworkManager.__rpc_func_table.Add(535466337u, new RpcReceiveHandler(__rpc_handler_535466337));
			NetworkManager.__rpc_func_table.Add(3944937462u, new RpcReceiveHandler(__rpc_handler_3944937462));
			NetworkManager.__rpc_func_table.Add(1857563953u, new RpcReceiveHandler(__rpc_handler_1857563953));
			NetworkManager.__rpc_func_table.Add(2783041630u, new RpcReceiveHandler(__rpc_handler_2783041630));
			NetworkManager.__rpc_func_table.Add(1736492914u, new RpcReceiveHandler(__rpc_handler_1736492914));
		}

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

		private static void __rpc_handler_1231335968(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)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				float size = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandler)(object)target).ChangePlayerSizeClientRpc(clientId, size);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4004141108(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).SpawnPinataServerRpc(pos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_535466337(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 playerPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref playerPos);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).SpawnPinataNearbyServerRpc(playerPos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3944937462(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)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				float size = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).ChangePlayerSizeServerRpc(clientId, size);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1857563953(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)1;
				((NetworkHandler)(object)target).AddToFrozenPlayersListServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2783041630(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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string itemName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref itemName, false);
				}
				int newValue = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref newValue);
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				Quaternion rot = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref rot);
				bool grabItem = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref grabItem, default(ForPrimitives));
				bool pinataCandy = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref pinataCandy, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).SpawnItemServerRpc(clientId, itemName, newValue, pos, rot, grabItem, pinataCandy);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1736492914(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)1;
				((NetworkHandler)(object)target).DespawnDeadPlayerServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "NetworkHandler";
		}
	}
	[HarmonyPatch]
	public class NetworkObjectManager
	{
		private static GameObject networkPrefab;

		private static ManualLogSource logger = Plugin.LoggerInstance;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		public static void Init()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			if (!((Object)(object)networkPrefab != (Object)null))
			{
				networkPrefab = (GameObject)Plugin.ModAssets.LoadAsset("Assets/ModAssets/Pinata/NetworkHandlerSCP956.prefab");
				logger.LogDebug((object)"Got networkPrefab");
				networkPrefab.AddComponent<NetworkHandler>();
				logger.LogDebug((object)"Added component");
				NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
				logger.LogDebug((object)"Added networkPrefab");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void SpawnNetworkHandler()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity);
				logger.LogDebug((object)"Instantiated networkHandlerHost");
				val.GetComponent<NetworkObject>().Spawn(false);
				logger.LogDebug((object)"Spawned network object");
			}
		}
	}
	[BepInPlugin("Snowlance.Pinata", "Pinata", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "Snowlance.Pinata";

		private const string modName = "Pinata";

		private const string modVersion = "1.0.0";

		public static Plugin PluginInstance;

		public static ManualLogSource LoggerInstance;

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

		public static int PlayerAge;

		public static int PlayerOriginalAge;

		public static List<string> CandyNames;

		public static AssetBundle? ModAssets;

		public static AudioClip? WarningSoundShortsfx;

		public static AudioClip? WarningSoundLongsfx;

		public static AudioClip? BoneCracksfx;

		public static AudioClip? PlayerDeathsfx;

		public static AudioClip? CandyCrunchsfx;

		public static AudioClip? CandyEquipsfx;

		public static AudioClip? CandleBlowsfx;

		public static AudioClip? CakeAppearsfx;

		public static AudioClip? CakeDisappearsfx;

		public static AudioClip? EatCakesfx;

		public static ConfigEntry<bool> configSecretLab;

		public static ConfigEntry<int> config956SpawnRadius;

		public static ConfigEntry<int> config956TeleportTime;

		public static ConfigEntry<int> config956TeleportRange;

		public static ConfigEntry<int> configExperimentationLevelRarity;

		public static ConfigEntry<int> configAssuranceLevelRarity;

		public static ConfigEntry<int> configVowLevelRarity;

		public static ConfigEntry<int> configOffenseLevelRarity;

		public static ConfigEntry<int> configMarchLevelRarity;

		public static ConfigEntry<int> configRendLevelRarity;

		public static ConfigEntry<int> configDineLevelRarity;

		public static ConfigEntry<int> configTitanLevelRarity;

		public static ConfigEntry<int> configModdedLevelRarity;

		public static ConfigEntry<int> configOtherLevelRarity;

		public static ConfigEntry<bool> configEnablePinata;

		public static ConfigEntry<bool> configTargetAllPlayers;

		public static ConfigEntry<float> config956ActivationRadius;

		public static ConfigEntry<int> configMinAge;

		public static ConfigEntry<int> configMaxAge;

		public static ConfigEntry<bool> configPlayWarningSound;

		public static ConfigEntry<int> configHeadbuttDamage;

		public static ConfigEntry<int> configCandyMinSpawn;

		public static ConfigEntry<int> configCandyMaxSpawn;

		public static ConfigEntry<int> configCandyDeathChance;

		public static ConfigEntry<bool> configEnableCandyBag;

		public static ConfigEntry<bool> configEnable559;

		public static ConfigEntry<int> config559Rarity;

		public static ConfigEntry<int> config559MinValue;

		public static ConfigEntry<int> config559MaxValue;

		public static ConfigEntry<int> config559HealAmount;

		public static ConfigEntry<bool> configEnable330;

		public static ConfigEntry<int> config330Rarity;

		public static ConfigEntry<bool> configEnableCustomStatusEffects;

		public static ConfigEntry<string> configCandyPurpleEffects;

		public static ConfigEntry<string> configCandyRedEffects;

		public static ConfigEntry<string> configCandyYellowEffects;

		public static ConfigEntry<string> configCandyGreenEffects;

		public static ConfigEntry<string> configCandyBlueEffects;

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

		private void Awake()
		{
			if ((Object)(object)PluginInstance == (Object)null)
			{
				PluginInstance = this;
			}
			LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
			harmony.PatchAll();
			InitializeNetworkBehaviours();
			configSecretLab = ((BaseUnityPlugin)this).Config.Bind<bool>("Secret Lab", "Secret Lab", false, "Enables Secret Lab mode. SCP-956 will have a lot of the same functionality from SCP Secret Lab. Acts like a Hard mode. See README for more info.");
			config956SpawnRadius = ((BaseUnityPlugin)this).Config.Bind<int>("Secret Lab", "956 Spawn Radius", 50, "Radius at which SCP-956 will spawn around the player when their age is below 12 or candy is collected.");
			config956TeleportTime = ((BaseUnityPlugin)this).Config.Bind<int>("Secret Lab", "956 Teleport Time", 60, "Time in seconds it takes for SCP-956 to teleport somewhere else when nobody is looking at it.");
			config956TeleportRange = ((BaseUnityPlugin)this).Config.Bind<int>("Secret Lab", "956 Teleport Range", 100, "Range at which SCP-956 will teleport.");
			configExperimentationLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "ExperimentationLevelRarity", 10, "Experimentation Level Rarity");
			configAssuranceLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "AssuranceLevelRarity", 10, "Assurance Level Rarity");
			configVowLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "VowLevelRarity", 10, "Vow Level Rarity");
			configOffenseLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "OffenseLevelRarity", 30, "Offense Level Rarity");
			configMarchLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "MarchLevelRarity", 50, "March Level Rarity");
			configRendLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "RendLevelRarity", 50, "Rend Level Rarity");
			configDineLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "DineLevelRarity", 50, "Dine Level Rarity");
			configTitanLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "TitanLevelRarity", 80, "Titan Level Rarity");
			configModdedLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "ModdedLevelRarity", 30, "Modded Level Rarity");
			configOtherLevelRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "OtherLevelRarity", 30, "Other Level Rarity");
			configEnablePinata = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-956", "Enable SCP-956", true, "Set to false to disable spawning SCP-956.");
			configTargetAllPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-956", "Target All Players", false, "Set to true if you want 956 to target all players regardless of conditions.");
			config956ActivationRadius = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-956", "Activation Radius", 15f, "The radius in which SCP-956 will target players that meet the required conditions.");
			configMinAge = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-956", "Min Age", 18, "The minimum age of a player that is decided at the beginning of a game.");
			configMaxAge = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-956", "Max Age", 70, "The maximum age of a player that is decided at the beginning of a game.");
			configPlayWarningSound = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-956", "Play Warning Sound", true, "Play warning sound when inside SCP-956's radius and conditions are met.");
			configHeadbuttDamage = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-956", "Headbutt Damage", 50, "The amount of damage SCP-956 will do when using his headbutt attack.");
			configCandyMinSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("Candy", "Min Candy Spawn", 5, "The minimum amount of candy to spawn when player dies to SCP-956");
			configCandyMaxSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("Candy", "Max Candy Spawn", 30, "The maximum amount of candy to spawn when player dies to SCP-956");
			configCandyDeathChance = ((BaseUnityPlugin)this).Config.Bind<int>("Candy", "Death Chance", 5, "The chance of the Player being killed by pinata candy");
			configEnableCandyBag = ((BaseUnityPlugin)this).Config.Bind<bool>("Candy", "Enable Candy Bag", true, "Makes it so you can place candy into a separate bag.");
			configEnable559 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-559", "Enable SCP-559", true, "Set to false to disable spawning SCP-559.");
			config559Rarity = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-559", "Rarity", 40, "How often SCP-559 will spawn.");
			config559MinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-559", "SCP-559 Min Value", 50, "The minimum scrap value of SCP-559.");
			config559MaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-559", "SCP-559 Max Value", 150, "The maximum scrap value of SCP-559.");
			config559HealAmount = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-559", "Heal Amount", 10, "The amount of health SCP-559 will heal when eaten.");
			configEnable330 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-330", "Enable SCP-330", true, "Set to false to disable spawning SCP-330.");
			config330Rarity = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-330", "Rarity", 30, "How often SCP-330 will spawn.");
			configEnableCustomStatusEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("Status Effects (Experimental)", "Enable Custom Status Effects", false, "Enable custom status effects");
			configCandyPurpleEffects = ((BaseUnityPlugin)this).Config.Bind<string>("Status Effects (Experimental)", "Candy Purple Effects", "DamageReduction:15,20,true;HealthRegen:2,10;", "Effects when eating purple candy. See README for more info.");
			configCandyRedEffects = ((BaseUnityPlugin)this).Config.Bind<string>("Status Effects (Experimental)", "Candy Red Effects", "HealthRegen:9,5;", "Effects when eating red candy. See README for more info.");
			configCandyYellowEffects = ((BaseUnityPlugin)this).Config.Bind<string>("Status Effects (Experimental)", "Candy Yellow Effects", "RestoreStamina:25;InfiniteSprint:8;IncreasedMovementSpeed:8,2,true,true;", "Effects when eating yellow candy. See README for more info.");
			configCandyGreenEffects = ((BaseUnityPlugin)this).Config.Bind<string>("Status Effects (Experimental)", "Candy Green Effects", "StatusNegation:30;HealthRegen:1,80;", "Effects when eating green candy. See README for more info.");
			configCandyBlueEffects = ((BaseUnityPlugin)this).Config.Bind<string>("Status Effects (Experimental)", "Candy Blue Effects", "HealPlayer:30,true;", "Effects when eating blue candy. See README for more info.");
			new StatusEffectController();
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scp956_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, "scp956_assets")));
			WarningSoundShortsfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Pinata/Audio/956WarningShort.mp3");
			WarningSoundLongsfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Pinata/Audio/956WarningLong.mp3");
			BoneCracksfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Pinata/Audio/bone-crack.mp3");
			PlayerDeathsfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Pinata/Audio/Pinata_attack.mp3");
			CandyCrunchsfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Candy/Audio/Candy_Crunch.wav");
			CandyEquipsfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Candy/Audio/Candy_Equip.wav");
			CandleBlowsfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Cake/Audio/cake_candle_blow.wav");
			CakeAppearsfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Cake/Audio/cake_appear.wav");
			CakeDisappearsfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Cake/Audio/cake_disappear.wav");
			EatCakesfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Cake/Audio/Cake_Eat.wav");
			if ((Object)(object)EatCakesfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"EatCakesfx is null");
			}
			if ((Object)(object)CandleBlowsfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"CandleBlowsfx is null");
			}
			if ((Object)(object)CakeAppearsfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"CakeAppearsfx is null");
			}
			if ((Object)(object)CakeDisappearsfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"CakeDisappearsfx is null");
			}
			if ((Object)(object)BoneCracksfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"BoneCracksfx is null");
			}
			if ((Object)(object)PlayerDeathsfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"PlayerDeathsfx is null");
			}
			if ((Object)(object)CandyCrunchsfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"CandyCrunchsfx is null");
			}
			if ((Object)(object)CandyEquipsfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"CandyEquipsfx is null");
			}
			if ((Object)(object)WarningSoundShortsfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"WarningSoundShortsfx is null");
			}
			if ((Object)(object)WarningSoundLongsfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"WarningSoundLongsfx is null");
			}
			LoggerInstance.LogDebug((object)"Got sounds from assets");
			if (configEnable559.Value)
			{
				Item val = ModAssets.LoadAsset<Item>("Assets/ModAssets/Cake/SCP559Item.asset");
				if ((Object)(object)val == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get SCP559 from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got SCP559 prefab");
				SCP559Behavior component = val.spawnPrefab.GetComponent<SCP559Behavior>();
				val.minValue = config559MinValue.Value;
				val.maxValue = config559MaxValue.Value;
				NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
				Utilities.FixMixerGroups(val.spawnPrefab);
				Items.RegisterScrap(val, config559Rarity.Value, (LevelTypes)(-1));
				Item val2 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Cake/CakeItem.asset");
				if ((Object)(object)val2 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get cake from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got Cake prefab");
				NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
				Utilities.FixMixerGroups(val2.spawnPrefab);
				Items.RegisterScrap(val2, (Dictionary<LevelTypes, int>)null, (Dictionary<string, int>)null);
			}
			if (configEnable330.Value)
			{
				Item val3 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/BowlOfCandyItem.asset");
				if ((Object)(object)val3 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get bowl of candy from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got bowl of candy prefab");
				NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
				Utilities.FixMixerGroups(val3.spawnPrefab);
				Items.RegisterScrap(val3, config330Rarity.Value, (LevelTypes)(-1));
				Item val4 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/BowlOfCandyPItem.asset");
				if ((Object)(object)val4 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get bowl of candy from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got bowl of candy P prefab");
				NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
				Utilities.FixMixerGroups(val4.spawnPrefab);
				Items.RegisterScrap(val4, config330Rarity.Value, (LevelTypes)(-1));
			}
			Item val5 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/CandyPinkItem.asset");
			if ((Object)(object)val5 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyPink from assets");
				return;
			}
			RegisterCandy(val5);
			LoggerInstance.LogDebug((object)"Got CandyPink");
			Item val6 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/CandyPurpleItem.asset");
			if ((Object)(object)val6 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyPurple from assets");
				return;
			}
			RegisterCandy(val6);
			LoggerInstance.LogDebug((object)"Got CandyPurple");
			Item val7 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/CandyRedItem.asset");
			if ((Object)(object)val7 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyRed from assets");
				return;
			}
			RegisterCandy(val7);
			LoggerInstance.LogDebug((object)"Got CandyRed");
			Item val8 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/CandyYellowItem.asset");
			if ((Object)(object)val8 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyYellow from assets");
				return;
			}
			RegisterCandy(val8);
			LoggerInstance.LogDebug((object)"Got CandyYellow");
			Item val9 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/CandyGreenItem.asset");
			if ((Object)(object)val9 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyGreen from assets");
				return;
			}
			RegisterCandy(val9);
			LoggerInstance.LogDebug((object)"Got CandyGreen");
			Item val10 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/CandyBlueItem.asset");
			if ((Object)(object)val10 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyBlue from assets");
				return;
			}
			RegisterCandy(val10);
			LoggerInstance.LogDebug((object)"Got CandyBlue");
			Item val11 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/CandyRainbowItem.asset");
			if ((Object)(object)val11 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyRainbow from assets");
				return;
			}
			RegisterCandy(val11);
			LoggerInstance.LogDebug((object)"Got CandyRainbow");
			Item val12 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/CandyBlackItem.asset");
			if ((Object)(object)val12 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyBlack from assets");
				return;
			}
			RegisterCandy(val12);
			LoggerInstance.LogDebug((object)"Got CandyBlack");
			CandyNames = new List<string> { val5.itemName, val6.itemName, val7.itemName, val8.itemName, val9.itemName, val10.itemName, val11.itemName, val12.itemName };
			if (configEnableCandyBag.Value)
			{
				Item val13 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/BagOfCandyItem.asset");
				if ((Object)(object)val13 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get CandyBag from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got CandyBag");
				NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab);
				Utilities.FixMixerGroups(val13.spawnPrefab);
				Items.RegisterItem(val13);
			}
			if (configEnablePinata.Value)
			{
				EnemyType val14 = ModAssets.LoadAsset<EnemyType>("Assets/ModAssets/Pinata/Pinata.asset");
				if ((Object)(object)val14 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get enemy from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got SCP-956 prefab");
				TerminalNode val15 = ModAssets.LoadAsset<TerminalNode>("Assets/ModAssets/Pinata/Bestiary/PinataTN.asset");
				TerminalKeyword val16 = ModAssets.LoadAsset<TerminalKeyword>("Assets/ModAssets/Pinata/Bestiary/PinataTK.asset");
				LoggerInstance.LogDebug((object)"Setting rarities");
				Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>
				{
					{
						(LevelTypes)4,
						configExperimentationLevelRarity.Value
					},
					{
						(LevelTypes)8,
						configAssuranceLevelRarity.Value
					},
					{
						(LevelTypes)16,
						configVowLevelRarity.Value
					},
					{
						(LevelTypes)32,
						configOffenseLevelRarity.Value
					},
					{
						(LevelTypes)64,
						configMarchLevelRarity.Value
					},
					{
						(LevelTypes)128,
						configRendLevelRarity.Value
					},
					{
						(LevelTypes)256,
						configDineLevelRarity.Value
					},
					{
						(LevelTypes)512,
						configTitanLevelRarity.Value
					},
					{
						(LevelTypes)(-1),
						configOtherLevelRarity.Value
					},
					{
						(LevelTypes)1024,
						configModdedLevelRarity.Value
					}
				};
				LoggerInstance.LogDebug((object)"Registering enemy network prefab...");
				NetworkPrefabs.RegisterNetworkPrefab(val14.enemyPrefab);
				LoggerInstance.LogDebug((object)"Registering enemy...");
				Enemies.RegisterEnemy(val14, dictionary, (Dictionary<string, int>)null, val15, val16);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.Pinata v1.0.0 has loaded!");
		}

		public static void DespawnItemInSlot(int itemSlot)
		{
			((Behaviour)HUDManager.Instance.itemSlotIcons[itemSlot]).enabled = false;
			if ((Object)(object)localPlayer.currentlyHeldObject != (Object)(object)localPlayer.ItemSlots[itemSlot])
			{
				PlayerControllerB obj = localPlayer;
				obj.carryWeight -= Mathf.Clamp(localPlayer.ItemSlots[itemSlot].itemProperties.weight - 1f, 0f, 10f);
			}
			localPlayer.DestroyItemInSlotAndSync(itemSlot);
		}

		public static bool IsPlayerHoldingCandy(PlayerControllerB player)
		{
			GrabbableObject[] itemSlots = player.ItemSlots;
			foreach (GrabbableObject val in itemSlots)
			{
				if (!((Object)(object)val == (Object)null) && CandyNames.Contains(val.itemProperties.itemName))
				{
					return true;
				}
			}
			return false;
		}

		private void RegisterCandy(Item candy)
		{
			if (!configEnableCandyBag.Value)
			{
				candy.toolTips[1] = "";
			}
			NetworkPrefabs.RegisterNetworkPrefab(candy.spawnPrefab);
			Utilities.FixMixerGroups(candy.spawnPrefab);
			Items.RegisterItem(candy);
		}

		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 SCP330Behavior : PhysicsProp
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public static int candyTaken = 0;

		public static bool noHands = false;

		private PlayerControllerB localPlayer => StartOfRound.Instance.localPlayerController;

		public override void InteractItem()
		{
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//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)
			logger.LogDebug((object)"Interacting with SCP-330");
			if (candyTaken >= 2 || (Plugin.PlayerAge < 12 && candyTaken >= 4))
			{
				logger.LogDebug((object)"Player took too much candy!");
				localPlayer.DamagePlayer(10, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				HUDManager.Instance.UpdateHealthUI(localPlayer.health, true);
				localPlayer.MakeCriticallyInjured(true);
				localPlayer.DropAllHeldItemsAndSync();
				noHands = true;
				HUDManager.Instance.UIAudio.PlayOneShot(Plugin.BoneCracksfx, 1f);
				HUDManager.Instance.DisplayTip("Took too much candy", "You feel a sharp pain where your hands should be. They've been severed by an unknown force.", false, false, "LC_Tip1");
				localPlayer.JumpToFearLevel(3f, true);
				StatusEffectController.Instance.DamagePlayerOverTime(5, 2, untilDead: true);
			}
			else
			{
				NetworkHandler.Instance.SpawnItemServerRpc(localPlayer.actualClientId, Plugin.CandyNames[Random.Range(0, Plugin.CandyNames.Count)], 0, ((Component)this).transform.position, Quaternion.identity, grabItem: true, pinataCandy: false);
				logger.LogDebug((object)"Spawned candy");
				candyTaken++;
				logger.LogDebug((object)("Candy taken: " + candyTaken));
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SCP330Behavior";
		}
	}
	internal class SCP559Behavior : PhysicsProp
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		private static PlayerControllerB localPlayer => StartOfRound.Instance.localPlayerController;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!buttonDown)
			{
				return;
			}
			StatusEffectController.Instance.BlowOutCandles();
			if (!StartOfRound.Instance.inShipPhase)
			{
				List<RandomScrapSpawn> list = (from x in Object.FindObjectsOfType<RandomScrapSpawn>()
					where !x.spawnUsed
					select x).ToList();
				int index = Random.Range(0, list.Count);
				RandomScrapSpawn val = list[index];
				Vector3 pos = ((Component)val).transform.position;
				if (val.spawnedItemsCopyPosition)
				{
					list.RemoveAt(index);
				}
				else
				{
					pos = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(((Component)val).transform.position, val.itemSpawnRange, RoundManager.Instance.navHit);
				}
				int newValue = ((Component)this).GetComponent<GrabbableObject>().scrapValue * 50;
				logger.LogDebug((object)"Spawning SCP-559");
				NetworkHandler.Instance.SpawnItemServerRpc(localPlayer.actualClientId, ((GrabbableObject)this).itemProperties.itemName, newValue, pos, Quaternion.identity);
			}
			PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
			int newValue2 = ((GrabbableObject)this).scrapValue / 2;
			((GrabbableObject)this).playerHeldBy.DespawnHeldObject();
			Item val2 = StartOfRound.Instance.allItemsList.itemsList.Where((Item x) => x.itemName == "Cake").FirstOrDefault();
			logger.LogDebug((object)"Spawning cake");
			NetworkHandler.Instance.SpawnItemServerRpc(localPlayer.actualClientId, val2.itemName, newValue2, ((Component)playerHeldBy).transform.position, Quaternion.identity, grabItem: true);
			if (StartOfRound.Instance.inShipPhase || !Plugin.configEnablePinata.Value)
			{
				return;
			}
			EnemyAI val3 = RoundManager.Instance.SpawnedEnemies.Where((EnemyAI x) => x.enemyType.enemyName == "SCP-956").FirstOrDefault();
			if ((Object)(object)val3 == (Object)null)
			{
				if (Plugin.configSecretLab.Value && localPlayer.isInsideFactory)
				{
					NetworkHandler.Instance.SpawnPinataNearbyServerRpc(((Component)localPlayer).transform.position);
				}
				else
				{
					NetworkHandler.Instance.SpawnPinataServerRpc();
				}
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SCP559Behavior";
		}
	}
	internal class SCP956AI : EnemyAI
	{
		private enum State
		{
			Dormant,
			MovingTowardsPlayer,
			HeadButtAttackInProgress
		}

		private static ManualLogSource logger = Plugin.LoggerInstance;

		public Transform turnCompass = null;

		private bool isDeadAnimationDone;

		private float timeSinceNewRandPos;

		private float timeSinceRandTeleport;

		public override void Start()
		{
			((EnemyAI)this).Start();
			logger.LogDebug((object)"SCP-956 Spawned");
			isDeadAnimationDone = false;
			base.currentBehaviourStateIndex = 0;
			RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)this);
		}

		public override void Update()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				if (!isDeadAnimationDone)
				{
					logger.LogDebug((object)"Stopping enemy voice with janky code.");
					isDeadAnimationDone = true;
					base.creatureVoice.Stop();
					base.creatureVoice.PlayOneShot(base.dieSFX);
				}
				return;
			}
			timeSinceNewRandPos += Time.deltaTime;
			timeSinceRandTeleport += Time.deltaTime;
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex == 1)
			{
				turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 0.8f * Time.deltaTime);
				if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 60f, 60, -1f))
				{
					GameNetworkManager.Instance.localPlayerController.IncreaseFearLevelOverTime(0.2f, 1f);
				}
			}
			else if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex == 2)
			{
				turnCompass.LookAt(((Component)base.targetPlayer.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 override void DoAIInterval()
		{
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			if (IsAnyPlayerLookingAtMe())
			{
				timeSinceRandTeleport = 0f;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 0f;
				if (TargetFrozenPlayerInRange(Plugin.config956ActivationRadius.Value))
				{
					logger.LogDebug((object)"Start Killing Player");
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				else if (Plugin.configSecretLab.Value && timeSinceRandTeleport > (float)Plugin.config956TeleportTime.Value)
				{
					logger.LogDebug((object)"Teleporting");
					Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(((Component)this).transform.position, (float)Plugin.config956TeleportRange.Value, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1);
					Teleport(randomNavMeshPositionInBoxPredictable);
					timeSinceRandTeleport = 0f;
				}
				break;
			case 1:
				base.agent.speed = 0.5f;
				timeSinceRandTeleport = 0f;
				if (!TargetFrozenPlayerInRange(Plugin.config956ActivationRadius.Value))
				{
					logger.LogDebug((object)"Stop Killing Players");
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				else
				{
					MoveToPlayer();
				}
				break;
			case 2:
				timeSinceRandTeleport = 0f;
				break;
			}
		}

		public IEnumerator HeadbuttAttack()
		{
			((EnemyAI)this).SwitchToBehaviourClientRpc(2);
			PlayerControllerB player = base.targetPlayer;
			Vector3 playerPos = ((Component)player).transform.position;
			yield return (object)new WaitForSeconds(3f);
			logger.LogDebug((object)"Headbutting");
			DoAnimationClientRpc("headButt");
			yield return (object)new WaitForSeconds(0.5f);
			logger.LogDebug((object)("Damaging player: " + base.targetPlayer.playerUsername));
			DamageTargetPlayerClientRpc(player.actualClientId);
			base.creatureSFX.PlayOneShot(Plugin.BoneCracksfx);
			yield return (object)new WaitForSeconds(0.5f);
			if (player.isPlayerDead)
			{
				base.creatureVoice.PlayOneShot(Plugin.PlayerDeathsfx);
				logger.LogDebug((object)"Player died, spawning candy");
				int candiesCount = Random.Range(Plugin.configCandyMinSpawn.Value, Plugin.configCandyMaxSpawn.Value);
				for (int i = 0; i < candiesCount; i++)
				{
					Vector3 pos = RoundManager.Instance.GetRandomNavMeshPositionInRadius(playerPos, 1.5f, RoundManager.Instance.navHit);
					NetworkHandler.Instance.SpawnItemServerRpc(0uL, Plugin.CandyNames[Random.Range(0, Plugin.CandyNames.Count)], 0, pos, Quaternion.Euler(0f, Random.Range(0f, 361f), 0f));
				}
				NetworkHandler.Instance.FrozenPlayers.Remove(player.actualClientId);
				base.targetPlayer = null;
			}
			if (base.currentBehaviourStateIndex == 2)
			{
				((EnemyAI)this).SwitchToBehaviourClientRpc(1);
			}
		}

		private bool TargetFrozenPlayerInRange(float range)
		{
			//IL_00c2: 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)
			base.targetPlayer = null;
			if (NetworkHandler.Instance.FrozenPlayers == null)
			{
				return false;
			}
			if (NetworkHandler.Instance.FrozenPlayers.Count > 0)
			{
				foreach (ulong frozenPlayer in NetworkHandler.Instance.FrozenPlayers)
				{
					PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[frozenPlayer]];
					if ((Object)(object)val == (Object)null || val.disconnectedMidGame || val.isPlayerDead || !val.isPlayerControlled)
					{
						NetworkHandler.Instance.FrozenPlayers.Remove(frozenPlayer);
					}
					else if (Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < range && ((EnemyAI)this).PlayerIsTargetable(val, false, false))
					{
						base.targetPlayer = val;
					}
				}
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		private void MoveToPlayer()
		{
			//IL_001d: 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_008d: 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)
			//IL_00a7: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)base.targetPlayer == (Object)null))
			{
				if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= 3f)
				{
					logger.LogDebug((object)"Headbutt Attack");
					((MonoBehaviour)this).StartCoroutine(HeadbuttAttack());
				}
				else if (timeSinceNewRandPos > 1.5f)
				{
					timeSinceNewRandPos = 0f;
					Vector3 val = ((Component)base.targetPlayer).transform.forward * 2.9f + ((Component)base.targetPlayer).transform.position;
					((EnemyAI)this).SetDestinationToPosition(val, false);
				}
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
		}

		public override void HitFromExplosion(float distance)
		{
			((EnemyAI)this).HitFromExplosion(distance);
			((EnemyAI)this).KillEnemy(true);
		}

		public override void HitEnemy(int force = 0, PlayerControllerB playerWhoHit = null, bool playHitSFX = true, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(0, playerWhoHit, playHitSFX, hitID);
		}

		public void Teleport(Vector3 teleportPos)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			base.serverPosition = teleportPos;
			((Component)this).transform.position = teleportPos;
			base.agent.Warp(teleportPos);
			((EnemyAI)this).SyncPositionToClients();
		}

		public bool IsAnyPlayerLookingAtMe()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.isPlayerControlled && val.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, (float)Plugin.config956SpawnRadius.Value))
				{
					return true;
				}
			}
			return false;
		}

		[ClientRpc]
		private 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(1088082959u, 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, 1088082959u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				logger.LogDebug((object)("Animation: " + animationName));
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

		[ClientRpc]
		private void DamageTargetPlayerClientRpc(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