Decompiled source of YujiItadori v1.2.1

plugins/YujiItadori/YujiItadori.dll

Decompiled 2 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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 BepInEx.Logging;
using EntityStates;
using GojoSatoruMod.Components;
using GojoSatoruMod.Content;
using GojoSatoruMod.States;
using GojoSatoruMod.Visuals;
using KinematicCharacterController;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
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("YujiItadori")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1+fd97d1e734adcd9e1245285b6bc69f1c40353929")]
[assembly: AssemblyProduct("YujiItadori")]
[assembly: AssemblyTitle("YujiItadori")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
namespace GojoSatoruMod.Yuji
{
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInDependency("dev.marmennz.satorugojo", "1.2.1")]
	[BepInPlugin("dev.marmennz.yujiitadori", "Yuji Itadori", "1.2.1")]
	public sealed class YujiPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "dev.marmennz.yujiitadori";

		public const string PluginVersion = "1.2.1";

		public const string PluginName = "Yuji Itadori";

		private void Awake()
		{
			JujutsuStartup.UseHost((MonoBehaviour)(object)this);
			JujutsuAssetPaths.AddPlugin(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location));
			JujutsuStartup.Step("Yuji's text", (Action)YujiLanguage.Register);
			JujutsuStartup.Step("Yuji's assets", (Action)YujiAssets.Initialize);
			JujutsuStartup.Step("Yuji's voice", (Func<IEnumerator>)YujiAssets.LoadVoices);
			JujutsuStartup.Step("Yuji's flow buff", (Action)YujiBuffs.Register);
			JujutsuStartup.Step("Yuji's vessel", (Action)YujiVessel.Initialize);
			JujutsuStartup.Step("Yuji's flow", (Action)delegate
			{
				JujutsuHitSync.Register("yuji-flow-claim", 12f, (Action<CharacterBody, Vector3, Vector3, float, bool>)YujiVessel.LandFlow);
			});
			JujutsuStartup.Survivor("Yuji", (Action)YujiSurvivor.Initialize);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Yuji Itadori 1.2.1 loaded.");
		}
	}
	internal static class GeneratedVersion
	{
		internal const string Value = "1.2.1";
	}
}
namespace GojoSatoruMod.Visuals
{
	internal static class YujiExtraSkins
	{
		private sealed class Part
		{
			internal string Name;

			internal int Outfit;

			internal string Texture;

			internal bool IsCutout;

			internal Vector3[] Vertices;

			internal Vector3[] Normals;

			internal Vector2[] Uvs;

			internal BoneWeight[] Weights;

			internal int[] Triangles;
		}

		private const string ModelFileName = "yuji-skins.model";

		private const string TextureDirectoryName = "yuji-skins";

		private static readonly string[] SkinNames = new string[6] { "SECOND", "THIRD", "FOURTH", "FIFTH", "SIXTH", "SEVENTH" };

		private static readonly (Color Primary, Color Secondary)[] SkinIconColors = new(Color, Color)[6]
		{
			(new Color(0.9f, 0.42f, 0.3f), new Color(0.28f, 0.11f, 0.09f)),
			(new Color(0.62f, 0.66f, 0.72f), new Color(0.18f, 0.2f, 0.24f)),
			(new Color(0.45f, 0.58f, 0.86f), new Color(0.13f, 0.17f, 0.29f)),
			(new Color(0.78f, 0.72f, 0.36f), new Color(0.24f, 0.21f, 0.1f)),
			(new Color(0.36f, 0.62f, 0.45f), new Color(0.11f, 0.2f, 0.14f)),
			(new Color(0.07f, 0.09f, 0.2f), new Color(0.62f, 0.1f, 0.09f))
		};

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

		private static string[] boneNames;

		private static Matrix4x4[] rest;

		private static List<Part> parts;

		private static readonly HashSet<int> applied = new HashSet<int>();

		private static bool reportedMaterial;

		internal static void RegisterOnPrefab(GameObject bodyPrefab)
		{
			try
			{
				ModelSkinController val = (Object.op_Implicit((Object)(object)bodyPrefab) ? bodyPrefab.GetComponentInChildren<ModelSkinController>(true) : null);
				if (!Object.op_Implicit((Object)(object)val))
				{
					return;
				}
				if (!File.Exists(JujutsuAssetPaths.Find(new string[2] { "assets", "yuji-skins.model" })))
				{
					Plugin.Log.LogInfo((object)"Yuji extra skins: yuji-skins.model is absent, so only his own outfit is offered.");
					return;
				}
				Transform val2 = (Object.op_Implicit((Object)(object)val.characterModel) ? ((Component)val.characterModel).transform : ((Component)val).transform);
				GameObject[] array = (GameObject[])(object)new GameObject[SkinNames.Length];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = MakeGroup(val2, "YujiOutfit" + SkinNames[i]);
					array[i].SetActive(false);
				}
				GameObject val3 = MakeGroup(val2, "YujiOutfitDEFAULT");
				val3.SetActive(true);
				SkinnedMeshRenderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<SkinnedMeshRenderer>(true);
				foreach (SkinnedMeshRenderer val4 in componentsInChildren)
				{
					if ((Object)(object)((Component)val4).gameObject != (Object)(object)val3 && !IsInside(((Component)val4).transform, array) && !((Component)val4).transform.IsChildOf(val3.transform))
					{
						((Component)val4).transform.SetParent(val3.transform, true);
					}
				}
				List<GameObject> ownMeshes = new List<GameObject> { val3 };
				List<SkinDef> list = new List<SkinDef> { BuildSkin("DEFAULT", -1, 0, ((Component)val2).gameObject, array, ownMeshes) };
				for (int k = 0; k < array.Length; k++)
				{
					list.Add(BuildSkin(SkinNames[k], k, k + 1, ((Component)val2).gameObject, array, ownMeshes));
				}
				val.skins = list.ToArray();
				Plugin.Log.LogInfo((object)($"Yuji extra skins: registered {list.Count} skins on " + ((Object)bodyPrefab).name + "."));
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"Yuji extra skins could not be registered: {arg}");
			}
		}

		private static void ReportRest(Transform[] bones, Transform root)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0095: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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_0175: 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)
			Matrix4x4 worldToLocalMatrix = root.worldToLocalMatrix;
			string[] array = new string[6] { "mixamorig:Hips", "mixamorig:Spine", "mixamorig:Head", "mixamorig:LeftArm", "mixamorig:LeftHand", "mixamorig:LeftFoot" };
			foreach (string text in array)
			{
				int num = Array.IndexOf(boneNames, text);
				if (num >= 0 && Object.op_Implicit((Object)(object)bones[num]))
				{
					Vector3 val = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint3x4(bones[num].position);
					Vector3 val2 = Vector4.op_Implicit(((Matrix4x4)(ref rest[num])).GetColumn(3));
					Matrix4x4 val3 = worldToLocalMatrix * bones[num].localToWorldMatrix;
					Vector3 val4 = Vector4.op_Implicit(((Matrix4x4)(ref val3)).GetColumn(2));
					val3 = worldToLocalMatrix * bones[num].localToWorldMatrix;
					float num2 = Quaternion.Angle(Quaternion.LookRotation(val4, Vector4.op_Implicit(((Matrix4x4)(ref val3)).GetColumn(1))), Quaternion.LookRotation(Vector4.op_Implicit(((Matrix4x4)(ref rest[num])).GetColumn(2)), Vector4.op_Implicit(((Matrix4x4)(ref rest[num])).GetColumn(1))));
					Plugin.Log.LogInfo((object)("Yuji extra skins: " + text + " live=" + $"({val.x:0.000},{val.y:0.000},{val.z:0.000}) file=" + $"({val2.x:0.000},{val2.y:0.000},{val2.z:0.000}) " + $"twist={num2:0.0} deg"));
				}
			}
		}

		private static GameObject MakeGroup(Transform root, string name)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Transform val = root.Find(name);
			object obj = (Object.op_Implicit((Object)(object)val) ? ((object)((Component)val).gameObject) : ((object)new GameObject(name)));
			((GameObject)obj).layer = ((Component)root).gameObject.layer;
			((GameObject)obj).transform.SetParent(root, false);
			return (GameObject)obj;
		}

		private static bool IsInside(Transform candidate, GameObject[] groups)
		{
			foreach (GameObject val in groups)
			{
				if (candidate.IsChildOf(val.transform))
				{
					return true;
				}
			}
			return false;
		}

		private static SkinDef BuildSkin(string skinName, int shown, int colorIndex, GameObject root, GameObject[] groups, List<GameObject> ownMeshes)
		{
			//IL_00f5: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			SkinDef val = ScriptableObject.CreateInstance<SkinDef>();
			((Object)val).name = "skinYuji" + skinName;
			val.nameToken = "CODEX_YUJI_SKIN_" + skinName + "_NAME";
			int index = Mathf.Clamp(colorIndex, 0, SkinIconColors.Length - 1);
			val.icon = GojoAssets.LoadIcon("yuji-skin-" + skinName.ToLowerInvariant(), (Func<Sprite>)(() => GojoAssets.CreateSkinIcon("texYujiSkin" + skinName, SkinIconColors[index].Primary, SkinIconColors[index].Secondary)));
			val.rootObject = root;
			val.baseSkins = Array.Empty<SkinDef>();
			val.unlockableDef = null;
			SkinDefParams val2 = ScriptableObject.CreateInstance<SkinDefParams>();
			((Object)val2).name = "skinParamsYuji" + skinName;
			val2.rendererInfos = Array.Empty<RendererInfo>();
			val2.meshReplacements = Array.Empty<MeshReplacement>();
			val2.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
			val2.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
			List<GameObjectActivation> list = new List<GameObjectActivation>();
			for (int num = 0; num < groups.Length; num++)
			{
				list.Add(new GameObjectActivation
				{
					gameObject = groups[num],
					shouldActivate = (num == shown)
				});
			}
			foreach (GameObject ownMesh in ownMeshes)
			{
				list.Add(new GameObjectActivation
				{
					gameObject = ownMesh,
					shouldActivate = (shown < 0)
				});
			}
			val2.gameObjectActivations = list.ToArray();
			val.skinDefParams = val2;
			val.Bake();
			return val;
		}

		internal static void Apply(CharacterModel characterModel)
		{
			try
			{
				if (!Object.op_Implicit((Object)(object)characterModel))
				{
					return;
				}
				GameObject[] array = FindGroups(characterModel);
				if (array == null || !Load() || !applied.Add(((Object)characterModel).GetInstanceID()))
				{
					return;
				}
				SkinnedMeshRenderer val = FindTemplate(characterModel);
				if (!Object.op_Implicit((Object)(object)val))
				{
					Plugin.Log.LogWarning((object)"Yuji extra skins: the rig has no skinned renderer to take a material from. Skipped.");
					return;
				}
				int found;
				Transform[] bones = ResolveBones(characterModel, out found);
				Plugin.Log.LogInfo((object)($"Yuji extra skins: {found} of {boneNames.Length} bones " + "found on the live rig by name."));
				if (found < boneNames.Length / 2)
				{
					Plugin.Log.LogWarning((object)"Yuji extra skins: too few bones resolved. Skipped.");
					return;
				}
				MeasureAgainstRig(bones, ((Component)characterModel).transform, out var bindPoses, out var offsets, out var scale);
				ReportRest(bones, ((Component)characterModel).transform);
				int num = 0;
				float[] array2 = new float[array.Length];
				for (int i = 0; i < array2.Length; i++)
				{
					array2[i] = float.MinValue;
				}
				foreach (Part part in parts)
				{
					if ((uint)part.Outfit < (uint)array.Length)
					{
						float num2 = BuildRenderer(part, bones, bindPoses, offsets, scale, val, array[part.Outfit].transform);
						if (!IsDecal(part) && num2 > array2[part.Outfit])
						{
							array2[part.Outfit] = num2;
						}
						num++;
					}
				}
				JujutsuNeckFit.NoteOutfitHeights(array2);
				Plugin.Log.LogInfo((object)($"Yuji extra skins: built {num} outfit renderers on " + ((Object)characterModel).name + "."));
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"Yuji extra skins could not be applied: {arg}");
			}
		}

		private static SkinnedMeshRenderer FindTemplate(CharacterModel characterModel)
		{
			SkinnedMeshRenderer val = null;
			SkinnedMeshRenderer[] componentsInChildren = ((Component)characterModel).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val2 in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)val2.sharedMesh) && !((Object)(object)((Renderer)val2).sharedMaterial == (Object)null) && ((Object)(object)val == (Object)null || val2.sharedMesh.vertexCount > val.sharedMesh.vertexCount))
				{
					val = val2;
				}
			}
			return val;
		}

		private static GameObject[] FindGroups(CharacterModel characterModel)
		{
			GameObject[] array = (GameObject[])(object)new GameObject[SkinNames.Length];
			for (int i = 0; i < array.Length; i++)
			{
				Transform val = ((Component)characterModel).transform.Find("YujiOutfit" + SkinNames[i]);
				if (!Object.op_Implicit((Object)(object)val))
				{
					return null;
				}
				array[i] = ((Component)val).gameObject;
			}
			return array;
		}

		private static Transform[] ResolveBones(CharacterModel characterModel, out int found)
		{
			Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(StringComparer.Ordinal);
			Transform[] componentsInChildren = ((Component)characterModel).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (!dictionary.ContainsKey(((Object)val).name))
				{
					dictionary[((Object)val).name] = val;
				}
			}
			found = 0;
			Transform[] array = (Transform[])(object)new Transform[boneNames.Length];
			for (int j = 0; j < boneNames.Length; j++)
			{
				if (dictionary.TryGetValue(boneNames[j], out var value))
				{
					array[j] = value;
					found++;
					continue;
				}
				foreach (KeyValuePair<string, Transform> item in dictionary)
				{
					if (item.Key.EndsWith(boneNames[j], StringComparison.Ordinal))
					{
						array[j] = item.Value;
						found++;
						break;
					}
				}
				if (!Object.op_Implicit((Object)(object)array[j]))
				{
					array[j] = ((Component)characterModel).transform;
				}
			}
			return array;
		}

		private static Vector3 ToRigSpace(Vector3 stored)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(stored.x, stored.z, 0f - stored.y);
		}

		private static float MeasureScale(Transform[] bones, Matrix4x4 toRoot)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			int num = Array.IndexOf(boneNames, "mixamorig:Hips");
			int num2 = Array.IndexOf(boneNames, "mixamorig:Head");
			if (num < 0 || num2 < 0 || !Object.op_Implicit((Object)(object)bones[num]) || !Object.op_Implicit((Object)(object)bones[num2]))
			{
				return 1f;
			}
			float num3 = Vector3.Distance(((Matrix4x4)(ref toRoot)).MultiplyPoint3x4(bones[num].position), ((Matrix4x4)(ref toRoot)).MultiplyPoint3x4(bones[num2].position));
			float num4 = Vector3.Distance(Vector4.op_Implicit(((Matrix4x4)(ref rest[num])).GetColumn(3)), Vector4.op_Implicit(((Matrix4x4)(ref rest[num2])).GetColumn(3)));
			if (!(num4 > 0.0001f))
			{
				return 1f;
			}
			return num3 / num4;
		}

		private static void MeasureAgainstRig(Transform[] bones, Transform root, out Matrix4x4[] bindPoses, out Vector3[] offsets, out float scale)
		{
			//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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			bindPoses = (Matrix4x4[])(object)new Matrix4x4[bones.Length];
			offsets = (Vector3[])(object)new Vector3[bones.Length];
			Matrix4x4 worldToLocalMatrix = root.worldToLocalMatrix;
			scale = MeasureScale(bones, worldToLocalMatrix);
			for (int i = 0; i < bones.Length; i++)
			{
				Matrix4x4 val = (Object.op_Implicit((Object)(object)bones[i]) ? (worldToLocalMatrix * bones[i].localToWorldMatrix) : Matrix4x4.identity);
				bindPoses[i] = ((Matrix4x4)(ref val)).inverse;
				offsets[i] = Vector4.op_Implicit(((Matrix4x4)(ref val)).GetColumn(3)) - ToRigSpace(Vector4.op_Implicit(((Matrix4x4)(ref rest[i])).GetColumn(3))) * scale;
			}
			Plugin.Log.LogInfo((object)($"Yuji extra skins: outfits scaled by {scale:0.000} onto the " + "rig, Z-up taken to Y-up."));
		}

		private static float BuildRenderer(Part part, Transform[] bones, Matrix4x4[] bindPoses, Vector3[] offsets, float scale, SkinnedMeshRenderer template, Transform parent)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_01c5: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_012e: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			int num = part.Vertices.Length;
			Mesh val = new Mesh
			{
				name = "meshYuji_" + part.Name,
				indexFormat = (IndexFormat)(num > 65000)
			};
			Vector3[] array = (Vector3[])(object)new Vector3[num];
			Vector3[] array2 = (Vector3[])(object)new Vector3[num];
			float num2 = float.MinValue;
			for (int i = 0; i < num; i++)
			{
				BoneWeight val2 = part.Weights[i];
				Vector3 val3 = offsets[((BoneWeight)(ref val2)).boneIndex0] * ((BoneWeight)(ref val2)).weight0 + offsets[((BoneWeight)(ref val2)).boneIndex1] * ((BoneWeight)(ref val2)).weight1 + offsets[((BoneWeight)(ref val2)).boneIndex2] * ((BoneWeight)(ref val2)).weight2 + offsets[((BoneWeight)(ref val2)).boneIndex3] * ((BoneWeight)(ref val2)).weight3;
				float num3 = ((BoneWeight)(ref val2)).weight0 + ((BoneWeight)(ref val2)).weight1 + ((BoneWeight)(ref val2)).weight2 + ((BoneWeight)(ref val2)).weight3;
				array[i] = ToRigSpace(part.Vertices[i]) * scale + ((num3 > 0.0001f) ? (val3 / num3) : Vector3.zero);
				array2[i] = ToRigSpace(part.Normals[i]);
				if (array[i].y > num2)
				{
					num2 = array[i].y;
				}
			}
			val.vertices = array;
			val.normals = array2;
			val.uv = part.Uvs;
			val.boneWeights = part.Weights;
			val.bindposes = bindPoses;
			val.triangles = part.Triangles;
			val.RecalculateBounds();
			GameObject val4 = new GameObject(part.Name)
			{
				layer = ((Component)parent).gameObject.layer
			};
			val4.transform.SetParent(parent, false);
			SkinnedMeshRenderer obj = val4.AddComponent<SkinnedMeshRenderer>();
			obj.sharedMesh = val;
			obj.bones = bones;
			obj.rootBone = ((bones.Length != 0 && Object.op_Implicit((Object)(object)bones[0])) ? bones[0] : parent);
			((Renderer)obj).sharedMaterial = BuildMaterial(template, part);
			obj.quality = (SkinQuality)4;
			obj.updateWhenOffscreen = true;
			return num2;
		}

		private static Material BuildMaterial(SkinnedMeshRenderer template, Part part)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			Material val = Object.Instantiate<Material>(((Renderer)template).sharedMaterial);
			((Object)val).name = "matYujiSkin_" + part.Name;
			Texture2D val2 = LoadTexture(part.Texture);
			if (val.HasProperty("_MainTex"))
			{
				val.SetTexture("_MainTex", (Texture)(object)val2);
			}
			if (val.HasProperty("_Color"))
			{
				val.SetColor("_Color", Color.white);
			}
			if (part.IsCutout && val.HasProperty("_EnableCutout"))
			{
				val.SetFloat("_EnableCutout", 1f);
			}
			if (IsDecal(part))
			{
				val.SetFloat("_EnableCutout", 1f);
				val.EnableKeyword("CUTOUT");
				ReportMaterial(val, part);
			}
			return val;
		}

		private static void ReportMaterial(Material material, Part part)
		{
			//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)
			if (!reportedMaterial)
			{
				reportedMaterial = true;
				string[] obj = new string[8] { "_EnableCutout", "_Cutoff", "_Mode", "_SrcBlend", "_DstBlend", "_ZWrite", "_MainTex", "_Color" };
				StringBuilder stringBuilder = new StringBuilder();
				string[] array = obj;
				foreach (string text in array)
				{
					stringBuilder.Append(text).Append('=').Append(material.HasProperty(text) ? "yes " : "no ");
				}
				Texture val = (material.HasProperty("_MainTex") ? material.GetTexture("_MainTex") : null);
				ManualLogSource log = Plugin.Log;
				string[] obj2 = new string[11]
				{
					"Yuji extra skins: decal '",
					part.Name,
					"' texture '",
					part.Texture,
					"' loaded=",
					Object.op_Implicit((Object)(object)val) ? (val.width + "x" + val.height) : "none",
					" format=",
					null,
					null,
					null,
					null
				};
				Texture2D val2 = (Texture2D)(object)((val is Texture2D) ? val : null);
				obj2[7] = ((val2 != null) ? ((object)val2.format/*cast due to .constrained prefix*/).ToString() : "?");
				obj2[8] = " ";
				Shader shader = material.shader;
				obj2[9] = $"shader '{((shader != null) ? ((Object)shader).name : null)}' queue={material.renderQueue} ";
				obj2[10] = string.Format("props: {0}keywords: {1}", stringBuilder, string.Join(",", material.shaderKeywords));
				log.LogInfo((object)string.Concat(obj2));
			}
		}

		private static bool IsDecal(Part part)
		{
			return part.Name.IndexOf("decal", StringComparison.OrdinalIgnoreCase) >= 0;
		}

		private static Texture2D LoadTexture(string textureName)
		{
			if (string.IsNullOrEmpty(textureName))
			{
				return Texture2D.whiteTexture;
			}
			if (textureCache.TryGetValue(textureName, out var value) && Object.op_Implicit((Object)(object)value))
			{
				return value;
			}
			string text = JujutsuAssetPaths.Find(new string[3] { "assets", "yuji-skins", textureName });
			bool flag = File.Exists(text);
			TextureAudit.Record("yuji-skins", textureName, flag);
			if (!flag)
			{
				Plugin.Log.LogWarning((object)("Yuji skin texture was not found: " + text));
				return Texture2D.whiteTexture;
			}
			Texture2D val = JujutsuTextures.Load(text, "texYujiSkin_" + Path.GetFileNameWithoutExtension(textureName), (TextureWrapMode)1, false);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Plugin.Log.LogWarning((object)("Yuji skin texture could not be decoded: " + text));
				return Texture2D.whiteTexture;
			}
			textureCache[textureName] = val;
			return val;
		}

		private static bool Load()
		{
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00fb: 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_0106: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_014c: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			if (parts != null)
			{
				return parts.Count > 0;
			}
			parts = new List<Part>();
			string path = JujutsuAssetPaths.Find(new string[2] { "assets", "yuji-skins.model" });
			if (!File.Exists(path))
			{
				Plugin.Log.LogInfo((object)"Yuji extra skins: yuji-skins.model is absent.");
				return false;
			}
			using FileStream input = File.OpenRead(path);
			using BinaryReader binaryReader = new BinaryReader(input);
			if (new string(binaryReader.ReadChars(8)) != "SUKNMDL1")
			{
				throw new InvalidDataException("Yuji skin model header is invalid.");
			}
			int num = binaryReader.ReadInt32();
			if (num != 2)
			{
				throw new InvalidDataException($"Unsupported Yuji skin model version {num}.");
			}
			int num2 = binaryReader.ReadInt32();
			boneNames = new string[num2];
			int[] array = new int[num2];
			Matrix4x4[] array2 = (Matrix4x4[])(object)new Matrix4x4[num2];
			for (int i = 0; i < num2; i++)
			{
				boneNames[i] = binaryReader.ReadString();
				array[i] = binaryReader.ReadInt32();
				Vector3 val = ReadVector3(binaryReader);
				Quaternion val2 = ReadQuaternion(binaryReader);
				Vector3 val3 = ReadVector3(binaryReader);
				array2[i] = Matrix4x4.TRS(val, val2, val3);
			}
			rest = (Matrix4x4[])(object)new Matrix4x4[num2];
			for (int j = 0; j < num2; j++)
			{
				rest[j] = ((array[j] < 0) ? array2[j] : (rest[array[j]] * array2[j]));
			}
			int num3 = binaryReader.ReadInt32();
			for (int k = 0; k < num3; k++)
			{
				Part part = new Part
				{
					Name = binaryReader.ReadString(),
					Outfit = binaryReader.ReadInt32()
				};
				binaryReader.ReadString();
				part.Texture = binaryReader.ReadString();
				part.IsCutout = binaryReader.ReadBoolean();
				int num4 = binaryReader.ReadInt32();
				part.Vertices = (Vector3[])(object)new Vector3[num4];
				part.Normals = (Vector3[])(object)new Vector3[num4];
				part.Uvs = (Vector2[])(object)new Vector2[num4];
				part.Weights = (BoneWeight[])(object)new BoneWeight[num4];
				for (int l = 0; l < num4; l++)
				{
					part.Vertices[l] = ReadVector3(binaryReader);
					part.Normals[l] = ReadVector3(binaryReader);
					part.Uvs[l] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle());
					BoneWeight[] weights = part.Weights;
					int num5 = l;
					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();
					weights[num5] = val4;
				}
				int num6 = binaryReader.ReadInt32();
				part.Triangles = new int[num6];
				for (int m = 0; m < num6; m++)
				{
					part.Triangles[m] = binaryReader.ReadInt32();
				}
				if ((uint)part.Outfit < (uint)SkinNames.Length)
				{
					parts.Add(part);
				}
			}
			Plugin.Log.LogInfo((object)($"Yuji extra skins: loaded {parts.Count} mesh part(s) over " + $"{num2} bones."));
			return parts.Count > 0;
		}

		private static Vector3 ReadVector3(BinaryReader reader)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
		}

		private static Quaternion ReadQuaternion(BinaryReader reader)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Quaternion(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
		}
	}
	internal sealed class YujiFlowGlow : MonoBehaviour
	{
		private sealed class Palm
		{
			private Transform hand;

			private TrailRenderer[] trails;

			private Material[] materials;

			private Color[] tints;

			private float[] glows;

			private Transform follower;

			private ParticleSystem embers;

			private float span;

			private bool showing;

			internal bool Alive
			{
				get
				{
					if (trails == null || !Object.op_Implicit((Object)(object)hand) || !Object.op_Implicit((Object)(object)follower))
					{
						return false;
					}
					for (int i = 0; i < trails.Length; i++)
					{
						if (!Object.op_Implicit((Object)(object)trails[i]))
						{
							return false;
						}
					}
					return true;
				}
			}

			internal static Palm Build(Transform bone, float palm)
			{
				//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_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ec: Expected O, but got Unknown
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)bone))
				{
					return null;
				}
				Palm palm2 = new Palm
				{
					hand = bone,
					span = palm,
					trails = (TrailRenderer[])(object)new TrailRenderer[TrailSeconds.Length],
					materials = (Material[])(object)new Material[TrailSeconds.Length],
					tints = (Color[])(object)new Color[TrailSeconds.Length],
					glows = new float[TrailSeconds.Length]
				};
				Color colour = Color.Lerp(YujiBuffs.Colour, Color.white, 0.12f);
				colour.a = 0.32f;
				float x = bone.lossyScale.x;
				float num = ((x > 0.0001f) ? (palm * 0.5f / x) : (palm * 0.5f));
				Vector3 offset = PalmDirection(bone) * num;
				for (int i = 0; i < TrailSeconds.Length; i++)
				{
					palm2.MakeTrail(i, (JujutsuFxLayer)i, colour, offset, x);
				}
				GameObject val = new GameObject("YujiFlowEmber");
				val.transform.position = bone.position;
				palm2.follower = val.transform;
				return palm2;
			}

			private unsafe void MakeTrail(int layer, JujutsuFxLayer which, Color colour, Vector3 offset, float handScale)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Expected O, but got Unknown
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_013f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0144: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_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_0187: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = new GameObject("YujiFlowTrail" + ((object)(*(JujutsuFxLayer*)(&which))/*cast due to .constrained prefix*/).ToString());
				val.transform.SetParent(hand, false);
				val.transform.localPosition = offset;
				TrailRenderer val2 = val.AddComponent<TrailRenderer>();
				JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val2);
				Color val3 = YujiFx.LayerTint(colour, which);
				float num = JujutsuFxMaterials.GlowFor(which);
				Material val4 = (((Renderer)val2).sharedMaterial = JujutsuFxMaterials.CreateLineMaterial("matYujiFlowTrail" + ((object)(*(JujutsuFxLayer*)(&which))/*cast due to .constrained prefix*/).ToString(), val3, num, JujutsuFxTextures.Streak));
				if (Object.op_Implicit((Object)(object)val4))
				{
					JujutsuFxMaterials.Claim(val, val4);
				}
				val2.time = TrailSeconds[layer];
				val2.minVertexDistance = 0.02f;
				val2.numCornerVertices = 3;
				val2.numCapVertices = 3;
				val2.autodestruct = false;
				val2.textureMode = (LineTextureMode)0;
				val2.alignment = (LineAlignment)0;
				float num2 = span * TrailWidthOfPalm[layer];
				val2.widthMultiplier = ((handScale > 0.0001f) ? (num2 / handScale) : num2);
				val2.widthCurve = JujutsuEase.Curve((Func<float, float>)((float t) => 1f - JujutsuEase.InCubic(t)), 8);
				Gradient val6 = new Gradient();
				val6.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
				{
					new GradientColorKey(Color.white, 0f),
					new GradientColorKey(Color.white, 1f)
				}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
				{
					new GradientAlphaKey(1f, 0f),
					new GradientAlphaKey(0.72f, 0.35f),
					new GradientAlphaKey(0f, 1f)
				});
				val2.colorGradient = val6;
				trails[layer] = val2;
				materials[layer] = val4;
				tints[layer] = val3;
				glows[layer] = num;
			}

			internal void Follow(float level)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)follower) && Object.op_Implicit((Object)(object)hand))
				{
					follower.position = hand.position;
				}
				if (materials == null)
				{
					return;
				}
				for (int i = 0; i < materials.Length; i++)
				{
					if (Object.op_Implicit((Object)(object)materials[i]))
					{
						JujutsuFxMaterials.SetEnvelope(materials[i], tints[i], level, glows[i]);
					}
				}
			}

			internal void Show(bool on)
			{
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				if (showing == on)
				{
					return;
				}
				showing = on;
				if (trails != null)
				{
					for (int i = 0; i < trails.Length; i++)
					{
						if (Object.op_Implicit((Object)(object)trails[i]))
						{
							((Component)trails[i]).gameObject.SetActive(on);
							if (on)
							{
								trails[i].Clear();
							}
						}
					}
				}
				if (!Object.op_Implicit((Object)(object)hand))
				{
					return;
				}
				if (on)
				{
					YujiFx.Ignite(hand.position, YujiBuffs.Colour, Mathf.Max(0.22f, span * 4.5f));
					if (Object.op_Implicit((Object)(object)follower))
					{
						follower.position = hand.position;
						embers = JujutsuMotes.Attach(follower, YujiBuffs.Colour, Mathf.Max(0.25f, span * 3f), (JujutsuMoteKind)0);
					}
				}
				else
				{
					JujutsuMotes.Stop(embers);
					embers = null;
					JujutsuMotes.Burst(hand.position, Vector3.up, YujiBuffs.Colour, Mathf.Max(0.25f, span * 3f), (JujutsuMoteKind)0, 6);
				}
			}

			internal void Discard()
			{
				JujutsuMotes.Stop(embers);
				embers = null;
				if (trails != null)
				{
					for (int i = 0; i < trails.Length; i++)
					{
						if (Object.op_Implicit((Object)(object)trails[i]))
						{
							Object.Destroy((Object)(object)((Component)trails[i]).gameObject);
						}
					}
				}
				trails = null;
				materials = null;
				if (Object.op_Implicit((Object)(object)follower))
				{
					Object.Destroy((Object)(object)((Component)follower).gameObject);
				}
				follower = null;
				showing = false;
			}
		}

		private const float AlongPalm = 0.5f;

		private const float AssumedPalm = 0.09f;

		private static readonly float[] TrailSeconds = new float[3] { 0.09f, 0.13f, 0.21f };

		private static readonly float[] TrailWidthOfPalm = new float[3] { 0.26f, 0.52f, 0.98f };

		private const float TrailStep = 0.02f;

		private const float TrailSolidity = 0.32f;

		private const float FlickerLow = 0.62f;

		private const float FlickerRate = 9.3f;

		private static bool reported;

		private CharacterBody body;

		private Palm left;

		private Palm right;

		private bool lit;

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		private void OnDisable()
		{
			Show(on: false);
		}

		private void OnDestroy()
		{
			Drop();
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)YujiBuffs.Flow) || !body.HasBuff(YujiBuffs.Flow))
			{
				Show(on: false);
				return;
			}
			if (!Standing(left) || !Standing(right))
			{
				Drop();
				if (!Build())
				{
					return;
				}
			}
			Show(on: true);
			Drive();
		}

		private void Drive()
		{
			float time = Time.time;
			Glow(left, JujutsuEase.FlickerScaled(time, 0.62f, 9.3f));
			Glow(right, JujutsuEase.FlickerScaled(time + 0.37f, 0.62f, 9.3f));
		}

		private static void Glow(Palm palm, float level)
		{
			palm?.Follow(level);
		}

		private bool Build()
		{
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			Transform val = default(Transform);
			Transform bone = default(Transform);
			if (!JujutsuBones.TryFindHands(body, ref val, ref bone))
			{
				return false;
			}
			float num = MeasurePalm(val);
			left = Palm.Build(val, num);
			right = Palm.Build(bone, num);
			if (!reported)
			{
				reported = true;
				Transform val2 = Knuckle(val);
				Plugin.Log.LogInfo((object)($"Yuji flow trail: palm measured at {num:0.000} m from " + "'" + ((Object)val).name + "' to '" + (Object.op_Implicit((Object)(object)val2) ? ((Object)val2).name : "nothing") + "', three layers " + $"up to {num * TrailWidthOfPalm[2]:0.000} m wide hung " + $"{num * 0.5f:0.000} m along it at " + $"{PalmDirection(val)} in the bone's space."));
			}
			if (Standing(left))
			{
				return Standing(right);
			}
			return false;
		}

		private static bool Standing(Palm palm)
		{
			return palm?.Alive ?? false;
		}

		private static float MeasurePalm(Transform hand)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			Transform val = Knuckle(hand);
			float num = (Object.op_Implicit((Object)(object)val) ? Vector3.Distance(hand.position, val.position) : 0f);
			if (num > 0.001f)
			{
				return num;
			}
			Plugin.Log.LogWarning((object)("Yuji flow trail: '" + ((Object)hand).name + "' has no finger to measure the " + $"palm with, so {0.09f:0.000} m is assumed. The trail " + "will be the wrong width on a rig scaled differently."));
			return 0.09f;
		}

		private static Transform Knuckle(Transform hand)
		{
			//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)
			Transform val = null;
			for (int i = 0; i < hand.childCount; i++)
			{
				Transform child = hand.GetChild(i);
				if (((Object)child).name.IndexOf("Middle", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					return child;
				}
				if (!Object.op_Implicit((Object)(object)val))
				{
					Vector3 localPosition = child.localPosition;
					if (((Vector3)(ref localPosition)).sqrMagnitude > 1E-06f)
					{
						val = child;
					}
				}
			}
			return val;
		}

		private static Vector3 PalmDirection(Transform hand)
		{
			//IL_0017: 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_001c: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			Transform val = Knuckle(hand);
			Vector3 val2 = (Object.op_Implicit((Object)(object)val) ? val.localPosition : Vector3.zero);
			if (!(((Vector3)(ref val2)).sqrMagnitude > 1E-06f))
			{
				return Vector3.up;
			}
			return ((Vector3)(ref val2)).normalized;
		}

		private void Show(bool on)
		{
			if (lit != on)
			{
				lit = on;
				Switch(left, on);
				Switch(right, on);
			}
		}

		private static void Switch(Palm palm, bool on)
		{
			palm?.Show(on);
		}

		private void Drop()
		{
			if (left != null)
			{
				left.Discard();
				left = null;
			}
			if (right != null)
			{
				right.Discard();
				right = null;
			}
			lit = false;
		}
	}
	internal static class YujiFx
	{
		private sealed class Piece
		{
			internal GameObject Item;

			internal Mesh Mesh;

			internal Material Material;

			internal Color Tint;

			internal float Glow;

			internal void Fade(float alpha)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)Material))
				{
					JujutsuFxMaterials.SetEnvelope(Material, Tint, alpha, Glow);
				}
			}

			internal void Size(float metres)
			{
				//IL_0019: 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)
				if (Object.op_Implicit((Object)(object)Item))
				{
					Item.transform.localScale = Vector3.one * Mathf.Max(0.0001f, metres);
				}
			}

			internal void Under(Transform parent)
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)Item) && Object.op_Implicit((Object)(object)parent))
				{
					Item.transform.SetParent(parent, false);
					Item.transform.localPosition = Vector3.zero;
				}
			}
		}

		private sealed class Snip
		{
			internal Piece Marks;

			internal Piece Seam;

			internal Piece Upper;

			internal Piece Lower;

			internal Transform Rig;

			internal Vector3 From;

			internal Vector3 Run;

			internal Vector3 Face;

			internal float Lead;
		}

		private sealed class GroundRing
		{
			private readonly JujutsuGroundField field;

			private readonly Vector3 centre;

			internal float Reach;

			internal float Lift;

			internal Func<float, float> Height { get; }

			internal GroundRing(JujutsuGroundField sampled, Vector3 around)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				field = sampled;
				centre = around;
				Height = Sample;
			}

			private float Sample(float angle)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				if (field == null)
				{
					return 0f;
				}
				return field.PointAt(angle, Reach, Lift).y - centre.y;
			}
		}

		private sealed class MeshKeeper : MonoBehaviour
		{
			private Mesh mesh;

			internal void Own(Mesh owned)
			{
				mesh = owned;
			}

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

		internal sealed class Wake : MonoBehaviour
		{
			private CharacterBody body;

			private Material[] materials;

			private Color[] tints;

			private float[] glows;

			private ParticleSystem embers;

			private float until;

			private float drain;

			private float closedAt;

			private bool closed;

			internal unsafe static Wake Open(CharacterBody caster, Color colour, float width, float seconds)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Expected O, but got Unknown
				//IL_0012: 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_00a9: Expected O, but got Unknown
				//IL_00ce: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_027d: Unknown result type (might be due to invalid IL or missing references)
				//IL_019d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a4: Expected O, but got Unknown
				//IL_01ae: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_01ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_0200: Unknown result type (might be due to invalid IL or missing references)
				//IL_0205: Unknown result type (might be due to invalid IL or missing references)
				//IL_0216: Unknown result type (might be due to invalid IL or missing references)
				//IL_021b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0241: Unknown result type (might be due to invalid IL or missing references)
				//IL_0243: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = new GameObject("YujiWake");
				val.transform.position = caster.corePosition;
				Wake wake = val.AddComponent<Wake>();
				wake.body = caster;
				wake.until = Time.time + Mathf.Max(0.05f, seconds);
				wake.materials = (Material[])(object)new Material[3];
				wake.tints = (Color[])(object)new Color[3];
				wake.glows = new float[3];
				float[] array = new float[3] { 0.14f, 0.2f, 0.3f };
				float[] array2 = new float[3] { 0.34f, 0.7f, 1.25f };
				for (int i = 0; i < 3; i++)
				{
					GameObject val2 = new GameObject("YujiWakeLayer" + i);
					val2.transform.SetParent(val.transform, false);
					TrailRenderer val3 = val2.AddComponent<TrailRenderer>();
					JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val3);
					JujutsuFxLayer val4 = (JujutsuFxLayer)i;
					Color val5 = LayerTint(colour, val4);
					float num = JujutsuFxMaterials.GlowFor(val4);
					Material val6 = (((Renderer)val3).sharedMaterial = JujutsuFxMaterials.CreateLineMaterial("matYujiWake" + ((object)(*(JujutsuFxLayer*)(&val4))/*cast due to .constrained prefix*/).ToString(), val5, num, JujutsuFxTextures.Streak));
					if (Object.op_Implicit((Object)(object)val6))
					{
						JujutsuFxMaterials.Claim(val2, val6);
					}
					val3.time = array[i];
					val3.minVertexDistance = 0.12f;
					val3.numCornerVertices = 2;
					val3.numCapVertices = 3;
					val3.autodestruct = false;
					val3.textureMode = (LineTextureMode)0;
					val3.alignment = (LineAlignment)0;
					val3.widthMultiplier = width * array2[i];
					val3.widthCurve = JujutsuEase.Curve((Func<float, float>)((float t) => 1f - JujutsuEase.InCubic(t)), 8);
					Gradient val8 = new Gradient();
					val8.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
					{
						new GradientColorKey(Color.white, 0f),
						new GradientColorKey(Color.white, 1f)
					}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
					{
						new GradientAlphaKey(1f, 0f),
						new GradientAlphaKey(0.6f, 0.4f),
						new GradientAlphaKey(0f, 1f)
					});
					val3.colorGradient = val8;
					wake.materials[i] = val6;
					wake.tints[i] = val5;
					wake.glows[i] = num;
					wake.drain = Mathf.Max(wake.drain, array[i]);
				}
				wake.embers = JujutsuMotes.Attach(val.transform, colour, Mathf.Max(0.4f, width * 2f), (JujutsuMoteKind)0);
				return wake;
			}

			internal void Close()
			{
				if (!closed)
				{
					closed = true;
					closedAt = Time.time;
					JujutsuMotes.Stop(embers);
					embers = null;
					Object.Destroy((Object)(object)((Component)this).gameObject, drain + 0.15f);
				}
			}

			private void LateUpdate()
			{
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				if (closed)
				{
					Dim();
				}
				else if (!Object.op_Implicit((Object)(object)body) || Time.time >= until)
				{
					Close();
				}
				else
				{
					((Component)this).transform.position = body.corePosition;
				}
			}

			private void Dim()
			{
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				if (materials == null)
				{
					return;
				}
				float num = 1f - JujutsuEase.InQuad(Mathf.Clamp01((Time.time - closedAt) / Mathf.Max(0.05f, drain)));
				for (int i = 0; i < materials.Length; i++)
				{
					if (Object.op_Implicit((Object)(object)materials[i]))
					{
						JujutsuFxMaterials.SetEnvelope(materials[i], tints[i], num, glows[i]);
					}
				}
			}

			private void OnDestroy()
			{
				JujutsuMotes.Stop(embers);
				embers = null;
			}
		}

		internal sealed class Knot : MonoBehaviour
		{
			private Piece core;

			private Piece body;

			private Piece haze;

			private ParticleSystem embers;

			private float radius;

			private float snappedAt = -999f;

			internal static Knot Open(Vector3 point, Color colour, float startRadius)
			{
				//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_0035: 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_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = new GameObject("YujiHeldKnot");
				val.transform.position = point;
				Knot knot = val.AddComponent<Knot>();
				knot.radius = Mathf.Max(0.02f, startRadius);
				knot.haze = Flare("YujiKnotHaze", point, colour, (JujutsuFxLayer)2, -35f, 0f);
				knot.body = Flare("YujiKnotBody", point, colour, (JujutsuFxLayer)1, 70f, 0f);
				knot.core = Flare("YujiKnotCore", point, colour, (JujutsuFxLayer)0, -190f, 0f);
				if (knot.haze != null)
				{
					knot.haze.Under(val.transform);
				}
				if (knot.body != null)
				{
					knot.body.Under(val.transform);
				}
				if (knot.core != null)
				{
					knot.core.Under(val.transform);
				}
				knot.embers = JujutsuMotes.Attach(val.transform, colour, Mathf.Max(0.3f, startRadius * 2f), (JujutsuMoteKind)0);
				return knot;
			}

			internal void Move(Vector3 point)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((Component)this).transform.position = point;
			}

			internal void SetRadius(float metres)
			{
				radius = Mathf.Max(0.02f, metres);
			}

			internal void Snap()
			{
				snappedAt = Time.time;
			}

			internal void CloseAndBurst(Vector3 aim, Color colour)
			{
				//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_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				JujutsuMotes.Stop(embers);
				embers = null;
				JujutsuMotes.Burst(((Component)this).transform.position, aim, colour, Mathf.Max(0.3f, radius * 4f), (JujutsuMoteKind)2, 14);
				Ignite(((Component)this).transform.position, colour, radius * 5f, 0.22f);
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}

			private void LateUpdate()
			{
				float num = JujutsuEase.FlickerScaled(Time.time, 0.7f, 14f);
				float num2 = 1f + 2.2f * JujutsuEase.Snap(Mathf.Clamp01((Time.time - snappedAt) / 0.16f), 0.1f);
				if (core != null)
				{
					core.Size(radius * 1.5f * num2);
					core.Fade(num);
				}
				if (body != null)
				{
					body.Size(radius * 2.6f * num2);
					body.Fade(num * 0.9f);
				}
				if (haze != null)
				{
					haze.Size(radius * 4.4f * num2);
					haze.Fade((1.7f - num) * 0.55f);
				}
			}

			private void OnDestroy()
			{
				JujutsuMotes.Stop(embers);
				embers = null;
			}
		}

		internal static readonly Color FlashVoid = new Color(0.015f, 0f, 0.02f, 0.94f);

		internal static readonly Color FlashEdge = new Color(0.95f, 0.1f, 0.16f, 1f);

		internal static readonly Color FlashCore = new Color(1f, 0.88f, 0.84f, 1f);

		private const float FailureRest = 20f;

		private static float restingUntil;

		private static bool failureLogged;

		internal const float JabWeight = 0.16f;

		internal const float DivergentLift = 0.38f;

		internal const float DivergentCeiling = 0.68f;

		private const float ScreenFull = 14f;

		private const float ScreenNone = 55f;

		internal static readonly Color Ink = new Color(0.05f, 0.032f, 0.038f, 0.97f);

		private static readonly Color SnipPaper = new Color(1f, 0.97f, 0.95f, 0.97f);

		private const float SnipLife = 0.62f;

		private const float SnipSweep = 0.62f;

		private const float SnipLead = 0.11f;

		private const float SnipPitch = 1.15f;

		private const float SnipCount = 4f;

		private const float SnipOpen = 22f;

		private const float SnipShut = 4f;

		private const float SnipStub = 0.08f;

		private static readonly List<Vector3> snipPath = new List<Vector3>(16);

		private static float snipMarkWidth = 0.3f;

		private static float snipSeamTail = 0.1f;

		private static float snipSeamHead = 0.6f;

		private static readonly Func<float, float> SnipMarkWidthOf = (float t) => snipMarkWidth;

		private static readonly Func<float, Color> SnipMarkShadeOf = (float t) => Solid;

		private static readonly Func<float, float> SnipSeamWidthOf = (float t) => Mathf.Lerp(snipSeamTail, snipSeamHead, Mathf.Clamp01(t));

		private const float DashFill = 0.62f;

		private static Texture2D dashMark;

		private static Texture2D cutMark;

		private static Texture2D scissorHalf;

		private static readonly Color Clear = new Color(1f, 1f, 1f, 0f);

		private static readonly Color Solid = new Color(1f, 1f, 1f, 1f);

		private static Texture2D DashMark
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)dashMark))
				{
					return dashMark = BuildDashMark();
				}
				return dashMark;
			}
		}

		private static Texture2D CutMark
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)cutMark))
				{
					return cutMark = JujutsuFxTextures.Build("texYujiCutMark", 64, (Func<float, float, Color32>)delegate(float u, float v)
					{
						//IL_0031: Unknown result type (might be due to invalid IL or missing references)
						float num = Mathf.Abs(v - 0.5f);
						return Marked(Mathf.Clamp01((0.34f - num) * 13f), Mathf.Clamp01((0.43f - num) * 13f));
					});
				}
				return cutMark;
			}
		}

		private static Texture2D ScissorHalf
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)scissorHalf))
				{
					return scissorHalf = JujutsuFxTextures.Build("texYujiScissorHalf", 192, (Func<float, float, Color32>)ScissorPixel);
				}
				return scissorHalf;
			}
		}

		internal static Color LayerTint(Color colour, JujutsuFxLayer layer)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			if ((int)layer != 0)
			{
				if ((int)layer == 2)
				{
					Color result = Color.Lerp(colour, Color.black, 0.15f);
					result.a = colour.a * 0.45f;
					return result;
				}
				return colour;
			}
			Color result2 = Color.Lerp(colour, Color.white, 0.78f);
			result2.a = colour.a;
			return result2;
		}

		private static Piece Flare(string name, Vector3 position, Color colour, JujutsuFxLayer layer, float spin, float life)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_00b8: 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)
			if (JujutsuFxBudget.Available((Kind)3, 1) < 1)
			{
				return null;
			}
			GameObject val = JujutsuPrimitives.Quad(name, position, false);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			val.AddComponent<JujutsuBillboard>().spin = spin;
			MeshRenderer component = val.GetComponent<MeshRenderer>();
			JujutsuFxMaterials.PrepareRenderer((Renderer)(object)component);
			Color val2 = LayerTint(colour, layer);
			float num = JujutsuFxMaterials.GlowFor(layer);
			Material val3 = JujutsuFxMaterials.CreateLineMaterial(name + "Material", val2, num, JujutsuFxTextures.Radial);
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)val3))
			{
				Object.Destroy((Object)(object)val);
				return null;
			}
			((Renderer)component).sharedMaterial = val3;
			JujutsuFxMaterials.Claim(val, val3);
			if (life > 0f)
			{
				Object.Destroy((Object)(object)val, life);
			}
			JujutsuFxBudget.Register(val, (Kind)3);
			return new Piece
			{
				Item = val,
				Material = val3,
				Tint = val2,
				Glow = num
			};
		}

		private static Piece Shadow(string name, Vector3 position, Color colour, float spin, float life)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: 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)
			if (!JujutsuFxMaterials.CanDrawDark || JujutsuFxBudget.Available((Kind)3, 1) < 1)
			{
				return null;
			}
			GameObject val = JujutsuPrimitives.Quad(name, position, false);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			val.AddComponent<JujutsuBillboard>().spin = spin;
			MeshRenderer component = val.GetComponent<MeshRenderer>();
			JujutsuFxMaterials.PrepareRenderer((Renderer)(object)component);
			Material val2 = JujutsuFxMaterials.CreateBlendedMaterial(name + "Material", colour, JujutsuFxTextures.Radial);
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)val2))
			{
				Object.Destroy((Object)(object)val);
				return null;
			}
			((Renderer)component).sharedMaterial = val2;
			JujutsuFxMaterials.Claim(val, val2);
			if (life > 0f)
			{
				Object.Destroy((Object)(object)val, life);
			}
			JujutsuFxBudget.Register(val, (Kind)3);
			return new Piece
			{
				Item = val,
				Material = val2,
				Tint = colour,
				Glow = 1f
			};
		}

		private static Piece Shape(string name, Vector3 position, Quaternion rotation, Color tint, float glow, bool dark, Texture2D texture, float life)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if (dark && !JujutsuFxMaterials.CanDrawDark)
			{
				return null;
			}
			if (JujutsuFxBudget.Available((Kind)3, 1) < 1)
			{
				return null;
			}
			Mesh val2 = default(Mesh);
			MeshRenderer val3 = default(MeshRenderer);
			GameObject val = JujutsuFxMesh.Object(name, ref val2, ref val3);
			val.transform.SetPositionAndRotation(position, rotation);
			Material val4 = (dark ? JujutsuFxMaterials.CreateBlendedMaterial("mat" + name, tint, texture) : JujutsuFxMaterials.CreateLineMaterial("mat" + name, tint, glow, texture));
			if (!Object.op_Implicit((Object)(object)val4))
			{
				Object.Destroy((Object)(object)val);
				Object.Destroy((Object)(object)val2);
				return null;
			}
			((Renderer)val3).sharedMaterial = val4;
			JujutsuFxMaterials.Claim(val, val4);
			val.AddComponent<MeshKeeper>().Own(val2);
			if (life > 0f)
			{
				Object.Destroy((Object)(object)val, life);
			}
			JujutsuFxBudget.Register(val, (Kind)3);
			return new Piece
			{
				Item = val,
				Mesh = val2,
				Material = val4,
				Tint = tint,
				Glow = (dark ? 1f : glow)
			};
		}

		internal static void Ignite(Vector3 point, Color colour, float radius, float life = 0.3f)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			if (Resting())
			{
				return;
			}
			try
			{
				Piece core = Flare("YujiIgniteCore", point, colour, (JujutsuFxLayer)0, 150f, life);
				Piece haze = Flare("YujiIgniteHaze", point, colour, (JujutsuFxLayer)2, -60f, life);
				Action<float> action = delegate(float t)
				{
					float num = JujutsuEase.OutBack(JujutsuEase.Window(t, 0f, 0.35f), 0.55f);
					float num2 = JujutsuEase.Snap(t, 0.18f);
					if (core != null)
					{
						core.Size(radius * 0.55f * num);
						core.Fade(num2);
					}
					if (haze != null)
					{
						haze.Size(radius * (0.6f + 0.9f * num));
						haze.Fade(num2 * 0.85f);
					}
				};
				action(0f);
				JujutsuFxSequence.Run(life).While(action);
				JujutsuMotes.Burst(point, Vector3.up, colour, radius, (JujutsuMoteKind)2, 7);
			}
			catch (Exception exception)
			{
				Fail(exception);
			}
		}

		internal static void Gather(Transform anchor, Color colour, float radius, float seconds)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			if (Resting() || !Object.op_Implicit((Object)(object)anchor) || seconds <= 0.01f)
			{
				return;
			}
			try
			{
				JujutsuFxSequenceRunner val = JujutsuFxSequence.Run(seconds, anchor);
				if (!Object.op_Implicit((Object)(object)val))
				{
					return;
				}
				Piece haze = Flare("YujiGatherHaze", anchor.position, colour, (JujutsuFxLayer)2, 45f, 0f);
				Piece core = Flare("YujiGatherCore", anchor.position, colour, (JujutsuFxLayer)0, -180f, 0f);
				Piece ring = Shape("YujiGatherRing", anchor.position, Quaternion.identity, LayerTint(colour, (JujutsuFxLayer)1), JujutsuFxMaterials.GlowFor((JujutsuFxLayer)1), dark: false, null, 0f);
				if (haze != null)
				{
					haze.Under(((Component)val).transform);
				}
				if (core != null)
				{
					core.Under(((Component)val).transform);
				}
				if (ring != null)
				{
					ring.Under(((Component)val).transform);
				}
				int seed = Seed(anchor.position);
				Action<float> action = delegate(float t)
				{
					//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
					//IL_0100: Unknown result type (might be due to invalid IL or missing references)
					//IL_0105: Unknown result type (might be due to invalid IL or missing references)
					float num = JujutsuEase.InCubic(t);
					float num2 = JujutsuEase.InQuad(t);
					if (haze != null)
					{
						haze.Size(radius * Mathf.Lerp(2.3f, 0.7f, num));
						haze.Fade(num2 * 0.9f);
					}
					if (core != null)
					{
						core.Size(radius * Mathf.Lerp(0.05f, 0.5f, num2));
						core.Fade(num2);
					}
					if (ring != null && Object.op_Implicit((Object)(object)ring.Mesh))
					{
						float num3 = radius * Mathf.Lerp(2.1f, 0.55f, num);
						float num4 = radius * Mathf.Lerp(0.1f, 0.28f, num);
						JujutsuFxMesh.Ring(ring.Mesh, Mathf.Max(0.01f, num3 - num4), Mathf.Max(0.02f, num3 + num4 * 0.3f), Clear, Solid, Clear, 28, 0.5f, seed, (Func<float, float>)null);
						ring.Fade(num2 * 0.8f);
					}
				};
				action(0f);
				val.While(action);
			}
			catch (Exception exception)
			{
				Fail(exception);
			}
		}

		internal static void Tell(Vector3 point, Color colour, float radius, float seconds)
		{
			//IL_002c: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_006e: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			if (Resting() || seconds <= 0.02f)
			{
				return;
			}
			try
			{
				float life = seconds + 0.25f;
				Piece knot = Shadow("YujiDivergentKnot", point, FlashVoid, 25f, life);
				Piece rim = Shape("YujiDivergentRim", point, Quaternion.identity, LayerTint(colour, (JujutsuFxLayer)1), JujutsuFxMaterials.GlowFor((JujutsuFxLayer)1), dark: false, null, life);
				Piece spark = Flare("YujiDivergentSpark", point, colour, (JujutsuFxLayer)0, 220f, life);
				int seed = Seed(point);
				Action<float> action = delegate(float t)
				{
					//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_00e8: Unknown result type (might be due to invalid IL or missing references)
					float num = JujutsuEase.InCubic(t);
					float num2 = JujutsuEase.InQuad(t);
					if (knot != null)
					{
						knot.Size(radius * Mathf.Lerp(0.15f, 0.85f, num2));
						knot.Fade(num2);
					}
					if (spark != null)
					{
						spark.Size(radius * 0.18f * num2);
						spark.Fade(num2 * 0.8f);
					}
					if (rim != null && Object.op_Implicit((Object)(object)rim.Mesh))
					{
						float num3 = radius * Mathf.Lerp(1.7f, 0.4f, num);
						float num4 = radius * 0.07f;
						JujutsuFxMesh.Ring(rim.Mesh, Mathf.Max(0.01f, num3 - num4), Mathf.Max(0.02f, num3 + num4), Clear, Solid, Clear, 32, 0.55f, seed, (Func<float, float>)null);
						rim.Fade(num2);
					}
				};
				action(0f);
				JujutsuFxSequence.Run(seconds).While(action).Then((Action)delegate
				{
					Sweep(knot);
					Sweep(rim);
					Sweep(spark);
				});
			}
			catch (Exception exception)
			{
				Fail(exception);
			}
		}

		internal static void Divergent(Vector3 point, Vector3 aim, Color colour, float radius, float weight)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			JujutsuImpact.Strike(point, aim, colour, radius, weight, true);
			if (Resting())
			{
				return;
			}
			try
			{
				float num = 0.42f;
				Piece front = Shape("YujiDivergentFront", point, Quaternion.FromToRotation(Vector3.up, Steady(aim)), LayerTint(colour, (JujutsuFxLayer)1), JujutsuFxMaterials.GlowFor((JujutsuFxLayer)1), dark: false, null, num);
				int seed = Seed(point) + 17;
				Action<float> action = delegate(float t)
				{
					//IL_009b: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
					if (front != null && Object.op_Implicit((Object)(object)front.Mesh))
					{
						float num2 = JujutsuEase.Window(t, 0.2f, 1f);
						float num3 = radius * Mathf.Lerp(0.3f, 1.25f, JujutsuEase.OutExpo(num2));
						float num4 = radius * Mathf.Lerp(0.3f, 0.06f, JujutsuEase.OutCubic(num2));
						JujutsuFxMesh.Ring(front.Mesh, Mathf.Max(0.01f, num3 - num4), Mathf.Max(0.02f, num3 + num4 * 0.4f), Clear, Solid, Clear, 44, 0.42f, seed, (Func<float, float>)null);
						front.Fade(JujutsuEase.Snap(num2, 0.12f));
					}
				};
				action(0f);
				JujutsuFxSequence.Run(num).While(action).At(0.28f, (Action)delegate
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					JujutsuMotes.Burst(point, Vector3.up, colour, radius * 0.8f, (JujutsuMoteKind)0, 0);
				});
			}
			catch (Exception exception)
			{
				Fail(exception);
			}
		}

		internal static void Flash(CharacterBody caster, Vector3 point, Vector3 aim, float radius, bool major)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: 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_01db: 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_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: 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_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			if (Resting())
			{
				return;
			}
			try
			{
				JujutsuFxHitStop.Hold(caster, major ? 0.09f : 0.06f, false);
				float num = Nearness(point);
				if (major && num > 0.01f)
				{
					Color flashCore = FlashCore;
					flashCore.a = 0.6f * num;
					JujutsuFxScreen.Flash(flashCore, 0.2f);
				}
				JujutsuFxLights.Borrow(point, Color.Lerp(FlashEdge, Color.white, 0.45f), major ? 17f : 11f, Mathf.Clamp(radius * 3.2f, 4f, 40f), major ? 0.16f : 0.12f);
				float num2 = (major ? 0.62f : 0.44f);
				Quaternion rotation = Quaternion.FromToRotation(Vector3.up, Steady(aim));
				Piece hollow = Shadow("YujiFlashVoid", point, FlashVoid, 18f, num2);
				Piece heart = Flare("YujiFlashHeart", point, FlashCore, (JujutsuFxLayer)0, 200f, num2);
				Piece inner = Shape("YujiFlashInnerEdge", point, rotation, LayerTint(FlashCore, (JujutsuFxLayer)0), JujutsuFxMaterials.GlowFor((JujutsuFxLayer)0), dark: false, null, num2);
				Piece gap = Shape("YujiFlashGap", point, rotation, FlashVoid, 1f, dark: true, null, num2);
				Piece outer = Shape("YujiFlashOuterEdge", point, rotation, LayerTint(FlashEdge, (JujutsuFxLayer)1), JujutsuFxMaterials.GlowFor((JujutsuFxLayer)1), dark: false, null, num2);
				int seed = Seed(point);
				int segments = Mathf.Clamp(Mathf.RoundToInt(radius * 4f) + 30, 36, 96);
				Action<float> action = delegate(float t)
				{
					float num3 = JujutsuEase.OutExpo(JujutsuEase.Window(t, 0.05f, 1f));
					float num4 = radius * Mathf.Lerp(0.22f, 1.5f, num3);
					float num5 = radius * Mathf.Lerp(0.4f, 0.11f, JujutsuEase.OutCubic(num3));
					float num6 = JujutsuEase.Snap(t, 0.16f);
					float alpha = JujutsuEase.Snap(t, 0.34f);
					if (hollow != null)
					{
						hollow.Size(radius * Mathf.Lerp(0.5f, 1.9f, num3));
						hollow.Fade(alpha);
					}
					if (heart != null)
					{
						heart.Size(radius * Mathf.Lerp(0.75f, 0.3f, JujutsuEase.OutCubic(t)));
						heart.Fade(JujutsuEase.Snap(t, 0.1f));
					}
					Band(inner, num4 - num5 * 1.5f, num4 - num5 * 0.62f, segments, seed, num6);
					Band(gap, num4 - num5 * 0.66f, num4 + num5 * 0.66f, segments, seed + 5, alpha);
					Band(outer, num4 + num5 * 0.58f, num4 + num5 * 1.5f, segments, seed + 11, num6 * 0.95f);
				};
				action(0f);
				JujutsuFxSequence.Run(num2).While(action).At(0.1f, (Action)delegate
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					//IL_002c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					//IL_0037: Unknown result type (might be due to invalid IL or missing references)
					JujutsuMotes.Burst(point, aim, FlashEdge, radius, (JujutsuMoteKind)2, major ? 34 : 22);
					JujutsuFxDebris.Throw(point, aim, FlashEdge, radius, major ? 22 : 12, 0f, 0.85f);
				})
					.At(0.34f, (Action)delegate
					{
						//IL_0001: Unknown result type (might be due to invalid IL or missing references)
						//IL_0006: Unknown result type (might be due to invalid IL or missing references)
						//IL_000b: Unknown result type (might be due to invalid IL or missing references)
						//IL_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_0043: Unknown result type (might be due to invalid IL or missing references)
						//IL_0048: Unknown result type (might be due to invalid IL or missing references)
						//IL_004d: Unknown result type (might be due to invalid IL or missing references)
						//IL_0060: Unknown result type (might be due to invalid IL or missing references)
						//IL_0065: Unknown result type (might be due to invalid IL or missing references)
						JujutsuMotes.Burst(point, Vector3.up, FlashEdge, radius, (JujutsuMoteKind)0, 0);
						JujutsuMotes.Burst(point, Vector3.up, FlashVoid, radius, (JujutsuMoteKind)1, 0);
						if (major)
						{
							JujutsuMotes.Burst(point, Vector3.up, FlashVoid, radius, (JujutsuMoteKind)3, 0);
							JujutsuFxScorch.Mark(point, FlashEdge, radius * 0.9f, 12f, true);
						}
					});
			}
			catch (Exception exception)
			{
				Fail(exception);
			}
		}

		private static void Band(Piece piece, float inner, float outer, int segments, int seed, float alpha)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (piece != null && Object.op_Implicit((Object)(object)piece.Mesh))
			{
				JujutsuFxMesh.Ring(piece.Mesh, Mathf.Max(0.01f, inner), Mathf.Max(0.02f, outer), Clear, Solid, Clear, segments, 0.38f, seed, (Func<float, float>)null);
				piece.Fade(alpha);
			}
		}

		internal static void Inward(CharacterBody caster, Vector3 point, Color colour, float radius)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			if (Resting())
			{
				return;
			}
			try
			{
				Piece well = Shadow("YujiSoulWell", point, FlashVoid, -30f, 0.46f);
				Piece arrival = Flare("YujiSoulArrival", point, colour, (JujutsuFxLayer)0, 260f, 0.46f);
				Piece[] rings = new Piece[3]
				{
					Shape("YujiSoulRingA", point, Quaternion.identity, LayerTint(colour, (JujutsuFxLayer)0), JujutsuFxMaterials.GlowFor((JujutsuFxLayer)0), dark: false, null, 0.46f),
					Shape("YujiSoulRingB", point, Quaternion.Euler(62f, 0f, 0f), LayerTint(colour, (JujutsuFxLayer)1), JujutsuFxMaterials.GlowFor((JujutsuFxLayer)1), dark: false, null, 0.46f),
					Shape("YujiSoulRingC", point, Quaternion.Euler(0f, 0f, 58f), LayerTint(colour, (JujutsuFxLayer)2), JujutsuFxMaterials.GlowFor((JujutsuFxLayer)2), dark: false, null, 0.46f)
				};
				int seed = Seed(point);
				Action<float> action = delegate(float t)
				{
					for (int i = 0; i < rings.Length; i++)
					{
						float num = JujutsuEase.Window(t, (float)i * 0.09f, 0.78f + (float)i * 0.06f);
						float num2 = JujutsuEase.InCubic(num);
						float num3 = radius * Mathf.Lerp(1.25f + (float)i * 0.35f, 0.08f, num2);
						float num4 = radius * Mathf.Lerp(0.05f, 0.2f, num2);
						Band(rings[i], num3 - num4, num3 + num4 * 0.5f, 40, seed + i * 13, JujutsuEase.InOut(Mathf.Min(1f, num * 4f)) * (1f - JujutsuEase.InQuad(num)));
					}
					if (well != null)
					{
						well.Size(radius * Mathf.Lerp(0.1f, 0.9f, JujutsuEase.OutCubic(JujutsuEase.Window(t, 0f, 0.7f))));
						well.Fade(JujutsuEase.Snap(JujutsuEase.Window(t, 0f, 1f), 0.5f));
					}
					if (arrival != null)
					{
						float num5 = JujutsuEase.Window(t, 0.68f, 1f);
						arrival.Size(radius * 0.9f * JujutsuEase.OutExpo(num5));
						arrival.Fade(JujutsuEase.Snap(num5, 0.12f));
					}
				};
				action(0f);
				JujutsuFxSequence.Run(0.46f).While(action).At(0.68f, (Action)delegate
				{
					//IL_0001: 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_0028: Unknown result type (might be due to invalid IL or missing references)
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0037: Unknown result type (might be due to invalid IL or missing references)
					//IL_0067: Unknown result type (might be due to invalid IL or missing references)
					//IL_006c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: 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_009a: Unknown result type (might be due to invalid IL or missing references)
					JujutsuFxShake.Tier(point, 0.62f);
					JujutsuFxHitStop.Hold(caster, 0.06f, false);
					JujutsuFxLights.Borrow(point, Color.Lerp(colour, Color.white, 0.3f), 9f, Mathf.Clamp(radius * 2.4f, 3f, 28f), 0.14f);
					JujutsuImpact.Strike(point, Vector3.up, colour, radius * 0.3f, 0.34f, true);
					JujutsuMotes.Burst(point, Vector3.up, colour, radius * 0.8f, (JujutsuMoteKind)0, 0);
				});
			}
			catch (Exception exception)
			{
				Fail(exception);
			}
		}

		internal static void Quake(Vector3 centre, Color colour, float radius, float weight, bool mark)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			JujutsuFxShake.Detonation(centre, radius);
			JujutsuImpact.Detonate(centre, colour, radius, weight, true);
			if (Resting())
			{
				return;
			}
			try
			{
				if (NetworkServer.active)
				{
					JujutsuImpact.Surface(centre, Vector3.up, radius, true);
				}
				JujutsuGroundField field = JujutsuGroundField.Sample(centre, radius, Mathf.Clamp(Mathf.RoundToInt(radius) + 8, 12, 28), 3);
				if (!field.HasFloor)
				{
					return;
				}
				Piece crest = Shape("YujiQuakeCrest", centre, Quaternion.identity, LayerTint(colour, (JujutsuFxLayer)0), JujutsuFxMaterials.GlowFor((JujutsuFxLayer)0), dark: false, null, 0.62f);
				Piece body = Shape("YujiQuakeBody", centre, Quaternion.identity, LayerTint(colour, (JujutsuFxLayer)1), JujutsuFxMaterials.GlowFor((JujutsuFxLayer)1), dark: false, null, 0.62f);
				Piece dust = Shape("YujiQuakeShadow", centre, Quaternion.identity, new Color(0.06f, 0.04f, 0.04f, 0.6f), 1f, dark: true, JujutsuFxTextures.Smoke, 0.62f);
				GroundRing follow = new GroundRing(field, centre);
				int seed = Seed(centre);
				Action<float> action = delegate(float t)
				{
					float num = JujutsuEase.OutExpo(t);
					follow.Reach = radius * Mathf.Lerp(0.12f, 1f, num);
					follow.Lift = 0.14f;
					float num2 = radius * Mathf.Lerp(0.26f, 0.05f, JujutsuEase.OutCubic(num));
					float num3 = JujutsuEase.Snap(t, 0.12f);
					Sheet(crest, follow.Reach - num2 * 0.5f, follow.Reach + num2 * 0.25f, seed, num3, follow);
					Sheet(body, follow.Reach - num2 * 1.6f, follow.Reach + num2 * 0.6f, seed + 3, num3 * 0.9f, follow);
					follow.Lift = 0.22f;
					Sheet(dust, follow.Reach - num2 * 3.4f, follow.Reach - num2 * 0.4f, seed + 7, JujutsuEase.Snap(t, 0.4f) * 0.75f, follow);
				};
				action(0f);
				JujutsuFxSequence.Run(0.62f).While(action).At(0.14f, (Action)delegate
				{
					//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_0045: Unknown result type (might be due to invalid IL or missing references)
					//IL_004a: Unknown result type (might be due to invalid IL or missing references)
					//IL_004f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0052: Unknown result type (might be due to invalid IL or missing references)
					//IL_0057: Unknown result type (might be due to invalid IL or missing references)
					//IL_0061: 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_006c: 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)
					for (int i = 0; i < 3; i++)
					{
						float num = (float)i * MathF.PI * 2f / 3f;
						Vector3 val = field.PointAt(num, radius * 0.55f, 0.1f);
						Vector3 val2 = val - centre;
						Vector3 val3 = ((Vector3)(ref val2)).normalized + Vector3.up * 0.7f;
						JujutsuMotes.Burst(val, val3, colour, radius * 0.4f, (JujutsuMoteKind)1, 0);
					}
				})
					.At(0.34f, (Action)delegate
					{
						//IL_0001: Unknown result type (might be due to invalid IL or missing references)
						//IL_0006: Unknown result type (might be due to invalid IL or missing references)
						//IL_000c: Unknown result type (might be due to invalid IL or missing references)
						//IL_002d: 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)
						JujutsuMotes.Burst(centre, Vector3.up, colour, radius * 0.5f, (JujutsuMoteKind)3, 0);
						if (mark)
						{
							JujutsuFxScorch.Mark(centre, colour, radius * 0.7f, 16f, true);
						}
					});
			}
			catch (Exception exception)
			{
				Fail(exception);
			}
		}

		internal static void QuakeTell(Vector3 centre, Color colour, float radius, float seconds)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result typ