Decompiled source of LuckyBlocks EXPERIMENTAL v1.2.1

SlipSkid.LuckyBlocks.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.Mono;
using Game;
using Game.Levels;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Obstacles;
using Obstacles.ObstacleAffixes;
using Player;
using SlipSkid.CardKit;
using Sounds.SplitScreenAudio;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.UI;
using World;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("SlipSkid.LuckyBlocks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1")]
[assembly: AssemblyProduct("SlipSkid.LuckyBlocks")]
[assembly: AssemblyTitle("SlipSkid.LuckyBlocks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SlipSkid.LuckyBlocks
{
	internal static class Art
	{
		private sealed class Shards : MonoBehaviour
		{
			private readonly List<(Transform t, Vector3 v, Vector3 spin)> _parts = new List<(Transform, Vector3, Vector3)>();

			private float _age;

			private const float Life = 0.8f;

			public void Add(Transform t, Vector3 velocity, Vector3 spin)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				_parts.Add((t, velocity, spin));
			}

			private void Update()
			{
				//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)
				//IL_004b: 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_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: 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_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: 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)
				//IL_0089: 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_0094: 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_00a4: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				_age += Time.deltaTime;
				float num = Mathf.Clamp01(1f - _age / 0.8f);
				for (int i = 0; i < _parts.Count; i++)
				{
					(Transform t, Vector3 v, Vector3 spin) tuple = _parts[i];
					Transform item = tuple.t;
					Vector3 item2 = tuple.v;
					Vector3 item3 = tuple.spin;
					item2 += Physics.gravity * Time.deltaTime * 0.6f;
					_parts[i] = (item, item2, item3);
					item.position += item2 * Time.deltaTime;
					item.Rotate(item3 * Time.deltaTime, (Space)1);
					item.localScale = Vector3.one * num;
				}
				if (_age >= 0.8f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		public static readonly Color Steel = new Color(0.42f, 0.46f, 0.51f);

		public static readonly Color SteelLight = new Color(0.57f, 0.61f, 0.66f);

		public static readonly Color BoltColor = new Color(0.76f, 0.79f, 0.84f);

		public static readonly Color QuestionBlue = new Color(0.2f, 0.63f, 0.96f);

		public static readonly Color Ink = new Color(0.06f, 0.15f, 0.28f);

		public static readonly Color SparkleBlue = new Color(0.62f, 0.88f, 1f);

		private const float Half = 0.75f;

		private const float Bar = 0.22f;

		private const float Guard = 0.3f;

		private const float Panel = 0.68f;

		private const float Opening = 0.53f;

		private static readonly Vector3[] Faces = (Vector3[])(object)new Vector3[6]
		{
			Vector3.forward,
			Vector3.back,
			Vector3.right,
			Vector3.left,
			Vector3.up,
			Vector3.down
		};

		private static Material _baseLit;

		private static Shader _unlit;

		private static bool _resolved;

		private static readonly Dictionary<string, Material> Cache = new Dictionary<string, Material>();

		private static Mesh _body;

		private static Mesh _frame;

		private static Mesh _bolts;

		private static Mesh _ink;

		private static Mesh _glyph;

		private static Mesh _sparkle;

		private static Mesh _ring;

		private static Mesh _cone;

		private static Mesh _disc;

		private static Mesh _shard;

		private static readonly string[] ColorProps = new string[5] { "_BaseColor", "_Color", "_MainColor", "_ColorPrimary", "_PrimaryColor" };

		private static readonly string[] TextureProps = new string[4] { "_BaseMap", "_MainTex", "_Albedo", "_Texture" };

		private static Material _bubble;

		private static Mesh _sphere;

		public static Mesh SphereMesh
		{
			get
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_sphere == (Object)null)
				{
					_sphere = new MeshBuilder().Sphere(Vector3.zero, 1f, 14, 24).ToMesh("LuckyBlocks_Sphere");
				}
				return _sphere;
			}
		}

		public static Mesh RingMesh
		{
			get
			{
				EnsureMeshes();
				return _ring;
			}
		}

		public static Mesh FlameMesh
		{
			get
			{
				EnsureMeshes();
				return _cone;
			}
		}

		public static Mesh ButterMesh
		{
			get
			{
				EnsureMeshes();
				return _disc;
			}
		}

		public static Mesh ShardMesh
		{
			get
			{
				EnsureMeshes();
				return _shard;
			}
		}

		public static void Resolve(ObstacleDescription[] catalog)
		{
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected O, but got Unknown
			if (_resolved)
			{
				return;
			}
			_resolved = true;
			foreach (ObstacleDescription val in catalog)
			{
				if ((Object)(object)val == (Object)null || (Object)(object)val.prefab == (Object)null)
				{
					continue;
				}
				MeshRenderer[] componentsInChildren = ((Component)val.prefab).GetComponentsInChildren<MeshRenderer>(true);
				for (int j = 0; j < componentsInChildren.Length; j++)
				{
					Material[] sharedMaterials = ((Renderer)componentsInChildren[j]).sharedMaterials;
					foreach (Material val2 in sharedMaterials)
					{
						if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.shader == (Object)null))
						{
							if ((Object)(object)_baseLit == (Object)null && ((Object)val2.shader).name.EndsWith("ToonShading") && val2.HasProperty("_Color"))
							{
								_baseLit = val2;
							}
							if ((Object)(object)_bubble == (Object)null && ((Object)val2.shader).name.EndsWith("/Bubble"))
							{
								_bubble = val2;
							}
						}
					}
				}
				if ((Object)(object)_baseLit != (Object)null && (Object)(object)_bubble != (Object)null)
				{
					break;
				}
			}
			string[] array = new string[3] { "Universal Render Pipeline/Unlit", "Unlit/Color", "Sprites/Default" };
			for (int i = 0; i < array.Length; i++)
			{
				_unlit = Shader.Find(array[i]);
				if ((Object)(object)_unlit != (Object)null)
				{
					break;
				}
			}
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(60, 4, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Art: lit material '");
				Material baseLit = _baseLit;
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>((baseLit != null) ? ((Object)baseLit).name : null);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("' (shader '");
				Material baseLit2 = _baseLit;
				object obj;
				if (baseLit2 == null)
				{
					obj = null;
				}
				else
				{
					Shader shader = baseLit2.shader;
					obj = ((shader != null) ? ((Object)shader).name : null);
				}
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>((string)obj);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("'), ");
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("glow shader '");
				Shader unlit = _unlit;
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((unlit != null) ? ((Object)unlit).name : null) ?? "none, using lit + emission");
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("', bubble '");
				Material bubble = _bubble;
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>((bubble != null) ? ((Object)bubble).name : null);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("'.");
			}
			log.LogInfo(val3);
		}

		public static Material Bubble(Color fallback)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_bubble != (Object)null))
			{
				return Glow(fallback);
			}
			return _bubble;
		}

		public static Material Lit(Color c)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return Get("lit", c, glow: false);
		}

		public static Material Glow(Color c)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return Get("glow", c, glow: true);
		}

		private static Material Get(string kind, Color c, bool glow)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			string key = kind + ":" + ColorUtility.ToHtmlStringRGBA(c);
			if (Cache.TryGetValue(key, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			value = ((glow && (Object)(object)_unlit != (Object)null) ? new Material(_unlit) : ((!((Object)(object)_baseLit != (Object)null)) ? new Material(((Object)(object)_unlit != (Object)null) ? _unlit : Shader.Find("Standard")) : new Material(_baseLit)));
			((Object)value).name = "LuckyBlocks_" + kind + "_" + ColorUtility.ToHtmlStringRGB(c);
			((Object)value).hideFlags = (HideFlags)32;
			string[] textureProps = TextureProps;
			foreach (string text in textureProps)
			{
				if (value.HasProperty(text))
				{
					value.SetTexture(text, (Texture)(object)Texture2D.whiteTexture);
				}
			}
			textureProps = ColorProps;
			foreach (string text2 in textureProps)
			{
				if (value.HasProperty(text2))
				{
					value.SetColor(text2, c);
				}
			}
			if (glow)
			{
				value.EnableKeyword("_EMISSION");
				if (value.HasProperty("_EmissionColor"))
				{
					value.SetColor("_EmissionColor", c * 1.6f);
				}
			}
			Cache[key] = value;
			return value;
		}

		private static void EnsureMeshes()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: 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_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_073d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0760: Unknown result type (might be due to invalid IL or missing references)
			//IL_0765: Unknown result type (might be due to invalid IL or missing references)
			//IL_076f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0797: Unknown result type (might be due to invalid IL or missing references)
			//IL_079c: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: 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_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: 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_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: 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_0265: 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_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_069d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			//IL_0636: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_body != (Object)null)
			{
				return;
			}
			_body = new MeshBuilder().ChamferBox(Vector3.zero, Vector3.one * 1.36f, 0.03f).ToMesh("LuckyBlock_Body");
			MeshBuilder meshBuilder = new MeshBuilder();
			MeshBuilder meshBuilder2 = new MeshBuilder();
			float num = 0.64f;
			float num2 = 2f * (num - 0.15f) + 0.04f;
			float[] array = new float[2]
			{
				0f - num,
				num
			};
			foreach (float num3 in array)
			{
				float[] array2 = new float[2]
				{
					0f - num,
					num
				};
				foreach (float num4 in array2)
				{
					meshBuilder.ChamferBox(new Vector3(0f, num3, num4), new Vector3(num2, 0.22f, 0.22f), 0.045f);
					meshBuilder.ChamferBox(new Vector3(num3, 0f, num4), new Vector3(0.22f, num2, 0.22f), 0.045f);
					meshBuilder.ChamferBox(new Vector3(num3, num4, 0f), new Vector3(0.22f, 0.22f, num2), 0.045f);
				}
			}
			array = new float[2]
			{
				0f - num,
				num
			};
			Vector3 val = default(Vector3);
			Vector3[] array4;
			foreach (float num5 in array)
			{
				float[] array2 = new float[2]
				{
					0f - num,
					num
				};
				foreach (float num6 in array2)
				{
					float[] array3 = new float[2]
					{
						0f - num,
						num
					};
					foreach (float num7 in array3)
					{
						((Vector3)(ref val))..ctor(num5, num6, num7);
						meshBuilder.ChamferBox(val, Vector3.one * 0.3f, 0.08f);
						array4 = (Vector3[])(object)new Vector3[3]
						{
							Vector3.right * Mathf.Sign(num5),
							Vector3.up * Mathf.Sign(num6),
							Vector3.forward * Mathf.Sign(num7)
						};
						foreach (Vector3 val2 in array4)
						{
							meshBuilder2.Disc(val + val2 * 0.162f, val2, 0.05f, 0.03f, 6);
						}
					}
				}
			}
			MeshBuilder meshBuilder3 = new MeshBuilder();
			MeshBuilder meshBuilder4 = new MeshBuilder();
			array4 = Faces;
			foreach (Vector3 val3 in array4)
			{
				Vector3 val4 = Vector3.Cross(val3, (Mathf.Abs(val3.y) > 0.5f) ? Vector3.forward : Vector3.up);
				Vector3 right = ((Vector3)(ref val4)).normalized;
				val4 = Vector3.Cross(right, val3);
				Vector3 up = ((Vector3)(ref val4)).normalized;
				Vector3 face = val3;
				meshBuilder.Polygon((IList<Vector3>)(object)new Vector3[4]
				{
					F(-0.53f, 0.53f, 0.012f),
					F(0.53f, 0.53f, 0.012f),
					F(0.53f, 0.48499995f, 0.012f),
					F(-0.53f, 0.48499995f, 0.012f)
				}, val3, 0.024f);
				meshBuilder.Polygon((IList<Vector3>)(object)new Vector3[4]
				{
					F(-0.53f, -0.48499995f, 0.012f),
					F(0.53f, -0.48499995f, 0.012f),
					F(0.53f, -0.53f, 0.012f),
					F(-0.53f, -0.53f, 0.012f)
				}, val3, 0.024f);
				meshBuilder.Polygon((IList<Vector3>)(object)new Vector3[4]
				{
					F(-0.53f, 0.48499995f, 0.012f),
					F(-0.48499995f, 0.48499995f, 0.012f),
					F(-0.48499995f, -0.48499995f, 0.012f),
					F(-0.53f, -0.48499995f, 0.012f)
				}, val3, 0.024f);
				meshBuilder.Polygon((IList<Vector3>)(object)new Vector3[4]
				{
					F(0.48499995f, 0.48499995f, 0.012f),
					F(0.53f, 0.48499995f, 0.012f),
					F(0.53f, -0.48499995f, 0.012f),
					F(0.48499995f, -0.48499995f, 0.012f)
				}, val3, 0.024f);
				array = new float[2] { -1f, 1f };
				foreach (float num8 in array)
				{
					float[] array2 = new float[2] { -1f, 1f };
					foreach (float num9 in array2)
					{
						float num10 = num8 * 0.53f;
						float num11 = num9 * 0.53f;
						meshBuilder.Polygon((IList<Vector3>)(object)new Vector3[3]
						{
							F(num10, num11, 0.02f),
							F(num10 - num8 * 0.22f, num11, 0.02f),
							F(num10, num11 - num9 * 0.22f, 0.02f)
						}, val3, 0.04f);
						meshBuilder2.Disc(F(num10 - num8 * 0.07f, num11 - num9 * 0.07f, 0.05f), val3, 0.034f, 0.03f, 6);
					}
				}
				QuestionMark(meshBuilder3, val3, F, 0.025f, 0.012f, 0.024f);
				QuestionMark(meshBuilder4, val3, F, 0f, 0.03f, 0.024f);
				Vector3 F(float u, float v, float lift)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					//IL_0019: Unknown result type (might be due to invalid IL or missing references)
					//IL_001e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0024: Unknown result type (might be due to invalid IL or missing references)
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					return face * (0.68f + lift) + right * u + up * v;
				}
			}
			_frame = meshBuilder.ToMesh("LuckyBlock_Frame");
			_bolts = meshBuilder2.ToMesh("LuckyBlock_Bolts");
			_ink = meshBuilder3.ToMesh("LuckyBlock_QuestionRim");
			_glyph = meshBuilder4.ToMesh("LuckyBlock_Question");
			_sparkle = new MeshBuilder().Diamond(Vector3.zero, 0.09f).ToMesh("LuckyBlock_Sparkle");
			_shard = new MeshBuilder().Box(Vector3.zero, Vector3.one * 0.22f).ToMesh("LuckyBlock_Shard");
			_ring = new MeshBuilder().Ring(Vector3.zero, Vector3.up, 1f, 0.045f, 40).ToMesh("LuckyBlocks_Ring");
			_cone = new MeshBuilder().Cone(Vector3.zero, Vector3.back, 0.35f, 14).ToMesh("LuckyBlocks_Flame");
			_disc = new MeshBuilder().Disc(Vector3.zero, Vector3.up, 0.85f, 0.04f, 16).ToMesh("LuckyBlocks_Butter");
		}

		private static void QuestionMark(MeshBuilder mb, Vector3 n, Func<float, float, float, Vector3> face, float grow, float lift, float depth)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: 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_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: 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_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: 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)
			//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_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			float w = 0.075f + grow;
			Vector2 centre = new Vector2(0f, 0.15f);
			for (int i = 0; i < 16; i++)
			{
				float deg = Mathf.Lerp(205f, -45f, (float)i / 16f);
				float deg2 = Mathf.Lerp(205f, -45f, (float)(i + 1) / 16f);
				mb.Polygon((IList<Vector3>)(object)new Vector3[4]
				{
					P(OnArc(deg, 0.175f - w)),
					P(OnArc(deg, 0.175f + w)),
					P(OnArc(deg2, 0.175f + w)),
					P(OnArc(deg2, 0.175f - w))
				}, n, depth);
			}
			Vector2 p = OnArc(205f, 0.175f);
			Vector2 val = OnArc(-45f, 0.175f);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0f, -0.07f);
			Vector2 b = default(Vector2);
			((Vector2)(ref b))..ctor(0f, -0.15f - grow);
			mb.Disc(P(p), n, w, depth, 14);
			mb.Disc(P(val), n, w, depth, 14);
			Segment(val, val2);
			mb.Disc(P(val2), n, w, depth, 14);
			Segment(val2, b);
			float num = 0.085f + grow;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0f, -0.31f);
			mb.Polygon((IList<Vector3>)(object)new Vector3[8]
			{
				P(val3 + new Vector2(0f - num + 0.032f, 0f - num)),
				P(val3 + new Vector2(num - 0.032f, 0f - num)),
				P(val3 + new Vector2(num, 0f - num + 0.032f)),
				P(val3 + new Vector2(num, num - 0.032f)),
				P(val3 + new Vector2(num - 0.032f, num)),
				P(val3 + new Vector2(0f - num + 0.032f, num)),
				P(val3 + new Vector2(0f - num, num - 0.032f)),
				P(val3 + new Vector2(0f - num, 0f - num + 0.032f))
			}, n, depth);
			Vector2 OnArc(float num2, float r)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				return centre + new Vector2(Mathf.Cos(num2 * ((float)Math.PI / 180f)), Mathf.Sin(num2 * ((float)Math.PI / 180f))) * r;
			}
			Vector3 P(Vector2 val4)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				return face(val4.x, val4.y, lift);
			}
			void Segment(Vector2 a, Vector2 val5)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: 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_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: 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_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				Vector2 val4 = val5 - a;
				Vector2 normalized = ((Vector2)(ref val4)).normalized;
				Vector2 val6 = new Vector2(0f - normalized.y, normalized.x) * w;
				mb.Polygon((IList<Vector3>)(object)new Vector3[4]
				{
					P(a + val6),
					P(val5 + val6),
					P(val5 - val6),
					P(a - val6)
				}, n, depth);
			}
		}

		public static GameObject Part(Transform parent, string name, Mesh mesh, Material mat)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0033: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			val.AddComponent<MeshFilter>().sharedMesh = mesh;
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = mat;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			return val;
		}

		public static Transform BuildBlock(Transform parent)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			EnsureMeshes();
			Transform transform = new GameObject("LuckyBlockPivot").transform;
			transform.SetParent(parent, false);
			((Renderer)Part(transform, "Body", _body, Lit(Steel)).GetComponent<MeshRenderer>()).shadowCastingMode = (ShadowCastingMode)1;
			Part(transform, "Frame", _frame, Lit(SteelLight));
			Part(transform, "Bolts", _bolts, Lit(BoltColor));
			Part(transform, "QuestionRim", _ink, Glow(Ink));
			Part(transform, "Question", _glyph, Glow(QuestionBlue));
			Transform transform2 = new GameObject("Sparkles").transform;
			transform2.SetParent(parent, false);
			for (int i = 0; i < 3; i++)
			{
				Transform transform3 = Part(transform2, "Sparkle" + i, _sparkle, Glow(SparkleBlue)).transform;
				float num = (float)Math.PI * 2f * (float)i / 3f;
				transform3.localPosition = new Vector3(Mathf.Cos(num) * 1.35f, 0.25f * (float)(i - 1), Mathf.Sin(num) * 1.35f);
			}
			return transform;
		}

		public static void Burst(Vector3 at, Vector3 up, Color a, Color b, int count = 16)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			EnsureMeshes();
			GameObject val = new GameObject("LuckyBlocks_Burst");
			val.transform.position = at;
			Shards shards = val.AddComponent<Shards>();
			for (int i = 0; i < count; i++)
			{
				Transform transform = Part(val.transform, "Shard", _shard, Glow((i % 2 == 0) ? a : b)).transform;
				Vector3 val2 = Random.onUnitSphere + up * 0.8f;
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				shards.Add(transform, normalized * Random.Range(6f, 11f), Random.insideUnitSphere * 720f);
			}
		}

		public static int TriggerLayer(ObstacleDescription[] catalog)
		{
			foreach (ObstacleDescription val in catalog)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val.prefab == (Object)null) && !(((Object)val).name != "BoostPad"))
				{
					CarModifierApplier componentInChildren = ((Component)val.prefab).GetComponentInChildren<CarModifierApplier>(true);
					if ((Object)(object)componentInChildren != (Object)null)
					{
						return ((Component)componentInChildren).gameObject.layer;
					}
				}
			}
			int num = LayerMask.NameToLayer("Obstacle");
			if (num < 0)
			{
				return 0;
			}
			return num;
		}

		public static void SetLayer(GameObject go, int layer)
		{
			Transform[] componentsInChildren = go.GetComponentsInChildren<Transform>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Component)componentsInChildren[i]).gameObject.layer = layer;
			}
		}

		public static void Destroy(Object o)
		{
			if (o != (Object)null)
			{
				Object.Destroy(o);
			}
		}

		public static string Describe(Material m)
		{
			if ((Object)(object)m == (Object)null)
			{
				return "null";
			}
			try
			{
				Shader shader = m.shader;
				List<string> list = new List<string>();
				for (int i = 0; i < shader.GetPropertyCount(); i++)
				{
					list.Add(shader.GetPropertyName(i));
				}
				return string.Format("{0} [{1}] q{2} kw[{3}] props[{4}]", ((Object)m).name, ((Object)shader).name, m.renderQueue, string.Join(" ", m.shaderKeywords), string.Join(" ", list));
			}
			catch (Exception ex)
			{
				return ((Object)m).name + " (describe failed: " + ex.Message + ")";
			}
		}
	}
	internal static class CardShot
	{
		private const int Size = 1024;

		private static readonly (string name, float yaw, float tilt, float roll)[] Poses = new(string, float, float, float)[4]
		{
			("a", 30f, 0f, 12f),
			("b", -32f, -6f, -12f),
			("c", 22f, 8f, 16f),
			("d", 38f, 0f, 0f)
		};

		public static IEnumerator Capture()
		{
			yield return (object)new WaitForEndOfFrame();
			string text = Path.Combine(Paths.BepInExRootPath, "luckyblocks-card");
			Directory.CreateDirectory(text);
			int num = FreeLayer();
			LevelLighting val = Object.FindObjectOfType<LevelLighting>();
			LevelEnvironmentBiome val2 = null;
			GameObject val3 = null;
			GameObject val4 = null;
			RenderTexture val5 = null;
			Texture2D val6 = null;
			bool flag = default(bool);
			try
			{
				if ((Object)(object)val != (Object)null)
				{
					val2 = ScriptableObject.CreateInstance<LevelEnvironmentBiome>();
					val.Refresh(val2);
				}
				Vector3 val7 = (((Object)(object)val != (Object)null && (Object)(object)val.mainLight != (Object)null) ? ((Component)val.mainLight).transform.forward : (Quaternion.Euler(51.5f, 170f, 0f) * Vector3.forward));
				val3 = new GameObject("LuckyBlocks_CardShot");
				val3.transform.position = new Vector3(0f, 3000f, 0f);
				Transform val8 = Art.BuildBlock(val3.transform);
				Transform val9 = val3.transform.Find("Sparkles");
				if ((Object)(object)val9 != (Object)null)
				{
					((Component)val9).gameObject.SetActive(false);
				}
				Art.SetLayer(val3, num);
				val4 = new GameObject("LuckyBlocks_CardCamera");
				Camera val10 = val4.AddComponent<Camera>();
				((Behaviour)val10).enabled = false;
				val10.cullingMask = 1 << num;
				val10.clearFlags = (CameraClearFlags)2;
				val10.fieldOfView = 22f;
				val10.nearClipPlane = 1f;
				val10.farClipPlane = 60f;
				val5 = (val10.targetTexture = new RenderTexture(1024, 1024, 24, (RenderTextureFormat)0)
				{
					antiAliasing = 8
				});
				val6 = new Texture2D(1024, 1024, (TextureFormat)4, false);
				Vector3 forward = default(Vector3);
				((Vector3)(ref forward))..ctor(val7.x, 0f, val7.z);
				if (((Vector3)(ref forward)).sqrMagnitude < 0.0001f)
				{
					forward = Vector3.forward;
				}
				Quaternion val12 = Quaternion.LookRotation(Quaternion.Euler(0f, 32f, 0f) * ((Vector3)(ref forward)).normalized);
				Quaternion val13 = val12 * Quaternion.Euler(30f, 0f, 0f);
				float num2 = 1.3f / (0.6f * Mathf.Tan(val10.fieldOfView * 0.5f * ((float)Math.PI / 180f)));
				Vector3 position = val3.transform.position;
				val4.transform.SetPositionAndRotation(position - val13 * Vector3.forward * num2, val13);
				(string, float, float, float)[] poses = Poses;
				for (int i = 0; i < poses.Length; i++)
				{
					var (text2, num3, num4, num5) = poses[i];
					val8.localPosition = Vector3.zero;
					val8.rotation = val12 * Quaternion.Euler(0f, 0f, num5) * Quaternion.Euler(num4, 0f, 0f) * Quaternion.Euler(0f, num3, 0f);
					Shoot(val10, val5, val6, Color.black, Path.Combine(text, "pose-" + text2 + "-black.png"));
					Shoot(val10, val5, val6, Color.white, Path.Combine(text, "pose-" + text2 + "-white.png"));
				}
				DumpStock(text);
				Sfx.DumpNames(Path.Combine(text, "audioclips.txt"));
				ManualLogSource log = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val14 = new BepInExInfoLogInterpolatedStringHandler(40, 4, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val14).AppendLiteral("Card art: wrote ");
					((BepInExLogInterpolatedStringHandler)val14).AppendFormatted<int>(Poses.Length);
					((BepInExLogInterpolatedStringHandler)val14).AppendLiteral(" poses to '");
					((BepInExLogInterpolatedStringHandler)val14).AppendFormatted<string>(text);
					((BepInExLogInterpolatedStringHandler)val14).AppendLiteral("' (layer ");
					((BepInExLogInterpolatedStringHandler)val14).AppendFormatted<int>(num);
					((BepInExLogInterpolatedStringHandler)val14).AppendLiteral(", ");
					((BepInExLogInterpolatedStringHandler)val14).AppendFormatted<string>(((Object)(object)val != (Object)null) ? "default daylight" : "no level lighting found, scene lights as they are");
					((BepInExLogInterpolatedStringHandler)val14).AppendLiteral(").");
				}
				log.LogInfo(val14);
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExErrorLogInterpolatedStringHandler val15 = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val15).AppendLiteral("Card art capture failed: ");
					((BepInExLogInterpolatedStringHandler)val15).AppendFormatted<Exception>(ex);
				}
				log2.LogError(val15);
			}
			finally
			{
				if ((Object)(object)val != (Object)null)
				{
					LevelEnvironmentBiome val16 = (((Object)(object)LevelManager.instance != (Object)null && (Object)(object)LevelManager.instance.levelDefinition != (Object)null) ? LevelManager.instance.levelDefinition.CurrentBiome : null);
					if ((Object)(object)val16 != (Object)null)
					{
						val.Refresh(val16);
					}
				}
				if ((Object)(object)val5 != (Object)null)
				{
					val5.Release();
				}
				Art.Destroy((Object)(object)val5);
				Art.Destroy((Object)(object)val6);
				Art.Destroy((Object)(object)val2);
				Art.Destroy((Object)(object)val4);
				Art.Destroy((Object)(object)val3);
			}
		}

		private static void Shoot(Camera cam, RenderTexture rt, Texture2D tex, Color background, string path)
		{
			//IL_0001: 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)
			cam.backgroundColor = background;
			cam.Render();
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = rt;
			tex.ReadPixels(new Rect(0f, 0f, 1024f, 1024f), 0, 0);
			tex.Apply();
			RenderTexture.active = active;
			WritePng(tex, path);
		}

		private static void WritePng(Texture2D tex, string path)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			NativeArray<byte> val = default(NativeArray<byte>);
			val..ctor(tex.GetRawTextureData(), (Allocator)2);
			try
			{
				NativeArray<byte> val2 = ImageConversion.EncodeNativeArrayToPNG<byte>(val, ((Texture)tex).graphicsFormat, (uint)((Texture)tex).width, (uint)((Texture)tex).height, 0u);
				File.WriteAllBytes(path, val2.ToArray());
				val2.Dispose();
			}
			finally
			{
				((IDisposable)val/*cast due to .constrained prefix*/).Dispose();
			}
		}

		private static int FreeLayer()
		{
			for (int num = 31; num >= 8; num--)
			{
				if (string.IsNullOrEmpty(LayerMask.LayerToName(num)))
				{
					return num;
				}
			}
			return 31;
		}

		private static void DumpStock(string dir)
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//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)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_0129: Expected O, but got Unknown
			ObstacleDescription[] array = ObstacleManager.instance?.allowedObstacleDescriptions;
			if (array == null)
			{
				return;
			}
			ObstacleDescription[] array2 = array;
			foreach (ObstacleDescription val in array2)
			{
				if ((Object)(object)val == (Object)null || (Object)(object)val.thumbnail == (Object)null)
				{
					continue;
				}
				Card card = LuckyCard.Card;
				if (!((Object)(object)val == (Object)(object)((card != null) ? card.Asset : null)))
				{
					string path = Path.Combine(dir, "stock-" + ((Object)val).name + ".png");
					if (!File.Exists(path))
					{
						Texture2D thumbnail = val.thumbnail;
						RenderTexture val2 = new RenderTexture(((Texture)thumbnail).width, ((Texture)thumbnail).height, 0, (RenderTextureFormat)0);
						Graphics.Blit((Texture)(object)thumbnail, val2, Vector2.one, Vector2.zero);
						RenderTexture active = RenderTexture.active;
						RenderTexture.active = val2;
						Texture2D val3 = new Texture2D(((Texture)thumbnail).width, ((Texture)thumbnail).height, (TextureFormat)4, false);
						val3.ReadPixels(new Rect(0f, 0f, (float)((Texture)thumbnail).width, (float)((Texture)thumbnail).height), 0, 0);
						val3.Apply();
						RenderTexture.active = active;
						WritePng(val3, path);
						val2.Release();
						Object.Destroy((Object)(object)val2);
						Object.Destroy((Object)val3);
					}
				}
			}
		}
	}
	internal sealed class CarPowerUps : MonoBehaviour
	{
		public static readonly List<CarPowerUps> All = new List<CarPowerUps>();

		private readonly Dictionary<PowerUpKind, float> _until = new Dictionary<PowerUpKind, float>();

		private readonly Dictionary<PowerUpKind, object> _appliers = new Dictionary<PowerUpKind, object>();

		private int _bonusDashes;

		private float _immuneUntil;

		private float _savedJumpHeight;

		private int _addedAirJumps;

		private readonly List<(Collider car, Collider prop)> _phased = new List<(Collider, Collider)>();

		private readonly List<Renderer> _blinking = new List<Renderer>();

		private float _nextButter;

		private float _launchCooldown;

		private Transform _fxRoot;

		private readonly Dictionary<PowerUpKind, GameObject> _fx = new Dictionary<PowerUpKind, GameObject>();

		public PlayerData Player { get; private set; }

		public SphereCarController Car { get; private set; }

		public bool HasShield { get; private set; }

		public bool IsLocal
		{
			get
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)Player != (Object)null && (int)Player.type == 0)
				{
					return ((NetworkBehaviour)Player).IsOwner;
				}
				return false;
			}
		}

		public IEnumerable<KeyValuePair<PowerUpKind, float>> Active
		{
			get
			{
				foreach (KeyValuePair<PowerUpKind, float> item in _until)
				{
					if (Time.time < item.Value)
					{
						yield return item;
					}
				}
			}
		}

		public int BonusDashes => _bonusDashes;

		private bool CarAlive
		{
			get
			{
				if ((Object)(object)Car != (Object)null && (Object)(object)Car.car != (Object)null && ((Component)Car.car).gameObject.activeInHierarchy)
				{
					return !Car.sphereRigidbody.isKinematic;
				}
				return false;
			}
		}

		public static CarPowerUps For(PlayerData p)
		{
			if ((Object)(object)p == (Object)null || (Object)(object)p.controller == (Object)null)
			{
				return null;
			}
			CarPowerUps carPowerUps = ((Component)p.controller).GetComponent<CarPowerUps>();
			if ((Object)(object)carPowerUps == (Object)null)
			{
				carPowerUps = ((Component)p.controller).gameObject.AddComponent<CarPowerUps>();
				carPowerUps.Player = p;
				carPowerUps.Car = p.controller;
			}
			return carPowerUps;
		}

		public static CarPowerUps Of(SphereCarController car)
		{
			if (!((Object)(object)car != (Object)null))
			{
				return null;
			}
			return ((Component)car).GetComponent<CarPowerUps>();
		}

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

		private void OnDisable()
		{
			All.Remove(this);
		}

		public bool Has(PowerUpKind k)
		{
			if (_until.TryGetValue(k, out var value))
			{
				return Time.time < value;
			}
			return false;
		}

		public float Remaining(PowerUpKind k)
		{
			if (!_until.TryGetValue(k, out var value))
			{
				return 0f;
			}
			return Mathf.Max(0f, value - Time.time);
		}

		public void Grant(PowerUpDef def)
		{
			if ((Object)(object)Car == (Object)null)
			{
				return;
			}
			float duration = def.Duration;
			switch (def.Kind)
			{
			case PowerUpKind.DashStash:
			{
				_bonusDashes += 3;
				SphereCarController car3 = Car;
				car3.maxBoostCount += 3;
				Car.CanBoost = Car.maxBoostCount > 0 && Car.boostPhase <= Car.maxBoostCount;
				Ring(def, 0.7f, 0.9f);
				break;
			}
			case PowerUpKind.WreckingBall:
				Timed(def, duration);
				Aura(def, 2);
				break;
			case PowerUpKind.PhaseOut:
				if (!Has(def.Kind))
				{
					StartPhase();
				}
				Timed(def, duration);
				break;
			case PowerUpKind.Titan:
				Timed(def, duration);
				RegisterModifier(def.Kind, duration, delegate(CarModifier m)
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_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_003e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0043: Unknown result type (might be due to invalid IL or missing references)
					//IL_0054: Unknown result type (might be due to invalid IL or missing references)
					//IL_0059: Unknown result type (might be due to invalid IL or missing references)
					//IL_005e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0064: Expected O, but got Unknown
					//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_007b: Unknown result type (might be due to invalid IL or missing references)
					AnimationCurve val = new AnimationCurve((Keyframe[])(object)new Keyframe[4]
					{
						new Keyframe(0f, 0.5263158f),
						new Keyframe(0.06f, 1f),
						new Keyframe(0.94f, 1f),
						new Keyframe(1f, 0.5263158f)
					});
					m.scale = new ModifierValue<Vector3>((ModifierValueType)2, val, Vector3.one * 1.9f);
				});
				break;
			case PowerUpKind.Afterburner:
				Timed(def, duration);
				RegisterModifier(def.Kind, duration, delegate(CarModifier m)
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_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_003e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0043: Unknown result type (might be due to invalid IL or missing references)
					//IL_0048: Unknown result type (might be due to invalid IL or missing references)
					//IL_004e: Expected O, but got Unknown
					//IL_0056: Unknown result type (might be due to invalid IL or missing references)
					//IL_005b: Unknown result type (might be due to invalid IL or missing references)
					AnimationCurve val = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
					{
						new Keyframe(0f, 1f),
						new Keyframe(0.85f, 1f),
						new Keyframe(1f, 0.2f)
					});
					m.speedToAdd = new ModifierValue<float>((ModifierValueType)1, val, 21f);
				});
				Flame(def);
				break;
			case PowerUpKind.SpringLoaded:
				if (!Has(def.Kind))
				{
					_savedJumpHeight = Car.jumpHeight;
					SphereCarController car = Car;
					car.jumpHeight *= 3f;
					SphereCarController car2 = Car;
					car2.maxAirJumps += 2;
					_addedAirJumps = 2;
				}
				Timed(def, duration);
				Aura(def, 1);
				break;
			case PowerUpKind.VelcroTires:
			{
				Timed(def, duration);
				float turn = Car.rotationSpeed * 0.4f;
				RegisterModifier(def.Kind, duration, delegate(CarModifier m)
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_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_0032: Unknown result type (might be due to invalid IL or missing references)
					//IL_0038: Expected O, but got Unknown
					//IL_0041: Unknown result type (might be due to invalid IL or missing references)
					//IL_0046: Unknown result type (might be due to invalid IL or missing references)
					AnimationCurve val = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 1f),
						new Keyframe(1f, 1f)
					});
					m.rotationSpeed = new ModifierValue<float>((ModifierValueType)1, val, turn);
				});
				Aura(def, 1);
				break;
			}
			case PowerUpKind.ButterTrail:
				Timed(def, duration);
				break;
			case PowerUpKind.Shockwave:
				Blast();
				break;
			case PowerUpKind.BubbleWrap:
				HasShield = true;
				Bubble(def, on: true);
				break;
			case PowerUpKind.Featherweight:
				Timed(def, duration);
				Aura(def, 1);
				break;
			}
		}

		private void Timed(PowerUpDef def, float seconds)
		{
			float time = Time.time;
			_until[def.Kind] = ((_until.TryGetValue(def.Kind, out var value) && value > time) ? value : time) + seconds;
		}

		private void RegisterModifier(PowerUpKind kind, float seconds, Action<CarModifier> setup)
		{
			if (_appliers.TryGetValue(kind, out var value))
			{
				Car.UnregisterModifiers(value);
			}
			CarModifier val = ScriptableObject.CreateInstance<CarModifier>();
			((Object)val).name = "LuckyBlocks_" + kind;
			val.id = "LUCKYBLOCKS_" + kind.ToString().ToUpperInvariant();
			val.durationSeconds = ((Remaining(kind) > 0f) ? Remaining(kind) : seconds);
			val.isUniquePerApplier = true;
			val.priority = 50;
			setup(val);
			object obj = new object();
			if (val.Register(Car, obj))
			{
				_appliers[kind] = obj;
			}
		}

		private void End(PowerUpKind kind)
		{
			_until.Remove(kind);
			if (_appliers.TryGetValue(kind, out var value))
			{
				if ((Object)(object)Car != (Object)null)
				{
					Car.UnregisterModifiers(value);
				}
				_appliers.Remove(kind);
			}
			switch (kind)
			{
			case PowerUpKind.PhaseOut:
				StopPhase();
				break;
			case PowerUpKind.SpringLoaded:
				if ((Object)(object)Car != (Object)null && _addedAirJumps > 0)
				{
					Car.jumpHeight = _savedJumpHeight;
					SphereCarController car = Car;
					car.maxAirJumps -= _addedAirJumps;
					_addedAirJumps = 0;
				}
				break;
			}
			ClearFx(kind);
		}

		public void EndTimed()
		{
			foreach (PowerUpKind item in new List<PowerUpKind>(_until.Keys))
			{
				End(item);
			}
		}

		public void EndRound()
		{
			EndTimed();
			if (_bonusDashes > 0 && (Object)(object)Car != (Object)null)
			{
				Car.maxBoostCount = Mathf.Max(0, Car.maxBoostCount - _bonusDashes);
			}
			_bonusDashes = 0;
			HasShield = false;
			Bubble(null, on: false);
			foreach (PowerUpKind item in new List<PowerUpKind>(_fx.Keys))
			{
				ClearFx(item);
			}
		}

		private void OnDestroy()
		{
			StopPhase();
		}

		private void Update()
		{
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Car == (Object)null)
			{
				return;
			}
			foreach (PowerUpKind item in new List<PowerUpKind>(_until.Keys))
			{
				if (Time.time >= _until[item])
				{
					End(item);
				}
			}
			if (_until.Count > 0 && (Object)(object)Car.car != (Object)null && !((Component)Car.car).gameObject.activeInHierarchy)
			{
				EndTimed();
			}
			if (_blinking.Count > 0)
			{
				bool enabled = Mathf.Repeat(Time.time * 9f, 1f) < 0.55f || (Remaining(PowerUpKind.PhaseOut) > 1.5f && Mathf.Repeat(Time.time * 4f, 1f) < 0.8f);
				foreach (Renderer item2 in _blinking)
				{
					if ((Object)(object)item2 != (Object)null)
					{
						item2.enabled = enabled;
					}
				}
			}
			if (!((Object)(object)_fxRoot != (Object)null) || !((Object)(object)Car.car != (Object)null))
			{
				return;
			}
			bool activeInHierarchy = ((Component)Car.car).gameObject.activeInHierarchy;
			if (((Component)_fxRoot).gameObject.activeSelf != activeInHierarchy)
			{
				((Component)_fxRoot).gameObject.SetActive(activeInHierarchy);
			}
			_fxRoot.position = Car.car.position;
			_fxRoot.rotation = Car.car.rotation;
			foreach (KeyValuePair<PowerUpKind, GameObject> item3 in _fx)
			{
				if (!((Object)(object)item3.Value == (Object)null))
				{
					if (item3.Key == PowerUpKind.Afterburner)
					{
						float num = 0.8f + Mathf.PerlinNoise(Time.time * 18f, 0.3f) * 0.6f;
						item3.Value.transform.localScale = new Vector3(1f, 1f, num);
					}
					else
					{
						item3.Value.transform.Rotate(0f, 160f * Time.deltaTime, 0f, (Space)1);
					}
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_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_007b: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			if (!CarAlive)
			{
				return;
			}
			Rigidbody sphereRigidbody = Car.sphereRigidbody;
			float fixedDeltaTime = Time.fixedDeltaTime;
			if (Has(PowerUpKind.Featherweight))
			{
				Vector3 gravityAtPoint = GravityShapesManager.GetGravityAtPoint(sphereRigidbody.position);
				sphereRigidbody.AddForce(-gravityAtPoint * 0.62f, (ForceMode)5);
			}
			if (Has(PowerUpKind.VelcroTires) && Car.OnGround)
			{
				Vector3 velocity = sphereRigidbody.velocity;
				Vector3 val = Vector3.Project(velocity, Car.car.right);
				sphereRigidbody.velocity = velocity - val * Mathf.Clamp01(12f * fixedDeltaTime);
			}
			if (Has(PowerUpKind.ButterTrail) && Car.OnGround && Time.time >= _nextButter)
			{
				Vector3 velocity2 = sphereRigidbody.velocity;
				if (((Vector3)(ref velocity2)).sqrMagnitude > 9f)
				{
					_nextButter = Time.time + 0.12f;
					Butter.Drop(this, Car.FloorPos, Car.FloorNormal, Car.car.forward);
				}
			}
			if (_launchCooldown > 0f)
			{
				_launchCooldown -= fixedDeltaTime;
			}
		}

		public void OnBumpedBy(CarPowerUps attacker, Vector3 contactNormal)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00d9: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			if (!IsLocal || (Object)(object)attacker == (Object)null || (Object)(object)attacker == (Object)(object)this || _launchCooldown > 0f || !CarAlive)
			{
				return;
			}
			bool flag = attacker.Has(PowerUpKind.WreckingBall) && !Has(PowerUpKind.WreckingBall);
			bool flag2 = attacker.Has(PowerUpKind.Titan) && !Has(PowerUpKind.Titan);
			if (flag || flag2)
			{
				Rigidbody sphereRigidbody = Car.sphereRigidbody;
				Vector3 val = Up(sphereRigidbody.position);
				Vector3 val2 = Vector3.ProjectOnPlane(sphereRigidbody.position - attacker.Car.sphereRigidbody.position, val);
				if (((Vector3)(ref val2)).sqrMagnitude < 0.01f)
				{
					val2 = Vector3.ProjectOnPlane(contactNormal, val);
				}
				val2 = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val2)).normalized : Car.car.forward);
				if (flag)
				{
					sphereRigidbody.velocity = Vector3.ProjectOnPlane(sphereRigidbody.velocity, val) * 0.3f + val2 * 16f + val * 22f;
					Spin(1.1f, 900f);
				}
				else
				{
					sphereRigidbody.velocity = Vector3.ProjectOnPlane(sphereRigidbody.velocity, val) * 0.5f + val2 * 24f + val * 7f;
					Spin(0.6f, 600f);
				}
				_launchCooldown = 1.2f;
				Plugin.Verbose(Player.DisplayNameRaw + " launched by " + attacker.Player.DisplayNameRaw + " (" + (flag ? "Wrecking Ball" : "Titan") + ").");
			}
		}

		private void Blast()
		{
			//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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Car == (Object)null)
			{
				return;
			}
			Vector3 position = Car.sphereRigidbody.position;
			ShockRing.Spawn(position, Up(position), PowerUps.Get(PowerUpKind.Shockwave).Color, 30f, 0.75f);
			foreach (PlayerData item in GameManagerPlayers())
			{
				if ((Object)(object)item == (Object)null || (Object)(object)item == (Object)(object)Player || (Object)(object)item.controller == (Object)null)
				{
					continue;
				}
				CarPowerUps carPowerUps = For(item);
				if (!((Object)(object)carPowerUps == (Object)null) && carPowerUps.IsLocal && carPowerUps.CarAlive)
				{
					Rigidbody sphereRigidbody = item.controller.sphereRigidbody;
					Vector3 val = sphereRigidbody.position - position;
					float magnitude = ((Vector3)(ref val)).magnitude;
					if (!(magnitude > 30f))
					{
						Vector3 val2 = Up(sphereRigidbody.position);
						Vector3 val3 = Vector3.ProjectOnPlane(val, val2);
						val3 = ((((Vector3)(ref val3)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val3)).normalized : item.controller.car.forward);
						float num = Mathf.Lerp(1f, 0.45f, magnitude / 30f);
						sphereRigidbody.velocity = Vector3.ProjectOnPlane(sphereRigidbody.velocity, val2) * 0.4f + val3 * 26f * num + val2 * 13f * num;
						carPowerUps.Spin(0.8f, 700f);
					}
				}
			}
		}

		private static IEnumerable<PlayerData> GameManagerPlayers()
		{
			return GameManager.Players ?? new List<PlayerData>();
		}

		public void SlipOnButter()
		{
			//IL_0048: 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_006a: 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_0076: 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)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (IsLocal && CarAlive && !(_launchCooldown > 0f) && !Has(PowerUpKind.VelcroTires))
			{
				_launchCooldown = 1.4f;
				Rigidbody sphereRigidbody = Car.sphereRigidbody;
				Vector3 val = Car.car.right * ((Random.value < 0.5f) ? (-1f) : 1f);
				sphereRigidbody.velocity = sphereRigidbody.velocity * 0.7f + val * 7f;
				Spin(0.9f, 760f);
				Plugin.Verbose(Player.DisplayNameRaw + " slipped on butter.");
			}
		}

		private void Spin(float seconds, float degreesPerSecond)
		{
			if (!((Object)(object)Car == (Object)null) && !((Object)(object)Car.car == (Object)null))
			{
				((MonoBehaviour)this).StartCoroutine(SpinRoutine(seconds, degreesPerSecond * ((Random.value < 0.5f) ? (-1f) : 1f)));
			}
		}

		private IEnumerator SpinRoutine(float seconds, float rate)
		{
			float end = Time.time + seconds;
			while (Time.time < end && (Object)(object)Car != (Object)null && (Object)(object)Car.car != (Object)null)
			{
				float num = (end - Time.time) / seconds;
				Car.car.Rotate(Car.car.up, rate * num * Time.deltaTime, (Space)0);
				yield return null;
			}
		}

		private static Vector3 Up(Vector3 at)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Vector3 gravityAtPoint = GravityShapesManager.GetGravityAtPoint(at);
			if (!(((Vector3)(ref gravityAtPoint)).sqrMagnitude > 0.001f))
			{
				return Vector3.up;
			}
			return -((Vector3)(ref gravityAtPoint)).normalized;
		}

		public bool BlocksTrapDeath()
		{
			if (Has(PowerUpKind.PhaseOut) || Time.time < _immuneUntil)
			{
				return true;
			}
			if (!HasShield)
			{
				return false;
			}
			HasShield = false;
			_immuneUntil = Time.time + 1.25f;
			PopBubble();
			Net.SendFx(Player.playerIndex.Value, 1);
			Plugin.Verbose(Player.DisplayNameRaw + "'s Bubble Wrap took the hit.");
			return true;
		}

		public void RemoteFx(byte fx)
		{
			if (fx == 1)
			{
				HasShield = false;
				PopBubble();
			}
		}

		private void PopBubble()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			PowerUpDef powerUpDef = PowerUps.Get(PowerUpKind.BubbleWrap);
			if ((Object)(object)Car != (Object)null && (Object)(object)Car.car != (Object)null)
			{
				Art.Burst(Car.car.position + Car.car.up * 0.6f, Car.car.up, powerUpDef.Color, Color.white, 12);
			}
			Bubble(powerUpDef, on: false);
		}

		private void StartPhase()
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Invalid comparison between Unknown and I4
			StopPhase();
			if ((Object)(object)Car == (Object)null)
			{
				return;
			}
			List<Collider> list = new List<Collider>();
			if ((Object)(object)Car.sphereCollider != (Object)null)
			{
				list.Add((Collider)(object)Car.sphereCollider);
			}
			if ((Object)(object)Car.subCollidersHolder != (Object)null)
			{
				list.AddRange(((Component)Car.subCollidersHolder).GetComponentsInChildren<Collider>(true));
			}
			foreach (Obstacle currentObstacle in ObstacleManager.CurrentObstacles)
			{
				if ((Object)(object)currentObstacle == (Object)null || (Object)(object)currentObstacle.description == (Object)null || (int)currentObstacle.description.type == 1 || (Object)(object)((Component)currentObstacle).GetComponent<LuckyBlock>() != (Object)null)
				{
					continue;
				}
				Collider[] componentsInChildren = ((Component)currentObstacle).GetComponentsInChildren<Collider>(true);
				foreach (Collider val in componentsInChildren)
				{
					if ((Object)(object)val == (Object)null || val.isTrigger)
					{
						continue;
					}
					foreach (Collider item in list)
					{
						if (!((Object)(object)item == (Object)null))
						{
							Physics.IgnoreCollision(item, val, true);
							_phased.Add((item, val));
						}
					}
				}
			}
			if ((Object)(object)Car.car != (Object)null)
			{
				Renderer[] componentsInChildren2 = ((Component)Car.car).GetComponentsInChildren<Renderer>(false);
				foreach (Renderer val2 in componentsInChildren2)
				{
					if (val2.enabled)
					{
						_blinking.Add(val2);
					}
				}
			}
			Plugin.Verbose($"Phase Out: {_phased.Count} collider pair(s) ignored, {_blinking.Count} renderer(s) blinking.");
		}

		private void StopPhase()
		{
			foreach (var (val, val2) in _phased)
			{
				if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null)
				{
					Physics.IgnoreCollision(val, val2, false);
				}
			}
			_phased.Clear();
			foreach (Renderer item in _blinking)
			{
				if ((Object)(object)item != (Object)null)
				{
					item.enabled = true;
				}
			}
			_blinking.Clear();
		}

		private Transform FxRoot()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_fxRoot == (Object)null)
			{
				_fxRoot = new GameObject("LuckyBlocks_CarFx").transform;
				_fxRoot.SetParent(((Component)this).transform, false);
			}
			return _fxRoot;
		}

		private void ClearFx(PowerUpKind kind)
		{
			if (_fx.TryGetValue(kind, out var value) && (Object)(object)value != (Object)null)
			{
				Object.Destroy((Object)(object)value);
			}
			_fx.Remove(kind);
		}

		private void Aura(PowerUpDef def, int rings)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_005f: 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_0087: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			if (!_fx.ContainsKey(def.Kind))
			{
				GameObject val = new GameObject("Aura_" + def.Kind);
				val.transform.SetParent(FxRoot(), false);
				for (int i = 0; i < rings; i++)
				{
					Transform transform = Art.Part(val.transform, "Ring", Art.RingMesh, Art.Glow(def.Color)).transform;
					transform.localPosition = Vector3.up * (0.35f + 0.45f * (float)i);
					transform.localRotation = Quaternion.Euler((i == 0) ? 8f : (-14f), 0f, (i == 0) ? (-6f) : 10f);
					transform.localScale = Vector3.one * (1.45f - 0.2f * (float)i);
				}
				_fx[def.Kind] = val;
			}
		}

		private void Ring(PowerUpDef def, float height, float seconds)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			ShockRing.Spawn(((Object)(object)Car != (Object)null && (Object)(object)Car.car != (Object)null) ? (Car.car.position + Car.car.up * height) : ((Component)this).transform.position, ((Object)(object)Car != (Object)null && (Object)(object)Car.car != (Object)null) ? Car.car.up : Vector3.up, def.Color, 4f, seconds);
		}

		private void Flame(PowerUpDef def)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			if (!_fx.ContainsKey(def.Kind))
			{
				GameObject val = new GameObject("Flame");
				val.transform.SetParent(FxRoot(), false);
				float[] array = new float[2] { -0.38f, 0.38f };
				foreach (float num in array)
				{
					Transform transform = Art.Part(val.transform, "Outer", Art.FlameMesh, Art.Glow(def.Color)).transform;
					transform.localPosition = new Vector3(num, 0.32f, -1.05f);
					transform.localScale = new Vector3(0.5f, 0.5f, 1.15f);
					Transform transform2 = Art.Part(val.transform, "Inner", Art.FlameMesh, Art.Glow(new Color(1f, 0.92f, 0.45f))).transform;
					transform2.localPosition = new Vector3(num, 0.32f, -1.02f);
					transform2.localScale = new Vector3(0.28f, 0.28f, 0.75f);
				}
				_fx[def.Kind] = val;
			}
		}

		private void Bubble(PowerUpDef def, bool on)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0032: 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_0057: 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)
			ClearFx(PowerUpKind.BubbleWrap);
			if (on && def != null)
			{
				GameObject val = new GameObject("Bubble");
				val.transform.SetParent(FxRoot(), false);
				val.transform.localPosition = Vector3.up * 0.55f;
				Art.Part(val.transform, "BubbleSphere", Art.SphereMesh, Art.Bubble(def.Color)).transform.localScale = new Vector3(1.55f, 1.25f, 1.9f);
				_fx[PowerUpKind.BubbleWrap] = val;
			}
		}
	}
	internal static class Diagnostics
	{
		private static bool _dumped;

		private static bool _carDumped;

		public static void DumpOnce(ObstacleDescription[] catalog)
		{
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			if (_dumped || !Plugin.VerboseLog.Value)
			{
				return;
			}
			_dumped = true;
			StringBuilder stringBuilder = new StringBuilder("Stock pieces:\n");
			string[] array = new string[5] { "Donut", "BoostPad", "Bubble", "ShrinkRay", "Laser" };
			foreach (string name in array)
			{
				ObstacleDescription val = ((IEnumerable<ObstacleDescription>)catalog).FirstOrDefault((Func<ObstacleDescription, bool>)((ObstacleDescription x) => (Object)(object)x != (Object)null && ((Object)x).name == name));
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val.prefab == (Object)null))
				{
					stringBuilder.AppendLine($"[{name}] prefab '{((Object)val.prefab).name}' scale {((Component)val.prefab).transform.localScale} " + "thumb " + (((Object)(object)val.thumbnail != (Object)null) ? $"{((Texture)val.thumbnail).width}x{((Texture)val.thumbnail).height}" : "none") + " " + $"move {val.movementType} rot {val.rotationType}");
					Hierarchy(stringBuilder, ((Component)val.prefab).transform, 1);
				}
			}
			IEnumerable<string> values = from num in Enumerable.Range(0, 32)
				select (i: num, n: LayerMask.LayerToName(num)) into x
				where !string.IsNullOrEmpty(x.n)
				select $"{x.i}={x.n}";
			stringBuilder.AppendLine("Layers: " + string.Join(", ", values));
			ObstacleManager instance = ObstacleManager.instance;
			stringBuilder.AppendLine($"obstacleLayer mask {((instance != null) ? new int?(((LayerMask)(ref instance.obstacleLayer)).value) : ((int?)null))}");
			Plugin.Log.LogInfo((object)stringBuilder.ToString());
		}

		public static void DumpCar(SphereCarController car)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (!_carDumped && Plugin.VerboseLog.Value && !((Object)(object)car == (Object)null))
			{
				_carDumped = true;
				StringBuilder stringBuilder = new StringBuilder("Car:\n");
				Hierarchy(stringBuilder, ((Component)car).transform, 1, 4);
				int num = (((Object)(object)car.sphereCollider != (Object)null) ? ((Component)car.sphereCollider).gameObject.layer : (-1));
				object arg = num;
				string arg2 = LayerMask.LayerToName(num);
				SphereCollider sphereCollider = car.sphereCollider;
				int? obj;
				if (sphereCollider == null)
				{
					obj = null;
				}
				else
				{
					LayerMask excludeLayers = ((Collider)sphereCollider).excludeLayers;
					obj = ((LayerMask)(ref excludeLayers)).value;
				}
				stringBuilder.AppendLine($"Sphere layer {arg} ({arg2}), excludeLayers {obj}; " + $"lucky trigger layer {LuckyCard.TriggerLayer} ({LayerMask.LayerToName(LuckyCard.TriggerLayer)})");
				Plugin.Log.LogInfo((object)stringBuilder.ToString());
			}
		}

		private static void Hierarchy(StringBuilder sb, Transform t, int depth, int maxDepth = 5)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			if (depth > maxDepth)
			{
				return;
			}
			IEnumerable<string> values = (from c in ((Component)t).GetComponents<Component>()
				where (Object)(object)c != (Object)null && !(c is Transform)
				select c).Select(delegate(Component c)
			{
				Collider val = (Collider)(object)((c is Collider) ? c : null);
				if (val != null)
				{
					return ((object)c).GetType().Name + (val.isTrigger ? "(trigger)" : "");
				}
				Renderer val2 = (Renderer)(object)((c is Renderer) ? c : null);
				return (val2 != null) ? (((object)c).GetType().Name + "<" + string.Join("; ", val2.sharedMaterials.Select(Art.Describe)) + ">") : ((object)c).GetType().Name;
			});
			sb.AppendLine(string.Format("{0}{1} L{2} [{3}]", new string(' ', depth * 2), ((Object)t).name, ((Component)t).gameObject.layer, string.Join(", ", values)));
			foreach (Transform item in t)
			{
				Transform t2 = item;
				Hierarchy(sb, t2, depth + 1, maxDepth);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerNetworking), "OnNetworkSpawn")]
	internal static class CarSpawnPatch
	{
		private static void Postfix(PlayerNetworking __instance)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			try
			{
				Diagnostics.DumpCar(__instance.carController);
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(17, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Car dump failed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val);
			}
		}
	}
	internal sealed class Butter : MonoBehaviour
	{
		private struct Pat
		{
			public Transform T;

			public CarPowerUps Dropper;

			public Vector3 Pos;

			public float Born;
		}

		private const float Life = 9f;

		private const float Radius = 1.6f;

		private const int Max = 400;

		private static readonly List<Pat> Pats = new List<Pat>();

		private static Butter _runner;

		public static void Drop(CarPowerUps dropper, Vector3 floor, Vector3 normal, Vector3 forward)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_runner == (Object)null)
			{
				_runner = new GameObject("LuckyBlocks_Butter").AddComponent<Butter>();
			}
			if (Pats.Count >= 400)
			{
				Remove(0);
			}
			Vector3 val = Vector3.ProjectOnPlane(forward, normal);
			Vector3 val2 = floor - ((Vector3)(ref val)).normalized * 1.3f + normal * 0.03f;
			Transform transform = Art.Part(((Component)_runner).transform, "Pat", Art.ButterMesh, Art.Lit(new Color(1f, 0.88f, 0.42f))).transform;
			transform.position = val2;
			transform.rotation = Quaternion.FromToRotation(Vector3.up, normal) * Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
			transform.localScale = new Vector3(Random.Range(0.8f, 1.15f), 1f, Random.Range(0.7f, 1f));
			Pats.Add(new Pat
			{
				T = transform,
				Dropper = dropper,
				Pos = val2,
				Born = Time.time
			});
		}

		private static void Remove(int i)
		{
			if ((Object)(object)Pats[i].T != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)Pats[i].T).gameObject);
			}
			Pats.RemoveAt(i);
		}

		public static void Clear()
		{
			for (int num = Pats.Count - 1; num >= 0; num--)
			{
				Remove(num);
			}
		}

		private void Update()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			for (int num = Pats.Count - 1; num >= 0; num--)
			{
				float num2 = Time.time - Pats[num].Born;
				if (num2 >= 9f || (Object)(object)Pats[num].T == (Object)null)
				{
					Remove(num);
				}
				else if (num2 > 8f)
				{
					Vector3 localScale = Pats[num].T.localScale;
					Pats[num].T.localScale = new Vector3(localScale.x, Mathf.Max(0.05f, 9f - num2), localScale.z);
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			if (Pats.Count == 0)
			{
				return;
			}
			List<PlayerData> players = GameManager.Players;
			if (players == null)
			{
				return;
			}
			foreach (PlayerData item in players)
			{
				if ((Object)(object)item == (Object)null || (int)item.type != 0 || !((NetworkBehaviour)item).IsOwner || (Object)(object)item.controller == (Object)null || !item.controller.OnGround)
				{
					continue;
				}
				Vector3 position = item.controller.sphereRigidbody.position;
				foreach (Pat pat in Pats)
				{
					if (!((Object)(object)pat.Dropper != (Object)null) || !((Object)(object)pat.Dropper.Player == (Object)(object)item))
					{
						Vector3 val = pat.Pos - position;
						if (!(((Vector3)(ref val)).sqrMagnitude > 2.5600002f))
						{
							CarPowerUps.For(item)?.SlipOnButter();
							break;
						}
					}
				}
			}
		}
	}
	internal sealed class ShockRing : MonoBehaviour
	{
		private float _age;

		private float _life;

		private float _radius;

		public static void Spawn(Vector3 at, Vector3 up, Color color, float radius = 30f, float seconds = 0.6f)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Art.Part(null, "LuckyBlocks_Ring", Art.RingMesh, Art.Glow(color));
			obj.transform.position = at;
			obj.transform.rotation = Quaternion.FromToRotation(Vector3.up, up);
			ShockRing shockRing = obj.AddComponent<ShockRing>();
			shockRing._life = seconds;
			shockRing._radius = radius;
			obj.transform.localScale = Vector3.one * 0.5f;
		}

		private void Update()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			_age += Time.deltaTime;
			float num = Mathf.Clamp01(_age / _life);
			float num2 = Mathf.Lerp(0.5f, _radius, 1f - (1f - num) * (1f - num));
			((Component)this).transform.localScale = new Vector3(num2, Mathf.Lerp(9f, 2f, num), num2);
			if (_age >= _life)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	internal static class Rounds
	{
		private static GameState _last;

		public static bool IsRacing
		{
			get
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Invalid comparison between Unknown and I4
				GameManager instance = GameManager.instance;
				if ((Object)(object)instance != (Object)null && (Object)(object)instance.networkVariables != (Object)null && instance.networkVariables.state != null)
				{
					return (int)instance.net