Decompiled source of MoonforgedChristmasDecorations v1.0.3

MoonforgedChristmasDecorations.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoonforgedChristmasDecorations")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoonforgedChristmasDecorations")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("adf433ef-261d-4339-87a0-3b351c8880a7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Moonforged.ChristmasDecorations;

[RequireComponent(typeof(LineRenderer))]
public class BezierRope : MonoBehaviour
{
	public Transform pointA;

	public Transform pointB;

	[Header("Look")]
	public int segments = 24;

	public float width = 0.015f;

	public float sag = 0.25f;

	public Material material;

	[Header("Cloth-like motion")]
	public float windStrength = 0.2f;

	public float jiggleAmplitude = 0.02f;

	public float jiggleSpeed = 1f;

	private LineRenderer _lr;

	private float _seed;

	private void Awake()
	{
		//IL_0083: 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)
		_lr = ((Component)this).GetComponent<LineRenderer>();
		_lr.useWorldSpace = true;
		_lr.startWidth = width;
		_lr.endWidth = width;
		_lr.numCornerVertices = 3;
		_lr.numCapVertices = 3;
		_lr.textureMode = (LineTextureMode)0;
		((Renderer)_lr).material = (Material)(((Object)(object)material != (Object)null) ? ((object)material) : ((object)new Material(Shader.Find("Sprites/Default"))));
		((Renderer)_lr).material.color = Color.black;
		_seed = Random.Range(0f, 1000f);
	}

	private void LateUpdate()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: 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_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_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)
		//IL_0099: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: 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_00bc: 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)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: 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_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0268: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)pointA == (Object)null) && !((Object)(object)pointB == (Object)null))
		{
			_lr.startWidth = width;
			_lr.endWidth = width;
			Vector3 position = pointA.position;
			Vector3 position2 = pointB.position;
			Vector3 val = (position + position2) * 0.5f;
			Vector3 val2 = Vector3.Lerp(position, val, 0.66f) + Vector3.down * sag;
			Vector3 val3 = Vector3.Lerp(position2, val, 0.66f) + Vector3.down * sag;
			Vector3 right = Vector3.right;
			if ((Object)(object)pointA != (Object)null)
			{
				right = pointA.right;
			}
			float num = Time.time + _seed;
			float num2 = Mathf.Sin(num * ((float)Math.PI * 2f) * Mathf.Max(0.01f, jiggleSpeed)) * jiggleAmplitude;
			val2 += right * windStrength * 0.5f + Vector3.up * num2 * 0.5f;
			val3 += right * windStrength * 1f + Vector3.down * num2 * 0.5f;
			int num3 = Mathf.Max(4, segments);
			_lr.positionCount = num3;
			float num4 = 1f / (float)(num3 - 1);
			for (int i = 0; i < num3; i++)
			{
				float num5 = (float)i * num4;
				Vector3 val4 = Mathf.Pow(1f - num5, 3f) * position + 3f * Mathf.Pow(1f - num5, 2f) * num5 * val2 + 3f * (1f - num5) * num5 * num5 * val3 + num5 * num5 * num5 * position2;
				float num6 = num5 * (1f - num5);
				Vector3 val5 = position2 - position;
				val5 = Vector3.Cross(((Vector3)(ref val5)).normalized, Vector3.up);
				Vector3 normalized = ((Vector3)(ref val5)).normalized;
				val4 += normalized * num2 * num6;
				_lr.SetPosition(i, val4);
			}
		}
	}
}
public class ChildLightsCycler : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <Run>d__10 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public ChildLightsCycler <>4__this;

		private float <delay>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Run>d__10(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<delay>5__1 = Mathf.Max(0.05f, <>4__this.stepSeconds);
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<>4__this._mats.Count > 0)
			{
				<>4__this.ApplyStep();
			}
			<>2__current = (object)new WaitForSeconds(<delay>5__1);
			<>1__state = 1;
			return true;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public string[] lightRendererNames = new string[3] { "Light1", "Light2", "Light3" };

	public float stepSeconds = 1f;

	public float intensity = 4.4f;

	private readonly List<Material> _mats = new List<Material>();

	private static readonly Color[] Palette = (Color[])(object)new Color[3]
	{
		Color.red,
		Color.yellow,
		Color.blue
	};

	private int _step;

	private Coroutine _runner;

	private void Awake()
	{
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		_mats.Clear();
		for (int i = 0; i < lightRendererNames.Length; i++)
		{
			Transform val = ((Component)this).transform.Find(lightRendererNames[i]);
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			Renderer component = ((Component)val).GetComponent<Renderer>();
			if (!((Object)(object)component == (Object)null))
			{
				Material sharedMaterial = component.sharedMaterial;
				if (!((Object)(object)sharedMaterial == (Object)null))
				{
					sharedMaterial.EnableKeyword("_EMISSION");
					sharedMaterial.SetColor("_EmissionColor", Palette[i % Palette.Length] * Mathf.LinearToGammaSpace(intensity));
					sharedMaterial.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
					_mats.Add(sharedMaterial);
				}
			}
		}
	}

	private void OnEnable()
	{
		if (_runner == null && _mats.Count > 0)
		{
			_runner = ((MonoBehaviour)this).StartCoroutine(Run());
		}
	}

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

	[IteratorStateMachine(typeof(<Run>d__10))]
	private IEnumerator Run()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Run>d__10(0)
		{
			<>4__this = this
		};
	}

	private void ApplyStep()
	{
		//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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < _mats.Count; i++)
		{
			Material val = _mats[i];
			if (!((Object)(object)val == (Object)null))
			{
				Color val2 = Palette[(i + _step) % Palette.Length];
				val.SetColor("_EmissionColor", val2 * Mathf.LinearToGammaSpace(intensity));
			}
		}
		_step = (_step + 1) % Palette.Length;
	}
}
public class ChristmasLightChaser : MonoBehaviour
{
	public enum AnimationMode
	{
		Chase,
		BlinkAll
	}

	[CompilerGenerated]
	private sealed class <Run>d__20 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public ChristmasLightChaser <>4__this;

		private WaitForSeconds <poll>5__1;

		private WaitForSeconds <stepWait>5__2;

		private bool <hasZdo>5__3;

		private ZNetView <znv>5__4;

		private int <n>5__5;

		private int <i>5__6;

		private Renderer <r>5__7;

		private MaterialPropertyBlock <mpb>5__8;

		private Color <c>5__9;

		private Color <c>5__10;

		private int <i>5__11;

		private Renderer <r>5__12;

		private MaterialPropertyBlock <mpb>5__13;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Run>d__20(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<poll>5__1 = null;
			<stepWait>5__2 = null;
			<znv>5__4 = null;
			<r>5__7 = null;
			<mpb>5__8 = null;
			<r>5__12 = null;
			<mpb>5__13 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: 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)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<poll>5__1 = new WaitForSeconds(0.2f);
				<stepWait>5__2 = new WaitForSeconds(<>4__this.stepSeconds);
				break;
			case 1:
				<>1__state = -1;
				break;
			case 2:
				<>1__state = -1;
				<znv>5__4 = null;
				break;
			}
			<hasZdo>5__3 = false;
			<znv>5__4 = ((Component)<>4__this).GetComponentInParent<ZNetView>();
			if ((Object)(object)<znv>5__4 != (Object)null)
			{
				<hasZdo>5__3 = <znv>5__4.GetZDO() != null;
			}
			if (!<hasZdo>5__3)
			{
				<>4__this._liveStarted = false;
				<>2__current = <poll>5__1;
				<>1__state = 1;
				return true;
			}
			if (!<>4__this._liveStarted)
			{
				<>4__this._liveStarted = true;
				<>4__this._step = 0;
			}
			<n>5__5 = Mathf.Max(1, <>4__this._palette.Length);
			if (<>4__this.mode == AnimationMode.Chase)
			{
				<i>5__6 = 0;
				while (<i>5__6 < <>4__this.targets.Count)
				{
					<r>5__7 = <>4__this.targets[<i>5__6];
					if (Object.op_Implicit((Object)(object)<r>5__7))
					{
						<mpb>5__8 = <>4__this._mpbs[<i>5__6];
						<c>5__9 = <>4__this._palette[(<i>5__6 + <>4__this._step) % <n>5__5];
						if (<>4__this.affectBaseColor)
						{
							<mpb>5__8.SetColor(<>4__this._colorId, <c>5__9);
						}
						<mpb>5__8.SetColor(<>4__this._emissId, <c>5__9 * Mathf.LinearToGammaSpace(<>4__this.emissionIntensity));
						<r>5__7.SetPropertyBlock(<mpb>5__8);
						<r>5__7 = null;
						<mpb>5__8 = null;
					}
					<i>5__6++;
				}
			}
			else
			{
				<c>5__10 = <>4__this._palette[<>4__this._step % <n>5__5];
				<i>5__11 = 0;
				while (<i>5__11 < <>4__this.targets.Count)
				{
					<r>5__12 = <>4__this.targets[<i>5__11];
					if (Object.op_Implicit((Object)(object)<r>5__12))
					{
						<mpb>5__13 = <>4__this._mpbs[<i>5__11];
						if (<>4__this.affectBaseColor)
						{
							<mpb>5__13.SetColor(<>4__this._colorId, <c>5__10);
						}
						<mpb>5__13.SetColor(<>4__this._emissId, <c>5__10 * Mathf.LinearToGammaSpace(<>4__this.emissionIntensity));
						<r>5__12.SetPropertyBlock(<mpb>5__13);
						<r>5__12 = null;
						<mpb>5__13 = null;
					}
					<i>5__11++;
				}
			}
			<>4__this._step++;
			<>2__current = <stepWait>5__2;
			<>1__state = 2;
			return true;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public bool includeInactive = true;

	public Color[] defaultPalette = (Color[])(object)new Color[3]
	{
		Color.red,
		Color.yellow,
		Color.blue
	};

	public Color[] paletteOverride;

	public AnimationMode mode = AnimationMode.Chase;

	[Min(0.01f)]
	public float stepSeconds = 1f;

	[Min(0f)]
	public float emissionIntensity = 4.4f;

	public bool affectBaseColor = false;

	public string[] ignoreNameContains = new string[2] { "cable", "snap" };

	public List<Renderer> targets = new List<Renderer>();

	private readonly List<MaterialPropertyBlock> _mpbs = new List<MaterialPropertyBlock>();

	private int _colorId;

	private int _emissId;

	private int _step;

	private Coroutine _runner;

	private bool _liveStarted;

	private Color[] _palette;

	private void Awake()
	{
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Expected O, but got Unknown
		_palette = ((paletteOverride != null && paletteOverride.Length != 0) ? paletteOverride : defaultPalette);
		_colorId = Shader.PropertyToID("_Color");
		_emissId = Shader.PropertyToID("_EmissionColor");
		if (targets.Count == 0)
		{
			Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(includeInactive);
			foreach (Renderer val in componentsInChildren)
			{
				if (!Object.op_Implicit((Object)(object)val))
				{
					continue;
				}
				string text = ((Object)val).name.ToLowerInvariant();
				bool flag = false;
				for (int j = 0; j < ignoreNameContains.Length; j++)
				{
					if (text.Contains(ignoreNameContains[j]))
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					targets.Add(val);
				}
			}
		}
		_mpbs.Clear();
		foreach (Renderer target in targets)
		{
			if (Object.op_Implicit((Object)(object)target))
			{
				MaterialPropertyBlock val2 = new MaterialPropertyBlock();
				target.GetPropertyBlock(val2);
				if (Object.op_Implicit((Object)(object)target.material))
				{
					target.material.EnableKeyword("_EMISSION");
				}
				_mpbs.Add(val2);
			}
		}
	}

	private void OnEnable()
	{
		if (_runner == null)
		{
			_runner = ((MonoBehaviour)this).StartCoroutine(Run());
		}
	}

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

	[IteratorStateMachine(typeof(<Run>d__20))]
	private IEnumerator Run()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Run>d__20(0)
		{
			<>4__this = this
		};
	}
}
public static class ChristmasLightChaserInstaller
{
	public static void InstallOn(GameObject prefabRoot, float stepSeconds, float emissionIntensity)
	{
		InstallOn(prefabRoot, stepSeconds, emissionIntensity, null, ChristmasLightChaser.AnimationMode.Chase);
	}

	public static void InstallOn(GameObject prefabRoot, float stepSeconds, float emissionIntensity, Color[] paletteOverride, ChristmasLightChaser.AnimationMode mode)
	{
		if (Object.op_Implicit((Object)(object)prefabRoot))
		{
			ChristmasLightChaser christmasLightChaser = prefabRoot.GetComponent<ChristmasLightChaser>();
			if (!Object.op_Implicit((Object)(object)christmasLightChaser))
			{
				christmasLightChaser = prefabRoot.AddComponent<ChristmasLightChaser>();
			}
			christmasLightChaser.includeInactive = true;
			christmasLightChaser.stepSeconds = stepSeconds;
			christmasLightChaser.emissionIntensity = emissionIntensity;
			christmasLightChaser.mode = mode;
			if (paletteOverride != null && paletteOverride.Length != 0)
			{
				christmasLightChaser.paletteOverride = paletteOverride;
			}
			christmasLightChaser.targets = CollectBulbRenderers(prefabRoot, new string[1] { "light" }, new string[6] { "cable", "wire", "string", "snap", "garland", "rope" });
		}
	}

	private static List<Renderer> CollectBulbRenderers(GameObject root, string[] includePrefixes, string[] ignoreContains)
	{
		List<Renderer> list = new List<Renderer>();
		if (!Object.op_Implicit((Object)(object)root))
		{
			return list;
		}
		Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val in componentsInChildren)
		{
			if (!Object.op_Implicit((Object)(object)val))
			{
				continue;
			}
			string text = ((Object)((Component)val).gameObject).name.ToLowerInvariant();
			bool flag = false;
			if (ignoreContains != null)
			{
				foreach (string value in ignoreContains)
				{
					if (!string.IsNullOrEmpty(value) && text.Contains(value))
					{
						flag = true;
						break;
					}
				}
			}
			if (flag)
			{
				continue;
			}
			bool flag2 = includePrefixes == null || includePrefixes.Length == 0;
			if (!flag2)
			{
				foreach (string value2 in includePrefixes)
				{
					if (!string.IsNullOrEmpty(value2) && text.StartsWith(value2))
					{
						flag2 = true;
						break;
					}
				}
			}
			if (flag2)
			{
				list.Add(val);
			}
		}
		return list;
	}
}
public class ChristmasLightsGlow : MonoBehaviour
{
	[Header("Target renderer (child name)")]
	public string rendererChildName = "Christmas tree.007";

	[Header("Choose how to select materials")]
	public bool useIndices = true;

	[Tooltip("Material slots that should glow (0-based)")]
	public int[] glowSlots = new int[3] { 2, 7, 8 };

	[Tooltip("Match by material name (contains, case-insensitive)")]
	public string[] glowNameContains = new string[1] { "vray_Christmas Tree Set3_4.001" };

	[Header("Glow settings")]
	public Color emissionColor = Color.yellow;

	public float intensity = 3f;

	public bool animate = false;

	public float cycleSeconds = 5f;

	private Renderer _rend;

	private Material[] _mats;

	private bool[] _shouldGlow;

	private void Awake()
	{
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		Transform val = ((Component)this).transform.Find(rendererChildName);
		if ((Object)(object)val != (Object)null)
		{
			_rend = ((Component)val).GetComponent<Renderer>();
		}
		if ((Object)(object)_rend == (Object)null)
		{
			_rend = (from r in ((Component)this).GetComponentsInChildren<Renderer>(true)
				orderby (r.sharedMaterials != null) ? r.sharedMaterials.Length : 0 descending
				select r).FirstOrDefault();
		}
		if ((Object)(object)_rend == (Object)null)
		{
			return;
		}
		_mats = _rend.materials;
		_shouldGlow = new bool[_mats.Length];
		for (int i = 0; i < _mats.Length; i++)
		{
			bool flag = false;
			if (useIndices)
			{
				for (int j = 0; j < glowSlots.Length; j++)
				{
					if (glowSlots[j] == i)
					{
						flag = true;
						break;
					}
				}
			}
			else
			{
				string text = (((Object)(object)_mats[i] != (Object)null) ? ((Object)_mats[i]).name : "");
				for (int k = 0; k < glowNameContains.Length; k++)
				{
					if (!string.IsNullOrEmpty(glowNameContains[k]) && text.ToLower().Contains(glowNameContains[k].ToLower()))
					{
						flag = true;
						break;
					}
				}
			}
			_shouldGlow[i] = flag;
			if (flag && (Object)(object)_mats[i] != (Object)null)
			{
				_mats[i].EnableKeyword("_EMISSION");
				Color val2 = emissionColor * Mathf.LinearToGammaSpace(intensity);
				_mats[i].SetColor("_EmissionColor", val2);
				_mats[i].globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
			}
		}
		_rend.materials = _mats;
	}

	private void Update()
	{
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: 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)
		if (!animate || _mats == null)
		{
			return;
		}
		float num = Mathf.Max(0.01f, cycleSeconds);
		float num2 = Time.time % num / num;
		float num3 = 0.5f + 0.5f * Mathf.Sin(num2 * (float)Math.PI * 2f);
		for (int i = 0; i < _mats.Length; i++)
		{
			if (_shouldGlow[i] && (Object)(object)_mats[i] != (Object)null)
			{
				Color val = emissionColor * Mathf.LinearToGammaSpace(intensity * (0.5f + num3));
				_mats[i].SetColor("_EmissionColor", val);
			}
		}
	}
}
public class DeerMarker : MonoBehaviour
{
	public static readonly HashSet<DeerMarker> All = new HashSet<DeerMarker>();

	private void OnEnable()
	{
		All.Add(this);
	}

	private void OnDisable()
	{
		All.Remove(this);
	}
}
public class IcicleFlow : MonoBehaviour
{
	public enum Axis
	{
		Auto,
		Y,
		Z
	}

	private class Column
	{
		public int columnIndex;

		public int batch;

		public float cycleLength;

		public List<Renderer> bulbs = new List<Renderer>();

		public List<MaterialPropertyBlock> mpb = new List<MaterialPropertyBlock>();
	}

	[Header("Target naming")]
	public string columnNamePrefix = "Icicle_Lamp_";

	public string bulbNamePrefix = "Light";

	[Header("Look")]
	public Color dripColor = new Color(0.6f, 0.85f, 1f);

	[Min(0f)]
	public float emissionIntensity = 4.5f;

	public bool affectBaseColor = false;

	[Header("Timing")]
	[Min(0.01f)]
	public float dripStepSeconds = 0.15f;

	[Min(0f)]
	public float pauseAfterColumn = 0.6f;

	[Min(1f)]
	public int batchCount = 3;

	[Min(0f)]
	public float batchSpacingSeconds = 4f;

	[Header("Advanced")]
	public bool includeInactive = true;

	public bool autoDetectVerticalAxis = true;

	public Axis verticalAxis = Axis.Auto;

	[Header("Performance")]
	[Min(0.01f)]
	public float minUpdateInterval = 0.05f;

	[Min(0f)]
	public float activeDistance = 60f;

	private readonly List<Column> _columns = new List<Column>();

	private float _gammaIntensity;

	private int _colorId;

	private int _emissId;

	private float _accum;

	private bool _isActive;

	private void Awake()
	{
		_colorId = Shader.PropertyToID("_Color");
		_emissId = Shader.PropertyToID("_EmissionColor");
		_gammaIntensity = Mathf.LinearToGammaSpace(Mathf.Max(0f, emissionIntensity));
		BuildColumns();
	}

	private void OnEnable()
	{
		PrepareMPBs();
	}

	private void Update()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		if (_columns.Count == 0)
		{
			return;
		}
		if (activeDistance > 0f && !Player.IsPlayerInRange(((Component)this).transform.position, activeDistance))
		{
			if (_isActive)
			{
				for (int i = 0; i < _columns.Count; i++)
				{
					SetColumnAll(_columns[i], Color.black);
				}
				_isActive = false;
			}
			return;
		}
		_isActive = true;
		_accum += Time.deltaTime;
		if (_accum < minUpdateInterval)
		{
			return;
		}
		_accum = 0f;
		float time = Time.time;
		for (int j = 0; j < _columns.Count; j++)
		{
			Column column = _columns[j];
			if (column.bulbs.Count == 0)
			{
				continue;
			}
			float num = (float)column.batch * Mathf.Min(batchSpacingSeconds, column.cycleLength * 0.9f);
			float num2 = time - num;
			if (num2 < 0f)
			{
				SetColumnAll(column, Color.black);
				continue;
			}
			float num3 = column.cycleLength;
			if (num3 <= 0.0001f)
			{
				num3 = 0.0001f;
			}
			float num4 = num2 % num3;
			int count = column.bulbs.Count;
			float num5 = (float)count * Mathf.Max(0.01f, dripStepSeconds);
			if (num4 >= 0f && num4 < num5)
			{
				int activeIndex = Mathf.Clamp(Mathf.FloorToInt(num4 / Mathf.Max(0.01f, dripStepSeconds)), 0, count - 1);
				SetColumnActive(column, activeIndex, dripColor);
			}
			else
			{
				SetColumnAll(column, Color.black);
			}
		}
	}

	private void BuildColumns()
	{
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Expected O, but got Unknown
		_columns.Clear();
		List<Transform> list = new List<Transform>();
		Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(includeInactive);
		foreach (Transform val in componentsInChildren)
		{
			if (Object.op_Implicit((Object)(object)val) && (string.IsNullOrEmpty(columnNamePrefix) || ((Object)val).name.StartsWith(columnNamePrefix)))
			{
				list.Add(val);
			}
		}
		list.Sort((Transform a, Transform b) => a.localPosition.x.CompareTo(b.localPosition.x));
		for (int j = 0; j < list.Count; j++)
		{
			Transform val2 = list[j];
			Column column = new Column();
			column.columnIndex = j;
			column.batch = ((batchCount > 0) ? (j % batchCount) : 0);
			Renderer[] componentsInChildren2 = ((Component)val2).GetComponentsInChildren<Renderer>(includeInactive);
			foreach (Renderer val3 in componentsInChildren2)
			{
				if (Object.op_Implicit((Object)(object)val3))
				{
					string text = ((Object)((Component)val3).gameObject).name.ToLowerInvariant();
					if (string.IsNullOrEmpty(bulbNamePrefix) || text.StartsWith(bulbNamePrefix.ToLowerInvariant()))
					{
						column.bulbs.Add(val3);
					}
				}
			}
			if (column.bulbs.Count != 0)
			{
				Axis axis = ResolveAxis(column.bulbs);
				column.bulbs.Sort(delegate(Renderer a, Renderer b)
				{
					float localAxis = GetLocalAxis(((Component)a).transform, axis);
					float localAxis2 = GetLocalAxis(((Component)b).transform, axis);
					return -localAxis.CompareTo(localAxis2);
				});
				for (int l = 0; l < column.bulbs.Count; l++)
				{
					column.mpb.Add(new MaterialPropertyBlock());
				}
				column.cycleLength = (float)column.bulbs.Count * Mathf.Max(0.01f, dripStepSeconds) + Mathf.Max(0f, pauseAfterColumn);
				_columns.Add(column);
			}
		}
	}

	private Axis ResolveAxis(List<Renderer> bulbs)
	{
		//IL_005a: 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)
		//IL_0061: 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_0071: 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_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		if (!autoDetectVerticalAxis)
		{
			return (verticalAxis == Axis.Auto) ? Axis.Z : verticalAxis;
		}
		float num = float.PositiveInfinity;
		float num2 = float.NegativeInfinity;
		float num3 = float.PositiveInfinity;
		float num4 = float.NegativeInfinity;
		for (int i = 0; i < bulbs.Count; i++)
		{
			Transform transform = ((Component)bulbs[i]).transform;
			Vector3 localPosition = transform.localPosition;
			if (localPosition.y < num)
			{
				num = localPosition.y;
			}
			if (localPosition.y > num2)
			{
				num2 = localPosition.y;
			}
			if (localPosition.z < num3)
			{
				num3 = localPosition.z;
			}
			if (localPosition.z > num4)
			{
				num4 = localPosition.z;
			}
		}
		float num5 = num2 - num;
		float num6 = num4 - num3;
		if (num5 >= num6)
		{
			return Axis.Y;
		}
		return Axis.Z;
	}

	private float GetLocalAxis(Transform t, Axis axis)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: 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)
		return axis switch
		{
			Axis.Y => t.localPosition.y, 
			Axis.Z => t.localPosition.z, 
			_ => t.localPosition.z, 
		};
	}

	private void PrepareMPBs()
	{
		for (int i = 0; i < _columns.Count; i++)
		{
			Column column = _columns[i];
			for (int j = 0; j < column.bulbs.Count; j++)
			{
				Renderer val = column.bulbs[j];
				if (Object.op_Implicit((Object)(object)val))
				{
					Material sharedMaterial = val.sharedMaterial;
					if ((Object)(object)sharedMaterial != (Object)null)
					{
						sharedMaterial.EnableKeyword("_EMISSION");
					}
					val.GetPropertyBlock(column.mpb[j]);
				}
			}
		}
	}

	private void SetColumnActive(Column col, int activeIndex, Color onColor)
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < col.bulbs.Count; i++)
		{
			Renderer val = col.bulbs[i];
			if (Object.op_Implicit((Object)(object)val))
			{
				MaterialPropertyBlock val2 = col.mpb[i];
				if (affectBaseColor)
				{
					val2.SetColor(_colorId, (i == activeIndex) ? onColor : Color.black);
				}
				val2.SetColor(_emissId, (i == activeIndex) ? (onColor * _gammaIntensity) : Color.black);
				val.SetPropertyBlock(val2);
			}
		}
	}

	private void SetColumnAll(Column col, Color c)
	{
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < col.bulbs.Count; i++)
		{
			Renderer val = col.bulbs[i];
			if (Object.op_Implicit((Object)(object)val))
			{
				MaterialPropertyBlock val2 = col.mpb[i];
				if (affectBaseColor)
				{
					val2.SetColor(_colorId, c);
				}
				val2.SetColor(_emissId, c * _gammaIntensity);
				val.SetPropertyBlock(val2);
			}
		}
	}
}
[BepInPlugin("Moonforged.ChristmasDecorations", "Moonforged Christmas Decorations", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MoonforgedChristmas : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <DelayedRegister>d__7 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public AssetBundle bundle;

		public MoonforgedChristmas <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DelayedRegister>d__7(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if ((Object)(object)ZNetScene.instance == (Object)null)
			{
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			RelicRegistrar.RegisterAllRelics(bundle);
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public const string PluginGUID = "Moonforged.ChristmasDecorations";

	public const string PluginName = "Moonforged Christmas Decorations";

	public const string PluginVersion = "1.0.3";

	private AssetBundle christmasBundle;

	private static readonly List<GameObject> placedObjects = new List<GameObject>();

	public static ConfigEntry<string> PlayerPreferredCategory;

	private void Awake()
	{
		//IL_0006: 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)
		new Harmony("moonforged.christmas.scalingdebug").PatchAll();
		string resourcePath = "MoonforgedChristmasDecorations.christmas";
		christmasBundle = EmbeddedAssetBundleLoader.LoadBundle(resourcePath);
		if ((Object)(object)christmasBundle == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load embedded AssetBundle.");
			return;
		}
		TrackAllPrefabsInBundle(christmasBundle);
		PlayerPreferredCategory = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CustomHammerTab", "Moonforged Christmas", "Set the hammer tab where this mod's pieces should appear (e.g., Building, Furniture, Moonforged Christmas)");
		foreach (string allCategory in RelicRegistrar.GetAllCategories())
		{
			PieceManager.Instance.AddPieceCategory(allCategory);
		}
		PrefabManager.OnPrefabsRegistered += delegate
		{
			((MonoBehaviour)this).StartCoroutine(DelayedRegister(christmasBundle));
		};
	}

	[IteratorStateMachine(typeof(<DelayedRegister>d__7))]
	private IEnumerator DelayedRegister(AssetBundle bundle)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DelayedRegister>d__7(0)
		{
			<>4__this = this,
			bundle = bundle
		};
	}

	public static void TrackAllPrefabsInBundle(AssetBundle bundle)
	{
		GameObject[] array = bundle.LoadAllAssets<GameObject>();
		foreach (GameObject val in array)
		{
			if ((Object)(object)val != (Object)null && (Object)(object)val.GetComponent<PlacementWatcher>() == (Object)null)
			{
				val.AddComponent<PlacementWatcher>().RegisterList = placedObjects;
			}
		}
	}
}
public static class EmbeddedAssetBundleLoader
{
	public static AssetBundle LoadBundle(string resourcePath)
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		using Stream stream = executingAssembly.GetManifestResourceStream(resourcePath);
		if (stream == null)
		{
			Debug.LogError((object)("AssetBundle resource not found: " + resourcePath));
			return null;
		}
		byte[] array = new byte[stream.Length];
		stream.Read(array, 0, array.Length);
		return AssetBundle.LoadFromMemory(array);
	}
}
public class PlacementWatcher : MonoBehaviour
{
	public List<GameObject> RegisterList;

	private void Start()
	{
		if (RegisterList != null && !RegisterList.Contains(((Component)this).gameObject))
		{
			RegisterList.Add(((Component)this).gameObject);
		}
	}

	private void OnDestroy()
	{
		if (RegisterList != null)
		{
			RegisterList.Remove(((Component)this).gameObject);
		}
	}
}
public class RainbowGlow : MonoBehaviour
{
	public float cycleSeconds = 10f;

	public float emissionIntensity = 1.5f;

	public float lightRange = 3f;

	public float lightIntensity = 1.8f;

	private bool _active;

	private Material _matInstance;

	private Light _light;

	private void Start()
	{
		//IL_0060: 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)
		_active = (Object)(object)((Component)this).GetComponentInParent<ItemStand>() != (Object)null;
		if (_active)
		{
			Renderer componentInChildren = ((Component)this).GetComponentInChildren<Renderer>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				_matInstance = componentInChildren.material;
				_matInstance.EnableKeyword("_EMISSION");
				_matInstance.SetColor("_EmissionColor", Color.white * emissionIntensity);
				_matInstance.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
			}
			_light = ((Component)this).GetComponent<Light>();
			if ((Object)(object)_light == (Object)null)
			{
				_light = ((Component)this).gameObject.AddComponent<Light>();
				_light.type = (LightType)2;
				_light.range = lightRange;
				_light.intensity = lightIntensity;
				_light.shadows = (LightShadows)0;
			}
		}
	}

	private void Update()
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: 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_007b: Unknown result type (might be due to invalid IL or missing references)
		if (_active && !((Object)(object)_matInstance == (Object)null) && !((Object)(object)_light == (Object)null))
		{
			float num = Mathf.Max(0.01f, cycleSeconds);
			float num2 = Time.time % num / num;
			Color val = Color.HSVToRGB(num2, 1f, 1f);
			_matInstance.SetColor("_EmissionColor", val * emissionIntensity);
			_light.color = val;
		}
	}
}
public class RelicRegistration
{
	public string PrefabName;

	public string DisplayName;

	public RequirementConfig[] Requirements;

	public string Description;

	public string Category;

	public int Comfort;

	public string CraftingStation;

	public RelicRegistration(string prefab, string display, RequirementConfig[] reqs, string desc, string cat, int comfort = 0, string craftingStation = "Workbench")
	{
		PrefabName = prefab;
		DisplayName = display;
		Requirements = reqs;
		Description = desc;
		Category = cat;
		Comfort = comfort;
		CraftingStation = craftingStation;
	}
}
public static class RelicRegistrar
{
	private class ScaleEnforcer : MonoBehaviour
	{
		public Vector3 desiredScale = Vector3.one;

		private void Awake()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localScale = desiredScale;
		}
	}

	private static bool wasAlreadyRegistered = false;

	private static bool _starRegistered = false;

	public static readonly List<RelicRegistration> AllRegistrations = new List<RelicRegistration>
	{
		new RelicRegistration("M_Christmas_Tree_1", "Town Square Christmas Tree", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("Wood", 30, 0, true),
			new RequirementConfig("Raspberry", 20, 0, true),
			new RequirementConfig("Blueberries", 20, 0, true),
			new RequirementConfig("Cloudberry", 20, 0, true)
		}, "Large town square Christmas Tree, craft a Star in the workbench and place it on the top.", "building"),
		new RelicRegistration("M_Christmas_Tree_Small", "Small Christmas Tree", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("Wood", 10, 0, true),
			new RequirementConfig("Raspberry", 5, 0, true),
			new RequirementConfig("Blueberries", 5, 0, true),
			new RequirementConfig("Cloudberry", 5, 0, true)
		}, "A small Christmas Tree, craft a Star in the workbench and place it on the top.", "building"),
		new RelicRegistration("M_Garland", "Green Christmas Garland", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("FineWood", 2, 0, true),
			new RequirementConfig("Raspberry", 2, 0, true)
		}, "A traditional Holiday decoration, you can link them with bows.", "building"),
		new RelicRegistration("M_Garland_White", "White Christmas Garland", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("FineWood", 2, 0, true),
			new RequirementConfig("Blueberries", 2, 0, true)
		}, "A traditional Holiday decoration, you can link them with bows.", "building"),
		new RelicRegistration("M_Garland_Spiral_Green", "Christmas Spiral Garland (Green)", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("FineWood", 5, 0, true),
			new RequirementConfig("PineCone", 1, 0, true)
		}, "They can be used arround pillars and poles.", "building"),
		new RelicRegistration("M_Garland_Spiral_White", "Christmas Spiral Garland (White)", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("FineWood", 5, 0, true),
			new RequirementConfig("PineCone", 1, 0, true)
		}, "They can be used arround pillars and poles.", "building"),
		new RelicRegistration("M_Christmas_Wreath", "Christmas Wreath", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("FineWood", 1, 0, true),
			new RequirementConfig("FirCone", 4, 0, true),
			new RequirementConfig("Raspberry", 10, 0, true)
		}, "Brings a traditional feeling in your homes.", "building"),
		new RelicRegistration("M_mistletoe", "Christmas Mistletoe", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("FineWood", 1, 0, true),
			new RequirementConfig("JuteRed", 1, 0, true)
		}, "Kiss your partner or the troll under it.", "building"),
		new RelicRegistration("Christmas_Lights1", "Christmas Star Lights", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 5, 0, true)
		}, "Nice Twinkly Star shaped Lights.", "building"),
		new RelicRegistration("Christmas_Lights2", "Christmas Snowflake Lights", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 5, 0, true)
		}, "Nice Twinkly Snowflake shaped Lights", "building"),
		new RelicRegistration("MChristmas_Lights1", "Christmas Lights", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Raspberry", 5, 0, true),
			new RequirementConfig("Blueberries", 5, 0, true),
			new RequirementConfig("Cloudberry", 5, 0, true)
		}, "Nice Twinkly Lights", "building"),
		new RelicRegistration("MChristmas_LongLights1", "Christmas Long Lights", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Raspberry", 5, 0, true),
			new RequirementConfig("Blueberries", 5, 0, true),
			new RequirementConfig("Cloudberry", 5, 0, true)
		}, "Nice Twinkly Lights", "building"),
		new RelicRegistration("M_Icicle_Lamp", "Icicle Christmas Lights", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 5, 0, true)
		}, "Glowing icicle light string that drips with blue light.", "building"),
		new RelicRegistration("MultiStar_Light", "Star Lights", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 5, 0, true)
		}, "Glowing Multi Star lights.", "building"),
		new RelicRegistration("8Meter_Town_Light", "8 Meter Town Square Light", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 5, 0, true)
		}, "Town Square Star Light Decoration.", "building"),
		new RelicRegistration("M_Snowflake", "Christmas Hanging Snowflake Model I", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 1, 0, true)
		}, "A Shiny Hanging Snowflake.", "building"),
		new RelicRegistration("M_Snowflake2", "Christmas Hanging Snowflake Model II", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 1, 0, true)
		}, "A Shiny Hanging Snowflake.", "building"),
		new RelicRegistration("M_Snowflake3", "Christmas Hanging Snowflake Model III", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 1, 0, true)
		}, "A Shiny Hanging Snowflake.", "building"),
		new RelicRegistration("M_Snowflake4", "Christmas Hanging Snowflake Model IV", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 1, 0, true)
		}, "A Shiny Hanging Snowflake.", "building"),
		new RelicRegistration("M_Gift_BlackOrange_Valheim", "Black & Orange Gift", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("FineWood", 1, 0, true),
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Carrot", 1, 0, true),
			new RequirementConfig("Coal", 2, 0, true)
		}, "A Gift to place under the tree.", "building"),
		new RelicRegistration("M_Gift_Yellow_Deco", "Yellow Christmas Gift", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("FineWood", 1, 0, true),
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Coal", 1, 0, true),
			new RequirementConfig("Dandelion", 1, 0, true)
		}, "A Gift to place under the tree.", "building"),
		new RelicRegistration("M_Gift_Red_Blue", "Red & Blue Christmas Gift", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("FineWood", 1, 0, true),
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Blueberries", 1, 0, true),
			new RequirementConfig("Raspberry", 1, 0, true)
		}, "A Gift to place under the tree.", "building"),
		new RelicRegistration("M_Gree_Gold_Gift", "Green & Gold Christmas Gift", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("FineWood", 1, 0, true),
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Dandelion", 2, 0, true)
		}, "A Gift to place under the tree.", "building"),
		new RelicRegistration("M_SnowFlake_Blue", "Blue Snowflake Gift", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("FineWood", 1, 0, true),
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Blueberries", 2, 0, true),
			new RequirementConfig("Cloudberry", 1, 0, true)
		}, "A Gift to place under the tree.", "building"),
		new RelicRegistration("M_SnowFlake_Red", "Red Snowflake Gift", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("FineWood", 1, 0, true),
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Raspberry", 1, 0, true),
			new RequirementConfig("Cloudberry", 1, 0, true)
		}, "A Gift to place under the tree.", "building"),
		new RelicRegistration("M_Gift_Silver_Black", "Silver & Black Gift", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("FineWood", 1, 0, true),
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Coal", 1, 0, true),
			new RequirementConfig("Cloudberry", 1, 0, true)
		}, "A Gift to place under the tree.", "building"),
		new RelicRegistration("M_BigblueChristmasbow", "Big Blue Christmas Bow", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Blueberries", 2, 0, true)
		}, "A nice Bow to connect your garlands.", "building"),
		new RelicRegistration("M_BigredChristmasbow", "Big Red Christmas Bow", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Bloodbag", 1, 0, true)
		}, "A nice Bow to connect your garlands.", "building"),
		new RelicRegistration("M_Cozy_Yule_Cup", "Cozy Yule Hot Cocoa Cup", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Wood", 1, 0, true),
			new RequirementConfig("Coal", 1, 0, true),
			new RequirementConfig("Cloudberry", 1, 0, true)
		}, "", "building"),
		new RelicRegistration("M_Cozy_Candy_Cane_Cup", "Hot Cocoa Cup with a Candy Cane", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Wood", 1, 0, true),
			new RequirementConfig("Coal", 1, 0, true),
			new RequirementConfig("Cloudberry", 1, 0, true)
		}, "", "building"),
		new RelicRegistration("Christmas_Cups3", "Hot Cocoa Cup with a Chocolate Tree", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Wood", 1, 0, true),
			new RequirementConfig("Coal", 1, 0, true),
			new RequirementConfig("Cloudberry", 1, 0, true)
		}, "", "building"),
		new RelicRegistration("M_MilkandCookiesforSanta", "Milk and Cookies for Santa", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("Resin", 1, 0, true),
			new RequirementConfig("Coal", 1, 0, true)
		}, "", "building"),
		new RelicRegistration("M_Gingerbread_Man", "Gingerbread Man", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Wood", 1, 0, true)
		}, "We finaly caught him!", "building"),
		new RelicRegistration("M_Christmas_Cake", "Christmas Cake on a Plate", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Stone", 1, 0, true),
			new RequirementConfig("Blueberries", 5, 0, true),
			new RequirementConfig("BarleyFlour", 1, 0, true)
		}, "Don`t eat it all, leave some for Santa.", "building"),
		new RelicRegistration("M_Christmas_Cake2", "Christmas Strawberry Cake on a Plate", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Stone", 1, 0, true),
			new RequirementConfig("Raspberry", 5, 0, true),
			new RequirementConfig("BarleyFlour", 1, 0, true)
		}, "Don`t eat it all, leave some for Santa.", "building"),
		new RelicRegistration("M_YuleLogCake", "Yule Log Cake", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Wood", 1, 0, true),
			new RequirementConfig("Raspberry", 5, 0, true),
			new RequirementConfig("BarleyFlour", 1, 0, true)
		}, "Is not a poop is a cake.", "building"),
		new RelicRegistration("M_Christmas_Wine", "Bottle of Wine", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Wood", 1, 0, true),
			new RequirementConfig("Stone", 1, 0, true),
			new RequirementConfig("Raspberry", 5, 0, true)
		}, "Moonforged Christmas Home made Wine for you all.", "building"),
		new RelicRegistration("M_Red_Candy_Cane_1m", "Red Candy Cane", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Wood", 1, 0, true),
			new RequirementConfig("Raspberry", 1, 0, true),
			new RequirementConfig("Cloudberry", 1, 0, true)
		}, "Candy Cane decorations.", "building"),
		new RelicRegistration("M_Green_Candy_Cane_1m", "Green Candy Cane", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("Wood", 1, 0, true),
			new RequirementConfig("Dandelion", 1, 0, true)
		}, "Candy Cane decorations.", "building"),
		new RelicRegistration("M_RedGreen_Candy_Cane_1m", "Red & Green Candy Cane", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Wood", 1, 0, true),
			new RequirementConfig("Raspberry", 1, 0, true),
			new RequirementConfig("Dandelion", 1, 0, true)
		}, "Candy Cane decorations.", "building"),
		new RelicRegistration("M_Green_Red_Candy_Cane_1m", "Green & Red Candy Cane", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Wood", 1, 0, true),
			new RequirementConfig("Raspberry", 1, 0, true),
			new RequirementConfig("Dandelion", 1, 0, true)
		}, "Candy Cane decorations.", "building"),
		new RelicRegistration("M_Christmas_Stocking", "Christmas Stocking", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("LeatherScraps", 1, 0, true),
			new RequirementConfig("Bloodbag", 1, 0, true)
		}, "", "building"),
		new RelicRegistration("M_Christmas_Stocking_2", "Large Christmas Stocking", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Raspberry", 1, 0, true)
		}, "", "building"),
		new RelicRegistration("M_Snowman", "Snowman", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Wood", 3, 0, true),
			new RequirementConfig("Coal", 5, 0, true),
			new RequirementConfig("Carrot", 1, 0, true)
		}, "", "building"),
		new RelicRegistration("M_SantaClaus", "Santa Claus", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("FineWood", 10, 0, true),
			new RequirementConfig("LeatherScraps", 10, 0, true),
			new RequirementConfig("Raspberry", 10, 0, true),
			new RequirementConfig("Cloudberry", 5, 0, true)
		}, "Saint Nicholas", "building"),
		new RelicRegistration("M_Small_Santa_Claus", "Small Santa Claus Figurine", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("FineWood", 2, 0, true),
			new RequirementConfig("LeatherScraps", 3, 0, true),
			new RequirementConfig("Raspberry", 3, 0, true),
			new RequirementConfig("Cloudberry", 1, 0, true)
		}, "He`s always watching, what a creep.", "building"),
		new RelicRegistration("M_SantaBag", "Santa’s Bag of Gifts", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("Wood", 2, 0, true),
			new RequirementConfig("LeatherScraps", 10, 0, true)
		}, "Wonder whats inside?", "building"),
		new RelicRegistration("M_boot", "Santa’s Boot of Gifts and Flowers", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("Wood", 2, 0, true),
			new RequirementConfig("Raspberry", 2, 0, true)
		}, "You can put gifts or flowers inside the boot.", "building"),
		new RelicRegistration("M_Nutcracker", "Nutcracker Figurine", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("FineWood", 1, 0, true)
		}, "Wooden figurine with a hinged mouth for cracking nuts.", "building"),
		new RelicRegistration("M_Deer", "Santa’s Reindeers", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("DeerMeat", 4, 0, true),
			new RequirementConfig("DeerHide", 4, 0, true)
		}, "Dasher, Dancer, Prancer, Vixen, Comet, Cupid, Donner, Blitzen", "building"),
		new RelicRegistration("M_Deer_Rudy", "Rudolph the Red-Nosed Reindeer", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("DeerMeat", 4, 0, true),
			new RequirementConfig("DeerHide", 4, 0, true),
			new RequirementConfig("Raspberry", 1, 0, true)
		}, "A very shiny nose. You might even say it glows.", "building"),
		new RelicRegistration("M_Christmas_Sled", "Santa’s Sled", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("Wood", 40, 0, true),
			new RequirementConfig("BronzeNails", 20, 0, true),
			new RequirementConfig("Bronze", 5, 0, true)
		}, "Sanat`s Christmas Sled, you can sit in it.", "building", 0, "Forge"),
		new RelicRegistration("M_Christmas_Train", "Christmas Train", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("FineWood", 5, 0, true),
			new RequirementConfig("Iron", 1, 0, true)
		}, "A small train that runs around its track and you can ride it round and round.", "building", 0, "Forge"),
		new RelicRegistration("M_Christmas_Banner_1", "Santa`s Christmas Banner I", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("LeatherScraps", 6, 0, true),
			new RequirementConfig("FineWood", 2, 0, true),
			new RequirementConfig("Raspberry", 2, 0, true),
			new RequirementConfig("Guck", 1, 0, true)
		}, "Reindeers under the mistletoe", "building"),
		new RelicRegistration("M_Christmas_Banner_2", "Santa`s Christmas Banner II", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("LeatherScraps", 6, 0, true),
			new RequirementConfig("FineWood", 2, 0, true),
			new RequirementConfig("Raspberry", 2, 0, true),
			new RequirementConfig("Guck", 1, 0, true)
		}, "Jingle bells", "building"),
		new RelicRegistration("M_Christmas_Banner_4", "Santa`s Christmas Banner IV", (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("LeatherScraps", 6, 0, true),
			new RequirementConfig("FineWood", 2, 0, true),
			new RequirementConfig("Raspberry", 2, 0, true),
			new RequirementConfig("Cloudberry", 1, 0, true)
		}, "Reindeers under the evening star.", "building"),
		new RelicRegistration("M_Bench", "Santa`s Christmas Bench", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("FineWood", 5, 0, true),
			new RequirementConfig("Iron", 2, 0, true)
		}, "", "building", 0, "Forge"),
		new RelicRegistration("M_Christmas_Throne", "Santa`s Christmas Throne", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("FineWood", 20, 0, true),
			new RequirementConfig("BronzeNails", 10, 0, true),
			new RequirementConfig("JuteRed", 2, 0, true)
		}, "Sit on Santa`s lap and tell him what you want for christmas.", "building", 0, "Forge"),
		new RelicRegistration("M_Star", "Evening Star", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 2, 0, true)
		}, "Can be placed on top of the Christmas tree", "building"),
		new RelicRegistration("Tio_de_Nadal", "Tió de Nadal", (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig("RoundLog", 2, 0, true),
			new RequirementConfig("LeatherScraps", 2, 0, true),
			new RequirementConfig("Raspberry", 1, 0, true)
		}, "", "building"),
		new RelicRegistration("M_icicles", "An Icicle.", (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Crystal", 1, 0, true)
		}, "Dripping ice decoration.", "building"),
		new RelicRegistration("ChirstmasMozaic_1", "Snowman Stained-Glass Window.", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("Crystal", 1, 0, true),
			new RequirementConfig("FineWood", 4, 0, true)
		}, "", "building"),
		new RelicRegistration("ChirstmasMozaic_2", "Santa`s Stained-Glass Window.", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("Crystal", 1, 0, true),
			new RequirementConfig("FineWood", 4, 0, true)
		}, "", "building"),
		new RelicRegistration("ChristmasHouseMozaic", "Christmas Home Stained-Glass Window.", (RequirementConfig[])(object)new RequirementConfig[2]
		{
			new RequirementConfig("Crystal", 1, 0, true),
			new RequirementConfig("FineWood", 4, 0, true)
		}, "", "building")
	};

	public static IEnumerable<string> GetAllCategories()
	{
		return AllRegistrations.Select((RelicRegistration r) => CategoryToTab(r.Category)).Distinct();
	}

	private static string CategoryToTab(string category)
	{
		string text = category.ToLower();
		string text2 = text;
		string text3 = text2;
		if (text3 == "building")
		{
			return MoonforgedChristmas.PlayerPreferredCategory.Value;
		}
		return category;
	}

	public static void RegisterAllRelics(AssetBundle bundle)
	{
		if (wasAlreadyRegistered)
		{
			return;
		}
		foreach (RelicRegistration allRegistration in AllRegistrations)
		{
			RegisterRelic(bundle, allRegistration);
		}
		wasAlreadyRegistered = true;
	}

	private static void RegisterRelic(AssetBundle bundle, RelicRegistration reg)
	{
		//IL_0095: 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_00be: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0302: Unknown result type (might be due to invalid IL or missing references)
		//IL_0307: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0391: Unknown result type (might be due to invalid IL or missing references)
		//IL_042c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0431: Unknown result type (might be due to invalid IL or missing references)
		//IL_0997: Unknown result type (might be due to invalid IL or missing references)
		//IL_099e: Expected O, but got Unknown
		//IL_09b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ce: Expected O, but got Unknown
		//IL_09df: Unknown result type (might be due to invalid IL or missing references)
		//IL_09e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_09f8: Expected O, but got Unknown
		//IL_0a41: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a48: Expected O, but got Unknown
		//IL_0a5f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a64: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a6c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a78: Expected O, but got Unknown
		//IL_0aba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0abf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0acb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0add: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0af9: Expected O, but got Unknown
		//IL_0b02: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b0c: Expected O, but got Unknown
		//IL_0a89: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a8e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a96: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aa2: Expected O, but got Unknown
		if ((Object)(object)bundle == (Object)null)
		{
			return;
		}
		if (reg.PrefabName == "M_Star")
		{
			RegisterCraftedStar(bundle, reg);
			return;
		}
		GameObject val = bundle.LoadAsset<GameObject>(reg.PrefabName);
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		((Object)val).name = reg.PrefabName;
		if (reg.PrefabName == "M_Deer" || reg.PrefabName == "M_Deer_Rudy")
		{
			val.transform.localScale = Vector3.one * 0.014f;
			ScaleEnforcer scaleEnforcer = val.GetComponent<ScaleEnforcer>() ?? val.AddComponent<ScaleEnforcer>();
			scaleEnforcer.desiredScale = Vector3.one * 0.014f;
			if (!Object.op_Implicit((Object)(object)val.GetComponent<DeerMarker>()))
			{
				val.AddComponent<DeerMarker>();
			}
		}
		if (reg.PrefabName == "M_Christmas_Tree_1")
		{
			ChildLightsCycler childLightsCycler = val.GetComponent<ChildLightsCycler>() ?? val.AddComponent<ChildLightsCycler>();
			childLightsCycler.lightRendererNames = new string[3] { "Light1", "Light2", "Light3" };
			childLightsCycler.intensity = 4.4f;
			childLightsCycler.stepSeconds = 1f;
		}
		if (reg.PrefabName == "Christmas_Lights1")
		{
			ChristmasLightChaserInstaller.InstallOn(val, 1f, 4.4f);
		}
		if (reg.PrefabName == "Christmas_Lights2")
		{
			ChristmasLightChaserInstaller.InstallOn(val, 0.8f, 4.4f, (Color[])(object)new Color[2]
			{
				Color.white,
				Color.yellow
			}, ChristmasLightChaser.AnimationMode.BlinkAll);
		}
		if (reg.PrefabName == "8Meter_Town_Light")
		{
			ChristmasLightChaserInstaller.InstallOn(val, 0.8f, 4.4f, (Color[])(object)new Color[2]
			{
				Color.white,
				Color.yellow
			}, ChristmasLightChaser.AnimationMode.BlinkAll);
		}
		if (reg.PrefabName == "MChristmas_Lights1" || reg.PrefabName == "MChristmas_LongLights1")
		{
			ChristmasLightChaserInstaller.InstallOn(val, 1f, 4.4f, (Color[])(object)new Color[3]
			{
				Color.red,
				Color.yellow,
				Color.blue
			}, ChristmasLightChaser.AnimationMode.Chase);
		}
		if (reg.PrefabName == "M_Garland_Spiral_Green")
		{
			ChristmasLightChaserInstaller.InstallOn(val, 1f, 4.4f, (Color[])(object)new Color[3]
			{
				Color.red,
				Color.yellow,
				Color.blue
			}, ChristmasLightChaser.AnimationMode.Chase);
		}
		if (reg.PrefabName == "M_Garland_Spiral_White")
		{
			ChristmasLightChaserInstaller.InstallOn(val, 1f, 4.4f, (Color[])(object)new Color[3]
			{
				Color.red,
				Color.yellow,
				Color.blue
			}, ChristmasLightChaser.AnimationMode.Chase);
		}
		if (reg.PrefabName == "M_Icicle_Lamp")
		{
			IcicleFlow icicleFlow = val.GetComponent<IcicleFlow>() ?? val.AddComponent<IcicleFlow>();
			icicleFlow.columnNamePrefix = "Icicle_Lamp_";
			icicleFlow.bulbNamePrefix = "Light";
			icicleFlow.dripStepSeconds = 0.35f;
			icicleFlow.pauseAfterColumn = 0.6f;
			icicleFlow.emissionIntensity = 4.5f;
			icicleFlow.dripColor = new Color(0.6f, 0.85f, 1f);
			icicleFlow.batchCount = 4;
			icicleFlow.batchSpacingSeconds = 4f;
			icicleFlow.autoDetectVerticalAxis = true;
		}
		if (reg.PrefabName == "MultiStar_Light")
		{
			IcicleFlow icicleFlow2 = val.GetComponent<IcicleFlow>() ?? val.AddComponent<IcicleFlow>();
			icicleFlow2.columnNamePrefix = "MultiStar_Light";
			icicleFlow2.bulbNamePrefix = "Light";
			icicleFlow2.dripStepSeconds = 0.35f;
			icicleFlow2.pauseAfterColumn = 0.6f;
			icicleFlow2.emissionIntensity = 4.5f;
			icicleFlow2.dripColor = new Color(0.6f, 0.85f, 1f);
			icicleFlow2.batchCount = 4;
			icicleFlow2.batchSpacingSeconds = 4f;
			icicleFlow2.autoDetectVerticalAxis = true;
		}
		if (reg.PrefabName == "M_Christmas_Sled")
		{
			SledReinsConnector sledReinsConnector = val.GetComponent<SledReinsConnector>() ?? val.AddComponent<SledReinsConnector>();
			sledReinsConnector.maxDeer = 9;
			sledReinsConnector.sledAnchorRootName = "RopeAttach";
			sledReinsConnector.deerAnchorName = "ReinAnchor";
			sledReinsConnector.useSingleStart = true;
			sledReinsConnector.verticalLift = 0f;
			sledReinsConnector.lateralSpacing = 0f;
			sledReinsConnector.forwardSpacing = 0f;
			sledReinsConnector.leadExtraForward = 0f;
			sledReinsConnector.ropeWidth = 0.018f;
			sledReinsConnector.ropeSag = 0.15f;
			sledReinsConnector.ropeSegments = 28;
			sledReinsConnector.windStrength = 0.25f;
			sledReinsConnector.jiggleAmplitude = 0.03f;
			sledReinsConnector.jiggleSpeed = 1.1f;
		}
		if (reg.PrefabName == "M_Christmas_Train")
		{
			InstallTrainOrbit(val, 18f, clockwise: false);
		}
		ZNetView val2 = val.GetComponent<ZNetView>() ?? val.AddComponent<ZNetView>();
		val2.m_persistent = true;
		val2.m_syncInitialScale = true;
		if (!Object.op_Implicit((Object)(object)val.GetComponent<ZSyncTransform>()))
		{
			val.AddComponent<ZSyncTransform>();
		}
		Piece val3 = val.GetComponent<Piece>() ?? val.AddComponent<Piece>();
		val3.m_name = reg.DisplayName;
		val3.m_description = reg.Description;
		val3.m_groundOnly = false;
		Sprite val4 = bundle.LoadAsset<Sprite>(reg.PrefabName);
		if ((Object)(object)val4 != (Object)null)
		{
			val3.m_icon = val4;
		}
		HashSet<string> hashSet = new HashSet<string> { "M_Gift_BlackOrange_Valheim", "M_Gift_Yellow_Deco", "M_Gift_Red_Blue", "M_SnowFlake_Blue", "M_SnowFlake_Red", "M_Garland", "M_Garland_White", "M_Garland_Spiral_Green", "M_Garland_Spiral_White", "M_Gingerbread_Man" };
		HashSet<string> hashSet2 = new HashSet<string>
		{
			"M_Cozy_Yule_Cup", "M_Cozy_Candy_Cane_Cup", "Christmas_Cups3", "M_Christmas_Cake", "M_Christmas_Cake2", "M_icicles", "M_Snowflake", "M_Snowflake2", "M_Snowflake3", "M_Snowflake4",
			"M_YuleLogCake"
		};
		HashSet<string> hashSet3 = new HashSet<string>
		{
			"M_BigredChristmasbow", "M_BigblueChristmasbow", "M_Small_Santa_Claus", "M_Christmas_Wine", "M_MilkandCookiesforSanta", "M_boot", "8Meter_Town_Light", "MultiStar_Light", "Christmas_Lights1", "Christmas_Lights2",
			"MChristmas_Lights1", "MChristmas_LongLights1", "M_Icicle_Lamp"
		};
		HashSet<string> hashSet4 = new HashSet<string> { "M_Red_Candy_Cane_1m", "M_Green_Candy_Cane_1m", "M_RedGreen_Candy_Cane_1m", "M_Green_Red_Candy_Cane_1m" };
		HashSet<string> hashSet5 = new HashSet<string> { "M_Christmas_Sled", "M_Christmas_Train", "M_Bench" };
		string prefabName = reg.PrefabName;
		GameObject val5 = null;
		ZNetScene instance = ZNetScene.instance;
		GameObject val6 = ((instance != null) ? instance.GetPrefab("sfx_build_hammer_default") : null);
		GameObject val7 = null;
		ZNetScene instance2 = ZNetScene.instance;
		GameObject val8 = ((instance2 != null) ? instance2.GetPrefab("sfx_wood_destroyed") : null);
		if (hashSet.Contains(prefabName))
		{
			ZNetScene instance3 = ZNetScene.instance;
			val6 = ((instance3 != null) ? instance3.GetPrefab("sfx_build_hammer_default") : null);
			ZNetScene instance4 = ZNetScene.instance;
			val8 = ((instance4 != null) ? instance4.GetPrefab("sfx_wood_destroyed") : null);
		}
		else if (hashSet2.Contains(prefabName) || hashSet3.Contains(prefabName))
		{
			ZNetScene instance5 = ZNetScene.instance;
			val6 = ((instance5 != null) ? instance5.GetPrefab("sfx_build_hammer_crystal") : null);
			ZNetScene instance6 = ZNetScene.instance;
			val8 = ((instance6 != null) ? instance6.GetPrefab("sfx_clay_pot_break") : null);
		}
		else if (hashSet4.Contains(prefabName))
		{
			ZNetScene instance7 = ZNetScene.instance;
			val5 = ((instance7 != null) ? instance7.GetPrefab("vfx_Place_stone") : null);
			ZNetScene instance8 = ZNetScene.instance;
			val6 = ((instance8 != null) ? instance8.GetPrefab("sfx_build_hammer_metal") : null);
			ZNetScene instance9 = ZNetScene.instance;
			val7 = ((instance9 != null) ? instance9.GetPrefab("vfx_destroyed") : null);
			ZNetScene instance10 = ZNetScene.instance;
			val8 = ((instance10 != null) ? instance10.GetPrefab("sfx_metal_blocked") : null);
		}
		else if (hashSet5.Contains(prefabName))
		{
			ZNetScene instance11 = ZNetScene.instance;
			val5 = ((instance11 != null) ? instance11.GetPrefab("vfx_Place_stone") : null);
			ZNetScene instance12 = ZNetScene.instance;
			val6 = ((instance12 != null) ? instance12.GetPrefab("sfx_build_hammer_metal") : null);
			ZNetScene instance13 = ZNetScene.instance;
			val7 = ((instance13 != null) ? instance13.GetPrefab("vfx_destroyed") : null);
			ZNetScene instance14 = ZNetScene.instance;
			val8 = ((instance14 != null) ? instance14.GetPrefab("sfx_metal_blocked") : null);
		}
		EffectList val9 = new EffectList();
		List<EffectData> list = new List<EffectData>();
		if ((Object)(object)val5 != (Object)null)
		{
			list.Add(new EffectData
			{
				m_prefab = val5,
				m_enabled = true
			});
		}
		if ((Object)(object)val6 != (Object)null)
		{
			list.Add(new EffectData
			{
				m_prefab = val6,
				m_enabled = true
			});
		}
		val9.m_effectPrefabs = list.ToArray();
		val3.m_placeEffect = val9;
		WearNTear val10 = val.GetComponent<WearNTear>() ?? val.AddComponent<WearNTear>();
		val10.m_health = Mathf.Max(val10.m_health, 1000f);
		val10.m_noRoofWear = true;
		EffectList val11 = new EffectList();
		List<EffectData> list2 = new List<EffectData>();
		if ((Object)(object)val7 != (Object)null)
		{
			list2.Add(new EffectData
			{
				m_prefab = val7,
				m_enabled = true
			});
		}
		if ((Object)(object)val8 != (Object)null)
		{
			list2.Add(new EffectData
			{
				m_prefab = val8,
				m_enabled = true
			});
		}
		val11.m_effectPrefabs = list2.ToArray();
		val10.m_destroyedEffect = val11;
		PieceConfig val12 = new PieceConfig
		{
			PieceTable = "Hammer",
			Category = CategoryToTab(reg.Category),
			CraftingStation = reg.CraftingStation,
			Requirements = reg.Requirements
		};
		PieceManager.Instance.AddPiece(new CustomPiece(val, true, val12));
	}

	private static void RegisterCraftedStar(AssetBundle bundle, RelicRegistration reg)
	{
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: Expected O, but got Unknown
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0267: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Expected O, but got Unknown
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Expected O, but got Unknown
		if (_starRegistered)
		{
			return;
		}
		GameObject val = bundle.LoadAsset<GameObject>(reg.PrefabName);
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		((Object)val).name = reg.PrefabName;
		ZNetView val2 = val.GetComponent<ZNetView>() ?? val.AddComponent<ZNetView>();
		val2.m_persistent = true;
		val2.m_syncInitialScale = true;
		if (!Object.op_Implicit((Object)(object)val.GetComponent<Rigidbody>()))
		{
			Rigidbody val3 = val.AddComponent<Rigidbody>();
			val3.useGravity = true;
			val3.isKinematic = false;
			val3.mass = 1f;
		}
		if (!Object.op_Implicit((Object)(object)val.GetComponent<Collider>()))
		{
			SphereCollider val4 = val.AddComponent<SphereCollider>();
			((Collider)val4).isTrigger = false;
			val4.radius = 0.25f;
		}
		val.layer = LayerMask.NameToLayer("item");
		ItemDrop component = val.GetComponent<ItemDrop>();
		if (!((Object)(object)component == (Object)null) && component.m_itemData != null && component.m_itemData.m_shared != null)
		{
			SharedData shared = component.m_itemData.m_shared;
			shared.m_itemType = (ItemType)13;
			Transform val5 = val.transform.Find("attach");
			GameObject val6 = null;
			if ((Object)(object)val5 != (Object)null)
			{
				Transform val7 = val5.Find("Star");
				val6 = (((Object)(object)val7 != (Object)null) ? ((Component)val7).gameObject : ((Component)val5).gameObject);
			}
			else
			{
				Transform val8 = val.transform.Find("Star");
				val6 = (((Object)(object)val8 != (Object)null) ? ((Component)val8).gameObject : null);
			}
			if ((Object)(object)val6 != (Object)null && (Object)(object)val6.GetComponent<RainbowGlow>() == (Object)null)
			{
				val6.AddComponent<RainbowGlow>();
			}
			component.m_itemData.m_dropPrefab = val;
			Sprite val9 = bundle.LoadAsset<Sprite>(reg.PrefabName);
			if ((Object)(object)val9 != (Object)null)
			{
				shared.m_icons = (Sprite[])(object)new Sprite[1] { val9 };
			}
			if (!string.IsNullOrEmpty(reg.DisplayName))
			{
				shared.m_name = reg.DisplayName;
			}
			if (!string.IsNullOrEmpty(reg.Description))
			{
				shared.m_description = reg.Description;
			}
			ItemManager.Instance.AddItem(new CustomItem(val, true));
			ItemManager.Instance.AddRecipe(new CustomRecipe(new RecipeConfig
			{
				Item = reg.PrefabName,
				Amount = 1,
				CraftingStation = (string.IsNullOrEmpty(reg.CraftingStation) ? "Workbench" : reg.CraftingStation),
				Requirements = reg.Requirements
			}));
			_starRegistered = true;
		}
	}

	private static void InstallTrainOrbit(GameObject prefab, float degreesPerSecond = 18f, bool clockwise = true)
	{
		//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)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Expected O, but got Unknown
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: 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_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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)
		Transform transform = prefab.transform;
		Transform val = transform.Find("TrackCenter");
		if (!Object.op_Implicit((Object)(object)val))
		{
			Vector3 position = transform.position;
			Transform val2 = transform.Find("track") ?? transform.Find("Track");
			if (Object.op_Implicit((Object)(object)val2))
			{
				Renderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Renderer>(true);
				if (componentsInChildren.Length != 0)
				{
					Bounds bounds = componentsInChildren[0].bounds;
					for (int i = 1; i < componentsInChildren.Length; i++)
					{
						((Bounds)(ref bounds)).Encapsulate(componentsInChildren[i].bounds);
					}
					position = ((Bounds)(ref bounds)).center;
				}
			}
			GameObject val3 = new GameObject("TrackCenter");
			val = val3.transform;
			val.SetParent(transform, true);
			val.position = position;
			val.rotation = Quaternion.identity;
		}
		Transform val4 = val.Find("pivot") ?? val.Find("OrbitPivot");
		if (!Object.op_Implicit((Object)(object)val4))
		{
			GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)0);
			((Object)val5).name = "pivot";
			val4 = val5.transform;
			val4.SetParent(val, true);
			val4.position = val.position;
			val4.rotation = Quaternion.identity;
			val4.localScale = Vector3.one * 0.05f;
			Collider component = val5.GetComponent<Collider>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.Destroy((Object)(object)component);
			}
		}
		TrainPivotRotator trainPivotRotator = ((Component)val4).GetComponent<TrainPivotRotator>() ?? ((Component)val4).gameObject.AddComponent<TrainPivotRotator>();
		trainPivotRotator.degreesPerSecond = (clockwise ? Mathf.Abs(degreesPerSecond) : (0f - Mathf.Abs(degreesPerSecond)));
	}
}
public class SledReinsConnector : MonoBehaviour
{
	private class RopeEntry
	{
		public Transform deerRoot;

		public Transform deerAnchor;

		public Transform sledAnchor;

		public BezierRope rope;
	}

	[Header("Hierarchy names")]
	public string sledAnchorRootName = "RopeAttach";

	public string deerAnchorName = "ReinAnchor";

	[Header("Deer selection")]
	public int maxDeer = 9;

	public float searchRadius = 20f;

	public float refreshSeconds = 1f;

	[Header("Anchor layout (local to RopeAttach)")]
	public bool useSingleStart = true;

	public Vector3 baseLocal = new Vector3(0f, 0f, 0f);

	public float verticalLift = 0f;

	public float lateralSpacing = 0.45f;

	public float forwardSpacing = 0.85f;

	public float leadExtraForward = 0.6f;

	[Header("Rope look")]
	public float ropeWidth = 0.018f;

	public float ropeSag = 0.35f;

	public int ropeSegments = 28;

	[Header("Cloth-like sway")]
	public float windStrength = 0.25f;

	public float jiggleAmplitude = 0.03f;

	public float jiggleSpeed = 1.1f;

	public Material ropeMaterial;

	private Transform _sledRoot;

	private readonly List<Transform> _sledAnchors = new List<Transform>();

	private readonly List<RopeEntry> _ropes = new List<RopeEntry>();

	private float _nextRefresh;

	private void Awake()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: 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)
		_sledRoot = FindChildRecursive(((Component)this).transform, sledAnchorRootName);
		if ((Object)(object)_sledRoot == (Object)null)
		{
			GameObject val = new GameObject(sledAnchorRootName);
			_sledRoot = val.transform;
			_sledRoot.SetParent(((Component)this).transform, false);
			_sledRoot.localPosition = Vector3.zero;
			_sledRoot.localRotation = Quaternion.identity;
		}
		for (int i = 0; i < 9; i++)
		{
			Transform transform = new GameObject("SledAnchor_" + i).transform;
			transform.SetParent(_sledRoot, false);
			transform.localPosition = ComputeAnchorLocal(i, 9);
			_sledAnchors.Add(transform);
		}
	}

	private void OnEnable()
	{
		_nextRefresh = 0f;
	}

	private void OnDisable()
	{
		ClearRopes();
	}

	private void Update()
	{
		if (Time.time >= _nextRefresh)
		{
			BuildOrUpdateLinks();
			_nextRefresh = Time.time + Mathf.Max(0.25f, refreshSeconds);
		}
	}

	private void BuildOrUpdateLinks()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_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_031b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Expected O, but got Unknown
		List<Transform> source = FindDeerRoots();
		Vector3 pos = ((Component)this).transform.position;
		Vector3 fwd = ((Component)this).transform.forward;
		Vector3 right = ((Component)this).transform.right;
		source = (from t in source.Where(delegate(Transform t)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				int result;
				if (Object.op_Implicit((Object)(object)t))
				{
					Vector3 val6 = fwd;
					Vector3 val7 = t.position - pos;
					result = ((Vector3.Dot(val6, ((Vector3)(ref val7)).normalized) > 0.05f) ? 1 : 0);
				}
				else
				{
					result = 0;
				}
				return (byte)result != 0;
			})
			orderby Vector3.Dot(fwd, t.position - pos), Mathf.Abs(Vector3.Dot(right, t.position - pos))
			select t).ToList();
		Transform val = ((IEnumerable<Transform>)source).FirstOrDefault((Func<Transform, bool>)delegate(Transform t)
		{
			string text = ((Object)t).name.ToLowerInvariant();
			return text.Contains("rudy") || text.Contains("rudolph");
		});
		if ((Object)(object)val != (Object)null)
		{
			source.Remove(val);
			source.Add(val);
		}
		int num = Mathf.Clamp(maxDeer, 0, 9);
		if (source.Count > num)
		{
			source.RemoveRange(num, source.Count - num);
		}
		bool flag = _ropes.Count == source.Count;
		if (flag)
		{
			for (int i = 0; i < _ropes.Count; i++)
			{
				RopeEntry ropeEntry = _ropes[i];
				Transform val2 = source[i];
				if (ropeEntry == null || (Object)(object)ropeEntry.deerRoot == (Object)null || (Object)(object)val2 == (Object)null || ((Object)ropeEntry.deerRoot).GetInstanceID() != ((Object)val2).GetInstanceID())
				{
					flag = false;
					break;
				}
			}
		}
		if (!flag)
		{
			ClearRopes();
			for (int j = 0; j < source.Count; j++)
			{
				_sledAnchors[j].localPosition = ComputeAnchorLocal(j, source.Count);
				Transform val3 = ResolveDeerAnchor(source[j]);
				GameObject val4 = new GameObject("Rope_" + j);
				val4.transform.SetParent(((Component)this).transform, false);
				BezierRope bezierRope = val4.AddComponent<BezierRope>();
				bezierRope.pointA = _sledAnchors[j];
				bezierRope.pointB = val3;
				bezierRope.width = ropeWidth;
				bezierRope.sag = ropeSag;
				bezierRope.segments = ropeSegments;
				bezierRope.material = ropeMaterial;
				bezierRope.windStrength = windStrength;
				bezierRope.jiggleAmplitude = jiggleAmplitude;
				bezierRope.jiggleSpeed = jiggleSpeed;
				RopeEntry ropeEntry2 = new RopeEntry();
				ropeEntry2.deerRoot = source[j];
				ropeEntry2.deerAnchor = val3;
				ropeEntry2.sledAnchor = _sledAnchors[j];
				ropeEntry2.rope = bezierRope;
				_ropes.Add(ropeEntry2);
			}
			return;
		}
		for (int k = 0; k < _ropes.Count; k++)
		{
			_sledAnchors[k].localPosition = ComputeAnchorLocal(k, _ropes.Count);
			Transform val5 = ResolveDeerAnchor(_ropes[k].deerRoot);
			if ((Object)(object)val5 != (Object)(object)_ropes[k].deerAnchor)
			{
				_ropes[k].deerAnchor = val5;
				_ropes[k].rope.pointB = val5;
			}
		}
	}

	private List<Transform> FindDeerRoots()
	{
		//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_0045: 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)
		List<Transform> list = new List<Transform>();
		Vector3 position = ((Component)this).transform.position;
		foreach (DeerMarker item in DeerMarker.All)
		{
			if (Object.op_Implicit((Object)(object)item))
			{
				Transform transform = ((Component)item).transform;
				if (Vector3.Distance(transform.position, position) <= searchRadius)
				{
					list.Add(transform);
				}
			}
		}
		return list;
	}

	private Transform ResolveDeerAnchor(Transform deerRoot)
	{
		if ((Object)(object)deerRoot == (Object)null)
		{
			return null;
		}
		Transform val = FindChildRecursive(deerRoot, deerAnchorName);
		if ((Object)(object)val != (Object)null)
		{
			return val;
		}
		Transform val2 = FindChildContains(deerRoot, "Head");
		if ((Object)(object)val2 == (Object)null)
		{
			val2 = FindChildContains(deerRoot, "Neck");
		}
		if ((Object)(object)val2 != (Object)null)
		{
			return val2;
		}
		return deerRoot;
	}

	private Transform FindChildRecursive(Transform root, string exact)
	{
		if ((Object)(object)root == (Object)null)
		{
			return null;
		}
		for (int i = 0; i < root.childCount; i++)
		{
			Transform child = root.GetChild(i);
			if (((Object)child).name == exact)
			{
				return child;
			}
			Transform val = FindChildRecursive(child, exact);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
		}
		return null;
	}

	private Transform FindChildContains(Transform root, string contains)
	{
		if ((Object)(object)root == (Object)null)
		{
			return null;
		}
		string value = contains.ToLowerInvariant();
		for (int i = 0; i < root.childCount; i++)
		{
			Transform child = root.GetChild(i);
			if (((Object)child).name.ToLowerInvariant().Contains(value))
			{
				return child;
			}
			Transform val = FindChildContains(child, contains);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
		}
		return null;
	}

	private Vector3 ComputeAnchorLocal(int index, int total)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: 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_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_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//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_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: 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_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_00b6: 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_00c5: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		if (useSingleStart)
		{
			return Vector3.zero;
		}
		Vector3 val = baseLocal + Vector3.up * verticalLift;
		if (total >= 9 && index == total - 1)
		{
			int num = 4;
			return val + Vector3.forward * ((float)num * forwardSpacing + leadExtraForward);
		}
		int num2 = index / 2;
		float num3 = ((index % 2 == 1) ? 1f : (-1f));
		val += Vector3.forward * ((float)num2 * forwardSpacing);
		return val + Vector3.right * (num3 * lateralSpacing);
	}

	private void ClearRopes()
	{
		for (int i = 0; i < _ropes.Count; i++)
		{
			RopeEntry ropeEntry = _ropes[i];
			if (ropeEntry != null && (Object)(object)ropeEntry.rope != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)ropeEntry.rope).gameObject);
			}
		}
		_ropes.Clear();
	}
}
public class TrainPivotRotator : MonoBehaviour
{
	public float degreesPerSecond = 10f;

	private void Update()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.Rotate(Vector3.up, degreesPerSecond * Time.deltaTime, (Space)0);
	}
}