Decompiled source of Rei Solar Ash v1.1.23

plugins/ReiMod/ReiMod.dll

Decompiled a month 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.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.AI.Walker;
using EntityStates.Loader;
using HG;
using HG.BlendableTypes;
using HenryMod.Modules;
using HenryMod.Modules.BaseStates;
using HenryMod.Modules.Characters;
using HenryMod.Survivors.Henry;
using HenryMod.Survivors.Rei;
using HenryMod.Survivors.Rei.SkillStates;
using KinematicCharacterController;
using On.EntityStates;
using On.RoR2;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using ReiRails;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Orbs;
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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace ReiRails
{
	public class GrindRail : MonoBehaviour
	{
		public static readonly List<GrindRail> All = new List<GrindRail>();

		public Vector3[] points;

		public Transform[] anchors;

		public Vector3 anchorOffset;

		public bool loop;

		public float minSpeed = 12f;

		public float cruise = 20f;

		public float slopeGravity = 1f;

		public float width = 0.7f;

		public Color color = new Color(0.25f, 0.95f, 1f, 1f);

		public readonly List<Vector3> samples = new List<Vector3>();

		public readonly List<float> arc = new List<float>();

		private Vector3 boundsCenter;

		private float boundsRadius;

		private LineRenderer lr;

		private bool moving;

		private MeshFilter tubeMf;

		private Mesh tube;

		private LineRenderer glow;

		private LineRenderer flow;

		private Transform[] caps;

		private readonly List<Transform> beads = new List<Transform>();

		private Material flowMat;

		private float flowOffset;

		private const int Sides = 8;

		private const float BeadEvery = 9f;

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

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

		private static readonly List<int> tt = new List<int>();

		public float Length { get; private set; }

		private void OnEnable()
		{
			All.Add(this);
		}

		private void OnDisable()
		{
			All.Remove(this);
		}

		private void Start()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			//IL_0190: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: 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_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: 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_0272: Unknown result type (might be due to invalid IL or missing references)
			moving = anchors != null && anchors.Length > 1;
			Rebuild();
			GameObject val = new GameObject("Tube");
			val.transform.SetParent(((Component)this).transform, false);
			tubeMf = val.AddComponent<MeshFilter>();
			tube = new Mesh
			{
				name = "RailTube"
			};
			tube.MarkDynamic();
			tubeMf.sharedMesh = tube;
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			((Renderer)obj).sharedMaterial = RailLook.Solid(color);
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			glow = Line("Glow", width * 1.5f, RailLook.Material(new Color(color.r, color.g, color.b, 0.22f)));
			flowMat = RailLook.Flow(Color.Lerp(color, Color.white, 0.55f));
			flow = Line("Flow", width * 0.8f, flowMat);
			flow.textureMode = (LineTextureMode)1;
			Mesh sphere = RailLook.Sphere;
			if (!loop)
			{
				caps = (Transform[])(object)new Transform[2];
				for (int i = 0; i < 2; i++)
				{
					GameObject val2 = new GameObject("RailEnd");
					val2.transform.SetParent(((Component)this).transform, false);
					val2.AddComponent<MeshFilter>().sharedMesh = sphere;
					MeshRenderer obj2 = val2.AddComponent<MeshRenderer>();
					((Renderer)obj2).sharedMaterial = RailLook.Solid(Color.Lerp(color, Color.white, 0.3f), 2.2f);
					((Renderer)obj2).shadowCastingMode = (ShadowCastingMode)0;
					val2.transform.localScale = Vector3.one * width * 1.3f;
					GameObject val3 = new GameObject("Halo");
					val3.transform.SetParent(val2.transform, false);
					LineRenderer obj3 = val3.AddComponent<LineRenderer>();
					obj3.useWorldSpace = false;
					obj3.positionCount = 2;
					obj3.SetPosition(0, Vector3.down * 0.6f);
					obj3.SetPosition(1, Vector3.up * 0.6f);
					obj3.widthMultiplier = width * 2.6f;
					((Renderer)obj3).material = RailLook.Material(new Color(color.r, color.g, color.b, 0.5f));
					((Renderer)obj3).shadowCastingMode = (ShadowCastingMode)0;
					caps[i] = val2.transform;
				}
			}
			UpdateLine();
		}

		private LineRenderer Line(string name, float w, Material m)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(((Component)this).transform, false);
			LineRenderer obj = val.AddComponent<LineRenderer>();
			obj.useWorldSpace = true;
			obj.loop = false;
			obj.widthMultiplier = w;
			obj.numCapVertices = 3;
			obj.numCornerVertices = 2;
			((Renderer)obj).material = m;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
			return obj;
		}

		private void Update()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)flowMat))
			{
				flowOffset -= Time.deltaTime * 0.9f;
				flowMat.mainTextureOffset = new Vector2(flowOffset, 0f);
			}
		}

		private void FixedUpdate()
		{
			if (moving)
			{
				Rebuild();
			}
		}

		private void LateUpdate()
		{
			if (moving)
			{
				Rebuild();
				UpdateLine();
			}
		}

		private void OnDestroy()
		{
			LineRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<LineRenderer>();
			foreach (LineRenderer val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).material))
				{
					Object.Destroy((Object)(object)((Renderer)val).material);
				}
			}
			if (Object.op_Implicit((Object)(object)tube))
			{
				Object.Destroy((Object)(object)tube);
			}
		}

		private void UpdateLine()
		{
			//IL_0055: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Expected O, but got Unknown
			//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_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: 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_017e: 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_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: 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_01a6: 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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01fe: 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_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)glow) || samples.Count < 2)
			{
				return;
			}
			int count = samples.Count;
			glow.positionCount = count;
			flow.positionCount = count;
			for (int i = 0; i < count; i++)
			{
				glow.SetPosition(i, samples[i]);
				flow.SetPosition(i, samples[i]);
			}
			flowMat.mainTextureScale = new Vector2(1f / 6f, 1f);
			tv.Clear();
			tn.Clear();
			tt.Clear();
			float num = width * 0.3f;
			Vector3 val = Vector3.zero;
			Matrix4x4 worldToLocalMatrix = ((Component)this).transform.worldToLocalMatrix;
			Vector3 tangent;
			for (int j = 0; j < count; j++)
			{
				Vector3 val2 = samples[Mathf.Max(0, j - 1)];
				Vector3 val3 = samples[Mathf.Min(count - 1, j + 1)] - val2;
				if (((Vector3)(ref val3)).sqrMagnitude < 1E-06f)
				{
					val3 = Vector3.forward;
				}
				((Vector3)(ref val3)).Normalize();
				Vector3 normalized;
				if (j != 0)
				{
					tangent = Vector3.Cross(val3, Vector3.Cross(val, val3));
					normalized = ((Vector3)(ref tangent)).normalized;
				}
				else
				{
					tangent = Vector3.Cross(val3, (Mathf.Abs(val3.y) > 0.9f) ? Vector3.right : Vector3.up);
					normalized = ((Vector3)(ref tangent)).normalized;
				}
				Vector3 val4 = normalized;
				if (((Vector3)(ref val4)).sqrMagnitude < 1E-06f)
				{
					val4 = Vector3.right;
				}
				val = val4;
				Vector3 val5 = Vector3.Cross(val4, val3);
				for (int k = 0; k < 8; k++)
				{
					float num2 = (float)k * (float)Math.PI * 2f / 8f;
					Vector3 val6 = val4 * Mathf.Cos(num2) + val5 * Mathf.Sin(num2);
					tv.Add(((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint3x4(samples[j] + val6 * num));
					tn.Add(((Matrix4x4)(ref worldToLocalMatrix)).MultiplyVector(val6));
				}
				if (j > 0)
				{
					for (int l = 0; l < 8; l++)
					{
						int item = (j - 1) * 8 + l;
						int item2 = (j - 1) * 8 + (l + 1) % 8;
						int item3 = j * 8 + l;
						int item4 = j * 8 + (l + 1) % 8;
						tt.Add(item);
						tt.Add(item3);
						tt.Add(item2);
						tt.Add(item2);
						tt.Add(item3);
						tt.Add(item4);
					}
				}
			}
			tube.Clear();
			tube.SetVertices(tv);
			tube.SetNormals(tn);
			tube.SetTriangles(tt, 0);
			tube.RecalculateBounds();
			if (caps != null)
			{
				caps[0].position = samples[0];
				caps[1].position = samples[count - 1];
			}
			int num3 = Mathf.Max(0, Mathf.FloorToInt(Length / 9f) - 1);
			while (beads.Count < num3)
			{
				GameObject val7 = new GameObject("Bead");
				val7.transform.SetParent(((Component)this).transform, false);
				val7.AddComponent<MeshFilter>().sharedMesh = RailLook.Sphere;
				MeshRenderer obj = val7.AddComponent<MeshRenderer>();
				((Renderer)obj).sharedMaterial = RailLook.Solid(Color.Lerp(color, Color.white, 0.5f), 1.6f);
				((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
				val7.transform.localScale = new Vector3(width * 0.75f, width * 0.75f, width * 0.75f);
				beads.Add(val7.transform);
			}
			for (int m = 0; m < beads.Count; m++)
			{
				bool flag = m < num3;
				((Component)beads[m]).gameObject.SetActive(flag);
				if (flag)
				{
					beads[m].position = Point((float)(m + 1) * Length / (float)(num3 + 1), out tangent);
				}
			}
		}

		public void Rebuild()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: 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_019d: 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_01af: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: 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_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: 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_0230: 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_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: 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_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: 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_0305: 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_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: 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)
			List<Vector3> cp = new List<Vector3>();
			if (moving)
			{
				Transform[] array = anchors;
				foreach (Transform val in array)
				{
					if (Object.op_Implicit((Object)(object)val))
					{
						cp.Add(val.position + anchorOffset);
					}
				}
			}
			else if (points != null)
			{
				cp.AddRange(points);
			}
			samples.Clear();
			arc.Clear();
			Length = 0f;
			if (cp.Count < 2)
			{
				return;
			}
			int n = cp.Count;
			int num = (loop ? n : (n - 1));
			for (int j = 0; j < num; j++)
			{
				Vector3 val2 = P(j - 1);
				Vector3 val3 = P(j);
				Vector3 val4 = P(j + 1);
				Vector3 val5 = P(j + 2);
				float num2 = 0f;
				float num3 = num2 + Mathf.Sqrt(Mathf.Max(Vector3.Distance(val2, val3), 0.001f));
				float num4 = num3 + Mathf.Sqrt(Mathf.Max(Vector3.Distance(val3, val4), 0.001f));
				float num5 = num4 + Mathf.Sqrt(Mathf.Max(Vector3.Distance(val4, val5), 0.001f));
				for (int k = 0; k < 14; k++)
				{
					float num6 = Mathf.Lerp(num3, num4, (float)k / 14f);
					Vector3 val6 = (num3 - num6) / (num3 - num2) * val2 + (num6 - num2) / (num3 - num2) * val3;
					Vector3 val7 = (num4 - num6) / (num4 - num3) * val3 + (num6 - num3) / (num4 - num3) * val4;
					Vector3 val8 = (num5 - num6) / (num5 - num4) * val4 + (num6 - num4) / (num5 - num4) * val5;
					Vector3 val9 = (num4 - num6) / (num4 - num2) * val6 + (num6 - num2) / (num4 - num2) * val7;
					Vector3 val10 = (num5 - num6) / (num5 - num3) * val7 + (num6 - num3) / (num5 - num3) * val8;
					samples.Add((num4 - num6) / (num4 - num3) * val9 + (num6 - num3) / (num4 - num3) * val10);
				}
			}
			samples.Add(loop ? samples[0] : cp[n - 1]);
			arc.Add(0f);
			Vector3 val11 = samples[0];
			Vector3 val12 = samples[0];
			for (int l = 1; l < samples.Count; l++)
			{
				Length += Vector3.Distance(samples[l - 1], samples[l]);
				arc.Add(Length);
				val11 = Vector3.Min(val11, samples[l]);
				val12 = Vector3.Max(val12, samples[l]);
			}
			boundsCenter = (val11 + val12) * 0.5f;
			Vector3 val13 = val12 - val11;
			boundsRadius = ((Vector3)(ref val13)).magnitude * 0.5f + 4f;
			Vector3 P(int num7)
			{
				//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_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: 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)
				if (loop)
				{
					return cp[(num7 % n + n) % n];
				}
				if (num7 < 0)
				{
					return cp[0] * 2f - cp[1];
				}
				if (num7 >= n)
				{
					return cp[n - 1] * 2f - cp[n - 2];
				}
				return cp[num7];
			}
		}

		private Vector3 Raw(float s)
		{
			//IL_00a0: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			if (loop)
			{
				s %= Length;
				if (s < 0f)
				{
					s += Length;
				}
			}
			s = Mathf.Clamp(s, 0f, Length);
			int num = 0;
			int num2 = arc.Count - 1;
			while (num2 - num > 1)
			{
				int num3 = (num + num2) / 2;
				if (arc[num3] <= s)
				{
					num = num3;
				}
				else
				{
					num2 = num3;
				}
			}
			float num4 = arc[num2] - arc[num];
			if (!(num4 > 0.0001f))
			{
				return samples[num];
			}
			return Vector3.Lerp(samples[num], samples[num2], (s - arc[num]) / num4);
		}

		public Vector3 Point(float s, out Vector3 tangent)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//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)
			tangent = Vector3.forward;
			if (samples.Count < 2 || Length <= 0f)
			{
				return ((Component)this).transform.position;
			}
			Vector3 result = Raw(s);
			float num = Mathf.Min(1f, Length * 0.25f);
			Vector3 val = Raw(loop ? (s + num) : Mathf.Min(s + num, Length)) - Raw(loop ? (s - num) : Mathf.Max(s - num, 0f));
			if (((Vector3)(ref val)).sqrMagnitude > 1E-06f)
			{
				tangent = ((Vector3)(ref val)).normalized;
			}
			return result;
		}

		public float Closest(Vector3 p, out float sOut, out Vector3 point)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_008c: 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_00ad: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			sOut = 0f;
			point = Vector3.zero;
			if (samples.Count >= 2)
			{
				Vector3 val = p - boundsCenter;
				if (!(((Vector3)(ref val)).sqrMagnitude > (boundsRadius + 6f) * (boundsRadius + 6f)))
				{
					float num = float.MaxValue;
					for (int i = 0; i < samples.Count - 1; i++)
					{
						Vector3 val2 = samples[i];
						Vector3 val3 = samples[i + 1] - val2;
						float num2 = Mathf.Clamp01(Vector3.Dot(p - val2, val3) / Mathf.Max(((Vector3)(ref val3)).sqrMagnitude, 1E-05f));
						Vector3 val4 = val2 + val3 * num2;
						val = p - val4;
						float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
						if (sqrMagnitude < num)
						{
							num = sqrMagnitude;
							point = val4;
							sOut = Mathf.Lerp(arc[i], arc[i + 1], num2);
						}
					}
					return Mathf.Sqrt(num);
				}
			}
			return float.MaxValue;
		}

		public static bool UnderAim(Ray aim, float range, float maxAngle, out GrindRail rail, out float s, out Vector3 point, out float angle)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			rail = null;
			s = 0f;
			point = Vector3.zero;
			angle = maxAngle;
			foreach (GrindRail item in All)
			{
				if (!Object.op_Implicit((Object)(object)item) || item.samples.Count < 2)
				{
					continue;
				}
				for (int i = 0; i < item.samples.Count; i++)
				{
					Vector3 val = item.samples[i] - ((Ray)(ref aim)).origin;
					float magnitude = ((Vector3)(ref val)).magnitude;
					if (!(magnitude < 3f) && !(magnitude > range))
					{
						float num = Vector3.Angle(((Ray)(ref aim)).direction, val);
						if (!(num >= angle))
						{
							angle = num;
							rail = item;
							point = item.samples[i];
							s = item.arc[i];
						}
					}
				}
			}
			if (Object.op_Implicit((Object)(object)rail))
			{
				Vector3 origin = ((Ray)(ref aim)).origin;
				Vector3 val2 = point;
				LayerIndex world = LayerIndex.world;
				if (Physics.Linecast(origin, val2, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
				{
					Vector3 origin2 = ((Ray)(ref aim)).origin;
					Vector3 val3 = point;
					world = LayerIndex.world;
					RaycastHit val4 = default(RaycastHit);
					if (Physics.Linecast(origin2, val3, ref val4, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
					{
						Vector3 val5 = ((RaycastHit)(ref val4)).point - point;
						if (((Vector3)(ref val5)).sqrMagnitude > 9f)
						{
							rail = null;
							return false;
						}
					}
				}
			}
			return Object.op_Implicit((Object)(object)rail);
		}

		public static GrindRail Make(Transform parent, string name, Vector3[] pts, bool loop = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, true);
			GrindRail grindRail = val.AddComponent<GrindRail>();
			grindRail.points = pts;
			grindRail.loop = loop;
			return grindRail;
		}
	}
	public static class Grinding
	{
		private class Grind
		{
			public GrindRail rail;

			public float s;

			public float dir = 1f;

			public float speed;

			public float boostCd;

			public Vector3 lastVel;

			public float cooldown;

			public GrindRail last;

			public CharacterMotor motor;

			public bool on;

			public float blend;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_PreMove <>9__13_0;

			public static hook_OnDestroy <>9__13_1;

			internal void <Hook>b__13_0(orig_PreMove orig, CharacterMotor self, float dt)
			{
				try
				{
					if (Tick(self, dt))
					{
						return;
					}
				}
				catch (Exception ex)
				{
					Debug.LogError((object)("[Rei] rail: " + ex));
					state.Remove(self);
				}
				orig.Invoke(self, dt);
			}

			internal void <Hook>b__13_1(orig_OnDestroy orig, CharacterMotor self)
			{
				state.Remove(self);
				orig.Invoke(self);
			}
		}

		private static readonly Dictionary<CharacterMotor, Grind> state = new Dictionary<CharacterMotor, Grind>();

		public const float FootOffset = 0.1f;

		private static bool hooked;

		public static event Action<CharacterMotor, bool> onGrindChanged;

		public static event Action<CharacterMotor> onGrindBoost;

		public static bool IsGrinding(CharacterBody b)
		{
			if (Object.op_Implicit((Object)(object)b) && Object.op_Implicit((Object)(object)b.characterMotor) && state.TryGetValue(b.characterMotor, out var value))
			{
				return Object.op_Implicit((Object)(object)value.rail);
			}
			return false;
		}

		public static bool IsGrinding(CharacterMotor m)
		{
			if (Object.op_Implicit((Object)(object)m) && state.TryGetValue(m, out var value))
			{
				return Object.op_Implicit((Object)(object)value.rail);
			}
			return false;
		}

		public static bool TryGetGrind(CharacterMotor m, out Vector3 dir, out float speed, out float lean)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			dir = Vector3.forward;
			speed = 0f;
			lean = 0f;
			if (!Object.op_Implicit((Object)(object)m) || !state.TryGetValue(m, out var value) || !Object.op_Implicit((Object)(object)value.rail))
			{
				return false;
			}
			value.rail.Point(value.s, out var tangent);
			value.rail.Point(value.s + value.dir * 3f, out var tangent2);
			dir = tangent * value.dir;
			speed = value.speed;
			Vector3 val = tangent * value.dir;
			Vector3 val2 = tangent2 * value.dir;
			val.y = 0f;
			val2.y = 0f;
			if (((Vector3)(ref val)).sqrMagnitude > 0.0001f && ((Vector3)(ref val2)).sqrMagnitude > 0.0001f)
			{
				lean = Mathf.Clamp(Vector3.SignedAngle(val, val2, Vector3.up) / 25f, -1f, 1f);
			}
			return true;
		}

		public static void Hook()
		{
			//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_002d: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			if (hooked)
			{
				return;
			}
			hooked = true;
			object obj = <>c.<>9__13_0;
			if (obj == null)
			{
				hook_PreMove val = delegate(orig_PreMove orig, CharacterMotor self, float dt)
				{
					try
					{
						if (Tick(self, dt))
						{
							return;
						}
					}
					catch (Exception ex)
					{
						Debug.LogError((object)("[Rei] rail: " + ex));
						state.Remove(self);
					}
					orig.Invoke(self, dt);
				};
				<>c.<>9__13_0 = val;
				obj = (object)val;
			}
			CharacterMotor.PreMove += (hook_PreMove)obj;
			object obj2 = <>c.<>9__13_1;
			if (obj2 == null)
			{
				hook_OnDestroy val2 = delegate(orig_OnDestroy orig, CharacterMotor self)
				{
					state.Remove(self);
					orig.Invoke(self);
				};
				<>c.<>9__13_1 = val2;
				obj2 = (object)val2;
			}
			CharacterMotor.OnDestroy += (hook_OnDestroy)obj2;
		}

		private static bool Eligible(CharacterMotor m)
		{
			CharacterBody body = m.body;
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive)
			{
				return false;
			}
			if (body.isPlayerControlled)
			{
				return true;
			}
			if (Object.op_Implicit((Object)(object)body.master))
			{
				return Object.op_Implicit((Object)(object)body.master.playerCharacterMasterController);
			}
			return false;
		}

		private static bool Tick(CharacterMotor m, float dt)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: 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_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: 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_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: 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_02f4: 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_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_067d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0684: Unknown result type (might be due to invalid IL or missing references)
			//IL_0689: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_0695: Unknown result type (might be due to invalid IL or missing references)
			//IL_0643: Unknown result type (might be due to invalid IL or missing references)
			//IL_0645: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0650: Unknown result type (might be due to invalid IL or missing references)
			//IL_0655: Unknown result type (might be due to invalid IL or missing references)
			//IL_0668: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_066e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: 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)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			if (!m.hasEffectiveAuthority)
			{
				return false;
			}
			if (GrindRail.All.Count == 0)
			{
				if (state.Count > 0)
				{
					state.Clear();
				}
				return false;
			}
			if (!state.TryGetValue(m, out var value))
			{
				if (!Eligible(m))
				{
					return false;
				}
				value = new Grind();
				state[m] = value;
			}
			if (value.cooldown > 0f)
			{
				value.cooldown -= dt;
			}
			if (value.on && !Object.op_Implicit((Object)(object)value.rail))
			{
				value.on = false;
				Grinding.onGrindChanged?.Invoke(m, arg2: false);
			}
			CharacterBody body = m.body;
			Vector3 footPosition = body.footPosition;
			Vector3 point;
			if (!Object.op_Implicit((Object)(object)value.rail))
			{
				if (value.cooldown > 0f || m.isGrounded || m.isFlying || dt <= 0f)
				{
					return false;
				}
				float num = 1.6f + ((Vector3)(ref m.velocity)).magnitude * dt;
				GrindRail grindRail = null;
				float num2 = num;
				float s = 0f;
				foreach (GrindRail item in GrindRail.All)
				{
					if (Object.op_Implicit((Object)(object)item))
					{
						float sOut;
						float num3 = item.Closest(footPosition, out sOut, out point);
						if (num3 < num2)
						{
							num2 = num3;
							grindRail = item;
							s = sOut;
						}
					}
				}
				if (!Object.op_Implicit((Object)(object)grindRail))
				{
					return false;
				}
				Attach(m, value, grindRail, s);
			}
			GrindRail rail = value.rail;
			rail.Point(value.s, out var tangent);
			if (value.boostCd > 0f)
			{
				value.boostCd -= dt;
			}
			if (m.isFlying || m.velocity.y > Mathf.Max(value.lastVel.y, 0f) + 6f)
			{
				if (!m.isFlying)
				{
					Vector3 val = tangent * value.dir * value.speed;
					Vector3 velocity = m.velocity;
					m.velocity = new Vector3(val.x, Mathf.Max(velocity.y, val.y + 4f), val.z) + new Vector3(velocity.x - value.lastVel.x, 0f, velocity.z - value.lastVel.z) * 0.5f;
				}
				Detach(value, 0.35f);
				return false;
			}
			Vector3 val2 = m.velocity - value.lastVel + m.rootMotion / Mathf.Max(dt, 0.001f);
			val2.y = 0f;
			if (((Vector3)(ref val2)).sqrMagnitude > 144f || ((Vector3)(ref m.rootMotion)).sqrMagnitude > 0.04f)
			{
				if (value.boostCd <= 0f)
				{
					float num4 = Vector3.Dot(val2, tangent * value.dir);
					if (num4 < -10f)
					{
						value.dir = 0f - value.dir;
						value.speed = Mathf.Max(rail.minSpeed, (0f - num4) * 0.6f);
					}
					else
					{
						value.speed += Mathf.Clamp(Mathf.Abs(num4) * 0.45f + ((Vector3)(ref val2)).magnitude * 0.1f, 5f, 22f);
					}
					value.boostCd = 0.35f;
					Grinding.onGrindBoost?.Invoke(m);
				}
				m.rootMotion = Vector3.zero;
			}
			float num5 = tangent.y * value.dir;
			value.speed -= 18f * rail.slopeGravity * num5 * dt;
			float num6 = Mathf.Max(rail.cruise, body.moveSpeed * 1.3f);
			if (value.speed < num6)
			{
				value.speed = Mathf.MoveTowards(value.speed, num6, 8f * dt);
			}
			else
			{
				value.speed = Mathf.MoveTowards(value.speed, num6, 2f * dt);
			}
			value.speed = Mathf.Clamp(value.speed, rail.minSpeed, 90f);
			value.s += value.dir * value.speed * dt;
			if (!rail.loop && (value.s < 0f || value.s > rail.Length))
			{
				Vector3 tangent2;
				Vector3 p = rail.Point(value.s, out tangent2);
				GrindRail grindRail2 = null;
				float s2 = 0f;
				float num7 = 3.5f;
				foreach (GrindRail item2 in GrindRail.All)
				{
					if (Object.op_Implicit((Object)(object)item2) && !((Object)(object)item2 == (Object)(object)rail))
					{
						float sOut2;
						float num8 = item2.Closest(p, out sOut2, out point);
						if (num8 < num7)
						{
							num7 = num8;
							grindRail2 = item2;
							s2 = sOut2;
						}
					}
				}
				if (!Object.op_Implicit((Object)(object)grindRail2))
				{
					m.velocity = tangent2 * value.dir * value.speed + Vector3.up * 8f;
					Detach(value, 0.5f);
					return false;
				}
				float speed = value.speed;
				Vector3 val3 = tangent2 * value.dir;
				Attach(m, value, grindRail2, s2);
				grindRail2.Point(s2, out var tangent3);
				value.dir = ((Vector3.Dot(tangent3, val3) >= 0f) ? 1f : (-1f));
				value.speed = speed;
				rail = value.rail;
			}
			Vector3 val4 = rail.Point(value.s, out tangent) + Vector3.up * 0.1f;
			float num9 = 1f / Mathf.Max(dt, 0.001f);
			Vector3 val5 = (val4 - footPosition) * num9;
			if (value.blend < 1f)
			{
				value.blend = Mathf.Min(1f, value.blend + dt / 0.2f);
				float num10 = value.blend * value.blend * (3f - 2f * value.blend);
				val5 = (Vector3.Lerp(footPosition + value.lastVel * dt, val4, Mathf.Lerp(0.25f, 1f, num10)) - footPosition) * num9;
			}
			m.velocity = Vector3.ClampMagnitude(val5, 160f);
			value.lastVel = m.velocity;
			m.jumpCount = 0;
			if (Object.op_Implicit((Object)(object)((BaseCharacterController)m).Motor))
			{
				((BaseCharacterController)m).Motor.ForceUnground(0.1f);
			}
			return true;
		}

		public static void AttachTo(CharacterMotor m, GrindRail r, float s, float speed)
		{
			if (Object.op_Implicit((Object)(object)m) && Object.op_Implicit((Object)(object)r))
			{
				if (!state.TryGetValue(m, out var value))
				{
					value = new Grind();
					state[m] = value;
				}
				value.cooldown = 0f;
				Attach(m, value, r, s);
				value.speed = Mathf.Max(new float[3] { value.speed, speed, r.minSpeed });
				value.blend = 0.4f;
			}
		}

		private static void Attach(CharacterMotor m, Grind g, GrindRail r, float s)
		{
			//IL_002b: 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_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_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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			bool num = Object.op_Implicit((Object)(object)g.rail);
			g.rail = r;
			g.s = s;
			if (!num)
			{
				g.blend = 0f;
			}
			r.Point(s, out var tangent);
			Vector3 velocity = m.velocity;
			float num2 = Vector3.Dot(velocity, tangent);
			if (Mathf.Abs(num2) < 2f && Object.op_Implicit((Object)(object)m.body.inputBank))
			{
				num2 = Vector3.Dot(m.body.inputBank.aimDirection, tangent);
			}
			g.dir = ((num2 >= 0f) ? 1f : (-1f));
			g.speed = Mathf.Max(Mathf.Abs(Vector3.Dot(velocity, tangent)) + ((Vector3)(ref velocity)).magnitude * 0.25f, r.minSpeed);
			g.lastVel = m.velocity;
			m.jumpCount = 0;
			g.motor = m;
			if (!num)
			{
				g.on = true;
				Grinding.onGrindChanged?.Invoke(m, arg2: true);
			}
		}

		private static void Detach(Grind g, float cooldown)
		{
			g.last = g.rail;
			g.rail = null;
			g.cooldown = cooldown;
			if (g.on)
			{
				g.on = false;
				if (Object.op_Implicit((Object)(object)g.motor))
				{
					Grinding.onGrindChanged?.Invoke(g.motor, arg2: false);
				}
			}
		}
	}
	public static class RailLook
	{
		private static Material src;

		private static Texture2D soft;

		private static Texture2D ramp;

		private static Texture2D dash;

		private static Shader hg;

		private static Texture2D white;

		private static Mesh sphere;

		public static Mesh Sphere
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)sphere))
				{
					GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0);
					sphere = obj.GetComponent<MeshFilter>().sharedMesh;
					Object.DestroyImmediate((Object)(object)obj);
				}
				return sphere;
			}
		}

		public static Material Material(Color c)
		{
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)src))
			{
				try
				{
					src = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matGenericFlash.mat").WaitForCompletion();
				}
				catch
				{
				}
				if (!Object.op_Implicit((Object)(object)src))
				{
					return null;
				}
				soft = new Texture2D(64, 64, (TextureFormat)4, true)
				{
					wrapMode = (TextureWrapMode)1
				};
				for (int i = 0; i < 64; i++)
				{
					for (int j = 0; j < 64; j++)
					{
						float num = Mathf.Abs(((float)i + 0.5f) / 32f - 1f);
						float num2 = Mathf.Clamp01(1f - num);
						num2 = num2 * num2 * (0.6f + 0.4f * num2);
						soft.SetPixel(j, i, new Color(1f, 1f, 1f, num2));
					}
				}
				soft.Apply(true);
				ramp = new Texture2D(256, 1, (TextureFormat)4, false)
				{
					wrapMode = (TextureWrapMode)1
				};
				for (int k = 0; k < 256; k++)
				{
					float num3 = (float)k / 255f;
					ramp.SetPixel(k, 0, new Color(num3, num3, num3, num3));
				}
				ramp.Apply();
			}
			Material val = new Material(src)
			{
				mainTexture = (Texture)(object)soft
			};
			if (val.HasProperty("_RemapTex"))
			{
				val.SetTexture("_RemapTex", (Texture)(object)ramp);
			}
			if (val.HasProperty("_Cloud1Tex"))
			{
				val.SetTexture("_Cloud1Tex", (Texture)null);
			}
			if (val.HasProperty("_Cloud2Tex"))
			{
				val.SetTexture("_Cloud2Tex", (Texture)null);
			}
			if (val.HasProperty("_TintColor"))
			{
				val.SetColor("_TintColor", c);
			}
			if (val.HasProperty("_Color"))
			{
				val.SetColor("_Color", c);
			}
			return val;
		}

		public static Material Flow(Color c)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			Material val = Material(new Color(c.r, c.g, c.b, 0.85f));
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			if (!Object.op_Implicit((Object)(object)dash))
			{
				dash = new Texture2D(64, 32, (TextureFormat)4, true)
				{
					wrapMode = (TextureWrapMode)0
				};
				for (int i = 0; i < 32; i++)
				{
					for (int j = 0; j < 64; j++)
					{
						float num = (float)j / 63f;
						float num2 = Mathf.Abs(((float)i + 0.5f) / 16f - 1f);
						float num3 = Mathf.Clamp01(1f - Mathf.Abs(num - 0.12f) / 0.1f);
						float num4 = ((num > 0.12f && num < 0.55f) ? (Mathf.Pow(1f - (num - 0.12f) / 0.43f, 2f) * 0.5f) : 0f);
						float num5 = Mathf.Max(num3, num4) * Mathf.Clamp01(1f - num2 * num2);
						dash.SetPixel(j, i, new Color(1f, 1f, 1f, num5));
					}
				}
				dash.Apply(true);
			}
			val.mainTexture = (Texture)(object)dash;
			return val;
		}

		public static Material Solid(Color c, float glow = 1f)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_003f: 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_004a: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_008c: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)hg))
			{
				hg = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard");
			}
			if (!Object.op_Implicit((Object)(object)hg))
			{
				return Material(c);
			}
			Material val = new Material(hg);
			val.SetColor("_Color", Color.Lerp(c, Color.white, 0.75f));
			val.SetFloat("_Smoothness", 0.85f);
			val.SetFloat("_SpecularStrength", 0.6f);
			if (!Object.op_Implicit((Object)(object)white))
			{
				white = new Texture2D(4, 4);
				Color[] array = (Color[])(object)new Color[16];
				for (int i = 0; i < 16; i++)
				{
					array[i] = Color.white;
				}
				white.SetPixels(array);
				white.Apply();
			}
			val.SetTexture("_EmTex", (Texture)(object)white);
			val.SetColor("_EmColor", c * 0.55f * glow);
			val.SetFloat("_EmPower", 1f);
			return val;
		}
	}
}
namespace HenryMod
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void ErrorAssetBundle(string assetName, string bundleName)
		{
			Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Friend.ReiSolarAsh", "Rei - Solar Ash", "1.1.23")]
	public class HenryPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.Friend.ReiSolarAsh";

		public const string MODNAME = "Rei - Solar Ash";

		public const string MODVERSION = "1.1.23";

		public const string DEVELOPER_PREFIX = "ELI";

		public static HenryPlugin instance;

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Language.Init();
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Soundbanks", "ReiBank.sound");
			if (File.Exists(text))
			{
				SoundBanks.Add(text);
			}
			else
			{
				Log.Warning("ReiBank.sound not found at " + text);
			}
			ReiNet.Register();
			new HenrySurvivor().Initialize();
			new ContentPacks().Initialize();
		}
	}
}
namespace HenryMod.Survivors.Henry
{
	public class HenrySurvivor : SurvivorBase<HenrySurvivor>
	{
		public const string HENRY_PREFIX = "ELI_REI_";

		public override string assetBundleName => "reibundle";

		public override string bodyName => "ReiBody";

		public override string masterName => "ReiMonsterMaster";

		public override string modelPrefabName => "mdlRei";

		public override string displayPrefabName => "ReiDisplay";

		public override string survivorTokenPrefix => "ELI_REI_";

		public override BodyInfo bodyInfo => new BodyInfo
		{
			bodyName = bodyName,
			bodyNameToken = "ELI_REI_NAME",
			subtitleNameToken = "ELI_REI_SUBTITLE",
			characterPortrait = (Texture)(((object)ReiIcons.Tex("texReiIcon")) ?? ((object)assetBundle.LoadAsset<Texture>("texHenryIcon"))),
			bodyColor = new Color(0f, 0.85f, 1f),
			sortPosition = 100f,
			crosshair = Asset.LoadCrosshair("Standard"),
			podPrefab = null,
			maxHealth = 110f,
			healthRegen = 1.5f,
			armor = 10f,
			moveSpeed = 5.8f,
			jumpCount = 2
		};

		public override CustomRendererInfo[] customRendererInfos => new CustomRendererInfo[7]
		{
			new CustomRendererInfo
			{
				childName = "ReiBody"
			},
			new CustomRendererInfo
			{
				childName = "ReiHead"
			},
			new CustomRendererInfo
			{
				childName = "ReiHair"
			},
			new CustomRendererInfo
			{
				childName = "ReiCape"
			},
			new CustomRendererInfo
			{
				childName = "ReiSuitLights"
			},
			new CustomRendererInfo
			{
				childName = "ReiEnergy"
			},
			new CustomRendererInfo
			{
				childName = "ReiMultitoolStatic"
			}
		};

		public override UnlockableDef characterUnlockableDef => HenryUnlockables.characterUnlockableDef;

		public override ItemDisplaysBase itemDisplays => new HenryItemDisplays();

		public override AssetBundle assetBundle { get; protected set; }

		public override GameObject bodyPrefab { get; protected set; }

		public override CharacterBody prefabCharacterBody { get; protected set; }

		public override GameObject characterModelObject { get; protected set; }

		public override CharacterModel prefabCharacterModel { get; protected set; }

		public override GameObject displayPrefab { get; protected set; }

		public override void Initialize()
		{
			base.Initialize();
		}

		public override void InitializeCharacter()
		{
			ReiConfig.Init(((BaseUnityPlugin)HenryPlugin.instance).Config);
			base.InitializeCharacter();
			HenryTokens.Init();
			ReiAssets.Init(assetBundle);
			try
			{
				ReiGlint.InitVisual();
			}
			catch (Exception ex)
			{
				Log.Error("[Rei] glint visual failed: " + ex);
			}
			Content.AddEntityState(typeof(ReiMain));
			Content.AddEntityState(typeof(ReiArrival));
			Content.AddEntityState(typeof(ReiWakeUp));
			Content.AddEntityState(typeof(ReiWakeRecover));
			Content.AddEntityState(typeof(ReiDeath));
			Content.AddEntityState(typeof(ReiCombo));
			Content.AddEntityState(typeof(ReiFireHook));
			Content.AddEntityState(typeof(ReiGrapple));
			Content.AddEntityState(typeof(NeedleStab));
			Content.AddEntityState(typeof(BoostDash));
			Content.AddEntityState(typeof(ReiVolley));
			Content.AddEntityState(typeof(ReiCrescentWave));
			Content.AddEntityState(typeof(ReiCrescentWaveThrow));
			Content.AddEntityState(typeof(GooBoost));
			Content.AddEntityState(typeof(RemnantFinale));
			Content.AddEntityState(typeof(EchoRush));
			Content.AddEntityState(typeof(NeedleFlurry));
			Content.AddEntityState(typeof(RemnantZip));
			InitializeEntityStateMachines();
			InitializeSkills();
			InitializeSkins();
			InitializeCharacterMaster();
			AdditionalBodySetup();
			AddHooks();
		}

		private void AdditionalBodySetup()
		{
			//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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			AddHitboxes();
			bodyPrefab.AddComponent<ReiSkateController>();
			CharacterDeathBehavior component = bodyPrefab.GetComponent<CharacterDeathBehavior>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.deathState = new SerializableEntityStateType(typeof(ReiDeath));
			}
			CharacterBody component2 = bodyPrefab.GetComponent<CharacterBody>();
			component2.bodyFlags = (BodyFlags)(component2.bodyFlags | 1);
			bodyPrefab.AddComponent<ReiReactions>();
			bodyPrefab.AddComponent<ReiChatter>();
			bodyPrefab.AddComponent<ReiKills>();
			bodyPrefab.AddComponent<ReiGoo>();
			bodyPrefab.AddComponent<ReiRemnantRush>();
			bodyPrefab.AddComponent<ReiEcho>();
			HuntressTracker obj = bodyPrefab.AddComponent<HuntressTracker>();
			obj.maxTrackingDistance = 50f;
			obj.maxTrackingAngle = 25f;
			obj.trackerUpdateFrequency = 10f;
			obj.trackingPrefab = (Object.op_Implicit((Object)(object)ReiAssets.trackingIndicator) ? ReiAssets.trackingIndicator : LegacyResourcesAPI.Load<GameObject>("Prefabs/HuntressTrackingIndicator"));
			((Component)prefabCharacterModel).gameObject.AddComponent<ReiSmokeHair>();
			((Component)prefabCharacterModel).gameObject.AddComponent<ReiBlade>();
			if (Object.op_Implicit((Object)(object)((Component)prefabCharacterModel).GetComponent<Animator>()))
			{
				((Component)prefabCharacterModel).gameObject.AddComponent<ReiRootMotionSink>();
			}
			((Component)prefabCharacterModel).gameObject.AddComponent<ReiCapePhysics>();
			if (Object.op_Implicit((Object)(object)displayPrefab))
			{
				displayPrefab.AddComponent<ReiSmokeHair>();
			}
			if (Object.op_Implicit((Object)(object)displayPrefab))
			{
				displayPrefab.AddComponent<ReiCapePhysics>();
			}
		}

		public void AddHitboxes()
		{
			Prefabs.SetupHitBoxGroup(characterModelObject, "SwordGroup", "SwordHitbox");
		}

		public override void InitializeEntityStateMachines()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			Prefabs.ClearEntityStateMachines(bodyPrefab);
			Prefabs.AddMainEntityStateMachine(bodyPrefab, "Body", typeof(ReiMain), typeof(ReiArrival));
			bodyPrefab.GetComponent<CharacterBody>().preferredInitialStateType = new SerializableEntityStateType(typeof(ReiArrival));
			Prefabs.AddEntityStateMachine(bodyPrefab, "Weapon");
			Prefabs.AddEntityStateMachine(bodyPrefab, "Weapon2");
			Prefabs.AddEntityStateMachine(bodyPrefab, "Hook");
			Prefabs.AddEntityStateMachine(bodyPrefab, "GooBoost");
		}

		public override void InitializeSkills()
		{
			//IL_0018: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			Skills.ClearGenericSkills(bodyPrefab);
			bodyPrefab.GetComponent<SkillLocator>().passiveSkill = new PassiveSkill
			{
				enabled = true,
				skillNameToken = "ELI_REI_PASSIVE_NAME",
				skillDescriptionToken = "ELI_REI_PASSIVE_DESCRIPTION",
				icon = ReiIcons.Sprite("texReiPassive", assetBundle.LoadAsset<Sprite>("texPassiveIcon"))
			};
			AddPrimarySkills();
			AddSecondarySkills();
			AddUtiitySkills();
			AddSpecialSkills();
		}

		private void AddPassiveSkill()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			bodyPrefab.GetComponent<SkillLocator>().passiveSkill = new PassiveSkill
			{
				enabled = true,
				skillNameToken = "ELI_REI_PASSIVE_NAME",
				skillDescriptionToken = "ELI_REI_PASSIVE_DESCRIPTION",
				keywordToken = "KEYWORD_STUNNING",
				icon = assetBundle.LoadAsset<Sprite>("texPassiveIcon")
			};
			GenericSkill val = Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, "PassiveSkill");
			SkillDefInfo skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "HenryPassive";
			skillDefInfo.skillNameToken = "ELI_REI_PASSIVE_NAME";
			skillDefInfo.skillDescriptionToken = "ELI_REI_PASSIVE_DESCRIPTION";
			skillDefInfo.keywordTokens = new string[1] { "KEYWORD_AGILE" };
			skillDefInfo.skillIcon = assetBundle.LoadAsset<Sprite>("texPassiveIcon");
			SkillDef val2 = Skills.CreateSkillDef(skillDefInfo);
			Skills.AddSkillsToFamily(val.skillFamily, val2);
		}

		private void AddPrimarySkills()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)0);
			SteppedSkillDef val = Skills.CreateSkillDef<SteppedSkillDef>(new SkillDefInfo("ReiCombo", "ELI_REI_PRIMARY_SLASH_NAME", "ELI_REI_PRIMARY_SLASH_DESCRIPTION", ReiIcons.Sprite("texReiPrimary", assetBundle.LoadAsset<Sprite>("texPrimaryIcon")), new SerializableEntityStateType(typeof(ReiCombo)), "Weapon", agile: true));
			val.stepCount = 3;
			val.stepGraceDuration = 0.25f;
			SteppedSkillDef val2 = Skills.CreateSkillDef<SteppedSkillDef>(new SkillDefInfo("ReiVolley", "ELI_REI_PRIMARY_VOLLEY_NAME", "ELI_REI_PRIMARY_VOLLEY_DESCRIPTION", ReiIcons.Sprite("texReiPrimaryAlt", ReiIcons.Sprite("texReiPrimary", assetBundle.LoadAsset<Sprite>("texPrimaryIcon"))), new SerializableEntityStateType(typeof(ReiVolley)), "Weapon", agile: true));
			val2.stepCount = 3;
			val2.stepGraceDuration = 0.4f;
			Skills.AddPrimarySkills(bodyPrefab, (SkillDef)val, (SkillDef)val2);
		}

		private void AddSecondarySkills()
		{
			//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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)1);
			SkillDef val = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "ReiGrapple",
				skillNameToken = "ELI_REI_SECONDARY_GUN_NAME",
				skillDescriptionToken = "ELI_REI_SECONDARY_GUN_DESCRIPTION",
				skillIcon = ReiIcons.Sprite("texReiSecondary", assetBundle.LoadAsset<Sprite>("texSecondaryIcon")),
				activationState = new SerializableEntityStateType(typeof(ReiGrapple)),
				activationStateMachineName = "Body",
				interruptPriority = (InterruptPriority)2,
				baseRechargeInterval = 7f,
				baseMaxStock = 1,
				rechargeStock = 1,
				requiredStock = 1,
				stockToConsume = 1,
				resetCooldownTimerOnUse = false,
				fullRestockOnAssign = true,
				dontAllowPastMaxStocks = false,
				mustKeyPress = true,
				beginSkillCooldownOnSkillEnd = false,
				isCombatSkill = true,
				canceledFromSprinting = false,
				cancelSprintingOnActivation = false,
				forceSprintDuringState = false
			});
			SkillDef val2 = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "ReiCrescentWave",
				skillNameToken = "ELI_REI_SECONDARY_WAVE_NAME",
				skillDescriptionToken = "ELI_REI_SECONDARY_WAVE_DESCRIPTION",
				skillIcon = ReiIcons.Sprite("texReiSecondaryAlt", ReiIcons.Sprite("texReiSecondary", assetBundle.LoadAsset<Sprite>("texSecondaryIcon"))),
				activationState = new SerializableEntityStateType(typeof(ReiCrescentWave)),
				activationStateMachineName = "Weapon2",
				interruptPriority = (InterruptPriority)1,
				baseRechargeInterval = 5f,
				baseMaxStock = 1,
				rechargeStock = 1,
				requiredStock = 1,
				stockToConsume = 1,
				fullRestockOnAssign = true,
				mustKeyPress = true,
				isCombatSkill = true,
				canceledFromSprinting = false,
				cancelSprintingOnActivation = false,
				forceSprintDuringState = false
			});
			Skills.AddSecondarySkills(bodyPrefab, val, val2);
		}

		private void AddUtiitySkills()
		{
			//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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)2);
			SkillDef val = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "ReiBoostDash",
				skillNameToken = "ELI_REI_UTILITY_ROLL_NAME",
				skillDescriptionToken = "ELI_REI_UTILITY_ROLL_DESCRIPTION",
				skillIcon = ReiIcons.Sprite("texReiUtility", assetBundle.LoadAsset<Sprite>("texUtilityIcon")),
				activationState = new SerializableEntityStateType(typeof(BoostDash)),
				activationStateMachineName = "Body",
				interruptPriority = (InterruptPriority)2,
				baseRechargeInterval = 7f,
				baseMaxStock = 3,
				rechargeStock = 1,
				requiredStock = 1,
				stockToConsume = 1,
				resetCooldownTimerOnUse = false,
				fullRestockOnAssign = true,
				dontAllowPastMaxStocks = false,
				mustKeyPress = false,
				beginSkillCooldownOnSkillEnd = false,
				isCombatSkill = false,
				canceledFromSprinting = false,
				cancelSprintingOnActivation = false,
				forceSprintDuringState = true
			});
			SkillDef val2 = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "ReiGooBoost",
				skillNameToken = "ELI_REI_UTILITY_GOOBOOST_NAME",
				skillDescriptionToken = "ELI_REI_UTILITY_GOOBOOST_DESCRIPTION",
				skillIcon = ReiIcons.Sprite("texReiUtilityAlt", ReiIcons.Sprite("texReiUtility", assetBundle.LoadAsset<Sprite>("texUtilityIcon"))),
				activationState = new SerializableEntityStateType(typeof(GooBoost)),
				activationStateMachineName = "GooBoost",
				interruptPriority = (InterruptPriority)0,
				baseRechargeInterval = 0.5f,
				baseMaxStock = 1,
				rechargeStock = 1,
				requiredStock = 0,
				stockToConsume = 0,
				fullRestockOnAssign = true,
				mustKeyPress = true,
				isCombatSkill = false,
				canceledFromSprinting = false,
				cancelSprintingOnActivation = false,
				forceSprintDuringState = true
			});
			Skills.AddUtilitySkills(bodyPrefab, val, val2);
		}

		private void AddSpecialSkills()
		{
			//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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)3);
			SkillDef val = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "ReiNeedle",
				skillNameToken = "ELI_REI_SPECIAL_BOMB_NAME",
				skillDescriptionToken = "ELI_REI_SPECIAL_BOMB_DESCRIPTION",
				skillIcon = ReiIcons.Sprite("texReiSpecial", assetBundle.LoadAsset<Sprite>("texSpecialIcon")),
				activationState = new SerializableEntityStateType(typeof(NeedleStab)),
				activationStateMachineName = "Body",
				interruptPriority = (InterruptPriority)2,
				baseMaxStock = 1,
				baseRechargeInterval = 9f,
				isCombatSkill = true,
				mustKeyPress = false,
				cancelSprintingOnActivation = false
			});
			ReiRemnantRush.strikeSkillDef = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "ReiRemnantStrike",
				skillNameToken = "ELI_REI_SPECIAL_STRIKE_NAME",
				skillDescriptionToken = "ELI_REI_SPECIAL_STRIKE_DESCRIPTION",
				skillIcon = ReiIcons.Sprite("texReiSpecialStrike", ReiIcons.Sprite("texReiSpecial", assetBundle.LoadAsset<Sprite>("texSpecialIcon"))),
				activationState = new SerializableEntityStateType(typeof(RemnantZip)),
				activationStateMachineName = "Body",
				interruptPriority = (InterruptPriority)2,
				baseMaxStock = 1,
				baseRechargeInterval = 0.5f,
				isCombatSkill = true,
				mustKeyPress = true,
				fullRestockOnAssign = true,
				cancelSprintingOnActivation = false,
				canceledFromSprinting = false
			});
			SkillDef val2 = Skills.CreateSkillDef(new SkillDefInfo
			{
				skillName = "ReiEchoRush",
				skillNameToken = "ELI_REI_SPECIAL_ECHO_NAME",
				skillDescriptionToken = "ELI_REI_SPECIAL_ECHO_DESCRIPTION",
				skillIcon = ReiIcons.Sprite("texReiSpecialEcho", ReiIcons.Sprite("texReiSpecial", assetBundle.LoadAsset<Sprite>("texSpecialIcon"))),
				activationState = new SerializableEntityStateType(typeof(EchoRush)),
				activationStateMachineName = "Weapon2",
				interruptPriority = (InterruptPriority)0,
				baseMaxStock = 1,
				baseRechargeInterval = 16f,
				isCombatSkill = false,
				mustKeyPress = true,
				cancelSprintingOnActivation = false,
				canceledFromSprinting = false
			});
			Skills.AddSpecialSkills(bodyPrefab, val, val2);
		}

		public override void InitializeSkins()
		{
			ModelSkinController val = ((Component)prefabCharacterModel).gameObject.AddComponent<ModelSkinController>();
			ChildLocator component = ((Component)prefabCharacterModel).GetComponent<ChildLocator>();
			RendererInfo[] baseRendererInfos = prefabCharacterModel.baseRendererInfos;
			List<SkinDef> list = new List<SkinDef>();
			SkinDef val2 = Skins.CreateSkinDef("DEFAULT_SKIN", ReiSkins.Icon("Default"), baseRendererInfos, ((Component)prefabCharacterModel).gameObject);
			list.Add(val2);
			try
			{
				ReiSkins.Add(list, prefabCharacterModel, component, val2);
			}
			catch (Exception ex)
			{
				Log.Error("[Rei] skins failed: " + ex);
			}
			ReiSkins.Tokens();
			val.skins = list.ToArray();
			if (!Object.op_Implicit((Object)(object)displayPrefab))
			{
				return;
			}
			CharacterModel component2 = displayPrefab.GetComponent<CharacterModel>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				Renderer[] componentsInChildren = displayPrefab.GetComponentsInChildren<Renderer>(true);
				RendererInfo[] baseRendererInfos2 = component2.baseRendererInfos;
				for (int i = 0; i < baseRendererInfos2.Length; i++)
				{
					string n = (Object.op_Implicit((Object)(object)baseRendererInfos2[i].renderer) ? ((Object)baseRendererInfos2[i].renderer).name : null);
					Renderer val3 = ((n == null) ? null : Array.Find(componentsInChildren, (Renderer r) => ((Object)r).name == n));
					if (Object.op_Implicit((Object)(object)val3))
					{
						baseRendererInfos2[i].renderer = val3;
					}
				}
				component2.baseRendererInfos = baseRendererInfos2;
			}
			ModelSkinController val4 = displayPrefab.GetComponent<ModelSkinController>();
			if (!Object.op_Implicit((Object)(object)val4))
			{
				val4 = displayPrefab.AddComponent<ModelSkinController>();
			}
			val4.skins = val.skins;
		}

		public override void InitializeCharacterMaster()
		{
			HenryAI.Init(bodyPrefab, masterName);
		}

		private void AddHooks()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
			ReiSkateController.HookStats();
			ReiReactions.Hook();
			ReiChatter.Hook();
			ReiKills.Hook();
			ReiGlint.Hook();
			ReiGoo.Hook();
			ReiEcho.Hook();
			ReiAnimGuard.Hook();
			ReiDamageLog.Hook();
			Grinding.Hook();
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			ReiSkateController component = ((Component)sender).GetComponent<ReiSkateController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				args.moveSpeedMultAdd += component.Bonus;
			}
			if (Object.op_Implicit((Object)(object)component) && component.Amped)
			{
				args.attackSpeedMultAdd += 0.4f * (float)component.AmpStacks;
				args.moveSpeedMultAdd += 0.33f;
			}
			if (Object.op_Implicit((Object)(object)component) && component.gooBoosting)
			{
				args.armorAdd += 30f;
			}
		}
	}
	public static class HenryTokens
	{
		public static void Init()
		{
			AddHenryTokens();
		}

		public static void AddHenryTokens()
		{
			string text = "ELI_REI_";
			string text2 = "Rei is the last Voidrunner: a skater who turns speed into damage. The longer she keeps moving, the faster and deadlier she gets.<color=#CCD3E0>" + Environment.NewLine + Environment.NewLine + "< ! > Keep moving. Rei builds momentum while she skates, and keeps it through the air and along walls." + Environment.NewLine + Environment.NewLine + "< ! > Grapple kills refresh the Grapple. Chain enemies together to cross the map without touching the ground." + Environment.NewLine + Environment.NewLine + "< ! > Boost and Crescent Wave each grant Amp. Land both for Double Amp." + Environment.NewLine + Environment.NewLine + "< ! > When a Remnant Trial starts, chase the crystals. Clearing it unlocks Final Strike." + Environment.NewLine + Environment.NewLine;
			string text3 = "..and so she left, still searching for a way home.";
			string text4 = "..and so she vanished into the Ultravoid.";
			Language.Add(text + "NAME", "Rei");
			Language.Add(text + "DESCRIPTION", text2);
			Language.Add(text + "SUBTITLE", "The Last Voidrunner");
			Language.Add(text + "LORE", "A Voidrunner who dove into the Ultravoid to save her world.");
			Language.Add(text + "OUTRO_FLAVOR", text3);
			Language.Add(text + "OUTRO_FAILURE", text4);
			Language.Add(text + "MASTERY_SKIN_NAME", "Alternate");
			Language.Add(text + "PASSIVE_NAME", "Voidrunner");
			Language.Add(text + "PASSIVE_DESCRIPTION", "Rei <style=cIsUtility>skates</style> whenever she moves, building <style=cIsUtility>momentum</style> up to <style=cIsUtility>+50% move speed</style>. She glides, <style=cIsUtility>wallrides</style>, <style=cIsUtility>double jumps</style> and ignores fall damage.\n\n<style=cIsUtility>Remnant Trial</style>: every 1-3 minutes a trial begins. Slash <style=cIsUtility>4 crystals</style> before time runs out to turn your special into <style=cIsDamage>Final Strike</style> for 15s. Fail, and another trial starts in 20s.");
			Language.Add(text + "PRIMARY_SLASH_NAME", "Multitool Combo");
			Language.Add(text + "PRIMARY_SLASH_DESCRIPTION", "<style=cIsUtility>Agile.</style>" + $"Slash for <style=cIsDamage>{230f}%</style>, <style=cIsDamage>{230f}%</style> and <style=cIsDamage>{380f}% damage</style>, zipping to the enemy you face.");
			Language.Add(text + "PRIMARY_VOLLEY_NAME", "Glint Volley");
			Language.Add(text + "PRIMARY_VOLLEY_DESCRIPTION", "<style=cIsUtility>Agile.</style>" + $"Flick <style=cIsUtility>seeking</style> needles for <style=cIsDamage>{140f}% damage</style>. Every 3rd throws <style=cIsDamage>3 bursting needles</style> for <style=cIsDamage>{90f}%</style>.");
			Language.Add(text + "SECONDARY_WAVE_NAME", "Crescent Wave");
			Language.Add(text + "SECONDARY_WAVE_DESCRIPTION", $"<style=cIsUtility>Charge</style> on the move and hurl a <style=cIsDamage>piercing</style> slash for <style=cIsDamage>{400f}%-{900f}% damage</style>. Release right at full charge to <style=cIsDamage>crit</style> and <style=cIsUtility>refund cooldown</style>. Enemies it passes through <style=cIsDamage>Glint</style>: <style=cIsDamage>+{20f}% damage taken</style> for {6f}s. Cut <style=cIsDamage>3 enemies</style> to gain <style=cIsDamage>Amp</style>, stacking with Boost's.");
			Language.Add(text + "SECONDARY_GUN_NAME", "Grapple");
			Language.Add(text + "SECONDARY_GUN_DESCRIPTION", $"Tether to an <style=cIsDamage>enemy</style> to zip in and strike for <style=cIsDamage>{440f}% damage</style>, or to a <style=cIsUtility>surface</style> to be pulled straight to it. <style=cIsUtility>Kills refresh it.</style>");
			Language.Add(text + "UTILITY_ROLL_NAME", "Boost");
			Language.Add(text + "UTILITY_ROLL_DESCRIPTION", $"<style=cIsUtility>Burst forward</style> for <style=cIsDamage>{250f}% damage</style> and a <style=cIsHealing>barrier</style>. For 3s, gain <style=cIsDamage>Amp</style>: <style=cIsDamage>+{25f}% damage</style>, <style=cIsDamage>+40% attack speed</style> and <style=cIsUtility>+33% move speed</style>.");
			Language.Add(text + "SPECIAL_BOMB_NAME", "Needle");
			Language.Add(text + "SPECIAL_BOMB_DESCRIPTION", $"Leap onto the targeted enemy and stab for <style=cIsDamage>{1500f}% damage</style>, <style=cIsDamage>x{2f}</style> under 33% health. <style=cIsDamage>Attack speed</style> makes it hit harder. <style=cIsUtility>Kills refund it</style> (up to 3 in a row). After a <style=cIsDamage>Final Strike</style>, your next {5} Needles open with its <style=cIsDamage>flurry</style>.");
			Language.Add(text + "UTILITY_GOOBOOST_NAME", "Goo Boost");
			Language.Add(text + "UTILITY_GOOBOOST_DESCRIPTION", $"<style=cIsUtility>Hold</style> to burn goo and boost past your top speed, <style=cIsDamage>Amped</style> the whole time, with <style=cIsUtility>+{30f} armor</style>. Ram enemies for <style=cIsDamage>{200f}%</style>. Goo fills from kills and skating.");
			Language.Add(text + "SPECIAL_STRIKE_NAME", "Final Strike");
			Language.Add(text + "SPECIAL_ECHO_NAME", "Echo Rush");
			Language.Add(text + "SPECIAL_ECHO_DESCRIPTION", $"For <style=cIsUtility>{7f}s</style>, a hard-light echo follows <style=cIsUtility>0.2s</style> behind you and <style=cIsDamage>repeats everything you do</style>: every hit lands again for <style=cIsDamage>{35f}%</style> of its damage. <style=cIsDamage>Final Strike</style> always sets it off for free, and your next {3} casts bring <style=cIsDamage>2 more echoes</style> (0.4s and 0.6s behind, {20f}% each).");
			Language.Add(text + "SPECIAL_STRIKE_DESCRIPTION", $"<style=cIsUtility>Tether</style> to the locked enemy and unleash a flurry of slashes, then plunge for <style=cIsDamage>{3800f}% damage</style>. <style=cIsUtility>Resets your other skills.</style>");
		}
	}
	public static class HenryUnlockables
	{
		public static UnlockableDef characterUnlockableDef;

		public static UnlockableDef masterySkinUnlockableDef;
	}
	public static class HenryAI
	{
		public static void Init(GameObject bodyPrefab, string masterName)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: 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_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: 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_02a4: 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_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			GameObject obj = Prefabs.CreateBlankMasterPrefab(bodyPrefab, masterName);
			BaseAI component = obj.GetComponent<BaseAI>();
			component.aimVectorDampTime = 0.1f;
			component.aimVectorMaxSpeed = 360f;
			AISkillDriver obj2 = obj.AddComponent<AISkillDriver>();
			obj2.customName = "Use Primary Swing";
			obj2.skillSlot = (SkillSlot)0;
			obj2.requiredSkill = null;
			obj2.requireSkillReady = false;
			obj2.requireEquipmentReady = false;
			obj2.minUserHealthFraction = float.NegativeInfinity;
			obj2.maxUserHealthFraction = float.PositiveInfinity;
			obj2.minTargetHealthFraction = float.NegativeInfinity;
			obj2.maxTargetHealthFraction = float.PositiveInfinity;
			obj2.minDistance = 0f;
			obj2.maxDistance = 8f;
			obj2.selectionRequiresTargetLoS = false;
			obj2.selectionRequiresOnGround = false;
			obj2.selectionRequiresAimTarget = false;
			obj2.maxTimesSelected = -1;
			obj2.moveTargetType = (TargetType)0;
			obj2.activationRequiresTargetLoS = false;
			obj2.activationRequiresAimTargetLoS = false;
			obj2.activationRequiresAimConfirmation = false;
			obj2.movementType = (MovementType)1;
			obj2.moveInputScale = 1f;
			obj2.aimType = (AimType)1;
			obj2.ignoreNodeGraph = false;
			obj2.shouldSprint = false;
			obj2.shouldFireEquipment = false;
			obj2.buttonPressType = (ButtonPressType)0;
			obj2.driverUpdateTimerOverride = -1f;
			obj2.resetCurrentEnemyOnNextDriverSelection = false;
			obj2.noRepeat = false;
			obj2.nextHighPriorityOverride = null;
			AISkillDriver obj3 = obj.AddComponent<AISkillDriver>();
			obj3.customName = "Use Secondary Shoot";
			obj3.skillSlot = (SkillSlot)1;
			obj3.requireSkillReady = true;
			obj3.minDistance = 0f;
			obj3.maxDistance = 25f;
			obj3.selectionRequiresTargetLoS = false;
			obj3.selectionRequiresOnGround = false;
			obj3.selectionRequiresAimTarget = false;
			obj3.maxTimesSelected = -1;
			obj3.moveTargetType = (TargetType)0;
			obj3.activationRequiresTargetLoS = false;
			obj3.activationRequiresAimTargetLoS = false;
			obj3.activationRequiresAimConfirmation = true;
			obj3.movementType = (MovementType)1;
			obj3.moveInputScale = 1f;
			obj3.aimType = (AimType)1;
			obj3.buttonPressType = (ButtonPressType)0;
			AISkillDriver obj4 = obj.AddComponent<AISkillDriver>();
			obj4.customName = "Use Utility Roll";
			obj4.skillSlot = (SkillSlot)2;
			obj4.requireSkillReady = true;
			obj4.minDistance = 8f;
			obj4.maxDistance = 20f;
			obj4.selectionRequiresTargetLoS = true;
			obj4.selectionRequiresOnGround = false;
			obj4.selectionRequiresAimTarget = false;
			obj4.maxTimesSelected = -1;
			obj4.moveTargetType = (TargetType)0;
			obj4.activationRequiresTargetLoS = false;
			obj4.activationRequiresAimTargetLoS = false;
			obj4.activationRequiresAimConfirmation = false;
			obj4.movementType = (MovementType)2;
			obj4.moveInputScale = 1f;
			obj4.aimType = (AimType)1;
			obj4.buttonPressType = (ButtonPressType)0;
			AISkillDriver obj5 = obj.AddComponent<AISkillDriver>();
			obj5.customName = "Use Special bomb";
			obj5.skillSlot = (SkillSlot)3;
			obj5.requireSkillReady = true;
			obj5.minDistance = 0f;
			obj5.maxDistance = 20f;
			obj5.selectionRequiresTargetLoS = false;
			obj5.selectionRequiresOnGround = false;
			obj5.selectionRequiresAimTarget = false;
			obj5.maxTimesSelected = -1;
			obj5.moveTargetType = (TargetType)0;
			obj5.activationRequiresTargetLoS = false;
			obj5.activationRequiresAimTargetLoS = false;
			obj5.activationRequiresAimConfirmation = false;
			obj5.movementType = (MovementType)1;
			obj5.moveInputScale = 1f;
			obj5.aimType = (AimType)1;
			obj5.buttonPressType = (ButtonPressType)0;
			AISkillDriver obj6 = obj.AddComponent<AISkillDriver>();
			obj6.customName = "Chase";
			obj6.skillSlot = (SkillSlot)(-1);
			obj6.requireSkillReady = false;
			obj6.minDistance = 0f;
			obj6.maxDistance = float.PositiveInfinity;
			obj6.moveTargetType = (TargetType)0;
			obj6.activationRequiresTargetLoS = false;
			obj6.activationRequiresAimTargetLoS = false;
			obj6.activationRequiresAimConfirmation = false;
			obj6.movementType = (MovementType)1;
			obj6.moveInputScale = 1f;
			obj6.aimType = (AimType)1;
			obj6.buttonPressType = (ButtonPressType)0;
		}
	}
	public class HenryItemDisplays : ItemDisplaysBase
	{
		protected override void SetItemDisplayRules(List<KeyAssetRuleGroup> itemDisplayRules)
		{
			//IL_0036: 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_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_006d: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: 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_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: 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_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0289: 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_02b1: 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_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: 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_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or miss