plugins/Pain/Pain.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 System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using ExtraSkillSlots;
using KinematicCharacterController;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using Rewired;
using RoR2;
using RoR2.CameraModes;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
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("Pain")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+aa5c0ac0f5db5c9c7af1bdfe62dd4f5b8b20ea56")]
[assembly: AssemblyProduct("Pain")]
[assembly: AssemblyTitle("Pain")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace PainMod;

public static class AirPush
{
	public static float Range = 24f;

	public static float Radius = 1.4f;

	public static float Travel = 0.22f;

	public static float MinLen = 4f;

	public static Vector3 End(CharacterBody b, Ray aim, Vector3 palm)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: 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_002a: 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_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: 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_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		float num = Vector3.Distance(((Ray)(ref aim)).origin, palm);
		RaycastHit best;
		Vector3 val = (Combat.AimHit(aim, b, Range + num, out best) ? ((RaycastHit)(ref best)).point : ((Ray)(ref aim)).GetPoint(Range + num));
		Vector3 val2 = val - palm;
		if (((Vector3)(ref val2)).sqrMagnitude < MinLen * MinLen)
		{
			val = palm + ((Ray)(ref aim)).direction * MinLen;
		}
		else if (((Vector3)(ref val2)).magnitude > Range)
		{
			val = palm + ((Vector3)(ref val2)).normalized * Range;
		}
		return val;
	}

	public static float Front(float a, float len)
	{
		float num = Mathf.Clamp01(a / Mathf.Max(0.05f, Travel));
		return Mathf.Lerp(0.4f, len, 1f - (1f - num) * (1f - num));
	}

	public static void Server(CharacterBody b, Vector3 palm, Vector3 end, bool crit, HashSet<HealthComponent> already, float coef)
	{
		//IL_0015: 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_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)b))
		{
			return;
		}
		AirPushRay airPushRay = new GameObject("PainAirPushRay").AddComponent<AirPushRay>();
		airPushRay.owner = b;
		airPushRay.a = palm;
		airPushRay.b = end;
		airPushRay.crit = crit;
		airPushRay.coef = coef;
		if (already == null)
		{
			return;
		}
		foreach (HealthComponent item in already)
		{
			airPushRay.hit.Add(item);
		}
	}
}
public sealed class AirPushRay : MonoBehaviour
{
	public CharacterBody owner;

	public Vector3 a;

	public Vector3 b;

	public bool crit;

	public float coef;

	public readonly HashSet<HealthComponent> hit = new HashSet<HealthComponent>();

	private float t0 = -1f;

	private float last;

	private readonly List<HurtBox> found = new List<HurtBox>();

	private int landed;

	private void FixedUpdate()
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00b3: 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_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)owner) || !NetworkServer.active)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		if (t0 < 0f)
		{
			t0 = Time.fixedTime;
			last = 0f;
		}
		Vector3 val = b - a;
		float magnitude = ((Vector3)(ref val)).magnitude;
		if (magnitude < 0.01f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			return;
		}
		Vector3 val2 = val / magnitude;
		float num = Time.fixedTime - t0 + Time.fixedDeltaTime;
		float num2 = AirPush.Front(num, magnitude);
		found.Clear();
		Combat.Capsule(owner, a + val2 * last, a + val2 * Mathf.Max(num2, last + 0.05f), AirPush.Radius, found, hit);
		last = num2;
		foreach (HurtBox item in found)
		{
			if (!Object.op_Implicit((Object)(object)item) || !Object.op_Implicit((Object)(object)item.healthComponent) || !hit.Add(item.healthComponent))
			{
				continue;
			}
			Combat.Source = "M1.airpush.ranged";
			CharacterBody body = item.healthComponent.body;
			Vector3 val3 = Combat.Point(item, a + val2 * num2);
			if (Combat.Deal(owner, item, val3, coef, Tuning.M1Proc.Value, crit, Vector3.zero, (DamageType)0, null, (DamageColorIndex)0, (DamageSource)1))
			{
				landed++;
				Fx.Emit(Fx.Hit, Object.op_Implicit((Object)(object)body) ? body.corePosition : val3, 1.4f, val3 - val2);
				if (Object.op_Implicit((Object)(object)body) && item.healthComponent.alive)
				{
					CharacterBody obj = owner;
					Vector3 val4 = val2 + Vector3.up * 0.25f;
					PainGravity.Repel(obj, body, ((Vector3)(ref val4)).normalized * Tuning.M1Launch.Value * Taijutsu.FinisherKnock, 0.8f, 0.8f, (DamageSource)1, "M1.push");
				}
				Combat.Trace?.Invoke("AIRPUSH hit victim=" + (Object.op_Implicit((Object)(object)body) ? ((Object)body).name : "?") + " dist=" + Vector3.Distance(a, val3).ToString("0.0") + " lineLen=" + magnitude.ToString("0.0"));
			}
		}
		if (num >= AirPush.Travel + 0.02f || num2 >= magnitude - 0.01f)
		{
			if (Tuning.Verbose.Value || Combat.Trace != null)
			{
				Plugin.Log.LogInfo((object)("PAIN_AIRPUSH line=" + magnitude.ToString("0.0") + " m landed=" + landed));
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public sealed class PushImpactFx : FxBase
{
	public static GameObject Prefab;

	public static float Size = 1f;

	public static float LensMax = 1.15f;

	public static float RingMax = 3.4f;

	public static float RingThin = 0.16f;

	public static float HazeA = 0.1f;

	public static float T = 0.22f;

	public static bool Streaks8 = false;

	public static bool Ring8 = false;

	private static ParticleSystem streaks;

	private static Material streakMat;

	private static Material hazeMat;

	private GameObject lens;

	private GameObject ring;

	private GameObject haze;

	private Material hazeInst;

	private Vector3 dir;

	public static void Prepare()
	{
		Prefab = Fx.MakeEffect("PainPushImpact", delegate(GameObject g)
		{
			g.AddComponent<PushImpactFx>();
		});
	}

	protected override void Begin()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: 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_011e: Expected O, but got Unknown
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: 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_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_030a: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Unknown result type (might be due to invalid IL or missing references)
		//IL_0325: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_033f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_034a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03db: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0405: Unknown result type (might be due to invalid IL or missing references)
		life = T + 0.35f;
		Vector3 val = data.start - data.origin;
		dir = ((((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val)).normalized : Vector3.forward);
		((Component)this).transform.position = data.origin;
		((Component)this).transform.rotation = Quaternion.LookRotation(dir, Vector3.up);
		Material distort = PainFx.Distort;
		lens = PainFx.MeshObj(((Component)this).transform, PainFx.Sphere, Object.op_Implicit((Object)(object)distort) ? distort : PainFx.EdgeMat, "lens");
		ring = PainFx.MeshObj(((Component)this).transform, PainFx.Sphere, Object.op_Implicit((Object)(object)distort) ? distort : PainFx.EdgeMat, "ring");
		if (!Object.op_Implicit((Object)(object)hazeMat))
		{
			hazeMat = Fx.Additive((Texture)(object)Fx.Soft);
		}
		haze = Fx.Quad(((Component)this).transform, null, "haze");
		hazeInst = new Material(hazeMat);
		haze.GetComponent<Renderer>().sharedMaterial = hazeInst;
		if (!Object.op_Implicit((Object)(object)streaks))
		{
			streakMat = Fx.Additive((Texture)(object)Fx.Soft);
			streakMat.SetColor("_TintColor", new Color(0.85f, 0.87f, 0.95f, 0.3f));
			streaks = Fx.Pool("PainPushImpactStreaks", streakMat, 300, 0f, 2.2f, AnimationCurve.Linear(0f, 1f, 1f, 0.3f), Fx.Grad(0f, (object)new Color(1f, 1f, 1f, 0f), 0.1f, (object)new Color(1f, 1f, 1f, 0.75f), 1f, (object)new Color(1f, 1f, 1f, 0f)));
			ParticleSystemRenderer component = ((Component)streaks).GetComponent<ParticleSystemRenderer>();
			component.renderMode = (ParticleSystemRenderMode)1;
			component.velocityScale = 0.08f;
			component.lengthScale = 2.6f;
		}
		float num = Mathf.Max(0.4f, data.scale);
		Quaternion val2 = Quaternion.LookRotation(dir, Vector3.up);
		if (Streaks8)
		{
			for (int i = 0; i < 10; i++)
			{
				float num2 = ((float)i + Random.value * 0.5f) / 10f * MathF.PI * 2f;
				Vector3 val3 = val2 * new Vector3(Mathf.Cos(num2), Mathf.Sin(num2), 0f);
				Fx.One(streaks, data.origin + val3 * 0.35f * num, (val3 * Random.Range(8f, 13f) + dir * Random.Range(6f, 11f)) * num, 0.12f * num * Random.Range(0.8f, 1.2f), Random.Range(0.12f, 0.2f));
			}
		}
		if (Streaks8)
		{
			for (int j = 0; j < 8; j++)
			{
				Vector2 val4 = Random.insideUnitCircle * 0.5f * num;
				Fx.One(streaks, data.origin + val2 * new Vector3(val4.x, val4.y, 0f), dir * Random.Range(18f, 28f) * num, 0.2f * num, Random.Range(0.15f, 0.24f));
			}
		}
	}

	private void LateUpdate()
	{
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: 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_0237: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
		float num = Mathf.Max(0.4f, data.scale);
		float num2 = Mathf.Clamp01(base.Age / T);
		float num3 = 1f - (1f - num2) * (1f - num2);
		float num4 = Mathf.Clamp01((1.05f - num2) * 5f);
		if (Object.op_Implicit((Object)(object)lens))
		{
			float num5 = Mathf.Lerp(0.5f, LensMax, num3) * num * num4;
			lens.transform.position = data.origin + dir * (0.35f * num3 * num);
			lens.transform.localScale = Vector3.one * num5;
			lens.SetActive(num5 > 0.02f);
		}
		if (Object.op_Implicit((Object)(object)ring))
		{
			float num6 = Mathf.Clamp01(base.Age / (T * 1.2f));
			float num7 = 1f - (1f - num6) * (1f - num6);
			float num8 = Mathf.Clamp01((1.05f - num6) * 4f);
			float num9 = Mathf.Lerp(0.6f, RingMax, num7) * num;
			ring.transform.position = data.origin + dir * (0.6f * num7 * num);
			ring.transform.localScale = new Vector3(num9, num9, RingThin * num * num8);
			ring.SetActive(Ring8 && num8 > 0.02f);
		}
		if (Object.op_Implicit((Object)(object)haze))
		{
			Camera val = Fx.Cam();
			if (Object.op_Implicit((Object)(object)val))
			{
				haze.transform.rotation = ((Component)val).transform.rotation;
			}
			haze.transform.position = data.origin;
			haze.transform.localScale = Vector3.one * Mathf.Lerp(0.8f, 2.2f, num3) * num;
			hazeInst.SetColor("_TintColor", new Color(0.9f, 0.92f, 1f, HazeA * num4));
			haze.SetActive(num4 > 0.01f);
		}
	}
}
public sealed class AirPushFx : FxBase
{
	private static ParticleSystem streaks;

	private static Material streakMat;

	private static Material hazeMat;

	public static GameObject Prefab;

	private GameObject lens;

	private GameObject lens2;

	private GameObject haze;

	private Material hazeInst;

	private Vector3 dir;

	private float len;

	private float nextStreak;

	private float lastF;

	private bool ended;

	public static float LensSize = 2.6f;

	public static float Lens2Size = 3.6f;

	public static float HazeSize = 2f;

	public static float HazeAlpha = 0.1f;

	public static float StreakSize = 0.22f;

	public static float ArriveFlash = 2.2f;

	public static float ArriveBurst = 1.1f;

	public static float LensStart = 0.3f;

	public static void Prepare()
	{
		Prefab = Fx.MakeEffect("PainAirPush", delegate(GameObject g)
		{
			g.AddComponent<AirPushFx>();
		});
	}

	protected override void Begin()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: 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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Expected O, but got Unknown
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_029e: 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_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = data.start - data.origin;
		len = Mathf.Max(0.5f, ((Vector3)(ref val)).magnitude);
		dir = val / len;
		life = AirPush.Travel + 0.5f;
		((Component)this).transform.position = data.origin;
		((Component)this).transform.rotation = Quaternion.LookRotation(dir, Vector3.up);
		Material distort = PainFx.Distort;
		lens = PainFx.MeshObj(((Component)this).transform, PainFx.Sphere, Object.op_Implicit((Object)(object)distort) ? distort : PainFx.EdgeMat, "lens");
		lens2 = PainFx.MeshObj(((Component)this).transform, PainFx.Sphere, Object.op_Implicit((Object)(object)distort) ? distort : PainFx.EdgeMat, "lens2");
		if (!Object.op_Implicit((Object)(object)hazeMat))
		{
			hazeMat = Fx.Additive((Texture)(object)Fx.Soft);
		}
		haze = Fx.Quad(((Component)this).transform, null, "haze");
		hazeInst = new Material(hazeMat);
		haze.GetComponent<Renderer>().sharedMaterial = hazeInst;
		if (!Object.op_Implicit((Object)(object)streaks))
		{
			streakMat = Fx.Additive((Texture)(object)Fx.Soft);
			streakMat.SetColor("_TintColor", new Color(0.85f, 0.87f, 0.95f, 0.32f));
			streaks = Fx.Pool("PainAirPushStreaks", streakMat, 400, 0f, 1.5f, AnimationCurve.Linear(0f, 1f, 1f, 0.3f), Fx.Grad(0f, (object)new Color(1f, 1f, 1f, 0f), 0.1f, (object)new Color(1f, 1f, 1f, 0.75f), 1f, (object)new Color(1f, 1f, 1f, 0f)));
			ParticleSystemRenderer component = ((Component)streaks).GetComponent<ParticleSystemRenderer>();
			component.renderMode = (ParticleSystemRenderMode)1;
			component.velocityScale = 0.09f;
			component.lengthScale = 3f;
		}
		Fx.Local(PainFx.Burst, data.origin, 0.6f, data.origin + dir, 2f);
		ShakeEmitter.CreateSimpleShakeEmitter(data.origin, new Wave
		{
			amplitude = 0.5f,
			frequency = 22f
		}, 0.16f, 25f, true);
	}

	private void LateUpdate()
	{
		//IL_002a: 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_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: 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_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: 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)
		//IL_0261: 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_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03db: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_040a: Unknown result type (might be due to invalid IL or missing references)
		//IL_040d: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: 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_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_030a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0311: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0322: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0333: Unknown result type (might be due to invalid IL or missing references)
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_034a: 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_0458: 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_046c: 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_047c: Unknown result type (might be due to invalid IL or missing references)
		//IL_047d: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Unknown result type (might be due to invalid IL or missing references)
		float num = AirPush.Front(base.Age, len);
		float num2 = Mathf.Clamp01(base.Age / AirPush.Travel);
		Vector3 val = data.origin + dir * num;
		bool flag = base.Age < AirPush.Travel;
		Quaternion val2 = Quaternion.LookRotation(dir, Vector3.up);
		float num3 = (flag ? 1f : Mathf.Clamp01(1f - (base.Age - AirPush.Travel) / 0.1f));
		if (Object.op_Implicit((Object)(object)lens))
		{
			float num4 = Mathf.Lerp(LensStart, LensSize, num2) * num3;
			lens.transform.SetPositionAndRotation(val, val2);
			lens.transform.localScale = new Vector3(num4, num4, num4 * 1.6f);
			lens.SetActive(num4 > 0.02f);
		}
		if (Object.op_Implicit((Object)(object)lens2))
		{
			float num5 = AirPush.Front(Mathf.Max(0f, base.Age - 0.03f), len);
			float num6 = Mathf.Lerp(LensStart, Lens2Size, num2) * num3 * Mathf.Clamp01((num2 - 0.2f) / 0.3f);
			lens2.transform.SetPositionAndRotation(data.origin + dir * num5, val2);
			lens2.transform.localScale = new Vector3(num6, num6, num6 * 0.7f);
			lens2.SetActive(num6 > 0.02f);
		}
		if (Object.op_Implicit((Object)(object)haze))
		{
			Camera val3 = Fx.Cam();
			if (Object.op_Implicit((Object)(object)val3))
			{
				haze.transform.rotation = ((Component)val3).transform.rotation;
			}
			haze.transform.position = val + dir * 0.4f;
			haze.transform.localScale = Vector3.one * Mathf.Lerp(1f, HazeSize, num2);
			hazeInst.SetColor("_TintColor", new Color(0.9f, 0.92f, 1f, HazeAlpha * num3));
			haze.SetActive(num3 > 0.01f);
		}
		if (flag && Object.op_Implicit((Object)(object)streaks) && Time.time >= nextStreak)
		{
			nextStreak = Time.time + 0.01f;
			int num7 = 4;
			for (int i = 0; i < num7; i++)
			{
				Vector2 val4 = Random.insideUnitCircle * Mathf.Lerp(0.25f, 0.9f, num2);
				Vector3 pos = data.origin + dir * Mathf.Lerp(lastF, num, Random.value) + val2 * new Vector3(val4.x, val4.y, 0f);
				Fx.One(streaks, pos, dir * Random.Range(14f, 26f), StreakSize * Random.Range(0.7f, 1.2f), Random.Range(0.12f, 0.22f));
			}
			lastF = num;
		}
		if (flag || ended)
		{
			return;
		}
		ended = true;
		Fx.Local(PainFx.Burst, val, ArriveBurst, val + dir, 2f);
		Fx.Local(Fx.CastFlash, val, ArriveFlash, val, 0f, (Color?)new Color(0.86f, 0.9f, 1f, 0.55f));
		ShakeEmitter.CreateSimpleShakeEmitter(val, new Wave
		{
			amplitude = 0.7f,
			frequency = 26f
		}, 0.14f, 30f, true);
		if (Object.op_Implicit((Object)(object)streaks))
		{
			for (int j = 0; j < 14; j++)
			{
				Vector3 val5 = Random.onUnitSphere + dir * 0.6f;
				Vector3 normalized = ((Vector3)(ref val5)).normalized;
				Fx.One(streaks, val, normalized * Random.Range(10f, 20f), StreakSize * Random.Range(0.8f, 1.3f), Random.Range(0.12f, 0.2f));
			}
		}
	}
}
public static class Snd
{
	private sealed class Speaking
	{
		public float until;

		public int prio;

		public uint id;
	}

	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", "Pain.bnk");
		if (File.Exists(path))
		{
			SoundBanks.Add(File.ReadAllBytes(path));
		}
		else
		{
			Plugin.Log.LogWarning((object)"PAIN_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_Pain_" + key, at) : 0u);
		Combat.Trace?.Invoke("SFX Play_Pain_" + key + " playingId=" + result + " rt=" + Time.realtimeSinceStartup.ToString("0.000"));
		return result;
	}

	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)("PAIN_VOICE skip " + key + " busy prio=" + value.prio + " t=" + time.ToString("0.00")));
			}
			return false;
		}
		if (grunt && Random.value > 0.55f)
		{
			return false;
		}
		if (time < value.until && value.id != 0)
		{
			AkSoundEngine.StopPlayingID(value.id, 80);
		}
		bool flag = VoiceLoadout.Get(body) == VoiceLoadout.Lang.English;
		string text = "Play_Pain_" + (flag ? "VE_" : "V_") + key;
		uint num = AkSoundEngine.PostEvent(text, ((Component)body).gameObject, 1048576u, (EventCallback)null, (object)null);
		value.until = time + 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)("PAIN_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 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 float GateSeconds = 15f;

	public float ShowerReadyAt;

	private uint showerPending;

	private float showerPendingUntil;

	private float showerLen;

	public bool ShowerBlocked
	{
		get
		{
			if (showerPending == 0)
			{
				return Time.time < ShowerReadyAt;
			}
			return true;
		}
	}

	public static VoiceProbe For(CharacterBody b)
	{
		if (!Object.op_Implicit((Object)(object)b))
		{
			return null;
		}
		return ((Component)b).GetComponent<VoiceProbe>() ?? ((Component)b).gameObject.AddComponent<VoiceProbe>();
	}

	public static void Watch(CharacterBody b, string ev, uint id)
	{
		VoiceProbe voiceProbe = For(b);
		if (Object.op_Implicit((Object)(object)voiceProbe) && id != 0)
		{
			voiceProbe.watch.Add(new W
			{
				ev = ev,
				id = id,
				postT = Time.time
			});
		}
	}

	public void ObserveShower(uint id, float len)
	{
		if (id != 0)
		{
			showerPending = id;
			showerPendingUntil = Time.time + 1f;
			showerLen = len;
		}
	}

	private void Update()
	{
		if (showerPending != 0)
		{
			if (Snd.Playing(showerPending, out var ms))
			{
				ShowerReadyAt = Time.time - (float)ms / 1000f + showerLen + GateSeconds;
				Plugin.Log.LogInfo((object)("PAIN_VOICE shower audible id=" + showerPending + " gateUntil=" + ShowerReadyAt.ToString("0.00") + " t=" + Time.time.ToString("0.00")));
				showerPending = 0u;
			}
			else if (Time.time > showerPendingUntil)
			{
				showerPending = 0u;
			}
		}
		for (int num = watch.Count - 1; num >= 0; num--)
		{
			W w = watch[num];
			if (Snd.Playing(w.id, out var ms2))
			{
				Plugin.Log.LogInfo((object)("PAIN_VOICE audible " + w.ev + " id=" + w.id + " posMs=" + ms2 + " t=" + Time.time.ToString("0.00")));
				watch.RemoveAt(num);
			}
			else if (Time.time - w.postT > 1.5f)
			{
				Plugin.Log.LogInfo((object)("PAIN_VOICE NOT_PLAYING " + w.ev + " id=" + w.id));
				watch.RemoveAt(num);
			}
		}
	}
}
public static class PrimaryVoice
{
	private sealed class St
	{
		public float last = -999f;

		public int target = -1;
	}

	private static readonly Dictionary<int, St> state = new Dictionary<int, St>();

	public static void Swing(CharacterBody body, int stage, int finisher, string key, float length)
	{
		if (!Object.op_Implicit((Object)(object)body))
		{
			return;
		}
		int instanceID = ((Object)body).GetInstanceID();
		if (!state.TryGetValue(instanceID, out var value))
		{
			value = (state[instanceID] = new St());
		}
		if (stage == 0)
		{
			value.target = ((!(Random.value < Tuning.PrimaryVoiceChance.Value)) ? (-1) : ((!(Random.value < 0.5f)) ? finisher : 0));
			Combat.Trace?.Invoke("PRIMARYVOICE string start plan=" + value.target);
		}
		if (value.target == stage)
		{
			value.target = -1;
			float num = Time.time - value.last;
			if (num < Tuning.PrimaryVoiceCooldown.Value)
			{
				Combat.Trace?.Invoke("PRIMARYVOICE cooldown skip age=" + num.ToString("0.0"));
			}
			else if (Snd.Voice(body, key, length))
			{
				value.last = Time.time;
				Combat.Trace?.Invoke("PRIMARYVOICE played " + key + " stage=" + stage);
			}
		}
	}
}
public sealed class BanshoCharge : BaseSkillState
{
	private Gesture gest;

	private bool decided;

	private int shownLevel = 1;

	public static float MidRadiusFrac = 0.5f;

	public static int MidMax = 8;

	public static bool Radius9 = true;

	public static float RaiseUp = 0.32f;

	public static float RaiseFwd = 0.5f;

	public static bool RightRaise = false;

	public static bool KeepRightArm = true;

	public static Func<bool> TestHeld;

	public int Level
	{
		get
		{
			if (!(((EntityState)this).fixedAge >= Tuning.ShinraL3Time.Value))
			{
				if (!(((EntityState)this).fixedAge >= Tuning.ShinraL2Time.Value))
				{
					return 1;
				}
				return 2;
			}
			return 3;
		}
	}

	public bool Mass => Level >= 2;

	public float Held => ((EntityState)this).fixedAge;

	public static float RadiusFor(int lv)
	{
		return Tuning.BanshoPullRadius.Value * ((lv >= 3) ? 1f : MidRadiusFrac) + ((Radius9 && Tuning.BanshoLevelRadius != null) ? Tuning.BanshoLevelRadius.Value : 0f);
	}

	public static int MaxFor(int lv)
	{
		if (lv < 3)
		{
			return Mathf.Min(MidMax, Tuning.BanshoPullMax.Value);
		}
		return Tuning.BanshoPullMax.Value;
	}

	public List<GameObject> TargetsNow()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		int level = Level;
		if (level >= 2)
		{
			return BanshoRelease.MassTargets(((EntityState)this).characterBody, RadiusFor(level), MaxFor(level));
		}
		List<GameObject> list = new List<GameObject>();
		CharacterBody val = BanshoRelease.SingleTarget(((EntityState)this).characterBody, ((BaseState)this).GetAimRay());
		if (Object.op_Implicit((Object)(object)val))
		{
			list.Add(((Component)val).gameObject);
		}
		return list;
	}

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		((EntityState)this).characterBody.SetAimTimer(2f);
		CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
		if (!Object.op_Implicit((Object)(object)charVisual) || !Object.op_Implicit((Object)(object)charVisual.Anim) || !TrackedReference.op_Implicit((TrackedReference)(object)charVisual.Anim["cmr10"]))
		{
			return;
		}
		float L3 = Mathf.Max(0.32f, Tuning.ShinraL3Time.Value);
		gest = new Gesture
		{
			clip = "cmr10",
			startF = 0f,
			endF = 12f,
			playSeconds = L3,
			duration = 30f,
			fadeIn = 0.2f,
			fadeOut = 0.12f,
			fullBodyWhenStill = false
		};
		BanshoCharge self = this;
		if (RightRaise)
		{
			gest.post = delegate(CharVisual cv, float w)
			{
				RaiseArm(cv, w, Mathf.Clamp01(((EntityState)self).fixedAge / L3));
			};
		}
		if (KeepRightArm)
		{
			gest.keepArmR = true;
		}
		charVisual.PlayGesture(gest, 0.2f);
	}

	private static void RaiseArm(CharVisual cv, float w, float u)
	{
		//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_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)cv) && !(w <= 0.001f))
		{
			Transform val = cv.Bone("r upperarm");
			if (Object.op_Implicit((Object)(object)val))
			{
				Vector3 fwd = cv.Fwd;
				Vector3 val2 = Vector3.Cross(Vector3.up, fwd);
				float k = w * Mathf.SmoothStep(0f, 1f, u);
				cv.ArmTo("r", val.position + fwd * RaiseFwd + Vector3.up * RaiseUp + val2 * 0.06f, val.position + val2 * 0.45f + Vector3.down * 0.15f, k);
			}
		}
	}

	public override void FixedUpdate()
	{
		//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_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		int level = Level;
		if (level != shownLevel)
		{
			shownLevel = level;
			Snd.Sfx((level == 3) ? "ChargeFull" : "ChargeStep", ((EntityState)this).gameObject);
			CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
			Transform val = (Object.op_Implicit((Object)(object)charVisual) ? charVisual.Bone("r hand") : null);
			Fx.Local(PainFx.Burst, Object.op_Implicit((Object)(object)val) ? val.position : ((EntityState)this).characterBody.corePosition, (level == 3) ? 0.9f : 0.55f, ((EntityState)this).characterBody.corePosition);
		}
		if (!((EntityState)this).isAuthority || decided || (Down() && !(((EntityState)this).fixedAge >= Tuning.ShinraL3Time.Value + 1.6f)))
		{
			return;
		}
		decided = true;
		Ray aimRay = ((BaseState)this).GetAimRay();
		BanshoRelease banshoRelease = new BanshoRelease
		{
			mass = Mass,
			aimDir = ((Ray)(ref aimRay)).direction,
			level = (byte)level
		};
		float range = RadiusFor(level);
		int num = MaxFor(level);
		if (banshoRelease.mass)
		{
			banshoRelease.targets = BanshoRelease.MassTargets(((EntityState)this).characterBody, range, num);
		}
		else
		{
			CharacterBody val2 = BanshoRelease.SingleTarget(((EntityState)this).characterBody, aimRay);
			if (Object.op_Implicit((Object)(object)val2))
			{
				banshoRelease.targets.Add(((Component)val2).gameObject);
			}
		}
		if (banshoRelease.mass && Object.op_Implicit((Object)(object)((BaseSkillState)this).activatorSkillSlot))
		{
			GenericSkill activatorSkillSlot = ((BaseSkillState)this).activatorSkillSlot;
			activatorSkillSlot.rechargeStopwatch -= Mathf.Max(0f, Tuning.BanshoMassCooldown.Value - Tuning.BanshoCooldown.Value) * ((level >= 3) ? 1f : 0.5f);
		}
		if (banshoRelease.targets.Count == 0 && Object.op_Implicit((Object)(object)((BaseSkillState)this).activatorSkillSlot))
		{
			((BaseSkillState)this).activatorSkillSlot.AddOneStock();
		}
		Plugin.Log.LogInfo((object)("PAIN_BANSHO " + (banshoRelease.mass ? ("hold360 level=" + level + " radius=" + range.ToString("0")) : "single") + " targets=" + banshoRelease.targets.Count + (banshoRelease.mass ? (" inRange=" + BanshoRelease.LastInRange + " cap=" + num + ((BanshoRelease.LastInRange > num) ? " CAPPED" : "") + " capBites=" + ((BanshoRelease.LastInRange <= num) ? BanshoRelease.CapBites : (++BanshoRelease.CapBites)) + "/" + ++BanshoRelease.MassReleases) : "") + " held=" + ((EntityState)this).fixedAge.ToString("0.00")));
		((EntityState)this).outer.SetNextState((EntityState)(object)banshoRelease);
	}

	private bool Down()
	{
		if (TestHeld != null && TestHeld())
		{
			return true;
		}
		if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
		{
			return ((EntityState)this).inputBank.skill3.down;
		}
		return false;
	}

	public override void OnExit()
	{
		CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
		if (Object.op_Implicit((Object)(object)charVisual) && gest != null && !(((EntityState)this).outer.nextState is BanshoRelease))
		{
			charVisual.EndGesture(gest, 0.1f);
		}
		((EntityState)this).OnExit();
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		return (InterruptPriority)2;
	}
}
public sealed class BanshoRelease : BaseSkillState
{
	public bool mass;

	public Vector3 aimDir;

	public List<GameObject> targets = new List<GameObject>();

	public byte level = 1;

	public static float ImpaleUp = 1.2f;

	public static float ImpaleOut = 0.6f;

	public static float ImpaleSide = 0.5f;

	public static float ImpaleClear = 1.2f;

	public static readonly Dictionary<CharacterBody, float> DrawIn = new Dictionary<CharacterBody, float>();

	private float duration = 0.55f;

	private bool fired;

	private Gesture gest;

	public static bool Big9 = true;

	public static int LastInRange;

	public static int CapBites;

	public static int MassReleases;

	public static float BanshoRingGap = 2.2f;

	public override void OnEnter()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: 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)
		((BaseState)this).OnEnter();
		((EntityState)this).characterBody.SetAimTimer(1.5f);
		((BaseState)this).StartAimMode(0.8f, false);
		Vector3 val = aimDir;
		val.y = 0f;
		if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && ((Vector3)(ref val)).sqrMagnitude > 0.001f)
		{
			((EntityState)this).characterDirection.forward = ((Vector3)(ref val)).normalized;
		}
		CharVisual charVisual = CharVisual.Find(((EntityState)this).characterBody);
		bool flag = Big9 && level >= 3;
		if (Object.op_Implicit((Object)(object)charVisual) && Object.op_Implicit((Object)(object)charVisual.Anim) && TrackedReference.op_Implicit((TrackedReference)(object)charVisual.Anim["cmr10"]))
		{
			gest = new Gesture
			{
				clip = "cmr10",
				startF = 12f,
				endF = 27f,
				playSeconds = 0.3f,
				tailF = 44f,
				tailSeconds = 0.3f,
				duration = (flag ? BigPose.Len : 0.65f),
				fadeIn = (flag ? 0.05f : 0.04f),
				fadeOut = (flag ? 0.2f : 0.15f),
				fullBodyWhenStill = false
			};
			if (flag)
			{
				Gesture g0 = gest;
				gest.post = delegate(CharVisual cv, float w)
				{
					BigPose.Apply(cv, w, g0.Age);
				};
			}
			charVisual.PlayGesture(gest, 0.04f);
		}
		StunHide.Ensure();
		if (flag)
		{
			BigPose.Effects(((EntityState)this).characterBody, aimDir);
			Snd.Voice(((EntityState)this).characterBody, "BanshoMass", 1.2f, grunt: false, 1);
		}
		else
		{
			Snd.Sfx(mass ? "BanshoMass" : "Bansho", ((EntityState)this).gameObject);
			Snd.Voice(((EntityState)this).characterBody, mass ? "BanshoMass" : "Bansho", 1.2f, !mass, mass ? 1 : 0);
		}
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (!fired && ((EntityState)this).fixedAge >= 0.05f)
		{
			fired = true;
			if (NetworkServer.active)
			{
				Pull();
			}
		}
		if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	private static bool Eligible(CharacterBody self, CharacterBody cb)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)cb) && (Object)(object)cb != (Object)(object)self && Combat.TargetBody(cb, self) && !PainGravity.Captured(cb))
		{
			return Combat.Visible(self.corePosition, cb.corePosition);
		}
		return false;
	}

	public static CharacterBody SingleTarget(CharacterBody self, Ray ray)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: 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_00d6: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		CharacterBody result = null;
		float num = float.MaxValue;
		float value = Tuning.BanshoRange.Value;
		if (Combat.AimHit(ray, self, value + 30f, out var best))
		{
			HurtBox val = (Object.op_Implicit((Object)(object)((RaycastHit)(ref best)).collider) ? ((Component)((RaycastHit)(ref best)).collider).GetComponent<HurtBox>() : null);
			CharacterBody val2 = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent)) ? val.healthComponent.body : null);
			if (Object.op_Implicit((Object)(object)val2) && Eligible(self, val2) && Vector3.Distance(val2.corePosition, self.corePosition) <= value)
			{
				return val2;
			}
		}
		foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
		{
			if (!Eligible(self, readOnlyInstances))
			{
				continue;
			}
			Vector3 val3 = readOnlyInstances.corePosition - ((Ray)(ref ray)).origin;
			float num2 = Vector3.Distance(readOnlyInstances.corePosition, self.corePosition);
			if (num2 > value)
			{
				continue;
			}
			float num3 = Vector3.Angle(val3, ((Ray)(ref ray)).direction);
			if (!(num3 > 9f))
			{
				float num4 = num3 * 3f + num2 * 0.1f;
				if (num4 < num)
				{
					num = num4;
					result = readOnlyInstances;
				}
			}
		}
		return result;
	}

	public static List<GameObject> MassTargets(CharacterBody self)
	{
		return MassTargets(self, Tuning.BanshoPullRadius.Value, Tuning.BanshoPullMax.Value);
	}

	public static List<GameObject> MassTargets(CharacterBody self, float range, int max)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		List<KeyValuePair<float, GameObject>> list = new List<KeyValuePair<float, GameObject>>();
		foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
		{
			if (Eligible(self, readOnlyInstances))
			{
				float num = Vector3.Distance(readOnlyInstances.corePosition, self.corePosition);
				if (!(num > range))
				{
					list.Add(new KeyValuePair<float, GameObject>(num, ((Component)readOnlyInstances).gameObject));
				}
			}
		}
		LastInRange = list.Count;
		list.Sort((KeyValuePair<float, GameObject> a, KeyValuePair<float, GameObject> b) => a.Key.CompareTo(b.Key));
		List<GameObject> list2 = new List<GameObject>();
		foreach (KeyValuePair<float, GameObject> item in list)
		{
			if (list2.Count >= max)
			{
				break;
			}
			list2.Add(item.Value);
		}
		return list2;
	}

	private static Vector3 RingPoint(CharacterBody self, CharacterBody cb, Vector3 bearing, float extra = 0f)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: 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_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: 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)
		float num = Mathf.Clamp(cb.radius, 0.4f, 4f);
		Vector3 val = self.footPosition + bearing * (self.radius + BanshoRingGap + num + extra);
		bool num2 = !Object.op_Implicit((Object)(object)cb.characterMotor);
		float num3 = cb.corePosition.y - cb.footPosition.y;
		if (num2)
		{
			val.y = self.corePosition.y + 1f;
			return val;
		}
		RaycastHit val2 = default(RaycastHit);
		if (Physics.Raycast(val + Vector3.up * 4f, Vector3.down, ref val2, 10f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
		{
			val.y = ((RaycastHit)(ref val2)).point.y;
		}
		else
		{
			val.y = self.footPosition.y;
		}
		return val + Vector3.up * (Mathf.Max(0.3f, num3) + 0.5f);
	}

	private void Pull()
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0401: Unknown result type (might be due to invalid IL or missing references)
		//IL_0406: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_049a: Unknown result type (might be due to invalid IL or missing references)
		//IL_049c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: 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_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0301: Unknown result type (might be due to invalid IL or missing references)
		//IL_030d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0538: Unknown result type (might be due to invalid IL or missing references)
		//IL_0544: Unknown result type (might be due to invalid IL or missing references)
		//IL_054e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0553: Unknown result type (might be due to invalid IL or missing references)
		//IL_0558: Unknown result type (might be due to invalid IL or missing references)
		//IL_0562: Unknown result type (might be due to invalid IL or missing references)
		//IL_0567: Unknown result type (might be due to invalid IL or missing references)
		//IL_0578: Unknown result type (might be due to invalid IL or missing references)
		//IL_059d: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
		CharacterBody self = ((EntityState)this).characterBody;
		Vector3 flat = Aim.Flat(aimDir);
		int num = 0;
		int num2 = 0;
		float dist = Tuning.BanshoHoldDistance.Value;
		int count = targets.Count;
		if (mass)
		{
			List<Vector2> list = new List<Vector2>();
			foreach (GameObject target in targets)
			{
				CharacterBody val = (Object.op_Implicit((Object)(object)target) ? target.GetComponent<CharacterBody>() : null);
				if (!Object.op_Implicit((Object)(object)val) || !Eligible(self, val))
				{
					continue;
				}
				Vector3 val2 = Aim.Flat(val.corePosition - self.corePosition);
				if (((Vector3)(ref val2)).sqrMagnitude < 0.01f)
				{
					val2 = flat;
				}
				float num3 = Mathf.Atan2(flat.x, flat.z) * 57.29578f;
				float num4 = Mathf.DeltaAngle(num3, Mathf.Atan2(val2.x, val2.z) * 57.29578f) * (5f / 12f);
				int num5 = 0;
				float num6 = num4;
				for (int i = 0; i < 24; i++)
				{
					bool flag = false;
					foreach (Vector2 item in list)
					{
						if (Mathf.Abs(item.x - (float)num5) < 0.5f && Mathf.Abs(Mathf.DeltaAngle(item.y, num6)) < 18f)
						{
							flag = true;
							break;
						}
					}
					if (!flag)
					{
						break;
					}
					int num7 = i % 8;
					if (num7 == 7)
					{
						num5++;
						num6 = num4;
					}
					else
					{
						num6 = Mathf.Clamp(num4 + (float)((num7 % 2 == 0) ? 1 : (-1)) * 18f * (float)(num7 / 2 + 1), -80f, 80f);
					}
				}
				list.Add(new Vector2((float)num5, num6));
				Vector3 bearing = Quaternion.Euler(0f, num3 + num6, 0f) * Vector3.forward;
				CharacterBody vb = val;
				float extra = (float)num5 * 2.2f;
				Func<Vector3> anchor = () => (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)vb)) ? ((!Object.op_Implicit((Object)(object)vb)) ? Vector3.zero : vb.corePosition) : RingPoint(self, vb, bearing, extra);
				PainGravity painGravity = PainGravity.Pull(self, val, anchor, Tuning.BanshoSpeed.Value, 0.06f, (DamageSource)4, "X.mass", OnArrive, suspend: false);
				if (Object.op_Implicit((Object)(object)painGravity))
				{
					num++;
					Fx.Emit(PainFx.Pull, self.corePosition + ((Vector3)(ref val2)).normalized * 0.8f + Vector3.up * 0.2f, 0.7f, val.corePosition);
					PathActors.NotifyPull(self, val, painGravity);
				}
			}
			Plugin.Log.LogInfo((object)("PAIN_BANSHO pull hold360 started=" + num + "/" + targets.Count));
			return;
		}
		foreach (GameObject target2 in targets)
		{
			CharacterBody cb = (Object.op_Implicit((Object)(object)target2) ? target2.GetComponent<CharacterBody>() : null);
			if (!Object.op_Implicit((Object)(object)cb) || !Eligible(self, cb))
			{
				num2++;
				continue;
			}
			Vector3 zero = Vector3.zero;
			if (mass && count > 1)
			{
				float num8 = (float)num2 / (float)count * MathF.PI * 2f;
				float num9 = Mathf.Min(1.6f, 0.5f + (float)count * 0.12f);
				((Vector3)(ref zero))..ctor(Mathf.Cos(num8) * num9, Mathf.Sin(num8) * num9 * 0.45f, Mathf.Sin(num8) * num9 * 0.5f);
			}
			float lift = (Object.op_Implicit((Object)(object)cb.characterMotor) ? 0.35f : 0.8f);
			Vector3 off = zero;
			Func<Vector3> anchor2 = delegate
			{
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: 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_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01de: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e3: 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_01fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: Unknown result type (might be due to invalid IL or missing references)
				//IL_020b: Unknown result type (might be due to invalid IL or missing references)
				//IL_012f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0134: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_0157: Unknown result type (might be due to invalid IL or missing references)
				//IL_015c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_0186: Unknown result type (might be due to invalid IL or missing references)
				//IL_018b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0197: Unknown result type (might be due to invalid IL or missing references)
				//IL_019c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: 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_02f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0261: Unknown result type (might be due to invalid IL or missing references)
				//IL_0263: Unknown result type (might be due to invalid IL or missing references)
				//IL_026d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0272: 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_027d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0282: Unknown result type (might be due to invalid IL or missing references)
				//IL_0288: Unknown result type (might be due to invalid IL or missing references)
				//IL_028d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0292: Unknown result type (might be due to invalid IL or missing references)
				//IL_0297: Unknown result type (might be due to invalid IL or missing references)
				//IL_0299: Unknown result type (might be due to invalid IL or missing references)
				//IL_029b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a5: 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_02d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02db: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)self))
				{
					if (!Object.op_Implicit((Object)(object)cb))
					{
						return Vector3.zero;
					}
					return cb.corePosition;
				}
				Vector3 val3 = Aim.Flat(Object.op_Implicit((Object)(object)self.inputBank) ? self.inputBank.aimDirection : flat);
				Vector3 val4 = Vector3.Cross(Vector3.up, val3);
				float num10 = (Object.op_Implicit((Object)(object)cb) ? Mathf.Clamp(cb.radius, 0.4f, 4f) : 0.6f);
				int num11;
				float num12;
				if (Object.op_Implicit((Object)(object)cb) && DrawIn.TryGetValue(cb, out var value))
				{
					num11 = ((Time.fixedTime < value) ? 1 : 0);
					if (num11 != 0)
					{
						num12 = 0.45f;
						goto IL_00ec;
					}
				}
				else
				{
					num11 = 0;
				}
				num12 = dist;
				goto IL_00ec;
				IL_00ec:
				float num13 = num12;
				float num14 = ((num11 != 0) ? (0.8f + num10 * 0.45f) : (0.9f + num10 * 0.6f));
				Vector3 val5 = (mass ? (self.corePosition + val3 * (dist + num10) + Vector3.up * lift) : (self.corePosition + val3 * (self.radius + num13 + num10) + val4 * num14 + Vector3.up * Mathf.Max(0f, num10 - 1f) * 0.5f + val4 * off.x + Vector3.up * off.y + val3 * off.z));
				PainGravity painGravity3 = (Object.op_Implicit((Object)(object)cb) ? PainGravity.Get(cb) : null);
				if ((num11 != 0 || (Object.op_Implicit((Object)(object)painGravity3) && painGravity3.carry)) && !mass)
				{
					val5 += Vector3.up * ImpaleUp + val3 * ImpaleOut + val4 * ImpaleSide;
					RaycastHit val6 = default(RaycastHit);
					if (Physics.Raycast(val5 + Vector3.up, Vector3.down, ref val6, num10 + ImpaleClear + 1.5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
					{
						val5.y = Mathf.Max(val5.y, ((RaycastHit)(ref val6)).point.y + num10 + ImpaleClear);
					}
				}
				return val5;
			};
			PainGravity painGravity2 = PainGravity.Pull(self, cb, anchor2, Tuning.BanshoSpeed.Value, Tuning.BanshoHold.Value + (mass ? 0.2f : 0f), (DamageSource)4, mass ? "X.mass" : "X", OnArrive);
			if (Object.op_Implicit((Object)(object)painGravity2))
			{
				num++;
				Fx.Emit(PainFx.Pull, self.corePosition + flat * 0.8f + Vector3.up * 0.2f, 1f, cb.corePosition);
				Fx.EmitRoot(PainFx.Hold, cb.corePosition, mass ? 0.55f : 1f, cb.corePosition, Tuning.BanshoHold.Value + 0.9f, ((Component)cb).gameObject);
				PathActors.NotifyPull(self, cb, painGravity2);
			}
			num2++;
		}
		Plugin.Log.LogInfo((object)("PAIN_BANSHO pull mass=" + mass + " started=" + num + "/" + targets.Count));
	}

	private static void OnArrive(PainGravity g)
	{
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)g) && Object.op_Implicit((Object)(object)g.owner) && Object.op_Implicit((Object)(object)g.body) && Object.op_Implicit((Object)(object)g.body.mainHurtBox))
		{
			Combat.Source = g.tag + ".arrive";
			Combat.Deal(g.owner, g.body.mainHurtBox, g.Core, Tuning.BanshoDamage.Value, 0.5f, crit: false, Vector3.zero, (DamageType)0, null, (DamageColorIndex)0, (DamageSource)4);
			if (g.tag != "X.mass")
			{
				Fx.Emit(PainFx.Burst, g.Core, 0.5f, g.Core + Vector3.up);
			}
		}
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		if (fired)
		{
			return (InterruptPriority)0;
		}
		return (InterruptPriority)2;
	}

	public override void OnSerialize(NetworkWriter w)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		((BaseSkillState)this).OnSerialize(w);
		w.Write(mass);
		w.Write(aimDir);
		w.Write(level);
		w.Write((byte)targets.Count);
		foreach (GameObject target in targets)
		{
			w.Write(target);
		}
	}

	public override void OnDeserialize(NetworkReader 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)
		((BaseSkillState)this).OnDeserialize(r);
		mass = r.ReadBoolean();
		aimDir = r.ReadVector3();
		level = r.ReadByte();
		int num = r.ReadByte();
		targets.Clear();
		for (int i = 0; i < num; i++)
		{
			GameObject val = r.ReadGameObject();
			if (Object.op_Implicit((Object)(object)val))
			{
				targets.Add(val);
			}
		}
	}
}
public static class BigPose
{
	public static float Spread9 = 25f;

	public static float Len = 0.75f;

	public static float Thrust = 0.1f;

	public static float HoldEnd = 0.34f;

	public static float DrawEnd = 0.56f;

	public static float Reach = 0.97f;

	public static float InTo = 0.12f;

	public static float DrawBack = 0.5f;

	public static float ChestDrop = 0.06f;

	public static float LeanBack = 5f;

	public static void Apply(CharVisual v, float w, float age)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: 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_01b7: 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_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: 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_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_0261: Unknown result type (might be due to invalid IL or missing references)
		//IL_0266: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a2: 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_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: 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_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d6: 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_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0301: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_0306: Unknown result type (might be due to invalid IL or missing references)
		//IL_0307: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0311: 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_031b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0325: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)v) || w <= 0.001f)
		{
			return;
		}
		Vector3 fwd = v.Fwd;
		Vector3 val = Vector3.Cross(Vector3.up, fwd);
		float num = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(age / Thrust));
		float num2 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((age - HoldEnd) / (DrawEnd - HoldEnd)));
		v.LevelHead(w);
		Transform val2 = v.Bone("spine1");
		if (Object.op_Implicit((Object)(object)val2) && LeanBack != 0f)
		{
			val2.rotation = Quaternion.AngleAxis((0f - LeanBack) * num * (1f - num2 * 0.6f) * w, val) * val2.rotation;
		}
		string[] array = new string[2] { "l", "r" };
		foreach (string text in array)
		{
			float num3 = ((text == "l") ? (-1f) : 1f);
			Transform val3 = v.Bone(text + " upperarm");
			Transform val4 = v.Bone(text + " forearm");
			Transform val5 = v.Bone(text + " hand");
			if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val4) && Object.op_Implicit((Object)(object)val5))
			{
				Vector3 position = val3.position;
				Vector3 val6 = val4.position - val3.position;
				float magnitude = ((Vector3)(ref val6)).magnitude;
				val6 = val5.position - val4.position;
				float num4 = magnitude + ((Vector3)(ref val6)).magnitude;
				Vector3 val7 = ((Spread9 > 0f) ? (Quaternion.AngleAxis(num3 * Spread9, Vector3.up) * fwd) : fwd);
				Vector3 val8 = ((Spread9 > 0f) ? (position + val7 * Reach * num4 + Vector3.down * ChestDrop) : (position + fwd * Reach * num4 - val * num3 * InTo + Vector3.down * ChestDrop));
				Vector3 val9 = position + fwd * (num4 * DrawBack) - val * num3 * (InTo * 0.6f) + Vector3.down * (ChestDrop + 0.1f);
				Vector3 target = Vector3.Lerp(Vector3.Lerp(val5.position, val8, num), val9, num2);
				Vector3 pole = position + val * num3 * 0.45f + Vector3.down * 0.35f - fwd * 0.2f;
				val6 = fwd + Vector3.up;
				v.ArmTo(text, target, pole, w, Vector3.Lerp(val7, ((Vector3)(ref val6)).normalized, num2), Vector3.up);
			}
		}
	}

	public static void Effects(CharacterBody b, Vector3 aim)
	{
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)b))
		{
			CharVisual charVisual = CharVisual.Find(b);
			Transform val = (Object.op_Implicit((Object)(object)charVisual) ? charVisual.Bone("l hand") : null);
			Transform val2 = (Object.op_Implicit((Object)(object)charVisual) ? charVisual.Bone("r hand") : null);
			Vector3 start = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2)) ? ((val.position + val2.position) * 0.5f + Aim.Flat(aim) * 0.5f) : (b.corePosition + Aim.Flat(aim) * 1f));
			Fx.Local(PainFx.PullBig, b.corePosition, BanshoCharge.RadiusFor(3), start);
			if (Snd.Sfx("BanshoFull", ((Component)b).gameObject) == 0)
			{
				Snd.Sfx("BanshoMass", ((Component)b).gameObject);
				Snd.Sfx("Impact", ((Component)b).gameObject);
			}
		}
	}
}
public sealed class StunHide : MonoBehaviour
{
	private static StunHide inst;

	public static void Ensure()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		if (!Object.op_Implicit((Object)(object)inst))
		{
			GameObject val = new GameObject("PainStunHide");
			Object.DontDestroyOnLoad((Object)val);
			inst = val.AddComponent<StunHide>();
		}
	}

	private void LateUpdate()
	{
		if (!Object.op_Implicit((Object)(object)PainBuffs.Suspended))
		{
			return;
		}
		foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
		{
			if (!Object.op_Implicit((Object)(object)readOnlyInstances) || !readOnlyInstances.HasBuff(PainBuffs.Suspended))
			{
				continue;
			}
			Transform transform = readOnlyInstances.transform;
			for (int i = 0; i < transform.childCount; i++)
			{
				Transform child = transform.GetChild(i);
				if (Object.op_Implicit((Object)(object)child) && ((Component)child).gameObject.activeSelf && ((Object)child).name.IndexOf("Stun", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					((Component)child).gameObject.SetActive(false);
				}
			}
		}
	}
}
public static class RockKit
{
	private static Mesh[] chunks;

	private static Material mat;

	public static Mesh[] Chunks
	{
		get
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			if (chunks != null)
			{
				return chunks;
			}
			List<Mesh> list = new List<Mesh>();
			try
			{
				ChibakuSatellite.Meshes();
				if (ChibakuSatellite.sPlate != null)
				{
					Mesh[] sPlate = ChibakuSatellite.sPlate;
					foreach (Mesh val in sPlate)
					{
						if (Object.op_Implicit((Object)(object)val) && val.vertexCount <= 2400)
						{
							Bounds bounds = val.bounds;
							Vector3 extents = ((Bounds)(ref bounds)).extents;
							float num = 1f / Mathf.Max(0.001f, ((Vector3)(ref extents)).magnitude);
							Vector3[] vertices = val.vertices;
							for (int j = 0; j < vertices.Length; j++)
							{
								vertices[j] = (vertices[j] - ((Bounds)(ref bounds)).center) * num;
							}
							Mesh val2 = new Mesh
							{
								name = "PainRockChunk"
							};
							val2.vertices = vertices;
							val2.normals = val.normals;
							val2.uv = val.uv;
							val2.triangles = val.triangles;
							val2.RecalculateBounds();
							list.Add(val2);
						}
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("PAIN_ROCKKIT " + ex.Message));
			}
			if (list.Count == 0)
			{
				list.Add(PainFx.Sphere);
			}
			chunks = list.ToArray();
			return chunks;
		}
	}

	public static Material Mat
	{
		get
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)mat))
			{
				ChibakuSatellite.Meshes();
				mat = (Object.op_Implicit((Object)(object)ChibakuSatellite.sRockMat) ? new Material(ChibakuSatellite.sRockMat) : new Material(Shader.Find("Hopoo Games/Deferred/Standard") ?? Shader.Find("Standard")));
				mat.color = new Color(0.78f, 0.72f, 0.64f);
			}
			return mat;
		}
	}

	public static void Throw(Vector3 at, Vector3 vel, float size, float life)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: 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_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: 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_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		Mesh[] array = Chunks;
		GameObject val = new GameObject("PainRockThrown")
		{
			layer = LayerIndex.debris.intVal
		};
		val.transform.position = at;
		val.transform.rotation = Random.rotation;
		val.transform.localScale = Vector3.one * size;
		val.AddComponent<MeshFilter>().sharedMesh = array[Random.Range(0, array.Length)];
		MeshRenderer obj = val.AddComponent<MeshRenderer>();
		((Renderer)obj).sharedMaterial = Mat;
		((Renderer)obj).shadowCastingMode = (ShadowCastingMode)(size > 0.8f);
		val.AddComponent<SphereCollider>().radius = 0.6f;
		Rigidbody obj2 = val.AddComponent<Rigidbody>();
		obj2.mass = Mathf.Max(0.2f, size);
		obj2.velocity = vel;
		obj2.angularVelocity = Random.insideUnitSphere * 6f;
		obj2.drag = 0.05f;
		val.AddComponent<ShrinkAway>().life = life;
	}
}
public static class CrackMesh
{
	public sealed class Cracks
	{
		public Cracks lip;

		public GameObject go;

		public Mesh mesh;

		public Color[] col;

		public float[] r;

		public float[] wgt;

		public Material mat;

		public Material rubMat;

		public Material plateMat;

		public Transform[] rub;

		public float[] rubR;

		public float[] rubS;
	}

	private static Texture2D profile;

	private static Texture2D lipProfile;

	public static bool NoOverhang = true;

	private static int MinPts = 2;

	public static int Primary = 16;

	public static int Hairlines = 70;

	public static int RubbleMax = 140;

	public static float WidthMax = 1.1f;

	public static float BranchP = 0.3f;

	public static int FracRadials = 20;

	public static int FracChords = 30;

	public static int FracPlates = 22;

	public static float FracFadeOut = 0.2f;

	private static Mesh plateMesh;

	public static float FracWidth = 2.1f;

	public static float FracSpur = 0.08f;

	public static int Frac8MainMin = 6;

	public static int Frac8Plates = 12;

	public static int Frac8LipMax = 120;

	public static float Frac8Width = 8.5f;

	public static float Frac8Lip = 0.45f;

	public static float Frac8Reach = 0.9f;

	public static float Frac8Taper = 0.75f;

	public static float Frac8LipW = 0.2f;

	private static Texture2D LipProfile
	{
		get
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0087: 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)
			if (Object.op_Implicit((Object)(object)lipProfile))
			{
				return lipProfile;
			}
			lipProfile = new Texture2D(64, 4, (TextureFormat)4, true)
			{
				wrapMode = (TextureWrapMode)1
			};
			Color[] array = (Color[])(object)new Color[256];
			for (int i = 0; i < 64; i++)
			{
				float num = Mathf.Abs((float)i / 63f * 2f - 1f);
				float num2 = Mathf.Clamp01((1f - num) / 0.45f) * 0.85f;
				for (int j = 0; j < 4; j++)
				{
					array[j * 64 + i] = new Color(0.5f, 0.43f, 0.34f, num2);
				}
			}
			lipProfile.SetPixels(array);
			lipProfile.Apply(true);
			return lipProfile;
		}
	}

	private static Texture2D Profile
	{
		get
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)profile))
			{
				return profile;
			}
			profile = new Texture2D(64, 4, (TextureFormat)4, true)
			{
				wrapMode = (TextureWrapMode)1
			};
			Color[] array = (Color[])(object)new Color[256];
			for (int i = 0; i < 64; i++)
			{
				float num = Mathf.Abs((float)i / 63f * 2f - 1f);
				float num2 = Mathf.Clamp01((1f - num) / 0.3f);
				float num3 = ((num < 0.3f) ? 0.02f : ((num < 0.62f) ? 0.1f : 0.26f));
				for (int j = 0; j < 4; j++)
				{
					array[j * 64 + i] = new Color(num3, num3 * 0.9f, num3 * 0.85f, num2);
				}
			}
			profile.SetPixels(array);
			profile.Apply(true);
			return profile;
		}
	}

	private static void Strip(List<Vector3> pts, List<float> width, Vector3 centre, List<Vector3> v, List<Vector2> uv, List<int> tri, List<float> rr)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: 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_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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_00ce: 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_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		for (int i = 0; i < pts.Count; i++)
		{
			Vector3 val = pts[i];
			Vector3 val2 = ((i < pts.Count - 1) ? (pts[i + 1] - val) : (val - pts[i - 1]));
			val2.y = 0f;
			val2 = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val2)).normalized : Vector3.forward);
			Vector3 val3 = Vector3.Cross(Vector3.up, val2) * width[i] * 0.5f;
			int count = v.Count;
			v.Add(val - val3);
			v.Add(val + val3);
			uv.Add(new Vector2(0f, (float)i));
			uv.Add(new Vector2(1f, (float)i));
			Vector2 val4 = new Vector2(val.x - centre.x, val.z - centre.z);
			float magnitude = ((Vector2)(ref val4)).magnitude;
			rr.Add(magnitude);
			rr.Add(magnitude);
			if (i > 0)
			{
				tri.AddRange(new int[6]
				{
					count - 2,
					count,
					count - 1,
					count - 1,
					count,
					count + 1
				});
			}
		}
	}

	private static Vector3 Land(Vector3 p, float lift, float probe)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: 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_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit val = default(RaycastHit);
		if (!Physics.Raycast(p + Vector3.up * probe, Vector3.down, ref val, probe * 2f + 40f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
		{
			return p;
		}
		return ((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).normal * lift;
	}

	private static bool Ground(Vector3 centre, Vector3 xz, out Vector3 p)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: 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_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (m