Decompiled source of RyomenSukuna v1.1.5

plugins/RyomenSukuna/RyomenSukuna.dll

Decompiled 14 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using EntityStates;
using GojoSatoruMod.Components;
using GojoSatoruMod.Content;
using GojoSatoruMod.States;
using GojoSatoruMod.Visuals;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RyomenSukuna")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.5.0")]
[assembly: AssemblyInformationalVersion("1.1.5+979ebb1e7dfa654951bfcb18204e3745b8f33ff9")]
[assembly: AssemblyProduct("RyomenSukuna")]
[assembly: AssemblyTitle("RyomenSukuna")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.5.0")]
[module: UnverifiableCode]
namespace GojoSatoruMod.Visuals
{
	internal sealed class RuntimeFugaPillar : MonoBehaviour
	{
		private const int TongueCount = 20;

		private const int CoreCount = 6;

		private const int Segments = 14;

		private const float ClimbSeconds = 0.62f;

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

		private LineRenderer[] tongues;

		private LineRenderer[] core;

		private Material tongueMaterial;

		private Material coreMaterial;

		private Color tongueBase;

		private Color coreBase;

		private Vector3 root;

		private float radius;

		private float height;

		private float ignition;

		private float fade = 1f;

		private float age;

		internal void Initialize(Vector3 basePosition, float effectRadius)
		{
			//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_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_003e: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			root = basePosition;
			radius = Mathf.Max(1f, effectRadius);
			tongueBase = new Color(1f, 0.42f, 0.03f, 0.95f);
			tongueMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaFugaPillarTongues", tongueBase, 1.5f);
			materials.Add(tongueMaterial);
			coreBase = new Color(1f, 0.86f, 0.42f, 0.95f);
			coreMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaFugaPillarCore", coreBase, 1.5f);
			materials.Add(coreMaterial);
			tongues = Build("FugaPillarTongue_", 20, tongueMaterial);
			core = Build("FugaPillarCore_", 6, coreMaterial);
		}

		internal void SetState(float takeHold, float remaining)
		{
			ignition = Mathf.Clamp01(takeHold);
			fade = Mathf.Clamp01(remaining);
		}

		private LineRenderer[] Build(string prefix, int count, Material material)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer[] array = (LineRenderer[])(object)new LineRenderer[count];
			for (int i = 0; i < count; i++)
			{
				GameObject val = new GameObject(prefix + i);
				val.transform.SetParent(((Component)this).transform, true);
				LineRenderer val2 = val.AddComponent<LineRenderer>();
				JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val2);
				val2.useWorldSpace = true;
				val2.positionCount = 14;
				val2.numCornerVertices = 3;
				val2.numCapVertices = 3;
				((Renderer)val2).material = material;
				array[i] = val2;
			}
			return array;
		}

		private void Update()
		{
			//IL_0071: 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)
			age += Time.deltaTime;
			height = Mathf.Lerp(3f, radius * 1.7f, ignition);
			Shape(tongues, 0.3f, 1f, 0.62f);
			Shape(core, 0.085f, 0.78f, 1f);
			JujutsuFxMaterials.SetEnvelope(tongueMaterial, tongueBase, fade, 1.5f);
			JujutsuFxMaterials.SetEnvelope(coreMaterial, coreBase, fade, 1.5f);
		}

		private void Shape(LineRenderer[] set, float spread, float reach, float weight)
		{
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: 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_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			if (set == null)
			{
				return;
			}
			Vector3 val2 = default(Vector3);
			Vector3 val3 = default(Vector3);
			Color endColor = default(Color);
			for (int i = 0; i < set.Length; i++)
			{
				LineRenderer val = set[i];
				if (Object.op_Implicit((Object)(object)val))
				{
					float num = (float)i * 2.39996f;
					float num2 = Mathf.Repeat(age / 0.62f + (float)i / (float)set.Length, 1f);
					float num3 = Mathf.SmoothStep(0f, 1f, num2);
					float num4 = height * reach * Mathf.Lerp(0.55f, 1f, num3);
					float num5 = radius * spread * (0.35f + (float)(i % 5) * 0.19f);
					float num6 = ((i % 2 == 0) ? 1f : (-1f)) * (0.9f + (float)(i % 3) * 0.35f);
					for (int j = 0; j < 14; j++)
					{
						float num7 = (float)j / 13f;
						float num8 = Mathf.Lerp(1f, 0.28f, num7) + num7 * num7 * 0.85f;
						float num9 = num + num7 * 2.1f + age * num6;
						float num10 = Mathf.Sin(num7 * 6.5f - age * 7.5f + num) * radius * 0.055f * (0.25f + num7);
						((Vector3)(ref val2))..ctor(Mathf.Cos(num9), 0f, Mathf.Sin(num9));
						((Vector3)(ref val3))..ctor(0f - val2.z, 0f, val2.x);
						val.SetPosition(j, root + Vector3.up * (num4 * num7) + val2 * (num5 * num8) + val3 * num10);
					}
					float num11 = (1f - num3) * fade * ignition;
					Color startColor = ((i % 4 == 0) ? new Color(1f, 0.88f, 0.45f, 0.95f * num11) : new Color(1f, 0.36f, 0.03f, 0.88f * num11));
					((Color)(ref endColor))..ctor(0.42f, 0.02f, 0.004f, 0f);
					val.startColor = startColor;
					val.endColor = endColor;
					val.widthMultiplier = radius * weight * (0.055f + (float)(i % 4) * 0.014f) * (0.45f + (1f - num3) * 0.85f) * fade;
				}
			}
		}

		private void OnDestroy()
		{
			for (int i = 0; i < materials.Count; i++)
			{
				if (Object.op_Implicit((Object)(object)materials[i]))
				{
					Object.Destroy((Object)(object)materials[i]);
				}
			}
			materials.Clear();
		}
	}
	internal static class SukunaFugaVisuals
	{
		internal static RuntimeFugaExplosionVisual CreateFugaExplosion(Vector3 impactPosition, Vector3 groundPosition, float radius, float duration = 8.5f, FugaExplosionDetail detail = FugaExplosionDetail.Blast)
		{
			//IL_0005: 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)
			RuntimeFugaExplosionVisual runtimeFugaExplosionVisual = new GameObject("SukunaFugaExplosion").AddComponent<RuntimeFugaExplosionVisual>();
			runtimeFugaExplosionVisual.Initialize(impactPosition, groundPosition, radius, duration, detail);
			return runtimeFugaExplosionVisual;
		}

		internal static RuntimeFugaProjectileVisual AddFugaProjectileFlames(GameObject projectileObject, Vector3 direction)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)projectileObject))
			{
				return null;
			}
			RuntimeFugaProjectileVisual runtimeFugaProjectileVisual = projectileObject.AddComponent<RuntimeFugaProjectileVisual>();
			runtimeFugaProjectileVisual.Initialize(direction);
			return runtimeFugaProjectileVisual;
		}
	}
	internal enum FugaExplosionDetail
	{
		Blast,
		Flare
	}
	internal sealed class RuntimeFugaProjectileVisual : MonoBehaviour
	{
		private const int FlameCount = 10;

		private const int FlameSegments = 7;

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

		private LineRenderer[] flames;

		private TrailRenderer[] trails;

		private Vector3 direction;

		private Vector3 lastPosition;

		private float age;

		internal void Initialize(Vector3 initialDirection)
		{
			//IL_0018: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			direction = ((((Vector3)(ref initialDirection)).sqrMagnitude > 0.001f) ? ((Vector3)(ref initialDirection)).normalized : Vector3.forward);
			lastPosition = ((Component)this).transform.position;
			BuildFlames();
			BuildTrails();
		}

		internal void SetDirection(Vector3 newDirection)
		{
			//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)
			if (((Vector3)(ref newDirection)).sqrMagnitude > 0.001f)
			{
				direction = ((Vector3)(ref newDirection)).normalized;
			}
		}

		internal void Stop()
		{
			if (flames != null)
			{
				for (int i = 0; i < flames.Length; i++)
				{
					if (Object.op_Implicit((Object)(object)flames[i]))
					{
						((Renderer)flames[i]).enabled = false;
					}
				}
			}
			if (trails != null)
			{
				for (int j = 0; j < trails.Length; j++)
				{
					if (Object.op_Implicit((Object)(object)trails[j]))
					{
						trails[j].emitting = false;
					}
				}
			}
			((Behaviour)this).enabled = false;
		}

		private void BuildFlames()
		{
			//IL_0026: 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_00bd: 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_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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			flames = (LineRenderer[])(object)new LineRenderer[10];
			Material val = JujutsuFxMaterials.CreateLineMaterial("matFugaProjectileFlames", new Color(1f, 0.25f, 0.015f, 0.92f), 1.5f);
			materials.Add(val);
			for (int i = 0; i < 10; i++)
			{
				GameObject val2 = new GameObject("FugaProjectileFlame_" + i);
				val2.transform.SetParent(((Component)this).transform, false);
				LineRenderer val3 = val2.AddComponent<LineRenderer>();
				JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val3);
				val3.useWorldSpace = true;
				val3.positionCount = 7;
				val3.numCornerVertices = 4;
				val3.numCapVertices = 4;
				Color val4 = (val3.startColor = (Color)((i % 3) switch
				{
					0 => new Color(1f, 0.76f, 0.12f, 0.95f), 
					1 => new Color(1f, 0.2f, 0.015f, 0.9f), 
					_ => new Color(0.72f, 0.025f, 0.008f, 0.82f), 
				}));
				Color endColor = val4;
				endColor.a = 0f;
				val3.endColor = endColor;
				((Renderer)val3).material = val;
				flames[i] = val3;
			}
		}

		private void BuildTrails()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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_013a: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			trails = (TrailRenderer[])(object)new TrailRenderer[3];
			Material val = JujutsuFxMaterials.CreateLineMaterial("matFugaInfernoTrails", new Color(1f, 0.15f, 0.008f, 0.88f), 1.5f);
			materials.Add(val);
			for (int i = 0; i < trails.Length; i++)
			{
				GameObject val2 = new GameObject("FugaInfernoTrail_" + i);
				val2.transform.SetParent(((Component)this).transform, false);
				float num = (float)i / 3f * MathF.PI * 2f;
				val2.transform.localPosition = new Vector3(Mathf.Cos(num) * 0.28f, Mathf.Sin(num) * 0.28f, 0f);
				TrailRenderer val3 = val2.AddComponent<TrailRenderer>();
				JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val3);
				val3.time = 0.38f + (float)i * 0.09f;
				val3.minVertexDistance = 0.08f;
				val3.numCornerVertices = 4;
				val3.numCapVertices = 3;
				val3.widthMultiplier = 0.72f - (float)i * 0.12f;
				Color val4 = ((i == 0) ? new Color(1f, 0.7f, 0.08f, 0.95f) : new Color(1f, 0.08f, 0.005f, 0.82f));
				Color endColor = val4;
				endColor.a = 0f;
				val3.startColor = val4;
				val3.endColor = endColor;
				((Renderer)val3).material = val;
				trails[i] = val3;
			}
		}

		private void Update()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0040: 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_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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			age += Time.deltaTime;
			Vector3 val = ((Component)this).transform.position - lastPosition;
			if (((Vector3)(ref val)).sqrMagnitude > 0.0025f)
			{
				direction = Vector3.Slerp(direction, ((Vector3)(ref val)).normalized, Mathf.Clamp01(Time.deltaTime * 18f));
			}
			lastPosition = ((Component)this).transform.position;
			Vector3 val2 = Vector3.Cross(Vector3.up, direction);
			if (((Vector3)(ref val2)).sqrMagnitude < 0.001f)
			{
				val2 = Vector3.right;
			}
			((Vector3)(ref val2)).Normalize();
			Vector3 val3 = Vector3.Cross(direction, val2);
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			float num = Mathf.Max(0.45f, ((Component)this).transform.localScale.x);
			for (int i = 0; i < flames.Length; i++)
			{
				LineRenderer val4 = flames[i];
				if (Object.op_Implicit((Object)(object)val4))
				{
					float num2 = (float)i / 10f * MathF.PI * 2f;
					float num3 = num * (2.4f + (float)(i % 4) * 0.42f);
					for (int j = 0; j < 7; j++)
					{
						float num4 = (float)j / 6f;
						float num5 = Mathf.Sin(age * (13f + (float)i * 0.22f) + num4 * 9f + num2) * num * (0.18f + num4 * 0.36f);
						float num6 = num2 + num4 * 2.4f + age * (2.5f + (float)i * 0.08f);
						Vector3 val5 = val2 * Mathf.Cos(num6) + normalized * Mathf.Sin(num6);
						val4.SetPosition(j, ((Component)this).transform.position - direction * num3 * num4 + val5 * (num * (0.26f + num4 * 0.52f)) + normalized * num5);
					}
					val4.widthMultiplier = num * (0.26f + (float)(i % 3) * 0.07f) * (1f + Mathf.Sin(age * 17f + num2) * 0.18f);
				}
			}
		}

		private void OnDestroy()
		{
			for (int i = 0; i < materials.Count; i++)
			{
				if (Object.op_Implicit((Object)(object)materials[i]))
				{
					Object.Destroy((Object)(object)materials[i]);
				}
			}
			materials.Clear();
		}
	}
	internal sealed class RuntimeFugaExplosionVisual : MonoBehaviour
	{
		private const int RingSegments = 72;

		private const int FlameRayCount = 14;

		private const int FlameTongueCount = 30;

		private const int FlameTongueSegments = 8;

		private const int EmberCount = 24;

		private const int ShockwaveCount = 3;

		internal const float BlastDuration = 8.5f;

		internal const float FlareDuration = 1.7f;

		private const int BlastGroundSpokes = 36;

		private const int BlastGroundRings = 12;

		private const int FlareGroundSpokes = 16;

		private const int FlareGroundRings = 5;

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

		private JujutsuGroundField ground;

		private RuntimeFugaPillar pillar;

		private LineRenderer[] shockwaves;

		private Material shockwaveMaterial;

		private Color shockwaveBaseColor;

		private LineRenderer[] flameRays;

		private Material flameRayMaterial;

		private Color flameRayBaseColor;

		private LineRenderer[] flameTongues;

		private Material flameTongueMaterial;

		private Color flameTongueBaseColor;

		private LineRenderer[] embers;

		private Material emberMaterial;

		private Color emberBaseColor;

		private Light explosionLight;

		private Vector3 groundPosition;

		private float radius;

		private float duration;

		private float fadeWindow;

		private float age;

		internal void Initialize(Vector3 impactPosition, Vector3 floorPosition, float effectRadius, float lifetime, FugaExplosionDetail detail)
		{
			//IL_0006: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = Vector3.zero;
			radius = Mathf.Max(2f, effectRadius);
			duration = Mathf.Max(0.4f, lifetime);
			fadeWindow = Mathf.Min(1.05f, duration * 0.35f);
			bool flag = detail == FugaExplosionDetail.Blast;
			ground = JujutsuGroundField.Sample(floorPosition, radius, flag ? 36 : 16, flag ? 12 : 5);
			groundPosition = ground.PointAt(0f, 0f, 0.08f);
			BuildFlameTongues(flag ? 30 : 10);
			BuildEmbers(flag ? 24 : 6);
			if (flag)
			{
				BuildPillar();
				BuildShockwave();
				BuildFlameRays();
			}
			BuildLight(flag);
		}

		private void BuildPillar()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("FugaFirePillar");
			val.transform.SetParent(((Component)this).transform, true);
			pillar = val.AddComponent<RuntimeFugaPillar>();
			pillar.Initialize(groundPosition, radius);
		}

		private void BuildShockwave()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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)
			shockwaves = (LineRenderer[])(object)new LineRenderer[3];
			shockwaveBaseColor = new Color(1f, 0.46f, 0.04f, 0.95f);
			shockwaveMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaFugaShockwave", shockwaveBaseColor, 1.5f);
			materials.Add(shockwaveMaterial);
			for (int i = 0; i < shockwaves.Length; i++)
			{
				GameObject val = new GameObject("FugaShockwave_" + i);
				val.transform.SetParent(((Component)this).transform, true);
				LineRenderer val2 = val.AddComponent<LineRenderer>();
				JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val2);
				val2.useWorldSpace = true;
				val2.loop = true;
				val2.positionCount = 72;
				val2.numCapVertices = 4;
				val2.numCornerVertices = 3;
				((Renderer)val2).material = shockwaveMaterial;
				shockwaves[i] = val2;
			}
		}

		private void BuildFlameTongues(int count)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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)
			flameTongues = (LineRenderer[])(object)new LineRenderer[count];
			flameTongueBaseColor = new Color(1f, 0.32f, 0.015f, 0.88f);
			flameTongueMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaFugaFlameTongues", flameTongueBaseColor, 1.5f);
			materials.Add(flameTongueMaterial);
			for (int i = 0; i < flameTongues.Length; i++)
			{
				GameObject val = new GameObject("FugaFlameTongue_" + i);
				val.transform.SetParent(((Component)this).transform, true);
				LineRenderer val2 = val.AddComponent<LineRenderer>();
				JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val2);
				val2.useWorldSpace = true;
				val2.positionCount = 8;
				val2.numCornerVertices = 5;
				val2.numCapVertices = 4;
				((Renderer)val2).material = flameTongueMaterial;
				flameTongues[i] = val2;
			}
		}

		private void BuildEmbers(int count)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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)
			embers = (LineRenderer[])(object)new LineRenderer[count];
			emberBaseColor = new Color(1f, 0.65f, 0.08f, 0.95f);
			emberMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaFugaEmbers", emberBaseColor, 1.5f);
			materials.Add(emberMaterial);
			for (int i = 0; i < embers.Length; i++)
			{
				GameObject val = new GameObject("FugaEmber_" + i);
				val.transform.SetParent(((Component)this).transform, true);
				LineRenderer val2 = val.AddComponent<LineRenderer>();
				JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val2);
				val2.useWorldSpace = true;
				val2.positionCount = 2;
				val2.numCapVertices = 3;
				((Renderer)val2).material = emberMaterial;
				embers[i] = val2;
			}
		}

		private void BuildFlameRays()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			flameRays = (LineRenderer[])(object)new LineRenderer[14];
			flameRayBaseColor = new Color(0.95f, 0.055f, 0.006f, 0.68f);
			flameRayMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaFugaFloorFlames", flameRayBaseColor, 1.5f);
			materials.Add(flameRayMaterial);
			for (int i = 0; i < 14; i++)
			{
				GameObject val = new GameObject("FugaFloorFlame_" + i);
				val.transform.SetParent(((Component)this).transform, true);
				LineRenderer val2 = val.AddComponent<LineRenderer>();
				JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val2);
				val2.useWorldSpace = true;
				val2.positionCount = 4;
				val2.numCapVertices = 3;
				((Renderer)val2).material = flameRayMaterial;
				flameRays[i] = val2;
			}
		}

		private void BuildLight(bool blast)
		{
			//IL_0016: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			explosionLight = JujutsuFxLights.TryAdd(((Component)this).gameObject, new Color(1f, 0.2f, 0.02f), 11f, radius * 1.55f, blast);
			if (Object.op_Implicit((Object)(object)explosionLight))
			{
				((Component)explosionLight).transform.position = groundPosition + Vector3.up * 7f;
			}
		}

		private void Update()
		{
			//IL_008d: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			age += Time.deltaTime;
			float num = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(age / 0.34f));
			float num2 = Mathf.Clamp01((duration - age) / fadeWindow);
			Mathf.Sin(age * 18f);
			UpdatePillar(num, num2);
			UpdateShockwave(num2);
			UpdateFlameRays(num, num2);
			UpdateFlameTongues(num, num2);
			UpdateEmbers(num, num2);
			JujutsuFxMaterials.SetEnvelope(shockwaveMaterial, shockwaveBaseColor, num2, 1.5f);
			JujutsuFxMaterials.SetEnvelope(flameRayMaterial, flameRayBaseColor, num2, 1.5f);
			JujutsuFxMaterials.SetEnvelope(flameTongueMaterial, flameTongueBaseColor, num2, 1.5f);
			JujutsuFxMaterials.SetEnvelope(emberMaterial, emberBaseColor, num2 * num, 1.5f);
			if (Object.op_Implicit((Object)(object)explosionLight))
			{
				explosionLight.intensity = (11f + Mathf.Sin(age * 23f) * 2.2f) * num2;
			}
			if (age >= duration)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void UpdatePillar(float ignition, float fade)
		{
			if (Object.op_Implicit((Object)(object)pillar))
			{
				pillar.SetState(ignition, fade);
			}
		}

		private void UpdateShockwave(float fade)
		{
			//IL_00ac: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			if (shockwaves == null)
			{
				return;
			}
			for (int i = 0; i < shockwaves.Length; i++)
			{
				LineRenderer val = shockwaves[i];
				if (Object.op_Implicit((Object)(object)val))
				{
					float num = (float)i * 0.16f;
					float num2 = Mathf.Clamp01((age - num) / (0.72f + (float)i * 0.12f));
					float num3 = radius * (1.18f + (float)i * 0.16f) * Mathf.SmoothStep(0f, 1f, num2);
					Color endColor = (val.startColor = ((i == 0) ? new Color(1f, 0.82f, 0.22f, (1f - num2) * fade) : new Color(1f, 0.18f, 0.015f, (1f - num2) * fade)));
					val.endColor = endColor;
					val.widthMultiplier = Mathf.Lerp(2.2f - (float)i * 0.35f, 0.06f, num2);
					for (int j = 0; j < 72; j++)
					{
						float num4 = (float)j / 72f * MathF.PI * 2f;
						float num5 = 1f + Mathf.Sin(num4 * (7f + (float)i) + age * 12f) * 0.035f;
						val.SetPosition(j, ground.PointAt(num4, num3 * num5, 0.15f + (float)i * 0.12f));
					}
				}
			}
		}

		private void UpdateFlameRays(float ignition, float fade)
		{
			//IL_0067: 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_00d5: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			if (flameRays == null)
			{
				return;
			}
			Vector3 val2 = default(Vector3);
			Vector3 val3 = default(Vector3);
			Color val4 = default(Color);
			for (int i = 0; i < flameRays.Length; i++)
			{
				LineRenderer val = flameRays[i];
				if (Object.op_Implicit((Object)(object)val))
				{
					float num = (float)i / 14f * MathF.PI * 2f + Mathf.Sin((float)i * 4.17f) * 0.18f;
					((Vector3)(ref val2))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num));
					((Vector3)(ref val3))..ctor(0f - val2.z, 0f, val2.x);
					float num2 = radius * (0.62f + (float)(i % 5) * 0.075f) * ignition;
					float num3 = Mathf.Sin(age * 5f + (float)i * 1.7f) * radius * 0.035f;
					val.SetPosition(0, ground.PointAt(num, 0f, 0.12f));
					val.SetPosition(1, ground.PointAt(num, num2 * 0.34f, 0.18f) + val3 * num3);
					val.SetPosition(2, ground.PointAt(num, num2 * 0.7f, 0.1f) - val3 * num3 * 0.55f);
					val.SetPosition(3, ground.PointAt(num, num2, 0.08f) + val3 * num3 * 0.25f);
					float num4 = ground.CoverageAt(num, num2);
					((Color)(ref val4))..ctor(1f, 0.08f + (float)(i % 3) * 0.045f, 0.005f, 0.64f * fade);
					val.startColor = val4;
					val.endColor = new Color(val4.r, val4.g, val4.b, 0f);
					val.widthMultiplier = (0.5f + (float)(i % 4) * 0.12f) * fade * num4;
				}
			}
		}

		private void UpdateFlameTongues(float ignition, float fade)
		{
			//IL_00c0: 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_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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: 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_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			if (flameTongues == null)
			{
				return;
			}
			Vector3 val2 = default(Vector3);
			Vector3 val3 = default(Vector3);
			Color endColor = default(Color);
			for (int i = 0; i < flameTongues.Length; i++)
			{
				LineRenderer val = flameTongues[i];
				if (Object.op_Implicit((Object)(object)val))
				{
					float num = (float)i / 30f * MathF.PI * 2f;
					float num2 = 0.16f + (float)(i % 6) * 0.115f;
					float num3 = radius * num2 * Mathf.Lerp(0.12f, 1f, ignition);
					float num4 = radius * (0.42f + (float)(i % 7) * 0.105f) * ignition * (0.78f + Mathf.Sin(age * 8f + num * 3f) * 0.16f);
					((Vector3)(ref val2))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num));
					((Vector3)(ref val3))..ctor(0f - val2.z, 0f, val2.x);
					Vector3 val4 = ground.PointAt(num, num3, 0.05f);
					float num5 = ground.CoverageAt(num, num3);
					for (int j = 0; j < 8; j++)
					{
						float num6 = (float)j / 7f;
						float num7 = Mathf.Sin(age * (6.5f + (float)i * 0.035f) + num6 * 8f + num * 2f) * radius * 0.055f * num6;
						float num8 = Mathf.Cos(age * 4.7f + num6 * 11f + num) * radius * 0.024f * num6;
						val.SetPosition(j, val4 + Vector3.up * num4 * num6 + val3 * num7 + val2 * num8 - val2 * num4 * 0.08f * num6 * num6);
					}
					Color startColor = ((i % 4 == 0) ? new Color(1f, 0.82f, 0.15f, 0.95f * fade) : new Color(1f, 0.16f, 0.008f, 0.82f * fade));
					((Color)(ref endColor))..ctor(0.35f, 0.005f, 0.001f, 0f);
					val.startColor = startColor;
					val.endColor = endColor;
					val.widthMultiplier = radius * (0.028f + (float)(i % 5) * 0.005f) * fade * num5 * (1f + Mathf.Sin(age * 13f + num) * 0.22f);
				}
			}
		}

		private void UpdateEmbers(float ignition, float fade)
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			if (embers == null)
			{
				return;
			}
			Color val4 = default(Color);
			for (int i = 0; i < embers.Length; i++)
			{
				LineRenderer val = embers[i];
				if (Object.op_Implicit((Object)(object)val))
				{
					float num = (float)i * 1.618034f;
					float num2 = Mathf.Repeat(age * (0.42f + (float)(i % 5) * 0.045f) + (float)i / 24f, 1f);
					float num3 = num + age * (0.35f + (float)(i % 3) * 0.16f);
					float num4 = radius * (0.08f + (float)(i % 8) * 0.035f) * (0.5f + num2 * 0.5f);
					Vector3 val2 = ground.PointAt(num3, num4, 0f) + Vector3.up * radius * (0.08f + num2 * 1.15f);
					Vector3 val3 = (Vector3.up * (0.45f + num2) + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * 0.18f) * radius * 0.075f;
					val.SetPosition(0, val2);
					val.SetPosition(1, val2 - val3);
					((Color)(ref val4))..ctor(1f, 0.72f, 0.16f, fade * ignition * (1f - num2 * 0.72f));
					Color endColor = val4;
					endColor.a = 0f;
					val.startColor = val4;
					val.endColor = endColor;
					val.widthMultiplier = radius * (0.007f + (float)(i % 3) * 0.002f) * fade;
				}
			}
		}

		private void OnDestroy()
		{
			for (int i = 0; i < materials.Count; i++)
			{
				if (Object.op_Implicit((Object)(object)materials[i]))
				{
					Object.Destroy((Object)(object)materials[i]);
				}
			}
			materials.Clear();
		}
	}
	internal static class SukunaShrineVisuals
	{
		internal static RuntimeMalevolentShrineVisual CreateShrine(Vector3 center, Vector3 facing, float radius, float duration)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0043: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("SukunaMalevolentShrine");
			val.transform.position = center;
			Vector3 val2 = Vector3.ProjectOnPlane(facing, Vector3.up);
			if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f)
			{
				val.transform.rotation = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up);
			}
			RuntimeMalevolentShrineVisual runtimeMalevolentShrineVisual = val.AddComponent<RuntimeMalevolentShrineVisual>();
			runtimeMalevolentShrineVisual.Initialize(radius, duration);
			return runtimeMalevolentShrineVisual;
		}
	}
	internal sealed class RuntimeMalevolentShrineVisual : MonoBehaviour
	{
		private const int RingSegments = 96;

		private const int SigilRayCount = 16;

		private const int CurseWispCount = 18;

		private const int WispSegments = 7;

		private const int HazeShells = 2;

		private const float StandOff = 23f;

		private const float RiseDuration = 1.1f;

		private const float UnsealedGrace = 8f;

		private const float MaximumGroundRise = 8f;

		private const float MaximumGroundDrop = 45f;

		private const float GroundSampleRadius = 7f;

		private Renderer[] shrineRenderers;

		private Transform shrineStand;

		private float standDrop;

		private Vector3 domainCentre;

		private bool placementReported;

		private Material shrineMaterial;

		private Material ringMaterial;

		private Color sphereBaseColor;

		private Transform sphereRoot;

		private Transform[] hazeShells;

		private Material[] hazeMaterials;

		private float nextAirCutAt;

		private LineRenderer boundary;

		private LineRenderer[] sigilRays;

		private LineRenderer[] curseWisps;

		private Material sigilMaterial;

		private Material wispMaterial;

		private Color sigilBaseColor;

		private Color wispBaseColor;

		private Light shrineLight;

		private float radius;

		private float duration;

		private float shrineHeight = 5.5f;

		private float age;

		private float sealAge = -1f;

		private bool domainSealed;

		internal void Initialize(float domainRadius, float lifetime)
		{
			//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_004d: 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)
			radius = Mathf.Max(8f, domainRadius);
			duration = Mathf.Max(1f, lifetime);
			domainCentre = ((Component)this).transform.position;
			shrineMaterial = SukunaVisuals.CreateSafeMaterial("matSukunaShrine", new Color(0.25f, 0.006f, 0.018f, 1f));
			ringMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaShrineBoundary", SukunaAssets.Crimson, 1.5f);
			BuildShrine();
		}

		internal void Seal()
		{
			if (!domainSealed)
			{
				domainSealed = true;
				sealAge = 0f;
				BuildBoundary();
				BuildSphere();
				BuildSigil();
				BuildCurseWisps();
				BuildLight();
			}
		}

		private void BuildSphere()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0078: 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_00b6: 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_00e9: 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)
			sphereBaseColor = new Color(0.5f, 0.02f, 0.03f, 0.05f);
			GameObject val = new GameObject("MalevolentShrineAir");
			val.transform.SetParent(((Component)this).transform, false);
			sphereRoot = val.transform;
			hazeShells = (Transform[])(object)new Transform[2];
			hazeMaterials = (Material[])(object)new Material[2];
			for (int i = 0; i < 2; i++)
			{
				GameObject val2 = JujutsuPrimitives.Sphere("ShrineHaze_" + i, Vector3.zero, false);
				val2.transform.SetParent(sphereRoot, false);
				val2.transform.localScale = Vector3.one * (radius * (1.98f - (float)i * 0.3f));
				hazeShells[i] = val2.transform;
				Renderer component = val2.GetComponent<Renderer>();
				if (Object.op_Implicit((Object)(object)component))
				{
					JujutsuFxMaterials.PrepareRenderer(component);
					Color val3 = sphereBaseColor;
					val3.a = 0.05f - (float)i * 0.015f;
					hazeMaterials[i] = JujutsuFxMaterials.CreateLineMaterial("matSukunaShrineHaze" + i, val3, 1f);
					component.material = hazeMaterials[i];
				}
			}
		}

		private void CutTheAir()
		{
			//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_0037: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00e0: 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)
			if (!(age < nextAirCutAt))
			{
				nextAirCutAt = age + Random.Range(0.12f, 0.3f);
				Vector3 position = ((Component)this).transform.position;
				Vector3 val = Random.insideUnitSphere * (radius * 0.85f);
				val.y = Mathf.Abs(val.y) * 0.7f + 0.5f;
				Vector3 onUnitSphere = Random.onUnitSphere;
				float num = radius * Random.Range(0.12f, 0.3f);
				SukunaVisuals.CreateSlash(position + val - onUnitSphere * num, position + val + onUnitSphere * num, Random.Range(0.12f, 0.3f), Random.Range(0.25f, 0.45f), (Random.value > 0.5f) ? SukunaVisuals.DarkSlash : SukunaVisuals.GreySlash, true);
			}
		}

		private void BuildLight()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_003d: 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_0042: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MalevolentShrineLight");
			val.transform.SetParent(((Component)this).transform, false);
			val.transform.localPosition = (Object.op_Implicit((Object)(object)shrineStand) ? shrineStand.localPosition : Vector3.zero) + Vector3.up * (shrineHeight * 0.55f);
			shrineLight = JujutsuFxLights.TryAdd(val, SukunaAssets.Crimson, 3.4f, radius * 0.9f, true);
		}

		private Transform CreateStand()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_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_007b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MalevolentShrineStand");
			val.transform.SetParent(((Component)this).transform, false);
			float num = 23f;
			float num2 = 0f;
			bool flag = false;
			for (int i = 0; i < 3; i++)
			{
				if (flag)
				{
					break;
				}
				num = 23f * (1f - (float)i * 0.25f);
				flag = TryFindGround(((Component)this).transform.position - ((Component)this).transform.forward * num, out var groundHeight);
				if (flag)
				{
					num2 = groundHeight - ((Component)this).transform.position.y;
				}
			}
			if (!flag)
			{
				num = 23f;
				Plugin.Log.LogWarning((object)("Malevolent Shrine found no ground behind the caster " + $"within {45f:0}m at any stand-off; standing " + "it on his own level."));
			}
			standDrop = num2;
			val.transform.localPosition = new Vector3(0f, num2, 0f - num);
			val.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
			return val.transform;
		}

		private bool TryFindGround(Vector3 centre, out float groundHeight)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0098: 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_00a7: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			groundHeight = 0f;
			bool flag = false;
			RaycastHit val = default(RaycastHit);
			for (int i = 0; i < 5; i++)
			{
				if (Physics.Raycast(centre + (Vector3)(i switch
				{
					1 => (((Component)this).transform.right + ((Component)this).transform.forward) * 7f, 
					2 => (((Component)this).transform.right - ((Component)this).transform.forward) * 7f, 
					3 => (-((Component)this).transform.right + ((Component)this).transform.forward) * 7f, 
					4 => (-((Component)this).transform.right - ((Component)this).transform.forward) * 7f, 
					_ => Vector3.zero, 
				}) + Vector3.up * 8f, Vector3.down, ref val, 53f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && (!flag || ((RaycastHit)(ref val)).point.y < groundHeight))
				{
					groundHeight = ((RaycastHit)(ref val)).point.y;
					flag = true;
				}
			}
			return flag;
		}

		private void BuildShrine()
		{
			//IL_004a: 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_007d: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			shrineStand = CreateStand();
			float num = default(float);
			if (RuntimeShrineModel.TryBuild(shrineStand, ref num))
			{
				shrineHeight = num;
				shrineRenderers = ((Component)shrineStand).GetComponentsInChildren<Renderer>(true);
				return;
			}
			CreateBlock("ShrineBase", new Vector3(0f, 0.18f, 0f), new Vector3(7.5f, 0.36f, 5.2f));
			CreateBlock("ShrineStep", new Vector3(0f, 0.48f, 0f), new Vector3(6.1f, 0.28f, 4.2f));
			for (int i = -1; i <= 1; i += 2)
			{
				CreateBlock("ShrinePillarFront", new Vector3((float)i * 2.55f, 2.7f, 1.35f), new Vector3(0.48f, 4.7f, 0.48f));
				CreateBlock("ShrinePillarBack", new Vector3((float)i * 2.55f, 2.7f, -1.35f), new Vector3(0.48f, 4.7f, 0.48f));
			}
			CreateBlock("ShrineRoofLower", new Vector3(0f, 4.85f, 0f), new Vector3(6.9f, 0.38f, 4.15f));
			CreateBlock("ShrineRoofUpper", new Vector3(0f, 5.35f, 0f), new Vector3(5.45f, 0.34f, 3.35f));
			CreateBlock("ShrineAltar", new Vector3(0f, 1.45f, -0.5f), new Vector3(2.8f, 2.1f, 1.25f));
			shrineRenderers = ((Component)shrineStand).GetComponentsInChildren<Renderer>(true);
		}

		private void CreateBlock(string blockName, Vector3 localPosition, Vector3 localScale)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = JujutsuPrimitives.Cube(blockName, Vector3.zero, false);
			obj.transform.SetParent(shrineStand, false);
			obj.transform.localPosition = localPosition;
			obj.transform.localScale = localScale;
			Renderer component = obj.GetComponent<Renderer>();
			component.sharedMaterial = shrineMaterial;
			component.shadowCastingMode = (ShadowCastingMode)1;
			component.receiveShadows = true;
		}

		private void BuildBoundary()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MalevolentShrineBoundary");
			val.transform.SetParent(((Component)this).transform, false);
			val.transform.localPosition = Vector3.up * 0.08f;
			boundary = val.AddComponent<LineRenderer>();
			JujutsuFxMaterials.PrepareRenderer((Renderer)(object)boundary);
			boundary.useWorldSpace = false;
			boundary.loop = true;
			boundary.positionCount = 96;
			boundary.widthMultiplier = 0.22f;
			boundary.numCornerVertices = 2;
			boundary.startColor = SukunaAssets.Crimson;
			boundary.endColor = SukunaAssets.Crimson;
			((Renderer)boundary).material = ringMaterial;
			for (int i = 0; i < 96; i++)
			{
				float num = (float)i / 96f * MathF.PI * 2f;
				boundary.SetPosition(i, new Vector3(Mathf.Cos(num) * radius, 0f, Mathf.Sin(num) * radius));
			}
		}

		private void BuildSigil()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			sigilBaseColor = new Color(0.75f, 0.015f, 0.025f, 0.82f);
			sigilMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaShrineSigil", sigilBaseColor, 1.5f);
			sigilRays = (LineRenderer[])(object)new LineRenderer[16];
			for (int i = 0; i < sigilRays.Length; i++)
			{
				GameObject val = new GameObject("ShrineSigilRay_" + i);
				val.transform.SetParent(((Component)this).transform, false);
				LineRenderer val2 = val.AddComponent<LineRenderer>();
				JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val2);
				val2.useWorldSpace = false;
				val2.positionCount = 5;
				val2.numCornerVertices = 3;
				val2.numCapVertices = 3;
				((Renderer)val2).material = sigilMaterial;
				sigilRays[i] = val2;
			}
		}

		private void BuildCurseWisps()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			wispBaseColor = new Color(0.18f, 0.002f, 0.008f, 0.78f);
			wispMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaShrineCurseWisps", wispBaseColor, 1.5f);
			curseWisps = (LineRenderer[])(object)new LineRenderer[18];
			for (int i = 0; i < curseWisps.Length; i++)
			{
				GameObject val = new GameObject("ShrineCurseWisp_" + i);
				val.transform.SetParent(((Component)this).transform, false);
				LineRenderer val2 = val.AddComponent<LineRenderer>();
				JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val2);
				val2.useWorldSpace = false;
				val2.positionCount = 7;
				val2.numCornerVertices = 4;
				val2.numCapVertices = 3;
				((Renderer)val2).material = wispMaterial;
				curseWisps[i] = val2;
			}
		}

		private void Update()
		{
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: 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_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			age += Time.deltaTime;
			if (domainSealed)
			{
				sealAge += Time.deltaTime;
			}
			float num = Mathf.Clamp01(age / 1.1f);
			float num2 = (domainSealed ? Mathf.Clamp01((duration - sealAge) / 0.8f) : 1f);
			float num3 = Mathf.Min(num, num2);
			float num4 = (domainSealed ? Mathf.Min(Mathf.Clamp01(sealAge / 0.55f), num2) : 0f);
			float num5 = 1f + Mathf.Sin(age * 3.4f) * 0.025f;
			if (shrineRenderers != null)
			{
				for (int i = 0; i < shrineRenderers.Length; i++)
				{
					if (Object.op_Implicit((Object)(object)shrineRenderers[i]))
					{
						shrineRenderers[i].enabled = num3 > 0.01f;
					}
				}
			}
			if (Object.op_Implicit((Object)(object)boundary))
			{
				boundary.widthMultiplier = 0.22f * num4 * (1f + Mathf.Sin(age * 9f) * 0.22f);
				((Component)boundary).transform.localRotation = Quaternion.Euler(0f, age * 4f, 0f);
				((Component)boundary).transform.localScale = new Vector3(num5, 1f, num5);
			}
			if (Object.op_Implicit((Object)(object)sphereRoot))
			{
				sphereRoot.localRotation = Quaternion.Euler(0f, (0f - age) * 2.5f, 0f);
				for (int j = 0; j < hazeMaterials.Length; j++)
				{
					Color val = sphereBaseColor;
					val.a = 0.05f - (float)j * 0.015f;
					JujutsuFxMaterials.SetEnvelope(hazeMaterials[j], val, num4, 1.5f);
				}
			}
			CutTheAir();
			UpdateSigil(num4);
			UpdateCurseWisps(num4);
			JujutsuFxMaterials.SetEnvelope(ringMaterial, SukunaAssets.Crimson, num4, 1.5f);
			JujutsuFxMaterials.SetEnvelope(sigilMaterial, sigilBaseColor, num4, 1.5f);
			JujutsuFxMaterials.SetEnvelope(wispMaterial, wispBaseColor, num4, 1.5f);
			((Component)this).transform.localScale = new Vector3(1f, Mathf.Lerp(0.12f, 1f, num), 1f);
			if (Object.op_Implicit((Object)(object)shrineLight))
			{
				shrineLight.intensity = (3.4f + Mathf.Sin(age * 7f) * 0.6f) * num4;
			}
			if (!placementReported)
			{
				placementReported = true;
				RuntimeShrineModel.ReportPlacement(shrineStand, ((Component)this).transform, domainCentre, standDrop);
			}
			if (domainSealed ? (sealAge >= duration) : (age >= 8f))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void UpdateSigil(float alpha)
		{
			//IL_006c: 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_00cd: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: 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)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			if (sigilRays == null)
			{
				return;
			}
			Vector3 val2 = default(Vector3);
			Vector3 val3 = default(Vector3);
			Color startColor = default(Color);
			Color endColor = default(Color);
			for (int i = 0; i < sigilRays.Length; i++)
			{
				LineRenderer val = sigilRays[i];
				if (Object.op_Implicit((Object)(object)val))
				{
					float num = (float)i / 16f * MathF.PI * 2f + age * ((i % 2 == 0) ? 0.08f : (-0.06f));
					((Vector3)(ref val2))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num));
					((Vector3)(ref val3))..ctor(0f - val2.z, 0f, val2.x);
					float num2 = radius * 0.16f;
					float num3 = radius * (0.82f + (float)(i % 4) * 0.045f) * (1f + Mathf.Sin(age * 3.2f + (float)i) * 0.018f);
					val.SetPosition(0, val2 * num2 + Vector3.up * 0.1f);
					val.SetPosition(1, val2 * num3 * 0.34f + val3 * radius * 0.025f + Vector3.up * 0.11f);
					val.SetPosition(2, val2 * num3 * 0.62f - val3 * radius * 0.035f + Vector3.up * 0.12f);
					val.SetPosition(3, val2 * num3 * 0.82f + val3 * radius * 0.02f + Vector3.up * 0.1f);
					val.SetPosition(4, val2 * num3 + Vector3.up * 0.09f);
					((Color)(ref startColor))..ctor(0.85f, 0.025f, 0.035f, 0.78f * alpha);
					((Color)(ref endColor))..ctor(0.08f, 0.001f, 0.003f, 0f);
					val.startColor = startColor;
					val.endColor = endColor;
					val.widthMultiplier = (0.15f + (float)(i % 3) * 0.035f) * alpha * (1f + Mathf.Sin(age * 11f + (float)i) * 0.18f);
				}
			}
		}

		private void UpdateCurseWisps(float alpha)
		{
			//IL_00f9: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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_016a: 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_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			if (curseWisps == null)
			{
				return;
			}
			Vector3 val2 = default(Vector3);
			Vector3 val3 = default(Vector3);
			for (int i = 0; i < curseWisps.Length; i++)
			{
				LineRenderer val = curseWisps[i];
				if (Object.op_Implicit((Object)(object)val))
				{
					float num = (float)i * 2.39996f;
					float num2 = radius * (0.24f + (float)(i % 7) * 0.095f);
					float num3 = num + age * (0.2f + (float)(i % 3) * 0.09f);
					((Vector3)(ref val2))..ctor(Mathf.Cos(num3) * num2, 0.15f, Mathf.Sin(num3) * num2);
					((Vector3)(ref val3))..ctor(0f - Mathf.Sin(num3), 0f, Mathf.Cos(num3));
					for (int j = 0; j < 7; j++)
					{
						float num4 = (float)j / 6f;
						float num5 = radius * (0.08f + (float)(i % 5) * 0.018f) * num4;
						float num6 = Mathf.Sin(age * 4.5f + num + num4 * 8f) * radius * 0.018f * num4;
						val.SetPosition(j, val2 + Vector3.up * num5 + val3 * num6);
					}
					Color val4 = ((i % 4 == 0) ? new Color(0.75f, 0.02f, 0.035f, 0.76f * alpha) : new Color(0.045f, 0.005f, 0.012f, 0.7f * alpha));
					Color endColor = val4;
					endColor.a = 0f;
					val.startColor = val4;
					val.endColor = endColor;
					val.widthMultiplier = (0.18f + (float)(i % 4) * 0.035f) * alpha;
				}
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)shrineMaterial))
			{
				Object.Destroy((Object)(object)shrineMaterial);
			}
			if (Object.op_Implicit((Object)(object)ringMaterial))
			{
				Object.Destroy((Object)(object)ringMaterial);
			}
			if (hazeMaterials != null)
			{
				for (int i = 0; i < hazeMaterials.Length; i++)
				{
					if (Object.op_Implicit((Object)(object)hazeMaterials[i]))
					{
						Object.Destroy((Object)(object)hazeMaterials[i]);
					}
				}
			}
			if (Object.op_Implicit((Object)(object)sigilMaterial))
			{
				Object.Destroy((Object)(object)sigilMaterial);
			}
			if (Object.op_Implicit((Object)(object)wispMaterial))
			{
				Object.Destroy((Object)(object)wispMaterial);
			}
		}
	}
	internal static class SukunaImportedModel
	{
		private sealed class ModelData
		{
			internal string[] BoneNames;

			internal int[] ParentIndices;

			internal Vector3[] BonePositions;

			internal Quaternion[] BoneRotations;

			internal Vector3[] BoneScales;

			internal MeshData[] Meshes;
		}

		private sealed class MeshData
		{
			internal string Name;

			internal int OutfitIndex;

			internal string MaterialName;

			internal string TextureName;

			internal bool IsDecal;

			internal Vector3[] Vertices;

			internal Vector3[] Normals;

			internal Vector2[] Uvs;

			internal BoneWeight[] BoneWeights;

			internal int[] Triangles;
		}

		private const string ModelFileName = "sukuna.model";

		private const string TextureDirectoryName = "sukuna";

		private const int OutfitCount = 5;

		private const int SharedOutfitIndex = 5;

		private static readonly int[] SelfContainedOutfits = new int[2] { 3, 4 };

		private const int OutfitGroupCount = 6;

		private const float NativeModelScale = 1.27f;

		private static ModelData cachedModel;

		private static readonly Dictionary<string, Texture2D> textureCache = new Dictionary<string, Texture2D>(StringComparer.Ordinal);

		private static readonly Dictionary<string, Sprite> iconCache = new Dictionary<string, Sprite>(StringComparer.Ordinal);

		private static Material cachedTemplateMaterial;

		private static readonly HashSet<string> loggedShaders = new HashSet<string>(StringComparer.Ordinal);

		internal static bool Apply(GameObject prefab)
		{
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_0179: 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_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = null;
			try
			{
				Plugin.Log.LogInfo((object)("Preparing supplied Sukuna rig for " + ((Object)prefab).name + "."));
				CharacterModel componentInChildren = prefab.GetComponentInChildren<CharacterModel>(true);
				if (!Object.op_Implicit((Object)(object)componentInChildren))
				{
					Plugin.Log.LogWarning((object)("CharacterModel was not found while applying Sukuna model to " + ((Object)prefab).name + "."));
					return false;
				}
				ModelData modelData = LoadModel();
				Material val2 = FindTemplateMaterial(componentInChildren);
				if (modelData == null)
				{
					Plugin.Log.LogError((object)("Sukuna model data could not be loaded for " + ((Object)prefab).name + "; the Mercenary fallback will remain visible."));
					return false;
				}
				if (!Object.op_Implicit((Object)(object)val2))
				{
					Plugin.Log.LogError((object)("No safe material template was available for " + ((Object)prefab).name + "; the Mercenary fallback will remain visible."));
					return false;
				}
				Plugin.Log.LogInfo((object)("Loaded Sukuna runtime data for " + ((Object)prefab).name + ": " + $"{modelData.BoneNames.Length} bones, " + $"{modelData.Meshes.Length} mesh parts."));
				Renderer[] componentsInChildren = ((Component)componentInChildren).GetComponentsInChildren<Renderer>(true);
				Light[] componentsInChildren2 = ((Component)componentInChildren).GetComponentsInChildren<Light>(true);
				Animator animator = ((Component)componentInChildren).GetComponent<Animator>() ?? ((Component)componentInChildren).GetComponentInChildren<Animator>(true);
				val = new GameObject("SukunaImportedModel");
				val.layer = ((Component)componentInChildren).gameObject.layer;
				Transform transform = val.transform;
				transform.SetParent(((Component)componentInChildren).transform, false);
				transform.localPosition = Vector3.zero;
				transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
				transform.localScale = Vector3.one * ((JujutsuConfig.SukunaModelScale != null) ? JujutsuConfig.SukunaModelScale.Value : 1.27f);
				Transform[] array = BuildSkeleton(modelData, transform);
				GameObject[] outfitGroups = BuildOutfitGroups(transform);
				List<RendererInfo> list = BuildMeshes(modelData, array, outfitGroups, val2, ((Component)componentInChildren).gameObject.layer);
				if (list.Count == 0)
				{
					Object.DestroyImmediate((Object)(object)val);
					Plugin.Log.LogError((object)("Sukuna model contained no usable renderers for " + ((Object)prefab).name + "."));
					return false;
				}
				RendererInfo[] baseRendererInfos = componentInChildren.baseRendererInfos;
				foreach (RendererInfo val3 in baseRendererInfos)
				{
					if (Object.op_Implicit((Object)(object)val3.renderer))
					{
						val3.renderer.enabled = false;
					}
				}
				RendererInfo[] array2 = (componentInChildren.baseRendererInfos = list.ToArray());
				componentInChildren.mainSkinnedMeshRenderer = FindMainRenderer(array2);
				componentInChildren.materialsDirty = true;
				componentInChildren.forceUpdate = true;
				Renderer[] array3 = (Renderer[])(object)new Renderer[array2.Length];
				for (int j = 0; j < array2.Length; j++)
				{
					array3[j] = array2[j].renderer;
				}
				val.AddComponent<GojoModelVisibilityController>().Configure(componentsInChildren, array3, componentsInChildren2);
				val.AddComponent<SukunaMixamoAnimationDriver>().Configure(modelData.BoneNames, array);
				bool flag = Array.IndexOf(modelData.BoneNames, "mixamorig:Hips") >= 0;
				if (!flag)
				{
					val.AddComponent<SukunaSettAnimationDriver>().Configure(modelData.BoneNames, array);
				}
				val.AddComponent<GojoModelAnimator>().Configure(componentInChildren, modelData.BoneNames, array);
				val.AddComponent<JujutsuFootPlanting>();
				ConfigureSkins(componentInChildren, animator, array2, outfitGroups, FindOutfitsWithGeometry(modelData));
				Plugin.Log.LogInfo((object)("Applied supplied Sukuna rig to " + ((Object)prefab).name + ": " + $"{modelData.BoneNames.Length} bones, " + $"{array2.Length} skinned renderers, " + $"{modelData.Meshes.Length} mesh parts, " + (flag ? "native Mixamo animation" : "retarget animation") + "."));
				return true;
			}
			catch (Exception arg)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					Object.DestroyImmediate((Object)(object)val);
				}
				Plugin.Log.LogError((object)$"Could not build imported Sukuna model: {arg}");
				return false;
			}
		}

		private static ModelData LoadModel()
		{
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: 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_0188: 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_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			if (cachedModel != null)
			{
				return cachedModel;
			}
			string text = JujutsuAssetPaths.Find(new string[2] { "assets", "sukuna.model" });
			if (!File.Exists(text))
			{
				Plugin.Log.LogWarning((object)("Sukuna model data was not found: " + text));
				return null;
			}
			using FileStream fileStream = File.OpenRead(text);
			using BinaryReader binaryReader = new BinaryReader(fileStream);
			byte[] array = new byte[8] { 83, 85, 75, 78, 77, 68, 76, 49 };
			byte[] array2 = binaryReader.ReadBytes(array.Length);
			if (array2.Length != array.Length)
			{
				throw new InvalidDataException("Sukuna model header is incomplete.");
			}
			for (int i = 0; i < array.Length; i++)
			{
				if (array2[i] != array[i])
				{
					throw new InvalidDataException("Sukuna model header is invalid.");
				}
			}
			int num = binaryReader.ReadInt32();
			if (num != 2)
			{
				throw new InvalidDataException($"Unsupported Sukuna model version {num}.");
			}
			int num2 = ReadSafeCount(binaryReader, 1, 1024, "bone");
			ModelData modelData = new ModelData
			{
				BoneNames = new string[num2],
				ParentIndices = new int[num2],
				BonePositions = (Vector3[])(object)new Vector3[num2],
				BoneRotations = (Quaternion[])(object)new Quaternion[num2],
				BoneScales = (Vector3[])(object)new Vector3[num2]
			};
			for (int j = 0; j < num2; j++)
			{
				modelData.BoneNames[j] = binaryReader.ReadString();
				modelData.ParentIndices[j] = binaryReader.ReadInt32();
				modelData.BonePositions[j] = ReadVector3(binaryReader);
				modelData.BoneRotations[j] = ReadQuaternion(binaryReader);
				modelData.BoneScales[j] = ReadVector3(binaryReader);
				if (modelData.ParentIndices[j] >= j || modelData.ParentIndices[j] < -1)
				{
					throw new InvalidDataException($"Sukuna bone {j} has an invalid parent.");
				}
			}
			int num3 = ReadSafeCount(binaryReader, 1, 128, "mesh");
			modelData.Meshes = new MeshData[num3];
			Vector2 val3 = default(Vector2);
			for (int k = 0; k < num3; k++)
			{
				MeshData meshData = new MeshData
				{
					Name = binaryReader.ReadString(),
					OutfitIndex = binaryReader.ReadInt32(),
					MaterialName = binaryReader.ReadString(),
					TextureName = binaryReader.ReadString(),
					IsDecal = binaryReader.ReadBoolean()
				};
				if ((uint)meshData.OutfitIndex >= 6u)
				{
					throw new InvalidDataException("Sukuna mesh " + meshData.Name + " has an invalid outfit.");
				}
				int num4 = ReadSafeCount(binaryReader, 3, 100000, "vertex");
				meshData.Vertices = (Vector3[])(object)new Vector3[num4];
				meshData.Normals = (Vector3[])(object)new Vector3[num4];
				meshData.Uvs = (Vector2[])(object)new Vector2[num4];
				meshData.BoneWeights = (BoneWeight[])(object)new BoneWeight[num4];
				for (int l = 0; l < num4; l++)
				{
					Vector3 val = ReadVector3(binaryReader);
					Vector3 val2 = ReadVector3(binaryReader);
					((Vector2)(ref val3))..ctor(binaryReader.ReadSingle(), binaryReader.ReadSingle());
					BoneWeight val4 = default(BoneWeight);
					((BoneWeight)(ref val4)).boneIndex0 = binaryReader.ReadInt32();
					((BoneWeight)(ref val4)).boneIndex1 = binaryReader.ReadInt32();
					((BoneWeight)(ref val4)).boneIndex2 = binaryReader.ReadInt32();
					((BoneWeight)(ref val4)).boneIndex3 = binaryReader.ReadInt32();
					((BoneWeight)(ref val4)).weight0 = binaryReader.ReadSingle();
					((BoneWeight)(ref val4)).weight1 = binaryReader.ReadSingle();
					((BoneWeight)(ref val4)).weight2 = binaryReader.ReadSingle();
					((BoneWeight)(ref val4)).weight3 = binaryReader.ReadSingle();
					BoneWeight val5 = val4;
					ValidateVertex(meshData.Name, l, val, val2, val5, num2);
					meshData.Vertices[l] = val;
					meshData.Normals[l] = val2;
					meshData.Uvs[l] = val3;
					meshData.BoneWeights[l] = val5;
				}
				int num5 = ReadSafeCount(binaryReader, 3, 1000000, "index");
				if (num5 % 3 != 0)
				{
					throw new InvalidDataException("Sukuna mesh " + meshData.Name + " has incomplete triangles.");
				}
				meshData.Triangles = new int[num5];
				for (int m = 0; m < num5; m++)
				{
					int num6 = binaryReader.ReadInt32();
					if ((uint)num6 >= (uint)num4)
					{
						throw new InvalidDataException("Sukuna mesh " + meshData.Name + " references a missing vertex.");
					}
					meshData.Triangles[m] = num6;
				}
				modelData.Meshes[k] = meshData;
			}
			if (fileStream.Position != fileStream.Length)
			{
				Plugin.Log.LogWarning((object)$"Sukuna model has {fileStream.Length - fileStream.Position} trailing bytes.");
			}
			cachedModel = modelData;
			return cachedModel;
		}

		private static int ReadSafeCount(BinaryReader reader, int minimum, int maximum, string label)
		{
			int num = reader.ReadInt32();
			if (num < minimum || num > maximum)
			{
				throw new InvalidDataException($"Unsafe Sukuna {label} count {num}.");
			}
			return num;
		}

		private static void ValidateVertex(string meshName, int vertexIndex, Vector3 vertex, Vector3 normal, BoneWeight weight, int boneCount)
		{
			//IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_005d: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			if (!IsFinite(vertex.x) || !IsFinite(vertex.y) || !IsFinite(vertex.z) || Mathf.Abs(vertex.x) > 20f || Mathf.Abs(vertex.y) > 20f || Mathf.Abs(vertex.z) > 20f || !IsFinite(normal.x) || !IsFinite(normal.y) || !IsFinite(normal.z))
			{
				throw new InvalidDataException($"Sukuna mesh {meshName} has an unsafe vertex {vertexIndex}.");
			}
			int[] array = new int[4]
			{
				((BoneWeight)(ref weight)).boneIndex0,
				((BoneWeight)(ref weight)).boneIndex1,
				((BoneWeight)(ref weight)).boneIndex2,
				((BoneWeight)(ref weight)).boneIndex3
			};
			for (int i = 0; i < array.Length; i++)
			{
				if ((uint)array[i] >= (uint)boneCount)
				{
					throw new InvalidDataException("Sukuna mesh " + meshName + " references an invalid bone.");
				}
			}
		}

		private static bool IsFinite(float value)
		{
			if (!float.IsNaN(value))
			{
				return !float.IsInfinity(value);
			}
			return false;
		}

		private static Transform[] BuildSkeleton(ModelData modelData, Transform container)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			Transform[] array = (Transform[])(object)new Transform[modelData.BoneNames.Length];
			for (int i = 0; i < array.Length; i++)
			{
				Transform transform = new GameObject(modelData.BoneNames[i])
				{
					layer = ((Component)container).gameObject.layer
				}.transform;
				int num = modelData.ParentIndices[i];
				transform.SetParent((num >= 0) ? array[num] : container, false);
				transform.localPosition = modelData.BonePositions[i];
				transform.localRotation = modelData.BoneRotations[i];
				transform.localScale = modelData.BoneScales[i];
				array[i] = transform;
			}
			return array;
		}

		private static GameObject[] BuildOutfitGroups(Transform container)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			string[] array = new string[6] { "SukunaOutfitDefault", "SukunaOutfitShirtless", "SukunaOutfitKimono", "SukunaOutfitShinjuku", "SukunaOutfitSendai", "SukunaOutfitShared" };
			GameObject[] array2 = (GameObject[])(object)new GameObject[6];
			for (int i = 0; i < array2.Length; i++)
			{
				array2[i] = new GameObject(array[i]);
				array2[i].layer = ((Component)container).gameObject.layer;
				array2[i].transform.SetParent(container, false);
				array2[i].SetActive(i == 0 || i == 5);
			}
			return array2;
		}

		private static List<RendererInfo> BuildMeshes(ModelData modelData, Transform[] skeleton, GameObject[] outfitGroups, Material template, int layer)
		{
			//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_0044: 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_0069: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			List<RendererInfo> list = new List<RendererInfo>(modelData.Meshes.Length);
			Dictionary<string, Material> dictionary = new Dictionary<string, Material>(StringComparer.Ordinal);
			for (int i = 0; i < modelData.Meshes.Length; i++)
			{
				MeshData meshData = modelData.Meshes[i];
				Mesh val = new Mesh
				{
					name = "meshSukuna_" + meshData.Name,
					indexFormat = (IndexFormat)(meshData.Vertices.Length > 65535),
					vertices = meshData.Vertices,
					normals = meshData.Normals,
					uv = meshData.Uvs,
					triangles = meshData.Triangles
				};
				GameObject val2 = new GameObject(meshData.Name);
				val2.layer = layer;
				Transform transform = val2.transform;
				transform.SetParent(outfitGroups[meshData.OutfitIndex].transform, false);
				BuildCompactSkinningData(meshData.BoneWeights, skeleton, out var compactWeights, out var compactBones, out var bindPoses);
				val.boneWeights = compactWeights;
				for (int j = 0; j < compactBones.Length; j++)
				{
					bindPoses[j] = compactBones[j].worldToLocalMatrix * transform.localToWorldMatrix;
				}
				val.bindposes = bindPoses;
				val.RecalculateBounds();
				string key = meshData.MaterialName + "\n" + meshData.TextureName + "\n" + meshData.IsDecal;
				if (!dictionary.TryGetValue(key, out var value))
				{
					value = CreateMaterial(template, meshData.MaterialName, meshData.TextureName, meshData.IsDecal);
					dictionary.Add(key, value);
				}
				SkinnedMeshRenderer val3 = val2.AddComponent<SkinnedMeshRenderer>();
				val3.sharedMesh = val;
				val3.bones = compactBones;
				val3.rootBone = skeleton[0];
				((Renderer)val3).sharedMaterial = value;
				((Renderer)val3).shadowCastingMode = (ShadowCastingMode)1;
				((Renderer)val3).receiveShadows = true;
				val3.quality = (SkinQuality)4;
				val3.updateWhenOffscreen = false;
				Bounds bounds = val.bounds;
				((Bounds)(ref bounds)).Expand(3f);
				((Renderer)val3).localBounds = bounds;
				((Renderer)val3).enabled = true;
				if (meshData.Name.StartsWith("Haori", StringComparison.OrdinalIgnoreCase))
				{
					JujutsuSleevePhysics.Attach(val3, skeleton);
				}
				list.Add(new RendererInfo
				{
					renderer = (Renderer)(object)val3,
					defaultMaterial = value,
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				});
			}
			return list;
		}

		private static void BuildCompactSkinningData(BoneWeight[] sourceWeights, Transform[] skeleton, out BoneWeight[] compactWeights, out Transform[] compactBones, out Matrix4x4[] bindPoses)
		{
			//IL_0014: 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_00f9: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			SortedSet<int> sortedSet = new SortedSet<int> { 0 };
			for (int i = 0; i < sourceWeights.Length; i++)
			{
				BoneWeight val = sourceWeights[i];
				AddUsedBone(sortedSet, ((BoneWeight)(ref val)).boneIndex0, ((BoneWeight)(ref val)).weight0);
				AddUsedBone(sortedSet, ((BoneWeight)(ref val)).boneIndex1, ((BoneWeight)(ref val)).weight1);
				AddUsedBone(sortedSet, ((BoneWeight)(ref val)).boneIndex2, ((BoneWeight)(ref val)).weight2);
				AddUsedBone(sortedSet, ((BoneWeight)(ref val)).boneIndex3, ((BoneWeight)(ref val)).weight3);
			}
			int[] array = new int[sortedSet.Count];
			sortedSet.CopyTo(array);
			int[] array2 = new int[skeleton.Length];
			for (int j = 0; j < array2.Length; j++)
			{
				array2[j] = -1;
			}
			compactBones = (Transform[])(object)new Transform[array.Length];
			bindPoses = (Matrix4x4[])(object)new Matrix4x4[array.Length];
			for (int k = 0; k < array.Length; k++)
			{
				int num = array[k];
				array2[num] = k;
				compactBones[k] = skeleton[num];
			}
			compactWeights = (BoneWeight[])(object)new BoneWeight[sourceWeights.Length];
			for (int l = 0; l < sourceWeights.Length; l++)
			{
				BoneWeight val2 = sourceWeights[l];
				BoneWeight[] obj = compactWeights;
				int num2 = l;
				BoneWeight val3 = default(BoneWeight);
				((BoneWeight)(ref val3)).boneIndex0 = RemapBone(array2, ((BoneWeight)(ref val2)).boneIndex0, ((BoneWeight)(ref val2)).weight0);
				((BoneWeight)(ref val3)).boneIndex1 = RemapBone(array2, ((BoneWeight)(ref val2)).boneIndex1, ((BoneWeight)(ref val2)).weight1);
				((BoneWeight)(ref val3)).boneIndex2 = RemapBone(array2, ((BoneWeight)(ref val2)).boneIndex2, ((BoneWeight)(ref val2)).weight2);
				((BoneWeight)(ref val3)).boneIndex3 = RemapBone(array2, ((BoneWeight)(ref val2)).boneIndex3, ((BoneWeight)(ref val2)).weight3);
				((BoneWeight)(ref val3)).weight0 = ((BoneWeight)(ref val2)).weight0;
				((BoneWeight)(ref val3)).weight1 = ((BoneWeight)(ref val2)).weight1;
				((BoneWeight)(ref val3)).weight2 = ((BoneWeight)(ref val2)).weight2;
				((BoneWeight)(ref val3)).weight3 = ((BoneWeight)(ref val2)).weight3;
				obj[num2] = val3;
			}
		}

		private static void AddUsedBone(SortedSet<int> indices, int index, float weight)
		{
			if (weight > 1E-06f)
			{
				indices.Add(index);
			}
		}

		private static int RemapBone(int[] localIndexByGlobal, int globalIndex, float weight)
		{
			if (weight <= 1E-06f)
			{
				return 0;
			}
			int num = localIndexByGlobal[globalIndex];
			if (num < 0)
			{
				return 0;
			}
			return num;
		}

		private static Material CreateMaterial(Material template, string materialName, string textureName, bool isDecal)
		{
			//IL_0085: 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_00a5: 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)
			Material val = Object.Instantiate<Material>(template);
			((Object)val).name = "matSukuna_" + materialName;
			Texture2D texture = LoadTexture(textureName);
			SetTextureIfPresent(val, "_NormalTex", null);
			SetTextureIfPresent(val, "_BumpMap", null);
			SetTextureIfPresent(val, "_EmTex", null);
			SetTextureIfPresent(val, "_EmissionMap", null);
			SetTextureIfPresent(val, "_DetailAlbedoMap", null);
			SetTextureIfPresent(val, "_DetailNormalMap", null);
			SetTextureIfPresent(val, "_MainTex", (Texture)(object)texture);
			SetTextureIfPresent(val, "_BaseColorMap", (Texture)(object)texture);
			SetColorIfPresent(val, "_Color", Color.white);
			SetColorIfPresent(val, "_MainColor", Color.white);
			SetColorIfPresent(val, "_EmissionColor", Color.black);
			SetColorIfPresent(val, "_EmColor", Color.black);