Decompiled source of JujutsuCompany v1.10.4

JujutsuCompany.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations;
using UnityEngine.Audio;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Networking;
using UnityEngine.Playables;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
	internal static class IsExternalInit
	{
	}
}
namespace JujutsuCompany
{
	public static class HudArt
	{
		private static Sprite? stroke;

		private static Sprite? smear;

		private static Sprite? enso;

		private static Sprite? disc;

		private static Sprite? dot;

		public static Sprite Stroke
		{
			get
			{
				//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_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)
				if ((Object)(object)stroke != (Object)null)
				{
					return stroke;
				}
				Texture2D val = NewTex(512, 64);
				Color32[] array = (Color32[])(object)new Color32[32768];
				for (int i = 0; i < 512; i++)
				{
					float num = (float)i / 511f;
					float num2 = Mathf.Pow(Mathf.Clamp01(num / 0.035f), 0.45f);
					float num3 = Mathf.Pow(Mathf.Clamp01((1f - num) / 0.2f), 0.75f);
					float num4 = 27.52f * num2 * num3 * (0.88f + 0.12f * Noise1(num * 24f, 3));
					float num5 = 32f + (Noise1(num * 3f, 9) - 0.5f) * 64f * 0.08f;
					float num6 = Mathf.SmoothStep(0f, 1f, (num - 0.72f) / 0.28f) * 0.75f;
					for (int j = 0; j < 64; j++)
					{
						float num7 = Mathf.Abs((float)j + 0.5f - num5);
						float num8 = Mathf.Clamp01(num4 - num7 + 0.5f);
						if (num8 <= 0f)
						{
							array[j * 512 + i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0);
							continue;
						}
						float num9 = Noise1((float)j * 0.9f, 17) * 0.7f + Noise1(num * 40f + (float)j * 3.1f, 23) * 0.3f;
						if (num9 < num6)
						{
							num8 *= Mathf.Clamp01((num9 - num6 + 0.08f) / 0.08f);
						}
						num8 *= 0.82f + 0.18f * Noise1((float)j * 0.6f + 40f, 5);
						array[j * 512 + i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num8 * 255f));
					}
				}
				val.SetPixels32(array);
				val.Apply(true);
				return stroke = Make(val);
			}
		}

		public static Sprite Smear
		{
			get
			{
				//IL_013d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)smear != (Object)null)
				{
					return smear;
				}
				Texture2D val = NewTex(256, 128);
				Color32[] array = (Color32[])(object)new Color32[32768];
				for (int i = 0; i < 256; i++)
				{
					float num = (float)i / 255f * 2f - 1f;
					float num2 = 0.82f + 0.12f * Noise1((float)i * 0.08f, 41);
					for (int j = 0; j < 128; j++)
					{
						float num3 = (float)j / 127f * 2f - 1f;
						float num4 = 0.78f + 0.18f * Noise1((float)i * 0.05f + (float)j * 0.01f, 7);
						float num5 = Mathf.Sqrt(Mathf.Pow(Mathf.Abs(num) / num2, 4f) + Mathf.Pow(Mathf.Abs(num3) / num4, 4f));
						float num6 = Mathf.Clamp01((1f - num5) * 5f);
						num6 *= 0.85f + 0.15f * Noise1((float)j * 0.7f + (float)i * 0.02f, 13);
						array[j * 256 + i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num6 * 255f));
					}
				}
				val.SetPixels32(array);
				val.Apply(true);
				return smear = Make(val);
			}
		}

		public static Sprite Enso
		{
			get
			{
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)enso != (Object)null)
				{
					return enso;
				}
				Texture2D val = NewTex(160, 160);
				Color32[] array = (Color32[])(object)new Color32[25600];
				float num = 60.8f;
				for (int i = 0; i < 160; i++)
				{
					for (int j = 0; j < 160; j++)
					{
						float num2 = (float)j + 0.5f - 80f;
						float num3 = (float)i + 0.5f - 80f;
						float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3);
						float num5 = Mathf.Repeat(Mathf.Atan2(num3, num2) / ((float)Math.PI * 2f) - 0.08f, 1f);
						float num6 = 0.93f;
						float num7 = 0f;
						if (num5 < num6)
						{
							float num8 = num5 / num6;
							float num9 = 160f * (0.085f - 0.05f * num8) * Mathf.Clamp01(num8 / 0.04f + 0.5f);
							if (num8 > 0.85f)
							{
								num9 *= Mathf.Clamp01((1f - num8) / 0.15f) * 0.7f + 0.3f;
							}
							float num10 = num + (Noise1(num8 * 9f, 31) - 0.5f) * 160f * 0.025f + num8 * 160f * 0.012f;
							num7 = Mathf.Clamp01(num9 - Mathf.Abs(num4 - num10) + 0.5f);
							float num11 = Mathf.SmoothStep(0f, 1f, (num8 - 0.6f) / 0.4f) * 0.6f;
							float num12 = Noise1((num4 - num10) * 1.3f + 50f, 19);
							if (num12 < num11)
							{
								num7 *= Mathf.Clamp01((num12 - num11 + 0.1f) / 0.1f);
							}
						}
						array[i * 160 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num7 * 255f));
					}
				}
				val.SetPixels32(array);
				val.Apply(true);
				return enso = Make(val);
			}
		}

		public static Sprite Disc
		{
			get
			{
				//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)
				if ((Object)(object)disc != (Object)null)
				{
					return disc;
				}
				Texture2D val = NewTex(128, 128);
				Color32[] array = (Color32[])(object)new Color32[16384];
				for (int i = 0; i < 128; i++)
				{
					for (int j = 0; j < 128; j++)
					{
						float num = (float)j + 0.5f - 64f;
						float num2 = (float)i + 0.5f - 64f;
						float num3 = Mathf.Clamp01(63f - Mathf.Sqrt(num * num + num2 * num2));
						array[i * 128 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num3 * 255f));
					}
				}
				val.SetPixels32(array);
				val.Apply(true);
				return disc = Make(val);
			}
		}

		public static Sprite Glow
		{
			get
			{
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)dot != (Object)null)
				{
					return dot;
				}
				Texture2D val = NewTex(64, 64);
				Color32[] array = (Color32[])(object)new Color32[4096];
				for (int i = 0; i < 64; i++)
				{
					for (int j = 0; j < 64; j++)
					{
						float num = ((float)j + 0.5f) / 64f * 2f - 1f;
						float num2 = ((float)i + 0.5f) / 64f * 2f - 1f;
						float num3 = Mathf.Clamp01(1f - Mathf.Sqrt(num * num + num2 * num2));
						array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num3 * num3 * 255f));
					}
				}
				val.SetPixels32(array);
				val.Apply(true);
				return dot = Make(val);
			}
		}

		private static float Hash(int n)
		{
			n = (n << 13) ^ n;
			return 1f - (float)((n * (n * n * 15731 + 789221) + 1376312589) & 0x7FFFFFFF) / 1.0737418E+09f * 0.5f;
		}

		private static float Noise1(float x, int seed)
		{
			int num = Mathf.FloorToInt(x);
			float num2 = x - (float)num;
			num2 = num2 * num2 * (3f - 2f * num2);
			return Mathf.Lerp(Hash(num * 57 + seed * 131), Hash((num + 1) * 57 + seed * 131), num2);
		}

		private static Sprite Make(Texture2D t)
		{
			//IL_0019: 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)
			return Sprite.Create(t, new Rect(0f, 0f, (float)((Texture)t).width, (float)((Texture)t).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0);
		}

		private static Texture2D NewTex(int w, int h)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			return new Texture2D(w, h, (TextureFormat)4, true)
			{
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)1,
				name = "JJK_HudArt"
			};
		}
	}
	public static class Visuals
	{
		public static readonly Color Blood = new Color(0.32f, 0.01f, 0.01f);

		private static readonly Dictionary<int, GameObject> vortices = new Dictionary<int, GameObject>();

		public static Vector3 Hand(PlayerControllerB p)
		{
			//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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			Transform val = (((Object)(object)p.gameplayCamera != (Object)null) ? ((Component)p.gameplayCamera).transform : ((Component)p).transform);
			return val.position + val.forward * 0.6f + val.right * 0.25f - val.up * 0.25f;
		}

		public static Vector3 Chest(PlayerControllerB p)
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)p).transform.position + Vector3.up * 1.2f;
		}

		private static Color GradeColor(Grade g)
		{
			//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_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_0039: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			return (Color)(g switch
			{
				Grade.Low => new Color(0.45f, 0.5f, 0.75f), 
				Grade.Moderate => FX.Blue, 
				Grade.High => FX.Purple, 
				Grade.SixEyes => new Color(0.4f, 0.95f, 1f), 
				_ => Color.white, 
			});
		}

		public static void Awaken(PlayerControllerB p, Grade g)
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_006b: 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_009d: 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_0101: 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)
			Vector3 pos = Chest(p);
			Color val = GradeColor(g);
			FX.Shockwave(pos, val, (g == Grade.SixEyes) ? 9f : 5f, 0.9f, 0.45f);
			FX.Particles(pos, val, (g == Grade.SixEyes) ? 90 : 45, 6f, 0.12f, 1.2f, 0f, 0.5f, -0.3f);
			FX.FlashLight(pos, val, (g == Grade.SixEyes) ? 60000f : 25000f, 14f, 1.4f);
			SoundBank.PlayAt((g == Grade.SixEyes) ? "six_eyes" : "awaken", pos);
			if ((Object)(object)p == (Object)(object)JJK.Local)
			{
				FX.Shake((ScreenShakeType)(g == Grade.SixEyes));
				PostFx.Flash(val, 0.6f, 0.05f, 0.25f, 1.2f, 0.8f, 0.35f, 0f, 0f, 0f, 0f, val * 0.4f);
			}
		}

		public static void InfinityRipple(Vector3 center, Vector3 dir, float radius, int playerIdx)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = JJK.PlayerByIndex(playerIdx);
			ForceField.Spawn(center, dir, radius, ((Object)(object)val != (Object)null) ? ((Component)val).transform : null);
		}

		public static void Slash(Vector3 center, Vector3 dir, float length, bool hit, bool scar, Vector3 normal)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_0140: 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)
			FX.Cut(center, dir, length, 0.45f);
			if (Random.value < 0.5f)
			{
				float num = Random.Range(-14f, 14f);
				Vector3 val = Vector3.Cross(dir, Vector3.up);
				Vector3 dir2 = Quaternion.AngleAxis(num, ((Vector3)(ref val)).normalized) * dir;
				FX.Cut(center + Random.insideUnitSphere * 0.12f, dir2, length * 0.7f, 0.35f, 0.7f, scar: false, Random.value < 0.35f);
			}
			if (hit)
			{
				FX.Particles(center, Blood, 26, 4.5f, 0.08f, 0.7f, 0f, 0.25f, 1.2f, null, 1f, inward: false, 0f);
				FX.Particles(center, FX.White, 10, 6f, 0.03f, 0.25f, 0f, 0.15f, 0f, null, 1f, inward: false, 1f);
				SoundBank.PlayAt("slash_hit", center, 0.9f, 30f, Random.Range(0.9f, 1.1f));
			}
			if (scar && ((Vector3)(ref normal)).sqrMagnitude > 0.01f)
			{
				FX.Scar(center, normal, dir, length * 0.8f, 8f);
			}
		}

		public static void DomainHit(Vector3 center)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			int num = Random.Range(4, 8);
			for (int i = 0; i < num; i++)
			{
				Vector3 onUnitSphere = Random.onUnitSphere;
				onUnitSphere.y *= 0.3f;
				FX.Cut(center + Random.insideUnitSphere * 0.5f, FX.CutDirection(onUnitSphere, 70f), Random.Range(1.5f, 3.5f), Random.Range(0.3f, 0.55f), Random.Range(0.8f, 1.4f), scar: false, Random.value < 0.5f);
			}
			FX.Particles(center, Blood, 30, 4f, 0.09f, 0.8f, 0f, 0.4f, 1.2f, null, 1f, inward: false, 0f);
			SoundBank.PlayAt("flurry", center, 0.85f, 35f, Random.Range(0.92f, 1.08f));
		}

		public static void CaptureBegin(int playerIdx, ulong enemyId, float duration)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			CaptureEndVisual(playerIdx);
			EnemyAI val = Net.FindEnemy(enemyId);
			PlayerControllerB val2 = JJK.PlayerByIndex(playerIdx);
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null))
			{
				GameObject val3 = new GameObject("JJK_CaptureVortex");
				val3.transform.SetParent(((Component)val).transform, false);
				val3.transform.position = WorldOps.EnemyCenter(val);
				CaptureVortex captureVortex = val3.AddComponent<CaptureVortex>();
				captureVortex.Player = val2;
				captureVortex.Enemy = val;
				captureVortex.Duration = duration;
				vortices[playerIdx] = val3;
			}
		}

		private static void CaptureEndVisual(int playerIdx)
		{
			if (vortices.TryGetValue(playerIdx, out GameObject value))
			{
				FX.Destroy(value);
				vortices.Remove(playerIdx);
			}
		}

		public static void CaptureEnd(int playerIdx, bool success, Vector3 pos)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_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_00be: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			CaptureEndVisual(playerIdx);
			if (!success)
			{
				SoundBank.PlayAt("capture_fail", pos, 0.8f, 25f);
				return;
			}
			Fader fader = FX.Sphere(pos, 3f, FX.GlowInstance(FX.Black, 0f, 0.95f)).AddComponent<Fader>();
			fader.Life = 0.45f;
			fader.ScaleFrom = 3f;
			fader.ScaleTo = 0.05f;
			FX.Particles(pos, FX.CurseViolet, 60, 7f, 0.12f, 0.5f, 0f, 2.5f, 0f, null, 1f, inward: true);
			FX.FlashLight(pos, FX.Purple, 30000f, 12f, 0.8f);
			FX.Shockwave(pos, FX.CurseViolet, 6f, 0.6f, 0.3f);
			SoundBank.PlayAt("capture_done", pos);
			PlayerControllerB val = JJK.PlayerByIndex(playerIdx);
			if ((Object)(object)val != (Object)null)
			{
				Homing homing = FX.Sphere(pos, 0.35f, FX.Glow(FX.CurseViolet, 3f)).AddComponent<Homing>();
				homing.Target = ((Component)val).transform;
				homing.Offset = Vector3.up * 1.2f;
				if ((Object)(object)val == (Object)(object)JJK.Local)
				{
					FX.Shake((ScreenShakeType)0);
					PostFx.Flash(FX.CurseViolet, 0.5f, 0.05f, 0.1f, 0.7f, 0.6f);
				}
			}
		}

		public static void ReleaseSpirit(Vector3 pos)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0073: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			Vector3 pos2 = pos + Vector3.up;
			Fader fader = FX.Sphere(pos2, 0.2f, FX.GlowInstance(FX.Black, 0f, 0.95f)).AddComponent<Fader>();
			fader.Life = 0.7f;
			fader.ScaleFrom = 0.2f;
			fader.ScaleTo = 3.5f;
			fader.FadeAlpha = true;
			FX.Shockwave(pos2, FX.Purple, 7f, 0.7f, 0.35f);
			FX.Particles(pos2, FX.CurseViolet, 80, 6f, 0.15f, 1.2f, 0f, 0.6f, -0.4f);
			FX.FlashLight(pos2, FX.Purple, 40000f, 14f, 1f);
			SoundBank.PlayAt("release", pos2, 1f, 45f);
			FX.ShakeAt(pos2, 8f, 20f);
		}

		public static void AllyAttack(Vector3 from, Vector3 to)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0078: 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_0082: 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_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_009c: 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_00bc: 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)
			Vector3 val = to - from;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			val = Vector3.Cross(normalized, Vector3.up);
			Vector3 normalized2 = ((Vector3)(ref val)).normalized;
			for (int i = -1; i <= 1; i++)
			{
				Vector3 val2 = normalized2 * ((float)i * 0.18f);
				FX.FlashLine((Vector3[])(object)new Vector3[2]
				{
					to + val2 + Vector3.up * 0.7f,
					to + val2 - Vector3.up * 0.7f + normalized * 0.3f
				}, 0.04f, FX.Purple, 0.25f, 3f);
			}
			FX.Particles(to, FX.CurseViolet, 12, 3f, 0.08f, 0.4f);
			SoundBank.PlayAt("ally_hit", to, 0.8f, 25f, Random.Range(0.85f, 1.1f));
		}

		public static void Clap(int playerIdx, Vector3 a, Vector3 b)
		{
			//IL_0080: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_009c: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = JJK.PlayerByIndex(playerIdx);
			if ((Object)(object)val != (Object)null)
			{
				SoundBank.PlayAt("boogie_clap", Chest(val), 1f, 60f, Random.Range(0.97f, 1.03f));
				FX.Particles(Hand(val), FX.Gold, 10, 2f, 0.05f, 0.3f);
			}
			Vector3[] array = (Vector3[])(object)new Vector3[2] { a, b };
			foreach (Vector3 val2 in array)
			{
				if (!(val2 == Vector3.zero))
				{
					CursedAura.Burst(val2 + Vector3.up * 0.9f);
					SoundBank.PlayAt(((Object)(object)SoundBank.Get("boogie_switch") != (Object)null) ? "boogie_switch" : "boogie_swap", val2, 0.9f, 35f, Random.Range(0.96f, 1.04f));
				}
			}
			PlayerControllerB local = JJK.Local;
			if ((Object)(object)local != (Object)null && (Vector3.Distance(((Component)local).transform.position, a) < 2f || Vector3.Distance(((Component)local).transform.position, b) < 2f))
			{
				PostFx.Flash(CursedAura.Blue, 0.35f, 0.02f, 0.05f, 0.35f, 1f, 0f, -0.25f);
			}
		}

		private static IEnumerator FlashQuake()
		{
			FX.Shake((ScreenShakeType)3);
			yield return (object)new WaitForSeconds(0.12f);
			FX.Shake((ScreenShakeType)3);
			yield return (object)new WaitForSeconds(0.2f);
			FX.Shake((ScreenShakeType)1);
		}

		public static void CounterStance(int playerIdx, float duration)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0034: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = JJK.PlayerByIndex(playerIdx);
			if (!((Object)(object)val == (Object)null))
			{
				GameObject val2 = new GameObject("JJK_CounterAura");
				val2.transform.SetParent(((Component)val).transform, false);
				val2.transform.localPosition = Vector3.up * 1f;
				FX.Particles(val2.transform.position, FX.Red, 0, 1.5f, 0.06f, 0.5f, 40f, 0.6f, -0.6f, val2.transform, duration);
				FX.Particles(val2.transform.position, FX.Black, 0, 1.2f, 0.09f, 0.6f, 30f, 0.7f, -0.4f, val2.transform, duration);
				FX.AddLight(val2, FX.Red, 2500f, 4f);
				Object.Destroy((Object)(object)val2, duration);
				SoundBank.PlayAt("counter_stance", Chest(val), 1f, 30f);
				if ((Object)(object)val == (Object)(object)JJK.Local)
				{
					PostFx.Flash(FX.BloodRed, 0.25f, 0.1f, Mathf.Max(0f, duration - 0.6f), 0.5f, 0f, 0.35f, 0f, 0f, 0f, 0f, FX.BloodRed * 0.5f);
				}
			}
		}

		public static void BlackFlashWindup(int playerIdx, EnemyAI? e, float hold)
		{
			//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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = JJK.PlayerByIndex(playerIdx);
			Vector3 val2 = (((Object)(object)e != (Object)null) ? WorldOps.EnemyCenter(e) : (((Object)(object)val != (Object)null) ? Chest(val) : Vector3.zero));
			if (!Cfg.AlternativeSounds.Value && (Object)(object)SoundBank.Get("black_flash_vfx") != (Object)null)
			{
				SoundBank.PlayAt("black_flash_vfx", val2, 1f, 70f);
			}
			if ((Object)(object)e != (Object)null)
			{
				BlackFlashHold.Begin(e, hold);
			}
			if ((Object)(object)val != (Object)null)
			{
				ArmPoser.PunchWindup(val, hold, ((Object)(object)e != (Object)null) ? new Vector3?(val2 - ((Component)val).transform.position) : ((Vector3?)null));
			}
			FX.ShakeAt(val2, 6f, 15f);
			if ((Object)(object)val == (Object)(object)JJK.Local)
			{
				PostFx.Flash(FX.BloodRed, 0.3f, 0.2f, hold - 0.3f, 0.1f, 0f, 0.5f, 0f, 0f, 0.6f, 0f, Color.black);
			}
		}

		public static void BlackFlash(int playerIdx, Vector3 pos)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_008e: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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_0179: 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_0194: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: 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_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: 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_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = JJK.PlayerByIndex(playerIdx);
			ArmPoser.PunchHit(val, pos);
			Vector3 a = (((Object)(object)val != (Object)null) ? Hand(val) : pos);
			for (int i = 0; i < 7; i++)
			{
				Vector3 b = pos + Random.onUnitSphere * Random.Range(1.5f, 3.5f);
				FX.Lightning(pos, b, (i % 2 == 0) ? FX.Black : FX.Red, 0.07f, 0.45f);
			}
			FX.Lightning(a, pos, FX.Red, 0.09f, 0.35f, 2);
			FX.Lightning(a, pos, FX.Black, 0.12f, 0.4f, 2);
			Fader fader = FX.Sphere(pos, 0.3f, FX.GlowInstance(FX.Black, 0f, 0.9f)).AddComponent<Fader>();
			fader.Life = 0.35f;
			fader.ScaleFrom = 0.3f;
			fader.ScaleTo = 4f;
			fader.FadeAlpha = true;
			FX.Shockwave(pos, FX.Red, 6f, 0.5f, 0.4f);
			FX.Particles(pos, FX.Red, 50, 9f, 0.08f, 0.5f, 0f, 0.3f);
			FX.Particles(pos, FX.Black, 50, 7f, 0.12f, 0.6f, 0f, 0.3f);
			FX.FlashLight(pos, FX.Red, 90000f, 18f, 0.6f);
			Fader fader2 = FX.Sphere(pos, 0.3f, FX.GlowInstance(new Color(0.6f, 0.02f, 0.02f), 2f, 0.7f)).AddComponent<Fader>();
			fader2.Life = 0.5f;
			fader2.ScaleFrom = 0.5f;
			fader2.ScaleTo = 7f;
			fader2.FadeAlpha = true;
			for (int j = 0; j < 6; j++)
			{
				Vector3 b2 = pos + Random.onUnitSphere * Random.Range(3f, 6f);
				FX.Lightning(pos, b2, (j % 2 == 0) ? FX.Red : FX.Black, 0.1f, 0.6f, 2);
			}
			FX.FlashLight(pos, new Color(1f, 0.1f, 0.05f), 220000f, 25f, 0.25f);
			BlackFlashAfter.Embers(pos);
			if (Cfg.AlternativeSounds.Value || (Object)(object)SoundBank.Get("black_flash_vfx") == (Object)null)
			{
				SoundBank.PlayAt("black_flash", pos, 1f, 70f);
			}
			FX.ShakeAt(pos, 14f, 40f, veryStrong: true);
			if ((Object)(object)Runner.Instance != (Object)null && FX.DistToLocal(pos) < 25f)
			{
				((MonoBehaviour)Runner.Instance).StartCoroutine(FlashQuake());
			}
			if ((Object)(object)val == (Object)(object)JJK.Local)
			{
				PostFx.Flash(Color.black, 1f, 0f, 0.06f, 0.08f, 0f, 0f, 0f, 0f, 1f, 1f);
				PostFx.Flash(FX.Red, 0.9f, 0.05f, 0.1f, 0.7f, 1f, 0.6f, -0.55f, 0f, 1f, 0.9f);
			}
		}
	}
	public class Homing : MonoBehaviour
	{
		public Transform? Target;

		public Vector3 Offset;

		private float t;

		private void Update()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			t += Time.deltaTime;
			if ((Object)(object)Target == (Object)null || t > 3f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Vector3 val = Target.position + Offset;
			((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, val, (6f + t * 18f) * Time.deltaTime);
			if (Vector3.Distance(((Component)this).transform.position, val) < 0.2f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class CaptureVortex : MonoBehaviour
	{
		public PlayerControllerB? Player;

		public EnemyAI? Enemy;

		public float Duration = 5f;

		private float t;

		private float nextBolt;

		private GameObject core;

		private AudioSource? loop;

		private void Start()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			core = FX.Sphere(((Component)this).transform.position, 0.2f, FX.GlowInstance(FX.Black, 0f, 0.85f), ((Component)this).transform);
			FX.Particles(((Component)this).transform.position, FX.CurseViolet, 0, 4f, 0.12f, 0.8f, 70f, 2.2f, 0f, ((Component)this).transform, Duration + 1f, inward: true);
			FX.Particles(((Component)this).transform.position, FX.Black, 0, 3f, 0.16f, 0.9f, 40f, 2.6f, 0f, ((Component)this).transform, Duration + 1f, inward: true);
			FX.AddLight(((Component)this).gameObject, FX.Purple, 8000f, 8f);
			loop = SoundBank.Loop("capture_loop", ((Component)this).transform, 0.9f, 35f);
		}

		private void Update()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			t += Time.deltaTime;
			float num = Mathf.Clamp01(t / Duration);
			core.transform.localScale = Vector3.one * Mathf.Lerp(0.2f, 2.2f, num);
			if ((Object)(object)loop != (Object)null)
			{
				loop.pitch = Mathf.Lerp(0.8f, 1.4f, num);
			}
			if (Time.time > nextBolt && (Object)(object)Player != (Object)null && (Object)(object)Enemy != (Object)null)
			{
				nextBolt = Time.time + Mathf.Lerp(0.25f, 0.06f, num);
				FX.Lightning(Visuals.Hand(Player), ((Component)this).transform.position + Random.insideUnitSphere * 0.8f, (Random.value < 0.5f) ? FX.Purple : FX.Black, 0.03f + 0.04f * num, 0.18f);
			}
		}
	}
	public static class ModelLoader
	{
		private static GameObject? shrineTemplate;

		private static bool tried;

		private static readonly Dictionary<string, string> texPrefix = new Dictionary<string, string>
		{
			{ "Shrine_Material", "shrine" },
			{ "Mouths_Material", "mouths" },
			{ "Bull_Skull_Material", "bullskull" },
			{ "Human_Skull_Material", "skull" },
			{ "Extra_Stuff_Material", "extra" }
		};

		private static Bounds? shrineBounds;

		public static Bounds ShrineBounds
		{
			get
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: 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_0148: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_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_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0100: 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_011e: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: Unknown result type (might be due to invalid IL or missing references)
				if (shrineBounds.HasValue)
				{
					return shrineBounds.Value;
				}
				Preload();
				Bounds val = default(Bounds);
				((Bounds)(ref val))..ctor(new Vector3(0f, 0.5f, 0f), new Vector3(1.4f, 1f, 1.2f));
				if ((Object)(object)shrineTemplate != (Object)null)
				{
					bool flag = false;
					MeshFilter[] componentsInChildren = shrineTemplate.GetComponentsInChildren<MeshFilter>(true);
					foreach (MeshFilter val2 in componentsInChildren)
					{
						if ((Object)(object)val2.sharedMesh == (Object)null)
						{
							continue;
						}
						Matrix4x4 val3 = shrineTemplate.transform.worldToLocalMatrix * ((Component)val2).transform.localToWorldMatrix;
						Bounds bounds = val2.sharedMesh.bounds;
						for (int j = 0; j < 8; j++)
						{
							Vector3 val4 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1))));
							Vector3 val5 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(val4);
							if (!flag)
							{
								((Bounds)(ref val))..ctor(val5, Vector3.zero);
								flag = true;
							}
							else
							{
								((Bounds)(ref val)).Encapsulate(val5);
							}
						}
					}
				}
				shrineBounds = val;
				return val;
			}
		}

		public static void Preload()
		{
			if (tried)
			{
				return;
			}
			tried = true;
			try
			{
				shrineTemplate = LoadShrine();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Malevolent Shrine model failed to load, using the simple shrine: " + ex.Message));
			}
		}

		public static GameObject? SpawnShrine(Vector3 basePos, Quaternion rot, float height)
		{
			//IL_002f: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			Preload();
			if ((Object)(object)shrineTemplate == (Object)null)
			{
				return null;
			}
			GameObject obj = Object.Instantiate<GameObject>(shrineTemplate);
			((Object)obj).name = "JJK_ShrineModel";
			obj.transform.SetPositionAndRotation(basePos, rot);
			obj.transform.localScale = Vector3.one * height;
			obj.SetActive(true);
			return obj;
		}

		private static Texture2D? LoadTex(string path, bool linear)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			if (!File.Exists(path))
			{
				return null;
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true, linear);
			if (!ImageConversion.LoadImage(val, File.ReadAllBytes(path), false))
			{
				return null;
			}
			((Texture)val).wrapMode = (TextureWrapMode)0;
			((Texture)val).anisoLevel = 4;
			val.Apply(true, true);
			return val;
		}

		private static GameObject? LoadShrine()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: 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_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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_01af: Expected O, but got Unknown
			//IL_01e2: 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_01fb: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			string path = Path.Combine(Plugin.PluginDir, "Models");
			string path2 = Path.Combine(path, "shrine.jjkm");
			if (!File.Exists(path2))
			{
				return null;
			}
			Shader val = Shader.Find("HDRP/Lit");
			GameObject val2 = new GameObject("JJK_ShrineTemplate");
			val2.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)val2);
			using BinaryReader binaryReader = new BinaryReader(File.OpenRead(path2));
			if (new string(binaryReader.ReadChars(4)) != "JJKM")
			{
				throw new Exception("bad header");
			}
			int num = binaryReader.ReadInt32();
			for (int i = 0; i < num; i++)
			{
				string text = Encoding.UTF8.GetString(binaryReader.ReadBytes(binaryReader.ReadInt32()));
				int num2 = binaryReader.ReadInt32();
				Vector3[] array = (Vector3[])(object)new Vector3[num2];
				Vector3[] array2 = (Vector3[])(object)new Vector3[num2];
				Vector2[] array3 = (Vector2[])(object)new Vector2[num2];
				for (int j = 0; j < num2; j++)
				{
					array[j] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
				}
				for (int k = 0; k < num2; k++)
				{
					array2[k] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
				}
				for (int l = 0; l < num2; l++)
				{
					array3[l] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle());
				}
				int num3 = binaryReader.ReadInt32();
				int[] array4 = new int[num3];
				for (int m = 0; m < num3; m++)
				{
					array4[m] = binaryReader.ReadInt32();
				}
				Mesh val3 = new Mesh
				{
					name = text,
					indexFormat = (IndexFormat)(num2 > 65000)
				};
				val3.vertices = array;
				val3.normals = array2;
				val3.uv = array3;
				val3.triangles = array4;
				val3.RecalculateBounds();
				val3.RecalculateTangents();
				Material val4 = new Material(val)
				{
					name = "JJK_" + text
				};
				val4.SetColor("_BaseColor", Color.white);
				val4.SetFloat("_Smoothness", 0.25f);
				if (texPrefix.TryGetValue(text, out string value))
				{
					Texture2D val5 = LoadTex(Path.Combine(path, value + "_albedo.jpg"), linear: false);
					Texture2D val6 = LoadTex(Path.Combine(path, value + "_normal.png"), linear: true);
					if ((Object)(object)val5 != (Object)null)
					{
						val4.SetTexture("_BaseColorMap", (Texture)(object)val5);
					}
					if ((Object)(object)val6 != (Object)null)
					{
						val4.SetTexture("_NormalMap", (Texture)(object)val6);
						val4.SetFloat("_NormalScale", 1f);
					}
					if (value == "mouths")
					{
						val4.SetColor("_EmissiveColor", new Color(0.35f, 0.02f, 0.02f) * 3f);
					}
				}
				try
				{
					HDMaterial.ValidateMaterial(val4);
				}
				catch
				{
				}
				GameObject val7 = new GameObject(text);
				val7.transform.SetParent(val2.transform, false);
				val7.AddComponent<MeshFilter>().sharedMesh = val3;
				((Renderer)val7.AddComponent<MeshRenderer>()).sharedMaterial = val4;
			}
			Plugin.Log.LogInfo((object)$"Loaded Malevolent Shrine model ({num} parts).");
			return val2;
		}
	}
	public static class FX
	{
		public enum CutStyle
		{
			Black,
			White,
			Scar
		}

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

		private static Shader? unlit;

		private static Shader? lit;

		public static readonly Color Blue = new Color(0.25f, 0.55f, 1f);

		public static readonly Color Red = new Color(1f, 0.12f, 0.1f);

		public static readonly Color Purple = new Color(0.62f, 0.18f, 1f);

		public static readonly Color Black = new Color(0.02f, 0.01f, 0.02f);

		public static readonly Color BloodRed = new Color(0.55f, 0.02f, 0.03f);

		public static readonly Color White = new Color(1f, 0.97f, 0.94f);

		public static readonly Color CurseViolet = new Color(0.35f, 0.05f, 0.45f);

		public static readonly Color Wood = new Color(0.55f, 0.36f, 0.2f);

		public static readonly Color Gold = new Color(1f, 0.8f, 0.3f);

		private static Texture2D? texBlack;

		private static Texture2D? texWhite;

		private static Texture2D? texScar;

		private static AnimationCurve? lensCurve;

		private static Material? decalTemplate;

		private static bool decalSearched;

		private static Texture2D? scarDecalTex;

		public static Shader Unlit
		{
			get
			{
				object obj = unlit;
				if (obj == null)
				{
					obj = Shader.Find("HDRP/Unlit") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Standard");
					unlit = (Shader?)obj;
				}
				return (Shader)obj;
			}
		}

		private static Shader Lit
		{
			get
			{
				object obj = lit;
				if (obj == null)
				{
					obj = Shader.Find("HDRP/Lit") ?? Shader.Find("Standard");
					lit = (Shader?)obj;
				}
				return (Shader)obj;
			}
		}

		public static Material Glow(Color c, float emission = 1f, float alpha = 1f)
		{
			//IL_000d: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_00af: 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_00d6: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			string text = $"g{c.r:F2}{c.g:F2}{c.b:F2}{emission:F1}{alpha:F2}";
			if (cache.TryGetValue(text, out Material value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			value = new Material(Unlit)
			{
				name = "JJK_" + text
			};
			Color val = default(Color);
			((Color)(ref val))..ctor(c.r, c.g, c.b, alpha);
			value.SetColor("_UnlitColor", val);
			value.SetColor("_BaseColor", val);
			value.SetColor("_Color", val);
			try
			{
				if (alpha < 0.999f)
				{
					HDMaterial.SetSurfaceType(value, true);
				}
				value.SetColor("_EmissiveColor", c * emission * 6f);
				value.SetFloat("_EmissiveExposureWeight", 0.6f);
				HDMaterial.ValidateMaterial(value);
			}
			catch
			{
			}
			cache[text] = value;
			return value;
		}

		public static Material GlowInstance(Color c, float emission = 1f, float alpha = 1f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			return new Material(Glow(c, emission, alpha));
		}

		public static Material Solid(Color c, float smoothness = 0.2f)
		{
			//IL_000d: 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_0029: 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_007a: Expected O, but got Unknown
			//IL_0080: 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)
			string text = $"s{c.r:F2}{c.g:F2}{c.b:F2}{smoothness:F2}";
			if (cache.TryGetValue(text, out Material value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			value = new Material(Lit)
			{
				name = "JJK_" + text
			};
			value.SetColor("_BaseColor", c);
			value.SetColor("_Color", c);
			value.SetFloat("_Smoothness", smoothness);
			try
			{
				HDMaterial.ValidateMaterial(value);
			}
			catch
			{
			}
			cache[text] = value;
			return value;
		}

		public unsafe static GameObject Prim(PrimitiveType type, Vector3 pos, Vector3 scale, Material mat, Transform? parent = null, Quaternion? rot = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.CreatePrimitive(type);
			Collider component = val.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			((Object)val).name = "JJK_" + ((object)(*(PrimitiveType*)(&type))/*cast due to .constrained prefix*/).ToString();
			if ((Object)(object)parent != (Object)null)
			{
				val.transform.SetParent(parent, false);
			}
			val.transform.position = pos;
			val.transform.rotation = (Quaternion)(((??)rot) ?? Quaternion.identity);
			val.transform.localScale = scale;
			Renderer component2 = val.GetComponent<Renderer>();
			component2.sharedMaterial = mat;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			return val;
		}

		public static GameObject Sphere(Vector3 pos, float size, Material mat, Transform? parent = null)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return Prim((PrimitiveType)0, pos, Vector3.one * size, mat, parent);
		}

		public static HDAdditionalLightData? AddLight(GameObject go, Color c, float lumens, float range)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				HDAdditionalLightData obj = GameObjectExtension.AddHDLight(go, (HDLightTypeAndShape)0);
				obj.SetColor(c, -1f);
				obj.SetIntensity(lumens);
				obj.SetRange(range);
				obj.affectsVolumetric = false;
				return obj;
			}
			catch (Exception ex)
			{
				if (Cfg.DebugLogging.Value)
				{
					Plugin.Log.LogWarning((object)("light: " + ex.Message));
				}
				return null;
			}
		}

		public static GameObject FlashLight(Vector3 pos, Color c, float lumens, float range, float duration)
		{
			//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_0010: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			GameObject val = new GameObject("JJK_Flash");
			val.transform.position = pos;
			HDAdditionalLightData lightData = AddLight(val, c, lumens, range);
			Fader fader = val.AddComponent<Fader>();
			fader.Life = duration;
			fader.LightData = lightData;
			fader.LightStart = lumens;
			return val;
		}

		public static LineRenderer Line(Vector3[] pts, float width, Material mat, Transform? parent = null)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			GameObject val = new GameObject("JJK_Line");
			if ((Object)(object)parent != (Object)null)
			{
				val.transform.SetParent(parent, false);
			}
			LineRenderer obj = val.AddComponent<LineRenderer>();
			obj.useWorldSpace = true;
			obj.positionCount = pts.Length;
			obj.SetPositions(pts);
			obj.startWidth = width;
			obj.endWidth = width * 0.4f;
			((Renderer)obj).sharedMaterial = mat;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			obj.numCapVertices = 2;
			return obj;
		}

		public static void FlashLine(Vector3[] pts, float width, Color c, float life, float emission = 2f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer val = Line(pts, width, GlowInstance(c, emission));
			Fader fader = ((Component)val).gameObject.AddComponent<Fader>();
			fader.Life = life;
			fader.LineWidth = width;
			fader.Line = val;
		}

		public static Vector3[] Jagged(Vector3 a, Vector3 b, int segments, float jitter)
		{
			//IL_0013: 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_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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[segments + 1];
			for (int i = 0; i <= segments; i++)
			{
				float num = (float)i / (float)segments;
				Vector3 val = Vector3.Lerp(a, b, num);
				if (i != 0 && i != segments)
				{
					val += Random.insideUnitSphere * jitter;
				}
				array[i] = val;
			}
			return array;
		}

		public static void Lightning(Vector3 a, Vector3 b, Color c, float width, float life, int bolts = 1)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Distance(a, b);
			for (int i = 0; i < bolts; i++)
			{
				FlashLine(Jagged(a, b, Mathf.Clamp((int)(num * 3f), 4, 24), Mathf.Clamp(num * 0.12f, 0.08f, 0.8f)), width, c, life * Random.Range(0.7f, 1.2f), 3f);
			}
		}

		public static ParticleSystem Particles(Vector3 pos, Color c, int burst, float speed, float size, float life, float rate = 0f, float radius = 0.2f, float gravity = 0f, Transform? parent = null, float duration = 1f, bool inward = false, float emission = 2f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00b8: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("JJK_Particles");
			if ((Object)(object)parent != (Object)null)
			{
				val.transform.SetParent(parent, false);
			}
			val.transform.position = pos;
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			val2.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val2.main;
			((MainModule)(ref main)).duration = duration;
			((MainModule)(ref main)).loop = rate > 0f;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(life * 0.6f, life);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(inward ? (0f - speed) : (speed * 0.4f), inward ? ((0f - speed) * 0.5f) : speed);
			((MainModule)(ref main)).startSize = new MinMaxCurve(size * 0.5f, size);
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(gravity);
			((MainModule)(ref main)).maxParticles = Mathf.Max(64, burst * 2 + (int)(rate * life * 2f));
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).playOnAwake = false;
			EmissionModule emission2 = val2.emission;
			((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(rate);
			if (burst > 0)
			{
				((EmissionModule)(ref emission2)).SetBursts((Burst[])(object)new Burst[1]
				{
					new Burst(0f, (short)burst)
				});
			}
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = radius;
			SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 1f, 1f, 0f));
			ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
			bool flag = c.r + c.g + c.b < 0.25f;
			((Renderer)component).sharedMaterial = ((emission > 0.05f && !flag) ? GlowFx.SoftMat(c, emission) : GlowFx.SmokeMat(c, 0.9f));
			component.renderMode = (ParticleSystemRenderMode)0;
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			val2.Play();
			if (rate <= 0f)
			{
				Object.Destroy((Object)(object)val, duration + life + 0.5f);
			}
			return val2;
		}

		public static void Shake(ScreenShakeType t)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (!Cfg.ScreenShake.Value || (Object)(object)HUDManager.Instance == (Object)null)
			{
				return;
			}
			try
			{
				HUDManager.Instance.ShakeCamera(t);
			}
			catch
			{
			}
		}

		public static void ShakeAt(Vector3 pos, float strongRange, float weakRange, bool veryStrong = false)
		{
			//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)
			PlayerControllerB local = JJK.Local;
			if (!((Object)(object)local == (Object)null))
			{
				float num = Vector3.Distance(((Component)local).transform.position, pos);
				if (num < strongRange)
				{
					Shake((ScreenShakeType)((!veryStrong) ? 1 : 3));
				}
				else if (num < weakRange)
				{
					Shake((ScreenShakeType)0);
				}
			}
		}

		public static float DistToLocal(Vector3 pos)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB local = JJK.Local;
			if (!((Object)(object)local == (Object)null))
			{
				return Vector3.Distance(((Component)local.gameplayCamera).transform.position, pos);
			}
			return 9999f;
		}

		public static void Shockwave(Vector3 pos, Color c, float maxSize, float life, float alpha = 0.6f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Fader fader = Sphere(pos, 0.1f, GlowInstance(c, 1.5f, alpha)).AddComponent<Fader>();
			fader.Life = life;
			fader.ScaleFrom = 0.1f;
			fader.ScaleTo = maxSize;
			fader.FadeAlpha = true;
		}

		public static void Destroy(GameObject? go)
		{
			if ((Object)(object)go != (Object)null)
			{
				Object.Destroy((Object)(object)go);
			}
		}

		private static float Smooth(float e0, float e1, float x)
		{
			float num = Mathf.Clamp01((x - e0) / (e1 - e0));
			return num * num * (3f - 2f * num);
		}

		private static Texture2D MakeCutTexture(CutStyle style)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(4, 256, (TextureFormat)4, true, false)
			{
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)2,
				anisoLevel = 4
			};
			Color[] array = (Color[])(object)new Color[1024];
			Color val2 = (Color)(style switch
			{
				CutStyle.Scar => new Color(0.06f, 0f, 0f), 
				CutStyle.White => Color.white, 
				_ => Color.black, 
			});
			Color val3 = (Color)(style switch
			{
				CutStyle.Scar => new Color(0.22f, 0.05f, 0.05f), 
				CutStyle.White => Color.black, 
				_ => Color.white, 
			});
			for (int i = 0; i < 256; i++)
			{
				float x = Mathf.Abs(((float)i + 0.5f) / 256f * 2f - 1f);
				float num = Smooth(0.4f, 0.5f, x);
				float num2 = 1f - Smooth(0.66f, 1f, x);
				if (style == CutStyle.Scar)
				{
					num2 *= 0.85f;
				}
				Color val4 = Color.Lerp(val2, val3, num);
				val4.a = num2;
				for (int j = 0; j < 4; j++)
				{
					array[i * 4 + j] = val4;
				}
			}
			val.SetPixels(array);
			val.Apply(true, true);
			return val;
		}

		private static Material CutMaterial(CutStyle style)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = (Texture2D)(style switch
			{
				CutStyle.Scar => texScar ?? (texScar = MakeCutTexture(CutStyle.Scar)), 
				CutStyle.White => texWhite ?? (texWhite = MakeCutTexture(CutStyle.White)), 
				_ => texBlack ?? (texBlack = MakeCutTexture(CutStyle.Black)), 
			});
			Material val2 = new Material(Unlit)
			{
				name = "JJK_Cut"
			};
			val2.SetTexture("_UnlitColorMap", (Texture)(object)val);
			val2.SetColor("_UnlitColor", Color.white);
			try
			{
				HDMaterial.SetSurfaceType(val2, true);
				HDMaterial.ValidateMaterial(val2);
			}
			catch
			{
			}
			return val2;
		}

		private static AnimationCurve LensCurve()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			if (lensCurve != null)
			{
				return lensCurve;
			}
			Keyframe[] array = (Keyframe[])(object)new Keyframe[17];
			for (int i = 0; i <= 16; i++)
			{
				float num = (float)i / 16f;
				array[i] = new Keyframe(num, Mathf.Pow(Mathf.Sin(num * (float)Math.PI), 0.85f));
			}
			lensCurve = new AnimationCurve(array);
			for (int j = 0; j < array.Length; j++)
			{
				lensCurve.SmoothTangents(j, 0f);
			}
			return lensCurve;
		}

		public static void Cut(Vector3 center, Vector3 dir, float length, float life, float widthScale = 1f, bool scar = false, bool white = false, float sweep = -1f)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0166: 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_016e: 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_0179: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			dir = ((((Vector3)(ref dir)).sqrMagnitude < 0.0001f) ? Vector3.right : ((Vector3)(ref dir)).normalized);
			int style = (scar ? 2 : (white ? 1 : 0));
			GameObject val = new GameObject(scar ? "JJK_CutScar" : "JJK_Cut");
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			val2.useWorldSpace = true;
			val2.alignment = (LineAlignment)0;
			val2.textureMode = (LineTextureMode)0;
			val2.numCapVertices = 0;
			val2.numCornerVertices = 2;
			((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)val2).receiveShadows = false;
			val2.widthCurve = LensCurve();
			float width = (val2.widthMultiplier = Mathf.Clamp(length * 0.075f, 0.07f, 0.5f) * widthScale);
			Material mat = (((Renderer)val2).sharedMaterial = CutMaterial((CutStyle)style));
			Vector3 val4 = (((Object)(object)JJK.Local != (Object)null) ? ((Component)JJK.Local.gameplayCamera).transform.position : (center - Vector3.forward));
			Vector3 val5 = dir;
			Vector3 val6 = val4 - center;
			Vector3 val7 = Vector3.Cross(val5, ((Vector3)(ref val6)).normalized);
			if (((Vector3)(ref val7)).sqrMagnitude < 0.0001f)
			{
				val7 = Vector3.up;
			}
			((Vector3)(ref val7)).Normalize();
			float num2 = Random.Range(-0.07f, 0.07f) * length;
			CutFx cutFx = val.AddComponent<CutFx>();
			cutFx.Line = val2;
			cutFx.Mat = mat;
			cutFx.Life = life;
			cutFx.Width = width;
			cutFx.Start0 = center - dir * length * 0.5f;
			cutFx.Dir = dir * length;
			cutFx.Normal = val7 * num2;
			cutFx.Sweep = (scar ? 0f : ((sweep >= 0f) ? sweep : Mathf.Min(0.07f, life * 0.25f)));
			cutFx.Scar = scar;
			cutFx.Init();
		}

		private static Material? DecalTemplate()
		{
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			if ((Object)(object)decalTemplate != (Object)null || decalSearched)
			{
				return decalTemplate;
			}
			decalSearched = true;
			try
			{
				PlayerControllerB local = JJK.Local;
				if ((Object)(object)local != (Object)null && local.playerBloodPooledObjects != null)
				{
					foreach (GameObject playerBloodPooledObject in local.playerBloodPooledObjects)
					{
						DecalProjector val = (((Object)(object)playerBloodPooledObject != (Object)null) ? playerBloodPooledObject.GetComponentInChildren<DecalProjector>(true) : null);
						if ((Object)(object)val != (Object)null && (Object)(object)val.material != (Object)null)
						{
							decalTemplate = val.material;
							break;
						}
					}
				}
				if ((Object)(object)decalTemplate == (Object)null)
				{
					DecalProjector[] array = Resources.FindObjectsOfTypeAll<DecalProjector>();
					foreach (DecalProjector val2 in array)
					{
						if ((Object)(object)val2 != (Object)null && (Object)(object)val2.material != (Object)null)
						{
							decalTemplate = val2.material;
							break;
						}
					}
				}
				if ((Object)(object)decalTemplate == (Object)null)
				{
					Shader val3 = Shader.Find("HDRP/Decal");
					if ((Object)(object)val3 != (Object)null)
					{
						decalTemplate = new Material(val3);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("No decal material: " + ex.Message));
			}
			if ((Object)(object)decalTemplate == (Object)null)
			{
				decalSearched = false;
			}
			return decalTemplate;
		}

		private static Texture2D ScarDecalTexture()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_0038: Expected O, but got Unknown
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)scarDecalTex != (Object)null)
			{
				return scarDecalTex;
			}
			Texture2D val = new Texture2D(256, 64, (TextureFormat)4, true, false)
			{
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)2,
				anisoLevel = 4
			};
			Color[] array = (Color[])(object)new Color[16384];
			for (int i = 0; i < 256; i++)
			{
				float num = Mathf.Pow(Mathf.Sin(((float)i + 0.5f) / 256f * (float)Math.PI), 0.85f) * 0.9f;
				for (int j = 0; j < 64; j++)
				{
					float x = Mathf.Abs(((float)j + 0.5f) / 64f * 2f - 1f);
					float num2 = ((num <= 0.001f) ? 0f : (1f - Smooth(num * 0.55f, num, x)));
					float num3 = ((num <= 0.001f) ? 0f : (1f - Smooth(0f, num * 0.6f, x)));
					Color val2 = Color.Lerp(new Color(0.2f, 0.03f, 0.03f), new Color(0.04f, 0f, 0f), num3);
					val2.a = num2 * 0.95f;
					array[j * 256 + i] = val2;
				}
			}
			val.SetPixels(array);
			val.Apply(true, true);
			return scarDecalTex = val;
		}

		public static void Scar(Vector3 point, Vector3 normal, Vector3 dir, float length, float life)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_0074: 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_0081: 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_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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e5: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			Material val = DecalTemplate();
			if (!((Object)(object)val == (Object)null))
			{
				normal = ((Vector3)(ref normal)).normalized;
				Vector3 val2 = Vector3.ProjectOnPlane(dir, normal);
				if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f)
				{
					val2 = Vector3.ProjectOnPlane(Vector3.right, normal);
				}
				if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f)
				{
					val2 = Vector3.ProjectOnPlane(Vector3.forward, normal);
				}
				((Vector3)(ref val2)).Normalize();
				Vector3 val3 = -normal;
				GameObject val4 = new GameObject("JJK_Scar");
				val4.transform.position = point;
				val4.transform.rotation = Quaternion.LookRotation(val3, Vector3.Cross(val3, val2));
				DecalProjector val5 = val4.AddComponent<DecalProjector>();
				Material val6 = new Material(val)
				{
					name = "JJK_ScarDecal"
				};
				Texture2D val7 = ScarDecalTexture();
				if (val6.HasProperty("_BaseColorMap"))
				{
					val6.SetTexture("_BaseColorMap", (Texture)(object)val7);
				}
				if (val6.HasProperty("_BaseColor"))
				{
					val6.SetColor("_BaseColor", Color.white);
				}
				if (val6.HasProperty("_NormalMap"))
				{
					val6.SetTexture("_NormalMap", (Texture)null);
				}
				val5.material = val6;
				float num = Mathf.Clamp(length * 0.12f, 0.12f, 0.45f);
				val5.size = new Vector3(length, num, 0.9f);
				val5.pivot = Vector3.zero;
				val5.drawDistance = 120f;
				try
				{
					val5.startAngleFade = 160f;
					val5.endAngleFade = 180f;
				}
				catch
				{
				}
				val5.fadeFactor = 1f;
				DecalFader decalFader = val4.AddComponent<DecalFader>();
				decalFader.Life = life;
				decalFader.Mat = val6;
				decalFader.Projector = val5;
			}
		}

		public static Vector3 CutDirection(Vector3 viewForward, float maxTilt)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.Cross(Vector3.up, viewForward);
			if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
			{
				val = Vector3.right;
			}
			((Vector3)(ref val)).Normalize();
			return Quaternion.AngleAxis(Random.Range(0f - maxTilt, maxTilt), ((Vector3)(ref viewForward)).normalized) * val;
		}
	}
	public class Fader : MonoBehaviour
	{
		public float Life = 1f;

		public float ScaleFrom = -1f;

		public float ScaleTo = -1f;

		public bool FadeAlpha;

		public HDAdditionalLightData? LightData;

		public float LightStart;

		public LineRenderer? Line;

		public float LineWidth;

		public bool LineOpen;

		private float t;

		private Renderer? rend;

		private Color baseCol;

		private void Start()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			rend = ((Component)this).GetComponent<Renderer>();
			if ((Object)(object)rend != (Object)null && (Object)(object)rend.sharedMaterial != (Object)null && rend.sharedMaterial.HasProperty("_UnlitColor"))
			{
				baseCol = rend.sharedMaterial.GetColor("_UnlitColor");
			}
		}

		private void Update()
		{
			//IL_0042: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			t += Time.deltaTime;
			float num = Mathf.Clamp01(t / Mathf.Max(0.01f, Life));
			if (ScaleTo >= 0f)
			{
				((Component)this).transform.localScale = Vector3.one * Mathf.Lerp(ScaleFrom, ScaleTo, 1f - (1f - num) * (1f - num));
			}
			if (FadeAlpha && (Object)(object)rend != (Object)null && (Object)(object)rend.sharedMaterial != (Object)null)
			{
				Color val = baseCol;
				val.a = baseCol.a * (LineOpen ? Mathf.Clamp01((1f - num) / 0.6f) : (1f - num));
				rend.sharedMaterial.SetColor("_UnlitColor", val);
			}
			if ((Object)(object)LightData != (Object)null)
			{
				LightData.SetIntensity(LightStart * (1f - num) * (1f - num));
			}
			if ((Object)(object)Line != (Object)null)
			{
				if (LineOpen)
				{
					float num2 = LineWidth * Mathf.Min(1f, 0.25f + num / 0.12f);
					LineRenderer? line = Line;
					float startWidth = (Line.endWidth = num2);
					line.startWidth = startWidth;
				}
				else
				{
					Line.startWidth = LineWidth * (1f - num);
					Line.endWidth = LineWidth * 0.4f * (1f - num);
				}
			}
			if (t >= Life)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class DecalFader : MonoBehaviour
	{
		public float Life = 8f;

		public Material? Mat;

		public DecalProjector? Projector;

		private float t;

		private void Update()
		{
			t += Time.deltaTime;
			Mathf.Clamp01(t / Mathf.Max(0.01f, Life));
			float num = Mathf.Min(6f, Life * 0.3f);
			if ((Object)(object)Projector != (Object)null)
			{
				Projector.fadeFactor = Mathf.Clamp01((Life - t) / Mathf.Max(0.01f, num));
			}
			if (t >= Life)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)Mat != (Object)null)
			{
				Object.Destroy((Object)(object)Mat);
			}
		}
	}
	public class CutFx : MonoBehaviour
	{
		public LineRenderer Line;

		public Material? Mat;

		public float Life;

		public float Width;

		public float Sweep;

		public bool Scar;

		public Vector3 Start0;

		public Vector3 Dir;

		public Vector3 Normal;

		private const int N = 24;

		private readonly Vector3[] pts = (Vector3[])(object)new Vector3[24];

		private float t;

		private Vector3 At(float u)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			return Start0 + Dir * u + Normal * (1f - (2f * u - 1f) * (2f * u - 1f));
		}

		public void Init()
		{
			Line.positionCount = 24;
			Apply((Sweep > 0f) ? 0.05f : 1f);
		}

		private void Apply(float reveal)
		{
			//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)
			for (int i = 0; i < 24; i++)
			{
				pts[i] = At(reveal * (float)i / 23f);
			}
			Line.SetPositions(pts);
		}

		private void Update()
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			t += Time.deltaTime;
			if (Sweep > 0f && t <= Sweep + Time.deltaTime)
			{
				Apply(Mathf.Clamp01(t / Sweep));
			}
			float num = Mathf.Clamp01(t / Mathf.Max(0.01f, Life));
			float num2 = (Scar ? 0.6f : 0.45f);
			float num3 = ((num < num2) ? 1f : (1f - (num - num2) / (1f - num2)));
			if ((Object)(object)Mat != (Object)null)
			{
				Mat.SetColor("_UnlitColor", new Color(1f, 1f, 1f, num3 * num3));
			}
			Line.widthMultiplier = Width * (Scar ? 1f : Mathf.Lerp(1f, 0.55f, num));
			if (t >= Life)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)Mat != (Object)null)
			{
				Object.Destroy((Object)(object)Mat);
			}
		}
	}
	public class Spinner : MonoBehaviour
	{
		public Vector3 Axis = Vector3.up;

		public float Speed = 90f;

		public float Bob;

		public float BobSpeed = 2f;

		private Vector3 basePos;

		private bool init;

		private void Update()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.Rotate(Axis, Speed * Time.deltaTime, (Space)1);
			if (Bob > 0f)
			{
				if (!init)
				{
					basePos = ((Component)this).transform.localPosition;
					init = true;
				}
				((Component)this).transform.localPosition = basePos + Vector3.up * Mathf.Sin(Time.time * BobSpeed) * Bob;
			}
		}
	}
	public class PostFx : MonoBehaviour
	{
		private class Pulse
		{
			public float Start;

			public float Attack;

			public float Hold;

			public float Release;

			public Color Tint;

			public float TintAmt;

			public float Chroma;

			public float Vignette;

			public float Distort;

			public float Exposure;

			public float Desat;

			public float Contrast;

			public Color VigColor;
		}

		public static PostFx? Instance;

		private readonly List<Pulse> pulses = new List<Pulse>();

		private readonly Dictionary<string, Pulse> sustained = new Dictionary<string, Pulse>();

		private Volume vol;

		private ColorAdjustments? color;

		private ChromaticAberration? chroma;

		private Vignette? vig;

		private LensDistortion? lens;

		private float nextLayerCheck;

		private bool layerMatched;

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

		private void Awake()
		{
			vol = ((Component)this).gameObject.AddComponent<Volume>();
			vol.isGlobal = true;
			vol.priority = 150f;
			vol.weight = 0f;
			VolumeProfile val = ScriptableObject.CreateInstance<VolumeProfile>();
			try
			{
				color = val.Add<ColorAdjustments>(true);
			}
			catch
			{
			}
			try
			{
				chroma = val.Add<ChromaticAberration>(true);
			}
			catch
			{
			}
			try
			{
				vig = val.Add<Vignette>(true);
			}
			catch
			{
			}
			try
			{
				lens = val.Add<LensDistortion>(true);
			}
			catch
			{
			}
			vol.sharedProfile = val;
		}

		public static void Flash(Color tint, float tintAmt, float attack, float hold, float release, float chroma = 0f, float vignette = 0f, float distort = 0f, float exposure = 0f, float desat = 0f, float contrast = 0f, Color? vigColor = null)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due