Decompiled source of SnowPlaygrounds v1.0.1

SnowPlaygrounds.dll

Decompiled 4 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using SnowPlaygrounds.Behaviours;
using SnowPlaygrounds.Behaviours.Items;
using SnowPlaygrounds.Behaviours.MapObjects;
using SnowPlaygrounds.Managers;
using SnowPlaygrounds.NetcodePatcher;
using SnowPlaygrounds.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("SnowPlaygrounds")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SnowPlaygrounds")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("da5eb4f1-463c-4837-a533-0c97fb2b145c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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: 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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SnowPlaygrounds
{
	public class Constants
	{
		public const string GLOBAL = "_Global_";

		public const string SNOWBALL = "Snowball";

		public const string SNOW_PILE = "Snow Pile";

		public const string SNOWMAN = "Snowman";

		public static Vector3 SNOWMAN_SCALE = new Vector3(2.5f, 2.5f, 2.5f);
	}
	[BepInPlugin("Lega.SnowPlaygrounds", "Snow Playgrounds", "1.0.0")]
	public class SnowPlaygrounds : BaseUnityPlugin
	{
		private const string modGUID = "Lega.SnowPlaygrounds";

		private const string modName = "Snow Playgrounds";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Lega.SnowPlaygrounds");

		private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "snowplaygrounds"));

		internal static ManualLogSource mls;

		public static ConfigFile configFile;

		public static GameObject managerPrefab = NetworkPrefabs.CreateNetworkPrefab("SnowPlaygroundsNetworkManager");

		public static GameObject snowballObj;

		public static GameObject snowPileObj;

		public static GameObject snowmanObj;

		public static GameObject snowballDecal;

		public static Material frozenShader;

		public static GameObject snowballParticle;

		public static GameObject snowmanParticle;

		public static GameObject snowmanAudio;

		public void Awake()
		{
			mls = Logger.CreateLogSource("SnowPlaygrounds");
			configFile = ((BaseUnityPlugin)this).Config;
			ConfigManager.Load();
			LoadManager();
			NetcodePatcher();
			LoadItems();
			LoadHazards();
			LoadDecals();
			LoadParticles();
			LoadAudios();
			LoadShaders();
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(RoundManagerPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(EnemyAIPatch));
		}

		public static void LoadManager()
		{
			Utilities.FixMixerGroups(managerPrefab);
			managerPrefab.AddComponent<SnowPlaygroundsNetworkManager>();
		}

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

		public void LoadItems()
		{
			snowballObj = RegisterItem(typeof(Snowball), bundle.LoadAsset<Item>("Assets/Snowball/SnowballItem.asset")).spawnPrefab;
		}

		public Item RegisterItem(Type type, Item item)
		{
			Component obj = item.spawnPrefab.AddComponent(type);
			PhysicsProp val = (PhysicsProp)(object)((obj is PhysicsProp) ? obj : null);
			((GrabbableObject)val).grabbable = true;
			((GrabbableObject)val).grabbableToEnemies = true;
			((GrabbableObject)val).itemProperties = item;
			NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			Utilities.FixMixerGroups(item.spawnPrefab);
			Items.RegisterItem(item);
			return item;
		}

		public void LoadHazards()
		{
			snowPileObj = RegisterHazard(bundle.LoadAsset<GameObject>("Assets/SnowPile/SnowPile.prefab"), ConfigManager.isSnowPileInside.Value, ConfigManager.minSnowPileInside.Value, ConfigManager.maxSnowPileInside.Value);
			snowmanObj = RegisterHazard(bundle.LoadAsset<GameObject>("Assets/Snowman/Snowman.prefab"), ConfigManager.isSnowmanInside.Value, ConfigManager.minSnowmanInside.Value, ConfigManager.maxSnowmanInside.Value);
		}

		public GameObject RegisterHazard(GameObject gameObject, bool isInside, float minSpawn, float maxSpawn)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			SpawnableMapObjectDef val = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
			val.spawnableMapObject = new SpawnableMapObject
			{
				prefabToSpawn = gameObject
			};
			AnimationCurve animationCurveInside = new AnimationCurve((Keyframe[])(object)new Keyframe[1]
			{
				new Keyframe(minSpawn, maxSpawn)
			});
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnableMapObject.prefabToSpawn);
			Utilities.FixMixerGroups(val.spawnableMapObject.prefabToSpawn);
			if (isInside)
			{
				MapObjects.RegisterMapObject(val, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel _) => animationCurveInside));
			}
			return val.spawnableMapObject.prefabToSpawn;
		}

		public static void LoadDecals()
		{
			snowballDecal = bundle.LoadAsset<GameObject>("Assets/Snowball/SnowballDecal.prefab");
		}

		public static void LoadParticles()
		{
			HashSet<GameObject> hashSet = new HashSet<GameObject>
			{
				snowballParticle = bundle.LoadAsset<GameObject>("Assets/Snowball/SnowballParticle.prefab"),
				snowmanParticle = bundle.LoadAsset<GameObject>("Assets/Snowman/SnowmanParticle.prefab")
			};
			foreach (GameObject item in hashSet)
			{
				NetworkPrefabs.RegisterNetworkPrefab(item);
				Utilities.FixMixerGroups(item);
			}
		}

		public static void LoadAudios()
		{
			HashSet<GameObject> hashSet = new HashSet<GameObject> { snowmanAudio = bundle.LoadAsset<GameObject>("Assets/Snowman/SnowmanAudio.prefab") };
			foreach (GameObject item in hashSet)
			{
				NetworkPrefabs.RegisterNetworkPrefab(item);
				Utilities.FixMixerGroups(item);
			}
		}

		public static void LoadShaders()
		{
			frozenShader = bundle.LoadAsset<Material>("Assets/Shaders/FrozenMaterial.mat");
		}
	}
	public class SPUtilities
	{
		public static Coroutine targetableCoroutine;

		public static void StartFreezeEnemy(EnemyAI enemy, float duration, float slowdownFactor)
		{
			EnemyFreezeBehaviour enemyFreezeBehaviour = ((Component)enemy).GetComponent<EnemyFreezeBehaviour>();
			if ((Object)(object)enemyFreezeBehaviour == (Object)null)
			{
				enemyFreezeBehaviour = ((Component)enemy).gameObject.AddComponent<EnemyFreezeBehaviour>();
				enemyFreezeBehaviour.enemy = enemy;
			}
			enemyFreezeBehaviour.StartFreeze(duration, slowdownFactor);
		}

		public static void StartTargetable(PlayerControllerB player, float duration)
		{
			if (targetableCoroutine != null)
			{
				((MonoBehaviour)player).StopCoroutine(targetableCoroutine);
			}
			targetableCoroutine = ((MonoBehaviour)player).StartCoroutine(SetTargetablePlayerCoroutine(duration));
		}

		public static IEnumerator SetTargetablePlayerCoroutine(float duration)
		{
			yield return (object)new WaitForSeconds(duration);
			EnemyAIPatch.isTargetable = true;
			targetableCoroutine = null;
		}

		public static void SetUntargetable(PlayerControllerB player)
		{
			if (targetableCoroutine != null)
			{
				((MonoBehaviour)player).StopCoroutine(targetableCoroutine);
			}
			EnemyAIPatch.isTargetable = false;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SnowPlaygrounds";

		public const string PLUGIN_NAME = "SnowPlaygrounds";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SnowPlaygrounds.Patches
{
	internal class EnemyAIPatch
	{
		public static bool isTargetable = true;

		[HarmonyPatch(typeof(EnemyAI), "PlayerIsTargetable")]
		[HarmonyPrefix]
		private static bool IsPlayerTargetable(ref bool __result)
		{
			if (!isTargetable)
			{
				__result = false;
				return false;
			}
			return true;
		}
	}
	internal class PlayerControllerBPatch
	{
		public static int cameraCollideLayerMask = (1 << LayerMask.NameToLayer("Room")) | (1 << LayerMask.NameToLayer("PlaceableShipObject")) | (1 << LayerMask.NameToLayer("Terrain")) | (1 << LayerMask.NameToLayer("MiscLevelGeometry"));

		public static float targetCameraDistance = 3f;

		[HarmonyPatch(typeof(PlayerControllerB), "PlayerLookInput")]
		[HarmonyPrefix]
		private static bool HandleSnowmanCamera(ref PlayerControllerB __instance)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				return true;
			}
			Snowman componentInChildren = ((Component)__instance).GetComponentInChildren<Snowman>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				return true;
			}
			if (!__instance.quickMenuManager.isMenuOpen)
			{
				MovementActions movement = __instance.playerActions.Movement;
				Vector2 val = ((MovementActions)(ref movement)).Look.ReadValue<Vector2>() * (float)IngamePlayerSettings.Instance.settings.lookSensitivity * 0.008f;
				componentInChildren.cameraPivot.Rotate(new Vector3(0f, val.x, 0f));
				float num = componentInChildren.cameraPivot.localEulerAngles.x - val.y;
				num = ((num > 180f) ? (num - 360f) : num);
				num = Mathf.Clamp(num, -45f, 45f);
				componentInChildren.cameraPivot.localEulerAngles = new Vector3(num, componentInChildren.cameraPivot.localEulerAngles.y, 0f);
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "ItemSecondaryUse_performed")]
		[HarmonyPostfix]
		private static void SecondaryUsePerformed(ref PlayerControllerB __instance)
		{
			((Component)__instance).GetComponentInChildren<Snowman>()?.ExitSnowman();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")]
		[HarmonyPrefix]
		private static bool PreDropObject(ref PlayerControllerB __instance)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.currentlyHeldObjectServer is Snowball snowball && !snowball.isThrown)
			{
				if (__instance.isCrouching)
				{
					SnowPlaygroundsNetworkManager.Instance.SpawnSnowmanServerRpc(NetworkObjectReference.op_Implicit(((Component)snowball).GetComponent<NetworkObject>()), ((Component)__instance).transform.position + Vector3.up * 1.5f);
				}
				else
				{
					snowball.DropSnowballServerRpc((int)__instance.playerClientId);
				}
				return false;
			}
			return true;
		}
	}
	internal class RoundManagerPatch
	{
		[HarmonyPatch(typeof(RoundManager), "SpawnOutsideHazards")]
		[HarmonyPostfix]
		private static void LoadNewGame(ref RoundManager __instance)
		{
			if (((NetworkBehaviour)__instance).IsHost)
			{
				if (ConfigManager.isSnowPileOutside.Value)
				{
					SpawnSnowPile(__instance);
				}
				if (ConfigManager.isSnowmanOutside.Value)
				{
					SpawnSnowman(__instance);
				}
			}
		}

		private static void SpawnSnowPile(RoundManager roundManager)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_00a9: 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)
			Random random = new Random();
			RaycastHit val = default(RaycastHit);
			for (int i = 0; i < random.Next(ConfigManager.minSnowPileOutside.Value, ConfigManager.maxSnowPileOutside.Value); i++)
			{
				GameObject[] outsideAINodes = roundManager.outsideAINodes;
				Vector3 position = outsideAINodes[random.Next(0, outsideAINodes.Length)].transform.position;
				position = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), random, -1) + Vector3.up;
				if (Physics.Raycast(position, Vector3.down, ref val, 5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
				{
					GameObject val2 = Object.Instantiate<GameObject>(SnowPlaygrounds.snowPileObj, ((RaycastHit)(ref val)).point + Vector3.down, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
					Transform transform = val2.transform;
					transform.localScale *= 2.5f;
					val2.GetComponent<NetworkObject>().Spawn(true);
				}
			}
		}

		private static void SpawnSnowman(RoundManager roundManager)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			Random random = new Random();
			RaycastHit val = default(RaycastHit);
			for (int i = 0; i < random.Next(ConfigManager.minSnowmanOutside.Value, ConfigManager.maxSnowmanOutside.Value); i++)
			{
				GameObject[] outsideAINodes = roundManager.outsideAINodes;
				Vector3 position = outsideAINodes[random.Next(0, outsideAINodes.Length)].transform.position;
				position = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), random, -1) + Vector3.up;
				if (Physics.Raycast(position, Vector3.down, ref val, 5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
				{
					GameObject val2 = Object.Instantiate<GameObject>(SnowPlaygrounds.snowmanObj, ((RaycastHit)(ref val)).point + Vector3.down * 0.5f, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
					NetworkObject component = val2.GetComponent<NetworkObject>();
					component.Spawn(true);
					SnowPlaygroundsNetworkManager.Instance.SpawnSnowmanClientRpc(NetworkObjectReference.op_Implicit(component), ConfigManager.amountSnowballToBuild.Value);
				}
			}
		}
	}
	internal class StartOfRoundPatch
	{
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyBefore(new string[] { "evaisa.lethallib" })]
		[HarmonyPostfix]
		private static void StartRound(ref StartOfRound __instance)
		{
			if (NetworkManager.Singleton.IsHost && (Object)(object)SnowPlaygroundsNetworkManager.Instance == (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(SnowPlaygrounds.managerPrefab, ((Component)__instance).transform.parent);
				val.GetComponent<NetworkObject>().Spawn(false);
				SnowPlaygrounds.mls.LogInfo((object)"Spawning SnowPlaygroundsNetworkManager");
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable()
		{
			SnowPlaygroundsNetworkManager.Instance = null;
		}
	}
}
namespace SnowPlaygrounds.Managers
{
	public class ConfigManager
	{
		public static ConfigEntry<bool> isSnowPileInside;

		public static ConfigEntry<int> minSnowPileInside;

		public static ConfigEntry<int> maxSnowPileInside;

		public static ConfigEntry<bool> isSnowPileOutside;

		public static ConfigEntry<int> minSnowPileOutside;

		public static ConfigEntry<int> maxSnowPileOutside;

		public static ConfigEntry<int> snowballAmount;

		public static ConfigEntry<float> snowballPushForce;

		public static ConfigEntry<float> snowballSlowdownDuration;

		public static ConfigEntry<float> snowballSlowdownFactor;

		public static ConfigEntry<bool> isSnowmanInside;

		public static ConfigEntry<int> minSnowmanInside;

		public static ConfigEntry<int> maxSnowmanInside;

		public static ConfigEntry<bool> isSnowmanOutside;

		public static ConfigEntry<int> minSnowmanOutside;

		public static ConfigEntry<int> maxSnowmanOutside;

		public static ConfigEntry<int> amountSnowballToBuild;

		public static ConfigEntry<float> snowmanSlowdownDuration;

		public static ConfigEntry<float> snowmanSlowdownFactor;

		public static void Load()
		{
			isSnowPileInside = SnowPlaygrounds.configFile.Bind<bool>("Snow Pile", "Can spawn inside", true, "Can Snow Pile spawn inside");
			minSnowPileInside = SnowPlaygrounds.configFile.Bind<int>("Snow Pile", "Min spawn inside", 5, "Min Snow Pile to spawn");
			maxSnowPileInside = SnowPlaygrounds.configFile.Bind<int>("Snow Pile", "Max spawn inside", 8, "Max Snow Pile to spawn");
			isSnowPileOutside = SnowPlaygrounds.configFile.Bind<bool>("Snow Pile", "Can spawn outside", true, "Can Snow Pile spawn outside");
			minSnowPileOutside = SnowPlaygrounds.configFile.Bind<int>("Snow Pile", "Min spawn outside", 2, "Min Snow Pile to spawn");
			maxSnowPileOutside = SnowPlaygrounds.configFile.Bind<int>("Snow Pile", "Max spawn outside", 4, "Max Snow Pile to spawn");
			snowballAmount = SnowPlaygrounds.configFile.Bind<int>("Snowball", "Amount", 5, "Amount of Snowball per slot");
			snowballPushForce = SnowPlaygrounds.configFile.Bind<float>("Snowball", "Push force", 1f, "Push force applied to target player");
			snowballSlowdownDuration = SnowPlaygrounds.configFile.Bind<float>("Snowball", "Slowdown duration", 1f, "Slowdown duration applied to targeted enemy");
			snowballSlowdownFactor = SnowPlaygrounds.configFile.Bind<float>("Snowball", "Slowdown factor", 3f, "Slowdown factor applied to targeted enemy");
			isSnowmanInside = SnowPlaygrounds.configFile.Bind<bool>("Snowman", "Can spawn inside", true, "Can Snowman spawn inside");
			minSnowmanInside = SnowPlaygrounds.configFile.Bind<int>("Snowman", "Min spawn inside", 2, "Min Snowman to spawn");
			maxSnowmanInside = SnowPlaygrounds.configFile.Bind<int>("Snowman", "Max spawn inside", 3, "Max Snowman to spawn");
			isSnowmanOutside = SnowPlaygrounds.configFile.Bind<bool>("Snowman", "Can spawn outside", true, "Can Snowman spawn outside");
			minSnowmanOutside = SnowPlaygrounds.configFile.Bind<int>("Snowman", "Min spawn outside", 1, "Min Snowman to spawn");
			maxSnowmanOutside = SnowPlaygrounds.configFile.Bind<int>("Snowman", "Max spawn outside", 3, "Max Snowman to spawn");
			amountSnowballToBuild = SnowPlaygrounds.configFile.Bind<int>("Snowman", "Amount snowball", 20, "Amout of Snowball required to build a Snowman");
			snowmanSlowdownDuration = SnowPlaygrounds.configFile.Bind<float>("Snowman", "Slowdown duration", 4f, "Slowdown duration applied to targeted enemy");
			snowmanSlowdownFactor = SnowPlaygrounds.configFile.Bind<float>("Snowman", "Slowdown factor", 3f, "Slowdown factor applied to targeted enemy");
		}
	}
	public class CustomPassManager : MonoBehaviour
	{
		public static FrozenCustomPass frozenPass;

		public static CustomPassVolume customPassVolume;

		public static Dictionary<EnemyAI, List<Renderer>> frozenEnemies = new Dictionary<EnemyAI, List<Renderer>>();

		public static CustomPassVolume CustomPassVolume
		{
			get
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)customPassVolume == (Object)null)
				{
					customPassVolume = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).gameObject.AddComponent<CustomPassVolume>();
					if ((Object)(object)customPassVolume != (Object)null)
					{
						customPassVolume.targetCamera = GameNetworkManager.Instance.localPlayerController.gameplayCamera;
						customPassVolume.injectionPoint = (CustomPassInjectionPoint)1;
						customPassVolume.isGlobal = true;
						frozenPass = new FrozenCustomPass();
						customPassVolume.customPasses.Add((CustomPass)(object)frozenPass);
					}
				}
				return customPassVolume;
			}
		}

		public static void SetupCustomPassForEnemy(EnemyAI enemy)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (frozenEnemies.ContainsKey(enemy))
			{
				return;
			}
			LayerMask frozenLayer = LayerMask.op_Implicit(524288);
			List<Renderer> list = (from r in ((Component)enemy).GetComponentsInChildren<Renderer>()
				where (LayerMask.op_Implicit(frozenLayer) & (1 << ((Component)r).gameObject.layer)) != 0
				select r).ToList();
			if (list.Any((Renderer r) => ((Object)r).name.Contains("LOD")))
			{
				list.RemoveAll((Renderer r) => !((Object)r).name.Contains("LOD"));
			}
			if (list == null || list.Count == 0)
			{
				SnowPlaygrounds.mls.LogError((object)("No renderer could be found on " + enemy.enemyType.enemyName + "."));
				return;
			}
			if ((Object)(object)CustomPassVolume == (Object)null)
			{
				SnowPlaygrounds.mls.LogError((object)"CustomPassVolume is not assigned.");
				return;
			}
			frozenPass = CustomPassVolume.customPasses.Find((CustomPass pass) => pass is FrozenCustomPass) as FrozenCustomPass;
			if (frozenPass == null)
			{
				SnowPlaygrounds.mls.LogError((object)"FrozenCustomPass could not be found in CustomPassVolume.");
				return;
			}
			frozenEnemies[enemy] = list;
			frozenPass.AddTargetRenderers(list.ToArray(), SnowPlaygrounds.frozenShader);
		}

		public static void RemoveAura(EnemyAI enemy)
		{
			if (frozenEnemies.ContainsKey(enemy))
			{
				frozenPass.RemoveTargetRenderers(frozenEnemies[enemy]);
				frozenEnemies.Remove(enemy);
			}
		}
	}
	public class SnowPlaygroundsNetworkManager : NetworkBehaviour
	{
		public static SnowPlaygroundsNetworkManager Instance;

		public void Awake()
		{
			Instance = this;
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnSnowmanServerRpc(NetworkObjectReference obj, Vector3 position)
		{
			//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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: 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(4156459071u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4156459071u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
			{
				Snowball snowball = ((Component)val3).gameObject.GetComponentInChildren<GrabbableObject>() as Snowball;
				RaycastHit val4 = default(RaycastHit);
				if (Physics.Raycast(position, Vector3.down, ref val4, 5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
				{
					GameObject val5 = Object.Instantiate<GameObject>(SnowPlaygrounds.snowmanObj, ((RaycastHit)(ref val4)).point + Vector3.down * 0.5f, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
					val5.transform.localScale = Constants.SNOWMAN_SCALE / (float)ConfigManager.amountSnowballToBuild.Value * (float)snowball.currentStackedItems;
					NetworkObject component = val5.GetComponent<NetworkObject>();
					component.Spawn(true);
					SpawnSnowmanClientRpc(NetworkObjectReference.op_Implicit(component), snowball.currentStackedItems);
					DestroyObjectClientRpc(obj);
				}
			}
		}

		[ClientRpc]
		public void SpawnSnowmanClientRpc(NetworkObjectReference obj, int nbSnowball)
		{
			//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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(33059619u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, nbSnowball);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 33059619u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
				{
					Snowman componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<Snowman>();
					componentInChildren.currentStackedSnowball = nbSnowball;
					componentInChildren.RefreshHoverTip();
				}
			}
		}

		[ClientRpc]
		private void DestroyObjectClientRpc(NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3744428089u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3744428089u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
			{
				GrabbableObject componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<GrabbableObject>();
				if (componentInChildren is Snowball snowball)
				{
					snowball.isThrown = true;
				}
				componentInChildren.DestroyObjectInHand(componentInChildren.playerHeldBy);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SnowPlaygroundsNetworkManager()
		{
			//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
			NetworkManager.__rpc_func_table.Add(4156459071u, new RpcReceiveHandler(__rpc_handler_4156459071));
			NetworkManager.__rpc_func_table.Add(33059619u, new RpcReceiveHandler(__rpc_handler_33059619));
			NetworkManager.__rpc_func_table.Add(3744428089u, new RpcReceiveHandler(__rpc_handler_3744428089));
		}

		private static void __rpc_handler_4156459071(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SnowPlaygroundsNetworkManager)(object)target).SpawnSnowmanServerRpc(obj, position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_33059619(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_005c: 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)
			{
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				int nbSnowball = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref nbSnowball);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SnowPlaygroundsNetworkManager)(object)target).SpawnSnowmanClientRpc(obj, nbSnowball);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SnowPlaygroundsNetworkManager";
		}
	}
}
namespace SnowPlaygrounds.Behaviours
{
	public class EnemyFreezeBehaviour : MonoBehaviour
	{
		public EnemyAI enemy;

		public Coroutine freezeCoroutine;

		public float originalSpeed;

		public float slowedSpeed;

		public void StartFreeze(float duration, float slowdownFactor)
		{
			if (freezeCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(freezeCoroutine);
			}
			freezeCoroutine = ((MonoBehaviour)this).StartCoroutine(FreezeCoroutine(duration, slowdownFactor));
		}

		private IEnumerator FreezeCoroutine(float duration, float slowdownFactor)
		{
			if ((Object)(object)enemy != (Object)null)
			{
				originalSpeed = enemy.agent.speed;
				slowedSpeed = enemy.agent.speed / slowdownFactor;
				CustomPassManager.SetupCustomPassForEnemy(enemy);
				yield return (object)new WaitForSeconds(duration);
				CustomPassManager.RemoveAura(enemy);
			}
			freezeCoroutine = null;
		}

		private void LateUpdate()
		{
			if (freezeCoroutine != null && (Object)(object)enemy != (Object)null)
			{
				enemy.agent.speed = slowedSpeed;
				EnemyAI obj = enemy;
				SandSpiderAI val = (SandSpiderAI)(object)((obj is SandSpiderAI) ? obj : null);
				if (val != null)
				{
					val.spiderSpeed = slowedSpeed;
				}
			}
		}
	}
	public class FrozenCustomPass : CustomPass
	{
		public Dictionary<Renderer, Material> rendererMaterials = new Dictionary<Renderer, Material>();

		public void AddTargetRenderers(Renderer[] renderers, Material material)
		{
			foreach (Renderer key in renderers)
			{
				if (!rendererMaterials.ContainsKey(key))
				{
					rendererMaterials[key] = material;
				}
			}
		}

		public void RemoveTargetRenderers(List<Renderer> renderers)
		{
			foreach (Renderer renderer in renderers)
			{
				rendererMaterials.Remove(renderer);
			}
		}

		public override void Execute(CustomPassContext ctx)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<Renderer, Material> rendererMaterial in rendererMaterials)
			{
				Renderer key = rendererMaterial.Key;
				Material value = rendererMaterial.Value;
				if (!((Object)(object)key == (Object)null) && key.sharedMaterials != null)
				{
					for (int i = 0; i < key.sharedMaterials.Length; i++)
					{
						ctx.cmd.DrawRenderer(key, value);
					}
				}
			}
		}
	}
}
namespace SnowPlaygrounds.Behaviours.MapObjects
{
	public class Snowman : NetworkBehaviour
	{
		public InteractTrigger snowmanTrigger;

		public Camera camera;

		public Transform cameraPivot;

		public int currentStackedSnowball;

		public bool isPlayerHiding;

		public PlayerControllerB hidingPlayer;

		public void SnowmanInteraction()
		{
			if (currentStackedSnowball < ConfigManager.amountSnowballToBuild.Value)
			{
				BuildSnowman();
			}
			else
			{
				EnterSnowmanServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
			}
		}

		public void BuildSnowman()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			int num = 0;
			for (int i = 0; i < localPlayerController.ItemSlots.Length; i++)
			{
				GrabbableObject val = localPlayerController.ItemSlots[i];
				if (!((Object)(object)val == (Object)null) && val is Snowball snowball)
				{
					num += snowball.currentStackedItems;
					localPlayerController.DestroyItemInSlotAndSync(i);
				}
			}
			if (num > 0)
			{
				BuildSnowmanServerRpc(num);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void BuildSnowmanServerRpc(int nbSnowball)
		{
			//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(250282495u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, nbSnowball);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 250282495u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					BuildSnowmanClientRpc(nbSnowball);
				}
			}
		}

		[ClientRpc]
		public void BuildSnowmanClientRpc(int nbSnowball)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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)
			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(582671939u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, nbSnowball);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 582671939u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				currentStackedSnowball += nbSnowball;
				if (currentStackedSnowball < ConfigManager.amountSnowballToBuild.Value)
				{
					((Component)this).gameObject.transform.localScale = Constants.SNOWMAN_SCALE / (float)ConfigManager.amountSnowballToBuild.Value * (float)currentStackedSnowball;
				}
				else
				{
					((Component)this).gameObject.transform.localScale = Constants.SNOWMAN_SCALE;
				}
				RefreshHoverTip();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void EnterSnowmanServerRpc(int playerId)
		{
			//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(1632170201u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1632170201u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					EnterSnowmanClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		public void EnterSnowmanClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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(3258798334u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3258798334u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
				component.DropAllHeldItemsAndSync();
				isPlayerHiding = true;
				hidingPlayer = component;
				((Component)this).transform.SetParent(((Component)component).transform);
				((Component)this).transform.position = ((Component)component).transform.position;
				((Component)this).transform.rotation = ((Component)component).transform.rotation;
				if ((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					((Behaviour)camera).enabled = true;
					StartOfRound.Instance.SwitchCamera(camera);
					SPUtilities.SetUntargetable(component);
					IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).Disable();
					IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false).Disable();
					IngamePlayerSettings.Instance.playerInput.actions.FindAction("Crouch", false).Disable();
				}
			}
		}

		public void ExitSnowman()
		{
			SPUtilities.StartTargetable(GameNetworkManager.Instance.localPlayerController, ConfigManager.snowmanSlowdownDuration.Value);
			ExitSnowmanServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
		}

		[ServerRpc(RequireOwnership = false)]
		public void ExitSnowmanServerRpc(int playerId)
		{
			//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(1399882726u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1399882726u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ExitSnowmanClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		public void ExitSnowmanClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(430531836u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 430531836u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
				((Component)this).transform.SetParent((Transform)null);
				if ((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					StartOfRound.Instance.SwitchCamera(component.gameplayCamera);
					((Behaviour)camera).enabled = false;
					IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).Enable();
					IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false).Enable();
					IngamePlayerSettings.Instance.playerInput.actions.FindAction("Crouch", false).Enable();
				}
				PlaySnowParticle();
				PlaySnowPoof();
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public void PlaySnowParticle()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(SnowPlaygrounds.snowmanParticle, ((Component)this).transform.position + Vector3.up * 2.5f, Quaternion.identity);
			ParticleSystem component = val.GetComponent<ParticleSystem>();
			MainModule main = component.main;
			float duration = ((MainModule)(ref main)).duration;
			main = component.main;
			MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
			Object.Destroy((Object)(object)val, duration + ((MinMaxCurve)(ref startLifetime)).constantMax);
		}

		public void PlaySnowPoof()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(SnowPlaygrounds.snowmanAudio, ((Component)this).transform.position + Vector3.up * 2.5f, Quaternion.identity);
			AudioSource component = val.GetComponent<AudioSource>();
			Object.Destroy((Object)(object)val, component.clip.length);
		}

		private void OnTriggerEnter(Collider other)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)other == (Object)null) && isPlayerHiding)
			{
				EnemyAICollisionDetect component = ((Component)other).GetComponent<EnemyAICollisionDetect>();
				if ((Object)(object)component != (Object)null)
				{
					FreezeEnemyServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)component.mainScript).NetworkObject));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void FreezeEnemyServerRpc(NetworkObjectReference enemyObject)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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(262410415u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 262410415u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					FreezeEnemyClientRpc(enemyObject);
				}
			}
		}

		[ClientRpc]
		public void FreezeEnemyClientRpc(NetworkObjectReference enemyObject)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2473326800u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2473326800u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkObjectReference)(ref enemyObject)).TryGet(ref val3, (NetworkManager)null))
			{
				return;
			}
			EnemyAI componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<EnemyAI>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				if ((Object)(object)hidingPlayer != (Object)null && (Object)(object)hidingPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					ExitSnowman();
				}
				SPUtilities.StartFreezeEnemy(componentInChildren, ConfigManager.snowmanSlowdownDuration.Value, ConfigManager.snowmanSlowdownFactor.Value);
			}
		}

		public void RefreshHoverTip()
		{
			if (currentStackedSnowball < ConfigManager.amountSnowballToBuild.Value)
			{
				snowmanTrigger.hoverTip = $"Add snowball {currentStackedSnowball}/{ConfigManager.amountSnowballToBuild.Value} : [LMB]";
			}
			else
			{
				snowmanTrigger.hoverTip = "Enter : [LMB]";
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Snowman()
		{
			//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(250282495u, new RpcReceiveHandler(__rpc_handler_250282495));
			NetworkManager.__rpc_func_table.Add(582671939u, new RpcReceiveHandler(__rpc_handler_582671939));
			NetworkManager.__rpc_func_table.Add(1632170201u, new RpcReceiveHandler(__rpc_handler_1632170201));
			NetworkManager.__rpc_func_table.Add(3258798334u, new RpcReceiveHandler(__rpc_handler_3258798334));
			NetworkManager.__rpc_func_table.Add(1399882726u, new RpcReceiveHandler(__rpc_handler_1399882726));
			NetworkManager.__rpc_func_table.Add(430531836u, new RpcReceiveHandler(__rpc_handler_430531836));
			NetworkManager.__rpc_func_table.Add(262410415u, new RpcReceiveHandler(__rpc_handler_262410415));
			NetworkManager.__rpc_func_table.Add(2473326800u, new RpcReceiveHandler(__rpc_handler_2473326800));
		}

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

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

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

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

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

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

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "Snowman";
		}
	}
	public class SnowPile : NetworkBehaviour
	{
		public InteractTrigger trigger;

		public void GrabSnowballs()
		{
			ForceGrabObjectServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
		}

		[ServerRpc(RequireOwnership = false)]
		public void ForceGrabObjectServerRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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(1991341412u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1991341412u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			try
			{
				PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
				GameObject val3 = Object.Instantiate<GameObject>(SnowPlaygrounds.snowballObj, ((Component)component).transform.position, Quaternion.identity, StartOfRound.Instance.propsContainer);
				GrabbableObject component2 = val3.GetComponent<GrabbableObject>();
				component2.fallTime = 0f;
				NetworkObject component3 = val3.GetComponent<NetworkObject>();
				component3.Spawn(false);
				ForceGrabObjectClientRpc(NetworkObjectReference.op_Implicit(component3), playerId);
			}
			catch (Exception arg)
			{
				SnowPlaygrounds.mls.LogError((object)$"Error in ForceGrabObjectServerRpc: {arg}");
			}
		}

		[ClientRpc]
		public void ForceGrabObjectClientRpc(NetworkObjectReference obj, int playerId)
		{
			//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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2461744648u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2461744648u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
			{
				Snowball snowball = ((Component)val3).gameObject.GetComponentInChildren<GrabbableObject>() as Snowball;
				((GrabbableObject)snowball).Start();
				PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					GrabObject(snowball, component);
				}
			}
		}

		public void GrabObject(Snowball snowball, PlayerControllerB player)
		{
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			player.currentlyGrabbingObject = (GrabbableObject)(object)snowball;
			player.grabInvalidated = false;
			player.currentlyGrabbingObject.InteractItem();
			if (player.currentlyGrabbingObject.grabbable && player.FirstEmptyItemSlot() != -1)
			{
				player.playerBodyAnimator.SetBool("GrabInvalidated", false);
				player.playerBodyAnimator.SetBool("GrabValidated", false);
				player.playerBodyAnimator.SetBool("cancelHolding", false);
				player.playerBodyAnimator.ResetTrigger("Throw");
				player.SetSpecialGrabAnimationBool(true, (GrabbableObject)null);
				player.isGrabbingObjectAnimation = true;
				player.carryWeight = Mathf.Clamp(player.carryWeight + (player.currentlyGrabbingObject.itemProperties.weight - 1f), 1f, 10f);
				player.grabObjectAnimationTime = ((player.currentlyGrabbingObject.itemProperties.grabAnimationTime > 0f) ? player.currentlyGrabbingObject.itemProperties.grabAnimationTime : 0.4f);
				if (!player.isTestingPlayer)
				{
					player.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)player.currentlyGrabbingObject).NetworkObject));
				}
				if (player.grabObjectCoroutine != null)
				{
					((MonoBehaviour)player).StopCoroutine(player.grabObjectCoroutine);
				}
				player.grabObjectCoroutine = ((MonoBehaviour)player).StartCoroutine(player.GrabObject());
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SnowPile()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1991341412u, new RpcReceiveHandler(__rpc_handler_1991341412));
			NetworkManager.__rpc_func_table.Add(2461744648u, new RpcReceiveHandler(__rpc_handler_2461744648));
		}

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

		private static void __rpc_handler_2461744648(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_005c: 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)
			{
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SnowPile)(object)target).ForceGrabObjectClientRpc(obj, playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SnowPile";
		}
	}
}
namespace SnowPlaygrounds.Behaviours.Items
{
	public class Snowball : PhysicsProp
	{
		public int currentStackedItems = ConfigManager.snowballAmount.Value;

		public Rigidbody rigidbody;

		public AudioSource snowPoof;

		public bool isThrown;

		public PlayerControllerB throwingPlayer;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if ((Object)(object)rigidbody == (Object)null)
			{
				rigidbody = ((Component)this).GetComponent<Rigidbody>();
			}
			if ((Object)(object)rigidbody == (Object)null)
			{
				SnowPlaygrounds.mls.LogError((object)"Rigidbody is not assigned and could not be found in children.");
			}
			if ((Object)(object)snowPoof == (Object)null)
			{
				snowPoof = ((Component)this).GetComponent<AudioSource>();
			}
			if ((Object)(object)snowPoof == (Object)null)
			{
				SnowPlaygrounds.mls.LogError((object)"SnowPoof is not assigned and could not be found.");
			}
		}

		public override void Update()
		{
			if (!isThrown)
			{
				((GrabbableObject)this).Update();
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				ThrowSnowballServerRpc();
			}
		}

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

		[ClientRpc]
		public void DropSnowballClientRpc(int playerId, NetworkObjectReference obj)
		{
			//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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: 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(80980208u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 80980208u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Snowball snowball = InitializeSnowballToThrow(obj);
			if ((Object)(object)snowball != (Object)null)
			{
				PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
				if (component.isInElevator)
				{
					((Component)snowball).transform.SetParent(component.playersManager.elevatorTransform, true);
				}
				if (Object.op_Implicit((Object)(object)((Component)snowball).transform.parent))
				{
					((GrabbableObject)snowball).startFallingPosition = ((Component)snowball).transform.parent.InverseTransformPoint(((GrabbableObject)snowball).startFallingPosition);
				}
				((GrabbableObject)snowball).FallToGround(false);
				((MonoBehaviour)snowball).StartCoroutine(snowball.DetectGroundAndWalls());
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ThrowSnowballServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1708178138u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1708178138u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ThrowSnowballClientRpc(NetworkObjectReference.op_Implicit(InstantiateSnowballToThrow()));
				}
			}
		}

		[ClientRpc]
		public void ThrowSnowballClientRpc(NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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(3605401409u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3605401409u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Snowball snowball = InitializeSnowballToThrow(obj);
			if ((Object)(object)snowball != (Object)null)
			{
				Vector3 val3 = ((Component)snowball.throwingPlayer.gameplayCamera).transform.forward;
				float num = -0.07f;
				if (val3.y < num)
				{
					Vector3 val4 = new Vector3(val3.x, num, val3.z);
					val3 = ((Vector3)(ref val4)).normalized;
				}
				Vector3 val5 = val3 * 30f;
				Vector3 val6 = default(Vector3);
				((Vector3)(ref val6))..ctor(0f, 3f, 0f);
				snowball.rigidbody.velocity = Vector3.zero;
				snowball.rigidbody.AddForce(val5, (ForceMode)2);
				snowball.rigidbody.AddForce(val6, (ForceMode)2);
				((MonoBehaviour)snowball).StartCoroutine(snowball.DetectGroundAndWalls());
			}
		}

		public NetworkObject InstantiateSnowballToThrow()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			NetworkObject component;
			if (currentStackedItems > 1)
			{
				GameObject val = Object.Instantiate<GameObject>(SnowPlaygrounds.snowballObj, ((Component)this).transform.position, Quaternion.identity, StartOfRound.Instance.propsContainer);
				component = val.GetComponent<NetworkObject>();
				component.Spawn(false);
				currentStackedItems--;
			}
			else
			{
				component = ((Component)this).GetComponent<NetworkObject>();
			}
			return component;
		}

		public Snowball InitializeSnowballToThrow(NetworkObjectReference obj)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			Snowball snowball = null;
			NetworkObject val = default(NetworkObject);
			if (((NetworkObjectReference)(ref obj)).TryGet(ref val, (NetworkManager)null))
			{
				snowball = ((Component)val).gameObject.GetComponentInChildren<GrabbableObject>() as Snowball;
				((GrabbableObject)snowball).Start();
				snowball.isThrown = true;
				snowball.throwingPlayer = ((GrabbableObject)this).playerHeldBy;
				if (((GrabbableObject)snowball).isHeld)
				{
					snowball.throwingPlayer.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
				}
				((Component)snowball).transform.position = ((Component)snowball.throwingPlayer).transform.position + Vector3.up * 1.5f;
				((GrabbableObject)snowball).startFallingPosition = ((Component)snowball).transform.position;
			}
			return snowball;
		}

		public IEnumerator DetectGroundAndWalls()
		{
			RaycastHit val = default(RaycastHit);
			while (isThrown)
			{
				if (Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, 0.25f, 605030721, (QueryTriggerInteraction)2))
				{
					ApplyDecalServerRpc(((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal);
					break;
				}
				yield return null;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ApplyDecalServerRpc(Vector3 point, Vector3 normal)
		{
			//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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3259599938u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref point);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref normal);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3259599938u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ApplyDecalClientRpc(point, normal);
				}
			}
		}

		[ClientRpc]
		public void ApplyDecalClientRpc(Vector3 point, Vector3 normal)
		{
			//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_0096: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3640875466u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref point);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref normal);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3640875466u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					GameObject val3 = Object.Instantiate<GameObject>(SnowPlaygrounds.snowballDecal);
					val3.transform.posi