Decompiled source of Warlock v1.0.0

plugins/Warlock/Warlock.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Mage;
using EntityStates.SurvivorPod;
using HarmonyLib;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using RoR2.Achievements;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Warlock")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5cab7a4d44f0921fe85664ed55d61e88d3f19809")]
[assembly: AssemblyProduct("Warlock")]
[assembly: AssemblyTitle("Warlock")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WarlockMod
{
	internal sealed class ArrivalSequence
	{
		internal const float Descent = 1.5f;

		private float elapsed;

		private bool released;

		internal bool Landed { get; private set; }

		internal bool JustLanded { get; private set; }

		internal bool Advance(float delta, bool interactPressed)
		{
			elapsed += Math.Max(0f, delta);
			JustLanded = false;
			if (!Landed && elapsed >= 1.5f)
			{
				Landed = true;
				JustLanded = true;
			}
			if (!Landed || released || !interactPressed)
			{
				return false;
			}
			released = true;
			return true;
		}
	}
	internal sealed class BackpackMeshCutout : IDisposable
	{
		private sealed class Island
		{
			internal int count;

			internal Vector3 min = Vector3.one * float.PositiveInfinity;

			internal Vector3 max = Vector3.one * float.NegativeInfinity;

			internal void Add(Vector3 p)
			{
				//IL_0010: 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_0016: 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_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				count++;
				min = Vector3.Min(min, p);
				max = Vector3.Max(max, p);
			}
		}

		internal readonly Mesh Source;

		private readonly SkinnedMeshRenderer skin;

		private Mesh filtered;

		internal BackpackMeshCutout(SkinnedMeshRenderer skin, Transform model, Transform chest)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_00a4: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_020b: Unknown result type (might be due to invalid IL or missing references)
			this.skin = skin;
			Source = skin.sharedMesh;
			Mesh val = null;
			int[] parent;
			try
			{
				if (!Object.op_Implicit((Object)(object)Source) || !Source.isReadable || !Object.op_Implicit((Object)(object)chest))
				{
					return;
				}
				val = new Mesh();
				skin.BakeMesh(val);
				Vector3[] vertices = val.vertices;
				int vertexCount = Source.vertexCount;
				if (vertices.Length != vertexCount)
				{
					return;
				}
				parent = new int[vertexCount];
				for (int i = 0; i < vertexCount; i++)
				{
					parent[i] = i;
				}
				Dictionary<(int, int, int), int> dictionary = new Dictionary<(int, int, int), int>();
				for (int j = 0; j < vertexCount; j++)
				{
					Vector3 val2 = vertices[j];
					(int, int, int) key = (Mathf.RoundToInt(val2.x * 1000f), Mathf.RoundToInt(val2.y * 1000f), Mathf.RoundToInt(val2.z * 1000f));
					if (dictionary.TryGetValue(key, out var value))
					{
						Union(j, value);
					}
					else
					{
						dictionary.Add(key, j);
					}
				}
				List<int[]> list = new List<int[]>();
				int num = 0;
				for (int k = 0; k < Source.subMeshCount; k++)
				{
					if ((int)Source.GetTopology(k) != 0)
					{
						return;
					}
					int[] triangles = Source.GetTriangles(k);
					list.Add(triangles);
					num += triangles.Length;
					for (int l = 0; l < triangles.Length; l += 3)
					{
						Union(triangles[l], triangles[l + 1]);
						Union(triangles[l], triangles[l + 2]);
					}
				}
				Dictionary<int, Island> dictionary2 = new Dictionary<int, Island>();
				for (int m = 0; m < vertexCount; m++)
				{
					int key2 = Find(m);
					if (!dictionary2.TryGetValue(key2, out var value2))
					{
						value2 = new Island();
						dictionary2.Add(key2, value2);
					}
					Vector3 p = model.InverseTransformDirection(((Component)skin).transform.TransformPoint(vertices[m]) - chest.position);
					value2.Add(p);
				}
				HashSet<int> hashSet = new HashSet<int>();
				foreach (KeyValuePair<int, Island> item in dictionary2)
				{
					Island value3 = item.Value;
					if (BackpackRegion.IsPack(value3.count, value3.min.x, value3.max.x, value3.min.y, value3.max.y, value3.min.z, value3.max.z))
					{
						hashSet.Add(item.Key);
					}
				}
				List<int[]> list2 = new List<int[]>();
				int num2 = 0;
				foreach (int[] item2 in list)
				{
					List<int> list3 = new List<int>(item2.Length);
					for (int n = 0; n < item2.Length; n += 3)
					{
						if (hashSet.Contains(Find(item2[n])))
						{
							num2 += 3;
							continue;
						}
						list3.Add(item2[n]);
						list3.Add(item2[n + 1]);
						list3.Add(item2[n + 2]);
					}
					list2.Add(list3.ToArray());
				}
				if (num2 == 0 || (float)num2 > (float)num * 0.35f)
				{
					foreach (KeyValuePair<int, Island> item3 in dictionary2)
					{
						Island value4 = item3.Value;
						Debug.Log((object)("WARLOCK PACK ISLAND: id=" + item3.Key + ", vertices=" + value4.count + ", min=" + ((Vector3)(ref value4.min)).ToString("F3") + ", max=" + ((Vector3)(ref value4.max)).ToString("F3")));
					}
					Debug.LogWarning((object)("WARLOCK PACK MESH: no conservative cut accepted; mesh=" + ((Object)Source).name + ", islands=" + dictionary2.Count + ", candidate triangles=" + num2 / 3 + "/" + num / 3));
				}
				else
				{
					filtered = Object.Instantiate<Mesh>(Source);
					((Object)filtered).name = "Warlock_Trimmed_" + ((Object)Source).name;
					for (int num3 = 0; num3 < list2.Count; num3++)
					{
						filtered.SetTriangles(list2[num3], num3, false);
					}
					skin.sharedMesh = filtered;
					Debug.Log((object)("WARLOCK PACK MESH: private mesh clone removed " + num2 / 3 + " triangles in " + hashSet.Count + " rear islands; source=" + ((Object)Source).name + ", weights/submeshes retained."));
				}
				void Union(int a, int b)
				{
					a = Find(a);
					b = Find(b);
					if (a != b)
					{
						parent[b] = a;
					}
				}
			}
			catch (Exception ex)
			{
				if (Object.op_Implicit((Object)(object)filtered))
				{
					if (Object.op_Implicit((Object)(object)skin) && (Object)(object)skin.sharedMesh == (Object)(object)filtered)
					{
						skin.sharedMesh = Source;
					}
					Object.Destroy((Object)(object)filtered);
					filtered = null;
				}
				Debug.LogWarning((object)("WARLOCK PACK MESH: source retained after cutout failure: " + ex.Message));
			}
			finally
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					Object.Destroy((Object)(object)val);
				}
			}
			int Find(int num4)
			{
				while (parent[num4] != num4)
				{
					parent[num4] = parent[parent[num4]];
					num4 = parent[num4];
				}
				return num4;
			}
		}

		internal bool Matches(Mesh mesh)
		{
			if (!((Object)(object)mesh == (Object)(object)Source))
			{
				return (Object)(object)mesh == (Object)(object)filtered;
			}
			return true;
		}

		internal void Refresh()
		{
			if (Object.op_Implicit((Object)(object)skin) && Object.op_Implicit((Object)(object)filtered) && (Object)(object)skin.sharedMesh == (Object)(object)Source)
			{
				skin.sharedMesh = filtered;
			}
		}

		public void Dispose()
		{
			if (Object.op_Implicit((Object)(object)skin) && Object.op_Implicit((Object)(object)filtered) && (Object)(object)skin.sharedMesh == (Object)(object)filtered)
			{
				skin.sharedMesh = Source;
			}
			if (Object.op_Implicit((Object)(object)filtered))
			{
				Object.Destroy((Object)(object)filtered);
			}
			filtered = null;
		}
	}
	internal static class BackpackRegion
	{
		internal static bool IsPack(int vertices, float minX, float maxX, float minY, float maxY, float minZ, float maxZ)
		{
			float num = (minY + maxY) * 0.5f;
			if (vertices < 1350 || vertices > 1450 || !(minX >= -0.19f) || !(maxX <= 0.3f) || !(minY >= -0.22f) || !(maxY <= 0.42f) || !(maxY - minY >= 0.5f) || !(minZ >= -0.41f) || !(minZ <= -0.3f) || !(maxZ <= 0.02f) || !(maxZ >= -0.08f))
			{
				if (vertices >= 6 && minX >= -0.36f && maxX <= 0.36f && minY >= -0.62f && maxY <= 0.42f && num >= -0.43f && num <= 0.28f && minZ < -0.22f)
				{
					return maxZ <= -0.08f;
				}
				return false;
			}
			return true;
		}
	}
	internal static class BeamTopology
	{
		internal static int[] ClosedTube(int rings, int sides)
		{
			if (rings < 2 || sides < 3)
			{
				throw new ArgumentOutOfRangeException();
			}
			int[] array = new int[(rings - 1) * sides * 6 + sides * 6];
			int num = 0;
			for (int i = 0; i < rings - 1; i++)
			{
				for (int j = 0; j < sides; j++)
				{
					int num2 = i * sides + j;
					int num3 = i * sides + (j + 1) % sides;
					int num4 = num2 + sides;
					int num5 = num3 + sides;
					array[num++] = num2;
					array[num++] = num4;
					array[num++] = num3;
					array[num++] = num3;
					array[num++] = num4;
					array[num++] = num5;
				}
			}
			for (int k = 0; k < sides; k++)
			{
				array[num++] = rings * sides;
				array[num++] = k;
				array[num++] = (k + 1) % sides;
				array[num++] = rings * sides + 1;
				array[num++] = (rings - 1) * sides + (k + 1) % sides;
				array[num++] = (rings - 1) * sides + k;
			}
			return array;
		}
	}
	public sealed class CometTrail : MonoBehaviour
	{
		private GameObject trailRoot;

		private ParticleSystem green;

		private ParticleSystem smoke;

		private TrailRenderer ribbon;

		private Vector3 previous;

		private float diameter;

		private void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//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_007f: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_014b: 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)
			Vector3 lossyScale = ((Component)this).transform.lossyScale;
			diameter = Mathf.Max(0.1f, 1.8f * Mathf.Max(new float[3]
			{
				Mathf.Abs(lossyScale.x),
				Mathf.Abs(lossyScale.y),
				Mathf.Abs(lossyScale.z)
			}));
			trailRoot = new GameObject("WorldSpaceCometWake");
			trailRoot.transform.position = (previous = ((Component)this).transform.position);
			green = Layer(dark: false);
			smoke = Layer(dark: true);
			GameObject val = new GameObject("BrightGreenCometStreak");
			val.transform.SetParent(trailRoot.transform, false);
			ribbon = val.AddComponent<TrailRenderer>();
			((Renderer)ribbon).sharedMaterial = SpellAssets.HexMistMaterial;
			ribbon.startWidth = diameter * 0.4f;
			ribbon.endWidth = 0f;
			ribbon.time = 0.2f;
			ribbon.minVertexDistance = diameter * 0.08f;
			ribbon.startColor = new Color(0.12f, 3f, 0.4f, 0.9f);
			ribbon.endColor = new Color(0.02f, 0.6f, 0.1f, 0f);
			((Renderer)ribbon).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)ribbon).receiveShadows = false;
		}

		private ParticleSystem Layer(bool dark)
		{
			//IL_000f: 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_002b: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: 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_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_01af: Expected O, but got Unknown
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: 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_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: 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_0220: 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)
			GameObject val = new GameObject(dark ? "CometBlackSmokeWake" : "CometGreenFlameWake");
			val.transform.SetParent(trailRoot.transform, false);
			val.transform.rotation = Quaternion.LookRotation(Vector3.up);
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			val2.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val2.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)2;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.2f);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(diameter * 2f, diameter * 5f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(diameter * (dark ? 0.3f : 0.15f), diameter * (dark ? 0.6f : 0.4f));
			((MainModule)(ref main)).maxParticles = (dark ? 80 : 160);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(dark ? new Color(0.002f, 0.004f, 0.002f, 0.8f) : new Color(0.08f, 3f, 0.25f, 0.95f));
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4;
			((ShapeModule)(ref shape)).angle = 8f;
			((ShapeModule)(ref shape)).radius = diameter * 0.12f;
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit((float)(dark ? 100 : 200));
			((EmissionModule)(ref emission)).rateOverDistance = MinMaxCurve.op_Implicit((dark ? 4f : 8f) / diameter);
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
			{
				new GradientAlphaKey(0.9f, 0f),
				new GradientAlphaKey(0f, 1f)
			});
			ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = (dark ? SpellAssets.SmokeMaterial : SpellAssets.HexMistMaterial);
			component.renderMode = (ParticleSystemRenderMode)1;
			component.lengthScale = (dark ? 1.5f : 3f);
			component.velocityScale = 0.08f;
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component).receiveShadows = false;
			val2.Play();
			return val2;
		}

		private void LateUpdate()
		{
			//IL_000f: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_008c: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)trailRoot))
			{
				float num = Vector3.Distance(previous, ((Component)this).transform.position) / Mathf.Max(0.001f, Time.deltaTime);
				float num2 = Mathf.Clamp(diameter * 7f / Mathf.Max(1f, num), 0.06f, 0.35f);
				MainModule main = green.main;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(num2 * 0.6f, num2);
				MainModule main2 = smoke.main;
				((MainModule)(ref main2)).startLifetime = MinMaxCurve.op_Implicit(num2);
				ribbon.time = num2;
				trailRoot.transform.position = (previous = ((Component)this).transform.position);
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)trailRoot))
			{
				trailRoot.SetActive(false);
				Object.Destroy((Object)(object)trailRoot);
			}
		}
	}
	internal sealed class CurseDetonations<T>
	{
		private readonly Queue<T> pending = new Queue<T>();

		private bool processing;

		internal void TryQueue(T victim, ISet<T> cursed, bool eligible, Action<T> detonate)
		{
			if (!eligible || !cursed.Remove(victim))
			{
				return;
			}
			pending.Enqueue(victim);
			if (processing)
			{
				return;
			}
			processing = true;
			try
			{
				while (pending.Count > 0)
				{
					detonate(pending.Dequeue());
				}
			}
			finally
			{
				pending.Clear();
				processing = false;
			}
		}
	}
	public sealed class EldritchBeamVisual : MonoBehaviour
	{
		internal static GameObject Prefab;

		public LineRenderer glow;

		public LineRenderer strand;

		public Material blackMaterial;

		private EffectComponent effect;

		private Mesh tube;

		private MeshRenderer tubeRenderer;

		private Vector3[] vertices;

		private Vector3[] normals;

		private float age;

		private const int Rings = 40;

		private const int Sides = 12;

		private const float Lifetime = 0.45f;

		internal static void Register()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			Texture2D val = new Texture2D(1, 64, (TextureFormat)4, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			for (int i = 0; i < 64; i++)
			{
				float num = Mathf.Abs(((float)i + 0.5f) / 32f - 1f);
				float num2 = Mathf.Exp(0f - Mathf.Pow((num - 0.55f) * 4f, 2f)) * Mathf.Clamp01((1f - num) * 8f);
				val.SetPixel(0, i, new Color(1f, 1f, 1f, num2));
			}
			val.Apply(false, true);
			Material val2 = NativeVfxMaterials.Create("WarlockHollowGreenHalo", additive: true);
			val2.mainTexture = (Texture)(object)val;
			NativeVfxMaterials.Tint(val2, new Color(0.08f, 1.7f, 0.25f, 0.85f));
			GameObject val3 = new GameObject("WarlockBeamTemplate");
			try
			{
				val3.AddComponent<EffectComponent>();
				val3.AddComponent<VFXAttributes>();
				val3.AddComponent<DestroyOnTimer>().duration = 0.45f;
				EldritchBeamVisual eldritchBeamVisual = val3.AddComponent<EldritchBeamVisual>();
				eldritchBeamVisual.blackMaterial = NativeVfxMaterials.OpaqueBlack("WarlockOpaqueTwistingCore");
				eldritchBeamVisual.glow = MakeLine(val3.transform, "GreenHalo", val2, 0.9f);
				eldritchBeamVisual.strand = MakeLine(val3.transform, "GreenOrbit", val2, 0.07f);
				Prefab = PrefabAPI.InstantiateClone(val3, "WarlockEldritchBeam", false);
				if (!ContentAddition.AddEffect(Prefab))
				{
					throw new InvalidOperationException("Could not register black-core beam.");
				}
			}
			finally
			{
				Object.DestroyImmediate((Object)(object)val3);
			}
		}

		private static LineRenderer MakeLine(Transform root, string name, Material material, float width)
		{
			//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)
			GameObject val = new GameObject(name);
			val.transform.SetParent(root, false);
			LineRenderer obj = val.AddComponent<LineRenderer>();
			((Renderer)obj).sharedMaterial = material;
			obj.useWorldSpace = true;
			obj.positionCount = 40;
			obj.widthCurve = AnimationCurve.Linear(0f, 1f, 1f, 0.6f);
			obj.widthMultiplier = width;
			obj.alignment = (LineAlignment)0;
			obj.numCapVertices = 4;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)obj).receiveShadows = false;
			((Renderer)obj).enabled = false;
			return obj;
		}

		private void BuildTube()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			GameObject val = new GameObject("OpaqueBlackHelix");
			val.transform.SetParent(((Component)this).transform, false);
			tube = new Mesh
			{
				name = "WarlockTwistingCoreMesh"
			};
			tube.MarkDynamic();
			vertices = (Vector3[])(object)new Vector3[482];
			normals = (Vector3[])(object)new Vector3[vertices.Length];
			int[] triangles = BeamTopology.ClosedTube(40, 12);
			tube.vertices = vertices;
			tube.triangles = triangles;
			val.AddComponent<MeshFilter>().sharedMesh = tube;
			tubeRenderer = val.AddComponent<MeshRenderer>();
			((Renderer)tubeRenderer).sharedMaterial = blackMaterial;
			((Renderer)tubeRenderer).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)tubeRenderer).receiveShadows = false;
			Debug.Log((object)"WARLOCK BEAM CORE ACTIVE: opaque twisting mesh; hollow green halo.");
		}

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

		private void Update()
		{
			//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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)effect))
			{
				effect = ((Component)this).GetComponent<EffectComponent>();
			}
			if (!Object.op_Implicit((Object)(object)effect) || effect.effectData == null)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)tube))
			{
				BuildTube();
			}
			age += Time.deltaTime;
			float num = Mathf.Clamp01(1f - age / 0.45f);
			Vector3 start = effect.effectData.start;
			Vector3 origin = effect.effectData.origin;
			Vector3 val = origin - start;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			val = Vector3.Cross(normalized, (Mathf.Abs(normalized.y) > 0.95f) ? Vector3.right : Vector3.up);
			Vector3 normalized2 = ((Vector3)(ref val)).normalized;
			Vector3 val2 = Vector3.Cross(normalized2, normalized);
			float num2 = Mathf.Min(1f, num * 5f);
			for (int i = 0; i < 40; i++)
			{
				float num3 = (float)i / 39f;
				float num4 = num3 * 35f - age * 30f;
				Vector3 val3 = Vector3.Lerp(start, origin, num3) + (normalized2 * Mathf.Sin(num4) + val2 * Mathf.Cos(num4)) * (0.1f * Mathf.Sin(num3 * MathF.PI));
				glow.SetPosition(i, val3);
				strand.SetPosition(i, val3 + (normalized2 * Mathf.Sin(num4 + 1.5f) + val2 * Mathf.Cos(num4 + 1.5f)) * 0.2f);
				for (int j = 0; j < 12; j++)
				{
					float num5 = (float)j * MathF.PI * 2f / 12f;
					Vector3 val4 = normalized2 * Mathf.Cos(num5) + val2 * Mathf.Sin(num5);
					float num6 = 0.13f * (1f + 0.2f * Mathf.Sin(num5 * 3f + num4)) * Mathf.Lerp(1f, 0.6f, num3) * num2;
					int num7 = i * 12 + j;
					vertices[num7] = ((Component)this).transform.InverseTransformPoint(val3 + val4 * num6);
					normals[num7] = ((Component)this).transform.InverseTransformDirection(val4);
				}
			}
			vertices[480] = ((Component)this).transform.InverseTransformPoint(start);
			vertices[481] = ((Component)this).transform.InverseTransformPoint(origin);
			normals[480] = ((Component)this).transform.InverseTransformDirection(-normalized);
			normals[481] = ((Component)this).transform.InverseTransformDirection(normalized);
			tube.vertices = vertices;
			tube.normals = normals;
			tube.RecalculateBounds();
			((Renderer)tubeRenderer).enabled = num > 0f;
			LineRenderer obj = glow;
			LineRenderer obj2 = glow;
			LineRenderer obj3 = strand;
			LineRenderer obj4 = strand;
			Color val5 = default(Color);
			((Color)(ref val5))..ctor(1f, 1f, 1f, num);
			obj4.endColor = val5;
			Color val6 = (obj3.startColor = val5);
			Color startColor = (obj2.endColor = val6);
			obj.startColor = startColor;
			LineRenderer obj5 = glow;
			bool enabled = (((Renderer)strand).enabled = num > 0f);
			((Renderer)obj5).enabled = enabled;
		}

		private void OnDisable()
		{
			if (Object.op_Implicit((Object)(object)glow))
			{
				((Renderer)glow).enabled = false;
			}
			if (Object.op_Implicit((Object)(object)strand))
			{
				((Renderer)strand).enabled = false;
			}
			if (Object.op_Implicit((Object)(object)tubeRenderer))
			{
				((Renderer)tubeRenderer).enabled = false;
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)tube))
			{
				Object.Destroy((Object)(object)tube);
			}
		}
	}
	internal sealed class EmitterRegistry<T>
	{
		private readonly HashSet<T> tracked = new HashSet<T>();

		internal bool TryTrack(T source, bool owned)
		{
			if (!owned)
			{
				return tracked.Add(source);
			}
			return false;
		}

		internal void Forget(T source)
		{
			tracked.Remove(source);
		}
	}
	internal static class HadarScaling
	{
		private static float Bonus(float speed)
		{
			if (!float.IsNaN(speed))
			{
				return Math.Min(2f, Math.Max(0f, speed - 1f));
			}
			return 0f;
		}

		internal static float RadiusMultiplier(float speed)
		{
			return 1f + 0.1f * Bonus(speed);
		}

		internal static float TickRateMultiplier(float speed)
		{
			return 1f + 0.2f * Bonus(speed);
		}
	}
	public sealed class HadarVisual : MonoBehaviour
	{
		private Transform wisps;

		private readonly List<LineRenderer> tendrils = new List<LineRenderer>();

		private Mesh groundMesh;

		private Mesh haloMesh;

		private Material sealMaterial;

		private Material haloMaterial;

		private Material darkTendril;

		private float radius;

		private const int TendrilCount = 24;

		private const int TendrilPoints = 32;

		private ParticleSystem dark;

		private ParticleSystem green;

		private Material shellMaterial;

		private float age;

		internal static HadarVisual Create(GameObject field, float radius, bool prepare = false)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_00a0: 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_0136: 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_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: 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_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: 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_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: 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_0238: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)SpellAssets.SmokeMaterial) || !Object.op_Implicit((Object)(object)SpellAssets.HexMistMaterial))
			{
				return null;
			}
			GameObject val = new GameObject("RitualPreparedField");
			val.transform.SetParent(field.transform, false);
			if (prepare)
			{
				val.SetActive(false);
			}
			HadarVisual hadarVisual = val.AddComponent<HadarVisual>();
			hadarVisual.radius = radius;
			field = val;
			GameObject val2 = new GameObject("HadarSphericalCursedWisps");
			val2.transform.SetParent(field.transform, false);
			hadarVisual.wisps = val2.transform;
			hadarVisual.dark = Layer(val2.transform, "BlackSwirlingWisps", SpellAssets.SmokeMaterial, new Color(0.003f, 0.008f, 0.004f, 0.7f), radius, 67, green: false);
			hadarVisual.green = Layer(val2.transform, "GreenHandLikeWisps", SpellAssets.HexMistMaterial, new Color(0.08f, 1.25f, 0.23f, 0.65f), radius, 200, green: true);
			if (!prepare)
			{
				hadarVisual.dark.Emit(13);
				hadarVisual.green.Emit(40);
			}
			hadarVisual.shellMaterial = NativeVfxMaterials.Create("HadarFaintBlackSphere", additive: false);
			NativeVfxMaterials.Tint(hadarVisual.shellMaterial, new Color(0.002f, 0.006f, 0.003f, 0.04f));
			hadarVisual.shellMaterial.mainTexture = (Texture)(object)Texture2D.whiteTexture;
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0);
			((Object)obj).name = "HadarHighlyTransparentBoundary";
			Collider component = obj.GetComponent<Collider>();
			component.enabled = false;
			Object.Destroy((Object)(object)component);
			obj.transform.SetParent(field.transform, false);
			obj.transform.localScale = Vector3.one * radius * 2f;
			Renderer component2 = obj.GetComponent<Renderer>();
			component2.sharedMaterial = hadarVisual.shellMaterial;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			component2.receiveShadows = false;
			hadarVisual.BuildTendrils(val2.transform);
			GameObject val3 = new GameObject("HadarGroundRitualSeal");
			val3.transform.SetParent(field.transform, false);
			Vector3 val4 = field.transform.position;
			RaycastHit val5 = default(RaycastHit);
			if (Physics.Raycast(val4 + Vector3.up * 2f, Vector3.down, ref val5, radius + 2f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				val4 = ((RaycastHit)(ref val5)).point;
			}
			val3.transform.position = val4 + Vector3.up * 0.045f;
			val3.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
			hadarVisual.sealMaterial = NativeVfxMaterials.Create("HadarBrightSeal", additive: true);
			NativeVfxMaterials.Tint(hadarVisual.sealMaterial, new Color(0.12f, 3f, 0.35f, 1f));
			hadarVisual.haloMaterial = NativeVfxMaterials.Create("HadarSealHalo", additive: true);
			NativeVfxMaterials.Tint(hadarVisual.haloMaterial, new Color(0.06f, 1.8f, 0.2f, 0.18f));
			OccultSigil.Create(val3.transform, hadarVisual.haloMaterial, radius, radius * 0.019f, out hadarVisual.haloMesh);
			OccultSigil.Create(val3.transform, hadarVisual.sealMaterial, radius, radius * 0.009f, out hadarVisual.groundMesh);
			Debug.Log((object)("WARLOCK HADAR TENDRILS PREPARED: center eruption, 24 radial tendrils, particle cap=267, full spherical reach=" + radius + ", ground seal diameter=" + radius * 2f));
			return hadarVisual;
		}

		internal void Reveal()
		{
			((Component)this).gameObject.SetActive(true);
			if (Object.op_Implicit((Object)(object)dark))
			{
				dark.Play();
				dark.Emit(13);
			}
			if (Object.op_Implicit((Object)(object)green))
			{
				green.Play();
				green.Emit(40);
			}
		}

		private static ParticleSystem Layer(Transform root, string name, Material material, Color color, float radius, int cap, bool green)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//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_0049: 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_0097: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(root, false);
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			val2.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val2.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(2f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(radius * (green ? 0.025f : 0.07f), radius * (green ? 0.065f : 0.12f));
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(radius * 0.4f, radius * 0.5f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
			((MainModule)(ref main)).maxParticles = cap;
			((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f);
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = 0.025f;
			((ShapeModule)(ref shape)).radiusThickness = 1f;
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(green ? 100f : 33.5f);
			VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalY = MinMaxCurve.op_Implicit(green ? 0.4f : 0.2f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalX = MinMaxCurve.op_Implicit(0.075f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = MinMaxCurve.op_Implicit(0f);
			ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(0.85f, 0.2f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = material;
			component.renderMode = (ParticleSystemRenderMode)1;
			component.lengthScale = 1.6f;
			component.velocityScale = 0.035f;
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component).receiveShadows = false;
			if (val.activeInHierarchy)
			{
				val2.Play();
			}
			return val2;
		}

		private void BuildTendrils(Transform root)
		{
			//IL_002b: 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)
			darkTendril = NativeVfxMaterials.Create("HadarDarkTendril", additive: false);
			NativeVfxMaterials.Tint(darkTendril, new Color(0.002f, 0.006f, 0.003f, 0.8f));
			for (int i = 0; i < 24; i++)
			{
				for (int j = 0; j < 2; j++)
				{
					GameObject val = new GameObject((j == 0) ? "BlackTendril" : "GreenTendril");
					val.transform.SetParent(root, false);
					LineRenderer val2 = val.AddComponent<LineRenderer>();
					((Renderer)val2).sharedMaterial = ((j == 0) ? darkTendril : SpellAssets.HexSymbolMaterial);
					val2.useWorldSpace = false;
					val2.positionCount = 32;
					val2.widthCurve = AnimationCurve.Linear(0f, 1f, 1f, 0.08f);
					val2.widthMultiplier = radius * ((j == 0) ? 0.014f : 0.006f);
					((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0;
					((Renderer)val2).receiveShadows = false;
					tendrils.Add(val2);
				}
			}
		}

		private void AnimateTendrils()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0159: 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_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: 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_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			Color val7 = default(Color);
			for (int i = 0; i < 24; i++)
			{
				float num = 1f - 2f * ((float)i + 0.5f) / 24f;
				float num2 = (float)i * 2.3999631f;
				float num3 = Mathf.Sqrt(1f - num * num);
				((Vector3)(ref val))..ctor(Mathf.Cos(num2) * num3, num, Mathf.Sin(num2) * num3);
				Vector3 val2 = Vector3.Cross(val, (Mathf.Abs(num) > 0.9f) ? Vector3.right : Vector3.up);
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				Vector3 val3 = Vector3.Cross(normalized, val);
				float num4 = Mathf.Repeat(age * 0.325f + (float)i * 0.137f, 1f);
				float num5 = Mathf.Clamp01(num4 * 1.7f);
				float num6 = Mathf.Clamp01((1f - num4) * 3f) * Mathf.Clamp01((Plugin.HadarDuration.Value - age) * 3f);
				LineRenderer val4 = tendrils[i * 2];
				LineRenderer val5 = tendrils[i * 2 + 1];
				for (int j = 0; j < 32; j++)
				{
					float num7 = (float)j / 31f * num5;
					float num8 = num7 * 16f - age * 2.5f + (float)i;
					Vector3 val6 = val * radius * num7 + (normalized * Mathf.Sin(num8) + val3 * Mathf.Cos(num8)) * radius * 0.055f * Mathf.Sin(num7 * MathF.PI);
					val4.SetPosition(j, val6);
					val5.SetPosition(j, val6);
				}
				((Color)(ref val7))..ctor(1f, 1f, 1f, num6);
				val4.endColor = val7;
				val4.startColor = val7;
				((Color)(ref val7))..ctor(0.12f, 1f, 0.25f, num6 * 0.7f);
				val5.endColor = val7;
				val5.startColor = val7;
			}
		}

		private void Update()
		{
			age += Time.deltaTime;
			AnimateTendrils();
			if (Object.op_Implicit((Object)(object)wisps))
			{
				wisps.Rotate(0f, Time.deltaTime * 4f, 0f, (Space)1);
			}
			if (age > Plugin.HadarDuration.Value - 0.45f)
			{
				if (Object.op_Implicit((Object)(object)dark) && dark.isEmitting)
				{
					dark.Stop(false, (ParticleSystemStopBehavior)1);
				}
				if (Object.op_Implicit((Object)(object)green) && green.isEmitting)
				{
					green.Stop(false, (ParticleSystemStopBehavior)1);
				}
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)shellMaterial))
			{
				Object.Destroy((Object)(object)shellMaterial);
			}
			if (Object.op_Implicit((Object)(object)darkTendril))
			{
				Object.Destroy((Object)(object)darkTendril);
			}
			if (Object.op_Implicit((Object)(object)groundMesh))
			{
				Object.Destroy((Object)(object)groundMesh);
			}
			if (Object.op_Implicit((Object)(object)haloMesh))
			{
				Object.Destroy((Object)(object)haloMesh);
			}
			if (Object.op_Implicit((Object)(object)sealMaterial))
			{
				Object.Destroy((Object)(object)sealMaterial);
			}
			if (Object.op_Implicit((Object)(object)haloMaterial))
			{
				Object.Destroy((Object)(object)haloMaterial);
			}
		}
	}
	internal static class HexDeathExplosion
	{
		internal static void Spawn(Vector3 position, float radius)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0094: 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_00d5: 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_0108: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)SpellAssets.SmokeMaterial) && Object.op_Implicit((Object)(object)SpellAssets.HexMistMaterial))
			{
				GameObject val = new GameObject("WarlockDenseCurseDetonation");
				val.transform.position = position;
				Layer(val.transform, "RollingBlackSmoke", SpellAssets.SmokeMaterial, new Color(0.004f, 0.002f, 0.002f, 0.95f), radius, 96, 1.5f, 0.22f, 1.9f, stretch: false);
				Layer(val.transform, "RedFireTongues", SpellAssets.HexMistMaterial, new Color(1.9f, 0.08f, 0.22f, 0.8f), radius, 72, 0.8f, 0.7f, 1.15f, stretch: true);
				Layer(val.transform, "RedOccultCinders", SpellAssets.HexMistMaterial, new Color(1.8f, 0.3f, 0.45f, 0.9f), radius, 48, 0.12f, 1f, 0.9f, stretch: false);
				val.AddComponent<CurseDetonationVisual>().radius = radius;
				Object.Destroy((Object)val, 2.6f);
			}
		}

		private static void Layer(Transform root, string name, Material material, Color color, float radius, short count, float size, float speed, float lifetime, bool stretch)
		{
			//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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00b1: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_0103: 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_0119: 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_0135: 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_0164: 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_0174: 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_0185: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(root, false);
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			val2.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val2.main;
			((MainModule)(ref main)).loop = false;
			((MainModule)(ref main)).duration = 0.1f;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(lifetime * 0.55f, lifetime);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(radius * speed * 0.5f, radius * speed);
			((MainModule)(ref main)).startSize = new MinMaxCurve(radius * 0.12f * size, radius * 0.25f * size);
			((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, MathF.PI * 2f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
			((MainModule)(ref main)).maxParticles = count;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = radius * 0.13f;
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = MinMaxCurve.op_Implicit(1.3f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalY = MinMaxCurve.op_Implicit(1.4f);
			SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.EaseInOut(0f, 0.5f, 1f, 1.5f));
			ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(0.95f, 0f),
				new GradientAlphaKey(0.85f, 0.3f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = material;
			if (stretch)
			{
				component.renderMode = (ParticleSystemRenderMode)1;
				component.lengthScale = 2f;
				component.velocityScale = 0.08f;
			}
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component).receiveShadows = false;
			val2.Play();
			val2.Emit((int)count);
		}
	}
	public sealed class CurseDetonationVisual : MonoBehaviour
	{
		internal float radius;

		private readonly Transform[] lobes = (Transform[])(object)new Transform[5];

		private LineRenderer shock;

		private LineRenderer shockHalo;

		private Light flash;

		private Material black;

		private float age;

		private void Start()
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				black = NativeVfxMaterials.OpaqueBlack("WarlockDetonationBlackMass");
				for (int i = 0; i < lobes.Length; i++)
				{
					GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
					((Object)val).name = "BlackTurbulenceLobe";
					Collider component = val.GetComponent<Collider>();
					component.enabled = false;
					Object.Destroy((Object)(object)component);
					val.transform.SetParent(((Component)this).transform, false);
					lobes[i] = val.transform;
					Renderer component2 = val.GetComponent<Renderer>();
					component2.sharedMaterial = black;
					component2.shadowCastingMode = (ShadowCastingMode)0;
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("Warlock explosion solid detail unavailable: " + ex.Message));
			}
			GameObject val2 = new GameObject("RedExpandingShockwave");
			val2.transform.SetParent(((Component)this).transform, false);
			shock = val2.AddComponent<LineRenderer>();
			shock.useWorldSpace = false;
			shock.positionCount = 65;
			((Renderer)shock).sharedMaterial = SpellAssets.HexRedSymbolMaterial;
			LineRenderer obj = shock;
			float startWidth = (shock.endWidth = 0.35f);
			obj.startWidth = startWidth;
			((Renderer)shock).shadowCastingMode = (ShadowCastingMode)0;
			GameObject val3 = new GameObject("BroadRedShockwaveHalo");
			val3.transform.SetParent(((Component)this).transform, false);
			shockHalo = val3.AddComponent<LineRenderer>();
			shockHalo.useWorldSpace = false;
			shockHalo.positionCount = 65;
			((Renderer)shockHalo).sharedMaterial = SpellAssets.HexMistMaterial;
			LineRenderer obj2 = shockHalo;
			startWidth = (shockHalo.endWidth = 0.95f);
			obj2.startWidth = startWidth;
			((Renderer)shockHalo).shadowCastingMode = (ShadowCastingMode)0;
			flash = ((Component)this).gameObject.AddComponent<Light>();
			flash.type = (LightType)2;
			flash.color = new Color(1f, 0.08f, 0.2f);
			flash.range = radius * 1.5f;
			Debug.Log((object)"WARLOCK CURSE DETONATION VISUAL: dense smoke, flame tongues, cinders, black lobes and shockwave.");
		}

		private void Update()
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: 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_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			age += Time.deltaTime;
			float num = Mathf.Clamp01(age / 0.18f);
			float num2 = Mathf.Clamp01(1f - (age - 0.2f) / 0.65f);
			for (int i = 0; i < lobes.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)lobes[i]))
				{
					float num3 = (float)i * MathF.PI * 2f / (float)lobes.Length;
					lobes[i].localPosition = new Vector3(Mathf.Sin(num3), 0.3f + age, Mathf.Cos(num3)) * radius * 0.09f * num;
					lobes[i].localScale = new Vector3(1f, 1.2f, 1f) * radius * 0.32f * num * num2;
				}
			}
			if (Object.op_Implicit((Object)(object)shock))
			{
				Vector3 val = default(Vector3);
				for (int j = 0; j < 65; j++)
				{
					float num4 = (float)j * MathF.PI * 2f / 64f;
					float num5 = radius * Mathf.Clamp01(age / 0.65f);
					((Vector3)(ref val))..ctor(Mathf.Sin(num4) * num5, 0.05f, Mathf.Cos(num4) * num5);
					shock.SetPosition(j, val);
					shockHalo.SetPosition(j, val);
				}
				LineRenderer obj = shock;
				LineRenderer obj2 = shock;
				Color val2 = default(Color);
				((Color)(ref val2))..ctor(2f, 0.15f, 0.3f, Mathf.Clamp01(1f - age / 0.95f));
				obj2.endColor = val2;
				obj.startColor = val2;
				((Renderer)shock).enabled = age < 0.95f;
				LineRenderer obj3 = shockHalo;
				LineRenderer obj4 = shockHalo;
				((Color)(ref val2))..ctor(1.5f, 0.08f, 0.2f, Mathf.Clamp01(1f - age / 0.95f) * 0.3f);
				obj4.endColor = val2;
				obj3.startColor = val2;
				((Renderer)shockHalo).enabled = ((Renderer)shock).enabled;
			}
			if (Object.op_Implicit((Object)(object)flash))
			{
				flash.intensity = 4f * Mathf.Clamp01(1f - age / 0.3f);
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)black))
			{
				Object.Destroy((Object)(object)black);
			}
		}
	}
	public sealed class HexVisual : MonoBehaviour
	{
		private WarlockTracker caster;

		private HealthComponent victim;

		private float scale;

		private Transform sigil;

		private Mesh sigilMesh;

		internal static HexVisual Attach(WarlockTracker caster, HealthComponent victim)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)SpellAssets.HexMistMaterial) || !Object.op_Implicit((Object)(object)SpellAssets.HexRedSymbolMaterial))
			{
				Debug.LogWarning((object)"WARLOCK HEX VISUAL: native materials unavailable; send LogOutput.log.");
				return null;
			}
			GameObject val = new GameObject("WarlockHexCurse");
			HexVisual hexVisual = val.AddComponent<HexVisual>();
			hexVisual.caster = caster;
			hexVisual.victim = victim;
			hexVisual.scale = Mathf.Clamp(victim.body.radius, 0.65f, 1.6f);
			val.transform.position = victim.body.corePosition;
			hexVisual.Build();
			hexVisual.BuildMist();
			Debug.Log((object)"WARLOCK HEX VISUAL ACTIVE: bright red mist and red artwork sigil; no square buff image.");
			return hexVisual;
		}

		private void Build()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			sigil = new GameObject("FloatingHexEye").transform;
			sigil.SetParent(((Component)this).transform, false);
			OccultSigil.Create(sigil, SpellAssets.HexRedSymbolMaterial, 1f, 0.025f, out sigilMesh);
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)sigilMesh))
			{
				Object.Destroy((Object)(object)sigilMesh);
			}
		}

		private void BuildMist()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_008f: 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_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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_0143: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("PersistentBrightHexMist");
			val.transform.SetParent(((Component)this).transform, false);
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			val2.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val2.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.6f, 1.1f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(scale * 1.3f, scale * 2.3f);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.15f, 0.4f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(1.6f, 0.22f, 0.4f, 0.85f));
			((MainModule)(ref main)).maxParticles = 48;
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(24f);
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = scale * 0.75f;
			VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(0.35f);
			ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(0.75f, 0.15f),
				new GradientAlphaKey(0.45f, 0.65f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = SpellAssets.HexMistMaterial;
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component).receiveShadows = false;
			val2.Play();
			val2.Emit(10);
		}

		private void Update()
		{
			//IL_0082: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)caster) || !Object.op_Implicit((Object)(object)victim) || !victim.alive || !Object.op_Implicit((Object)(object)victim.body) || !caster.targets.Contains(victim) || Time.fixedTime >= caster.until)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			CharacterBody body = victim.body;
			((Component)this).transform.position = body.corePosition;
			sigil.localPosition = Vector3.up * (Mathf.Max(0.7f, body.radius) + 0.7f);
			Camera main = Camera.main;
			if (Object.op_Implicit((Object)(object)main))
			{
				sigil.rotation = ((Component)main).transform.rotation;
			}
			sigil.localScale = Vector3.one * scale * (1f + Mathf.Sin(Time.time * 5f) * 0.07f);
		}
	}
	internal readonly struct HoodProfile
	{
		internal const int Rows = 7;

		internal const int Columns = 13;

		internal readonly float Width;

		internal readonly float Front;

		internal readonly float Back;

		internal readonly float Bottom;

		internal readonly float Top;

		internal static HoodProfile Fallback => new HoodProfile(0.145f, 0.14f, 0.185f, -0.145f, 0.215f);

		internal HoodProfile(float width, float front, float back, float bottom, float top)
		{
			Width = width;
			Front = front;
			Back = back;
			Bottom = bottom;
			Top = top;
		}

		internal static HoodProfile FromBounds(float minX, float maxX, float minY, float maxY, float minZ, float maxZ)
		{
			float val = Math.Max(Math.Abs(minX), Math.Abs(maxX)) + 0.012f;
			return new HoodProfile(Math.Max(0.1f, val), Math.Max(0.1f, maxZ + 0.015f), Math.Max(0.12f, 0f - minZ + 0.018f), Math.Min(-0.145f, minY - 0.04f), Math.Max(0.1f, maxY + 0.028f));
		}

		internal void Point(int row, int column, out float x, out float y, out float z)
		{
			double num = (60.0 + (double)(240 * column) / 12.0) * Math.PI / 180.0;
			float num2 = row switch
			{
				5 => 0.95f, 
				4 => 0.84f, 
				3 => 0.7f, 
				2 => 0.5f, 
				1 => 0.25f, 
				0 => 0f, 
				_ => 1f, 
			};
			float num3 = ((row <= 2) ? 1f : (row switch
			{
				5 => 0.62f, 
				4 => 0.88f, 
				3 => 0.96f, 
				_ => 0f, 
			}));
			x = (float)Math.Sin(num) * Width * num3;
			float num4 = (float)Math.Cos(num);
			z = num4 * ((num4 >= 0f) ? Front : Back) * num3;
			y = Bottom + (Top - Bottom) * num2;
		}
	}
	internal static class HoverFlames
	{
		internal static ParticleSystem Create(Transform bone, bool dark, bool foot)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0118: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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_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_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: 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_01b7: 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)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			//IL_01e2: 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_01f8: 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_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: 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)
			GameObject val = new GameObject(dark ? "HoverBlackWisp" : "HoverGreenFlame");
			val.transform.SetParent(bone, false);
			if (bone.childCount > 1)
			{
				val.transform.position = Vector3.Lerp(bone.position, bone.GetChild(0).position, 0.5f);
			}
			val.AddComponent<OccultOwnedEmitter>();
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			val2.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val2.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)2;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.0583333f, 0.1083333f);
			float num = (dark ? 0.4f : (foot ? 0.3f : 0.25f));
			((MainModule)(ref main)).startSize = new MinMaxCurve(num * 0.6f, num);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.04f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(dark ? new Color(0.002f, 0.005f, 0.003f, 0.85f) : new Color(0.08f, 1.25f, 0.23f, 0.8f));
			((MainModule)(ref main)).maxParticles = (dark ? 20 : 36);
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(dark ? 24f : 48f);
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = 0.09f;
			VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalY = MinMaxCurve.op_Implicit(2f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalX = MinMaxCurve.op_Implicit(0.75f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = MinMaxCurve.op_Implicit(0.125f);
			ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(0.85f, 0.2f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = (dark ? SpellAssets.SmokeMaterial : SpellAssets.HexMistMaterial);
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component).receiveShadows = false;
			return val2;
		}

		internal static void SetActive(ParticleSystem particles, bool active)
		{
			if (Object.op_Implicit((Object)(object)particles))
			{
				if (active && !particles.isEmitting)
				{
					particles.Play();
				}
				else if (!active && particles.isPlaying)
				{
					particles.Stop(false, (ParticleSystemStopBehavior)0);
				}
			}
		}
	}
	public sealed class JetpackMagic : MonoBehaviour
	{
		private static readonly FieldInfo JetEffect = typeof(JetpackOn).GetField("jetOnEffect", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		private EntityStateMachine[] machines;

		private bool warned;

		private static readonly string[] JetNames = new string[4] { "JetOn", "JetsOn", "JetOff", "JetsOff" };

		private void Start()
		{
			machines = ((Component)this).GetComponents<EntityStateMachine>();
		}

		private void LateUpdate()
		{
			CharacterBody component = ((Component)this).GetComponent<CharacterBody>();
			ModelLocator val = (Object.op_Implicit((Object)(object)component) ? component.modelLocator : null);
			Transform val2 = (Object.op_Implicit((Object)(object)val) ? val.modelTransform : null);
			bool hovering = false;
			EntityStateMachine[] array;
			if (machines != null)
			{
				array = machines;
				for (int i = 0; i < array.Length; i++)
				{
					if (array[i].state is JetpackOn)
					{
						hovering = true;
						break;
					}
				}
			}
			WarlockLimbGlow warlockLimbGlow = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).GetComponentInChildren<WarlockLimbGlow>(true) : null);
			if (Object.op_Implicit((Object)(object)warlockLimbGlow))
			{
				warlockLimbGlow.SetHovering(hovering);
			}
			ChildLocator val3 = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).GetComponent<ChildLocator>() : null);
			if (Object.op_Implicit((Object)(object)val3))
			{
				string[] jetNames = JetNames;
				foreach (string text in jetNames)
				{
					Transform val4 = val3.FindChild(text);
					if (Object.op_Implicit((Object)(object)val4))
					{
						SuppressNativeFlames.Hide(val4);
					}
				}
			}
			if (machines == null)
			{
				return;
			}
			array = machines;
			for (int i = 0; i < array.Length; i++)
			{
				EntityState state = array[i].state;
				JetpackOn val5 = (JetpackOn)(object)((state is JetpackOn) ? state : null);
				if (val5 == null)
				{
					continue;
				}
				object? obj = JetEffect?.GetValue(val5);
				Transform val6 = (Transform)((obj is Transform) ? obj : null);
				CharacterBody component2 = ((Component)this).GetComponent<CharacterBody>();
				ModelLocator val7 = (Object.op_Implicit((Object)(object)component2) ? component2.modelLocator : null);
				Transform val8 = (Object.op_Implicit((Object)(object)val7) ? val7.modelTransform : null);
				if (!Object.op_Implicit((Object)(object)val6) && Object.op_Implicit((Object)(object)val8))
				{
					ChildLocator component3 = ((Component)val8).GetComponent<ChildLocator>();
					if (Object.op_Implicit((Object)(object)component3))
					{
						val6 = component3.FindChild("JetOn");
					}
				}
				if (Object.op_Implicit((Object)(object)val6) && (val6.IsChildOf(((Component)this).transform) || (Object.op_Implicit((Object)(object)val8) && val6.IsChildOf(val8))))
				{
					SuppressNativeFlames.Hide(val6);
					break;
				}
				if (!warned)
				{
					warned = true;
					Debug.LogWarning((object)"WARLOCK HOVER MAGIC: active JetpackOn has no effect under its body/owned model; send the current LogOutput.log if exhaust colors remain unchanged.");
				}
			}
		}
	}
	[DefaultExecutionOrder(11000)]
	public sealed class MagicParticlePalette : MonoBehaviour
	{
		private sealed class Replacement
		{
			internal ParticleSystem source;

			internal ParticleSystem green;

			internal ParticleSystem dark;

			internal ParticleSystemRenderer original;

			internal bool wasEnabled;
		}

		private readonly List<Replacement> effects = new List<Replacement>();

		private readonly List<Light> lights = new List<Light>();

		private readonly List<ParticleSystem> candidates = new List<ParticleSystem>();

		private readonly EmitterRegistry<ParticleSystem> registry = new EmitterRegistry<ParticleSystem>();

		private void LateUpdate()
		{
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)SpellAssets.HexMistMaterial) || !Object.op_Implicit((Object)(object)SpellAssets.SmokeMaterial))
			{
				return;
			}
			candidates.Clear();
			((Component)this).GetComponentsInChildren<ParticleSystem>(true, candidates);
			int num = 0;
			foreach (ParticleSystem candidate in candidates)
			{
				bool owned = Object.op_Implicit((Object)(object)((Component)candidate).GetComponent<OccultOwnedEmitter>());
				if (registry.TryTrack(candidate, owned))
				{
					ParticleSystemRenderer component = ((Component)candidate).GetComponent<ParticleSystemRenderer>();
					if (Object.op_Implicit((Object)(object)component))
					{
						effects.Add(new Replacement
						{
							source = candidate,
							original = component,
							wasEnabled = ((Renderer)component).enabled,
							green = Layer(((Component)candidate).transform, "OccultGreenCurl", SpellAssets.HexMistMaterial, new Color(0.08f, 1.25f, 0.23f, 0.8f), 0.2f),
							dark = Layer(((Component)candidate).transform, "OccultBlackWisp", SpellAssets.SmokeMaterial, new Color(0.002f, 0.005f, 0.003f, 0.9f), 0.38f)
						});
						num++;
					}
				}
			}
			if (num > 0)
			{
				Debug.Log((object)("WARLOCK MAGIC DISCOVERY: root=" + ((Object)((Component)this).gameObject).name + ", new native emitters=" + num + ", tracked=" + effects.Count));
			}
			for (int num2 = effects.Count - 1; num2 >= 0; num2--)
			{
				Replacement replacement = effects[num2];
				if (!Object.op_Implicit((Object)(object)replacement.source))
				{
					registry.Forget(replacement.source);
					effects.RemoveAt(num2);
				}
				else
				{
					if (Object.op_Implicit((Object)(object)replacement.original))
					{
						((Renderer)replacement.original).enabled = false;
					}
					bool active = replacement.source.isPlaying && ((Component)replacement.source).gameObject.activeInHierarchy;
					Toggle(replacement.green, active);
					Toggle(replacement.dark, active);
				}
			}
			lights.Clear();
			((Component)this).GetComponentsInChildren<Light>(true, lights);
			foreach (Light light in lights)
			{
				if (Object.op_Implicit((Object)(object)light))
				{
					light.color = new Color(0.08f, 1f, 0.22f);
				}
			}
		}

		private static void Toggle(ParticleSystem particles, bool active)
		{
			if (Object.op_Implicit((Object)(object)particles))
			{
				if (active && !particles.isEmitting)
				{
					particles.Play();
				}
				else if (!active && particles.isEmitting)
				{
					particles.Stop(false, (ParticleSystemStopBehavior)1);
				}
			}
		}

		private static ParticleSystem Layer(Transform root, string name, Material material, Color color, float size)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_005b: 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_0082: 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_008f: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0157: 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_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: 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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(root, false);
			val.AddComponent<OccultOwnedEmitter>();
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			val2.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val2.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)2;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.35f, 0.65f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(size * 0.6f, size);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.08f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
			((MainModule)(ref main)).maxParticles = 24;
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(28f);
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = 0.09f;
			VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalY = MinMaxCurve.op_Implicit(4f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalX = MinMaxCurve.op_Implicit(1.5f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = MinMaxCurve.op_Implicit(0.25f);
			ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(0.85f, 0.2f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = material;
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component).receiveShadows = false;
			return val2;
		}

		private void OnDestroy()
		{
			foreach (Replacement effect in effects)
			{
				if (Object.op_Implicit((Object)(object)effect.original))
				{
					((Renderer)effect.original).enabled = effect.wasEnabled;
				}
				if (Object.op_Implicit((Object)(object)effect.green))
				{
					Object.Destroy((Object)(object)((Component)effect.green).gameObject);
				}
				if (Object.op_Implicit((Object)(object)effect.dark))
				{
					Object.Destroy((Object)(object)((Component)effect.dark).gameObject);
				}
			}
		}
	}
	public sealed class OccultOwnedEmitter : MonoBehaviour
	{
	}
	internal static class MistCloud
	{
		private static GameObject prefab;

		internal static void Register()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: 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_020c: 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_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: 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_02