Decompiled source of Millenium Winterland v1.1.0

SlopCrew.Server.XmasEvent.Common.dll

Decompiled 10 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("SlopCrew.Server.XmasEvent.Common")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3fa4f9a5baab184c4664e5d8d813add8410e890c")]
[assembly: AssemblyProduct("SlopCrew.Server.XmasEvent.Common")]
[assembly: AssemblyTitle("SlopCrew.Server.XmasEvent.Common")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SlopCrew.Server.XmasEvent
{
	[Serializable]
	public class XmasClientCollectGiftPacket : XmasPacket
	{
		public const string PacketId = "Xmas-Client-CollectGift";

		public bool IgnoreCooldown = false;

		protected override uint LatestVersion => 1u;

		public override string GetPacketId()
		{
			return "Xmas-Client-CollectGift";
		}

		protected override void Read(BinaryReader reader)
		{
			IgnoreCooldown = reader.ReadBoolean();
		}

		protected override void Write(BinaryWriter writer)
		{
			writer.Write(IgnoreCooldown);
		}

		public override string Describe()
		{
			return base.Describe() + $" IgnoreCooldown={IgnoreCooldown}";
		}
	}
	[Serializable]
	public class XmasClientModifyEventStatePacket : XmasPacket
	{
		public const string PacketId = "Xmas-Client-ModifyEventState";

		public List<XmasPhaseModifications> PhaseModifications = new List<XmasPhaseModifications>();

		protected override uint LatestVersion => 1u;

		public override string GetPacketId()
		{
			return "Xmas-Client-ModifyEventState";
		}

		protected override void Write(BinaryWriter writer)
		{
			writer.Write((ushort)PhaseModifications.Count);
			foreach (XmasPhaseModifications phaseModification in PhaseModifications)
			{
				phaseModification.Write(writer);
			}
		}

		protected override void Read(BinaryReader reader)
		{
			uint version = Version;
			uint num = version;
			if (num == 1)
			{
				PhaseModifications = new List<XmasPhaseModifications>();
				ushort num2 = reader.ReadUInt16();
				for (int i = 0; i < num2; i++)
				{
					XmasPhaseModifications item = new XmasPhaseModifications();
					item.Read(reader);
					PhaseModifications.Add(item);
				}
			}
			else
			{
				UnexpectedVersion();
			}
		}

		public override string Describe()
		{
			string text = base.Describe() + "\n";
			for (int i = 0; i < PhaseModifications.Count; i++)
			{
				XmasPhaseModifications xmasPhaseModifications = PhaseModifications[i];
				text += $"Phase {i}: ";
				if (xmasPhaseModifications.ModifyActive)
				{
					text += string.Format("{0}={1} ", "Active", xmasPhaseModifications.Phase.Active);
				}
				if (xmasPhaseModifications.ModifyGiftsCollected)
				{
					text += string.Format("{0}={1} ", "GiftsCollected", xmasPhaseModifications.Phase.GiftsCollected);
				}
				if (xmasPhaseModifications.ModifyGiftsGoal)
				{
					text += string.Format("{0}={1} ", "GiftsGoal", xmasPhaseModifications.Phase.GiftsGoal);
				}
				if (xmasPhaseModifications.ModifyActivatePhaseAutomatically)
				{
					text += string.Format("{0}Active={1} ", "ActivateNextPhaseAutomatically", xmasPhaseModifications.Phase.ActivateNextPhaseAutomatically);
				}
				text += "\n";
			}
			return text;
		}
	}
	[Serializable]
	public struct XmasPhaseModifications
	{
		public bool ModifyActive;

		public bool ModifyGiftsCollected;

		public bool ModifyGiftsGoal;

		public bool ModifyActivatePhaseAutomatically;

		public XmasPhase Phase;

		public XmasPhaseModifications()
		{
			ModifyActive = false;
			ModifyGiftsCollected = false;
			ModifyGiftsGoal = false;
			ModifyActivatePhaseAutomatically = false;
			Phase = new XmasPhase();
		}

		public void Write(BinaryWriter writer)
		{
			writer.Write(ModifyActive);
			writer.Write(ModifyGiftsCollected);
			writer.Write(ModifyGiftsGoal);
			writer.Write(ModifyActivatePhaseAutomatically);
			Phase.Write(writer);
		}

		public void Read(BinaryReader reader)
		{
			ModifyActive = reader.ReadBoolean();
			ModifyGiftsCollected = reader.ReadBoolean();
			ModifyGiftsGoal = reader.ReadBoolean();
			ModifyActivatePhaseAutomatically = reader.ReadBoolean();
			Phase.Read(reader);
		}
	}
	[Serializable]
	public class XmasServerAcceptGiftPacket : XmasPacket
	{
		public const string PacketId = "Xmas-Server-AcceptGift";

		protected override uint LatestVersion => 1u;

		public override string GetPacketId()
		{
			return "Xmas-Server-AcceptGift";
		}

		protected override void Read(BinaryReader reader)
		{
		}

		protected override void Write(BinaryWriter writer)
		{
		}
	}
	[Serializable]
	public class XmasServerEventStatePacket : XmasPacket
	{
		public const string PacketId = "Xmas-Server-EventState";

		public List<XmasPhase> Phases = new List<XmasPhase>();

		protected override uint LatestVersion => 1u;

		public override string GetPacketId()
		{
			return "Xmas-Server-EventState";
		}

		protected override void Write(BinaryWriter writer)
		{
			writer.Write((ushort)Phases.Count);
			foreach (XmasPhase phase in Phases)
			{
				phase.Write(writer);
			}
		}

		protected override void Read(BinaryReader reader)
		{
			uint version = Version;
			uint num = version;
			if (num == 1)
			{
				Phases = new List<XmasPhase>();
				ushort num2 = reader.ReadUInt16();
				for (int i = 0; i < num2; i++)
				{
					XmasPhase xmasPhase = new XmasPhase();
					xmasPhase.Read(reader);
					Phases.Add(xmasPhase);
				}
			}
			else
			{
				UnexpectedVersion();
			}
		}

		public XmasServerEventStatePacket Clone()
		{
			XmasServerEventStatePacket xmasServerEventStatePacket = new XmasServerEventStatePacket();
			xmasServerEventStatePacket.PlayerID = PlayerID;
			xmasServerEventStatePacket.Version = Version;
			xmasServerEventStatePacket.Phases = new List<XmasPhase>();
			foreach (XmasPhase phase in Phases)
			{
				xmasServerEventStatePacket.Phases.Add(phase.Clone());
			}
			return xmasServerEventStatePacket;
		}

		public override string Describe()
		{
			return base.Describe() + "\n" + DescribeWithoutPacketInfo();
		}

		public string DescribeWithoutPacketInfo()
		{
			string text = "";
			for (int i = 0; i < Phases.Count; i++)
			{
				XmasPhase xmasPhase = Phases[i];
				text += $"Phase#{i}: ";
				text += $"{xmasPhase.GiftsCollected}/{xmasPhase.GiftsGoal} gifts ";
				if (xmasPhase.Active)
				{
					text += "Active ";
				}
				if (xmasPhase.ActivateNextPhaseAutomatically)
				{
					text += "ActivateNextPhaseAutomatically ";
				}
				text += "\n";
			}
			return text;
		}
	}
	[Serializable]
	public class XmasPhase
	{
		public bool Active = false;

		public uint GiftsCollected = 0u;

		public uint GiftsGoal = 1u;

		public bool ActivateNextPhaseAutomatically = false;

		public void Write(BinaryWriter writer)
		{
			writer.Write(Active);
			writer.Write((ushort)GiftsCollected);
			writer.Write((ushort)GiftsGoal);
			writer.Write(ActivateNextPhaseAutomatically);
		}

		public void Read(BinaryReader reader)
		{
			Active = reader.ReadBoolean();
			GiftsCollected = reader.ReadUInt16();
			GiftsGoal = reader.ReadUInt16();
			ActivateNextPhaseAutomatically = reader.ReadBoolean();
		}

		public XmasPhase Clone()
		{
			XmasPhase xmasPhase = new XmasPhase();
			xmasPhase.Active = Active;
			xmasPhase.GiftsCollected = GiftsCollected;
			xmasPhase.GiftsGoal = GiftsGoal;
			xmasPhase.ActivateNextPhaseAutomatically = ActivateNextPhaseAutomatically;
			return xmasPhase;
		}
	}
	[Serializable]
	public class XmasServerRejectGiftPacket : XmasPacket
	{
		public const string PacketId = "Xmas-Server-RejectGift";

		protected override uint LatestVersion => 1u;

		public override string GetPacketId()
		{
			return "Xmas-Server-RejectGift";
		}

		protected override void Read(BinaryReader reader)
		{
		}

		protected override void Write(BinaryWriter writer)
		{
		}
	}
	public abstract class XmasPacket
	{
		public uint? PlayerID;

		public uint Version;

		protected abstract uint LatestVersion { get; }

		public abstract string GetPacketId();

		public XmasPacket()
		{
			Version = LatestVersion;
		}

		public byte[] Serialize()
		{
			MemoryStream memoryStream = new MemoryStream();
			using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream, Encoding.UTF8, leaveOpen: false))
			{
				binaryWriter.Write((ushort)Version);
				Write(binaryWriter);
			}
			return memoryStream.ToArray();
		}

		protected virtual void Write(BinaryWriter writer)
		{
			throw new NotImplementedException();
		}

		public void Deserialize(byte[] data)
		{
			MemoryStream input = new MemoryStream(data, writable: false);
			using BinaryReader binaryReader = new BinaryReader(input, Encoding.UTF8);
			Version = binaryReader.ReadUInt16();
			Read(binaryReader);
		}

		protected virtual void Read(BinaryReader reader)
		{
			throw new NotImplementedException();
		}

		protected void UnexpectedVersion()
		{
			throw new XmasPacketParseException($"Got packet with unexpected version: {GetType().Name} {Version}");
		}

		public virtual string Describe()
		{
			string name = GetType().Name;
			return name + $" Version={Version} PlayerID={PlayerID}";
		}
	}
	public class XmasPacketParseException : Exception
	{
		public XmasPacketParseException(string message)
			: base(message)
		{
		}
	}
	public static class XmasPacketFactory
	{
		public static XmasPacket? ParsePacket(uint playerID, string id, byte[] data)
		{
			XmasPacket xmasPacket = CreatePacketFromID(id);
			if (xmasPacket != null)
			{
				xmasPacket.PlayerID = playerID;
				xmasPacket.Deserialize(data);
			}
			return xmasPacket;
		}

		public static XmasPacket? CreatePacketFromID(string id)
		{
			return id switch
			{
				"Xmas-Client-CollectGift" => new XmasClientCollectGiftPacket(), 
				"Xmas-Server-AcceptGift" => new XmasServerAcceptGiftPacket(), 
				"Xmas-Server-RejectGift" => new XmasServerRejectGiftPacket(), 
				"Xmas-Server-EventState" => new XmasServerEventStatePacket(), 
				"Xmas-Client-ModifyEventState" => new XmasClientModifyEventStatePacket(), 
				_ => null, 
			};
		}
	}
}

Winterland.Common.dll

Decompiled 10 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CommonAPI;
using CommonAPI.Phone;
using CrewBoomAPI;
using DG.Tweening;
using Microsoft.CodeAnalysis;
using Reptile;
using SlopCrew.API;
using SlopCrew.Server.XmasEvent;
using TMPro;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.UI;
using Winterland.Common;
using Winterland.Common.Challenge;
using Winterland.Common.Phone;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Winterland.Common")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Common code for Millenium Winterland.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d57e729790290875d5daaef4022962c64d26f632")]
[assembly: AssemblyProduct("Winterland.Common")]
[assembly: AssemblyTitle("Winterland.Common")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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;
		}
	}
}
internal class EffectSpawner : MonoBehaviour
{
	public GameObject prefab;

	public string prefabAssetBundle;

	public string prefabAssetPath;

	public float playbackSpeed = 1f;

	public bool spawnParentedToMe = true;

	private bool spawnNextFrame;

	private void Awake()
	{
		if ((Object)(object)prefab == (Object)null)
		{
			prefab = Core.Instance.Assets.LoadAssetFromBundle<GameObject>(prefabAssetBundle, prefabAssetPath);
		}
	}

	private void OnEnable()
	{
		TreeController componentInParent = ((Component)this).GetComponentInParent<TreeController>();
		if ((Object)(object)componentInParent == (Object)null || !componentInParent.IsFastForwarding)
		{
			spawnNextFrame = true;
		}
	}

	private void OnDisable()
	{
		spawnNextFrame = false;
	}

	private void FixedUpdate()
	{
		if (spawnNextFrame)
		{
			spawnNextFrame = false;
			SpawnEffect();
		}
	}

	private void SpawnEffect()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: 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)
		GameObject val;
		if (spawnParentedToMe)
		{
			val = Object.Instantiate<GameObject>(prefab, ((Component)this).transform);
		}
		else
		{
			val = Object.Instantiate<GameObject>(prefab);
			val.transform.position = ((Component)this).transform.position;
			val.transform.rotation = ((Component)this).transform.rotation;
			val.transform.localScale = ((Component)this).transform.localScale;
		}
		Animation anim = val.GetComponent<OneOffVisualEffect>().anim;
		anim[((Object)anim.clip).name].speed = playbackSpeed;
	}
}
internal class SetAnimatorParameters : MonoBehaviour
{
	[SerializeField]
	private Animator animator;

	[SerializeField]
	private List<string> boolsToSet = new List<string>();

	private void OnValidate()
	{
		if ((Object)(object)animator == (Object)null)
		{
			animator = ((Component)this).GetComponent<Animator>();
		}
	}

	private void Awake()
	{
		setParams();
	}

	private void OnEnable()
	{
		setParams();
	}

	private void setParams()
	{
		foreach (string item in boolsToSet)
		{
			animator.SetBoolString(item, true);
		}
	}
}
internal class GiftConveyorBelt : MonoBehaviour
{
	public GameObject GiftLogicPrefab;

	public float spawnMinInterval = 0.5f;

	public float spawnMaxInterval = 0.75f;

	public float spawnMinYRot = -45f;

	public float spawnMaxYRot = 45f;

	public float spawnMinScale = 0.7f;

	public float spawnMaxScale = 1.3f;

	private Coroutine animCoro;

	public Transform waypointParent;

	public Transform[] waypoints;

	public float movementSpeed;

	public Transform giftVisualsPrefabParent;

	public Transform[] giftVisualsPrefabs;

	private float[] timeBetweenWaypoints;

	public float[] TimeBetweenWaypoints => timeBetweenWaypoints;

	private void OnValidate()
	{
		waypoints = TransformExtentions.GetAllChildren(waypointParent);
		giftVisualsPrefabs = TransformExtentions.GetAllChildren(giftVisualsPrefabParent);
	}

	private void Awake()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		timeBetweenWaypoints = new float[waypoints.Length - 1];
		for (int i = 0; i < waypoints.Length - 1; i++)
		{
			timeBetweenWaypoints[i] = Vector3.Distance(waypoints[i].position, waypoints[i + 1].position) / movementSpeed;
		}
		Transform[] array = waypoints;
		for (int j = 0; j < array.Length; j++)
		{
			Object.Destroy((Object)(object)array[j].GetChild(0));
		}
		GiftLogicPrefab.SetActive(false);
		((Component)waypointParent).gameObject.SetActive(false);
		((Component)giftVisualsPrefabParent).gameObject.SetActive(false);
	}

	private void OnEnable()
	{
		animCoro = ((MonoBehaviour)this).StartCoroutine(Animation());
	}

	private void OnDisable()
	{
		if (animCoro != null)
		{
			((MonoBehaviour)this).StopCoroutine(animCoro);
			animCoro = null;
		}
	}

	private IEnumerator Animation()
	{
		while (true)
		{
			yield return (object)new WaitForSeconds(Random.Range(spawnMinInterval, spawnMaxInterval));
			GameObject obj = Object.Instantiate<GameObject>(GiftLogicPrefab);
			GiftConveyorBeltGift component = obj.GetComponent<GiftConveyorBeltGift>();
			obj.SetActive(true);
			component.Init(this, ((Component)giftVisualsPrefabs[Random.Range(0, giftVisualsPrefabs.Length)]).gameObject, Random.Range(spawnMinYRot, spawnMaxYRot), new Vector3(Random.Range(spawnMinScale, spawnMaxScale), Random.Range(spawnMinScale, spawnMaxScale), Random.Range(spawnMinScale, spawnMaxScale)));
		}
	}
}
internal class GiftConveyorBeltGift : MonoBehaviour
{
	public Transform GiftParent;

	public float simulatePhysicsXSecondsAfterLastWaypoint;

	private GiftConveyorBelt belt;

	private uint lastWaypointIndex;

	private float timeSinceLastWaypoint;

	private bool finishedWaypoints;

	public void Init(GiftConveyorBelt belt, GameObject giftPrefab, float yRot, Vector3 scale)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: 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)
		this.belt = belt;
		Object.Instantiate<GameObject>(giftPrefab, GiftParent).SetActive(true);
		Vector3 localEulerAngles = ((Component)GiftParent).transform.localEulerAngles;
		localEulerAngles.y = yRot;
		((Component)GiftParent).transform.localEulerAngles = localEulerAngles;
		((Component)GiftParent).transform.localScale = scale;
	}

	private void Update()
	{
		if (!finishedWaypoints)
		{
			moveAlongWaypoints();
		}
	}

	private void moveAlongWaypoints()
	{
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		timeSinceLastWaypoint += Time.deltaTime;
		while (timeSinceLastWaypoint > belt.TimeBetweenWaypoints[lastWaypointIndex])
		{
			timeSinceLastWaypoint -= belt.TimeBetweenWaypoints[lastWaypointIndex];
			lastWaypointIndex++;
			if (lastWaypointIndex >= belt.waypoints.Length - 1)
			{
				finishWaypoints();
				return;
			}
		}
		float num = timeSinceLastWaypoint / belt.TimeBetweenWaypoints[lastWaypointIndex];
		((Component)this).transform.position = Vector3.Lerp(belt.waypoints[lastWaypointIndex].position, belt.waypoints[lastWaypointIndex + 1].position, num);
		((Component)this).transform.rotation = Quaternion.Lerp(belt.waypoints[lastWaypointIndex].rotation, belt.waypoints[lastWaypointIndex + 1].rotation, num);
	}

	private void finishWaypoints()
	{
		//IL_0048: 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_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		finishedWaypoints = true;
		if (simulatePhysicsXSecondsAfterLastWaypoint == 0f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
		component.isKinematic = false;
		Vector3 val = belt.waypoints[belt.waypoints.Length - 1].position - belt.waypoints[belt.waypoints.Length - 2].position;
		component.velocity = ((Vector3)(ref val)).normalized * belt.movementSpeed;
		((MonoBehaviour)this).StartCoroutine(DestroySelfAfterDelay(simulatePhysicsXSecondsAfterLastWaypoint));
	}

	private IEnumerator DestroySelfAfterDelay(float delay)
	{
		yield return (object)new WaitForSeconds(delay);
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
internal class TimelineScrubber
{
	private PlayableDirector director;

	private bool started;

	private float percent;

	public TimelineScrubber(PlayableDirector director)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Invalid comparison between Unknown and I4
		this.director = director;
		if ((int)director.timeUpdateMode != 3)
		{
			Debug.LogError((object)("TimelineScrubber instantiated for a PlayableDirector that's not in manual mode: " + ((Object)((Component)director).gameObject).name));
		}
	}

	public void ResetTimeline()
	{
		director.Stop();
		director.time = 0.0;
		started = false;
	}

	public void SetPercentComplete(float newPercent)
	{
		if (!started || newPercent < percent)
		{
			started = true;
			initializeTimelineToPosition(getTimeForPercent(newPercent));
		}
		else
		{
			advanceTimelineToPosition(getTimeForPercent(newPercent));
		}
		percent = newPercent;
	}

	private void initializeTimelineToPosition(float position)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: 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)
		director.Stop();
		director.Play();
		PlayableGraph playableGraph = director.playableGraph;
		((PlayableGraph)(ref playableGraph)).Evaluate();
		playableGraph = director.playableGraph;
		((PlayableGraph)(ref playableGraph)).Evaluate(position);
	}

	private void advanceTimelineToPosition(float position)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Invalid comparison between Unknown and I4
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		float num = position - (float)director.time;
		if (!(num <= 0f) && (int)director.state == 1)
		{
			PlayableGraph playableGraph = director.playableGraph;
			((PlayableGraph)(ref playableGraph)).Evaluate(num);
		}
	}

	private float getTimeForPercent(float percent)
	{
		return (float)director.duration * percent;
	}
}
namespace Winterland.Common
{
	[ExecuteAlways]
	public class AmbientOverride : MonoBehaviour
	{
		public static AmbientOverride Instance;

		public bool Night;

		[HideInInspector]
		public Color AdditiveSkyColor = Color.black;

		[Header("How fast additive sky colors fade to black (Fireworks)")]
		public float AdditiveSkyColorLerpSpeed = 5f;

		[HideInInspector]
		public bool DayNightCycleModEnabled = true;

		[Header("Skybox texture. Leave this set to nothing to keep the original stage skybox.")]
		public Texture Skybox;

		public Color LightColor = Color.white;

		public Color ShadowColor = Color.black;

		[HideInInspector]
		public Color CurrentLightColor = Color.white;

		[HideInInspector]
		public Color CurrentShadowColor = Color.black;

		[HideInInspector]
		public AmbientOverrideTrigger CurrentAmbientTrigger;

		private Color oldLightColor = Color.white;

		private Color oldShadowColor = Color.black;

		private float currentTimer;

		private float currentTransitionDuration = 1f;

		private AmbientManager sun;

		private void Update()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (Application.isEditor)
			{
				Shader.SetGlobalColor("LightColor", LightColor);
				Shader.SetGlobalColor("ShadowColor", ShadowColor);
			}
			else
			{
				ReptileUpdate();
			}
			void ReptileUpdate()
			{
				//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_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_010a: 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_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_015b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_0166: Unknown result type (might be due to invalid IL or missing references)
				//IL_016d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0173: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				currentTimer += Core.dt;
				if (currentTimer > currentTransitionDuration)
				{
					currentTimer = currentTransitionDuration;
				}
				float num = 1f;
				if (currentTransitionDuration > 0f)
				{
					num = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f).Evaluate(currentTimer / currentTransitionDuration);
				}
				Color lightColor = LightColor;
				Color shadowColor = ShadowColor;
				if ((Object)(object)CurrentAmbientTrigger != (Object)null)
				{
					lightColor = CurrentAmbientTrigger.LightColor;
					shadowColor = CurrentAmbientTrigger.ShadowColor;
				}
				CurrentLightColor = Color.op_Implicit(Vector4.Lerp(Color.op_Implicit(oldLightColor), Color.op_Implicit(lightColor), num));
				CurrentShadowColor = Color.op_Implicit(Vector4.Lerp(Color.op_Implicit(oldShadowColor), Color.op_Implicit(shadowColor), num));
				AdditiveSkyColor = Color.op_Implicit(Vector4.Lerp(Color.op_Implicit(AdditiveSkyColor), Color.op_Implicit(Color.black), AdditiveSkyColorLerpSpeed * Core.dt));
				if ((Object)(object)CurrentAmbientTrigger == (Object)null)
				{
					float num2 = 0f - (AdditiveSkyColor.r + AdditiveSkyColor.g + AdditiveSkyColor.b) / 3f * 0.5f + 1f;
					CurrentShadowColor *= num2;
					CurrentLightColor *= num2;
					CurrentLightColor += AdditiveSkyColor;
				}
			}
		}

		public void AddSkyLight(Color color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			AdditiveSkyColor += color * 0.7f;
		}

		private void LateUpdate()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)sun == (Object)null) && !DayNightCycleModEnabled)
			{
				Light component = ((Component)sun).GetComponent<Light>();
				component.color = Color.white;
				component.shadowStrength = 1f;
			}
		}

		public void TransitionAmbient(AmbientOverrideTrigger trigger)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)CurrentAmbientTrigger != (Object)(object)trigger)
			{
				CurrentAmbientTrigger = trigger;
				currentTimer = 0f;
				currentTransitionDuration = trigger.TransitionDuration;
				oldLightColor = CurrentLightColor;
				oldShadowColor = CurrentShadowColor;
				DayNightCycleModEnabled = trigger.EnableDayLightCycleMod;
			}
		}

		public void StopAmbient(AmbientOverrideTrigger trigger)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)trigger == (Object)(object)CurrentAmbientTrigger)
			{
				CurrentAmbientTrigger = null;
				currentTimer = 0f;
				currentTransitionDuration = trigger.TransitionDuration;
				oldLightColor = CurrentLightColor;
				oldShadowColor = CurrentShadowColor;
				DayNightCycleModEnabled = true;
			}
		}

		public void Refresh()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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)
			oldLightColor = LightColor;
			oldShadowColor = ShadowColor;
			if ((Object)(object)Skybox != (Object)null)
			{
				RenderSettings.skybox.mainTexture = Skybox;
			}
			AmbientManager val = Object.FindObjectOfType<AmbientManager>();
			if ((Object)(object)val != (Object)null)
			{
				((Component)val).transform.rotation = ((Component)this).transform.rotation;
			}
			((Behaviour)((Component)val).GetComponent<LensFlare>()).enabled = !Night;
		}

		private void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Refresh();
			Light component = ((Component)Object.FindObjectOfType<AmbientManager>()).GetComponent<Light>();
			Light component2 = ((Component)this).GetComponent<Light>();
			component.color = component2.color;
			if ((Object)(object)component2 != (Object)null)
			{
				Object.Destroy((Object)(object)component2);
			}
		}

		private void OnDestroy()
		{
			Instance = null;
		}
	}
	public class AmbientOverrideTrigger : MonoBehaviour
	{
		public Color LightColor = Color.white;

		public Color ShadowColor = Color.black;

		public float TransitionDuration = 2f;

		[Header("If this is set to false, they Day and Night cycle mod won't take effect while you're in this ambient.")]
		public bool EnableDayLightCycleMod = true;

		private void OnTriggerEnter(Collider other)
		{
			Player val = ((Component)other).GetComponent<Player>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)other).GetComponentInParent<Player>();
			}
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)other).GetComponentInChildren<Player>();
			}
			if (!((Object)(object)val == (Object)null) && !val.isAI)
			{
				AmbientOverride.Instance.TransitionAmbient(this);
			}
		}

		private void OnTriggerExit(Collider other)
		{
			Player val = ((Component)other).GetComponent<Player>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)other).GetComponentInParent<Player>();
			}
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)other).GetComponentInChildren<Player>();
			}
			if (!((Object)(object)val == (Object)null) && !val.isAI)
			{
				AmbientOverride.Instance.StopAmbient(this);
			}
		}
	}
	public class Arcade : MonoBehaviour
	{
		public Texture2D MapPinTexture;

		private MapPin pin;

		private void Awake()
		{
			ArcadeManager.Instance.RegisterArcade(this);
		}

		private void MakePin()
		{
			Mapcontroller instance = Mapcontroller.Instance;
			pin = instance.CreatePin((PinType)5);
			pin.AssignGameplayEvent(((Component)this).gameObject);
			pin.InitMapPin((PinType)0);
			pin.OnPinEnable();
			((Renderer)((Component)pin).GetComponentInChildren<MeshRenderer>()).material.mainTexture = (Texture)(object)MapPinTexture;
		}

		private void Start()
		{
			MakePin();
			UpdateAvailability();
		}

		public void UpdateAvailability()
		{
			((Component)this).gameObject.SetActive(WinterProgress.Instance.LocalProgress.ArcadeUnlocked);
			if ((Object)(object)pin != (Object)null)
			{
				if (WinterProgress.Instance.LocalProgress.ArcadeUnlocked)
				{
					pin.EnablePin();
				}
				else
				{
					pin.DisablePin();
				}
			}
		}
	}
	public class ArcadeManager : MonoBehaviour
	{
		public List<Arcade> Arcades = new List<Arcade>();

		public static ArcadeManager Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		public void RegisterArcade(Arcade arcade)
		{
			Arcades.Add(arcade);
		}

		public void UpdateArcades()
		{
			foreach (Arcade arcade in Arcades)
			{
				arcade.UpdateAvailability();
			}
		}
	}
	public class BindGameObjectActive : MonoBehaviour
	{
		[Header("When the GameObject referenced here is disabled, I will get disabled as well, and viceversa.")]
		public GameObject BoundGameObject;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Core.OnAlwaysUpdate += new OnUpdateHandler(CoreUpdate);
		}

		private void CoreUpdate()
		{
			if (BoundGameObject.activeInHierarchy && !((Component)this).gameObject.activeSelf)
			{
				((Component)this).gameObject.SetActive(true);
			}
			else if (!BoundGameObject.activeInHierarchy && ((Component)this).gameObject.activeSelf)
			{
				((Component)this).gameObject.SetActive(false);
			}
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Core.OnAlwaysUpdate -= new OnUpdateHandler(CoreUpdate);
		}
	}
	public enum BrcCharacter
	{
		None = -1,
		Vinyl,
		Frank,
		Coil,
		Red,
		Tryce,
		Bel,
		Rave,
		DotExeMember,
		Solace,
		DjCyber,
		EclipseMember,
		DevilTheoryMember,
		FauxWithBoostPack,
		FleshPrince,
		Irene,
		Felix,
		OldHeadMember,
		Base,
		Jet,
		Mesh,
		FuturismMember,
		Rise,
		Shine,
		FauxWithoutBoostPack,
		DotExeBoss,
		FelixWithCyberHead
	}
	public class BuiltToy : MonoBehaviour
	{
		public Toys Toy;

		private Material material;

		private static int GraffitiTextureProperty = Shader.PropertyToID("_Graffiti");

		private void Awake()
		{
			Renderer componentInChildren = ((Component)this).GetComponentInChildren<Renderer>();
			material = componentInChildren.sharedMaterial;
		}

		public void SetGraffiti(GraffitiArt graffiti)
		{
			material.SetTexture(GraffitiTextureProperty, graffiti.graffitiMaterial.mainTexture);
		}
	}
	public class CameraSequenceAction : SequenceAction
	{
		[Header("Leave this on None to keep the current camera.")]
		public CameraRegisterer Camera;

		public override void Run(bool immediate)
		{
			base.Run(immediate);
			if (!immediate && (Object)(object)Camera != (Object)null)
			{
				((CustomSequence)Sequence).SetCamera(((Component)Camera).gameObject);
			}
		}
	}
	public class CameraZoomZone : MonoBehaviour
	{
		public bool ChangeCameraPosition;

		public float CameraDragDistanceDefault = 1f;

		public float CameraDragDistanceMax = 1f;

		public float CameraHeight = 2f;

		public bool ChangeCameraFOV;

		public float CameraFOV = 40f;

		private void OnTriggerEnter(Collider other)
		{
			Player val = ((Component)other).GetComponent<Player>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)other).GetComponentInParent<Player>();
			}
			if (!((Object)(object)val == (Object)null) && !val.isAI)
			{
				WinterPlayer winterPlayer = WinterPlayer.Get(val);
				if (!((Object)(object)winterPlayer == (Object)null))
				{
					winterPlayer.CurrentCameraZoomZone = this;
				}
			}
		}

		private void OnTriggerExit(Collider other)
		{
			Player val = ((Component)other).GetComponent<Player>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)other).GetComponentInParent<Player>();
			}
			if (!((Object)(object)val == (Object)null) && !val.isAI)
			{
				WinterPlayer winterPlayer = WinterPlayer.Get(val);
				if (!((Object)(object)winterPlayer == (Object)null) && (Object)(object)winterPlayer.CurrentCameraZoomZone == (Object)(object)this)
				{
					winterPlayer.CurrentCameraZoomZone = null;
				}
			}
		}
	}
	public enum Condition
	{
		None,
		HasWantedLevel,
		CollectedAllToyLines,
		CollectedSomeToyLines,
		ArcadeBestTimeSet
	}
	public class CustomCharacterSelectSpot : MonoBehaviour
	{
		public string GUID;

		private static GameObject Source;

		private void Reset()
		{
			GUID = Guid.NewGuid().ToString();
		}

		private void Awake()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Source == (Object)null)
			{
				Source = ((Component)Object.FindObjectOfType<CharacterSelectSpot>()).gameObject;
			}
			GameObject obj = Object.Instantiate<GameObject>(Source, ((Component)this).transform);
			obj.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
			((AProgressable)obj.GetComponent<CharacterSelectSpot>()).uid = GUID;
			((Component)obj.transform.Find("mesh")).gameObject.SetActive(false);
		}
	}
	[ExecuteAlways]
	public class CustomNPC : MonoBehaviour
	{
		[Header("General")]
		[SerializeField]
		private string guid = "";

		public bool CreateMapPin;

		public ChallengeLevel Challenge;

		public string Name = "";

		public bool PlacePlayerAtSnapPosition = true;

		public bool LookAt = true;

		public bool FixStupidFBXLookAtRotation;

		public bool ShowRep;

		public int MaxDialogueLevel = 1;

		[HideInInspector]
		public int CurrentDialogueLevel;

		private EventDrivenInteractable interactable;

		private DialogueBranch[] dialogueBranches;

		private Transform head;

		private const float MaxHeadYaw = 75f;

		private const float MaxHeadPitch = 60f;

		private const float LookAtDuration = 2f;

		private const float LookAtSpeed = 4f;

		private float currentLookAtAmount;

		private float lookAtTimer;

		private Player lookAtTarget;

		private bool isLookingAt;

		public Guid GUID
		{
			get
			{
				return Guid.Parse(guid);
			}
			set
			{
				guid = value.ToString();
			}
		}

		private void Reset()
		{
			if (Application.isEditor)
			{
				((Component)this).gameObject.layer = 19;
				GUID = Guid.NewGuid();
			}
		}

		private void Start()
		{
			Mapcontroller instance = Mapcontroller.Instance;
			if (CreateMapPin)
			{
				MapPin obj = instance.CreatePin((PinType)2);
				obj.AssignGameplayEvent(((Component)this).gameObject);
				obj.InitMapPin((PinType)2);
				obj.OnPinEnable();
			}
		}

		private void Awake()
		{
			if (!Application.isEditor)
			{
				ReptileAwake();
			}
			void ReptileAwake()
			{
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Expected O, but got Unknown
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Expected O, but got Unknown
				CurrentDialogueLevel = 0;
				dialogueBranches = OrderedComponent.GetComponentsOrdered<DialogueBranch>(((Component)this).gameObject);
				interactable = ((Component)this).gameObject.AddComponent<EventDrivenInteractable>();
				interactable.OnInteract = Interact;
				interactable.OnGetLookAtPos = GetLookAtPos;
				((CustomInteractable)interactable).PlacePlayerAtSnapPosition = PlacePlayerAtSnapPosition;
				((CustomInteractable)interactable).ShowRep = ShowRep;
				((CustomInteractable)interactable).LookAt = LookAt;
				head = TransformExtentions.FindRecursive(((Component)this).transform, "head");
				Core.OnUpdate += new OnUpdateHandler(OnUpdate);
				Core.OnLateUpdate += new OnLateUpdateHandler(OnLateUpdate);
				DeserializeNPC();
			}
		}

		private void OnUpdate()
		{
			if (isLookingAt)
			{
				currentLookAtAmount += 4f * Core.dt;
				lookAtTimer -= Core.dt;
				if (lookAtTimer <= 0f)
				{
					lookAtTimer = 0f;
					isLookingAt = false;
				}
			}
			else
			{
				currentLookAtAmount -= 4f * Core.dt;
			}
			currentLookAtAmount = Mathf.Clamp(currentLookAtAmount, 0f, 1f);
		}

		private void OnLateUpdate()
		{
			UpdateHeadTransform();
		}

		private void OnTriggerStay(Collider other)
		{
			Player val = ((Component)other).GetComponentInChildren<Player>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)other).GetComponentInParent<Player>();
			}
			if (!((Object)(object)val == (Object)null) && !val.isAI)
			{
				StartLookAt(val);
			}
		}

		private void UpdateHeadTransform()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)lookAtTarget == (Object)null || (Object)(object)head == (Object)null)
			{
				return;
			}
			CharacterVisual characterVisual = lookAtTarget.characterVisual;
			if ((Object)(object)characterVisual == (Object)null)
			{
				return;
			}
			Transform transform = characterVisual.head;
			if (!((Object)(object)head == (Object)null))
			{
				if (characterVisual.VFX.phone.activeSelf)
				{
					transform = characterVisual.VFX.phone.transform;
				}
				Vector3 val = head.position - transform.position;
				Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up);
				Vector3 eulerAngles = ((Quaternion)(ref val2)).eulerAngles;
				val2 = Quaternion.LookRotation(-((Component)this).transform.forward, Vector3.up);
				Vector3 eulerAngles2 = ((Quaternion)(ref val2)).eulerAngles;
				float num = Mathf.DeltaAngle(eulerAngles.y, eulerAngles2.y);
				float num2 = Mathf.DeltaAngle(eulerAngles.x, eulerAngles2.x);
				eulerAngles.y = eulerAngles2.y - Mathf.Clamp(num, -75f, 75f);
				eulerAngles.x = eulerAngles2.x - Mathf.Clamp(num2, -60f, 60f);
				if (FixStupidFBXLookAtRotation)
				{
					eulerAngles.z -= 90f;
				}
				((Component)head).transform.rotation = Quaternion.Lerp(((Component)head).transform.rotation, Quaternion.Euler(eulerAngles), currentLookAtAmount);
			}
		}

		private void StartLookAt(Player player)
		{
			if (!((Object)(object)player.characterVisual == (Object)null))
			{
				lookAtTarget = player;
				lookAtTimer = 2f;
				isLookingAt = true;
			}
		}

		private void DeserializeNPC()
		{
			SerializedNPC nPCProgress = WinterProgress.Instance.LocalProgress.GetNPCProgress(this);
			if (nPCProgress != null)
			{
				CurrentDialogueLevel = nPCProgress.DialogueLevel;
			}
		}

		private void OnDestroy()
		{
			if (!Application.isEditor)
			{
				ReptileDestroy();
				return;
			}
			DialogueBranch[] components = ((Component)this).GetComponents<DialogueBranch>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
			void ReptileDestroy()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				Core.OnUpdate -= new OnUpdateHandler(OnUpdate);
				Core.OnLateUpdate -= new OnLateUpdateHandler(OnLateUpdate);
			}
		}

		public void AddDialogueLevel(int dialogueLevelToAdd)
		{
			CurrentDialogueLevel += dialogueLevelToAdd;
			CurrentDialogueLevel = Mathf.Clamp(CurrentDialogueLevel, 0, MaxDialogueLevel);
		}

		public Vector3 GetLookAtPos()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)head))
			{
				return head.position;
			}
			return ((Component)this).transform.position;
		}

		public void Interact(Player player)
		{
			Sequence sequence = null;
			DialogueBranch[] array = dialogueBranches;
			foreach (DialogueBranch dialogueBranch in array)
			{
				if (dialogueBranch.Test(this))
				{
					sequence = dialogueBranch.Sequence;
					break;
				}
			}
			if (!((Object)(object)sequence == (Object)null))
			{
				StartSequence(sequence);
			}
		}

		public void StartSequence(Sequence sequence)
		{
			SequenceWrapper customSequence = sequence.GetCustomSequence(this);
			if (customSequence != null)
			{
				((CustomInteractable)interactable).StartEnteringSequence((CustomSequence)(object)customSequence, sequence.HidePlayer, true, false, true, true, sequence.Skippable, true, false);
			}
		}
	}
	public class CustomToilet : MonoBehaviour
	{
		private static GameObject Source;

		private void Awake()
		{
			//IL_0031: 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)
			if ((Object)(object)Source == (Object)null)
			{
				Source = ((Component)Object.FindObjectOfType<PublicToilet>()).gameObject;
			}
			Object.Instantiate<GameObject>(Source, ((Component)this).transform).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
		}
	}
	public class DebugUI : MonoBehaviour
	{
		private class DebugMenu
		{
			public string Name;

			public Action OnGUI;
		}

		private const int Width = 400;

		private const int Height = 1200;

		private List<DebugMenu> debugMenus = new List<DebugMenu>();

		private bool show = true;

		private DebugMenu currentDebugMenu;

		public static DebugUI Instance { get; private set; }

		public static void Create(bool enabled)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_002f: Expected O, but got Unknown
			if (!((Object)(object)Instance != (Object)null))
			{
				GameObject val = new GameObject("Winterland Debug UI");
				val.SetActive(enabled);
				Instance = val.AddComponent<DebugUI>();
				Object.DontDestroyOnLoad((Object)val);
			}
		}

		public void RegisterMenu(string name, Action onDebugUI)
		{
			DebugMenu item = new DebugMenu
			{
				Name = name,
				OnGUI = onDebugUI
			};
			debugMenus.Add(item);
		}

		private void OnGUI()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)0;
			GUILayout.BeginArea(new Rect(0f, 0f, 400f, 1200f));
			GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.BeginVertical("Debug UI", GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.Space(20f);
			try
			{
				if (GUILayout.Button("Show/Hide", Array.Empty<GUILayoutOption>()))
				{
					show = !show;
				}
				if (!show)
				{
					return;
				}
				if (currentDebugMenu != null)
				{
					if (GUILayout.Button("Back", Array.Empty<GUILayoutOption>()))
					{
						currentDebugMenu = null;
					}
					else
					{
						currentDebugMenu.OnGUI();
					}
					return;
				}
				foreach (DebugMenu debugMenu in debugMenus)
				{
					if (GUILayout.Button(debugMenu.Name, Array.Empty<GUILayoutOption>()))
					{
						currentDebugMenu = debugMenu;
					}
				}
			}
			finally
			{
				GUILayout.EndVertical();
				GUILayout.EndVertical();
				GUILayout.EndVertical();
				GUILayout.EndArea();
			}
		}
	}
	[ExecuteAlways]
	public class DialogBlock : OrderedComponent
	{
		public enum SpeakerMode
		{
			None,
			NPC,
			Text
		}

		[HideInInspector]
		public DialogSequenceAction Owner;

		public SpeakerMode Speaker = SpeakerMode.NPC;

		[HideInInspector]
		public string SpeakerName = "???";

		public string Text = "...";

		[Header("Random clips to play when the character says this line.")]
		public AudioClip[] AudioClips;

		protected override void OnValidate()
		{
			base.OnValidate();
			if (Application.isEditor)
			{
				((Object)this).hideFlags = (HideFlags)2;
			}
		}

		private void Awake()
		{
			if (Application.isEditor && (Object)(object)((Component)this).GetComponent<DialogSequenceAction>() == (Object)null)
			{
				Object.DestroyImmediate((Object)(object)this);
			}
		}

		public override bool IsPeer(Component other)
		{
			DialogBlock dialogBlock = other as DialogBlock;
			if ((Object)(object)dialogBlock == (Object)null)
			{
				return false;
			}
			if ((Object)(object)dialogBlock.Owner == (Object)(object)Owner)
			{
				return true;
			}
			return false;
		}

		private void Start()
		{
			if (Application.isEditor && (Object)(object)Owner == (Object)null)
			{
				Object.DestroyImmediate((Object)(object)this);
			}
		}
	}
	public class DialogSequenceAction : CameraSequenceAction
	{
		public enum DialogType
		{
			Normal,
			YesNah
		}

		[Header("Type of dialog. Can make a branching question.")]
		public DialogType Type;

		[HideInInspector]
		public string YesTarget = "";

		[HideInInspector]
		public string NahTarget = "";

		[Header("Random clips to play when the character starts talking.")]
		public AudioClip[] AudioClips;

		public override void Run(bool immediate)
		{
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Expected O, but got Unknown
			base.Run(immediate);
			if (immediate)
			{
				return;
			}
			if (AudioClips != null && AudioClips.Length != 0)
			{
				AudioManager audioManager = Core.Instance.AudioManager;
				AudioClip val = AudioClips[Random.Range(0, AudioClips.Length)];
				audioManager.PlayNonloopingSfx(audioManager.audioSources[5], val, audioManager.mixerGroups[5], 0f);
			}
			DialogBlock[] array = (from block in OrderedComponent.GetComponentsOrdered<DialogBlock>(((Component)this).gameObject)
				where (Object)(object)block.Owner == (Object)(object)this
				select block).ToArray();
			List<CustomDialogue> list = new List<CustomDialogue>();
			for (int i = 0; i < array.Length; i++)
			{
				DialogBlock dialog = array[i];
				string text = dialog.Text;
				text = text.Replace("$TOYS_LEFT", (ToyLineManager.Instance.ToyLines.Count - WinterProgress.Instance.LocalProgress.ToyLinesCollected).ToString());
				text = text.Replace("$LOCALGIFTS", WinterProgress.Instance.LocalProgress.Gifts.ToString());
				text = text.Replace("$GLOBALGIFTS", TreeController.Instance.TargetProgress.totalGiftsCollected.ToString());
				if ((Object)(object)NPC != (Object)null && (Object)(object)NPC.Challenge != (Object)null)
				{
					string newValue = ChallengeUI.SecondsToMMSS(NPC.Challenge.Timer);
					string newValue2 = ChallengeUI.SecondsToMMSS(NPC.Challenge.BestTime);
					if (NPC.Challenge.BestTime == 0f)
					{
						newValue2 = "Not set";
					}
					text = text.Replace("$ARCADE_LASTTIME", newValue);
					text = text.Replace("$ARCADE_BESTTIME", newValue2);
				}
				CustomDialogue customDialog = new CustomDialogue(dialog.SpeakerName, text, (CustomDialogue)null);
				list.Add(customDialog);
				if (dialog.Speaker == DialogBlock.SpeakerMode.None)
				{
					customDialog.CharacterName = "";
				}
				if (dialog.Speaker == DialogBlock.SpeakerMode.NPC)
				{
					customDialog.CharacterName = NPC.Name;
				}
				if (i > 0)
				{
					CustomDialogue val2 = list[i - 1];
					if (val2 != null)
					{
						val2.NextDialogue = customDialog;
					}
				}
				CustomDialogue obj = customDialog;
				obj.OnDialogueBegin = (Action)Delegate.Combine(obj.OnDialogueBegin, (Action)delegate
				{
					if (dialog.AudioClips != null && dialog.AudioClips.Length != 0)
					{
						AudioManager audioManager2 = Core.Instance.AudioManager;
						AudioClip val3 = dialog.AudioClips[Random.Range(0, dialog.AudioClips.Length)];
						audioManager2.PlayNonloopingSfx(audioManager2.audioSources[5], val3, audioManager2.mixerGroups[5], 0f);
					}
				});
				if (i < array.Length - 1)
				{
					continue;
				}
				CustomDialogue obj2 = customDialog;
				obj2.OnDialogueBegin = (Action)Delegate.Combine(obj2.OnDialogueBegin, (Action)delegate
				{
					if (Type == DialogType.YesNah)
					{
						((CustomSequence)Sequence).RequestYesNoPrompt();
					}
				});
				CustomDialogue obj3 = customDialog;
				obj3.OnDialogueEnd = (Action)Delegate.Combine(obj3.OnDialogueEnd, (Action)delegate
				{
					if (Type == DialogType.YesNah)
					{
						SequenceAction actionByName = Sequence.Sequence.GetActionByName(YesTarget);
						SequenceAction actionByName2 = Sequence.Sequence.GetActionByName(NahTarget);
						if (customDialog.AnsweredYes)
						{
							if ((Object)(object)actionByName == (Object)null)
							{
								Finish(immediate);
							}
							else
							{
								actionByName.Run(immediate);
							}
						}
						else if ((Object)(object)actionByName2 == (Object)null)
						{
							Finish(immediate);
						}
						else
						{
							actionByName2.Run(immediate);
						}
					}
					else
					{
						Finish(immediate);
					}
				});
			}
			if (list.Count > 0)
			{
				((CustomSequence)Sequence).StartDialogue(list[0], 0.9f);
			}
		}
	}
	[ExecuteAlways]
	public class DialogueBranch : OrderedComponent
	{
		public Sequence Sequence;

		public WinterObjective RequiredObjective;

		public Condition Condition;

		public int MinimumDialogueLevel;

		protected override void OnValidate()
		{
			base.OnValidate();
			if (Application.isEditor)
			{
				((Object)this).hideFlags = (HideFlags)2;
			}
		}

		public override bool IsPeer(Component other)
		{
			return other is DialogueBranch;
		}

		public bool Test(CustomNPC npc)
		{
			if (npc.CurrentDialogueLevel < MinimumDialogueLevel)
			{
				return false;
			}
			switch (Condition)
			{
			case Condition.HasWantedLevel:
				if (!WantedManager.instance.Wanted)
				{
					return false;
				}
				break;
			case Condition.CollectedAllToyLines:
				if (!ToyLineManager.Instance.GetCollectedAllToyLines())
				{
					return false;
				}
				break;
			case Condition.CollectedSomeToyLines:
				if (ToyLineManager.Instance.GetCollectedAllToyLines() || WinterProgress.Instance.LocalProgress.ToyLinesCollected == 0)
				{
					return false;
				}
				break;
			case Condition.ArcadeBestTimeSet:
				if ((Object)(object)npc.Challenge == (Object)null)
				{
					return false;
				}
				if (npc.Challenge.BestTime == 0f)
				{
					return false;
				}
				break;
			}
			if ((Object)(object)RequiredObjective != (Object)null && ((Object)WinterProgress.Instance.LocalProgress.Objective).name != ((Object)RequiredObjective).name)
			{
				return false;
			}
			return true;
		}
	}
	public class EndSequenceAction : SequenceAction
	{
		public override void Run(bool immediate)
		{
			base.Run(immediate);
			if (!immediate)
			{
				((CustomSequence)Sequence).ExitSequence(0.9f);
			}
		}
	}
	public class FallenSnowController : MonoBehaviour
	{
		public float MinimumSpeedForSnowParticles = 5f;

		public GameObject SnowFootstepParticlesPrefab;

		public Action OnUpdate;

		public Action OnUpdateOneShot;

		private const string CameraPositionProp = "CameraPosition";

		private const string DepthHalfRadiusProp = "DepthHalfRadius";

		private const string DepthTextureProp = "DepthTexture";

		[SerializeField]
		private float clearRate = 0.033f;

		[SerializeField]
		private float clearStrength = 0.1f;

		[SerializeField]
		private float updateRate = 0.016f;

		[SerializeField]
		private float depthRadiusHalf = 100f;

		[SerializeField]
		private RenderTexture depthRenderTexture;

		[SerializeField]
		private Texture2D holeTexture;

		[SerializeField]
		private float gridSize = 10f;

		private RenderTexture backBufferRenderTexture;

		private Texture2D clearTexture;

		private Vector2 cameraPosition = Vector2.zero;

		private float currentUpdateTime;

		private float currentClearTime;

		public static FallenSnowController Instance { get; private set; }

		private void ProcessRenderTextureDraws()
		{
			RenderTexture.active = depthRenderTexture;
			GL.PushMatrix();
			GL.LoadPixelMatrix(0f, depthRadiusHalf * 2f, depthRadiusHalf * 2f, 0f);
			OnUpdateOneShot?.Invoke();
			OnUpdate?.Invoke();
			GL.PopMatrix();
			RenderTexture.active = null;
			OnUpdateOneShot = null;
		}

		public void DrawHole(Vector2 worldPosition, float size, float strength)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0043: 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_006a: 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)
			Vector2 depthPositionAt = GetDepthPositionAt(worldPosition);
			depthPositionAt.y = 0f - depthPositionAt.y + depthRadiusHalf * 2f;
			depthPositionAt -= new Vector2(size * 0.5f, size * 0.5f);
			Graphics.DrawTexture(new Rect(depthPositionAt.x, depthPositionAt.y, size, size), (Texture)(object)holeTexture, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, new Color(1f, 1f, 1f, strength), (Material)null, -1);
		}

		private Vector2 GetDepthPositionAt(Vector2 position)
		{
			//IL_0001: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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)
			Vector2 val = cameraPosition - new Vector2(depthRadiusHalf, depthRadiusHalf);
			return position - val;
		}

		private void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			RenderTexture.active = depthRenderTexture;
			GL.Clear(true, true, Color.black);
			RenderTexture.active = null;
			backBufferRenderTexture = Object.Instantiate<RenderTexture>(depthRenderTexture);
			clearTexture = new Texture2D(1, 1);
			clearTexture.SetPixel(0, 0, Color.black);
			clearTexture.Apply();
			Instance = this;
			Shader.SetGlobalFloat("DepthHalfRadius", depthRadiusHalf);
			Shader.SetGlobalTexture("DepthTexture", (Texture)(object)depthRenderTexture);
		}

		private void TransformTexture(Vector2 previousCameraPosition, Vector2 currentCameraPosition)
		{
			//IL_0011: 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_0013: 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_0041: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			Graphics.Blit((Texture)(object)depthRenderTexture, backBufferRenderTexture);
			Vector2 val = (currentCameraPosition - previousCameraPosition) / (depthRadiusHalf * 2f) * new Vector2((float)((Texture)depthRenderTexture).width, (float)((Texture)depthRenderTexture).height);
			val.x = 0f - val.x;
			RenderTexture.active = depthRenderTexture;
			GL.PushMatrix();
			GL.LoadPixelMatrix(0f, (float)((Texture)depthRenderTexture).width, (float)((Texture)depthRenderTexture).height, 0f);
			GL.Clear(true, true, Color.black);
			Graphics.DrawTexture(new Rect(val.x, val.y, (float)((Texture)depthRenderTexture).width, (float)((Texture)depthRenderTexture).height), (Texture)(object)backBufferRenderTexture);
			GL.PopMatrix();
			RenderTexture.active = null;
		}

		private void Update()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_006b: 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_0043: 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_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(((Component)this).transform.position.x, ((Component)this).transform.position.z);
			Camera currentCamera = WorldHandler.instance.CurrentCamera;
			if ((Object)(object)currentCamera != (Object)null)
			{
				((Vector2)(ref val))..ctor(((Component)currentCamera).transform.position.x, ((Component)currentCamera).transform.position.z);
			}
			Vector2 val2 = cameraPosition;
			val.x = Mathf.Floor(val.x / gridSize) * gridSize;
			val.y = Mathf.Floor(val.y / gridSize) * gridSize;
			currentUpdateTime += Core.dt;
			currentClearTime += Core.dt;
			float num = Mathf.Floor(currentClearTime / clearRate);
			for (int i = 0; (float)i < num; i++)
			{
				OnUpdateOneShot = (Action)Delegate.Combine(OnUpdateOneShot, (Action)delegate
				{
					//IL_0022: Unknown result type (might be due to invalid IL or missing references)
					//IL_0041: Unknown result type (might be due to invalid IL or missing references)
					//IL_005f: Unknown result type (might be due to invalid IL or missing references)
					Graphics.DrawTexture(new Rect(0f, 0f, depthRadiusHalf * 2f, depthRadiusHalf * 2f), (Texture)(object)clearTexture, new Rect(0f, 0f, 1f, 1f), 0, 0, 0, 0, new Color(1f, 1f, 1f, clearStrength), (Material)null, -1);
				});
			}
			float num2 = Mathf.Floor(currentUpdateTime / updateRate);
			for (int j = 0; (float)j < num2; j++)
			{
				ProcessRenderTextureDraws();
			}
			currentUpdateTime -= num2 * updateRate;
			currentClearTime -= num * clearRate;
			cameraPosition = val;
			if (val != val2)
			{
				TransformTexture(val2, val);
			}
			Shader.SetGlobalVector("CameraPosition", Vector4.op_Implicit(cameraPosition));
		}

		private void OnDestroy()
		{
			Object.Destroy((Object)(object)clearTexture);
			Object.Destroy((Object)(object)backBufferRenderTexture);
		}
	}
	public class FallingSnowBlocker : MonoBehaviour
	{
		private void Awake()
		{
			Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>();
			FallingSnowController[] array = Object.FindObjectsOfType<FallingSnowController>(true);
			foreach (FallingSnowController fallingSnowController in array)
			{
				Collider[] array2 = componentsInChildren;
				foreach (Collider trigger in array2)
				{
					fallingSnowController.AddKillTrigger(trigger);
				}
			}
		}
	}
	public class FallingSnowController : MonoBehaviour
	{
		[Tooltip("How much to move the particles upwards when you look up. To make it look like the particles are coming from higher up.")]
		[SerializeField]
		private float heightOffsetWhenLookingUp = 10f;

		[Tooltip("Size of the snow chunk grid. Make this match the size of the emitter.")]
		[SerializeField]
		private float gridSize = 50f;

		[SerializeField]
		private GameObject snowEmitter;

		[Tooltip("Amount of adjacent snow chunks to create around the camera. Probably best left at 1 as it increases the number of chunks exponentially.")]
		[SerializeField]
		private int amountAroundCamera = 1;

		private Dictionary<Vector2, GameObject> particles;

		private Stack<GameObject> particlePool;

		private List<GameObject> allParticles;

		private void Awake()
		{
			particles = new Dictionary<Vector2, GameObject>();
			particlePool = new Stack<GameObject>();
			allParticles = new List<GameObject>();
			int num = 1 + amountAroundCamera * 2;
			int num2 = num * num;
			AddToPool(snowEmitter);
			allParticles.Add(snowEmitter);
			for (int i = 1; i < num2; i++)
			{
				GameObject val = Object.Instantiate<GameObject>(snowEmitter);
				AddToPool(val);
				allParticles.Add(val);
			}
		}

		public void AddKillTrigger(Collider trigger)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject allParticle in allParticles)
			{
				ParticleSystem[] componentsInChildren = allParticle.GetComponentsInChildren<ParticleSystem>(true);
				if (componentsInChildren != null)
				{
					ParticleSystem[] array = componentsInChildren;
					for (int i = 0; i < array.Length; i++)
					{
						TriggerModule trigger2 = array[i].trigger;
						((TriggerModule)(ref trigger2)).AddCollider((Component)(object)trigger);
					}
				}
			}
		}

		private void AddToPool(GameObject instance)
		{
			instance.transform.parent = ((Component)this).transform;
			particlePool.Push(instance);
		}

		private GameObject GetFromPool()
		{
			return particlePool.Pop();
		}

		private Vector2 GridSnapPosition(Vector3 position)
		{
			//IL_0000: 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)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Floor(position.x / gridSize) * gridSize;
			float num2 = Mathf.Floor(position.z / gridSize) * gridSize;
			return new Vector2(num, num2);
		}

		private bool InRange(Vector2 position, Vector2 position2)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Abs(position.x - position2.x);
			float num2 = Mathf.Abs(position.y - position2.y);
			if (num > (float)amountAroundCamera * gridSize || num2 > (float)amountAroundCamera * gridSize)
			{
				return false;
			}
			return true;
		}

		private void Update()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0063: 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_006f: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_011b: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			Camera currentCamera = WorldHandler.instance.CurrentCamera;
			if ((Object)(object)currentCamera == (Object)null)
			{
				return;
			}
			Vector3 val = ((Component)currentCamera).transform.forward - Vector3.Project(((Component)currentCamera).transform.forward, Vector3.up);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			Vector3 position = ((Component)currentCamera).transform.position + normalized * gridSize;
			Vector2 val2 = GridSnapPosition(position);
			float y = ((Component)currentCamera).transform.position.y;
			float num = Mathf.Max(0f, Vector3.Dot(((Component)currentCamera).transform.forward, Vector3.up));
			y += heightOffsetWhenLookingUp * num;
			Dictionary<Vector2, GameObject> dictionary = new Dictionary<Vector2, GameObject>();
			foreach (KeyValuePair<Vector2, GameObject> particle in particles)
			{
				if (!InRange(particle.Key, val2))
				{
					AddToPool(particle.Value);
					continue;
				}
				particle.Value.transform.position = new Vector3(particle.Value.transform.position.x, y, particle.Value.transform.position.z);
				dictionary[particle.Key] = particle.Value;
			}
			particles = dictionary;
			Vector2 val3 = default(Vector2);
			for (int i = -amountAroundCamera; i <= amountAroundCamera; i++)
			{
				for (int j = -amountAroundCamera; j <= amountAroundCamera; j++)
				{
					((Vector2)(ref val3))..ctor(val2.x + (float)i * gridSize, val2.y + (float)j * gridSize);
					if (!particles.ContainsKey(val3))
					{
						GameObject fromPool = GetFromPool();
						fromPool.transform.position = new Vector3(val3.x + gridSize * 0.5f, y, val3.y + gridSize * 0.5f);
						particles[val3] = fromPool;
					}
				}
			}
		}
	}
	public class FauxHead : MonoBehaviour
	{
		[SerializeField]
		private float timeIdleToConsiderGrounded = 0.2f;

		[SerializeField]
		private float maximumDistanceTravelledToConsiderGrounded = 0.05f;

		private float lastMovedHeight;

		private float currentTimeIdle;

		[SerializeField]
		private LayerMask groundMask;

		[SerializeField]
		private float groundRayLength = 0.5f;

		[SerializeField]
		private float kickCooldownInSeconds = 0.5f;

		private float currentKickCooldown;

		private int currentJuggles;

		private Rigidbody body;

		private bool onGround;

		private void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			body = ((Component)this).GetComponent<Rigidbody>();
			lastMovedHeight = ((Component)this).transform.position.y;
		}

		private void OnTriggerStay(Collider other)
		{
			if (((Component)other).gameObject.layer != 18 || currentKickCooldown > 0f)
			{
				return;
			}
			Player val = ((Component)other).GetComponentInParent<Player>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)other).GetComponentInChildren<Player>();
			}
			if ((Object)(object)val == (Object)null || val.isAI)
			{
				return;
			}
			FauxJuggleUI fauxJuggleUI = WinterUI.Instance?.FauxJuggleUI;
			if (!((Object)(object)fauxJuggleUI == (Object)null))
			{
				currentKickCooldown = kickCooldownInSeconds;
				currentJuggles++;
				currentTimeIdle = 0f;
				if (currentJuggles >= 2)
				{
					fauxJuggleUI.UpdateCounter(currentJuggles);
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_003d: 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_0055: 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)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			currentKickCooldown -= Core.dt;
			if (currentKickCooldown < 0f)
			{
				currentKickCooldown = 0f;
			}
			if (currentKickCooldown <= 0f)
			{
				RaycastHit val = default(RaycastHit);
				if (Physics.Raycast(new Ray(((Component)this).transform.position, Vector3.down), ref val, groundRayLength, LayerMask.op_Implicit(groundMask), (QueryTriggerInteraction)1))
				{
					onGround = true;
					if (Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponent<Player>()))
					{
						onGround = false;
					}
				}
				else
				{
					onGround = false;
				}
			}
			else
			{
				onGround = false;
			}
			if (onGround)
			{
				currentTimeIdle = 0f;
			}
			if (Mathf.Abs(((Component)this).transform.position.y - lastMovedHeight) > maximumDistanceTravelledToConsiderGrounded)
			{
				currentTimeIdle = 0f;
				lastMovedHeight = ((Component)this).transform.position.y;
			}
			else
			{
				currentTimeIdle += Core.dt;
				if (currentTimeIdle > timeIdleToConsiderGrounded)
				{
					onGround = true;
				}
			}
			if (onGround)
			{
				currentJuggles = 0;
				FauxJuggleUI fauxJuggleUI = WinterUI.Instance?.FauxJuggleUI;
				if ((Object)(object)fauxJuggleUI != (Object)null && onGround && fauxJuggleUI.CurrentJuggleAmount > 0)
				{
					fauxJuggleUI.EndJuggle();
				}
			}
		}
	}
	public class FauxJuggleUI : MonoBehaviour
	{
		[HideInInspector]
		public int CurrentJuggleAmount;

		[SerializeField]
		private TextMeshProUGUI counterLabel;

		[SerializeField]
		private TextMeshProUGUI highScoreLabel;

		[SerializeField]
		private float highScoreLabelGrowSize = 5f;

		[SerializeField]
		private float highScoreLabelAnimationDuration = 0.5f;

		[SerializeField]
		private float highScoreLabelDisplayDuration = 2f;

		private float highScoreLabelDefaultSize;

		private float counterLabelDefaultSize;

		public bool Visible
		{
			get
			{
				return ((Component)this).gameObject.activeSelf;
			}
			set
			{
				if (value && !((Component)this).gameObject.activeSelf)
				{
					((Component)this).gameObject.SetActive(true);
				}
				else if (!value && ((Component)this).gameObject.activeSelf)
				{
					((Component)this).gameObject.SetActive(false);
				}
			}
		}

		private void Awake()
		{
			Visible = false;
			highScoreLabelDefaultSize = ((TMP_Text)highScoreLabel).fontSize;
			counterLabelDefaultSize = ((TMP_Text)counterLabel).fontSize;
		}

		public void EndJuggle()
		{
			((MonoBehaviour)this).StopAllCoroutines();
			ILocalProgress localProgress = WinterProgress.Instance.LocalProgress;
			if (CurrentJuggleAmount > localProgress.FauxJuggleHighScore)
			{
				localProgress.FauxJuggleHighScore = CurrentJuggleAmount;
				localProgress.Save();
				UpdateHighScoreLabelNew();
				((MonoBehaviour)this).StartCoroutine(PlayHighScoreAnimation());
			}
			((MonoBehaviour)this).StartCoroutine(PlayCounterAnimation());
			((MonoBehaviour)this).StartCoroutine(PlayDisableUIAnimation());
			CurrentJuggleAmount = 0;
		}

		private void UpdateHighScoreLabel()
		{
			ILocalProgress localProgress = WinterProgress.Instance.LocalProgress;
			((TMP_Text)highScoreLabel).text = $"High score: {localProgress.FauxJuggleHighScore}";
		}

		private void UpdateHighScoreLabelNew()
		{
			ILocalProgress localProgress = WinterProgress.Instance.LocalProgress;
			((TMP_Text)highScoreLabel).text = $"High score: {localProgress.FauxJuggleHighScore}(NEW!)";
		}

		public void UpdateCounter(int number)
		{
			((MonoBehaviour)this).StopAllCoroutines();
			Visible = true;
			UpdateHighScoreLabel();
			((TMP_Text)highScoreLabel).fontSize = highScoreLabelDefaultSize;
			CurrentJuggleAmount = number;
			((TMP_Text)counterLabel).text = CurrentJuggleAmount.ToString();
		}

		private IEnumerator PlayDisableUIAnimation()
		{
			yield return (object)new WaitForSeconds(highScoreLabelDisplayDuration);
			Visible = false;
		}

		private IEnumerator PlayHighScoreAnimation()
		{
			float animationTimer = 0f;
			AnimationCurve animationCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
			while (animationTimer < highScoreLabelDisplayDuration)
			{
				animationTimer += Core.dt;
				float num = animationCurve.Evaluate(Mathf.Min(1f, animationTimer / highScoreLabelAnimationDuration));
				((TMP_Text)highScoreLabel).fontSize = highScoreLabelDefaultSize + highScoreLabelGrowSize * num;
				yield return null;
			}
		}

		private IEnumerator PlayCounterAnimation()
		{
			float animationTimer = 0f;
			AnimationCurve animationCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
			while (animationTimer < highScoreLabelDisplayDuration)
			{
				animationTimer += Core.dt;
				float num = animationCurve.Evaluate(Mathf.Min(1f, animationTimer / highScoreLabelAnimationDuration));
				((TMP_Text)counterLabel).fontSize = counterLabelDefaultSize + highScoreLabelGrowSize * num;
				yield return null;
			}
		}
	}
	public class Firework : MonoBehaviour
	{
		public Color LightColor = Color.white;

		private ParticleSystem particleSystem;

		private void Awake()
		{
			particleSystem = ((Component)this).GetComponent<ParticleSystem>();
			if ((Object)(object)particleSystem != (Object)null)
			{
				particleSystem.Stop();
			}
		}

		public void Launch()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			AmbientOverride.Instance.AddSkyLight(LightColor);
			if (!((Object)(object)particleSystem == (Object)null))
			{
				particleSystem.Stop();
				particleSystem.Play();
			}
		}
	}
	public class FireworkDebugUI : MonoBehaviour
	{
		public static FireworkDebugUI Instance { get; private set; }

		public static void Create()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if (!((Object)(object)Instance != (Object)null))
			{
				GameObject val = new GameObject("Winterland FireworkDebugUI");
				Instance = val.AddComponent<FireworkDebugUI>();
				Object.DontDestroyOnLoad((Object)val);
			}
		}

		private void Awake()
		{
			DebugUI.Instance.RegisterMenu("Fireworks", OnDebugUI);
		}

		private void OnDebugUI()
		{
			GUILayout.Label("Fireworks", Array.Empty<GUILayoutOption>());
			FireworkHolder instance = FireworkHolder.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				if (GUILayout.Button("Launch Fireworks Locally", Array.Empty<GUILayoutOption>()))
				{
					instance.Launch();
				}
				if (GUILayout.Button("Broadcast Fireworks", Array.Empty<GUILayoutOption>()))
				{
					instance.BroadcastLaunch();
				}
				if (GUILayout.Button("Simulate fireworks received", Array.Empty<GUILayoutOption>()))
				{
					instance.DispatchReceivedLaunch();
				}
			}
		}
	}
	public class FireworkHandplantTrigger : MonoBehaviour
	{
	}
	public class FireworkHolder : MonoBehaviour
	{
		public static FireworkHolder Instance;

		[HideInInspector]
		public DateTime LastTriggeredFireworks;

		public float CooldownSeconds = 30f;

		public float TimeForFirstLaunch = 0.4f;

		public float MinimumTimeBetweenLaunches = 1f;

		public float MaximumTimeBetweenLaunches = 2f;

		public AudioClip FireworkSFX;

		public int FireworkAmount = 10;

		private Firework[] fireworks;

		private const string PacketID = "Xmas-Client-Fireworks";

		private void Awake()
		{
			if (!((Object)(object)Instance != (Object)null))
			{
				Instance = this;
				fireworks = ((Component)this).GetComponentsInChildren<Firework>(true);
				if (WinterNetworking.SlopCrewInstalled)
				{
					SlopCrewStep();
				}
			}
			void SlopCrewStep()
			{
				APIManager.API.OnCustomPacketReceived += CustomPacketReceived;
			}
		}

		private void CustomPacketReceived(uint playerid, string packetid, byte[] data)
		{
			if (!(packetid != "Xmas-Client-Fireworks"))
			{
				DispatchReceivedLaunch();
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
			if (WinterNetworking.SlopCrewInstalled)
			{
				SlopCrewStep();
			}
			void SlopCrewStep()
			{
				APIManager.API.OnCustomPacketReceived -= CustomPacketReceived;
			}
		}

		public void Launch()
		{
			AudioManager audioManager = Core.Instance.AudioManager;
			audioManager.PlayNonloopingSfx(audioManager.audioSources[3], FireworkSFX, audioManager.mixerGroups[3], 0f);
			((MonoBehaviour)this).StartCoroutine(LaunchCoroutine(TimeForFirstLaunch));
			((MonoBehaviour)this).StartCoroutine(LaunchCoroutine(TimeForFirstLaunch + 0.5f));
		}

		public bool DispatchReceivedLaunch()
		{
			DateTime now = DateTime.Now;
			if ((now - LastTriggeredFireworks).TotalSeconds <= (double)CooldownSeconds)
			{
				return false;
			}
			LastTriggeredFireworks = now;
			Launch();
			return true;
		}

		public void BroadcastLaunch()
		{
			if (DispatchReceivedLaunch() && WinterNetworking.SlopCrewInstalled)
			{
				SlopCrewStep();
			}
			static void SlopCrewStep()
			{
				APIManager.API.SendCustomPacket("Xmas-Client-Fireworks", new byte[0]);
			}
		}

		private IEnumerator LaunchCoroutine(float delay)
		{
			List<Firework> potentialFireworks = fireworks.ToList();
			yield return (object)new WaitForSeconds(delay);
			for (int i = 0; i < FireworkAmount; i++)
			{
				float num = Random.Range(MinimumTimeBetweenLaunches, MaximumTimeBetweenLaunches);
				int index = Random.Range(0, potentialFireworks.Count);
				Firework firework = potentialFireworks[index];
				potentialFireworks.RemoveAt(index);
				firework.Launch();
				yield return (object)new WaitForSeconds(num);
			}
		}
	}
	public class GiftPile : MonoBehaviour
	{
		public int MinimumGiftAmount = 1;

		private void Awake()
		{
			GiftPileManager.Instance.RegisterPile(this);
		}

		private void Start()
		{
			UpdateAvailability();
		}

		public void UpdateAvailability()
		{
			((Component)this).gameObject.SetActive(WinterProgress.Instance.LocalProgress.Gifts >= MinimumGiftAmount);
		}
	}
	public class GiftPileManager : MonoBehaviour
	{
		public List<GiftPile> GiftPiles = new List<GiftPile>();

		public static GiftPileManager Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		public void RegisterPile(GiftPile giftPile)
		{
			GiftPiles.Add(giftPile);
		}

		public void UpdatePiles()
		{
			foreach (GiftPile giftPile in GiftPiles)
			{
				giftPile.UpdateAvailability();
			}
		}
	}
	public static class GUILayoutUtility
	{
		private class HorizontalDisposable : IDisposable
		{
			public void Dispose()
			{
				GUILayout.EndHorizontal();
			}
		}

		private class VerticalDisposable : IDisposable
		{
			public void Dispose()
			{
				GUILayout.EndVertical();
			}
		}

		public static IDisposable Horizontal(params GUILayoutOption[] options)
		{
			GUILayout.BeginHorizontal(options);
			return new HorizontalDisposable();
		}

		public static IDisposable Vertical(params GUILayoutOption[] options)
		{
			GUILayout.BeginVertical(options);
			return new VerticalDisposable();
		}

		public static IDisposable Horizontal()
		{
			throw new NotImplementedException();
		}
	}
	public interface IGlobalProgress
	{
		public delegate void OnGlobalStageChangedHandler();

		XmasServerEventStatePacket State { get; }

		event OnGlobalStageChangedHandler OnGlobalStateChanged;
	}
	public class WritableGlobalProgress : IGlobalProgress
	{
		public XmasServerEventStatePacket State { get; private set; }

		public event IGlobalProgress.OnGlobalStageChangedHandler OnGlobalStateChanged;

		public void SetState(XmasServerEventStatePacket state)
		{
			State = state;
			this.OnGlobalStateChanged?.Invoke();
		}
	}
	public interface ILocalProgress
	{
		int CurrentPhaseGifts { get; set; }

		int CurrentPhase { get; set; }

		WinterObjective Objective { get; set; }

		int Gifts { get; set; }

		int FauxJuggleHighScore { get; set; }

		int ToyLinesCollected { get; }

		bool ArcadeUnlocked { get; set; }

		TimeOfDayController.TimesOfDay TimeOfDay { get; set; }

		bool SingleplayerUpdateNew { get; set; }

		void InitializeNew();

		void Save();

		void Load();

		void SetNPCDirty(CustomNPC npc);

		SerializedNPC GetNPCProgress(CustomNPC npc);

		void SetToyLineCollected(Guid guid, bool collected);

		bool IsToyLineCollected(Guid guid);

		void SetChallengeBestTime(ChallengeLevel challenge, float bestTime);

		float GetChallengeBestTime(ChallengeLevel challenge);

		void UpdateTree(bool reset = false);
	}
	public class JumpSequenceAction : SequenceAction
	{
		[Header("Target action to jump to.")]
		public string Target = "";

		public override void Run(bool immediate)
		{
			base.Run(immediate);
			SequenceAction actionByName = Sequence.Sequence.GetActionByName(Target);
			if ((Object)(object)actionByName != (Object)null)
			{
				actionByName.Run(immediate);
			}
			else
			{
				Finish(immediate);
			}
		}
	}
	public class LocalProgress : ILocalProgress
	{
		private const byte Version = 6;

		private string savePath;

		private Dictionary<Guid, SerializedNPC> npcs;

		private HashSet<Guid> collectedToyLines;

		private Dictionary<string, float> challengeBestTimes;

		public int CurrentPhaseGifts { get; set; }

		public int CurrentPhase { get; set; }

		public WinterObjective Objective { get; set; }

		public int Gifts { get; set; }

		public int FauxJuggleHighScore { get; set; }

		public int ToyLinesCollected => collectedToyLines.Count;

		public bool ArcadeUnlocked { get; set; }

		public TimeOfDayController.TimesOfDay TimeOfDay { get; set; }

		public bool SingleplayerUpdateNew { get; set; }

		public LocalProgress()
		{
			InitializeNew();
		}

		public void UpdateTree(bool reset = false)
		{
			if ((Object)(object)TreeController.Instance == (Object)null)
			{
				return;
			}
			if (CurrentPhase < TreeController.Instance.treePhases.Length - 1)
			{
				int goalForPhase = SingleplayerPhases.GetGoalForPhase(CurrentPhase);
				if (CurrentPhaseGifts >= goalForPhase)
				{
					CurrentPhase++;
					CurrentPhaseGifts = 0;
				}
			}
			MakeState();
			if (reset)
			{
				TreeController.Instance.ResetToTarget();
			}
		}

		public void MakeState()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			XmasServerEventStatePacket val = new XmasServerEventStatePacket();
			for (int i = 0; i <= CurrentPhase; i++)
			{
				XmasPhase val2 = new XmasPhase();
				val2.Active = false;
				if (i == CurrentPhase)
				{
					val2.Active = true;
				}
				else
				{
					val2.GiftsCollected = 1u;
				}
				val2.GiftsGoal = 1u;
				val.Phases.Add(val2);
			}
			(WinterProgress.Instance.GlobalProgress as SingleplayerGlobalProgress).SetState(val);
		}

		public void InitializeNew()
		{
			npcs = new Dictionary<Guid, SerializedNPC>();
			collectedToyLines = new HashSet<Guid>();
			challengeBestTimes = new Dictionary<string, float>();
			Gifts = 0;
			FauxJuggleHighScore = 0;
			ArcadeUnlocked = false;
			Objective = ObjectiveDatabase.StartingObjective;
			savePath = Path.Combine(Paths.ConfigPath, "MilleniumWinterland/localprogress.mwp");
			TimeOfDay = TimeOfDayController.TimesOfDay.Night;
			SingleplayerUpdateNew = true;
			CurrentPhase = 0;
			CurrentPhaseGifts = 0;
		}

		public void Save()
		{
			using MemoryStream memoryStream = new MemoryStream();
			using (BinaryWriter writer = new BinaryWriter(memoryStream))
			{
				Write(writer);
			}
			CustomStorage.Instance.WriteFile(memoryStream.ToArray(), savePath);
		}

		public void SetNPCDirty(CustomNPC npc)
		{
			npcs[npc.GUID] = new SerializedNPC(npc);
		}

		public void SetToyLineCollected(Guid guid, bool collected)
		{
			if (collected)
			{
				collectedToyLines.Add(guid);
			}
			else
			{
				collectedToyLines.Remove(guid);
			}
		}

		public bool IsToyLineCollected(Guid guid)
		{
			return collectedToyLines.Contains(guid);
		}

		public SerializedNPC GetNPCProgress(CustomNPC npc)
		{
			if (!npcs.TryGetValue(npc.GUID, out var value))
			{
				return null;
			}
			return value;
		}

		public void Load()
		{
			if (!File.Exists(savePath))
			{
				Debug.Log((object)"No Winterland save to load, starting a new game.");
				return;
			}
			using FileStream input = File.Open(savePath, FileMode.Open);
			using BinaryReader reader = new BinaryReader(input);
			try
			{
				Read(reader);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to load Winterland save!{Environment.NewLine}{arg}");
			}
		}

		private void Write(BinaryWriter writer)
		{
			writer.Write((byte)6);
			writer.Write(((Object)Objective).name);
			writer.Write(npcs.Count);
			foreach (SerializedNPC value in npcs.Values)
			{
				value.Write(writer);
			}
			writer.Write(Gifts);
			writer.Write(collectedToyLines.Count);
			foreach (Guid collectedToyLine in collectedToyLines)
			{
				writer.Write(collectedToyLine.ToString());
			}
			writer.Write(FauxJuggleHighScore);
			writer.Write(ArcadeUnlocked);
			writer.Write(challengeBestTimes.Count);
			foreach (KeyValuePair<string, float> challengeBestTime in challengeBestTimes)
			{
				writer.Write(challengeBestTime.Key);
				writer.Write(challengeBestTime.Value);
			}
			writer.Write((int)TimeOfDay);
			writer.Write(SingleplayerUpdateNew);
			writer.Write(CurrentPhase);
			writer.Write(CurrentPhaseGifts);
		}

		private void Read(BinaryReader reader)
		{
			npcs.Clear();
			byte b = reader.ReadByte();
			if (b > 6)
			{
				Debug.LogError((object)$"Attemped to read a Winterland save that's too new (version {b}), current version is {(byte)6}.");
				return;
			}
			WinterObjective objective = ObjectiveDatabase.GetObjective(reader.ReadString());
			if ((Object)(object)objective != (Object)null)
			{
				Objective = objective;
			}
			else
			{
				Objective = ObjectiveDatabase.StartingObjective;
			}
			if (b > 0)
			{
				int num = reader.ReadInt32();
				for (int i = 0; i < num; i++)
				{
					SerializedNPC serializedNPC = new SerializedNPC(reader);
					if (serializedNPC.GUID != Guid.Empty)
					{
						npcs[serializedNPC.GUID] = serializedNPC;
					}
				}
			}
			if (b > 1)
			{
				Gifts = reader.ReadInt32();
				int num2 = reader.ReadInt32();
				for (int j = 0; j < num2; j++)
				{
					Guid guid = Guid.Parse(reader.ReadString());
					SetToyLineCollected(guid, collected: true);
				}
			}
			if (b > 2)
			{
				FauxJuggleHighScore = reader.ReadInt32();
			}
			if (b > 3)
			{
				ArcadeUnlocked = reader.ReadBoolean();
				int num3 = reader.ReadInt32();
				for (int k = 0; k < num3; k++)
				{
					string key = reader.ReadString();
					challengeBestTimes[key] = reader.ReadSingle();
				}
			}
			if (b > 4)
			{
				TimeOfDay = (TimeOfDayController.TimesOfDay)reader.ReadInt32();
				SingleplayerUpdateNew = reader.ReadBoolean();
			}
			if (b > 5)
			{
				CurrentPhase = reader.ReadInt32();
				CurrentPhaseGifts = reader.ReadInt32();
			}
		}

		public void SetChallengeBestTime(ChallengeLevel challenge, float bestTime)
		{
			challengeBestTimes[challenge.GUID] = bestTime;
		}

		public float GetChallengeBestTime(ChallengeLevel challenge)
		{
			if (challengeBestTimes.TryGetValue(challenge.GUID, out var value))
			{
				return value;
			}
			return 0f;
		}
	}
	public class LocalProgressDebugUI : MonoBehaviour
	{
		public static LocalProgressDebugUI Instance { get; private set; }

		public static void Create()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if (!((Object)(object)Instance != (Object)null))
			{
				GameObject val = new GameObject("Winterland LocalProgressDebugUI");
				Instance = val.AddComponent<LocalProgressDebugUI>();
				Object.DontDestroyOnLoad((Object)val);
			}
		}

		private void Awake()
		{
			DebugUI.Instance.RegisterMenu("Local Progress", OnDebugUI);
		}

		private void OnDebugUI()
		{
			ILocalProgress localProgress = WinterProgress.Instance.LocalProgress;
			ToyLineManager instance = ToyLineManager.Instance;
			if (localProgress != null)
			{
				GUILayout.Label("Local Progress", Array.Empty<GUILayoutOption>());
				GUILayout.Label("Using " + localProgress.GetType().Name, Array.Empty<GUILayoutOption>());
				GUILayout.Label($"[ILocalProgress] Gifts wrapped: {localProgress.Gifts}", Array.Empty<GUILayoutOption>());
				GUILayout.Label($"[ILocalProgress] Faux head juggle high score: {localProgress.FauxJuggleHighScore}", Array.Empty<GUILayoutOption>());
				GUILayout.Label("[ILocalProgress] Current objective: " + ((Object)localProgress.Objective).name, Array.Empty<GUILayoutOption>());
				if (GUILayout.Button("Reset Progress", Array.Empty<GUILayoutOption>()))
				{
					localProgress.InitializeNew();
					localProgress.Save();
				}
			}
			if (!((Object)(object)instance != (Object)null))
			{
				return;
			}
			GUILayout.Label("Toy Line Manager", Array.Empty<GUILayoutOption>());
			GUILayout.Label($"[ToyLineManager] Collected all Toy Lines: {instance.GetCollectedAllToyLines()}", Array.Empty<GUILayoutOption>());
			GUILayout.Label($"[ToyLineManager] Toy Lines in this stage: {instance.ToyLines.Count}", Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Respawn Toy Lines", Array.Empty<GUILayoutOption>()))
			{
				instance.RespawnAllToyLines();
			}
			if (!GUILayout.Button("Collect all Toy Lines", Array.Empty<GUILayoutOption>()))
			{
				return;
			}
			foreach (ToyLine toyLine in instance.ToyLines)
			{
				toyLine.Collect();
			}
		}
	}
	public class MaterialReplacer : MonoBehaviour
	{
		public string NameOfMaterialToReplace;

		public Material ReplacementMaterial;

		public bool UseBRCShader;

		public ShaderNames BRCShaderName = (ShaderNames)1;

		private void Start()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (UseBRCShader)
			{
				ReplacementMaterial.shader = AssetAPI.GetShader(BRCShaderName);
			}
			Renderer[] array = Object.FindObjectsOfType<Renderer>();
			foreach (Renderer val in array)
			{
				if (!val.sharedMaterials.Any((Material x) => (Object)(object)x != (Object)null && ((Object)x).name == NameOfMaterialToReplace))
				{
					continue;
				}
				Material[] array2 = (Material[])(object)new Material[val.sharedMaterials.Length];
				for (int j = 0; j < val.sharedMaterials.Length; j++)
				{
					Material val2 = val.sharedMaterials[j];
					if ((Object)(object)val2 != (Object)null && ((Object)val2).name == NameOfMaterialToReplace)
					{
						array2[j] = ReplacementMaterial;
					}
					else
					{
						array2[j] = val2;
					}
				}
				val.sharedMaterials = array2;
			}
		}
	}
	public class Moon : MonoBehaviour
	{
		private void Update()
		{
			//IL_0031: 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)
			Camera currentCamera = WorldHandler.instance.currentCamera;
			if (!((Object)(object)currentCamera == (Object)null))
			{
				AmbientOverride instance = AmbientOverride.Instance;
				if (!((Object)(object)instance == (Object)null))
				{
					((Component)this).transform.position = ((Component)currentCamera).transform.position;
					((Component)this).transform.rotation = Quaternion.LookRotation(-((Component)instance).transform.forward);
				}
			}
		}
	}
	public class NotificationSequenceAction : SequenceAction
	{
		[Header("Text to show in this UI Notification.")]
		public string NotificationText = "";

		public override void Run(bool immediate)
		{
			base.Run(immediate);
			Core.Instance.UIManager.ShowNotification(NotificationText, Array.Empty<string>());
			Finish(immediate);
		}
	}
	public static class ObjectiveDatabase
	{
		public static WinterObjective StartingObjective;

		private static Dictionary<string, WinterObjective> ObjectiveByName;

		public static void Initialize(AssetBundle bundle)
		{
			ObjectiveByName = new Dictionary<string, WinterObjective>();
			WinterObjective[] array = bundle.LoadAllAssets<WinterObjective>();
			foreach (WinterObjective winterObjective in array)
			{
				ObjectiveByName[((Object)winterObjective).name] = winterObjective;
				if (winterObjective.StartingObjective)
				{
					StartingObjective = winterObjective;
				}
			}
		}

		public static WinterObjective GetObjective(string objectiveName)
		{
			if (ObjectiveByName.TryGetValue(objectiveName, out var value))
			{
				return value;
			}
			return null;
		}
	}
	public abstract class OrderedComponent : MonoBehaviour
	{
		[HideInInspector]
		public int Order = -1;

		public virtual bool IsPeer(Component other)
		{
			if (((object)other).GetType() == ((object)this).GetType())
			{
				return true;
			}
			return false;
		}

		protected virtual void OnValidate()
		{
			if (Order < 0 || GetOrderCollision(Order))
			{
				Order = GetHighestOrder() + 1;
			}
		}

		public void SetHighestOrder()
		{
			Order = GetHighestOrder() + 1;
		}

		public OrderedComponent MoveUp()
		{
			OrderedComponent firstComponentAbove = GetFirstComponentAbove(Order);
			if ((Object)(object)firstComponentAbove != (Object)null)
			{
				int order = Order;
				Order = firstComponentAbove.Order;
				firstComponentAbove.Order = order;
			}
			return firstComponentAbove;
		}

		public OrderedComponent MoveDown()
		{
			OrderedComponent firstComponentBelow = GetFirstComponentBelow(Order);
			if ((Object)(object)firstComponentBelow != (Object)null)
			{
				int order = Order;
				Order = firstComponentBelow.Order;
				firstComponentBelow.Order = order;
			}
			return firstComponentBelow;
		}

		private OrderedComponent GetFirstComponentAbove(int order)
		{
			OrderedComponent[] componentsAbove = GetComponentsAbove(order);
			OrderedComponent orderedComponent = null;
			OrderedComponent[] array = componentsAbove;
			foreach (OrderedComponent orderedComponent2 in array)
			{
				if ((Object)(object)orderedComponent == (Object)null)
				{
					orderedComponent = orderedComponent2;
				}
				else if (orderedComponent2.Order > orderedComponent.Order)
				{
					orderedComponent = orderedComponent2;
				}
			}
			return orderedComponent;
		}

		private OrderedComponent GetFirstComponentBelow(int order)
		{
			OrderedComponent[] componentsBelow = GetComponentsBelow(order);
			OrderedComponent orderedComponent = null;
			OrderedComponent[] array = componentsBelow;
			foreach (OrderedComponent orderedComponent2 in array)
			{
				if ((Object)(object)orderedComponent == (Object)null)
				{
					orderedComponent = orderedComponent2;
				}
				else if (orderedComponent2.Order < orderedComponent.Order)
				{
					orderedComponent = orderedComponent2;
				}
			}
			return orderedComponent;
		}

		private OrderedComponent[] GetComponentsAbove(int order)
		{
			return (from x in ((Component)this).gameObject.GetComponents<OrderedComponent>()
				where x.Order < order && IsPeer((Component)(object)x)
				select x).ToArray();
		}

		private OrderedComponent[] GetComponentsBelow(int order)
		{
			return (from x in ((Component)this).gameObject.GetComponents<OrderedComponent>()
				where x.Order > order && IsPeer((Component)(object)x)
				select x).ToArray();
		}

		private int GetHighestOrder()
		{
			IEnumerable<OrderedComponent> enumerable = from x in ((Component)this).gameObject.GetComponents<OrderedComponent>()
				where IsPeer((Component)(object)x)
				select x;
			int num = -1;
			foreach (OrderedComponent item in enumerable)
			{
				if (item.Order > num)
				{
					num = item.Order;
				}
			}
			return num;
		}

		private bool GetOrderCollision(int order)
		{
			return ((Component)this).gameObject.GetComponents<OrderedComponent>().Any((OrderedComponent x) => x.Order == order && IsPeer((Component)(object)x) && (Object)(object)x != (Object)(object)this);
		}

		public static T[] GetComponentsOrdered<T>(GameObject gameObject, Func<T, bool> predicate = null) where T : OrderedComponent
		{
			T[] source = gameObject.GetComponents<T>();
			if (predicate != null)
			{
				source = source.Where(predicate).ToArray();
			}
			List<T> list = source.ToList();
			list.Sort((T x, T y) => x.Order - y.Order);
			return list.ToArray();
		}
	}
	[RequireComponent(typeof(SnowSinker))]
	[RequireComponent(typeof(Rigidbody))]
	public class PhysicsSnowSinker : MonoBehaviour
	{
		public LayerMask Mask;

		public float RayDistance = 1f;

		private SnowSinker snowSinker;

		private Rigidbody body;

		private void Awake()
		{
			snowSinker = ((Component)this).GetComponent<SnowSinker>();
			body = ((Component)this).GetComponent<Rigidbody>();
		}

		private void FixedUpdate()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (body.isKinematic)
			{
				snowSinker.Enabled = false;
			}
			else if (Physics.Raycast(new Ray(((Component)this).transform.position, Vector3.down), ref val, RayDistance, LayerMask.op_Implicit(Mask), (QueryTriggerInteraction)1))
			{
				bool flag = true;
				if ((Object)(object)((Component)((RaycastHit)(ref val)).collider).gameObject.GetComponent<Rigidbody>() != (Object)null)
				{
					flag = false;
				}
				if (flag)
				{
					snowSinker.Enabled = true;
				}
				else
				{
					snowSinker.Enabled = false;
				}
			}
			else
			{
				snowSinker.Enabled = false;
			}
		}
	}
	public class PickupRotation : MonoBehaviour
	{
		[SerializeField]
		private Vector3 rotationSpeed;

		private void Update()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.Rotate(rotationSpeed * Time.deltaTime, (Space)0);
		}
	}
	public class PlayerCollisionUtility
	{
		public static Player GetPlayer(Collider other, bool includeAI = false)
		{
			Player val = ((Component)other).GetComponent<Player>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)other).GetComponentInParent<Player>();
			}
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)other).GetComponentInChildren<Player>();
			}
			if (!includeAI && val.isAI)
			{
				return null;
			}
			return val;
		}
	}
	public class PlayTimelineOnObjective : GameplayEvent
	{
		public WinterObjective RequiredObjective;

		public WinterObjective ObjectiveToSet;

		public PlayableDirector Director;

		public string Music = "MusicTrack_Hwbouths";

		private void OnPostInitialization()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			StageManager.OnStagePostInitialization -= new OnStageInitializedDelegate(OnPostInitialization);
			ILocalProgress localProgress = WinterProgress.Instance.LocalProgress;
			if (((Object)localProgress.Objective).name == ((Object)RequiredObjective).name)
			{
				localProgress.Objective = ObjectiveToSet;
				localProgress.Save();
				if (!string.IsNullOrEmpty(Music))
				{
					MusicTrack val = Core.Instance.Assets.LoadAssetFromBundle<MusicTrack>("coreassets", Music);
					if ((Object)(object)val != (Object)null)
					{
						IMusicPlayer musicPlayer = Core.Instance.BaseModule.StageManager.musicPlayer;
						musicPlayer.AddAndBufferAsCurrentTrack(val);
						musicPlayer.AttemptStartCurrentTrack();
					}
				}
				SequenceHandler.instance.StartEnteringSequence(Director, (GameplayEvent)(object)this, true, true, true, true, true, (ProgressObject)null, true, false, (Battle)null, false);
			}
			else
			{
				ShowNewStuffNotification();
			}
		}

		public override void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			StageManager.OnStagePostInitialization += new OnStageInitializedDelegate(OnPostInitialization);
		}

		public override void ExitSequence(PlayableDirector sequence, bool invokeEvent = true, bool restartCurrentEncounter = false)
		{
			((GameplayEvent)this).ExitSequence(sequence, invokeEvent, restartCurrentEncounter);
			ShowNewStuffNotification();
		}

		private void ShowNewStuffNotification()
		{
			ILocalProgress localProgress = WinterProgress.Instance.LocalProgress;
			if (localProgress.SingleplayerUpdateNew)
			{
				Core.Instance.UIManager.ShowNotification("Check out the new Winterland app on your phone to set things up to your liking!", Array.Empty<string>());
				localProgress.SingleplayerUpdateNew = false;
				localProgress.Save();
			}
		}

		public override void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			StageManager.OnStagePostInitialization -= new OnStageInitializedDelegate(OnPostInitialization);
		}
	}
	pub

Winterland.MapStation.Common.dll

Decompiled 10 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis;
using Reptile;
using UnityEngine;
using UnityEngine.Audio;
using Winterland.MapStation.Common.Serialization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Winterland.MapStation.Common")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d57e729790290875d5daaef4022962c64d26f632")]
[assembly: AssemblyProduct("Winterland.MapStation.Common")]
[assembly: AssemblyTitle("Winterland.MapStation.Common")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 Winterland.MapStation.Common
{
	public class DebugShapeUtility
	{
		public static IEnumerable<Renderer> FindDebugShapes(GameObject root)
		{
			return root.GetComponentsInChildren<Renderer>(true).Where(delegate(Renderer r)
			{
				Material sharedMaterial = r.sharedMaterial;
				return ((sharedMaterial != null) ? ((Object)sharedMaterial).name : null) == "Debug";
			});
		}

		public static void SetDebugShapesVisibility(GameObject root, bool visible)
		{
			foreach (Renderer item in FindDebugShapes(root))
			{
				item.enabled = visible;
			}
		}
	}
	public static class Doctor
	{
		private static readonly string[] VendingMachineAnimations = new string[5] { "none", "shake", "emptyShake", "close", "drop" };

		public static List<string> Analyze(GameObject root)
		{
			List<string> list = new List<string>();
			GraffitiSpot[] componentsInChildren = root.GetComponentsInChildren<GraffitiSpot>();
			foreach (GraffitiSpot val in componentsInChildren)
			{
				if ((Object)(object)val.dynamicRepPickup == (Object)null)
				{
					list.Add("Found GraffitiSpot.dynamicRepPickup == null. This will soft-lock when tagged.");
				}
				if (!Regex.Match(((AProgressable)val).uid, "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$", RegexOptions.None).Success)
				{
					list.Add($"Found GraffitiSpot.uid which is not in expected UID format (all lowercase, numbers and letters a-f, correct length, correct hyphens) UID={((AProgressable)val).uid}");
				}
				if (((Component)val).tag != "GraffitiSpot")
				{
					list.Add("Found GraffitiSpot not tagged as 'GraffitiSpot'");
				}
				if (((Component)val).gameObject.layer != 19)
				{
					list.Add("Found GraffitiSpot not on the 'TriggerDetectPlayer' layer.");
				}
			}
			VendingMachine[] componentsInChildren2 = root.GetComponentsInChildren<VendingMachine>();
			foreach (VendingMachine obj in componentsInChildren2)
			{
				if (((Component)obj).gameObject.layer != 17)
				{
					list.Add("Found VendingMachine that is not on the Enemies layer, this means it cannot be kicked.");
				}
				Animation component = ((Component)obj).GetComponent<Animation>();
				if ((Object)(object)component == (Object)null)
				{
					list.Add("Found VendingMachine without an Animation component.");
				}
				string[] vendingMachineAnimations = VendingMachineAnimations;
				foreach (string text in vendingMachineAnimations)
				{
					if ((TrackedReference)(object)component.GetState(text) == (TrackedReference)null)
					{
						list.Add("Found VendingMachine with Animation component missing animation: " + text + ". This will fail with errors when kicked.");
					}
				}
			}
			Teleport[] componentsInChildren3 = root.GetComponentsInChildren<Teleport>();
			foreach (Teleport obj2 in componentsInChildren3)
			{
				if ((Object)(object)obj2.teleportTo == (Object)null)
				{
					list.Add("Found Teleport missing a `teleportTo` destination.");
				}
				BoxCollider componentInChildren = ((Component)obj2).GetComponentInChildren<BoxCollider>();
				if ((Object)(object)componentInChildren == (Object)null)
				{
					list.Add("Found Teleport without a Box Collider on a child GameObject.");
				}
				if (((Component)componentInChildren).tag != "Teleport")
				{
					list.Add("Found Teleporter's child collider not tagged as 'Teleport'");
				}
				if (((Component)componentInChildren).gameObject.layer != 19)
				{
					list.Add("Found Teleport's child collider not on the 'TriggerDetectPlayer' layer.");
				}
			}
			return list;
		}

		public static void AnalyzeAndLog(GameObject root)
		{
			List<string> list = Analyze(root);
			Debug.Log((object)$"MapStation: Analysis of {((Object)root).name} found {list.Count} problems.");
			foreach (string item in list)
			{
				Debug.Log((object)item);
			}
		}
	}
	public class NoOpDynamicPickup : MonoBehaviour
	{
		private void Awake()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	public class SerializationTest : MonoBehaviour
	{
		[Serializable]
		public struct SerializedStruct
		{
			public string Foo;

			public string Bar;
		}

		public SerializedStruct data;

		private void Awake()
		{
			Debug.Log((object)$"Serialized data: foo={data.Foo}, bar={data.Bar}");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Winterland.MapStation.Common";

		public const string PLUGIN_NAME = "Winterland.MapStation.Common";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Winterland.MapStation.Common.Serialization
{
	internal class SerializationExample : MonoBehaviour
	{
		[Serializable]
		private class Conversation
		{
			public string showIfUnlockableIsUnlocked;
		}

		[Serializable]
		private class Dialog
		{
			public string say;

			public string animation;

			public bool askYesNo;
		}

		private class SList_NpcDialog : SList<Dialog>
		{
		}

		[SerializeReference]
		private Conversation conversation = new Conversation();

		[SerializeReference]
		private SList_NpcDialog npcDialog_ = new SList_NpcDialog();

		private List<Dialog> npcDialogs => npcDialog_.items;

		private void Awake()
		{
			string text = "";
			text += string.Format("{0} serialized data:\n", "SerializationExample");
			text += string.Format("{0}.{1}={2}\n", "Conversation", "showIfUnlockableIsUnlocked", conversation.showIfUnlockableIsUnlocked);
			text += string.Format("{0}.Count={1}\n", "npcDialogs", npcDialogs.Count);
			for (int i = 0; i < npcDialogs.Count; i++)
			{
				text += string.Format("{0}[{1}].{2}={3}\n", "npcDialogs", i, "say", npcDialogs[i].say);
				text += string.Format("{0}[{1}].{2}={3}\n", "npcDialogs", i, "animation", npcDialogs[i].animation);
				text += string.Format("{0}[{1}].{2}={3}\n", "npcDialogs", i, "askYesNo", npcDialogs[i].askYesNo);
			}
			Debug.Log((object)text);
		}
	}
	public class SList
	{
	}
	[Serializable]
	public class SList<T> : SList, ISerializationCallbackReceiver where T : new()
	{
		[HideInInspector]
		[SerializeReference]
		private Node linkedList;

		[SerializeReference]
		public List<T> items;

		public void copyToLinkedList()
		{
			if (items == null || items.Count == 0)
			{
				linkedList = null;
				return;
			}
			if (linkedList == null)
			{
				linkedList = new Node();
			}
			Node next = linkedList;
			int i = 0;
			for (int count = items.Count; i < count; i++)
			{
				next.value = items[i];
				if (i < count - 1)
				{
					Node node = next;
					if (node.next == null)
					{
						node.next = new Node();
					}
					next = next.next;
				}
				else
				{
					next.next = null;
				}
			}
		}

		public void copyToList()
		{
			if (items == null)
			{
				items = new List<T>();
			}
			else
			{
				items.Clear();
			}
			for (Node next = linkedList; next != null; next = next.next)
			{
				items.Add((T)next.value);
			}
		}

		private void instantiateNullList()
		{
			if (items == null)
			{
				items = new List<T>();
			}
		}

		private void instantiateNullItemsInList()
		{
			int i = 0;
			for (int count = items.Count; i < count; i++)
			{
				if (items[i] == null)
				{
					items[i] = new T();
				}
			}
		}

		public void OnBeforeSerialize()
		{
			instantiateNullList();
			instantiateNullItemsInList();
			copyToLinkedList();
		}

		public void OnAfterDeserialize()
		{
			if (!Application.isEditor)
			{
				copyToList();
			}
		}
	}
	[Serializable]
	public class Node
	{
		[SerializeReference]
		public object value;

		[SerializeReference]
		public Node next;
	}
}
namespace Winterland.MapStation.Common.VanillaAssets
{
	public class DeleteVanillaGameObjectsV1 : MonoBehaviour
	{
		public class SList_Deletion : SList<Deletion>
		{
		}

		[Serializable]
		public class Deletion
		{
			public string Path;
		}

		private HashSet<GameObject> disabledGameObjects = new HashSet<GameObject>();

		[SerializeReference]
		private SList_Deletion deletions = new SList_Deletion();

		public static DeleteVanillaGameObjectsV1 Instance { get; private set; }

		private List<Deletion> Deletions => deletions.items;

		private void Awake()
		{
			if (!Application.isEditor)
			{
				Instance = this;
				DeleteGameObjects();
			}
		}

		public void DeleteGameObjects()
		{
			foreach (Deletion deletion in Deletions)
			{
				GameObject val = GameObject.Find(deletion.Path);
				if ((Object)(object)val == (Object)null)
				{
					Debug.Log((object)("DeleteVanillaGameObjectsV1 could not find GameObject to delete at path: " + deletion.Path));
				}
				else
				{
					HandleDeleteGameObject(val);
				}
			}
		}

		private void HandleDeleteGameObject(GameObject gameObject)
		{
			if ((Object)(object)gameObject.GetComponent<StreetLifeCluster>() != (Object)null)
			{
				DisableGameObject(gameObject);
			}
			else
			{
				Object.Destroy((Object)(object)gameObject);
			}
		}

		private void DisableGameObject(GameObject gameObject)
		{
			gameObject.SetActive(false);
			disabledGameObjects.Add(gameObject);
		}

		public bool IsDisabled(GameObject gameObject)
		{
			if (disabledGameObjects.Contains(gameObject))
			{
				return true;
			}
			return false;
		}
	}
	public class MoveVanillaGameObjectV1 : MonoBehaviour
	{
		public string moveThis;

		public Transform targetLocation;

		private void Awake()
		{
			if (!Application.isEditor)
			{
				MoveGameObject();
			}
		}

		public void MoveGameObject()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.Find(moveThis);
			obj.transform.position = targetLocation.position;
			obj.transform.rotation = targetLocation.rotation;
		}
	}
	public class VanillaAssetReference : MonoBehaviour
	{
		public Component component;

		[TextArea(3, 10)]
		public List<string> fields = new List<string>();

		public const BindingFlags UseTheseBindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;

		private void Awake()
		{
			AssignReferences();
		}

		public void AssignReferences()
		{
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			foreach (string field in fields)
			{
				int num = field.IndexOf("=");
				int num2 = field.IndexOf(":");
				string text = field.Substring(0, num);
				int num3 = -1;
				int num4 = text.IndexOf("[");
				if (num4 >= 0)
				{
					num3 = int.Parse(text.Substring(num4 + 1, -1));
					((Object)this).name = text.Substring(0, num4);
				}
				else
				{
					((Object)this).name = text;
				}
				string text2 = field.Substring(num + 1, num2 - num - 1);
				string text3 = field.Substring(num2 + 1);
				Object val = Core.Instance.Assets.LoadAssetFromBundle<Object>(text2, text3);
				if (val == (Object)null)
				{
					Debug.Log((object)string.Format("{0}: Restoring reference to vanilla asset failed, asset not found: {1}.{2} = LoadAssetFromBundle(\"{3}\", \"{4}\")", "VanillaAssetReference", ((object)component).GetType().Name, ((Object)this).name, text2, text3));
					continue;
				}
				Type type = ((object)component).GetType();
				MemberInfo memberInfo = type.GetMember(((Object)this).name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)[0];
				string text4 = string.Format("VanillaAssetReference: Assigning {0}.{1} = asset {2}:{3} (asset found={4}, field found={5}, asset type={6})", type.Name, text, text2, text3, val != (Object)null, memberInfo != null, (val != (Object)null) ? ((object)val).GetType().Name : "<not found>");
				try
				{
					if (num3 >= 0)
					{
						object obj = ((memberInfo is PropertyInfo propertyInfo) ? propertyInfo.GetValue(component) : ((FieldInfo)memberInfo).GetValue(component));
						obj.GetType().GetProperty("Item").SetValue(obj, val, new object[1] { num3 });
					}
					else if (memberInfo is PropertyInfo propertyInfo2)
					{
						propertyInfo2.SetValue(component, val);
					}
					else
					{
						((FieldInfo)memberInfo).SetValue(component, val);
					}
				}
				catch (Exception ex)
				{
					Debug.Log((object)(text4 + "\nFailed with error:\n" + ex.Message + "\n" + ex.StackTrace));
				}
			}
		}
	}
	public class VanillaAssetReferenceV2 : MonoBehaviour
	{
		public class SList_Components : SList<ComponentEntry>
		{
		}

		[SerializeReference]
		private SList_Components components = new SList_Components();

		public const BindingFlags UseTheseBindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;

		private List<ComponentEntry> Components => components.items;

		private void Awake()
		{
			AssignReferences();
		}

		public void AssignReferences()
		{
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			foreach (ComponentEntry component2 in Components)
			{
				Component component = component2.Component;
				foreach (FieldEntry field in component2.Fields)
				{
					Object val = null;
					Object[] array = null;
					if (field.SubAssetType == SubAssetType.FbxChild)
					{
						array = Core.Instance.Assets.availableBundles[field.BundleName].AssetBundle.LoadAssetWithSubAssets(field.Path);
					}
					else
					{
						val = Core.Instance.Assets.LoadAssetFromBundle<Object>(field.BundleName, field.Path);
					}
					if (val == (Object)null && array == null)
					{
						Debug.Log((object)string.Format("{0}: Restoring reference to vanilla asset failed, asset not found: {1}.{2} = LoadAssetFromBundle(\"{3}\", \"{4}\")", "VanillaAssetReferenceV2", ((object)component).GetType().Name, field.Name, field.BundleName, field.Path));
						continue;
					}
					switch (field.SubAssetType)
					{
					case SubAssetType.FbxChild:
					{
						Object[] array2 = array;
						foreach (Object val2 in array2)
						{
							if (val2.name == field.SubPath)
							{
								val = val2;
								break;
							}
						}
						break;
					}
					case SubAssetType.MixerGroup:
						val = (Object)(object)((AudioMixer)val).FindMatchingGroups(field.SubPath)[0];
						break;
					}
					if (val == (Object)null)
					{
						Debug.Log((object)string.Format("{0}: Restoring reference to vanilla asset failed, sub-asset not found: {1}.{2} = LoadAssetFromBundle(\"{3}\", \"{4}\"); SubAssetType={5}; SubPath={6}", "VanillaAssetReferenceV2", ((object)component).GetType().Name, field.Name, field.BundleName, field.Path, field.SubAssetType.ToString(), field.SubPath));
						continue;
					}
					string message = "";
					try
					{
						if (component is Animation && field.Name == "AddClip")
						{
							AddAnimationClip(val, component, field, out message);
						}
						else
						{
							AssignMember(val, component, field, out message);
						}
					}
					catch (Exception ex)
					{
						Debug.Log((object)(message + "\nFailed with error:\n" + ex.Message + "\n" + ex.StackTrace));
					}
				}
			}
		}

		public static void AssignMember(Object asset, Component component, FieldEntry f, out string message)
		{
			Type type = ((object)component).GetType();
			MemberInfo memberInfo = type.GetMember(f.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)[0];
			message = string.Format("{0}: Assigning {1}.{2} = asset {3}:{4} (asset found={5}, field found={6}, asset type={7})", "VanillaAssetReferenceV2", type.Name, f.PropertyPath, f.BundleName, f.Path, asset != (Object)null, memberInfo != null, (asset != (Object)null) ? ((object)asset).GetType().Name : "<not found>");
			if (f.Index >= 0)
			{
				object obj = ((memberInfo is PropertyInfo propertyInfo) ? propertyInfo.GetValue(component) : ((FieldInfo)memberInfo).GetValue(component));
				obj.GetType().GetProperty("Item").SetValue(obj, asset, new object[1] { f.Index });
			}
			else if (memberInfo is PropertyInfo propertyInfo2)
			{
				propertyInfo2.SetValue(component, asset);
			}
			else
			{
				((FieldInfo)memberInfo).SetValue(component, asset);
			}
		}

		public static void AddAnimationClip(Object asset, Component component, FieldEntry f, out string message)
		{
			message = "VanillaAssetReferenceV2: Animation.AddClip(asset, " + asset.name + ") where asset is " + f.BundleName + ":" + f.Path + ((f.SubPath != null) ? (":" + f.SubPath) : "") + " (asset type=" + ((asset != (Object)null) ? ((object)asset).GetType().Name : "<not found>") + ")";
			((Animation)((component is Animation) ? component : null)).AddClip((AnimationClip)(object)((asset is AnimationClip) ? asset : null), asset.name);
		}
	}
	[Serializable]
	public class ComponentEntry
	{
		private class SList_FieldEntry : SList<FieldEntry>
		{
		}

		[SerializeField]
		public Component Component;

		[SerializeReference]
		private SList_FieldEntry fields = new SList_FieldEntry();

		public List<FieldEntry> Fields => fields.items;
	}
	[Serializable]
	public class FieldEntry
	{
		[HideInInspector]
		[SerializeField]
		public bool Enabled = true;

		[HideInInspector]
		[SerializeField]
		public bool AutoSync = true;

		[SerializeField]
		public string Name;

		[HideInInspector]
		[SerializeField]
		public int Index = -1;

		[SerializeField]
		public string BundleName;

		[SerializeField]
		public string Path;

		[SerializeField]
		public SubAssetType SubAssetType;

		[SerializeField]
		public string SubPath = "";

		public string PropertyPath
		{
			get
			{
				if (Index < 0)
				{
					return Name;
				}
				return $"{Name}[{Index}]";
			}
		}
	}
	public enum SubAssetType
	{
		None,
		MixerGroup,
		FbxChild
	}
}
namespace Winterland.MapStation.Common.Dependencies
{
	public class AssemblyDependencies
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

Winterland.MapStation.Plugin.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;
using Reptile;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Winterland.MapStation.Plugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d57e729790290875d5daaef4022962c64d26f632")]
[assembly: AssemblyProduct("Winterland.MapStation.Plugin")]
[assembly: AssemblyTitle("Winterland.MapStation.Plugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: TypeForwardedTo(typeof(GraffitiSpot))]
[assembly: TypeForwardedTo(typeof(GrindLine))]
[assembly: TypeForwardedTo(typeof(GrindNode))]
[assembly: TypeForwardedTo(typeof(GrindPath))]
[assembly: TypeForwardedTo(typeof(VertShape))]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 Winterland.MapStation.Components
{
	public class Grind : MonoBehaviour
	{
	}
}
namespace Winterland.MapStation.Plugin
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Winterland.MapStation.Plugin";

		public const string PLUGIN_NAME = "Winterland.MapStation.Plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Winterland.MapStation.Plugin.Dependencies
{
	public class AssemblyDependencies
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

Winterland.MustLoadInEditor.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Winterland.MustLoadInEditor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Small inspectable classes which absolutely must load in Unity Editor without errors.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d57e729790290875d5daaef4022962c64d26f632")]
[assembly: AssemblyProduct("Winterland.MustLoadInEditor")]
[assembly: AssemblyTitle("Winterland.MustLoadInEditor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 Winterland.MustLoadInEditor
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Winterland.MustLoadInEditor";

		public const string PLUGIN_NAME = "Winterland.MustLoadInEditor";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

Winterland.Plugin.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using CommonAPI;
using CommonAPI.Phone;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using Rewired;
using TMPro;
using UnityEngine;
using Winterland.Common;
using Winterland.Common.Phone;
using Winterland.MapStation.Common;
using Winterland.MapStation.Common.Dependencies;
using Winterland.MapStation.Common.VanillaAssets;
using Winterland.MapStation.Plugin.Dependencies;
using Winterland.Plugin;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Winterland.Plugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("BepInEx Plugin Assembly for Millenium Winterland.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+d57e729790290875d5daaef4022962c64d26f632")]
[assembly: AssemblyProduct("Winterland.Plugin")]
[assembly: AssemblyTitle("Winterland.Plugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 Winterland.Plugin
{
	internal class KBMInputDisabler
	{
		public static void Disable()
		{
			Player rewiredPlayer = Core.Instance.GameInput.rewiredMappingHandler.GetRewiredPlayer(0);
			((Controller)rewiredPlayer.controllers.Mouse).enabled = false;
			((Controller)rewiredPlayer.controllers.Keyboard).enabled = false;
		}
	}
	[BepInPlugin("Winterland.Plugin", "Winterland.Plugin", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public delegate void UpdateDelegate();

		public static Plugin Instance;

		public static ManualLogSource Log = null;

		internal static bool DynamicCameraInstalled = false;

		internal static bool BunchOfEmotesInstalled = false;

		private static Type ForceLoadMapStationCommonAssembly = typeof(AssemblyDependencies);

		private static Type ForceLoadMapStationPluginAssembly = typeof(AssemblyDependencies);

		public static UpdateDelegate UpdateEvent;

		private void Awake()
		{
			Instance = this;
			try
			{
				Initialize();
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Winterland.Plugin 1.1.0 is loaded!");
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)string.Format("Plugin {0} {1} failed to load!{2}{3}", "Winterland.Plugin", "1.1.0", Environment.NewLine, ex));
			}
		}

		private void Initialize()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_00ae: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			WinterNetworking.SlopCrewInstalled = Chainloader.PluginInfos.Keys.Contains("SlopCrew.Plugin");
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "AssetBundles");
			string text2 = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			if (Directory.Exists(text))
			{
				text2 = text;
			}
			WinterAssets val = new WinterAssets(text2);
			PhoneAPI.RegisterApp<AppWinterland>("winterland", val.PhoneResources.AppIcon);
			new WinterConfig(((BaseUnityPlugin)this).Config);
			WinterCharacters.Initialize();
			ObjectiveDatabase.Initialize(val.WinterBundle);
			new WinterProgress();
			Log = ((BaseUnityPlugin)this).Logger;
			StageAPI.OnStagePreInitialization = (StageInitializationDelegate)Delegate.Combine((Delegate?)(object)StageAPI.OnStagePreInitialization, (Delegate?)new StageInitializationDelegate(StageAPI_OnStagePreInitialization));
			new Harmony("Winterland.Plugin").PatchAll();
			BunchOfEmotesInstalled = Chainloader.PluginInfos.Keys.Contains("com.Dragsun.BunchOfEmotes");
			DynamicCameraInstalled = Chainloader.PluginInfos.Keys.Contains("DynamicCamera") || Chainloader.PluginInfos.Keys.Contains("com.Dragsun.Savestate");
		}

		private void StageAPI_OnStagePreInitialization(Stage newStage, Stage previousStage)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			WinterManager.Create().SetupStage(newStage);
		}

		private void Update()
		{
			UpdateEvent?.Invoke();
		}
	}
	public class WinterManager : MonoBehaviour
	{
		public GameObject stageAdditions;

		public static WinterManager Instance { get; private set; }

		public static WinterManager Create()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Winter Manager");
			WinterManager result = val.AddComponent<WinterManager>();
			val.AddComponent<ToyLineManager>();
			val.AddComponent<ArcadeManager>();
			val.AddComponent<GiftPileManager>();
			return result;
		}

		public void SetupStage(Stage stage)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			GameObject prefabForStage = WinterAssets.Instance.GetPrefabForStage(stage);
			if (!((Object)(object)prefabForStage == (Object)null))
			{
				stageAdditions = Object.Instantiate<GameObject>(prefabForStage);
				StageObject[] componentsInChildren = stageAdditions.GetComponentsInChildren<StageObject>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].PutInChunk();
				}
				DebugShapeUtility.SetDebugShapesVisibility(stageAdditions, false);
				Doctor.AnalyzeAndLog(stageAdditions);
			}
		}

		private void SetupUI()
		{
			AssetBundle winterBundle = WinterAssets.Instance.WinterBundle;
			if (!((Object)(object)winterBundle == (Object)null))
			{
				GameObject val = winterBundle.LoadAsset<GameObject>("WinterUI");
				if (!((Object)(object)val == (Object)null))
				{
					GameObject obj = Object.Instantiate<GameObject>(val);
					Transform val2 = ((Component)Core.Instance.UIManager).transform.Find("GamePlayUI(Clone)").Find("GameplayUI").Find("gameplayUIScreen");
					obj.transform.SetParent(val2, false);
				}
			}
		}

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			Instance = this;
			LightmapSettings.lightmaps = (LightmapData[])(object)new LightmapData[0];
			QualitySettings.shadowDistance = 150f;
			StageManager.OnStagePostInitialization += new OnStageInitializedDelegate(StageManager_OnStagePostInitialization);
		}

		private void OnDestroy()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			Instance = null;
			StageManager.OnStagePostInitialization -= new OnStageInitializedDelegate(StageManager_OnStagePostInitialization);
		}

		private void StageManager_OnStagePostInitialization()
		{
			SetupUI();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Winterland.Plugin";

		public const string PLUGIN_NAME = "Winterland.Plugin";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace Winterland.Plugin.Patches
{
	[HarmonyPatch(typeof(AmbientManager))]
	internal class AmbientManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Update")]
		private static bool Update_Prefix(AmbientManager __instance)
		{
			//IL_0015: 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 ((Object)(object)AmbientOverride.Instance == (Object)null)
			{
				return true;
			}
			__instance.ApplyAmbientChange(AmbientOverride.Instance.CurrentLightColor, AmbientOverride.Instance.CurrentShadowColor);
			return false;
		}
	}
	[HarmonyPatch(typeof(CharacterVisual))]
	internal class CharacterVisualPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Init")]
		private static void Init_Postfix(Characters character, RuntimeAnimatorController animatorController, CharacterVisual __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			OverrideAnimations(__instance, character);
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetMoveStyleVisualAnim")]
		private static void SetMoveStyleVisualAnim_Postfix(Player player, CharacterVisual __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Characters character = (Characters)(-1);
			if ((Object)(object)player != (Object)null)
			{
				character = player.character;
			}
			OverrideAnimations(__instance, character);
		}

		private static void OverrideAnimations(CharacterVisual visual, Characters character)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			if (WinterAssets.Instance == null)
			{
				return;
			}
			RuntimeAnimatorController runtimeAnimatorController = visual.anim.runtimeAnimatorController;
			AnimatorOverrideController val = (AnimatorOverrideController)(object)((runtimeAnimatorController is AnimatorOverrideController) ? runtimeAnimatorController : null);
			if ((Object)(object)val == (Object)null)
			{
				val = new AnimatorOverrideController(visual.anim.runtimeAnimatorController);
				visual.anim.runtimeAnimatorController = (RuntimeAnimatorController)(object)val;
			}
			if (WinterCharacters.IsSanta(character) || ((Object)((Component)visual).gameObject).name.StartsWith("Santa Visuals"))
			{
				if ((Object)(object)val["softBounce13"] != (Object)(object)WinterAssets.Instance.PlayerSantaBounce)
				{
					val["softBounce13"] = WinterAssets.Instance.PlayerSantaBounce;
				}
			}
			else
			{
				if (!((Object)(object)val["softBounce13"] == (Object)(object)WinterAssets.Instance.PlayerSantaBounce))
				{
					return;
				}
				if (Plugin.BunchOfEmotesInstalled)
				{
					Player componentInParent = ((Component)visual).GetComponentInParent<Player>();
					if ((Object)(object)componentInParent != (Object)null && !componentInParent.isAI)
					{
						val["softBounce13"] = null;
					}
				}
				else
				{
					val["softBounce13"] = null;
				}
			}
		}
	}
	[HarmonyPatch(typeof(ComboMascot))]
	internal class ComboMascotPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnTriggerEnter")]
		private static bool OnTriggerEnter_Prefix(Collider other)
		{
			WinterPlayer componentInParent = ((Component)other).GetComponentInParent<WinterPlayer>();
			if ((Object)(object)componentInParent == (Object)null)
			{
				return true;
			}
			if ((Object)(object)componentInParent.CurrentToyLine != (Object)null)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(GameplayCamera))]
	internal class GameplayCameraPatch
	{
		private static float OriginalDragDistanceDefault;

		private static float OriginalDragDistanceMax;

		private static float OriginalCameraHeight;

		private static float OriginalCameraFOV;

		private const float CameraTransitionSpeed = 5f;

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(GameplayCamera __instance)
		{
			OriginalDragDistanceDefault = __instance.dragDistanceDefault;
			OriginalDragDistanceMax = __instance.dragDistanceMax;
			OriginalCameraHeight = __instance.defaultCamHeight;
			OriginalCameraFOV = __instance.cam.fieldOfView;
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdateCamera")]
		private static void UpdateCamera_Postfix(GameplayCamera __instance)
		{
		}
	}
	[HarmonyPatch(typeof(GraffitiGame))]
	internal class GraffitiGamePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Init")]
		private static void Init_Postfix(GraffitiSpot g, GraffitiGame __instance, Player p)
		{
			ToyGraffitiSpot val = ToyGraffitiSpot.Get(g);
			if (!((Object)(object)val == (Object)null))
			{
				__instance.distanceToGrafSpot = 1.75f;
				AmbientOverrideTrigger interiorLighting = val.ToyMachine.InteriorLighting;
				AmbientOverride instance = AmbientOverride.Instance;
				if ((Object)(object)interiorLighting != (Object)null && (Object)(object)instance != (Object)null)
				{
					instance.TransitionAmbient(interiorLighting);
				}
				Ability ability = p.ability;
				ToyMachineAbility val2 = (ToyMachineAbility)(object)((ability is ToyMachineAbility) ? ability : null);
				if (val2 != null)
				{
					val2.TaggedAlready = true;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetState")]
		private static void SetState_Postfix(GraffitiGameState setState, GraffitiGame __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			ToyGraffitiSpot val = ToyGraffitiSpot.Get(__instance.gSpot);
			if (!((Object)(object)val == (Object)null) && (int)setState == 2)
			{
				__instance.showPieceCamSpeed = 5f;
				WinterPlayer local = WinterPlayer.GetLocal();
				if ((Object)(object)local.CurrentToyLine != (Object)null)
				{
					val.ToyMachine.ShowBuiltToy(local.CurrentToyLine.Toy, __instance.grafArt);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("End")]
		private static void End_Postfix(GraffitiGame __instance)
		{
			ToyGraffitiSpot val = ToyGraffitiSpot.Get(__instance.gSpot);
			if (!((Object)(object)val == (Object)null))
			{
				val.ToyMachine.HideBuiltToy();
				AmbientOverrideTrigger interiorLighting = val.ToyMachine.InteriorLighting;
				AmbientOverride instance = AmbientOverride.Instance;
				if ((Object)(object)interiorLighting != (Object)null && (Object)(object)instance != (Object)null)
				{
					instance.StopAmbient(interiorLighting);
				}
			}
		}
	}
	[HarmonyPatch(typeof(GraffitiSpot))]
	internal class GraffitiSpotPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("GiveRep")]
		private static bool GiveRep_Prefix(GraffitiSpot __instance)
		{
			if (REPLessGraffiti.IsREPLess(__instance))
			{
				return false;
			}
			if ((Object)(object)ToyGraffitiSpot.Get(__instance) != (Object)null)
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("CanDoGraffiti")]
		private static bool CanDoGraffiti_Prefix(ref bool __result, Player byPlayer, GraffitiSpot __instance)
		{
			if ((Object)(object)ToyGraffitiSpot.Get(__instance) != (Object)null && !(byPlayer.ability is ToyMachineAbility))
			{
				__result = false;
				return false;
			}
			if (byPlayer.ability is ToyMachineAbility)
			{
				WinterPlayer val = WinterPlayer.Get(byPlayer);
				if ((Object)(object)val != (Object)null)
				{
					if ((Object)(object)val.CurrentToyLine == (Object)null)
					{
						__result = false;
						return false;
					}
					if (val.CollectedToyParts != val.CurrentToyLine.ToyParts.Length)
					{
						__result = false;
						return false;
					}
				}
				Ability ability = byPlayer.ability;
				if (!((ToyMachineAbility)((ability is ToyMachineAbility) ? ability : null)).CanTag)
				{
					__result = false;
					return false;
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(GrindAbility))]
	internal class GrindAbilityPatch
	{
		private static bool Fixed = false;

		private static Vector3 DeltaPosition = Vector3.zero;

		private static Quaternion PreviousRotation = Quaternion.identity;

		[HarmonyPrefix]
		[HarmonyPatch("FixedUpdateAbility")]
		private static void FixedUpdateAbility_Prefix(GrindAbility __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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)
			float num = float.Epsilon;
			Vector3 position = ((Ability)__instance).p.tf.position;
			Vector3 forward = ((Ability)__instance).p.tf.forward;
			Vector3 val = __instance.grindLine.GetNextNode(forward) - position;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			if (((Vector3)(ref normalized)).sqrMagnitude <= num)
			{
				Fixed = true;
				DeltaPosition = 1f * (PreviousRotation * Vector3.forward);
				((Ability)__instance).p.SetRotHard(PreviousRotation);
				Transform tf = ((Ability)__instance).p.tf;
				tf.position += DeltaPosition;
			}
			PreviousRotation = ((Ability)__instance).p.tf.rotation;
		}

		[HarmonyPostfix]
		[HarmonyPatch("FixedUpdateAbility")]
		private static void FixedUpdateAbility_Postfix(GrindAbility __instance)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (Fixed)
			{
				Transform tf = ((Ability)__instance).p.tf;
				tf.position -= DeltaPosition;
			}
			Fixed = false;
		}
	}
	[HarmonyPatch(typeof(PauseMenu))]
	internal class PauseMenuPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("RefreshLabels")]
		private static void RefreshLabels_Postfix(PauseMenu __instance)
		{
			WinterProgress instance = WinterProgress.Instance;
			object obj;
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				ILocalProgress localProgress = instance.LocalProgress;
				obj = ((localProgress != null) ? localProgress.Objective : null);
			}
			WinterObjective val = (WinterObjective)obj;
			if (!((Object)(object)val == (Object)null) && val.Test() && !string.IsNullOrEmpty(val.Description))
			{
				((TMP_Text)__instance.currentObjectiveText).text = val.Description;
			}
		}
	}
	[HarmonyPatch(typeof(Player))]
	internal static class PlayerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("ActivateAbility")]
		private static void ActivateAbility_Postfix(Player __instance, Ability a)
		{
			if (__instance.isAI)
			{
				return;
			}
			FireworkHolder instance = FireworkHolder.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				WinterPlayer val = WinterPlayer.Get(__instance);
				if (!((Object)(object)val == (Object)null) && val.InFireworkTrigger && a is HandplantAbility)
				{
					instance.BroadcastLaunch();
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("Init")]
		private static void Init_Postfix(Player __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			WinterPlayer val = ((Component)__instance).gameObject.AddComponent<WinterPlayer>();
			val.player = __instance;
			if (!__instance.isAI)
			{
				val.ToyMachineAbility = new ToyMachineAbility(__instance);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("EndGraffitiMode")]
		private static void EndGraffitiMode_Postfix(Player __instance, GraffitiSpot graffitiSpot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)graffitiSpot.state == 2 && !__instance.isAI && graffitiSpot.ClaimedByPlayableCrew())
			{
				ToyGraffitiSpot val = ToyGraffitiSpot.Get(graffitiSpot);
				if (!((Object)(object)val == (Object)null))
				{
					val.ToyMachine.FinishToyLine();
					val.ToyMachine.TeleportPlayerToExit(true);
					graffitiSpot.allowRedo = true;
				}
			}
		}
	}
	[HarmonyPatch(typeof(SceneObjectsRegister))]
	internal class SceneObjectsRegisterPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("GetTotalGraffitiREP")]
		private static bool GetTotalGraffitiREP_Prefix(ref int __result, SceneObjectsRegister __instance)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			for (int i = 0; i < __instance.grafSpots.Count; i++)
			{
				if (!(__instance.grafSpots[i] is GraffitiSpotFinisher) && !((Object)(object)ToyGraffitiSpot.Get(__instance.grafSpots[i]) != (Object)null) && !REPLessGraffiti.IsREPLess(__instance.grafSpots[i]))
				{
					num += GraffitiSpot.GetREP(__instance.grafSpots[i].size);
				}
			}
			__result = num;
			return false;
		}
	}
	[HarmonyPatch(typeof(StreetLifeCluster))]
	internal class StreetLifeClusterPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("UpdateStreetLifeCluster")]
		private static bool UpdateStreetLifeCluster_Prefix(StreetLifeCluster __instance)
		{
			DeleteVanillaGameObjectsV1 instance = DeleteVanillaGameObjectsV1.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return true;
			}
			if (instance.IsDisabled(((Component)__instance).gameObject))
			{
				__instance.SetClusterActive(false);
				return false;
			}
			return true;
		}
	}
}
namespace Winterland.Common
{
	public class DebugShapeDebugUI : MonoBehaviour
	{
		private bool visible;

		public static DebugShapeDebugUI Instance { get; private set; }

		public static void Create()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if (!((Object)(object)Instance != (Object)null))
			{
				GameObject val = new GameObject("Winterland DebugShapeDebugUI");
				Instance = val.AddComponent<DebugShapeDebugUI>();
				Object.DontDestroyOnLoad((Object)val);
			}
		}

		private void Awake()
		{
			DebugUI.Instance.RegisterMenu("Debug Shapes", (Action)OnDebugUI);
		}

		private void OnDebugUI()
		{
			GUILayout.Label("Red Debug Shapes", Array.Empty<GUILayoutOption>());
			if ((Object)(object)WinterManager.Instance != (Object)null && (Object)(object)WinterManager.Instance.stageAdditions != (Object)null && GUILayout.Button((visible ? "Hide" : "Show") + " Red Debug Shapes", Array.Empty<GUILayoutOption>()))
			{
				visible = !visible;
				DebugShapeUtility.SetDebugShapesVisibility(WinterManager.Instance.stageAdditions, visible);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}