Decompiled source of Shikamaru v0.5.1

plugins/Shikamaru/Shikamaru.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Json;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using HG;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CameraModes;
using RoR2.ContentManagement;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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("Shikamaru")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9bfd5ad0eaf008d69a3e7d831661aa0d64b61dc2")]
[assembly: AssemblyProduct("Shikamaru")]
[assembly: AssemblyTitle("Shikamaru")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ShikamaruMod
{
	public static class Snd
	{
		[Serializable]
		public class EvRow
		{
			public string @event;

			public float duration;
		}

		[Serializable]
		public class EvFile
		{
			public EvRow[] events;
		}

		private sealed class Speaking
		{
			public float until;

			public int prio;

			public uint id;
		}

		private static readonly Dictionary<string, Vector2> few = new Dictionary<string, Vector2>();

		private static Dictionary<string, float> lengths;

		private static readonly Dictionary<int, Speaking> speaking = new Dictionary<int, Speaking>();

		public static uint LastVoiceId;

		public static void Init()
		{
			string path = Path.Combine(Media.Assets, "Audio", "Shikamaru.bnk");
			if (File.Exists(path))
			{
				SoundBanks.Add(File.ReadAllBytes(path));
			}
			else
			{
				Plugin.Log.LogWarning((object)"SHIKAMARU_AUDIO bank missing");
			}
		}

		public static uint Sfx(string key, GameObject at)
		{
			if (key != null && !key.StartsWith("S_"))
			{
				key = "S_" + key;
			}
			uint result = (Object.op_Implicit((Object)(object)at) ? AkSoundEngine.PostEvent("Play_Shikamaru_" + key, at) : 0u);
			Combat.Trace?.Invoke("SFX Play_Shikamaru_" + key + " playingId=" + result + " rt=" + Time.realtimeSinceStartup.ToString("0.000"));
			return result;
		}

		public static void Few(string key, GameObject at, int max)
		{
			//IL_0013: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			few.TryGetValue(key, out var value);
			if (Time.time - value.x > 0.15f)
			{
				((Vector2)(ref value))..ctor(Time.time, 0f);
			}
			if (!(value.y >= (float)max))
			{
				value.y += 1f;
				few[key] = value;
				Sfx(key, at);
			}
		}

		private static float Length(string ev, float fallback)
		{
			LoadLengths();
			if (!lengths.TryGetValue(ev, out var value))
			{
				return fallback;
			}
			return value;
		}

		public static void LoadLengths()
		{
			if (lengths != null)
			{
				return;
			}
			lengths = new Dictionary<string, float>();
			try
			{
				EvFile evFile = Media.Read<EvFile>(Path.Combine(Media.Assets, "Audio", "ShikamaruEvents.json"));
				if (evFile != null && evFile.events != null)
				{
					EvRow[] events = evFile.events;
					foreach (EvRow evRow in events)
					{
						lengths[evRow.@event] = evRow.duration;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("SHIKAMARU_AUDIO event lengths unavailable: " + ex.Message));
			}
		}

		public static bool Voice(CharacterBody body, string key, float length, bool grunt = false, int prio = -1, bool log = false)
		{
			if (!Object.op_Implicit((Object)(object)body))
			{
				return false;
			}
			int instanceID = ((Object)body).GetInstanceID();
			float time = Time.time;
			if (prio < 0)
			{
				prio = ((!grunt) ? 1 : 0);
			}
			if (!speaking.TryGetValue(instanceID, out var value))
			{
				Dictionary<int, Speaking> dictionary = speaking;
				Speaking obj = new Speaking
				{
					until = -1f
				};
				value = obj;
				dictionary[instanceID] = obj;
			}
			if (time < value.until && prio <= value.prio)
			{
				if (log)
				{
					Plugin.Log.LogInfo((object)("SHIKAMARU_VOICE skip " + key + " busy prio=" + value.prio + " t=" + time.ToString("0.00")));
				}
				return false;
			}
			if (grunt && Random.value > 0.55f)
			{
				return false;
			}
			bool flag = VoiceLoadout.Get(body) == VoiceLoadout.Lang.English;
			string text = "Play_Shikamaru_" + (flag ? "VE_" : "V_") + key;
			uint num = AkSoundEngine.PostEvent(text, ((Component)body).gameObject, 1048576u, (EventCallback)null, (object)null);
			if (num == 0)
			{
				if (log)
				{
					Plugin.Log.LogInfo((object)("SHIKAMARU_VOICE not in a loaded bank: " + text));
				}
				return false;
			}
			if (time < value.until && value.id != 0)
			{
				AkSoundEngine.StopPlayingID(value.id, 80);
			}
			value.until = time + Length(text, length);
			value.prio = prio;
			value.id = num;
			LastVoiceId = num;
			Combat.Trace?.Invoke("VOICE " + (flag ? "VE_" : "V_") + key + " playingId=" + num + " rt=" + Time.realtimeSinceStartup.ToString("0.000"));
			if (log)
			{
				Plugin.Log.LogInfo((object)("SHIKAMARU_VOICE post " + text + " id=" + num + " t=" + time.ToString("0.00")));
				VoiceProbe.Watch(body, text, num);
			}
			return num != 0;
		}

		public static bool Playing(uint id, out int ms)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			ms = 0;
			if (id != 0 && (int)AkSoundEngine.GetSourcePlayPosition(id, ref ms, true) == 1)
			{
				return ms > 0;
			}
			return false;
		}
	}
	public static class LockCue
	{
		public static float MinGap = 0.06f;

		public static float TopGap = 0.12f;

		public static float Burst = 0.5f;

		public static int MaxStep = 5;

		public static int MaxQueue = 5;

		private static float Gap(Possession p)
		{
			if (p.cueNewBurst || p.cueStep < MaxStep)
			{
				return MinGap;
			}
			return TopGap;
		}

		public static bool Play(Possession p)
		{
			if (!Object.op_Implicit((Object)(object)p) || !Object.op_Implicit((Object)(object)p.body))
			{
				return false;
			}
			float time = Time.time;
			bool flag = time - p.cueLastLock > Burst;
			if (flag)
			{
				p.cueNewBurst = true;
			}
			p.cueLastLock = time;
			if (p.cuePending == 0 && time - p.cuePlayed >= Gap(p))
			{
				Fire(p, time, "lock");
				return flag;
			}
			if (p.cuePending < MaxQueue)
			{
				p.cuePending++;
				Combat.Trace?.Invoke("LOCKCUE queue n=" + p.cuePending);
				if (Tuning.Verbose.Value)
				{
					Plugin.Log.LogInfo((object)("SHIKAMARU_LOCKCUE queue pending=" + p.cuePending + " owner=" + ((Object)p.body).name + " server=" + NetworkServer.active));
				}
				return flag;
			}
			Combat.Trace?.Invoke("LOCKCUE drop");
			if (Tuning.Verbose.Value)
			{
				Plugin.Log.LogInfo((object)("SHIKAMARU_LOCKCUE drop owner=" + ((Object)p.body).name + " server=" + NetworkServer.active));
			}
			return flag;
		}

		public static void Pump(Possession p)
		{
			if (!Object.op_Implicit((Object)(object)p) || !Object.op_Implicit((Object)(object)p.body))
			{
				if (Object.op_Implicit((Object)(object)p))
				{
					p.cuePending = 0;
				}
				return;
			}
			float time = Time.time;
			if (!(time - p.cuePlayed < Gap(p)))
			{
				p.cuePending--;
				Fire(p, time, "queued");
			}
		}

		private static void Fire(Possession p, float now, string why)
		{
			p.cueStep = ((!p.cueNewBurst) ? Mathf.Min(p.cueStep + 1, MaxStep) : 0);
			p.cueNewBurst = false;
			p.cuePlayed = now;
			uint num = Snd.Sfx("LockOn" + p.cueStep, ((Component)p.body).gameObject);
			if (Tuning.Verbose.Value)
			{
				Plugin.Log.LogInfo((object)("SHIKAMARU_LOCKCUE play " + why + " step=" + p.cueStep + " id=" + num + " owner=" + ((Object)p.body).name + " mine=" + p.body.hasEffectiveAuthority + " server=" + NetworkServer.active + " t=" + now.ToString("0.000")));
			}
		}
	}
	public static class KThrow
	{
		private static int last;

		public static string Next()
		{
			int num = Random.Range(1, (last == 0) ? 7 : 6);
			if (last != 0 && num >= last)
			{
				num++;
			}
			last = num;
			return "KThrow" + num;
		}
	}
	public sealed class VoiceProbe : MonoBehaviour
	{
		private sealed class W
		{
			public string ev;

			public uint id;

			public float postT;
		}

		private readonly List<W> watch = new List<W>();

		public static void Watch(CharacterBody b, string ev, uint id)
		{
			if (Object.op_Implicit((Object)(object)b) && id != 0)
			{
				(((Component)b).GetComponent<VoiceProbe>() ?? ((Component)b).gameObject.AddComponent<VoiceProbe>()).watch.Add(new W
				{
					ev = ev,
					id = id,
					postT = Time.time
				});
			}
		}

		private void Update()
		{
			for (int num = watch.Count - 1; num >= 0; num--)
			{
				W w = watch[num];
				if (Snd.Playing(w.id, out var ms))
				{
					Plugin.Log.LogInfo((object)("SHIKAMARU_VOICE audible " + w.ev + " posMs=" + ms));
					watch.RemoveAt(num);
				}
				else if (Time.time - w.postT > 1.5f)
				{
					Plugin.Log.LogInfo((object)("SHIKAMARU_VOICE NOT_PLAYING " + w.ev + " id=" + w.id));
					watch.RemoveAt(num);
				}
			}
		}
	}
	public static class BodyProbe
	{
		private static GameObject root;

		private static readonly MeshCollider[] col = (MeshCollider[])(object)new MeshCollider[3];

		private static readonly Mesh[] mesh = (Mesh[])(object)new Mesh[3];

		private static readonly SkinnedMeshRenderer[] src = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[3];

		private static int count;

		private static readonly Dictionary<Mesh, BoneWeight[]> weights = new Dictionary<Mesh, BoneWeight[]>();

		private static readonly Dictionary<Mesh, int[]> tris = new Dictionary<Mesh, int[]>();

		private static Mesh skinMesh;

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

		private static Matrix4x4 toWorld;

		private static readonly Dictionary<Mesh, int[]> faces = new Dictionary<Mesh, int[]>();

		public static List<SkinnedMeshRenderer> Skins(CharacterBody b)
		{
			List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>();
			Transform val = ((Object.op_Implicit((Object)(object)b) && Object.op_Implicit((Object)(object)b.modelLocator)) ? b.modelLocator.modelTransform : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				SkinnedMeshRenderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<SkinnedMeshRenderer>();
				foreach (SkinnedMeshRenderer val2 in componentsInChildren)
				{
					if (Object.op_Implicit((Object)(object)val2) && ((Renderer)val2).enabled && Object.op_Implicit((Object)(object)val2.sharedMesh) && val2.sharedMesh.vertexCount >= 60 && val2.sharedMesh.vertexCount <= 24000)
					{
						list.Add(val2);
					}
				}
			}
			list.Sort((SkinnedMeshRenderer x, SkinnedMeshRenderer y) => y.sharedMesh.vertexCount.CompareTo(x.sharedMesh.vertexCount));
			if (list.Count > 3)
			{
				list.RemoveRange(3, list.Count - 3);
			}
			return list;
		}

		public static int Bake(List<SkinnedMeshRenderer> skins)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//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_00c3: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			count = 0;
			if (skins == null)
			{
				return 0;
			}
			try
			{
				if (!Object.op_Implicit((Object)(object)root))
				{
					root = new GameObject("ShikamaruBodyProbe");
					Object.DontDestroyOnLoad((Object)(object)root);
					for (int i = 0; i < 3; i++)
					{
						GameObject val = new GameObject("Probe" + i);
						val.transform.SetParent(root.transform, false);
						val.layer = LayerIndex.noCollision.intVal;
						col[i] = val.AddComponent<MeshCollider>();
						col[i].cookingOptions = (MeshColliderCookingOptions)16;
						((Collider)col[i]).enabled = false;
						mesh[i] = new Mesh
						{
							name = "ShikamaruBodyBake" + i
						};
					}
				}
				foreach (SkinnedMeshRenderer skin in skins)
				{
					if (Object.op_Implicit((Object)(object)skin) && ((Renderer)skin).enabled && ((Component)skin).gameObject.activeInHierarchy && Object.op_Implicit((Object)(object)skin.sharedMesh))
					{
						if (Object.op_Implicit((Object)(object)mesh[count]))
						{
							Object.Destroy((Object)(object)mesh[count]);
						}
						mesh[count] = new Mesh
						{
							name = "ShikamaruBodyBake"
						};
						((Collider)col[count]).enabled = true;
						skin.BakeMesh(mesh[count], true);
						((Component)col[count]).transform.SetPositionAndRotation(((Component)skin).transform.position, ((Component)skin).transform.rotation);
						((Component)col[count]).transform.localScale = ((Component)skin).transform.lossyScale;
						col[count].sharedMesh = null;
						col[count].sharedMesh = mesh[count];
						((Collider)col[count]).enabled = true;
						src[count] = skin;
						if (++count >= 3)
						{
							break;
						}
					}
				}
				if (count > 0)
				{
					Physics.SyncTransforms();
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("SHIKAMARU_SEW body probe: " + ex.Message));
				Off();
			}
			return count;
		}

		public static bool Ray(Ray r, float len, out RaycastHit hit, out SkinnedMeshRenderer s)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			hit = default(RaycastHit);
			s = null;
			float num = float.MaxValue;
			RaycastHit val = default(RaycastHit);
			for (int i = 0; i < count; i++)
			{
				if (((Collider)col[i]).Raycast(r, ref val, len) && ((RaycastHit)(ref val)).distance < num)
				{
					num = ((RaycastHit)(ref val)).distance;
					hit = val;
					s = src[i];
				}
			}
			return Object.op_Implicit((Object)(object)s);
		}

		public static Transform BoneAt(SkinnedMeshRenderer s, RaycastHit h)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00d7: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			Mesh sharedMesh = s.sharedMesh;
			Transform[] bones = s.bones;
			if (Object.op_Implicit((Object)(object)sharedMesh) && sharedMesh.isReadable && ((RaycastHit)(ref h)).triangleIndex >= 0)
			{
				if (!weights.TryGetValue(sharedMesh, out var value))
				{
					if (weights.Count > 60)
					{
						weights.Clear();
						tris.Clear();
					}
					value = (weights[sharedMesh] = sharedMesh.boneWeights);
					tris[sharedMesh] = sharedMesh.triangles;
				}
				int[] array = tris[sharedMesh];
				int num = ((RaycastHit)(ref h)).triangleIndex * 3;
				if (num + 2 < array.Length && array[num] < value.Length)
				{
					Vector3 barycentricCoordinate = ((RaycastHit)(ref h)).barycentricCoordinate;
					int num2 = ((barycentricCoordinate.x >= barycentricCoordinate.y && barycentricCoordinate.x >= barycentricCoordinate.z) ? array[num] : ((barycentricCoordinate.y >= barycentricCoordinate.z) ? array[num + 1] : array[num + 2]));
					int boneIndex = ((BoneWeight)(ref value[num2])).boneIndex0;
					if (boneIndex >= 0 && boneIndex < bones.Length && Object.op_Implicit((Object)(object)bones[boneIndex]))
					{
						return bones[boneIndex];
					}
				}
			}
			Transform val = null;
			float num3 = 1E+09f;
			Transform[] array2 = bones;
			foreach (Transform val2 in array2)
			{
				if (!Object.op_Implicit((Object)(object)val2))
				{
					continue;
				}
				bool flag = false;
				Vector3 val4;
				foreach (Transform item in val2)
				{
					Vector3 val3 = item.position - val2.position;
					float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
					if (!(sqrMagnitude < 1E-05f))
					{
						flag = true;
						float num4 = Mathf.Clamp01(Vector3.Dot(((RaycastHit)(ref h)).point - val2.position, val3) / sqrMagnitude);
						val4 = ((RaycastHit)(ref h)).point - val2.position - val3 * num4;
						float sqrMagnitude2 = ((Vector3)(ref val4)).sqrMagnitude;
						if (sqrMagnitude2 < num3)
						{
							num3 = sqrMagnitude2;
							val = val2;
						}
					}
				}
				if (!flag)
				{
					val4 = ((RaycastHit)(ref h)).point - val2.position;
					float num5 = ((Vector3)(ref val4)).sqrMagnitude * 1.2f;
					if (num5 < num3)
					{
						num3 = num5;
						val = val2;
					}
				}
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				return ((Component)s).transform;
			}
			return val;
		}

		public static bool Tri(SkinnedMeshRenderer s, int t, out int a, out int b, out int c)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			a = (b = (c = 0));
			int num = -1;
			for (int i = 0; i < count; i++)
			{
				if ((Object)(object)src[i] == (Object)(object)s)
				{
					num = i;
				}
			}
			if (num < 0 || t < 0)
			{
				return false;
			}
			if (!faces.TryGetValue(s.sharedMesh, out var value))
			{
				if (faces.Count > 60)
				{
					faces.Clear();
				}
				value = (faces[s.sharedMesh] = mesh[num].triangles);
			}
			if (t * 3 + 2 >= value.Length)
			{
				return false;
			}
			a = value[t * 3];
			b = value[t * 3 + 1];
			c = value[t * 3 + 2];
			mesh[num].GetVertices(verts);
			toWorld = Matrix4x4.TRS(((Component)s).transform.position, ((Component)s).transform.rotation, ((Component)s).transform.lossyScale);
			if (a < verts.Count && b < verts.Count)
			{
				return c < verts.Count;
			}
			return false;
		}

		public static bool Skin(SkinnedMeshRenderer s)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0080: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)s) || !((Renderer)s).enabled || !Object.op_Implicit((Object)(object)s.sharedMesh) || !((Component)s).gameObject.activeInHierarchy)
			{
				return false;
			}
			if (!Object.op_Implicit((Object)(object)skinMesh))
			{
				skinMesh = new Mesh
				{
					name = "ShikamaruSkin"
				};
				skinMesh.MarkDynamic();
			}
			try
			{
				s.BakeMesh(skinMesh, true);
				skinMesh.GetVertices(verts);
			}
			catch
			{
				return false;
			}
			toWorld = Matrix4x4.TRS(((Component)s).transform.position, ((Component)s).transform.rotation, ((Component)s).transform.lossyScale);
			return verts.Count > 0;
		}

		public static Vector3 At(int v)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			if (v >= verts.Count)
			{
				return Vector3.zero;
			}
			return ((Matrix4x4)(ref toWorld)).MultiplyPoint3x4(verts[v]);
		}

		public static void Frame(int a, int b, int c, SkinnedMeshRenderer s, out Vector3 t, out Vector3 bt, out Vector3 n)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_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)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = At(a);
			Vector3 val2 = At(b);
			Vector3 val3 = At(c);
			n = Vector3.Cross(val2 - val, val3 - val);
			t = val2 - val;
			if (((Vector3)(ref n)).sqrMagnitude < 1E-12f || ((Vector3)(ref t)).sqrMagnitude < 1E-12f)
			{
				t = (bt = (n = Vector3.zero));
				return;
			}
			((Vector3)(ref n)).Normalize();
			((Vector3)(ref t)).Normalize();
			bt = Vector3.Cross(n, t);
		}

		public static Vector3 Near(Vector3 p)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			if (count == 0)
			{
				return p;
			}
			Bounds bounds = ((Collider)col[0]).bounds;
			return Vector3.Lerp(((Bounds)(ref bounds)).center, ((Bounds)(ref bounds)).ClosestPoint(p), 0.25f);
		}

		public static string Info(Vector3 at)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			for (int i = 0; i < count; i++)
			{
				string[] obj = new string[14]
				{
					text,
					"[",
					((Collider)col[i]).enabled.ToString(),
					" ",
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null,
					null
				};
				Bounds bounds = ((Collider)col[i]).bounds;
				Vector3 val = ((Bounds)(ref bounds)).center;
				obj[4] = ((Vector3)(ref val)).ToString("F1");
				obj[5] = " ";
				bounds = ((Collider)col[i]).bounds;
				val = ((Bounds)(ref bounds)).size;
				obj[6] = ((Vector3)(ref val)).ToString("F1");
				obj[7] = " scale=";
				val = ((Component)col[i]).transform.localScale;
				obj[8] = val.x.ToString("0.000");
				obj[9] = " local=";
				object obj2;
				if (!Object.op_Implicit((Object)(object)mesh[i]))
				{
					obj2 = "";
				}
				else
				{
					bounds = mesh[i].bounds;
					val = ((Bounds)(ref bounds)).size;
					obj2 = ((Vector3)(ref val)).ToString("F1");
				}
				obj[10] = (string)obj2;
				obj[11] = " v=";
				obj[12] = (Object.op_Implicit((Object)(object)mesh[i]) ? mesh[i].vertexCount : 0).ToString();
				obj[13] = "]";
				text = string.Concat(obj);
			}
			return text + " at=" + ((Vector3)(ref at)).ToString("F1");
		}

		public static void Off()
		{
			for (int i = 0; i < 3; i++)
			{
				if (Object.op_Implicit((Object)(object)col[i]))
				{
					((Collider)col[i]).enabled = false;
				}
				src[i] = null;
			}
			count = 0;
		}
	}
	public sealed class ChokeView : MonoBehaviour
	{
		private sealed class Hand
		{
			public float azOff;

			public float vFrac;

			public float delay;

			public float size = 1f;

			public float mirror = 1f;

			public float seed;

			public bool main;

			public bool grab;
		}

		private struct Shard
		{
			public Vector3 p;

			public Vector3 v;

			public float size;

			public float life;

			public float born;
		}

		private sealed class Victim
		{
			public CharacterBody b;

			public bool boss;

			public bool air;

			public bool linked;

			public bool sampled;

			public bool lifted;

			public bool small;

			public bool meshed;

			public bool noMesh;

			public SkinnedMeshRenderer[] skins;

			public float rBody = 0.6f;

			public float dark;

			public float hug = 1f;

			public int step;

			public int verts;

			public float gone = -1f;

			public float goneFrom;

			public float burst = -1f;

			public float melt = -1f;

			public float meltFrom;

			public float seed;

			public float nextSample;

			public float lift;

			public float height = 2f;

			public float drop;

			public float reach = 1f;

			public float groundR = 1f;

			public float camAz;

			public float lastS;

			public Vector3 baseOff;

			public Vector3 basePos;

			public Vector3 ground;

			public Vector3 gn = Vector3.up;

			public Vector3 modelBase0;

			public readonly float[] rad = new float[108];

			public readonly float[] rowMean = new float[9];

			public Hand[] hands;

			public Transform modelBase;

			public readonly List<Shard> shards = new List<Shard>();

			public Vector3[] whip;

			public float Radius(float v, float az)
			{
				float num = Mathf.Clamp01(v / height) * 8f;
				int num2 = (int)num;
				int num3 = Mathf.Min(num2 + 1, 8);
				float num4 = num - (float)num2;
				float num5 = Mathf.Repeat(az, MathF.PI * 2f) * (6f / MathF.PI);
				int num6 = (int)num5;
				float num7 = num5 - (float)num6;
				num6 %= 12;
				int num8 = (num6 + 1) % 12;
				float num9 = rad[num2 * 12 + num6] + (rad[num2 * 12 + num8] - rad[num2 * 12 + num6]) * num7;
				float num10 = rad[num3 * 12 + num6] + (rad[num3 * 12 + num8] - rad[num3 * 12 + num6]) * num7;
				return num9 + (num10 - num9) * num4;
			}

			public float Rref(float v)
			{
				if (v < 0f)
				{
					if (!air)
					{
						return rowMean[0] - v;
					}
					return Mathf.Lerp(rowMean[0], 0.14f, Mathf.Min(1f, (0f - v) / Mathf.Max(0.5f, drop) * 3f));
				}
				float num = Mathf.Clamp01(v / height) * 8f;
				int num2 = (int)num;
				int num3 = Mathf.Min(num2 + 1, 8);
				return Mathf.Max(0.12f, rowMean[num2] + (rowMean[num3] - rowMean[num2]) * (num - (float)num2));
			}
		}

		private enum Phase
		{
			Idle,
			Hold,
			Hush,
			Retreat
		}

		private sealed class Later : MonoBehaviour
		{
			public float at;

			public string key;

			private void Update()
			{
				if (key != null && Time.time >= at)
				{
					Snd.Sfx(key, ((Component)this).gameObject);
					key = null;
				}
			}
		}

		public static float Hug = 1f;

		public static float AirHug = 1.3f;

		public static float Skin = 0.045f;

		public static float GroundLift = 0.07f;

		public static float Rim = 0.055f;

		public static float RimAlpha = 0.7f;

		public static float HandSize = 1.75f;

		public static float MinHand = 0.5f;

		public static float MaxHand = 8f;

		public static float MaxOfHeight = 0.46f;

		public static float NeckAt = 0.64f;

		public static float Spiral = 75f;

		public static float ClimbEnd = 0.5f;

		public static float GripEnd = 0.6f;

		public static float LiftMax = 0.28f;

		public static float RetreatSeconds = 0.3f;

		public static float BurstSeconds = 0.55f;

		public static float WhipSeconds = 0.24f;

		public static float ClenchSeconds = 0.07f;

		public static float Bands = 0f;

		public static float FingerW = 0.15f;

		public static float Hook = 0.7f;

		public static float BossHand = 0.75f;

		public static float WhipHalf = 0.12f;

		public static float GrabSize = 1.9f;

		public static float GrabOfHeight = 0.55f;

		public static float GrabFingerW = 0.1f;

		public static float GrabBelow = 3.2f;

		public static float GrabHug = 1.1f;

		public static float DomeSize = 3f;

		public static float DomeOfHeight = 0.6f;

		public static float DomeStand = 1.3f;

		public static float DomeCup = 0.5f;

		public static float DomeClose = 0.1f;

		public static float DomeTip = 0.66f;

		public static float DomeHook = 0.8f;

		public static float DomeNearCut = 3f;

		public static float DomeFingerW = 0.08f;

		public static float Creep = 0.07f;

		public static float MeshEvery = 1.6f;

		public static float BossEvery = 0.7f;

		public static int ResampleMaxVerts = 15000;

		public static bool UseMesh = true;

		public static int Lurches = 4;

		public static int MaxHands = 4;

		public static bool Enabled = true;

		public static bool GrabDome = true;

		private const int Rows = 9;

		private const int Cols = 12;

		private static readonly Dictionary<Possession, ChokeView> map = new Dictionary<Possession, ChokeView>();

		private Possession owner;

		private readonly InkMesh im = new InkMesh();

		private Mesh mesh;

		private MeshRenderer mr;

		private Material mat;

		private Phase phase;

		private float squeeze;

		private float phaseAt;

		private float retreatFrom;

		private float exitAt = -1f;

		private readonly List<Victim> victims = new List<Victim>();

		private CharVisual visual;

		private Gesture gesture;

		public static float MeltSeconds = 0.62f;

		public static float PoolSeconds = 0.38f;

		public static float PoolGrow = 0.3f;

		private float fM = -1f;

		private float fTipK = 1f;

		private float fMerge = 1f;

		private static readonly List<Collider> cols = new List<Collider>();

		private static readonly float[] tmp = new float[108];

		private static GameObject probeRoot;

		private static readonly MeshCollider[] probe = (MeshCollider[])(object)new MeshCollider[3];

		private static readonly Mesh[] probeMesh = (Mesh[])(object)new Mesh[3];

		private static int meshFrame = -1;

		private static readonly float[] rowTmp = new float[Mathf.Max(9, 12)];

		private Victim fw;

		private float fAz;

		private float fV;

		private float fSize;

		private float fSin;

		private float fCos;

		private float fMir;

		private float fRim;

		private float fRimA;

		private int secLast;

		private bool fDome;

		private Vector3 dB;

		private Vector3 dR;

		private Vector3 dBase;

		private float dD;

		private float dH1;

		private float dCup;

		private float dGround;

		private static readonly float[] DomeA = new float[4] { -12f, -4f, 5f, 13f };

		public static float KnuckleStag = 0.8f;

		public static float KnuckleCap = 1.55f;

		public static float DomeJoint = 1.1f;

		public static float DomeMid = 0.88f;

		private static readonly float[] StagF = new float[4] { 0.45f, 1f, 0.72f, -0.05f };

		private float fStag;

		private static readonly float[] Seg = new float[3] { 0.42f, 0.33f, 0.25f };

		private static readonly float[] Mid = new float[3] { 0.98f, 0.92f, 0.82f };

		private static readonly float[] Joint = new float[2] { 1.05f, 0.96f };

		private static readonly float[] PalmX = new float[13]
		{
			-0.3f, 0.3f, 0.41f, 0.47f, 0.48f, 0.42f, 0.13f, -0.13f, -0.42f, -0.5f,
			-0.56f, -0.52f, -0.41f
		};

		private static readonly float[] PalmY = new float[13]
		{
			0f, 0f, 0.25f, 0.55f, 0.85f, 1.02f, 1.07f, 1.07f, 1.02f, 0.8f,
			0.55f, 0.3f, 0.1f
		};

		private static readonly float[] FingerX = new float[4] { -0.34f, -0.115f, 0.115f, 0.34f };

		private static readonly float[] FingerL = new float[4] { 0.98f, 1.1f, 1f, 0.8f };

		private static readonly float[] OpenA = new float[4] { -18f, -6f, 7f, 22f };

		private static readonly float[] OpenB = new float[4] { 4f, 1.5f, -2f, -5f };

		private static readonly float[] GripA = new float[4] { -23f, -7f, 9f, 27f };

		private static readonly float[] GripB = new float[4] { 17f, 6f, -7f, -19f };

		private static readonly Vector3[] armP = (Vector3[])(object)new Vector3[20];

		private static readonly Vector3[] armN = (Vector3[])(object)new Vector3[20];

		private static readonly float[] GrabA = new float[4] { -14f, -5f, 5f, 14f };

		public static bool Hands3 = true;

		public static float TubeSheen = 1.25f;

		public static float OverRim = 0.75f;

		public static float Fr3 = 0.116f;

		public static float FrAir = 0.1f;

		public static float GrabTilt = 52f;

		public static float GrabNeck = 0.74f;

		public static float GrabNeckRound = 0.52f;

		public static float GrabSpread = 25f;

		public static float GrabThumb = -66f;

		public static float GrabFr = 0.122f;

		public static float GrabTip = 0.46f;

		public static float GrabPress = 0.2f;

		public static float GrabBack = 0.3f;

		public static float GrabLen = 0.95f;

		public static int WispN = 3;

		private static readonly Vector3[] tq = (Vector3[])(object)new Vector3[96];

		private static readonly float[] tw3 = new float[96];

		private int tn3;

		private float fRim3;

		private float fA3;

		private float fSeed3;

		private bool lod3;

		private Vector3 camP;

		private Vector3 camU;

		private Vector3 camR;

		private static readonly float[] gx = new float[108];

		private static readonly float[] gy = new float[108];

		private static readonly float[] gz = new float[108];

		private static int gN;

		private float wideK = 1f;

		private static readonly float[] JR = new float[4] { 1f, 0.95f, 0.76f, 0.52f };

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

		public static bool SnapStar = false;

		public int Count => victims.Count;

		public bool Busy
		{
			get
			{
				if (phase == Phase.Idle)
				{
					return victims.Count > 0;
				}
				return true;
			}
		}

		private float MeltSize
		{
			get
			{
				if (!(fM < 0f))
				{
					return 1f - 0.62f * MeltIn(fM, 0.34f, 0.97f);
				}
				return 1f;
			}
		}

		private float MeltWide
		{
			get
			{
				if (!(fM < 0f))
				{
					return (1f - 0.5f * MeltIn(fM, 0.2f, 0.75f)) * (1f - MeltIn(fM, 0.8f, 1f));
				}
				return 1f;
			}
		}

		public Gesture Gesture => gesture;

		public CharVisual Visual => visual;

		public static ChokeView For(Possession p)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)p))
			{
				return null;
			}
			if (map.TryGetValue(p, out var value) && Object.op_Implicit((Object)(object)value))
			{
				return value;
			}
			value = new GameObject("ShikamaruChokeView").AddComponent<ChokeView>();
			value.owner = p;
			map[p] = value;
			return value;
		}

		private void Awake()
		{
			//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_0016: Expected O, but got Unknown
			mesh = new Mesh
			{
				name = "ShikamaruChokeInk"
			};
			mesh.MarkDynamic();
			((Component)this).gameObject.AddComponent<MeshFilter>().sharedMesh = mesh;
			mr = ((Component)this).gameObject.AddComponent<MeshRenderer>();
			((Renderer)mr).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)mr).receiveShadows = false;
			((Renderer)mr).enabled = false;
		}

		private void OnDestroy()
		{
			foreach (Victim victim in victims)
			{
				Unlift(victim);
			}
			if (Object.op_Implicit((Object)(object)owner))
			{
				map.Remove(owner);
			}
			if (Object.op_Implicit((Object)(object)mesh))
			{
				Object.Destroy((Object)(object)mesh);
			}
			if (Object.op_Implicit((Object)(object)mat))
			{
				Object.Destroy((Object)(object)mat);
			}
		}

		private void Melt(Victim w, float from)
		{
			if (!(w.melt >= 0f))
			{
				w.melt = Time.time;
				w.meltFrom = Mathf.Clamp01(from);
			}
		}

		private static float MeltIn(float m, float a, float b)
		{
			return Smooth(Mathf.InverseLerp(a, b, m));
		}

		private void MeltPose(ref float climb, ref float gripRaw, ref float q, ref float jolt)
		{
			if (!(fM < 0f))
			{
				climb *= 1f - MeltIn(fM, 0.3f, 1f);
				gripRaw *= 1f - 0.66f * MeltIn(fM, 0f, 0.44f);
				q *= 1f - MeltIn(fM, 0f, 0.16f);
				jolt = 0f;
				fTipK = 1f - MeltIn(fM, 0.08f, 0.52f);
				fMerge = 1f - 0.72f * MeltIn(fM, 0.36f, 0.74f);
			}
		}

		private void Drip(Vector3 p, float seed, float size, float groundY)
		{
			//IL_008a: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			if (fM < 0.06f || lod3)
			{
				return;
			}
			float num = Mathf.InverseLerp(0.06f + 0.12f * Mathf.Repeat(seed, 1f), 0.85f, fM);
			if (num <= 0f || num >= 1f)
			{
				return;
			}
			float num2 = size * Mathf.Lerp(0.08f, 0.95f, num * num);
			float num3 = ((num < 0.6f) ? 0f : Mathf.InverseLerp(0.6f, 1f, num));
			num2 = Mathf.Min(num2, Mathf.Max(0f, p.y - groundY));
			if (!(num2 < 0.03f))
			{
				T0();
				for (int i = 0; i <= 6; i++)
				{
					float num4 = (float)i / 6f;
					float num5 = Mathf.Lerp(num3, 1f, num4) * num2;
					TP(p + Vector3.down * num5 + camR * (0.02f * size * Mathf.Sin(num4 * 4f + seed * 9f)), size * Mathf.Lerp(0.045f, 0.02f, num) * ((num4 < 0.75f) ? Mathf.Lerp(1f - num3, 0.55f, num4 / 0.75f) : Mathf.Lerp(0.95f, 0.05f, (num4 - 0.75f) * 4f)));
				}
				Tube(over: false, 0.5f, Time.time);
			}
		}

		private void MeltPool(Victim w, float t)
		{
			//IL_00c1: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: 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)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			float num = t - w.melt;
			float num2 = num / MeltSeconds;
			float num3 = Mathf.Clamp01((num - MeltSeconds) / PoolSeconds);
			float num4 = Smooth(Mathf.Clamp01(num / 0.1f));
			if (!(num3 >= 1f))
			{
				float num5 = Mathf.Clamp(Mathf.Max(w.groundR * 0.78f, w.rBody * 1.05f), 0.5f, 4f) * num4 * (1f + 0.1f * Mathf.Sin(Mathf.Clamp01((num2 - 0.7f) / 0.4f) * 3.1416f) + PoolGrow * Smooth(num3));
				float num6 = 1f - Smooth(num3);
				float num7 = 1f - 0.75f * num3;
				Vector3 gn = w.gn;
				Vector3 val = Vector3.Cross(gn, Vector3.forward);
				if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
				{
					val = Vector3.Cross(gn, Vector3.right);
				}
				((Vector3)(ref val)).Normalize();
				Vector3 val2 = Vector3.Cross(gn, val);
				Vector3 val3 = w.ground + gn * GroundLift;
				int a = im.Black(val3, num6 * num7);
				int count = im.v.Count;
				for (int i = 0; i < 40; i++)
				{
					float num8 = (float)i * (MathF.PI * 2f) / 40f;
					float num9 = Mathf.Abs(Mathf.Sin(num8 * 3.5f + w.seed));
					num9 *= num9;
					num9 *= num9;
					float num10 = num5 * (0.92f + 0.34f * num9 * num9 * (1f - Smooth(num2)) + 0.05f * Mathf.Sin(num8 * 3f + t * 2.4f + w.seed) + 0.03f * Mathf.Sin(num8 * 7f - t * 3.1f + w.seed) + 0.05f * num3 * Mathf.Sin(num8 * 5f + w.seed * 2f));
					Vector3 val4 = val * Mathf.Cos(num8) + val2 * Mathf.Sin(num8);
					im.Black(val3 + val4 * Mathf.Max(0f, num10 * (1f - 0.25f * num3) - Rim), num6 * num7);
					im.Indigo(val3 + val4 * num10, RimAlpha * num6 * (1f - num3));
					im.Indigo(val3 + val4 * (num10 + Rim * (1f + 2f * num3)), 0f);
				}
				for (int j = 0; j < 40; j++)
				{
					int num11 = count + j * 3;
					int num12 = count + (j + 1) % 40 * 3;
					im.Tri(isCore: true, a, num11, num12);
					im.Tri(isCore: false, num11, num11 + 1, num12);
					im.Tri(isCore: false, num12, num11 + 1, num12 + 1);
					im.Tri(isCore: false, num11 + 1, num11 + 2, num12 + 1);
					im.Tri(isCore: false, num12 + 1, num11 + 2, num12 + 2);
				}
			}
		}

		public void Begin(CharVisual v, Gesture g)
		{
			phase = Phase.Hold;
			squeeze = 0f;
			phaseAt = Time.time;
			exitAt = -1f;
			visual = v;
			gesture = g;
			foreach (Victim victim in victims)
			{
				if (victim.burst < 0f && victim.melt < 0f)
				{
					victim.gone = -1f;
				}
			}
		}

		public void Hold(float s)
		{
			if (phase == Phase.Hold)
			{
				squeeze = s;
			}
		}

		public void Exit()
		{
			exitAt = Time.time;
		}

		public void Claim()
		{
			exitAt = -1f;
		}

		public void Hush()
		{
			phase = Phase.Hush;
			phaseAt = Time.time;
			squeeze = 1f;
		}

		public void LetGo()
		{
			EndGesture(0.2f);
			StartRetreat();
		}

		public void EndGesture(float fade)
		{
			if (Object.op_Implicit((Object)(object)visual) && gesture != null)
			{
				visual.EndGesture(gesture, fade);
			}
			gesture = null;
		}

		private void StartRetreat()
		{
			if (phase == Phase.Idle || phase == Phase.Retreat)
			{
				return;
			}
			retreatFrom = ((phase == Phase.Hush) ? 1f : squeeze);
			phase = Phase.Retreat;
			phaseAt = Time.time;
			foreach (Victim victim in victims)
			{
				if (victim.burst < 0f && victim.gone < 0f)
				{
					Melt(victim, (victim.lastS > 0f) ? victim.lastS : retreatFrom);
				}
			}
		}

		public void Snap()
		{
			//IL_002b: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			float time = Time.time;
			Vector3 home = ((Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)owner.body)) ? owner.body.footPosition : ((Component)this).transform.position);
			int num = 0;
			foreach (Victim victim in victims)
			{
				if (victim.burst < 0f && victim.melt < 0f && (victim.gone < 0f || time - victim.gone < 0.5f))
				{
					Combat.Trace?.Invoke("CHOKE_VIEW snap " + (Object.op_Implicit((Object)(object)victim.b) ? ((Object)victim.b).name : "?") + " lift=" + victim.lift.ToString("0.00") + " modelBase=" + (Object.op_Implicit((Object)(object)victim.modelBase) ? ((Object)victim.modelBase).name : "none") + " hands=" + victim.hands.Length + " h=" + victim.height.ToString("0.0"));
					Burst(victim, 1f, home, whip: true);
					Melt(victim, 1f);
					if (num++ < 4)
					{
						Crack(victim, (float)num * 0.018f);
					}
				}
			}
			phase = Phase.Idle;
			squeeze = 0f;
		}

		private void Crack(Victim w, float delay)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			GameObject val = new GameObject("ShikamaruChokeCrack");
			val.transform.position = w.basePos + Vector3.up * (w.height * 0.7f);
			val.AddComponent<AkGameObj>();
			Later later = val.AddComponent<Later>();
			later.at = Time.time + delay;
			later.key = "ChokeCrack";
			Object.Destroy((Object)val, 2.5f);
		}

		private Victim Add(CharacterBody b)
		{
			//IL_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_061e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0670: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			Victim victim = new Victim
			{
				b = b,
				boss = Possession.IsBoss(b),
				seed = (float)(((Object)b).GetInstanceID() & 0x3FF) * 0.37f
			};
			victims.Add(victim);
			Transform val = (Object.op_Implicit((Object)(object)b.modelLocator) ? b.modelLocator.modelTransform : null);
			List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>();
			SkinnedMeshRenderer[] componentsInChildren;
			if (Object.op_Implicit((Object)(object)val))
			{
				componentsInChildren = ((Component)val).GetComponentsInChildren<SkinnedMeshRenderer>();
				foreach (SkinnedMeshRenderer val2 in componentsInChildren)
				{
					if (Object.op_Implicit((Object)(object)val2) && ((Renderer)val2).enabled && Object.op_Implicit((Object)(object)val2.sharedMesh) && val2.sharedMesh.vertexCount >= 60 && val2.sharedMesh.vertexCount <= 40000)
					{
						list.Add(val2);
					}
				}
			}
			list.Sort((SkinnedMeshRenderer x, SkinnedMeshRenderer y) => y.sharedMesh.vertexCount.CompareTo(x.sharedMesh.vertexCount));
			if (list.Count > 3)
			{
				list.RemoveRange(3, list.Count - 3);
			}
			victim.skins = list.ToArray();
			victim.noMesh = victim.skins.Length == 0;
			componentsInChildren = victim.skins;
			foreach (SkinnedMeshRenderer val3 in componentsInChildren)
			{
				victim.verts += val3.sharedMesh.vertexCount;
			}
			Sample(victim, first: true);
			float num = (((((Object)b).GetInstanceID() & 1) == 0) ? 1f : (-1f));
			int num2 = ((!Object.op_Implicit((Object)(object)owner)) ? 1 : owner.Count);
			int num3 = (victim.boss ? 4 : ((victim.height > 3.4f) ? 3 : 2));
			if (num2 > 8)
			{
				num3 = Mathf.Min(num3, 2);
			}
			if (num2 > 14)
			{
				num3 = 1;
			}
			num3 = Mathf.Min(num3, MaxHands);
			victim.hands = new Hand[num3];
			victim.small = victim.height < 1.7f;
			victim.hands[0] = new Hand
			{
				main = true,
				mirror = num,
				azOff = num * 0.1f,
				vFrac = NeckAt,
				seed = victim.seed
			};
			if (num3 > 1)
			{
				victim.hands[1] = new Hand
				{
					mirror = 0f - num,
					azOff = 3.14159f - num * 0.45f,
					vFrac = (victim.small ? 0.6f : 0.5f),
					delay = 0.1f,
					size = 0.85f,
					seed = victim.seed + 2f
				};
			}
			if (num3 > 2)
			{
				victim.hands[2] = new Hand
				{
					mirror = num,
					azOff = (0f - num) * 1.25f,
					vFrac = 0.34f,
					delay = 0.18f,
					size = 0.7f,
					seed = victim.seed + 4f
				};
			}
			if (num3 > 3)
			{
				victim.hands[3] = new Hand
				{
					mirror = 0f - num,
					azOff = num * 1.7f,
					vFrac = 0.58f,
					delay = 0.24f,
					size = 0.8f,
					seed = victim.seed + 6f
				};
			}
			if (victim.boss)
			{
				victim.hands[0].size = BossHand;
				victim.hands[0].azOff = num * 0.2f;
				if (num3 > 1)
				{
					victim.hands[1] = new Hand
					{
						mirror = 0f - num,
						azOff = (0f - num) * 1.35f,
						vFrac = 0.3f,
						delay = 0.08f,
						size = BossHand * 0.56f,
						seed = victim.seed + 2f
					};
				}
				if (num3 > 2)
				{
					victim.hands[2] = new Hand
					{
						mirror = num,
						azOff = num * 1.45f,
						vFrac = 0.42f,
						delay = 0.16f,
						size = BossHand * 0.56f,
						seed = victim.seed + 4f
					};
				}
				if (num3 > 3)
				{
					victim.hands[3] = new Hand
					{
						mirror = 0f - num,
						azOff = 3.14159f + num * 0.3f,
						vFrac = 0.58f,
						delay = 0.22f,
						size = BossHand * 0.8f,
						seed = victim.seed + 6f
					};
				}
			}
			if (!victim.boss && victim.height < GrabBelow)
			{
				victim.hands = new Hand[1]
				{
					new Hand
					{
						main = true,
						grab = true,
						mirror = num,
						vFrac = 0.56f,
						seed = victim.seed
					}
				};
			}
			else if (victim.air && num3 > 1)
			{
				victim.hands[0].vFrac = 0.42f;
				victim.hands[1].vFrac = 0.4f;
			}
			victim.hug = (victim.air ? AirHug : (victim.hands[0].grab ? GrabHug : Hug));
			victim.dark = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.55f, 0.88f, ShadowEnvironment.ShadeFraction(victim.ground)));
			Camera val4 = Fx.Cam();
			Vector3 val5 = (Object.op_Implicit((Object)(object)val4) ? ((Component)val4).transform.position : ((Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)owner.body)) ? owner.body.corePosition : (victim.basePos + Vector3.forward)));
			victim.camAz = Mathf.Atan2(val5.z - victim.basePos.z, val5.x - victim.basePos.x);
			ModelLocator modelLocator = b.modelLocator;
			victim.modelBase = (Object.op_Implicit((Object)(object)modelLocator) ? modelLocator.modelBaseTransform : null);
			if (Object.op_Implicit((Object)(object)victim.modelBase))
			{
				victim.modelBase0 = victim.modelBase.localPosition;
			}
			return victim;
		}

		private Victim Find(CharacterBody b)
		{
			foreach (Victim victim in victims)
			{
				if ((Object)(object)victim.b == (Object)(object)b && victim.burst < 0f && victim.melt < 0f)
				{
					return victim;
				}
			}
			return null;
		}

		private void Sync()
		{
			foreach (Victim victim2 in victims)
			{
				victim2.linked = false;
			}
			if (!Object.op_Implicit((Object)(object)owner))
			{
				return;
			}
			int num = 0;
			foreach (Possession.Link link in owner.Links)
			{
				if (!Object.op_Implicit((Object)(object)link.victim))
				{
					continue;
				}
				Victim victim = Find(link.victim);
				if (victim == null)
				{
					if (num >= 4)
					{
						continue;
					}
					victim = Add(link.victim);
					num++;
				}
				victim.linked = true;
				if (victim.gone >= 0f && phase == Phase.Hold)
				{
					victim.gone = -1f;
				}
			}
		}

		private void Sample(Victim w, bool first)
		{
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: 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_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0898: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_090c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0912: Unknown result type (might be due to invalid IL or missing references)
			//IL_0917: Unknown result type (might be due to invalid IL or missing references)
			//IL_091c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0932: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody b = w.b;
			if (!Object.op_Implicit((Object)(object)b))
			{
				return;
			}
			w.nextSample = Time.time + (w.boss ? BossEvery : MeshEvery) + Mathf.Repeat(w.seed, 0.2f);
			cols.Clear();
			int num = 0;
			bool flag = UseMesh && !w.noMesh;
			if (flag && w.meshed && w.verts > ResampleMaxVerts)
			{
				return;
			}
			if (flag && !first && Time.frameCount != meshFrame)
			{
				meshFrame = Time.frameCount;
				num = Probe(w);
				if (num == 0)
				{
					w.noMesh = true;
				}
			}
			else if (flag)
			{
				w.nextSample = Time.time;
				if (!first)
				{
					return;
				}
			}
			HurtBoxGroup hurtBoxGroup = b.hurtBoxGroup;
			if (Object.op_Implicit((Object)(object)hurtBoxGroup) && hurtBoxGroup.hurtBoxes != null)
			{
				HurtBox[] hurtBoxes = hurtBoxGroup.hurtBoxes;
				foreach (HurtBox val in hurtBoxes)
				{
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.collider) && val.collider.enabled && ((Component)val).gameObject.activeInHierarchy && cols.Count < 28)
					{
						cols.Add(val.collider);
					}
				}
			}
			if (cols.Count == 0 && Object.op_Implicit((Object)(object)b.mainHurtBox) && Object.op_Implicit((Object)(object)b.mainHurtBox.collider) && b.mainHurtBox.collider.enabled)
			{
				cols.Add(b.mainHurtBox.collider);
			}
			Bounds bounds = default(Bounds);
			if (cols.Count > 0)
			{
				bounds = cols[0].bounds;
				for (int j = 1; j < cols.Count; j++)
				{
					((Bounds)(ref bounds)).Encapsulate(cols[j].bounds);
				}
			}
			else
			{
				if (!first)
				{
					return;
				}
				((Bounds)(ref bounds))..ctor(b.corePosition, Vector3.one * Mathf.Max(1f, b.radius * 2f));
			}
			int num2 = LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask);
			bool flag2 = false;
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).center.z);
			float num3 = Mathf.Max(0.6f, b.radius);
			RaycastHit val3 = default(RaycastHit);
			if (ShadowEnvironment.NodeOf(b, out var node))
			{
				flag2 = node.airborne;
				val2 = node.foot;
				num3 = Mathf.Min(node.footRadius, 4.5f);
			}
			else if (Physics.Raycast(((Bounds)(ref bounds)).center, Vector3.down, ref val3, 80f, num2, (QueryTriggerInteraction)1))
			{
				val2 = ((RaycastHit)(ref val3)).point;
				flag2 = ((RaycastHit)(ref val3)).distance > ((Bounds)(ref bounds)).extents.y + 1.5f;
			}
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(val2 + Vector3.up * 0.5f, Vector3.down, ref val4, 1.6f, num2, (QueryTriggerInteraction)1))
			{
				val2 = ((RaycastHit)(ref val4)).point;
				w.gn = ((((RaycastHit)(ref val4)).normal.y > 0.5f) ? ((RaycastHit)(ref val4)).normal : Vector3.up);
			}
			float num4 = ((Bounds)(ref bounds)).max.y - w.lift;
			float num5 = (flag2 ? (((Bounds)(ref bounds)).min.y - w.lift) : Mathf.Min(val2.y, num4 - 0.6f));
			float num6 = Mathf.Max(0.6f, num4 - num5);
			float x = ((Bounds)(ref bounds)).center.x;
			float z = ((Bounds)(ref bounds)).center.z;
			float num7 = Mathf.Max(((Bounds)(ref bounds)).extents.x, ((Bounds)(ref bounds)).extents.z) * ((num > 0) ? 2.3f : 1.45f) + ((num > 0) ? 0.9f : 0.4f);
			float num8 = 0f;
			int num9 = 0;
			Vector3 val5 = default(Vector3);
			Ray val6 = default(Ray);
			RaycastHit val7 = default(RaycastHit);
			RaycastHit val8 = default(RaycastHit);
			for (int k = 0; k < 9; k++)
			{
				float num10 = num5 + w.lift + num6 * Mathf.Lerp(0.03f, 0.97f, (float)k / 8f);
				for (int l = 0; l < 12; l++)
				{
					float num11 = (float)l * (MathF.PI * 2f) / 12f;
					((Vector3)(ref val5))..ctor(Mathf.Cos(num11), 0f, Mathf.Sin(num11));
					((Ray)(ref val6))..ctor(new Vector3(x, num10, z) + val5 * num7, -val5);
					float num12 = float.MaxValue;
					for (int m = 0; m < num; m++)
					{
						if (((Collider)probe[m]).Raycast(val6, ref val7, num7) && ((RaycastHit)(ref val7)).distance < num12)
						{
							num12 = ((RaycastHit)(ref val7)).distance;
						}
					}
					if (num12 == float.MaxValue)
					{
						for (int n = 0; n < cols.Count; n++)
						{
							if (cols[n].Raycast(val6, ref val8, num7) && ((RaycastHit)(ref val8)).distance < num12)
							{
								num12 = ((RaycastHit)(ref val8)).distance;
							}
						}
					}
					float num13 = ((num12 < float.MaxValue) ? (num7 - num12) : 0f);
					tmp[k * 12 + l] = num13;
					if (num13 > 0f)
					{
						num8 += num13;
						num9++;
					}
				}
			}
			for (int num14 = 0; num14 < num; num14++)
			{
				((Collider)probe[num14]).enabled = false;
			}
			for (int num15 = 0; num15 < 9; num15++)
			{
				int num16 = 0;
				for (int num17 = 0; num17 < 12; num17++)
				{
					if (tmp[num15 * 12 + num17] > 0f)
					{
						rowTmp[num16++] = tmp[num15 * 12 + num17];
					}
				}
				if (num16 < 3)
				{
					continue;
				}
				Array.Sort(rowTmp, 0, num16);
				float num18 = rowTmp[num16 / 2] * 1.5f;
				for (int num19 = 0; num19 < 12; num19++)
				{
					if (tmp[num15 * 12 + num19] > num18)
					{
						tmp[num15 * 12 + num19] = num18;
					}
				}
			}
			float num20 = ((num9 > 0) ? (num8 / (float)num9) : Mathf.Max(0.4f, b.radius * 0.7f));
			float num21 = num20 * 0.38f;
			for (int num22 = 0; num22 < 12; num22++)
			{
				for (int num23 = 0; num23 < 9; num23++)
				{
					if (tmp[num23 * 12 + num22] > 0f)
					{
						continue;
					}
					float num24 = 0f;
					for (int num25 = 1; num25 < 9; num25++)
					{
						if (!(num24 <= 0f))
						{
							break;
						}
						if (num23 - num25 >= 0 && tmp[(num23 - num25) * 12 + num22] > 0f)
						{
							num24 = tmp[(num23 - num25) * 12 + num22] * 0.88f;
						}
						else if (num23 + num25 < 9 && tmp[(num23 + num25) * 12 + num22] > 0f)
						{
							num24 = tmp[(num23 + num25) * 12 + num22] * 0.88f;
						}
					}
					tmp[num23 * 12 + num22] = 0f - ((num24 > 0f) ? num24 : (num20 * 0.7f));
				}
			}
			for (int num26 = 0; num26 < tmp.Length; num26++)
			{
				tmp[num26] = Mathf.Max(num21, Mathf.Abs(tmp[num26]));
			}
			float num27 = ((first || (num > 0 && !w.meshed)) ? 1f : 0.5f);
			if (num > 0)
			{
				w.meshed = true;
			}
			for (int num28 = 0; num28 < 9; num28++)
			{
				float num29 = 0f;
				for (int num30 = 0; num30 < 12; num30++)
				{
					float num31 = 0.25f * tmp[num28 * 12 + (num30 + 12 - 1) % 12] + 0.5f * tmp[num28 * 12 + num30] + 0.25f * tmp[num28 * 12 + (num30 + 1) % 12];
					int num32 = num28 * 12 + num30;
					w.rad[num32] += (num31 - w.rad[num32]) * num27;
					num29 += w.rad[num32];
				}
				w.rowMean[num28] = num29 / 12f;
			}
			Vector3 val9 = new Vector3(x, num5, z) - b.transform.position;
			w.baseOff = (first ? val9 : Vector3.Lerp(w.baseOff, val9, 0.5f));
			w.height = (first ? num6 : Mathf.Lerp(w.height, num6, 0.5f));
			w.air = flag2;
			w.ground = val2;
			w.groundR = num3;
			w.basePos = b.transform.position + w.baseOff;
			w.drop = Mathf.Max(0f, w.basePos.y - val2.y);
			w.reach = (flag2 ? Mathf.Max(0.6f, w.drop) : Mathf.Clamp(num3 * 0.55f, 0.45f, 2.5f));
			w.sampled = true;
			for (int num33 = 0; num33 < 9; num33++)
			{
				rowTmp[num33] = w.rowMean[num33];
			}
			Array.Sort(rowTmp, 2, 6);
			w.rBody = rowTmp[5];
			Combat.Trace?.Invoke("CHOKE_SURFACE " + ((Object)b).name + " mesh=" + num + " cols=" + cols.Count + " h=" + w.height.ToString("0.00") + " rBody=" + w.rBody.ToString("0.00") + " air=" + flag2 + " first=" + first);
		}

		private static int Probe(Victim w)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//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_00b9: Expected O, but got Unknown
			//IL_012f: 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)
			int num = 0;
			try
			{
				if (!Object.op_Implicit((Object)(object)probeRoot))
				{
					probeRoot = new GameObject("ShikamaruChokeProbe");
					Object.DontDestroyOnLoad((Object)(object)probeRoot);
					for (int i = 0; i < 3; i++)
					{
						GameObject val = new GameObject("Probe" + i);
						val.transform.SetParent(probeRoot.transform, false);
						val.layer = LayerIndex.noCollision.intVal;
						probe[i] = val.AddComponent<MeshCollider>();
						probe[i].cookingOptions = (MeshColliderCookingOptions)16;
						((Collider)probe[i]).enabled = false;
						probeMesh[i] = new Mesh
						{
							name = "ShikamaruChokeBake" + i
						};
					}
				}
				SkinnedMeshRenderer[] skins = w.skins;
				foreach (SkinnedMeshRenderer val2 in skins)
				{
					if (Object.op_Implicit((Object)(object)val2) && ((Renderer)val2).enabled && ((Component)val2).gameObject.activeInHierarchy && Object.op_Implicit((Object)(object)val2.sharedMesh))
					{
						val2.BakeMesh(probeMesh[num], true);
						((Component)probe[num]).transform.SetPositionAndRotation(((Component)val2).transform.position, ((Component)val2).transform.rotation);
						probe[num].sharedMesh = null;
						probe[num].sharedMesh = probeMesh[num];
						((Collider)probe[num]).enabled = true;
						if (++num >= 3)
						{
							break;
						}
					}
				}
				if (num > 0)
				{
					Physics.SyncTransforms();
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("SHIKAMARU_CHOKE mesh probe off for " + (Object.op_Implicit((Object)(object)w.b) ? ((Object)w.b).name : "?") + ": " + ex.Message));
				for (int k = 0; k < 3; k++)
				{
					if (Object.op_Implicit((Object)(object)probe[k]))
					{
						((Collider)probe[k]).enabled = false;
					}
				}
				num = 0;
			}
			return num;
		}

		private static Vector3 MapOn(Victim w, float az, float v)
		{
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: 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_013e: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Cos(az);
			float num2 = Mathf.Sin(az);
			if (v >= 0f)
			{
				float num3 = w.Radius(v, az) * w.hug + Skin;
				float num4 = (w.air ? w.lift : (w.lift * Mathf.Clamp01(v / (0.35f * w.height))));
				if (v > w.height && w.air)
				{
					float num5 = v - w.height;
					num3 *= 1f - 0.5f * Mathf.Clamp01(num5 / Mathf.Max(0.2f, num3));
					return new Vector3(w.basePos.x + num * num3, w.basePos.y + v + num4, w.basePos.z + num2 * num3);
				}
				if (v > w.height)
				{
					float num6 = v - w.height;
					num3 *= Mathf.Clamp01(1f - num6 / Mathf.Max(0.2f, num3));
					return new Vector3(w.basePos.x + num * num3, w.basePos.y + w.height + num4 + Skin + Mathf.Min(num6, 0.08f), w.basePos.z + num2 * num3);
				}
				return new Vector3(w.basePos.x + num * num3, w.basePos.y + v + num4 + (w.air ? 0f : (GroundLift * Mathf.Clamp01(1f - v * 4f))), w.basePos.z + num2 * num3);
			}
			if (!w.air)
			{
				float num7 = w.Radius(0f, az) * w.hug + Skin - v;
				float num8 = w.basePos.x + num * num7;
				float num9 = w.basePos.z + num2 * num7;
				float num10 = w.ground.y - (w.gn.x * (num8 - w.ground.x) + w.gn.z * (num9 - w.ground.z)) / Mathf.Max(0.3f, w.gn.y);
				return new Vector3(num8, num10 + GroundLift, num9);
			}
			float num11 = Mathf.Clamp01((0f - v) / Mathf.Max(0.3f, w.drop));
			float num12 = Mathf.Lerp(w.Radius(0f, az) * AirHug + Skin, 0.14f, Mathf.Min(1f, num11 * 3f));
			Vector3 val = Vector3.Lerp(new Vector3(w.basePos.x, w.basePos.y + w.lift, w.basePos.z), w.ground + Vector3.up * GroundLift, num11);
			return new Vector3(val.x + num * num12, val.y, val.z + num2 * num12);
		}

		private Vector3 DomeP(float xl, float s)
		{
			//IL_00ca: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			float num;
			float num2;
			if (s <= 0f)
			{
				num = Mathf.Max(0f, dD + s);
				num2 = 0f;
			}
			else if (s <= dH1)
			{
				num = dD;
				num2 = s;
			}
			else
			{
				float num3 = 3.14159f * dD;
				float num4 = s - dH1;
				if (num4 <= num3)
				{
					float num5 = num4 / dD;
					num = dD * Mathf.Cos(num5);
					num2 = dH1 + (dD + fStag) * Mathf.Sin(num5);
				}
				else
				{
					num = 0f - dD;
					num2 = dH1 - (num4 - num3);
				}
			}
			float num6 = dCup * xl * xl * Mathf.Clamp(num / dD, -0.4f, 1f);
			Vector3 result = dBase + dB * (num - num6) + dR * xl;
			result.y = ((s <= 0f) ? (dGround + GroundLift) : (dBase.y + num2 + fw.lift * Mathf.Clamp01(num2 / (0.35f * fw.height))));
			return result;
		}

		private void DrawDomeHand(Victim w, Hand h, float sh, float t, float clench, bool still)
		{
			//IL_008e: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: 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_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp01(sh / 0.05f);
			float num2 = Stair(Mathf.Clamp01(sh / ClimbEnd), Lurches);
			float num3 = Smooth(Mathf.InverseLerp(ClimbEnd - 0.05f, GripEnd, sh));
			float x = Mathf.InverseLerp(GripEnd, 1f, sh);
			float num4 = Stair(x, 3) + clench;
			float num5 = StairPulse(x, 3);
			float num6 = Mathf.Min(num4, 1.3f);
			Camera val = Fx.Cam();
			float num7 = (Object.op_Implicit((Object)(object)val) ? Vector3.Distance(((Component)val).transform.position, w.basePos + Vector3.up * (w.height * 0.5f)) : 20f);
			float num8 = Mathf.InverseLerp(3.5f, 11f, num7);
			float num9 = (Object.op_Implicit((Object)(object)owner) ? Mathf.Lerp(1f, 0.62f, Mathf.InverseLerp(4f, 10f, (float)owner.Count)) : 1f);
			if (num7 < DomeNearCut)
			{
				return;
			}
			float num10 = Mathf.Clamp(Mathf.Max(DomeSize * w.rBody, DomeOfHeight * w.height), MinHand, MaxHand) * Mathf.Lerp(0.45f, 1f, num8) * num9 * (0.3f + 0.7f * num) * (1f - 0.05f * num5 + 0.08f * clench);
			float num11 = Mathf.Max(0.3f, w.rBody * DomeStand);
			float num12 = Mathf.Max(0.25f * w.height, w.height - num11 * 0.7f);
			float num13 = 3.14159f * num11;
			float num14 = Mathf.Cos(w.camAz);
			float num15 = Mathf.Sin(w.camAz);
			dB = new Vector3(0f - num14, 0f, 0f - num15);
			dR = new Vector3(0f - num15, 0f, num14);
			dBase = w.basePos;
			dD = num11;
			dH1 = num12;
			dCup = DomeCup / Mathf.Max(0.3f, num10) * (0.4f + 0.6f * num3);
			dGround = w.ground.y;
			float num16 = 0f - Mathf.Min(0.9f * num10, num11 * 0.9f);
			float num17 = num12 - num10 * 0.98f;
			float num18 = Mathf.Lerp(num16, num17, num2) + 0.05f * num10 * num6;
			float num19 = Mathf.Lerp(Mathf.Lerp(0.9f, num13 * 0.55f / num10, num2), (num13 + Mathf.Max(0.1f, num12 - w.height * (DomeTip - DomeClose * num6))) / num10, num3);
			float num20 = Rim * (0.8f + 0.25f * w.dark);
			float num21 = Mathf.Min(1f, (RimAlpha + 0.16f * w.dark) * (1f + 0.2f * num5 + 0.3f * clench));
			fw = w;
			fDome = true;
			fV = num18;
			fSize = num10;
			fMir = h.mirror;
			fRim = num20;
			fRimA = num21;
			fSin = 0f;
			fCos = 1f;
			float num22 = 0f - num11;
			if (num18 - num22 > 0.15f)
			{
				int num23 = Mathf.Clamp(Mathf.CeilToInt((num18 - num22) / 0.3f), 4, 18);
				int num24 = -1;
				for (int i = 0; i <= num23; i++)
				{
					float num25 = (float)i / (float)num23;
					float num26 = num10 * Forearm(num25) * 0.9f;
					int num27 = im.Section(DomeP(still ? 0f : (0.04f * num10 * (1f - num25) * Mathf.Sin(num25 * 5f - t * 3f + h.seed)), Mathf.Lerp(num22, num18, num25)), dR, num26, num26, num20, num21);
					if (num24 >= 0)
					{
						im.Link(num24, num27);
					}
					num24 = num27;
				}
				secLast = num24;
				Sec(0f, 0.02f, 0f, 0.25f);
				Sec(0f, 0.24f, 0f, 0.36f);
			}
			float num28 = 1f - 0.12f * num6;
			float num29 = num20 / num10;
			int a = im.Black(P(0f, 0.52f));
			int count = im.v.Count;
			int num30 = PalmX.Length;
			for (int j = 0; j < num30; j++)
			{
				float num31 = PalmX[j] * num28;
				float num32 = PalmY[j];
				float num33 = num31 - 0f;
				float num34 = num32 - 0.52f;
				float num35 = Mathf.Sqrt(num33 * num33 + num34 * num34);
				float num36 = num33 / num35;
				float num37 = num34 / num35;
				float num38 = Mathf.Max(0f, num35 - num29 * 0.8f);
				im.Black(P(0f + num33 * 0.55f, 0.52f + num34 * 0.55f));
				im.Black(P(0f + num36 * num38, 0.52f + num37 * num38));
				im.Indigo(P(num31, num32), num21);
				im.Indigo(P(num31 + num36 * num29, num32 + num37 * num29), 0f);
			}
			for (int k = 0; k < num30; k++)
			{
				int num39 = count + k * 4;
				int num40 = count + (k + 1) % num30 * 4;
				im.Tri(isCore: true, a, num39, num40);
				im.Tri(isCore: true, num39, num39 + 1, num40);
				im.Tri(isCore: true, num40, num39 + 1, num40 + 1);
				im.Tri(isCore: false, num39 + 1, num39 + 2, num40 + 1);
				im.Tri(isCore: false, num40 + 1, num39 + 2, num40 + 2);
				im.Tri(isCore: false, num39 + 2, num39 + 3, num40 + 2);
				im.Tri(isCore: false, num40 + 2, num39 + 3, num40 + 3);
			}
			float num41 = 1f - num3;
			float num42 = (still ? 0f : (1.2f * Mathf.Min(1f, num4) * Mathf.Sin(t * 31f + h.seed)));
			float num43 = num41 * Mathf.Sin((num2 * 6f + 0.6f) * (MathF.PI * 2f));
			for (int l = 0; l < 4; l++)
			{
				float num44 = num41 * Mathf.Sin((num2 * 6f + (float)l * 0.27f) * (MathF.PI * 2f));
				fStag = KnuckleStag * num11 * StagF[l];
				Finger(FingerX[l] * num28, 0.98f, Mathf.Lerp(OpenA[l], DomeA[l], num3) + 3f * num44, FingerL[l] * num19, DomeFingerW * (1f + 0.1f * num4), Mathf.Lerp(OpenB[l], GripB[l] * 0.6f * (1f + DomeHook * num4), num3) + 8f * num44 + num42);
			}
			fStag = 0f;
			Finger(-0.5f * num28, 0.42f, Mathf.Lerp(-50f, -36f, num3) - 4f * num43, Mathf.Lerp(0.3f, 0.85f, num3) * num, DomeFingerW * 1.35f * (1f + 0.1f * num4), Mathf.Lerp(4f, 14f * (1f + 0.4f * num4), num3) - 6f * num43 - num42);
			fDome = false;
		}

		private Vector3 P(float x, float y)
		{
			//IL_0099: 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)
			if (fDome)
			{
				return DomeP(x * fMir * fSize, fV + y * fSize);
			}
			x *= fMir;
			float num = fSize * (x * fCos + y * fSin);
			float num2 = fSize * ((0f - x) * fSin + y * fCos);
			float v = fV + num2;
			return MapOn(fw, fAz + num / Mathf.Max(0.1f, fw.Rref(v)), v);
		}

		private void Sec(float x, float y, float a, float hw)
		{
			//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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Cos(a) * hw;
			float num2 = (0f - Mathf.Sin(a)) * hw;
			Vector3 val = P(x - num, y - num2);
			Vector3 val2 = P(x + num, y + num2);
			Vector3 val3 = val2 - val;
			float magnitude = ((Vector3)(ref val3)).magnitude;
			if (!(magnitude < 1E-05f))
			{
				int b = im.Section((val + val2) * 0.5f, val3 / magnitude, magnitude * 0.5f, magnitude * 0.5f, fRim, fRimA);
				if (secLast >= 0)
				{
					im.Link(secLast, b);
				}
				secLast = b;
			}
		}

		private void Knuckle(Vector3 p, float r)
		{
			//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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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)
			//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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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_011f: 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)
			Camera val = Fx.Cam();
			if (Object.op_Implicit((Object)(object)val))
			{
				Vector3 right = ((Component)val).transform.right;
				Vector3 up = ((Component)val).transform.up;
				p -= up * r * 0.35f;
				int a = im.Black(p);
				int count = im.v.Count;
				for (int i = 0; i < 14; i++)
				{
					float num = (float)i * (MathF.PI * 2f) / 14f;
					Vector3 val2 = right * Mathf.Cos(num) * 0.92f + up * Mathf.Sin(num) * 1.08f;
					im.Black(p + val2 * Mathf.Max(0f, r - fRim * 0.8f));
					im.Indigo(p + val2 * r, fRimA * 0.8f);
					im.Indigo(p + val2 * (r + fRim), 0f);
				}
				for (int j = 0; j < 14; j++)
				{
					int num2 = count + j * 3;
					int num3 = count + (j + 1) % 14 * 3;
					im.Tri(isCore: true, a, num2, num3);
					im.Tri(isCore: false, num2, num2 + 1, num3);
					im.Tri(isCore: false, num3, num2 + 1, num3 + 1);
					im.Tri(isCore: false, num2 + 1, num2 + 2, num3 + 1);
					im.Tri(isCore: false, num3 + 1, num2 + 2, num3 + 2);
				}
			}
		}

		private void Finger(float bx, float by, float a0, float len, float hw, float bend)
		{
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			float num = a0 * (MathF.PI / 180f);
			float num2 = bend * (MathF.PI / 180f);
			float num3 = bx - Mathf.Sin(num) * 0.1f;
			float num4 = by - Mathf.Cos(num) * 0.1f;
			secLast = -1;
			Sec(num3, num4, num, hw);
			int num5 = (fDome ? 5 : 2);
			float apex = (fDome ? (dH1 + 1.5708f * dD) : 0f);
			float lastS = fV + num4 * fSize;
			float lastX = num3;
			float capX = float.NaN;
			for (int i = 0; i < 3; i++)
			{
				float num6 = Seg[i] * len;
				float num7 = Mathf.Sin(num);
				float num8 = Mathf.Cos(num);
				for (int j = 1; j < num5; j++)
				{
					float num9 = (float)j / (float)num5;
					Sec(num3 + num7 * num6 * num9, num4 + num8 * num6 * num9, num, hw * Mid[i] * (fDome ? DomeMid : 1f));
					if (fDome)
					{
						Apex(num3 + num7 * num6 * num9, num4 + num8 * num6 * num9);
					}
				}
				num3 += num7 * num6;
				num4 += num8 * num6;
				if (fDome)
				{
					Apex(num3, num4);
				}
				if (i < 2)
				{
					float num10 = num2 * ((i == 0) ? 0.45f : 1.55f);
					Sec(num3, num4, num + num10 * 0.5f, hw * Joint[i] * (fDome ? DomeJoint : 1f));
					num += num10;
				}
			}
			if (!float.IsNaN(capX) && KnuckleCap > 0f)
			{
				Knuckle(DomeP(capX * fMir * fSize, apex), hw * fSize * KnuckleCap);
			}
			Sec(num3, num4, num, hw * 0.62f);
			Sec(num3 + Mathf.Sin(num) * 0.08f, num4 + Mathf.Cos(num) * 0.08f, num, hw * 0.2f);
			void Apex(float x, float y)
			{
				float num11 = fV + y * fSize;
				if (float.IsNaN(capX) && lastS < apex && num11 >= apex)
				{
					capX = Mathf.Lerp(lastX, x, (apex - lastS) / Mathf.Max(0.0001f, num11 - lastS));
				}
				lastS = num11;
				lastX = x;
			}
		}

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

		private static float Stair(float x, int n)
		{
			if (x <= 0f)
			{
				return 0f;
			}
			if (x >= 1f)
			{
				return 1f;
			}
			float num = x * (float)n;
			int num2 = (int)num;
			float num3 = num - (float)num2;
			float num4 = 1f - Mathf.Pow(1f - Mathf.Clamp01(num3 / 0.55f), 3f);
			return ((float)num2 + 0.88f * num4 + 0.12f * num3) / (float)n;
		}

		private static float StairPulse(float x, int n)
		{
			if (x <= 0f || x >= 1f)
			{
				return 0f;
			}
			float num = x * (float)n;
			num -= (float)(int)num;
			if (!(num < 0.22f))
			{
				return 0f;
			}
			return Mathf.Sin(num / 0.22f * MathF.PI);
		}

		private void DrawHand(Victim w, Hand h, float S, float t, float clench, bool still)
		{
			//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_09db: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_073b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0740: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0770: Unknown result type (might be due to invalid IL or missing references)
			//IL_0756: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0775: Unknown result type (might be due to invalid IL or missing references)
			//IL_0848: Unknown result type (might be due to invalid IL or missing references)
			//IL_084d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0851: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0640: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp01((S - h.delay) / (1f - h.delay));
			if (num <= 0f)
			{
				return;
			}
			if (Hands3)
			{
				if (h.grab)
				{
					DrawGrab3(w, h, num, t, clench, still);
				}
				else
				{
					DrawHand3(w, h, num, t, clench, still);
				}
				return;
			}
			if (h.grab && GrabDome)
			{
				DrawDomeHand(w, h, num, t, clench, still);
				return;
			}
			float num2 = Mathf.Clamp01(num / 0.05f);
			float num3 = Stair(Mathf.Clamp01(num / ClimbEnd), Lurches);
			float num4 = Smooth(Mathf.InverseLerp(ClimbEnd - 0.05f, GripEnd, num));
			float x = Mathf.InverseLerp(GripEnd, 1f, num);
			float num5 = Stair(x, 3) + clench;
			float num6 = StairPulse(x, 3);
			float num7 = Mathf.Min(num5, 1.3f);
			bool grab = h.grab;
			float num8 = (grab ? Mathf.Min(Mathf.Clamp(GrabSize * w.rBody, MinHand, MaxHand), w.height * GrabOfHeight) : Mathf.Min(Mathf.Clamp(HandSize * w.rBody, MinHand, MaxHand), w.height * (w.air ? 0.6f : MaxOfHeight)));
			float num9 = num8 * h.size * (0.3f + 0.7f * num2) * (1f - 0.06f * num6 + 0.1f * clench);
			float num10 = w.height * h.vFrac;
			float num11 = 0f - w.reach;
			float num12 = (grab ? num10 : (Mathf.Max(w.height * 0.05f, num10 - num9) + Creep * num9 * num7));
			float num13 = Mathf.Max(0.15f, w.Rref(num12));
			float num14 = 0.52f * num8 * h.size / num13;
			float num15 = Mathf.Max(0f, num3 - 0.03f);
			float num16;
			float num17;
			float num18;
			float num19;
			float num20;
			float num21;
			if (grab)
			{
				num16 = w.camAz + 3.14159f + h.mirror * num14;
				num17 = h.mirror * (3.44159f - num14);
				num18 = Mathf.Lerp(num11, num12, 1f - (1f - num3) * (1f - num3));
				num19 = num16 + num17 * (1f - num3);
				num20 = Mathf.Lerp(num11, num12, 1f - (1f - num15) * (1f - num15));
				num21 = num16 + num17 * (1f - num15);
			}
			else
			{
				num16 = w.camAz + h.azOff;
				nu