Decompiled source of Ring of Invisibility v1.0.0

RingOfInvisibility.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Auras;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 Auras
{
	internal static class RingModel
	{
		internal sealed class Materials
		{
			public Material Metal;

			public Material Stone;
		}

		private sealed class Shape
		{
			public readonly List<Vector3> Points = new List<Vector3>();

			public readonly List<Vector3> Normals = new List<Vector3>();

			public readonly List<int> Triangles = new List<int>();

			public int Add(Vector3 point, Vector3 normal)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				Points.Add(point);
				Normals.Add(((Vector3)(ref normal)).normalized);
				return Points.Count - 1;
			}

			public void Triangle(int a, int b, int c)
			{
				//IL_0007: 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_0018: 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_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: 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_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				if (Vector3.Dot(Vector3.Cross(Points[b] - Points[a], Points[c] - Points[a]), Normals[a] + Normals[b] + Normals[c]) < 0f)
				{
					int num = c;
					c = b;
					b = num;
				}
				Triangles.Add(a);
				Triangles.Add(b);
				Triangles.Add(c);
			}

			public void Quad(int a, int b, int c, int d)
			{
				Triangle(a, b, c);
				Triangle(a, c, d);
			}

			public void Facet(Vector3 outwardFrom, params Vector3[] corners)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: 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_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: 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_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_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_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_007b: 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_0086: 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_0088: 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_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = Vector3.Cross(corners[1] - corners[0], corners[2] - corners[0]);
				float magnitude = ((Vector3)(ref val)).magnitude;
				val = ((magnitude > 0f) ? (val / magnitude) : Vector3.up);
				Vector3 val2 = Vector3.zero;
				Vector3[] array = corners;
				foreach (Vector3 val3 in array)
				{
					val2 += val3;
				}
				val2 /= (float)corners.Length;
				if (Vector3.Dot(val, val2 - outwardFrom) < 0f)
				{
					val = -val;
				}
				int count = Points.Count;
				array = corners;
				foreach (Vector3 point in array)
				{
					Add(point, val);
				}
				for (int j = 1; j < corners.Length - 1; j++)
				{
					Triangle(count, count + j, count + j + 1);
				}
			}

			public Mesh ToMesh(string name)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: 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_0014: 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_002c: 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_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Expected O, but got Unknown
				Mesh val = new Mesh
				{
					name = name,
					hideFlags = (HideFlags)32
				};
				val.SetVertices(Points);
				val.SetNormals(Normals);
				val.SetUVs(0, new List<Vector2>((IEnumerable<Vector2>)(object)new Vector2[Points.Count]));
				val.SetTriangles(Triangles, 0);
				val.RecalculateBounds();
				return val;
			}
		}

		private const float BandRadius = 0.0095f;

		private const float BandThickness = 0.0017f;

		private const float CollarRadius = 0.0041f;

		private const float CollarHeight = 0.0028f;

		private const float StoneRadius = 0.0047f;

		private const float TableRadius = 0.0027f;

		private const float CrownHeight = 0.0021f;

		private const float PavilionDepth = 0.0026f;

		private const float WornHalfWidth = 0.002f;

		private const float WornThickness = 0.0016f;

		private const float WornSetting = 1.25f;

		private static readonly Color Gold = new Color(0.86f, 0.68f, 0.3f);

		private static readonly Color Silver = new Color(0.8f, 0.82f, 0.86f);

		private static Mesh? _band;

		private static Mesh? _collar;

		private static Mesh? _stone;

		private static readonly Dictionary<string, Mesh> WornBands = new Dictionary<string, Mesh>();

		private static Mesh CollarMesh
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_collar))
				{
					return _collar = Collar();
				}
				return _collar;
			}
		}

		private static Mesh StoneMesh
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_stone))
				{
					return _stone = Cut();
				}
				return _stone;
			}
		}

		private static float CollarBase => 0.010009999f;

		public static Materials MaterialsFor(Shader standard, AuraDef def)
		{
			//IL_0016: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			return new Materials
			{
				Metal = Metal(standard, def.SilverBand ? Silver : Gold, def.SilverBand ? "silver" : "gold"),
				Stone = Stone(standard, def.Gem, def.Key)
			};
		}

		public static Bounds Build(Transform parent, Materials materials, int layer)
		{
			//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_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_0086: 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_0091: 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_00ba: 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)
			Vector3 position = default(Vector3);
			((Vector3)(ref position))..ctor(0f, CollarBase, 0f);
			Vector3 position2 = default(Vector3);
			((Vector3)(ref position2))..ctor(0f, CollarBase + 0.0028f, 0f);
			Bounds result = Part(parent, "band", Object.op_Implicit((Object)(object)_band) ? _band : (_band = Band()), materials.Metal, layer, Vector3.zero, Quaternion.identity, 1f);
			((Bounds)(ref result)).Encapsulate(Part(parent, "collar", CollarMesh, materials.Metal, layer, position, Quaternion.identity, 1f));
			((Bounds)(ref result)).Encapsulate(Part(parent, "stone", StoneMesh, materials.Stone, layer, position2, Quaternion.identity, 1f));
			return result;
		}

		public static Bounds BuildWorn(Transform parent, RingFit fit, Materials materials, int layer)
		{
			//IL_0035: 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_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_0060: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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)
			if (!WornBands.TryGetValue(fit.Name, out Mesh value) || !Object.op_Implicit((Object)(object)value))
			{
				value = (WornBands[fit.Name] = WornBand(fit));
			}
			Vector3 val2 = fit.Centre + fit.Top * (fit.Radii[0] + 0.0016f - 0.0004f);
			Quaternion rotation = Quaternion.LookRotation(fit.Axis, fit.Top);
			Bounds result = Part(parent, "band", value, materials.Metal, layer, Vector3.zero, Quaternion.identity, 1f);
			((Bounds)(ref result)).Encapsulate(Part(parent, "collar", CollarMesh, materials.Metal, layer, val2, rotation, 1.25f));
			((Bounds)(ref result)).Encapsulate(Part(parent, "stone", StoneMesh, materials.Stone, layer, val2 + fit.Top * 0.0034999999f, rotation, 1.25f));
			return result;
		}

		private static Bounds Part(Transform parent, string name, Mesh mesh, Material material, int layer, Vector3 position, Quaternion rotation, float scale)
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0069: 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_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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//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)
			GameObject val = new GameObject(name)
			{
				layer = layer
			};
			val.transform.SetParent(parent, false);
			val.transform.localPosition = position;
			val.transform.localRotation = rotation;
			val.transform.localScale = Vector3.one * scale;
			val.AddComponent<MeshFilter>().sharedMesh = mesh;
			((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterial = material;
			Bounds bounds = mesh.bounds;
			Bounds result = default(Bounds);
			((Bounds)(ref result))..ctor(position + rotation * (((Bounds)(ref bounds)).center * scale), Vector3.zero);
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < 8; i++)
			{
				((Vector3)(ref val2))..ctor(((i & 1) == 0) ? (0f - ((Bounds)(ref bounds)).extents.x) : ((Bounds)(ref bounds)).extents.x, ((i & 2) == 0) ? (0f - ((Bounds)(ref bounds)).extents.y) : ((Bounds)(ref bounds)).extents.y, ((i & 4) == 0) ? (0f - ((Bounds)(ref bounds)).extents.z) : ((Bounds)(ref bounds)).extents.z);
				((Bounds)(ref result)).Encapsulate(position + rotation * ((((Bounds)(ref bounds)).center + val2) * scale));
			}
			return result;
		}

		private static Material Metal(Shader standard, Color colour, string name)
		{
			//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_0017: 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_001e: 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_003f: Expected O, but got Unknown
			Material val = new Material(standard)
			{
				name = "aura_ring_" + name,
				color = colour
			};
			val.SetFloat("_Metallic", 1f);
			val.SetFloat("_Glossiness", 0.72f);
			return val;
		}

		private static Material Stone(Shader standard, Color colour, string name)
		{
			//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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008d: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			Material val = new Material(standard)
			{
				name = "aura_ring_stone_" + name.ToLowerInvariant(),
				color = new Color(colour.r * 0.6f, colour.g * 0.6f, colour.b * 0.6f, 1f)
			};
			val.SetFloat("_Metallic", 0f);
			val.SetFloat("_Glossiness", 0.9f);
			val.EnableKeyword("_EMISSION");
			val.SetColor("_EmissionColor", new Color(colour.r * 0.5f, colour.g * 0.5f, colour.b * 0.5f, 1f));
			return val;
		}

		private static Mesh Band()
		{
			//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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_0097: 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)
			Shape shape = new Shape();
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < 40; i++)
			{
				float num = (float)i * (float)Math.PI * 2f / 40f;
				Vector3 val = new Vector3(Mathf.Cos(num), Mathf.Sin(num), 0f) * 0.0095f;
				for (int j = 0; j < 12; j++)
				{
					float num2 = (float)j * (float)Math.PI * 2f / 12f;
					((Vector3)(ref val2))..ctor(Mathf.Cos(num) * Mathf.Cos(num2), Mathf.Sin(num) * Mathf.Cos(num2), Mathf.Sin(num2));
					shape.Add(val + val2 * 0.0017f, val2);
				}
			}
			for (int k = 0; k < 40; k++)
			{
				int num3 = (k + 1) % 40;
				for (int l = 0; l < 12; l++)
				{
					int num4 = (l + 1) % 12;
					shape.Quad(k * 12 + l, num3 * 12 + l, num3 * 12 + num4, k * 12 + num4);
				}
			}
			return shape.ToMesh("aura_ring_band");
		}

		private static Mesh WornBand(RingFit fit)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: 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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: 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_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: 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_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: 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_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			int num = fit.Radii.Length;
			Vector2[] array = (Vector2[])(object)new Vector2[6]
			{
				new Vector2(-0.002f, 0f),
				new Vector2(-0.002f, 0.00088f),
				new Vector2(-0.001f, 0.0016f),
				new Vector2(0.001f, 0.0016f),
				new Vector2(0.002f, 0.00088f),
				new Vector2(0.002f, 0f)
			};
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0f, 0.00071999995f);
			Vector3[] array2 = (Vector3[])(object)new Vector3[num];
			Vector3[] array3 = (Vector3[])(object)new Vector3[num];
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i * (float)Math.PI * 2f / (float)num;
				int num3 = i;
				Vector3 val2 = Mathf.Cos(num2) * fit.Top + Mathf.Sin(num2) * fit.Side;
				array2[num3] = ((Vector3)(ref val2)).normalized;
				array3[i] = fit.Centre + array2[i] * fit.Radii[i];
			}
			Shape shape = new Shape();
			for (int j = 0; j < array.Length; j++)
			{
				Vector2 val3 = array[j];
				Vector2 val4 = array[(j + 1) % array.Length];
				Vector2 val5 = new Vector2(val4.y - val3.y, val3.x - val4.x);
				Vector2 val6 = ((Vector2)(ref val5)).normalized;
				if (Vector2.Dot(val6, (val3 + val4) * 0.5f - val) < 0f)
				{
					val6 = -val6;
				}
				int count = shape.Points.Count;
				for (int k = 0; k < num; k++)
				{
					Vector3 normal = fit.Axis * val6.x + array2[k] * val6.y;
					shape.Add(array3[k] + fit.Axis * val3.x + array2[k] * val3.y, normal);
					shape.Add(array3[k] + fit.Axis * val4.x + array2[k] * val4.y, normal);
				}
				for (int l = 0; l < num; l++)
				{
					int num4 = (l + 1) % num;
					shape.Quad(count + l * 2, count + l * 2 + 1, count + num4 * 2 + 1, count + num4 * 2);
				}
			}
			return shape.ToMesh("aura_ring_band_" + fit.Name);
		}

		private static Mesh Collar()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0064: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			Shape shape = new Shape();
			Vector3 val = default(Vector3);
			for (int i = 0; i < 16; i++)
			{
				float num = (float)i * (float)Math.PI * 2f / 16f;
				((Vector3)(ref val))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num));
				shape.Add(val * 0.0041f * 0.8f, val);
				shape.Add(new Vector3(0f, 0.0028f, 0f) + val * 0.0041f, val);
			}
			for (int j = 0; j < 16; j++)
			{
				int num2 = (j + 1) % 16;
				shape.Quad(j * 2, num2 * 2, num2 * 2 + 1, j * 2 + 1);
			}
			return shape.ToMesh("aura_ring_collar");
		}

		private static Mesh Cut()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00a3: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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_00f2: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0120: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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)
			Vector3 zero = Vector3.zero;
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(0f, -0.0026f, 0f);
			Shape shape = new Shape();
			Vector3[] array = (Vector3[])(object)new Vector3[8];
			Vector3[] array2 = (Vector3[])(object)new Vector3[8];
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < 8; i++)
			{
				float num = ((float)i + 0.5f) * (float)Math.PI * 2f / 8f;
				((Vector3)(ref val2))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num));
				array2[i] = zero + val2 * 0.0047f;
				array[i] = zero + new Vector3(0f, 0.0021f, 0f) + val2 * 0.0027f;
			}
			shape.Facet(zero, array);
			for (int j = 0; j < 8; j++)
			{
				int num2 = (j + 1) % 8;
				shape.Facet(zero, array2[j], array2[num2], array[num2], array[j]);
				shape.Facet(zero, array2[j], array2[num2], val);
			}
			return shape.ToMesh("aura_ring_stone");
		}
	}
	internal sealed class RingFit
	{
		public string Name = "";

		public string Body = "";

		public Vector3 Centre;

		public Vector3 Axis;

		public Vector3 Top;

		public Vector3 Side;

		public float[] Radii = new float[0];
	}
	internal static class RingFits
	{
		public static readonly RingFit[] All = new RingFit[3]
		{
			new RingFit
			{
				Name = "model",
				Body = "body",
				Centre = new Vector3(-0.61691f, 0.94004f, -0.07649f),
				Axis = new Vector3(-0.66288f, -0.74842f, 0.02138f),
				Top = new Vector3(-0.74859f, 0.66304f, -0f),
				Side = new Vector3(0.01418f, 0.01601f, 0.99977f),
				Radii = new float[32]
				{
					0.02297f, 0.02432f, 0.02627f, 0.02193f, 0.01838f, 0.01604f, 0.0147f, 0.01405f, 0.01396f, 0.0144f,
					0.01549f, 0.0172f, 0.01924f, 0.01737f, 0.01614f, 0.01563f, 0.0157f, 0.01627f, 0.01746f, 0.01925f,
					0.01943f, 0.01751f, 0.01625f, 0.01572f, 0.0158f, 0.01651f, 0.01801f, 0.02074f, 0.02472f, 0.02336f,
					0.02246f, 0.02233f
				}
			},
			new RingFit
			{
				Name = "model_F",
				Body = "bodyfem",
				Centre = new Vector3(-0.61691f, 0.94004f, -0.07649f),
				Axis = new Vector3(-0.66288f, -0.74842f, 0.02138f),
				Top = new Vector3(-0.74859f, 0.66304f, -0f),
				Side = new Vector3(0.01418f, 0.01601f, 0.99977f),
				Radii = new float[32]
				{
					0.01833f, 0.01939f, 0.02099f, 0.01749f, 0.01475f, 0.01303f, 0.0121f, 0.0117f, 0.01175f, 0.01226f,
					0.01334f, 0.01495f, 0.01382f, 0.01238f, 0.01141f, 0.01097f, 0.011f, 0.01154f, 0.01269f, 0.01439f,
					0.01543f, 0.014f, 0.01308f, 0.01272f, 0.01286f, 0.01355f, 0.01496f, 0.01725f, 0.02018f, 0.01876f,
					0.01794f, 0.01784f
				}
			},
			new RingFit
			{
				Name = "model_FF",
				Body = "bodyfem_slim",
				Centre = new Vector3(-0.59813f, 0.96163f, -0.07279f),
				Axis = new Vector3(-0.66288f, -0.74842f, 0.02138f),
				Top = new Vector3(-0.74859f, 0.66304f, -0f),
				Side = new Vector3(0.01418f, 0.01601f, 0.99977f),
				Radii = new float[32]
				{
					0.01486f, 0.01571f, 0.017f, 0.01429f, 0.01212f, 0.01073f, 0.00997f, 0.00965f, 0.00969f, 0.0101f,
					0.01098f, 0.01228f, 0.0112f, 0.01005f, 0.00928f, 0.00893f, 0.00896f, 0.00939f, 0.01031f, 0.01166f,
					0.01241f, 0.01128f, 0.01055f, 0.01027f, 0.01038f, 0.01092f, 0.01204f, 0.01389f, 0.01634f, 0.0152f,
					0.01454f, 0.01446f
				}
			}
		};
	}
	internal sealed class BodyFit : MonoBehaviour
	{
		public const string First = "model";

		public const string Second = "model_F";

		public const string Slim = "model_FF";

		private const string FeminineFigureGuid = "com.skaket.valheim.femininefigure";

		private const float CheckSeconds = 1f;

		private static bool? _feminineFigure;

		private VisEquipment? _equipment;

		private float _nextCheck;

		public string Shown { get; private set; } = "model";

		internal static bool FeminineFigureInstalled
		{
			get
			{
				if (!_feminineFigure.HasValue)
				{
					_feminineFigure = Chainloader.PluginInfos.ContainsKey("com.skaket.valheim.femininefigure");
				}
				return _feminineFigure.Value;
			}
		}

		public static string Pick(Transform holder, int bodyShape)
		{
			if (bodyShape != 1)
			{
				return "model";
			}
			if (FeminineFigureInstalled && Object.op_Implicit((Object)(object)holder.Find("model_FF")))
			{
				return "model_FF";
			}
			if (!Object.op_Implicit((Object)(object)holder.Find("model_F")))
			{
				return "model";
			}
			return "model_F";
		}

		private void OnEnable()
		{
			Apply();
		}

		private void Update()
		{
			if (Time.unscaledTime >= _nextCheck)
			{
				Apply();
			}
		}

		private void Apply()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			_nextCheck = Time.unscaledTime + 1f;
			if (!Object.op_Implicit((Object)(object)_equipment))
			{
				_equipment = ((Component)this).GetComponentInParent<VisEquipment>();
			}
			Shown = Pick(((Component)this).transform, Object.op_Implicit((Object)(object)_equipment) ? _equipment.GetModelIndex() : 0);
			foreach (Transform item in ((Component)this).transform)
			{
				Transform val = item;
				bool flag = ((Object)val).name == Shown;
				if (((Component)val).gameObject.activeSelf != flag)
				{
					((Component)val).gameObject.SetActive(flag);
				}
			}
		}
	}
	internal static class Skeleton
	{
		private static GameObject? _player;

		public static bool TryGetRestPose(string joint, out Vector3 position, out Quaternion rotation, out string problem)
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			position = Vector3.zero;
			rotation = Quaternion.identity;
			problem = "";
			GameObject val = FindPlayerPrefab();
			if (!Object.op_Implicit((Object)(object)val))
			{
				problem = "the player prefab is not loaded yet";
				return false;
			}
			Transform transform = val.transform;
			Transform val2 = transform.Find("Visual");
			if (!Object.op_Implicit((Object)(object)val2))
			{
				val2 = transform;
			}
			Transform val3 = Utils.FindChild(val2, joint, (IterativeSearchType)0);
			if (!Object.op_Implicit((Object)(object)val3))
			{
				problem = "the player has no bone named '" + joint + "'";
				return false;
			}
			position = transform.InverseTransformPoint(val3.position);
			rotation = Quaternion.Inverse(transform.rotation) * val3.rotation;
			return true;
		}

		private static GameObject? FindPlayerPrefab()
		{
			if (Object.op_Implicit((Object)(object)_player))
			{
				return _player;
			}
			GameObject val = null;
			try
			{
				val = PrefabManager.Instance.GetPrefab("Player");
			}
			catch
			{
			}
			if (!IsPlayer(val) && Object.op_Implicit((Object)(object)ZNetScene.instance))
			{
				val = ZNetScene.instance.GetPrefab("Player");
			}
			if (!IsPlayer(val) && Object.op_Implicit((Object)(object)Game.instance))
			{
				val = Game.instance.m_playerPrefab;
			}
			if (!IsPlayer(val) && Object.op_Implicit((Object)(object)FejdStartup.instance))
			{
				val = FejdStartup.instance.m_playerPrefab;
			}
			if (!IsPlayer(val))
			{
				val = (from player in Resources.FindObjectsOfTypeAll<Player>()
					where ((Object)player).name == "Player"
					select ((Component)player).gameObject).FirstOrDefault();
			}
			if (IsPlayer(val))
			{
				_player = val;
			}
			return _player;
		}

		private static bool IsPlayer(GameObject? candidate)
		{
			if (Object.op_Implicit((Object)(object)candidate))
			{
				return Object.op_Implicit((Object)(object)candidate.GetComponent<VisEquipment>());
			}
			return false;
		}
	}
	internal enum AuraAccent
	{
		None,
		Petals,
		Smoke,
		Radiance,
		Stars
	}
	internal sealed class AuraDef
	{
		public string Key = "";

		public Color[] Palette = (Color[])(object)new Color[2]
		{
			Color.white,
			Color.white
		};

		public Color Spark = Color.white;

		public Color Glow = Color.white;

		public Color Gem = Color.white;

		public AuraAccent Accent;

		public bool Dark;

		public bool SilverBand;

		public List<(string Item, int Amount)> Recipe = new List<(string, int)>();

		public string AuraName => Key + " Aura";

		public string ItemId => "SkaAuraRing" + Key;

		public string ItemName => Key + " Aura Ring";

		public string Description => "A ring that wraps its wearer in " + ((Key == "Emerald" || Key == "Amethyst" || Key == "Orange" || Key == "Indigo") ? "an " : "a ") + Key.ToLowerInvariant() + " aura.";

		public string NameToken => "item_" + ItemId.ToLowerInvariant();

		public string DescriptionToken => NameToken + "_description";
	}
	internal static class AuraDefs
	{
		public static readonly AuraDef[] All = Build();

		private static Color Hex(uint rgb)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			return new Color((float)((rgb >> 16) & 0xFF) / 255f, (float)((rgb >> 8) & 0xFF) / 255f, (float)(rgb & 0xFF) / 255f, 1f);
		}

		private static AuraDef Aura(string key, uint main, uint second, uint spark, params (string Item, int Amount)[] colourIngredients)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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)
			AuraDef auraDef = new AuraDef();
			auraDef.Key = key;
			auraDef.Palette = (Color[])(object)new Color[2]
			{
				Hex(main),
				Hex(second)
			};
			auraDef.Spark = Hex(spark);
			auraDef.Glow = Hex(main);
			auraDef.Gem = Hex(main);
			auraDef.Recipe.Add(("Coins", 200));
			auraDef.Recipe.Add(("SurtlingCore", 1));
			auraDef.Recipe.AddRange(colourIngredients);
			return auraDef;
		}

		private static AuraDef Silvered(AuraDef def)
		{
			def.SilverBand = true;
			return def;
		}

		private static AuraDef With(AuraDef def, AuraAccent accent)
		{
			def.Accent = accent;
			return def;
		}

		private static AuraDef[] Build()
		{
			//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_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_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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: 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)
			AuraDef auraDef = With(Aura("Black", 2363958u, 787986u, 10506495u, ("Obsidian", 10), ("Coal", 10)), AuraAccent.Smoke);
			auraDef.Dark = true;
			auraDef.Glow = Hex(8007896u);
			auraDef.Gem = Hex(3807344u);
			auraDef.SilverBand = true;
			AuraDef auraDef2 = Aura("Rainbow", 16724032u, 16724032u, 16777215u, ("Crystal", 5), ("AmberPearl", 5));
			auraDef2.Palette = (Color[])(object)new Color[8]
			{
				Hex(16724032u),
				Hex(16748576u),
				Hex(16769072u),
				Hex(4253792u),
				Hex(3199231u),
				Hex(4219135u),
				Hex(11555071u),
				Hex(16728256u)
			};
			auraDef2.Glow = Hex(15255807u);
			auraDef2.Gem = Hex(15790335u);
			AuraDef auraDef3 = With(Aura("Celestial", 9218303u, 16767120u, 16777215u, ("DragonTear", 1), ("Crystal", 5)), AuraAccent.Stars);
			auraDef3.Palette = (Color[])(object)new Color[3]
			{
				Hex(9218303u),
				Hex(16777215u),
				Hex(16767120u)
			};
			auraDef3.Glow = Hex(7375103u);
			auraDef3.Gem = Hex(13161727u);
			auraDef3.SilverBand = true;
			return new AuraDef[20]
			{
				Aura("Golden", 16761134u, 16771488u, 16774344u, ("Amber", 5)),
				Silvered(Aura("Silver", 12897514u, 16777215u, 16777215u, ("Silver", 2))),
				Aura("Emerald", 2285670u, 11075524u, 14221284u, ("Guck", 5)),
				Aura("Ruby", 16722498u, 16747672u, 16765140u, ("Ruby", 3)),
				Aura("Amethyst", 11816447u, 14987519u, 16047359u, ("Thistle", 10)),
				Aura("Sapphire", 3107839u, 9484543u, 13952255u, ("Blueberries", 20)),
				Aura("Topaz", 16752676u, 16766088u, 16772296u, ("Cloudberry", 10)),
				Aura("Turquoise", 2677992u, 11073791u, 14482687u, ("FreezeGland", 5)),
				With(Aura("Rose", 16738996u, 16761054u, 16770288u, ("Raspberry", 20)), AuraAccent.Petals),
				Aura("Violet", 8146175u, 12363007u, 14734591u, ("GreydwarfEye", 20)),
				Aura("Cyan", 3196159u, 11069695u, 14481151u, ("Crystal", 5)),
				Aura("Orange", 16741400u, 16758912u, 16769220u, ("Carrot", 10)),
				Aura("Indigo", 4733183u, 9472255u, 13683967u, ("MushroomBlue", 5)),
				Aura("Teal", 1103012u, 8454108u, 13697008u, ("Chitin", 10)),
				Aura("Magenta", 16724184u, 16750828u, 16766200u, ("Bloodbag", 5)),
				Aura("Lime", 10813208u, 14483344u, 15794128u, ("Ooze", 5)),
				Silvered(With(Aura("White", 16777215u, 14214399u, 16777215u, ("AmberPearl", 5)), AuraAccent.Radiance)),
				auraDef,
				auraDef2,
				auraDef3
			};
		}
	}
	internal sealed class AuraLook
	{
		public float Brightness = 1f;

		public float Density = 1f;

		public float Speed = 1f;

		public float Light;

		public int Seed { get; set; }

		public Func<Color, Color>? Convert { get; set; }
	}
	internal static class AuraBuilder
	{
		private enum Blend
		{
			Add,
			Over
		}

		private sealed class Maker
		{
			private readonly AuraDef _def;

			private readonly Shader _shader;

			private readonly AuraLook _look;

			private readonly Transform _root;

			private int _made;

			public Maker(AuraDef def, Shader shader, AuraLook look)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				_def = def;
				_shader = shader;
				_look = look;
				_root = new GameObject("aura").transform;
			}

			public GameObject Run()
			{
				//IL_00e1: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_010d: Unknown result type (might be due to invalid IL or missing references)
				//IL_012a: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Clamp(_look.Density, 0.1f, 4f);
				Halo();
				Mist(7.2f * num);
				Haze(29f * num);
				Wisps(11.5f * num);
				Rise(10.2f * num);
				Motes(25.6f * num);
				Glints(((_def.Accent == AuraAccent.Stars) ? 1.6f : 0.51f) * num);
				switch (_def.Accent)
				{
				case AuraAccent.Petals:
					Petals(1.9f * num);
					break;
				case AuraAccent.Smoke:
					Smoke(4f * num);
					break;
				case AuraAccent.Radiance:
					Radiance();
					break;
				}
				if (_look.Light > 0f)
				{
					GameObject val = new GameObject("light");
					val.transform.SetParent(_root, false);
					val.transform.localPosition = new Vector3(0f, 1f, 0f);
					Light obj = val.AddComponent<Light>();
					obj.type = (LightType)2;
					obj.color = _def.Glow;
					obj.range = 4f;
					obj.intensity = _look.Light;
					obj.shadows = (LightShadows)0;
				}
				return ((Component)_root).gameObject;
			}

			private void Halo()
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0035: 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_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				ParticleSystem val = New("halo", new Vector3(0f, 1.02f, 0f), Quaternion.identity, leftBehind: false);
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(4f);
				((MainModule)(ref main)).startSize3D = true;
				((MainModule)(ref main)).startSizeX = MinMaxCurve.op_Implicit(2f);
				((MainModule)(ref main)).startSizeY = MinMaxCurve.op_Implicit(3f);
				((MainModule)(ref main)).startSizeZ = MinMaxCurve.op_Implicit(1f);
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(C(_def.Glow, _def.Dark ? 0.052f : 0.096f));
				((MainModule)(ref main)).maxParticles = 4;
				Rate(val, 0.5f);
				NoShape(val);
				Fade(val, (0f, 0f), (0.5f, 1f), (1f, 0f));
				Size(val, (0f, 0.92f), (0.5f, 1.06f), (1f, 0.92f));
				ParticleSystemRenderer obj = Renderer(val);
				((Renderer)obj).sharedMaterial = Mat(AuraTextures.Glow, Blend.Add, 1f, fadeNearCamera: true);
				obj.maxParticleSize = 5f;
				obj.sortingFudge = 20f;
			}

			private void Mist(float rate)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_003a: 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_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_010d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_012f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_015b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: Unknown result type (might be due to invalid IL or missing references)
				//IL_0187: Unknown result type (might be due to invalid IL or missing references)
				//IL_019d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
				ParticleSystem val = New("mist", new Vector3(0f, 0.3f, 0f), Quaternion.identity, leftBehind: false);
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(3.2f, 4.8f);
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.6f, 1f);
				((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, (float)Math.PI * 2f);
				((MainModule)(ref main)).startColor = Random((Color[])((!_def.Dark) ? ((Array)_def.Palette) : ((Array)new Color[2] { _def.Glow, _def.Glow })), _def.Dark ? 0.05f : 0.075f);
				((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * 4.8f * 1.3f) + 4;
				Rate(val, rate);
				FlatCircle(val, 0.6f, 1f);
				VelocityOverLifetimeModule velocityOverLifetime = val.velocityOverLifetime;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = Between(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = Between(0.02f, 0.12f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = Between(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalX = Between(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalY = Between(-0.22f, 0.22f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalZ = Between(0f, 0f);
				RotationOverLifetimeModule rotationOverLifetime = val.rotationOverLifetime;
				((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true;
				((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = Between(-0.3f, 0.3f);
				Fade(val, (0f, 0f), (0.3f, 1f), (0.7f, 0.8f), (1f, 0f));
				Size(val, (0f, 0.7f), (1f, 1.25f));
				ParticleSystemRenderer obj = Renderer(val);
				((Renderer)obj).sharedMaterial = Mat(AuraTextures.Smoke, Blend.Add, 1f, fadeNearCamera: true);
				obj.maxParticleSize = 5f;
				obj.sortingFudge = 19f;
			}

			private void Haze(float rate)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_003a: 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_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_013e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0180: Unknown result type (might be due to invalid IL or missing references)
				//IL_0196: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
				ParticleSystem val = New("haze", new Vector3(0f, 0.85f, 0f), Quaternion.identity, leftBehind: false);
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(2.1f, 3.3f);
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.4f, 0.75f);
				((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, (float)Math.PI * 2f);
				((MainModule)(ref main)).startColor = Random((Color[])((!_def.Dark) ? ((Array)_def.Palette) : ((Array)new Color[2] { _def.Glow, _def.Glow })), _def.Dark ? 0.03f : 0.042f);
				((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * 3.3f * 1.3f) + 4;
				Rate(val, rate);
				Shell(val, new Vector3(0.55f, 0.85f, 0.55f), 0.6f);
				VelocityOverLifetimeModule velocityOverLifetime = val.velocityOverLifetime;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = Between(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = Between(0.15f, 0.38f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = Between(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalX = Between(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalY = Between(-0.25f, 0.25f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalZ = Between(0f, 0f);
				Fade(val, (0f, 0f), (0.3f, 1f), (0.65f, 0.7f), (1f, 0f));
				Size(val, (0f, 0.75f), (1f, 1.2f));
				ParticleSystemRenderer obj = Renderer(val);
				((Renderer)obj).sharedMaterial = Mat(AuraTextures.Glow, Blend.Add, 1f, fadeNearCamera: true);
				obj.maxParticleSize = 5f;
				obj.sortingFudge = 18f;
			}

			private void Wisps(float rate)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_003a: 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_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)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: 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_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				ParticleSystem val = New("wisps", new Vector3(0f, 0.05f, 0f), Quaternion.identity, leftBehind: false, points: true);
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.8f, 1.5f);
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.1f);
				((MainModule)(ref main)).startColor = Random((Color[])((!_def.Dark) ? ((Array)_def.Palette) : ((Array)new Color[2] { _def.Glow, _def.Spark })), 0.5f);
				((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * 1.5f * 1.3f) + 4;
				Rate(val, rate);
				FlatCircle(val, 0.5f, 0.6f);
				VelocityOverLifetimeModule velocityOverLifetime = val.velocityOverLifetime;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = Between(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = Between(0.5f, 1.1f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = Between(0f, 0f);
				Fade(val, (0f, 0f), (0.25f, 1f), (1f, 0f));
				Size(val, (0f, 1f), (1f, 0.3f));
				ParticleSystemRenderer obj = Renderer(val);
				obj.renderMode = (ParticleSystemRenderMode)1;
				obj.lengthScale = 3.5f;
				obj.velocityScale = 0.2f;
				((Renderer)obj).sharedMaterial = Mat(AuraTextures.Glow, Blend.Add, 1f, fadeNearCamera: false);
			}

			private void Motes(float rate)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_003a: 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_007b: 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_00c9: 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_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0148: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0174: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				ParticleSystem val = New("motes", new Vector3(0f, 1f, 0f), Quaternion.identity, leftBehind: true, points: true);
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(1.8f, 3f);
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.025f, 0.06f);
				((MainModule)(ref main)).startColor = Random((Color[])((_def.Palette.Length > 2) ? ((Array)_def.Palette) : ((Array)new Color[2]
				{
					_def.Spark,
					_def.Dark ? _def.Glow : _def.Palette[0]
				})), 1f);
				((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.012f);
				((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * 3f * 1.3f) + 4;
				Rate(val, rate);
				Shell(val, new Vector3(0.7f, 1f, 0.7f), 0.8f);
				VelocityOverLifetimeModule velocityOverLifetime = val.velocityOverLifetime;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = Between(-0.06f, 0.06f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = Between(0.06f, 0.28f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = Between(-0.06f, 0.06f);
				Wander(val, 0.14f, 0.7f);
				Fade(val, (0f, 0f), (0.2f, 1f), (0.7f, 0.8f), (1f, 0f));
				Size(val, (0f, 0.6f), (0.3f, 1f), (1f, 0.3f));
				((Renderer)Renderer(val)).sharedMaterial = Mat(AuraTextures.Glow, Blend.Add, 1.5f, fadeNearCamera: false);
			}

			private void Rise(float rate)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_003a: 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_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)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: 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_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				ParticleSystem val = New("rise", new Vector3(0f, 0.15f, 0f), Quaternion.identity, leftBehind: false, points: true);
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(2.2f, 3.6f);
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.03f, 0.065f);
				((MainModule)(ref main)).startColor = Random((Color[])((!_def.Dark) ? ((Array)_def.Palette) : ((Array)new Color[2] { _def.Glow, _def.Spark })), 1f);
				((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * 3.6f * 1.3f) + 4;
				Rate(val, rate);
				FlatCircle(val, 0.6f, 0.8f);
				VelocityOverLifetimeModule velocityOverLifetime = val.velocityOverLifetime;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = Between(-0.03f, 0.03f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = Between(0.3f, 0.6f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = Between(-0.03f, 0.03f);
				Wander(val, 0.1f, 0.7f);
				Fade(val, (0f, 0f), (0.2f, 1f), (0.7f, 0.8f), (1f, 0f));
				Size(val, (0f, 0.5f), (0.3f, 1f), (1f, 0.4f));
				((Renderer)Renderer(val)).sharedMaterial = Mat(AuraTextures.Glow, Blend.Add, 1.5f, fadeNearCamera: false);
			}

			private void Glints(float rate)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_003a: 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_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: 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)
				ParticleSystem val = New("glints", new Vector3(0f, 1f, 0f), Quaternion.identity, leftBehind: true, points: true);
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.45f, 0.9f);
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.07f, 0.15f);
				((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, (float)Math.PI / 2f);
				((MainModule)(ref main)).startColor = Random((Color[])(object)new Color[2]
				{
					_def.Spark,
					Color.Lerp(_def.Spark, _def.Dark ? _def.Glow : _def.Palette[0], 0.5f)
				}, 1f);
				((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * 0.9f * 1.5f) + 4;
				Rate(val, rate);
				Shell(val, new Vector3(0.7f, 1f, 0.7f), 0.5f);
				Fade(val, (0f, 0f), (0.3f, 1f), (1f, 0f));
				Size(val, (0f, 0.1f), (0.3f, 1f), (1f, 0.1f));
				((Renderer)Renderer(val)).sharedMaterial = Mat(AuraTextures.Star, Blend.Add, 1.5f, fadeNearCamera: false);
			}

			private void Petals(float rate)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_003a: 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_0066: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Unknown result type (might be due to invalid IL or missing references)
				//IL_012a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: 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_0173: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: 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_01a8: Unknown result type (might be due to invalid IL or missing references)
				ParticleSystem val = New("petals", new Vector3(0f, 1.45f, 0f), Quaternion.identity, leftBehind: true, points: true);
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(2.8f, 4.2f);
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.085f);
				((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, (float)Math.PI * 2f);
				((MainModule)(ref main)).flipRotation = 0.5f;
				((MainModule)(ref main)).startColor = Random((Color[])(object)new Color[2]
				{
					_def.Palette[0],
					_def.Palette[_def.Palette.Length - 1]
				}, 0.95f);
				((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.03f);
				((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * 4.2f * 1.3f) + 4;
				Rate(val, rate);
				Shell(val, new Vector3(0.75f, 0.5f, 0.75f), 0.6f);
				VelocityOverLifetimeModule velocityOverLifetime = val.velocityOverLifetime;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = Between(-0.12f, 0.12f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = Between(-0.06f, 0.04f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = Between(-0.12f, 0.12f);
				Wander(val, 0.22f, 0.5f);
				RotationOverLifetimeModule rotationOverLifetime = val.rotationOverLifetime;
				((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true;
				((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = Between(-2.5f, 2.5f);
				Fade(val, (0f, 0f), (0.12f, 1f), (0.8f, 1f), (1f, 0f));
				((Renderer)Renderer(val)).sharedMaterial = Mat(AuraTextures.Petal, Blend.Over, 1f, fadeNearCamera: false);
			}

			private void Smoke(float rate)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_003a: 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_0066: 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_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_00e2: 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_010e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: 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_015b: 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_0175: Unknown result type (might be due to invalid IL or missing references)
				ParticleSystem val = New("smoke", new Vector3(0f, 0.25f, 0f), Quaternion.identity, leftBehind: false);
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(2.4f, 3.8f);
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.5f, 0.9f);
				((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, (float)Math.PI * 2f);
				((MainModule)(ref main)).startColor = Random(_def.Palette, 0.5f);
				((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * 3.8f * 1.3f) + 4;
				Rate(val, rate);
				FlatCircle(val, 0.5f, 0.6f);
				VelocityOverLifetimeModule velocityOverLifetime = val.velocityOverLifetime;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = Between(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = Between(0.3f, 0.55f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = Between(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalX = Between(0f, 0f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalY = Between(-0.3f, 0.3f);
				((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalZ = Between(0f, 0f);
				RotationOverLifetimeModule rotationOverLifetime = val.rotationOverLifetime;
				((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true;
				((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = Between(-0.4f, 0.4f);
				Fade(val, (0f, 0f), (0.25f, 1f), (0.6f, 0.8f), (1f, 0f));
				Size(val, (0f, 0.6f), (1f, 1.3f));
				ParticleSystemRenderer obj = Renderer(val);
				((Renderer)obj).sharedMaterial = Mat(AuraTextures.Smoke, Blend.Over, 1f, fadeNearCamera: true);
				obj.sortingFudge = 10f;
			}

			private void Radiance()
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: 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)
				ParticleSystem val = New("radiance", new Vector3(0f, 1.2f, 0f), Quaternion.identity, leftBehind: false);
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(3.6f);
				((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(1f);
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(C(_def.Palette[_def.Palette.Length - 1], 0.32f));
				((MainModule)(ref main)).maxParticles = 8;
				Rate(val, 0.68f);
				NoShape(val);
				Fade(val, (0f, 0f), (0.2f, 1f), (0.6f, 0.6f), (1f, 0f));
				Size(val, (0f, 0.5f), (1f, 2.7f));
				ParticleSystemRenderer obj = Renderer(val);
				((Renderer)obj).sharedMaterial = Mat(AuraTextures.Circle, Blend.Add, 1f, fadeNearCamera: true);
				obj.maxParticleSize = 5f;
				obj.sortingFudge = 15f;
			}

			private ParticleSystem New(string name, Vector3 position, Quaternion rotation, bool leftBehind, bool points = false)
			{
				//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_0018: 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_0030: 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_00a9: 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)
				GameObject val = new GameObject(name);
				val.transform.SetParent(_root, false);
				val.transform.localPosition = position;
				val.transform.localRotation = rotation;
				ParticleSystem val2 = val.AddComponent<ParticleSystem>();
				val2.Stop(true, (ParticleSystemStopBehavior)0);
				if (_look.Seed != 0)
				{
					val2.useAutoRandomSeed = false;
					val2.randomSeed = (uint)(_look.Seed + _made * 7919);
				}
				_made++;
				MainModule main = val2.main;
				((MainModule)(ref main)).duration = 5f;
				((MainModule)(ref main)).loop = true;
				((MainModule)(ref main)).playOnAwake = true;
				((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f);
				((MainModule)(ref main)).startDelay = MinMaxCurve.op_Implicit(0f);
				((MainModule)(ref main)).simulationSpeed = 0.75f * (points ? 0.8f : 1f) * Mathf.Clamp(_look.Speed, 0.1f, 3f);
				((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)(leftBehind ? 1 : 0);
				((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)1;
				ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
				((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
				((Renderer)component).receiveShadows = false;
				((Renderer)component).lightProbeUsage = (LightProbeUsage)0;
				((Renderer)component).reflectionProbeUsage = (ReflectionProbeUsage)0;
				component.alignment = (ParticleSystemRenderSpace)0;
				return val2;
			}

			private static ParticleSystemRenderer Renderer(ParticleSystem ps)
			{
				return ((Component)ps).GetComponent<ParticleSystemRenderer>();
			}

			private static void Rate(ParticleSystem ps, float perSecond)
			{
				//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_0012: Unknown result type (might be due to invalid IL or missing references)
				EmissionModule emission = ps.emission;
				((EmissionModule)(ref emission)).enabled = true;
				((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(perSecond);
			}

			private static void NoShape(ParticleSystem ps)
			{
				//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)
				ShapeModule shape = ps.shape;
				((ShapeModule)(ref shape)).enabled = false;
			}

			private static void FlatCircle(ParticleSystem ps, float radius, float thickness)
			{
				//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_0045: Unknown result type (might be due to invalid IL or missing references)
				ShapeModule shape = ps.shape;
				((ShapeModule)(ref shape)).enabled = true;
				((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10;
				((ShapeModule)(ref shape)).radius = radius;
				((ShapeModule)(ref shape)).radiusThickness = thickness;
				((ShapeModule)(ref shape)).arc = 360f;
				((ShapeModule)(ref shape)).rotation = new Vector3(90f, 0f, 0f);
			}

			private static void Shell(ParticleSystem ps, Vector3 size, float thickness)
			{
				//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_002d: Unknown result type (might be due to invalid IL or missing references)
				ShapeModule shape = ps.shape;
				((ShapeModule)(ref shape)).enabled = true;
				((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
				((ShapeModule)(ref shape)).radius = 1f;
				((ShapeModule)(ref shape)).radiusThickness = thickness;
				((ShapeModule)(ref shape)).scale = size;
			}

			private static void Wander(ParticleSystem ps, float strength, float frequency)
			{
				//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_0012: 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)
				NoiseModule noise = ps.noise;
				((NoiseModule)(ref noise)).enabled = true;
				((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(strength);
				((NoiseModule)(ref noise)).frequency = frequency;
				((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(0.25f);
				((NoiseModule)(ref noise)).damping = true;
				((NoiseModule)(ref noise)).octaveCount = 1;
				((NoiseModule)(ref noise)).quality = (ParticleSystemNoiseQuality)1;
			}

			private static void Fade(ParticleSystem ps, params (float Time, float Alpha)[] keys)
			{
				//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_0017: Unknown result type (might be due to invalid IL or missing references)
				ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime;
				((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
				((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(Alpha(keys));
			}

			private static void Size(ParticleSystem ps, params (float Time, float Size)[] keys)
			{
				//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_001c: Unknown result type (might be due to invalid IL or missing references)
				SizeOverLifetimeModule sizeOverLifetime = ps.sizeOverLifetime;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, Curve(keys));
			}

			private static MinMaxCurve Between(float min, float max)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				return new MinMaxCurve(min, max);
			}

			private static Gradient Alpha(params (float Time, float Alpha)[] keys)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Expected O, but got Unknown
				//IL_004a: 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_0060: 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_006f: Unknown result type (might be due to invalid IL or missing references)
				GradientAlphaKey[] array = (GradientAlphaKey[])(object)new GradientAlphaKey[keys.Length];
				for (int i = 0; i < keys.Length; i++)
				{
					array[i] = new GradientAlphaKey(keys[i].Alpha, keys[i].Time);
				}
				Gradient val = new Gradient();
				val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
				{
					new GradientColorKey(Color.white, 0f),
					new GradientColorKey(Color.white, 1f)
				}, array);
				return val;
			}

			private static AnimationCurve Curve(params (float Time, float Value)[] keys)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Expected O, but got Unknown
				AnimationCurve val = new AnimationCurve();
				for (int i = 0; i < keys.Length; i++)
				{
					var (num, num2) = keys[i];
					val.AddKey(num, num2);
				}
				for (int j = 0; j < val.length; j++)
				{
					val.SmoothTangents(j, 0f);
				}
				return val;
			}

			private Color C(Color colour, float alpha)
			{
				//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_000d: 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_002a: Unknown result type (might be due to invalid IL or missing references)
				Color result = ((_look.Convert != null) ? _look.Convert(colour) : colour);
				result.a = alpha;
				return result;
			}

			private MinMaxGradient Random(Color[] colours, float alpha)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: 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_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Expected O, but got Unknown
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_00ad: 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)
				int num = Mathf.Clamp(colours.Length, 1, 8);
				GradientColorKey[] array = (GradientColorKey[])(object)new GradientColorKey[Mathf.Max(num, 2)];
				for (int i = 0; i < array.Length; i++)
				{
					Color val = C(colours[Mathf.Min(i, num - 1)], 1f);
					array[i] = new GradientColorKey(val, (array.Length == 1) ? 0f : ((float)i / (float)(array.Length - 1)));
				}
				Gradient val2 = new Gradient();
				val2.SetKeys(array, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
				{
					new GradientAlphaKey(alpha, 0f),
					new GradientAlphaKey(alpha, 1f)
				});
				MinMaxGradient result = default(MinMaxGradient);
				((MinMaxGradient)(ref result))..ctor(val2);
				((MinMaxGradient)(ref result)).mode = (ParticleSystemGradientMode)4;
				return result;
			}

			private Material Mat(Texture2D texture, Blend blend, float strength, bool fadeNearCamera)
			{
				//IL_00e0: 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_010e: Expected O, but got Unknown
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_014d: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: 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_032c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0360: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
				float num = ((blend == Blend.Add) ? (strength * Mathf.Clamp(_look.Brightness, 0.05f, 4f)) : 1f);
				string key = ((Object)_shader).GetInstanceID() + "|" + ((Object)texture).name + "|" + blend.ToString() + "|" + num.ToString("0.###") + "|" + fadeNearCamera + "|" + (_look.Convert != null);
				if (Materials.TryGetValue(key, out Material value) && Object.op_Implicit((Object)(object)value))
				{
					return value;
				}
				Material val = new Material(_shader)
				{
					name = "aura_" + ((Object)texture).name + "_" + blend
				};
				val.SetTexture("_MainTex", (Texture)(object)texture);
				Color val2 = default(Color);
				((Color)(ref val2))..ctor(num, num, num, 1f);
				val.SetColor("_Color", (_look.Convert != null) ? _look.Convert(val2) : val2);
				val.SetFloat("_Mode", (blend == Blend.Add) ? 4f : 2f);
				val.SetFloat("_ColorMode", 0f);
				val.SetFloat("_BlendOp", 0f);
				val.SetFloat("_SrcBlend", 5f);
				val.SetFloat("_DstBlend", (float)((blend == Blend.Add) ? 1 : 10));
				val.SetFloat("_ZWrite", 0f);
				val.SetFloat("_Cull", 0f);
				val.SetFloat("_LightingEnabled", 0f);
				val.SetFloat("_EmissionEnabled", 0f);
				val.SetFloat("_DistortionEnabled", 0f);
				val.SetFloat("_FlipbookMode", 0f);
				val.SetVector("_ColorAddSubDiff", Vector4.zero);
				string[] shaderKeywords = val.shaderKeywords;
				foreach (string text in shaderKeywords)
				{
					val.DisableKeyword(text);
				}
				val.EnableKeyword("_ALPHABLEND_ON");
				if (fadeNearCamera)
				{
					val.SetFloat("_SoftParticlesEnabled", 1f);
					val.SetFloat("_SoftParticlesNearFadeDistance", 0f);
					val.SetFloat("_SoftParticlesFarFadeDistance", 0.2f);
					val.SetVector("_SoftParticleFadeParams", new Vector4(0f, 5f, 0f, 0f));
					val.SetFloat("_CameraFadingEnabled", 1f);
					val.SetFloat("_CameraNearFadeDistance", 0.5f);
					val.SetFloat("_CameraFarFadeDistance", 1.8f);
					val.SetVector("_CameraFadeParams", new Vector4(0.5f, 0.7692308f, 0f, 0f));
					val.EnableKeyword("_FADING_ON");
				}
				else
				{
					val.SetFloat("_SoftParticlesEnabled", 0f);
					val.SetVector("_SoftParticleFadeParams", Vector4.zero);
					val.SetFloat("_CameraFadingEnabled", 0f);
					val.SetVector("_CameraFadeParams", new Vector4(0f, float.PositiveInfinity, 0f, 0f));
				}
				val.renderQueue = 3000;
				Materials[key] = val;
				return val;
			}
		}

		public const string ShaderName = "Particles/Standard Unlit2";

		private const float Middle = 1f;

		private const float DesignSpeed = 0.75f;

		private const float PointSpeed = 0.8f;

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

		public static GameObject Build(AuraDef def, Shader shader, AuraLook look)
		{
			return new Maker(def, shader, look).Run();
		}
	}
	internal static class AuraTextures
	{
		private static Texture2D? _glow;

		private static Texture2D? _star;

		private static Texture2D? _petal;

		private static Texture2D? _smoke;

		private static Texture2D? _circle;

		public static Texture2D Glow
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_glow))
				{
					return _glow = Make("aura_glow", 128, 128, delegate(float x, float y)
					{
						float num = Mathf.Sqrt(x * x + y * y);
						return Mathf.Exp((0f - num) * num * 4.5f) * Edge(num);
					});
				}
				return _glow;
			}
		}

		public static Texture2D Star
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_star))
				{
					return _star = Make("aura_star", 64, 64, delegate(float x, float y)
					{
						float num = Mathf.Sqrt(x * x + y * y);
						float num2 = Mathf.Exp((0f - num) * num * 60f);
						float num3 = Mathf.Max(Ray(x, y, 34f, 2.2f), Ray(y, x, 34f, 2.2f));
						float num4 = 0.18f * Mathf.Exp((0f - num) * num * 8f);
						return Mathf.Clamp01(num2 + num3 + num4) * Edge(num);
					});
				}
				return _star;
			}
		}

		public static Texture2D Petal
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_petal))
				{
					return _petal = Make("aura_petal", 32, 32, delegate(float x, float y)
					{
						float num = (y + 0.9f) / 1.8f;
						if (num <= 0f || num >= 1f)
						{
							return 0f;
						}
						float num2 = 0.62f * Mathf.Pow(Mathf.Sin((float)Math.PI * Mathf.Pow(num, 0.75f)), 0.8f);
						return Mathf.Clamp01((num2 - Mathf.Abs(x)) / 0.12f) * (0.75f + 0.25f * Mathf.Clamp01(Mathf.Abs(x) / Mathf.Max(num2, 0.01f)));
					});
				}
				return _petal;
			}
		}

		public static Texture2D Smoke
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_smoke))
				{
					return _smoke = Make("aura_smoke", 128, 128, delegate(float x, float y)
					{
						float num = Mathf.Sqrt(x * x + y * y);
						float num2 = 0.5f * Noise(x * 2.2f + 7.3f, y * 2.2f + 1.9f) + 0.3f * Noise(x * 4.6f + 3.1f, y * 4.6f + 8.4f) + 0.2f * Noise(x * 9.4f, y * 9.4f + 5.5f);
						float num3 = Mathf.Clamp01(1.25f - num * 1.35f - 0.55f * (1f - num2));
						return num3 * num3 * Edge(num);
					});
				}
				return _smoke;
			}
		}

		public static Texture2D Circle
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_circle))
				{
					return _circle = Make("aura_circle", 128, 128, delegate(float x, float y)
					{
						float r = Mathf.Sqrt(x * x + y * y);
						return Mathf.Clamp01(Band(r, 0.88f, 0.016f) + 0.22f * Band(r, 0.88f, 0.07f)) * Edge(r);
					});
				}
				return _circle;
			}
		}

		private static float Edge(float r)
		{
			float num = Mathf.C