Decompiled source of DiamondPeasant v1.2.0

DiamondPeasant.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using DM;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.GameMode;
using Landfall.TABS.GameState;
using Landfall.TABS.Services;
using Landfall.TABS.UnitPlacement;
using Landfall.TABS.WinConditions;
using Microsoft.CodeAnalysis;
using TFBGames;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.LowLevel;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace G1
{
	[BepInPlugin("okbro11.tabs", "OkBro11", "1.2.0")]
	public sealed class Main : BaseUnityPlugin
	{
		private sealed class CollisionPair
		{
			internal Collider A;

			internal Collider B;
		}

		private sealed class StatueEraseVisual : MonoBehaviour
		{
			private struct Part
			{
				internal Transform Transform;

				internal Vector3 BaseLocal;

				internal Vector3 Axis;

				internal int Side;
			}

			private readonly List<Part> Parts = new List<Part>(32);

			private float Started;

			private float Duration = 0.72f;

			private float SplitStart = 0.23f;

			private Material[] Materials;

			internal void Function240(Unit target)
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Expected O, but got Unknown
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Expected O, but got Unknown
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: 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_01d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Expected O, but got Unknown
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				Started = Time.unscaledTime;
				Renderer[] componentsInChildren = ((Component)target).GetComponentsInChildren<Renderer>(true);
				List<Material> list = new List<Material>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					Renderer val = componentsInChildren[i];
					if (!Object.op_Implicit((Object)(object)val))
					{
						continue;
					}
					try
					{
						Mesh val2 = null;
						SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null);
						if (val3 != null)
						{
							val2 = new Mesh();
							val3.BakeMesh(val2);
						}
						else
						{
							MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
							if (Object.op_Implicit((Object)(object)component))
							{
								val2 = component.sharedMesh;
							}
						}
						if (!Object.op_Implicit((Object)(object)val2))
						{
							continue;
						}
						GameObject val4 = new GameObject("StatuePart");
						val4.transform.SetParent(((Component)this).transform, false);
						val4.transform.position = ((Component)val).transform.position;
						val4.transform.rotation = ((Component)val).transform.rotation;
						val4.transform.localScale = ((Component)val).transform.lossyScale;
						MeshFilter obj = val4.AddComponent<MeshFilter>();
						MeshRenderer val5 = val4.AddComponent<MeshRenderer>();
						obj.sharedMesh = val2;
						Material[] sharedMaterials = val.sharedMaterials;
						if (sharedMaterials != null && sharedMaterials.Length != 0)
						{
							Material[] array = (Material[])(object)new Material[sharedMaterials.Length];
							for (int j = 0; j < array.Length; j++)
							{
								Material val6 = new Material(sharedMaterials[j]);
								val6.shader = (((Object)(object)CrystalMaterial != (Object)null) ? CrystalMaterial.shader : Shader.Find("Standard"));
								Function266(val6, ForcedUnitColor, 0.18f);
								val6.renderQueue = 2000;
								array[j] = val6;
								list.Add(val6);
							}
							((Renderer)val5).materials = array;
						}
						Vector3 baseLocal = ((Component)this).transform.InverseTransformPoint(val4.transform.position);
						List<Part> parts = Parts;
						Part item = new Part
						{
							Transform = val4.transform,
							BaseLocal = baseLocal
						};
						Vector3 onUnitSphere = Random.onUnitSphere;
						item.Axis = ((Vector3)(ref onUnitSphere)).normalized;
						item.Side = (((i & 1) != 0) ? 1 : (-1));
						parts.Add(item);
					}
					catch
					{
					}
				}
				Materials = list.ToArray();
			}

			private void Update()
			{
				//IL_00f4: 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_0104: Unknown result type (might be due to invalid IL or missing references)
				//IL_0109: Unknown result type (might be due to invalid IL or missing references)
				//IL_010d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_0137: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Unknown result type (might be due to invalid IL or missing references)
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_014d: 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_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_016b: 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_0175: 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_01bf: 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)
				//IL_01e6: 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_024d: Unknown result type (might be due to invalid IL or missing references)
				//IL_025a: 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_0263: Unknown result type (might be due to invalid IL or missing references)
				float num = Time.unscaledTime - Started;
				float num2 = Mathf.Clamp01(num / Duration);
				float num3 = Mathf.Pow(1f - num2, 1.4f);
				float num4 = Mathf.Clamp01((num - SplitStart) / Mathf.Max(0.01f, Duration - SplitStart));
				float num5 = num4 * num4 * (3f - 2f * num4);
				for (int i = 0; i < Parts.Count; i++)
				{
					Part part = Parts[i];
					if (Object.op_Implicit((Object)(object)part.Transform))
					{
						Vector3 val = new Vector3(Mathf.PerlinNoise(Started * 17f + (float)i, num * 32f) - 0.5f, Mathf.PerlinNoise(Started * 23f + (float)i, num * 39f) - 0.5f, Mathf.PerlinNoise(Started * 31f + (float)i, num * 28f) - 0.5f) * num3 * 0.34f;
						Vector3 localPosition = part.BaseLocal + val + Vector3.up * (((i & 1) == 0) ? 1f : (-1f)) * num5 * 0.5f + part.Axis * num5 * 0.35f * (float)part.Side;
						part.Transform.localPosition = localPosition;
						part.Transform.localRotation = Quaternion.Euler(num * (420f + (float)i * 11f), num * (510f + (float)i * 7f), num * (620f + (float)i * 13f));
						part.Transform.localScale = Vector3.one * Mathf.Lerp(1f, 0.86f, num5);
					}
				}
				if (num >= SplitStart)
				{
					for (int j = 0; j < Materials.Length; j++)
					{
						Material val2 = Materials[j];
						if (Object.op_Implicit((Object)(object)val2))
						{
							float num6 = 0.7f + 0.3f * Mathf.Sin(num * 44f + (float)j);
							Color color = Color.Lerp(ForcedUnitColor, Color.white, 0.22f * num6);
							Function266(val2, color, 0.35f * num6);
						}
					}
				}
				if (!(num >= Duration))
				{
					return;
				}
				for (int k = 0; k < Parts.Count; k++)
				{
					if (Object.op_Implicit((Object)(object)Parts[k].Transform))
					{
						Object.Destroy((Object)(object)((Component)Parts[k].Transform).gameObject);
					}
				}
				for (int l = 0; l < Materials.Length; l++)
				{
					if (Object.op_Implicit((Object)(object)Materials[l]))
					{
						Object.Destroy((Object)(object)Materials[l]);
					}
				}
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private sealed class SoulGrabVisual : MonoBehaviour
		{
			private struct PartState
			{
				internal Transform Var_t;

				internal Vector3 Var_pos;

				internal Quaternion Var_rot;

				internal int Var_side;

				internal float Var_phase;
			}

			private readonly List<PartState> Var_parts = new List<PartState>(32);

			private readonly List<Material> Var_mats = new List<Material>(32);

			private float Var_start;

			private Color Var_col;

			private float Var_matTick;

			internal bool Var_done;

			internal void Function318(Unit Var_target, Color Var_color, Renderer[] Var_renderers)
			{
				//IL_000c: 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_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_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
				Var_start = Time.unscaledTime;
				Var_col = Var_color;
				Var_matTick = 0f;
				Var_done = false;
				Var_parts.Clear();
				Var_mats.Clear();
				if (Var_renderers == null)
				{
					Var_renderers = ((Component)Var_target).GetComponentsInChildren<Renderer>(true);
				}
				Vector3 position = ((Component)Var_target).transform.position;
				foreach (Renderer val in Var_renderers)
				{
					if (!Object.op_Implicit((Object)(object)val))
					{
						continue;
					}
					Material[] sharedMaterials = val.sharedMaterials;
					for (int j = 0; j < sharedMaterials.Length; j++)
					{
						if (Object.op_Implicit((Object)(object)sharedMaterials[j]))
						{
							Var_mats.Add(sharedMaterials[j]);
						}
					}
					Vector3 position2 = ((Component)val).transform.position;
					Var_parts.Add(new PartState
					{
						Var_t = ((Component)val).transform,
						Var_pos = position2,
						Var_rot = ((Component)val).transform.rotation,
						Var_side = ((position2.y >= position.y) ? 1 : (-1)),
						Var_phase = Random.value * 6.28f
					});
				}
			}

			private void Update()
			{
				//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_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: 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_00f2: 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_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Unknown result type (might be due to invalid IL or missing references)
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_0137: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_021e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Unknown result type (might be due to invalid IL or missing references)
				float num = Time.unscaledTime - Var_start;
				float num2 = Mathf.Clamp01(1f - num / 1.15f);
				float num3 = Mathf.Clamp01((num - 0.55f) / 0.45f);
				float num4 = num3 * num3;
				Vector3 val = default(Vector3);
				for (int i = 0; i < Var_parts.Count; i++)
				{
					PartState partState = Var_parts[i];
					if (Object.op_Implicit((Object)(object)partState.Var_t))
					{
						float num5 = Mathf.Sin(num * 42f + partState.Var_phase) * 0.018f * num2;
						float num6 = Mathf.Cos(num * 55f + partState.Var_phase) * 0.018f * num2;
						((Vector3)(ref val))..ctor(num5, Mathf.Sin(num * 47f + partState.Var_phase) * 0.012f * num2, num6);
						val += Vector3.up * (float)partState.Var_side * num4 * 0.45f;
						val += partState.Var_t.right * Mathf.Sin(num * 31f + partState.Var_phase) * 0.08f * num2;
						partState.Var_t.position = partState.Var_pos + val;
						partState.Var_t.rotation = partState.Var_rot * Quaternion.Euler(Mathf.Sin(num * 36f + partState.Var_phase) * 4f * num2, Mathf.Cos(num * 49f + partState.Var_phase) * 4f * num2, Mathf.Sin(num * 61f + partState.Var_phase) * 5f * num2);
					}
				}
				if (num >= Var_matTick)
				{
					Var_matTick = num + 0.033333f;
					for (int j = 0; j < Var_mats.Count; j++)
					{
						Material val2 = Var_mats[j];
						if (Object.op_Implicit((Object)(object)val2))
						{
							float num7 = 0.78f + 0.22f * Mathf.Sin(num * 18f + (float)j);
							Function266(val2, Var_col * (0.82f + 0.18f * num7), 0.12f + 0.18f * num7);
						}
					}
				}
				if (num >= 1.15f)
				{
					Var_done = true;
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		private sealed class Proj : MonoBehaviour
		{
			internal Unit Owner;

			internal Vector3 Direction;

			internal Vector3 Velocity;

			internal bool InternalWrite;

			private ProjectileHit Hit;

			private MoveTransform Move;

			private bool Subscribed;

			private bool HitHandled;

			private Rigidbody[] PhysicalBodies;

			private Renderer[] CachedRenderers;

			private MaterialPropertyBlock PropertyBlock;

			private int LastVisualColorVersion = -1;

			private float LaunchUntil;

			private Vector3 LastPosition;

			private float StalledFor;

			internal Unit AimTarget;

			internal int BounceCount;

			internal float AimStrength = 12f;

			internal void Function292(Unit owner, Vector3 direction, Vector3 targetDirection, Rigidbody targetRig)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				Owner = owner;
				Direction = ((((Vector3)(ref direction)).sqrMagnitude > 0.001f) ? ((Vector3)(ref direction)).normalized : Vector3.forward);
				AimTarget = (Object.op_Implicit((Object)(object)targetRig) ? ((Component)targetRig).GetComponentInParent<Unit>() : null);
				BounceCount = 0;
				if (((Vector3)(ref targetDirection)).sqrMagnitude > 0.001f)
				{
					Direction = ((Vector3)(ref targetDirection)).normalized;
				}
			}

			internal void Function293(MoveTransform move)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Expected O, but got Unknown
				Move = move;
				if ((Object)(object)Move != (Object)null && !Subscribed)
				{
					Hit = ((Component)this).GetComponentInChildren<ProjectileHit>(true);
					if ((Object)(object)Hit != (Object)null)
					{
						Hit.HitUnit += new HitUnitEventHandler(Function297);
					}
					Subscribed = true;
				}
			}

			private void Start()
			{
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Expected O, but got Unknown
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Expected O, but got Unknown
				//IL_0147: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Unknown result type (might be due to invalid IL or missing references)
				if (!Subscribed)
				{
					Hit = ((Component)this).GetComponentInChildren<ProjectileHit>(true);
					if ((Object)(object)Hit != (Object)null)
					{
						Hit.HitUnit += new HitUnitEventHandler(Function297);
					}
					Move = ((Component)this).GetComponentInChildren<MoveTransform>(true);
					Subscribed = true;
				}
				PhysicalBodies = ((Component)this).GetComponentsInChildren<Rigidbody>(true);
				CachedRenderers = ((Component)this).GetComponentsInChildren<Renderer>(true);
				PropertyBlock = new MaterialPropertyBlock();
				Function295();
				LastPosition = ((Component)this).transform.position;
				LaunchUntil = Time.unscaledTime + 0.45f;
				StalledFor = 0f;
				if (Object.op_Implicit((Object)(object)Move))
				{
					try
					{
						Behaviour move = (Behaviour)(object)Move;
						if (Object.op_Implicit((Object)(object)move))
						{
							move.enabled = true;
						}
						InternalWrite = true;
						Move.velocity = Velocity;
						InternalWrite = false;
					}
					catch
					{
						InternalWrite = false;
					}
				}
				if (PhysicalBodies != null)
				{
					for (int i = 0; i < PhysicalBodies.Length; i++)
					{
						Rigidbody val = PhysicalBodies[i];
						if (Object.op_Implicit((Object)(object)val))
						{
							try
							{
								val.isKinematic = false;
								val.constraints = (RigidbodyConstraints)0;
								val.WakeUp();
								val.velocity = Velocity;
							}
							catch
							{
							}
						}
					}
				}
				Function296(ForcedUnitColor);
			}

			private void FixedUpdate()
			{
				//IL_029a: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0503: Unknown result type (might be due to invalid IL or missing references)
				//IL_0348: 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_02b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_035f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0366: Unknown result type (might be due to invalid IL or missing references)
				//IL_036b: 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_0374: 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_0380: Unknown result type (might be due to invalid IL or missing references)
				//IL_0386: Unknown result type (might be due to invalid IL or missing references)
				//IL_0390: Unknown result type (might be due to invalid IL or missing references)
				//IL_0395: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cf: 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_02db: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f6: 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_0305: 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_0319: Unknown result type (might be due to invalid IL or missing references)
				//IL_0323: 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_058a: Unknown result type (might be due to invalid IL or missing references)
				//IL_058f: Unknown result type (might be due to invalid IL or missing references)
				//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_0426: Unknown result type (might be due to invalid IL or missing references)
				//IL_042b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0564: Unknown result type (might be due to invalid IL or missing references)
				//IL_056a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0574: Unknown result type (might be due to invalid IL or missing references)
				//IL_0579: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_0182: Unknown result type (might be due to invalid IL or missing references)
				//IL_0187: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_0199: Unknown result type (might be due to invalid IL or missing references)
				//IL_019e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0440: Unknown result type (might be due to invalid IL or missing references)
				//IL_0445: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0463: Unknown result type (might be due to invalid IL or missing references)
				//IL_0468: 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_01c4: 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_0108: Unknown result type (might be due to invalid IL or missing references)
				//IL_010d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: 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_01d2: 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_01d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: 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_014e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0209: Unknown result type (might be due to invalid IL or missing references)
				//IL_020e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_0165: 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_027e: Unknown result type (might be due to invalid IL or missing references)
				if (!Function288() || (Object)(object)Owner == (Object)null || (Object)(object)Owner != (Object)(object)State.Unit || !Object.op_Implicit((Object)(object)Owner))
				{
					return;
				}
				Unit val = AimTarget;
				if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val == (Object)(object)State.Unit || (Object)(object)val.data == (Object)null || val.data.Dead)
				{
					val = Function245();
				}
				if (Object.op_Implicit((Object)(object)val) && (Object)(object)val != (Object)(object)State.Unit)
				{
					AimTarget = val;
				}
				float num = Mathf.Clamp(((Vector3)(ref Velocity)).magnitude, 120f, 260f);
				Vector3 val2 = Direction;
				if (Object.op_Implicit((Object)(object)AimTarget) && (Object)(object)AimTarget.data != (Object)null && Object.op_Implicit((Object)(object)AimTarget.data.mainRig))
				{
					Vector3 v = AimTarget.data.mainRig.worldCenterOfMass - ((Component)this).transform.position;
					if (Function289(v) && ((Vector3)(ref v)).sqrMagnitude > 0.0025f)
					{
						val2 = Vector3.Slerp(Direction, ((Vector3)(ref v)).normalized, Mathf.Clamp01(AimStrength * Time.fixedDeltaTime));
						if (((Vector3)(ref val2)).sqrMagnitude > 0.001f)
						{
							Direction = ((Vector3)(ref val2)).normalized;
						}
					}
				}
				Velocity = Direction * num;
				Vector3 position = ((Component)this).transform.position;
				Vector3 val3 = position + Velocity * Time.fixedDeltaTime;
				RaycastHit val4 = default(RaycastHit);
				bool flag = false;
				try
				{
					Vector3 val5 = val3 - position;
					Vector3 val6 = ((((Vector3)(ref val5)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref val5)).normalized : Direction);
					int num2 = Physics.RaycastNonAlloc(position, val6, ProjectileRaycastBuffer, ((Vector3)(ref val5)).magnitude + 0.15f, -5, (QueryTriggerInteraction)1);
					float num3 = float.MaxValue;
					for (int i = 0; i < num2; i++)
					{
						RaycastHit val7 = ProjectileRaycastBuffer[i];
						if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val7)).collider) && !((Component)((RaycastHit)(ref val7)).collider).transform.IsChildOf(((Component)this).transform) && !((Object)(object)((Component)((RaycastHit)(ref val7)).collider).GetComponentInParent<Unit>() == (Object)(object)State.Unit) && !((Object)(object)((Component)((RaycastHit)(ref val7)).collider).GetComponentInParent<Unit>() == (Object)(object)AimTarget) && ((RaycastHit)(ref val7)).distance < num3)
						{
							num3 = ((RaycastHit)(ref val7)).distance;
							val4 = val7;
							flag = true;
						}
					}
				}
				catch
				{
					flag = false;
					val4 = default(RaycastHit);
				}
				Vector3 val8;
				if (flag && BounceCount < 12)
				{
					val8 = ((RaycastHit)(ref val4)).normal;
					if (((Vector3)(ref val8)).sqrMagnitude > 0.001f)
					{
						val8 = Vector3.Reflect(Direction, ((RaycastHit)(ref val4)).normal);
						Direction = ((Vector3)(ref val8)).normalized;
						Velocity = Direction * num * 0.94f;
						((Component)this).transform.position = ((RaycastHit)(ref val4)).point + ((RaycastHit)(ref val4)).normal * 0.05f;
						BounceCount++;
						goto IL_039a;
					}
				}
				if (flag)
				{
					val8 = ((RaycastHit)(ref val4)).normal;
					if (((Vector3)(ref val8)).sqrMagnitude > 0.001f)
					{
						val8 = Vector3.Reflect(Direction, ((RaycastHit)(ref val4)).normal);
						Direction = ((Vector3)(ref val8)).normalized;
						Velocity = Direction * num * 0.9f;
					}
				}
				goto IL_039a;
				IL_039a:
				if (((Vector3)(ref Velocity)).sqrMagnitude < 400f)
				{
					Velocity = Direction * 140f;
				}
				if (Object.op_Implicit((Object)(object)Move))
				{
					try
					{
						Behaviour move = (Behaviour)(object)Move;
						if (Object.op_Implicit((Object)(object)move) && !move.enabled)
						{
							move.enabled = true;
						}
						if (Time.unscaledTime < LaunchUntil || ((Vector3)(ref Move.velocity)).sqrMagnitude < 25f)
						{
							InternalWrite = true;
							Move.velocity = Velocity;
							InternalWrite = false;
						}
						else
						{
							Velocity = Move.velocity;
							if (((Vector3)(ref Velocity)).sqrMagnitude > 25f)
							{
								Direction = ((Vector3)(ref Velocity)).normalized;
							}
						}
					}
					catch
					{
						InternalWrite = false;
					}
				}
				else if (PhysicalBodies != null)
				{
					for (int j = 0; j < PhysicalBodies.Length; j++)
					{
						Rigidbody val9 = PhysicalBodies[j];
						if (!Object.op_Implicit((Object)(object)val9))
						{
							continue;
						}
						try
						{
							val9.isKinematic = false;
							val9.constraints = (RigidbodyConstraints)0;
							val9.WakeUp();
							val8 = val9.velocity;
							if (((Vector3)(ref val8)).sqrMagnitude < 25f)
							{
								val9.velocity = Velocity;
							}
						}
						catch
						{
						}
					}
				}
				val8 = ((Component)this).transform.position - LastPosition;
				if (((Vector3)(ref val8)).magnitude < 0.0025f)
				{
					StalledFor += Time.fixedDeltaTime;
				}
				else
				{
					StalledFor = 0f;
				}
				if (!Object.op_Implicit((Object)(object)Move) && PhysicalBodies != null && PhysicalBodies.Length == 0 && StalledFor > 0.06f)
				{
					Transform transform = ((Component)this).transform;
					transform.position += Velocity * Time.fixedDeltaTime;
				}
				LastPosition = ((Component)this).transform.position;
			}

			internal void Function294(Unit owner)
			{
				//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_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)Owner != (Object)(object)owner) && Object.op_Implicit((Object)(object)Owner) && Object.op_Implicit((Object)(object)Move) && ((Vector3)(ref Move.velocity)).sqrMagnitude > 25f)
				{
					Velocity = Move.velocity;
					Direction = ((Vector3)(ref Velocity)).normalized;
				}
			}

			private void Function295()
			{
				if (CachedRenderers == null)
				{
					return;
				}
				Shader val = (((Object)(object)CrystalMaterial != (Object)null) ? CrystalMaterial.shader : Shader.Find("Standard"));
				for (int i = 0; i < CachedRenderers.Length; i++)
				{
					Renderer val2 = CachedRenderers[i];
					if (!Object.op_Implicit((Object)(object)val2))
					{
						continue;
					}
					try
					{
						Material[] materials = val2.materials;
						foreach (Material val3 in materials)
						{
							if (Object.op_Implicit((Object)(object)val3))
							{
								if (Object.op_Implicit((Object)(object)val))
								{
									val3.shader = val;
								}
								Function265(val3);
							}
						}
						val2.materials = materials;
					}
					catch
					{
					}
				}
			}

			internal void Function296(Color color)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: 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_008b: Expected O, but got Unknown
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				if (LastVisualColorVersion == ProjectileVisualColorVersion)
				{
					return;
				}
				if (float.IsNaN(color.r) || float.IsNaN(color.g) || float.IsNaN(color.b) || float.IsInfinity(color.r) || float.IsInfinity(color.g) || float.IsInfinity(color.b))
				{
					color = ForcedUnitColor;
				}
				color.a = 1f;
				if (CachedRenderers == null)
				{
					return;
				}
				if (PropertyBlock == null)
				{
					PropertyBlock = new MaterialPropertyBlock();
				}
				PropertyBlock.Clear();
				PropertyBlock.SetColor("_Color", color);
				PropertyBlock.SetColor("_BaseColor", color);
				PropertyBlock.SetColor("_EmissionColor", color * 0.12f);
				for (int i = 0; i < CachedRenderers.Length; i++)
				{
					Renderer val = CachedRenderers[i];
					if (Object.op_Implicit((Object)(object)val))
					{
						try
						{
							val.SetPropertyBlock(PropertyBlock);
							val.enabled = true;
						}
						catch
						{
						}
					}
				}
				LastVisualColorVersion = ProjectileVisualColorVersion;
			}

			private void Function297(ProjectileHit projectileHit, Unit unit)
			{
				if (!HitHandled && !((Object)(object)unit == (Object)null) && !((Object)(object)Owner == (Object)null) && !((Object)(object)Owner != (Object)(object)State.Unit))
				{
					HitHandled = true;
					Function226(this, unit);
				}
			}

			private void OnDestroy()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Expected O, but got Unknown
				if ((Object)(object)Hit != (Object)null)
				{
					Hit.HitUnit -= new HitUnitEventHandler(Function297);
				}
				Hit = null;
			}
		}

		private sealed class FragmentMotion : MonoBehaviour
		{
			internal Vector3 Velocity;

			internal Vector3 Angular;

			private float Age;

			private void Update()
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: 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_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				float unscaledDeltaTime = Time.unscaledDeltaTime;
				Age += unscaledDeltaTime;
				Transform transform = ((Component)this).transform;
				transform.position += Velocity * unscaledDeltaTime;
				Velocity += Physics.gravity * 0.72f * unscaledDeltaTime;
				((Component)this).transform.Rotate(Angular * unscaledDeltaTime, (Space)1);
				float num = Mathf.Lerp(1f, 0f, Mathf.Clamp01((Age - 0.35f) / 0.48f));
				((Component)this).transform.localScale = Vector3.one * Mathf.Max(0f, num);
				if (Age >= 0.83f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		private sealed class HiBan
		{
			internal const string Name = "Hi";

			internal Unit Unit;

			internal UnitBlueprint Blueprint;

			internal DatabaseEntity Entity;

			internal ReferenceType<Unit> RuntimeReference;

			internal int RuntimeIndex;

			internal short RemoteInstanceId;

			internal short InstanceId;

			internal ulong NetworkId;

			internal ushort SmallNetworkId;

			internal ushort CopyOfSmallNetworkId;

			internal Vector3 SpawnPosition;

			internal Team Team;

			internal bool FinalDestroying;

			internal bool DestroyScheduled;

			internal float DestroyAt;

			internal bool MeleeSequence;

			internal bool MeleeCleanupDone;
		}

		private sealed class Shockwave
		{
			internal Vector3 Position;

			internal Vector3 Direction;

			internal float Started;

			internal float Life;

			internal float BaseScale;

			internal float Power;

			internal ShockVisual Visual;
		}

		private sealed class ShockVisual
		{
			internal GameObject Root;

			internal GameObject[] Parts;

			internal MeshRenderer[] Renderers;

			internal Material Material;
		}

		private sealed class DelayedDestruction
		{
			internal HiBan Ban;

			internal float At;
		}

		[BurstCompile]
		private struct VitalityColorJob : IJob
		{
			public float Time;

			public float BaseMax;

			public NativeArray<float4> Out;

			public void Execute()
			{
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: 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_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_0137: 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_0094: Unknown result type (might be due to invalid IL or missing references)
				float num = math.frac(Time * 0.85f) * 3f;
				int num2 = (int)math.floor(num);
				float num3 = num - (float)num2;
				? val = num2 switch
				{
					1 => new float4(0f, 1f, 0f, 0f), 
					0 => new float4(1f, 0f, 0f, 0f), 
					_ => new float4(0f, 0f, 1f, 0f), 
				};
				float4 val2 = (float4)(num2 switch
				{
					1 => new float4(0f, 0f, 1f, 0f), 
					0 => new float4(0f, 1f, 0f, 0f), 
					_ => new float4(1f, 0f, 0f, 0f), 
				});
				float num4 = num3 * num3 * (3f - 2f * num3);
				float4 val3 = math.lerp((float4)val, val2, num4) * 0.82f;
				float w = BaseMax * (0.58f + 0.22f * (0.5f + 0.5f * math.sin(Time * 4.2f)));
				val3.w = w;
				Out[0] = val3;
			}
		}

		[BurstCompile]
		private struct GroundJob : IJob
		{
			public float3 P;

			public float3 N;

			public float D;

			public float Max;

			public NativeArray<float3> Out;

			public void Execute()
			{
				//IL_0021: 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)
				float num = math.clamp(D, 0f - Max, Max);
				Out[0] = N * num;
			}
		}

		private static class State
		{
			internal static Unit Unit;

			internal static UnitBlueprint Blueprint;

			internal static DatabaseEntity Entity;

			internal static int RuntimeIndex;

			internal static ReferenceType<Unit> RuntimeReference;

			internal static short RemoteInstanceId;

			internal static short InstanceId;

			internal static ulong NetworkId;

			internal static ushort SmallNetworkId;

			internal static ushort CopyOfSmallNetworkId;

			internal static Vector3 CopyOfUnitSpawnPosition;

			internal static GameObject Root;

			internal static Transform RootT;

			internal static Transform OriginalParent;

			internal static Vector3 SafeRootPosition;

			internal static Quaternion SafeRootRotation;

			internal static DataHandler Data;

			internal static HealthHandler Health;

			internal static Rigidbody MainRig;

			internal static float MainRigRootOffsetY;

			internal static float OriginalMovementMultiplier = 1f;

			internal static Rigidbody[] Rigs;

			internal static Collider[] Colliders;

			internal static Renderer[] Renderers;

			internal static bool Grounded;

			internal static bool GroundValid;

			internal static Vector3 LastGround;

			internal static float FloorY;

			internal static float RootFloorOffset;

			internal static float GroundProbeX;

			internal static float GroundProbeZ;

			internal static bool GroundOffsetReady;

			internal static float HoverHeight;

			internal static float AirborneSince;

			internal static float GetupGraceUntil;

			internal static bool LevitationLock;

			internal static string RandomName = "UNKNOWN_0000";

			internal static Vector3 RootOriginalScale = Vector3.one;

			internal static Color ForcedColor = Color.white;

			internal static Transform[] ProtectedTransforms;

			internal static Behaviour[] ProtectedBehaviours;

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

			private static readonly Dictionary<int, bool> OriginalActiveStates = new Dictionary<int, bool>();

			private static readonly Dictionary<int, bool> OriginalBehaviourStates = new Dictionary<int, bool>();

			private static readonly Dictionary<int, bool> OriginalColliderStates = new Dictionary<int, bool>();

			private static readonly Dictionary<int, bool> OriginalRendererStates = new Dictionary<int, bool>();

			private static readonly Dictionary<int, Mesh> OriginalSkinMeshes = new Dictionary<int, Mesh>();

			private static readonly Dictionary<int, Mesh> OriginalFilterMeshes = new Dictionary<int, Mesh>();

			private static readonly Dictionary<int, Vector3> OriginalTransformScales = new Dictionary<int, Vector3>();

			private static readonly Dictionary<int, Vector3> OriginalBoxColliderSizes = new Dictionary<int, Vector3>();

			private static readonly Dictionary<int, float> OriginalSphereColliderRadii = new Dictionary<int, float>();

			private static readonly Dictionary<int, float> OriginalCapsuleColliderRadii = new Dictionary<int, float>();

			private static readonly Dictionary<int, float> OriginalCapsuleColliderHeights = new Dictionary<int, float>();

			private static readonly Dictionary<int, float> OriginalCharacterControllerRadii = new Dictionary<int, float>();

			private static readonly Dictionary<int, float> OriginalCharacterControllerHeights = new Dictionary<int, float>();

			private static readonly Dictionary<int, float> BaseMasses = new Dictionary<int, float>();

			internal static readonly List<Material> CrystalMaterials = new List<Material>(64);

			internal static readonly List<Material[]> CrystalMaterialArrays = new List<Material[]>();

			private static readonly Dictionary<int, Material[]> OriginalMaterialArrays = new Dictionary<int, Material[]>();

			internal static void Function298(Unit unit)
			{
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_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_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: 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_0645: Unknown result type (might be due to invalid IL or missing references)
				//IL_064a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0375: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
				Function59();
				Function317();
				if (!Object.op_Implicit((Object)(object)unit))
				{
					return;
				}
				Unit = unit;
				Blueprint = unit.unitBlueprint;
				Entity = unit.Entity;
				RuntimeIndex = unit.RuntimeIndex;
				RuntimeReference = unit.RuntimeReference;
				RemoteInstanceId = unit.RemoteInstanceId;
				InstanceId = unit.InstanceId;
				NetworkId = unit.NetworkId;
				SmallNetworkId = unit.SmallNetworkId;
				CopyOfSmallNetworkId = unit.CopyOfSmallNetworkId;
				CopyOfUnitSpawnPosition = unit.CopyOfUnitSpawnPosition;
				Root = ((Component)unit).gameObject;
				RootT = ((Component)unit).transform;
				RootOriginalScale = RootT.localScale;
				OriginalParent = RootT.parent;
				SafeRootPosition = RootT.position;
				SafeRootRotation = RootT.rotation;
				Data = ((Component)unit).GetComponentInChildren<DataHandler>(true);
				Health = ((Component)unit).GetComponentInChildren<HealthHandler>(true);
				MainRig = (Object.op_Implicit((Object)(object)Data) ? Data.mainRig : ((Component)unit).GetComponentInChildren<Rigidbody>(true));
				MainRigRootOffsetY = (Object.op_Implicit((Object)(object)MainRig) ? (MainRig.position.y - RootT.position.y) : 0f);
				MovementHandler componentInChildren = Root.GetComponentInChildren<MovementHandler>(true);
				OriginalMovementMultiplier = (Object.op_Implicit((Object)(object)componentInChildren) ? Mathf.Max(1f, componentInChildren.multiplier) : 1f);
				CombatMovementMultiplier = OriginalMovementMultiplier;
				Rigs = Root.GetComponentsInChildren<Rigidbody>(true);
				Colliders = Root.GetComponentsInChildren<Collider>(true);
				Renderers = Root.GetComponentsInChildren<Renderer>(true);
				ProtectedTransforms = Root.GetComponentsInChildren<Transform>(true);
				ProtectedBehaviours = Root.GetComponentsInChildren<Behaviour>(true);
				OriginalComponentIds.Clear();
				OriginalActiveStates.Clear();
				OriginalBehaviourStates.Clear();
				Component[] componentsInChildren = Root.GetComponentsInChildren<Component>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					if (Object.op_Implicit((Object)(object)componentsInChildren[i]))
					{
						OriginalComponentIds.Add(RuntimeHelpers.GetHashCode(componentsInChildren[i]));
					}
				}
				for (int j = 0; j < ProtectedTransforms.Length; j++)
				{
					if (Object.op_Implicit((Object)(object)ProtectedTransforms[j]))
					{
						OriginalActiveStates[RuntimeHelpers.GetHashCode(((Component)ProtectedTransforms[j]).gameObject)] = ((Component)ProtectedTransforms[j]).gameObject.activeSelf;
					}
				}
				for (int k = 0; k < ProtectedBehaviours.Length; k++)
				{
					if (Object.op_Implicit((Object)(object)ProtectedBehaviours[k]))
					{
						OriginalBehaviourStates[RuntimeHelpers.GetHashCode(ProtectedBehaviours[k])] = ProtectedBehaviours[k].enabled;
					}
				}
				ProtectedTransforms = null;
				ProtectedBehaviours = null;
				OriginalColliderStates.Clear();
				OriginalRendererStates.Clear();
				OriginalSkinMeshes.Clear();
				OriginalFilterMeshes.Clear();
				OriginalTransformScales.Clear();
				OriginalBoxColliderSizes.Clear();
				OriginalSphereColliderRadii.Clear();
				OriginalCapsuleColliderRadii.Clear();
				OriginalCapsuleColliderHeights.Clear();
				OriginalCharacterControllerRadii.Clear();
				OriginalCharacterControllerHeights.Clear();
				Transform[] componentsInChildren2 = Root.GetComponentsInChildren<Transform>(true);
				for (int l = 0; l < componentsInChildren2.Length; l++)
				{
					if (Object.op_Implicit((Object)(object)componentsInChildren2[l]))
					{
						OriginalTransformScales[RuntimeHelpers.GetHashCode(componentsInChildren2[l])] = componentsInChildren2[l].localScale;
					}
				}
				BoxCollider[] componentsInChildren3 = Root.GetComponentsInChildren<BoxCollider>(true);
				for (int m = 0; m < componentsInChildren3.Length; m++)
				{
					if (Object.op_Implicit((Object)(object)componentsInChildren3[m]))
					{
						OriginalBoxColliderSizes[RuntimeHelpers.GetHashCode(componentsInChildren3[m])] = componentsInChildren3[m].size;
					}
				}
				SphereCollider[] componentsInChildren4 = Root.GetComponentsInChildren<SphereCollider>(true);
				for (int n = 0; n < componentsInChildren4.Length; n++)
				{
					if (Object.op_Implicit((Object)(object)componentsInChildren4[n]))
					{
						OriginalSphereColliderRadii[RuntimeHelpers.GetHashCode(componentsInChildren4[n])] = componentsInChildren4[n].radius;
					}
				}
				CapsuleCollider[] componentsInChildren5 = Root.GetComponentsInChildren<CapsuleCollider>(true);
				for (int num = 0; num < componentsInChildren5.Length; num++)
				{
					if (Object.op_Implicit((Object)(object)componentsInChildren5[num]))
					{
						int hashCode = RuntimeHelpers.GetHashCode(componentsInChildren5[num]);
						OriginalCapsuleColliderRadii[hashCode] = componentsInChildren5[num].radius;
						OriginalCapsuleColliderHeights[hashCode] = componentsInChildren5[num].height;
					}
				}
				CharacterController[] componentsInChildren6 = Root.GetComponentsInChildren<CharacterController>(true);
				for (int num2 = 0; num2 < componentsInChildren6.Length; num2++)
				{
					if (Object.op_Implicit((Object)(object)componentsInChildren6[num2]))
					{
						int hashCode2 = RuntimeHelpers.GetHashCode(componentsInChildren6[num2]);
						OriginalCharacterControllerRadii[hashCode2] = componentsInChildren6[num2].radius;
						OriginalCharacterControllerHeights[hashCode2] = componentsInChildren6[num2].height;
					}
				}
				SkinnedMeshRenderer[] componentsInChildren7 = Root.GetComponentsInChildren<SkinnedMeshRenderer>(true);
				for (int num3 = 0; num3 < componentsInChildren7.Length; num3++)
				{
					if (Object.op_Implicit((Object)(object)componentsInChildren7[num3]))
					{
						OriginalSkinMeshes[RuntimeHelpers.GetHashCode(componentsInChildren7[num3])] = componentsInChildren7[num3].sharedMesh;
					}
				}
				MeshFilter[] componentsInChildren8 = Root.GetComponentsInChildren<MeshFilter>(true);
				for (int num4 = 0; num4 < componentsInChildren8.Length; num4++)
				{
					if (Object.op_Implicit((Object)(object)componentsInChildren8[num4]))
					{
						OriginalFilterMeshes[RuntimeHelpers.GetHashCode(componentsInChildren8[num4])] = componentsInChildren8[num4].sharedMesh;
					}
				}
				OriginalMaterialArrays.Clear();
				for (int num5 = 0; num5 < Renderers.Length; num5++)
				{
					Renderer val = Renderers[num5];
					if (Object.op_Implicit((Object)(object)val))
					{
						try
						{
							OriginalMaterialArrays[RuntimeHelpers.GetHashCode(val)] = val.sharedMaterials;
						}
						catch
						{
						}
					}
				}
				Function263();
				BaseMasses.Clear();
				InternalIdentityRead = true;
				try
				{
					for (int num6 = 0; num6 < Rigs.Length; num6++)
					{
						if (Object.op_Implicit((Object)(object)Rigs[num6]))
						{
							BaseMasses[RuntimeHelpers.GetHashCode(Rigs[num6])] = Mathf.Max(Rigs[num6].mass, 0.01f);
						}
					}
				}
				finally
				{
					InternalIdentityRead = false;
				}
				Grounded = true;
				GroundValid = true;
				LastGround = SafeRootPosition;
				FloorY = SafeRootPosition.y;
				RootFloorOffset = 0f;
				HoverHeight = 0f;
				AirborneSince = Time.unscaledTime;
				GetupGraceUntil = Time.unscaledTime + 1.25f;
				LevitationLock = false;
				NextCollisionIsolation = Time.unscaledTime;
				CombatMovementConfigured = false;
				CombatMovementMultiplier = 1f;
			}

			internal static float Function299(Rigidbody rig)
			{
				if (!Object.op_Implicit((Object)(object)rig))
				{
					return 1f;
				}
				InternalIdentityRead = true;
				try
				{
					if (BaseMasses.TryGetValue(RuntimeHelpers.GetHashCode(rig), out var value))
					{
						return value;
					}
				}
				finally
				{
					InternalIdentityRead = false;
				}
				return Mathf.Max(rig.mass, 0.01f);
			}

			internal static bool Function300(Component component)
			{
				if (!Object.op_Implicit((Object)(object)component))
				{
					return false;
				}
				return OriginalComponentIds.Contains(RuntimeHelpers.GetHashCode(component));
			}

			internal static bool Function301(GameObject gameObject, out bool value)
			{
				value = true;
				if (!Object.op_Implicit((Object)(object)gameObject))
				{
					return false;
				}
				return OriginalActiveStates.TryGetValue(RuntimeHelpers.GetHashCode(gameObject), out value);
			}

			internal static bool Function302(Behaviour behaviour, out bool value)
			{
				value = true;
				if (!Object.op_Implicit((Object)(object)behaviour))
				{
					return false;
				}
				return OriginalBehaviourStates.TryGetValue(RuntimeHelpers.GetHashCode(behaviour), out value);
			}

			internal static bool Function303(Collider collider, out bool value)
			{
				value = true;
				if (!Object.op_Implicit((Object)(object)collider))
				{
					return false;
				}
				return OriginalColliderStates.TryGetValue(RuntimeHelpers.GetHashCode(collider), out value);
			}

			internal static bool Function304(Renderer renderer, out bool value)
			{
				value = true;
				if (!Object.op_Implicit((Object)(object)renderer))
				{
					return false;
				}
				return OriginalRendererStates.TryGetValue(RuntimeHelpers.GetHashCode(renderer), out value);
			}

			internal static Material[] Function305(Renderer renderer)
			{
				if (!Object.op_Implicit((Object)(object)renderer))
				{
					return null;
				}
				RuntimeHelpers.GetHashCode(renderer);
				for (int i = 0; i < Renderers.Length; i++)
				{
					if ((Object)(object)Renderers[i] == (Object)(object)renderer && i < CrystalMaterialArrays.Count)
					{
						return CrystalMaterialArrays[i];
					}
				}
				return null;
			}

			internal static Material[] Function306(Renderer renderer)
			{
				if (!Object.op_Implicit((Object)(object)renderer))
				{
					return null;
				}
				if (!OriginalMaterialArrays.TryGetValue(RuntimeHelpers.GetHashCode(renderer), out var value))
				{
					return null;
				}
				return value;
			}

			internal static Mesh Function307(SkinnedMeshRenderer renderer)
			{
				if (!Object.op_Implicit((Object)(object)renderer))
				{
					return null;
				}
				if (!OriginalSkinMeshes.TryGetValue(RuntimeHelpers.GetHashCode(renderer), out var value))
				{
					return null;
				}
				return value;
			}

			internal static Mesh Function308(MeshFilter renderer)
			{
				if (!Object.op_Implicit((Object)(object)renderer))
				{
					return null;
				}
				if (!OriginalFilterMeshes.TryGetValue(RuntimeHelpers.GetHashCode(renderer), out var value))
				{
					return null;
				}
				return value;
			}

			internal static bool Function309(Transform transform, out Vector3 value)
			{
				return OriginalTransformScales.TryGetValue(RuntimeHelpers.GetHashCode(transform), out value);
			}

			internal static bool Function310(BoxCollider collider, out Vector3 value)
			{
				return OriginalBoxColliderSizes.TryGetValue(RuntimeHelpers.GetHashCode(collider), out value);
			}

			internal static bool Function311(SphereCollider collider, out float value)
			{
				return OriginalSphereColliderRadii.TryGetValue(RuntimeHelpers.GetHashCode(collider), out value);
			}

			internal static bool Function312(CapsuleCollider collider, out float value)
			{
				return OriginalCapsuleColliderRadii.TryGetValue(RuntimeHelpers.GetHashCode(collider), out value);
			}

			internal static bool Function313(CapsuleCollider collider, out float value)
			{
				return OriginalCapsuleColliderHeights.TryGetValue(RuntimeHelpers.GetHashCode(collider), out value);
			}

			internal static bool Function314(CharacterController controller, out float value)
			{
				return OriginalCharacterControllerRadii.TryGetValue(RuntimeHelpers.GetHashCode(controller), out value);
			}

			internal static bool Function315(CharacterController controller, out float value)
			{
				return OriginalCharacterControllerHeights.TryGetValue(RuntimeHelpers.GetHashCode(controller), out value);
			}

			internal static void Function316()
			{
				for (int i = 0; i < CrystalMaterials.Count; i++)
				{
					Material val = CrystalMaterials[i];
					if (Object.op_Implicit((Object)(object)val))
					{
						Object.Destroy((Object)(object)val);
					}
				}
				CrystalMaterials.Clear();
			}

			internal static void Function317()
			{
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_0137: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Unknown result type (might be due to invalid IL or missing references)
				if (Renderers != null)
				{
					for (int i = 0; i < Renderers.Length; i++)
					{
						Renderer val = Renderers[i];
						if (Object.op_Implicit((Object)(object)val) && OriginalMaterialArrays.TryGetValue(RuntimeHelpers.GetHashCode(val), out var value))
						{
							try
							{
								val.sharedMaterials = value;
							}
							catch
							{
							}
						}
					}
				}
				Function316();
				CrystalMaterialArrays.Clear();
				OriginalMaterialArrays.Clear();
				Unit = null;
				Root = null;
				RootT = null;
				OriginalParent = null;
				SafeRootPosition = Vector3.zero;
				SafeRootRotation = Quaternion.identity;
				Data = null;
				Health = null;
				MainRig = null;
				MainRigRootOffsetY = 0f;
				OriginalMovementMultiplier = 1f;
				Rigs = null;
				Colliders = null;
				Renderers = null;
				Grounded = false;
				LastGround = Vector3.zero;
				FloorY = 0f;
				RootFloorOffset = 0f;
				GroundProbeX = 0f;
				GroundProbeZ = 0f;
				GroundOffsetReady = false;
				HoverHeight = 0f;
				AirborneSince = 0f;
				GetupGraceUntil = 0f;
				LevitationLock = false;
				RandomName = "UNKNOWN_0000";
				RootOriginalScale = Vector3.one;
				ForcedColor = Color.white;
				OriginalSkinMeshes.Clear();
				OriginalFilterMeshes.Clear();
				OriginalTransformScales.Clear();
				OriginalBoxColliderSizes.Clear();
				OriginalSphereColliderRadii.Clear();
				OriginalCapsuleColliderRadii.Clear();
				OriginalCapsuleColliderHeights.Clear();
				OriginalCharacterControllerRadii.Clear();
				OriginalCharacterControllerHeights.Clear();
				BaseMasses.Clear();
				CombatMovementConfigured = false;
				CombatMovementMultiplier = 1f;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static CameraCallback <0>__Function204;

			public static Action<GameState> <1>__Function5;

			public static UpdateFunction <2>__Function191;

			public static SpawnedProjectileEventHandler <3>__Function219;
		}

		private static Main Instance;

		private const string CoreId = "okbro11.tabs.core";

		private const string BattleId = "okbro11.tabs.battle";

		private static Harmony CoreHarmony;

		private static Harmony BattleHarmony;

		private static bool StateLinked;

		private static bool InBattle;

		private static Unit PendingUnit;

		private static UnitBlueprint PlacementBlueprint;

		private static uint PlacementOriginalForceCost = 30u;

		private static bool BattleHooksActive;

		private static bool PlayerLoopActive;

		private static PlayerLoopSystem OldPlayerLoop;

		private static bool InternalHarmonyWrite;

		private static FieldInfo Var_patchProcessorOriginal;

		private static bool InternalTransformWrite;

		private static bool InternalPhysicsWrite;

		private static bool InternalCollisionWrite;

		private static bool InternalMassWrite;

		private static bool InternalIdentityRead;

		private static bool AttackRunning;

		private static NativeArray<float3> JobOut;

		private static bool JobReady;

		private static Action<MeleeWeapon, Vector3, Rigidbody, Vector3, bool> NativeMeleeAttack;

		private static Action<Unit> NativeUnitDestroy;

		private static MethodInfo NativeMeleeAttackStandIn;

		private static MethodInfo NativeUnitDestroyStandIn;

		private static float NextAttack;

		private static float Var_typeatk;

		private static float Var_m0dScan;

		private static Unit Var_typetarget;

		private const float Var_m0dCd = 8f;

		private const float Var_m0dScanStep = 0.65f;

		private static float NextVitality;

		private static float ProtectedHealthValue;

		private static float ProtectedMaxHealthValue;

		private static readonly List<HiBan> HiBans = new List<HiBan>(32);

		private static FieldInfo ReviveStickUnitField;

		private static FieldInfo UnitSpawnerRootUnitField;

		private static FieldInfo CopyPoolOriginalUnitField;

		private static float NextName;

		private static float NextGround;

		private static float NextRiseCheck;

		private static float LastGroundY;

		private static float LastGroundRootY;

		private static float LastGroundTrackTime;

		private static readonly RaycastHit[] GroundHits = (RaycastHit[])(object)new RaycastHit[32];

		private static float NextCrystal;

		private static float NextCollisionIsolation;

		private static float Var_soulNext;

		private static float CombatMovementMultiplier = 1f;

		private static bool CombatMovementConfigured;

		private static readonly List<GameObject> MeleeFragments = new List<GameObject>(256);

		private static readonly List<CollisionPair> CollisionPairs = new List<CollisionPair>(256);

		private static readonly HashSet<ulong> CollisionPairKeys = new HashSet<ulong>();

		private static readonly List<Shockwave> Shockwaves = new List<Shockwave>(24);

		private static Mesh RingMesh;

		private static Mesh SpikeMesh;

		private static Mesh BurstMesh;

		private static Mesh CoreMesh;

		private static Material ShockMaterial;

		private static Material ShockVisualMaterial;

		private static Material CrystalMaterial;

		private static GameObject VisualRoot;

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

		private static int DrawnShockFrame = -1;

		private static float SelfImpactBlockUntil;

		private static readonly List<DelayedDestruction> PendingDestructions = new List<DelayedDestruction>(32);

		private static readonly List<SoulGrabVisual> Var_soulFx = new List<SoulGrabVisual>(16);

		private static bool VitalityInitialized;

		private static NativeArray<float4> VitalityOut;

		private static bool VitalityJobReady;

		private static int VitalityCycleIndex;

		private static Color ForcedUnitColor = Color.white;

		private static MaterialPropertyBlock UnitColorBlock;

		private static bool InternalMaterialWrite;

		private static bool InternalMeshWrite;

		private static bool InternalTargetCleanup;

		private static bool InternalComponentWrite;

		private static FieldInfo ProjectilePrefabsField;

		private static FieldInfo MoveDidStartField;

		private static FieldInfo MoveVelocityInitializedField;

		private static MethodInfo MoveInitializeVelocityMethod;

		private static readonly List<Proj> OwnedProjectiles = new List<Proj>(64);

		private static NativeList<int> ProjectileIndexScratch;

		private static NativeArray<float3> ProjectileVectorScratch;

		private static bool ProjectileNativeReady;

		private static ProjectilesSpawnManager CachedProjectileManager;

		private static Projectile[] CachedProjectilePrefabs;

		private static int ProjectileVisualColorVersion;

		private const string Var_urlbat = "https://github.com/VTILServer/Jack_Hase-s-stuff/raw/refs/heads/main/!UNSORTED!/la.ogg";

		private const string Var_urlfx = "https://github.com/VTILServer/Jack_Hase-s-stuff/raw/refs/heads/main/!UNSORTED!/153832523.ogg";

		private static GameObject Var_audgo;

		private static AudioSource Var_batsrc;

		private static AudioClip Var_batclip;

		private static AudioClip Var_fxclip;

		private static Coroutine Var_batco;

		private static Coroutine Var_fxco;

		private static UnityWebRequest Var_batreq;

		private static UnityWebRequest Var_fxreq;

		private static UnitEffectBase[] Var_effpool;

		private static readonly List<AudioSource> Var_fxsrc = new List<AudioSource>(8);

		private static readonly Queue<Vector3> Var_fxq = new Queue<Vector3>(8);

		private const float Var_batvol = 0.2f;

		private const float Var_fxvol = 0.28f;

		private const float Var_audioSyncStep = 0.05f;

		private const float Var_groundStep = 0.07f;

		private const float Var_levitationGap = 1.35f;

		private static readonly RaycastHit[] ProjectileRaycastBuffer = (RaycastHit[])(object)new RaycastHit[48];

		private static readonly string[] NamePool = new string[10] { "UNKNOWN", "ERROR", "NULL", "DESYNC", "VOID", "BROKEN", "UNIT", "GLITCH", "INVALID", "0x00" };

		private void Awake()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			Instance = this;
			CoreHarmony = new Harmony("okbro11.tabs.core");
			Function346();
			Function347();
			Function348();
			Function340();
			Function344();
			Function1();
			Function189();
			Function260();
			CameraCallback onPreRender = Camera.onPreRender;
			object obj = <>O.<0>__Function204;
			if (obj == null)
			{
				CameraCallback val = Function204;
				<>O.<0>__Function204 = val;
				obj = (object)val;
			}
			Camera.onPreRender = (CameraCallback)Delegate.Combine((Delegate?)(object)onPreRender, (Delegate?)obj);
		}

		private void OnDestroy()
		{
		}

		private static void Function1()
		{
			Function20(CoreHarmony, AccessTools.Method(typeof(UnitPlacementBrush), "Update", (Type[])null, (Type[])null), null, "Function2");
			Function20(CoreHarmony, AccessTools.Method(typeof(GameStateManager), "EnterPlacementState", (Type[])null, (Type[])null), null, "Function3");
		}

		private static void Function2()
		{
			Function4();
			if (!InBattle && Input.GetKeyDown((KeyCode)289))
			{
				Function208();
			}
		}

		private static void Function3()
		{
			Function4();
			Function207();
		}

		private static void Function4()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (!StateLinked)
			{
				GameStateManager service = ServiceLocator.GetService<GameStateManager>();
				if (service != null)
				{
					service.GameStateChanged += Function5;
					StateLinked = true;
					Function5(service.GameState);
				}
			}
		}

		private static void Function5(GameState state)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			if ((int)state == 1)
			{
				Function6();
			}
			else if (InBattle)
			{
				Function7(unload: false);
			}
		}

		private static void Function6()
		{
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			if (InBattle)
			{
				return;
			}
			InBattle = true;
			Function206();
			if (Function287())
			{
				Function8();
				Function217();
				Function210();
				if (!VitalityInitialized)
				{
					Function248();
				}
				Function246();
				Function249();
				NextAttack = Time.unscaledTime + 0.18f;
				Var_typeatk = Time.unscaledTime + 2f;
				Var_m0dScan = 0f;
				Var_typetarget = null;
				Var_effpool = null;
				NextVitality = Time.unscaledTime + 0.5f;
				NextName = Time.unscaledTime + 0.02f;
				NextCrystal = 0f;
				Var_soulNext = Time.unscaledTime + Random.Range(0.8f, 1.8f);
				NextGround = 0f;
				NextRiseCheck = Time.unscaledTime + 1f;
				LastGroundY = State.RootT.position.y;
				LastGroundRootY = State.RootT.position.y;
				LastGroundTrackTime = Time.unscaledTime;
				Function320();
				Function321();
				State.GetupGraceUntil = Time.unscaledTime + 1.25f;
			}
		}

		private static void Function7(bool unload)
		{
			Function322();
			if (BattleHooksActive)
			{
				Function9();
			}
			Function218();
			Function225();
			InBattle = false;
			NextGround = 0f;
			NextRiseCheck = 0f;
			LastGroundY = 0f;
			LastGroundRootY = 0f;
			LastGroundTrackTime = 0f;
			Function279();
			PendingDestructions.Clear();
			Var_effpool = null;
			for (int num = Var_soulFx.Count - 1; num >= 0; num--)
			{
				if (Object.op_Implicit((Object)(object)Var_soulFx[num]))
				{
					Object.Destroy((Object)(object)((Component)Var_soulFx[num]).gameObject);
				}
			}
			Var_soulFx.Clear();
			Function238();
			Function59();
			SelfImpactBlockUntil = 0f;
			Function192();
			if (unload || !Function287())
			{
				State.Function317();
				Shockwaves.Clear();
				HiBans.Clear();
				VitalityInitialized = false;
			}
			else
			{
				PendingUnit = null;
				State.Function317();
				Shockwaves.Clear();
				HiBans.Clear();
				VitalityInitialized = false;
			}
		}

		private static void Function8()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (!BattleHooksActive)
			{
				BattleHarmony = new Harmony("okbro11.tabs.battle");
				Function10(BattleHarmony);
				Function17(BattleHarmony);
				Function18(BattleHarmony);
				Function19(BattleHarmony);
				Function23();
				BattleHooksActive = true;
			}
		}

		private static void Function9()
		{
			InternalHarmonyWrite = true;
			try
			{
				if (BattleHarmony != null)
				{
					BattleHarmony.UnpatchSelf();
				}
			}
			finally
			{
				InternalHarmonyWrite = false;
			}
			BattleHarmony = null;
			NativeMeleeAttack = null;
			NativeUnitDestroy = null;
			NativeMeleeAttackStandIn = null;
			NativeUnitDestroyStandIn = null;
			BattleHooksActive = false;
		}

		private static void Function10(Harmony h)
		{
			Function20(h, AccessTools.Method(typeof(Unit), "DestroyUnit", (Type[])null, (Type[])null), "Function28");
			Function20(h, AccessTools.Method(typeof(Unit), "InitializeUnit", new Type[1] { typeof(Team) }, (Type[])null), "Function148");
			Function20(h, AccessTools.Method(typeof(Unit), "Start", (Type[])null, (Type[])null), "Function16");
			Function20(h, AccessTools.Method(typeof(Unit), "SetSpawnSource", new Type[1] { typeof(UnitSpawnSource) }, (Type[])null), "Function149");
			Function20(h, AccessTools.PropertySetter(typeof(Unit), "RuntimeIndex"), "Function150");
			Function20(h, AccessTools.PropertySetter(typeof(Unit), "RuntimeReference"), "Function151");
			Function20(h, AccessTools.PropertySetter(typeof(Unit), "RemoteInstanceId"), "Function152");
			Function20(h, AccessTools.PropertySetter(typeof(Unit), "InstanceId"), "Function153");
			Function20(h, AccessTools.PropertySetter(typeof(Unit), "NetworkId"), "Function154");
			Function20(h, AccessTools.PropertySetter(typeof(Unit), "SmallNetworkId"), "Function155");
			Function20(h, AccessTools.PropertySetter(typeof(Unit), "CopyOfSmallNetworkId"), "Function156");
			Function20(h, AccessTools.PropertySetter(typeof(Unit), "CopyOfUnitSpawnPosition"), "Function157");
			Function20(h, AccessTools.Method(typeof(Unit), "FreezeBody", (Type[])null, (Type[])null), "Function29");
			Function20(h, AccessTools.Method(typeof(Unit), "UnfreezeBody", (Type[])null, (Type[])null), null, "Function30");
			Function20(h, AccessTools.Method(typeof(Unit), "BatchedUpdate", (Type[])null, (Type[])null), null, "Function31");
			Function20(h, AccessTools.Method(typeof(Unit), "SetMassMultiplier", (Type[])null, (Type[])null), "Function33");
			Function20(h, AccessTools.Method(typeof(UnitBlueprint), "DoMultipliers", (Type[])null, (Type[])null), null, "Function32");
			Function20(h, AccessTools.Method(typeof(WeaponHandler), "Attack", (Type[])null, (Type[])null), "Function34");
			Function20(h, AccessTools.Method(typeof(MeleeWeapon), "Attack", new Type[4]
			{
				typeof(Vector3),
				typeof(Rigidbody),
				typeof(Vector3),
				typeof(bool)
			}, (Type[])null), "Function143");
			Function20(h, AccessTools.Method(typeof(Weapon), "UpdateCounters", new Type[1] { typeof(float) }, (Type[])null), null, "Function214");
			Function20(h, AccessTools.Method(typeof(DataHandler), "BatchedUpdate", (Type[])null, (Type[])null), null, "Function35");
			Function20(h, AccessTools.Method(typeof(DataHandler), "BatchedFixedUpdate", (Type[])null, (Type[])null), "Function36");
			Function20(h, AccessTools.Method(typeof(DataHandler), "BatchedFixedUpdate", (Type[])null, (Type[])null), null, "Function37");
			Function20(h, AccessTools.Method(typeof(DataHandler), "TouchGround", new Type[3]
			{
				typeof(Vector3),
				typeof(Vector3),
				typeof(Rigidbody)
			}, (Type[])null), "Function38");
			Function20(h, AccessTools.Method(typeof(GeneralInput), "Update", (Type[])null, (Type[])null), "Function39");
			Function20(h, AccessTools.PropertySetter(typeof(DataHandler), "Dead"), "Function40");
			Function20(h, AccessTools.Method(typeof(HealthHandler), "Update", (Type[])null, (Type[])null), "Function41");
			Function20(h, AccessTools.Method(typeof(HealthHandler), "TakeDamage", new Type[4]
			{
				typeof(float),
				typeof(Vector3),
				typeof(Unit),
				typeof(DamageType)
			}, (Type[])null), "Function42");
			Function20(h, AccessTools.Method(typeof(Damagable), "TakeDamage", new Type[4]
			{
				typeof(float),
				typeof(Vector3),
				typeof(Unit),
				typeof(DamageType)
			}, (Type[])null), "Function43");
			Function20(h, AccessTools.Method(typeof(Unit), "DealDamage", new Type[1] { typeof(float) }, (Type[])null), "Function44");
			Function20(h, AccessTools.Method(typeof(DamageOverTimeEffect), "AddDamage", Type.EmptyTypes, (Type[])null), "Function45");
			Function20(h, AccessTools.Method(typeof(HealthHandler), "Die", new Type[1] { typeof(Unit) }, (Type[])null), "Function47");
			Function20(h, AccessTools.Method(typeof(HealthHandler), "Die", new Type[1] { typeof(Unit) }, (Type[])null), null, "Function46");
			Function20(h, AccessTools.Method(typeof(HealthHandler), "Die", new Type[1] { typeof(bool) }, (Type[])null), "Function48");
			Function20(h, AccessTools.Method(typeof(RigidbodyHolder), "Start", (Type[])null, (Type[])null), null, "Function49");
			Function20(h, AccessTools.Method(typeof(UnitSpawner), "Start", (Type[])null, (Type[])null), "Function158");
			Function20(h, AccessTools.Method(typeof(UnitSpawner), "Initialize", (Type[])null, (Type[])null), "Function159");
			Function20(h, AccessTools.Method(typeof(UnitSpawner), "Spawnerino", (Type[])null, (Type[])null), "Function160");
			Function20(h, AccessTools.Method(typeof(UnitSpawner), "Spawn", (Type[])null, (Type[])null), "Function161");
			Function20(h, AccessTools.Method(typeof(ReviveStick), "Start", (Type[])null, (Type[])null), "Function162");
			Function20(h, AccessTools.Method(typeof(ReviveStick), "Update", (Type[])null, (Type[])null), "Function163");
			Function20(h, AccessTools.Method(typeof(MonoBehaviour), "StartCoroutine", new Type[1] { typeof(IEnumerator) }, (Type[])null), "Function164");
			Function20(h, AccessTools.Method(typeof(MonoBehaviour), "StartCoroutine", new Type[1] { typeof(string) }, (Type[])null), "Function165");
			Function20(h, AccessTools.Method(typeof(MonoBehaviour), "StartCoroutine", new Type[2]
			{
				typeof(string),
				typeof(object)
			}, (Type[])null), "Function166");
			Function20(h, AccessTools.Method(typeof(CopySelfLimitedPool), "CreatePool", new Type[1] { typeof(Unit) }, (Type[])null), "Function173");
			Function20(h, AccessTools.Method(typeof(CopySelfLimitedPool), "GetNextUnitFromPool", new Type[2]
			{
				typeof(Vector3),
				typeof(Quaternion)
			}, (Type[])null), "Function174");
			Function20(h, AccessTools.Method(typeof(CopySelfLimitedPool), "InitializeUnitFromPool", new Type[3]
			{
				typeof(Unit),
				typeof(Vector3),
				typeof(Quaternion)
			}, (Type[])null), "Function169");
			Function20(h, AccessTools.Method(typeof(NetworkUnit), "Initialize", new Type[2]
			{
				typeof(Unit),
				typeof(bool)
			}, (Type[])null), "Function170");
			Function20(h, AccessTools.Method(typeof(NetworkUnit), "OnUnitDied", Type.EmptyTypes, (Type[])null), "Function171");
			Function21(h, typeof(NetworkUnit), "UpdateWaitingToSpawnLocalCopy", "Function172");
			Function21(h, typeof(NetworkUnit), "UpdateLinkingToPooledUnit", "Function172");
			Function21(h, typeof(NetworkUnit), "SpawnLocalCopyOfRemoteUnit", "Function172");
			Function20(h, AccessTools.Method(typeof(SetParent), "Doit", (Type[])null, (Type[])null), "Function50");
			Function20(h, AccessTools.Method(typeof(UnitPlacementBrush), "RemoveUnitInternal", new Type[2]
			{
				typeof(Unit),
				typeof(Team)
			}, (Type[])null), "Function26");
			Function20(h, AccessTools.Method(typeof(BrushBehaviourOnlineMultiplayer), "RemoveUnit", new Type[2]
			{
				typeof(Unit),
				typeof(bool)
			}, (Type[])null), "Function27");
			Function20(h, AccessTools.Method(typeof(BaseGameMode), "DecideWinner", (Type[])null, (Type[])null), "Function51");
			Function20(h, AccessTools.Method(typeof(BaseGameMode), "OnWinnerDecided", (Type[])null, (Type[])null), "Function51");
			Function20(h, AccessTools.Method(typeof(BaseGameMode), "OnUnitDied", (Type[])null, (Type[])null), "Function51");
			Function20(h, AccessTools.Method(typeof(BaseGameMode), "OnUnitRemoved", (Type[])null, (Type[])null), "Function51");
			Function20(h, AccessTools.Method(typeof(BaseGameMode), "DelayedCheckMatchOver", (Type[])null, (Type[])null), "Function51");
			Function20(h, AccessTools.Method(typeof(BaseGameMode), "UpdateForMatchOver", (Type[])null, (Type[])null), "Function51");
			Function20(h, AccessTools.PropertySetter(typeof(BaseGameMode), "CachedCurrentWinner"), "Function52");
			Function20(h, AccessTools.Method(typeof(SandboxGameMode), "OnWinnerDecided", (Type[])null, (Type[])null), "Function51");
			Function20(h, AccessTools.Method(typeof(WinConditionPropagator), "OnMatchOVer", (Type[])null, (Type[])null), "Function51");
			Function20(h, AccessTools.Method(typeof(WinConditionPropagator), "OnUnitDied", (Type[])null, (Type[])null), "Function51");
			Function20(h, AccessTools.Method(typeof(GameStateManager), "OnMatchOver", (Type[])null, (Type[])null), "Function51");
			Function20(h, AccessTools.Method(typeof(TimeService), "Pause", (Type[])null, (Type[])null), null, "Function54");
			Function21(h, typeof(TimeService), "SetState", null, "Function54");
			Function20(h, AccessTools.Method(typeof(TimeService), "ApplyState", (Type[])null, (Type[])null), null, "Function54");
			Function20(h, AccessTools.Method(typeof(NetworkUnitsManager), "RemoveUnitOnError", new Type[3]
			{
				typeof(int),
				typeof(bool),
				typeof(bool)
			}, (Type[])null), "Function53");
			Function20(h, AccessTools.Method(typeof(ProjectileHit), "Hit", new Type[2]
			{
				typeof(RaycastHit),
				typeof(float)
			}, (Type[])null), "Function109");
			Function20(h, AccessTools.Method(typeof(ProjectileHit), "AddForceToTarget", new Type[3]
			{
				typeof(Vector3),
				typeof(Rigidbody),
				typeof(float)
			}, (Type[])null), "Function110");
			Function20(h, AccessTools.Method(typeof(MoveTransform), "InitializeVelocity", (Type[])null, (Type[])null), "Function114");
			PropertyInfo property = typeof(MoveTransform).GetProperty("velocity", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (property != null && property.CanWrite)
			{
				Function20(h, property.GetSetMethod(nonPublic: true), "Function115");
			}
			else
			{
				Function20(h, AccessTools.Method(typeof(MoveTransform), "Update", (Type[])null, (Type[])null), null, "Function116");
			}
			Function11(h);
		}

		private static void Function11(Harmony h)
		{
			if (h == null)
			{
				return;
			}
			Assembly assembly = typeof(Unit).Assembly;
			Type[] types;
			try
			{
				types = assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				types = ex.Types;
			}
			if (types == null)
			{
				return;
			}
			foreach (Type type in types)
			{
				if (type == null || type.IsInterface || type.IsAbstract)
				{
					continue;
				}
				string text = (type.FullName ?? type.Name).ToLowerInvariant();
				if (!text.Contains("unit") && !text.Contains("revive") && !text.Contains("spawn") && !text.Contains("pool") && !text.Contains("network") && !text.Contains("editor"))
				{
					continue;
				}
				MethodInfo[] methods;
				try
				{
					methods = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				}
				catch
				{
					continue;
				}
				foreach (MethodInfo methodInfo in methods)
				{
					if (!(methodInfo == null) && !methodInfo.IsAbstract && !methodInfo.IsSpecialName && Function12(methodInfo.Name.ToLowerInvariant()) && !methodInfo.ContainsGenericParameters && !(methodInfo == AccessTools.Method(typeof(Unit), "InitializeUnit", new Type[1] { typeof(Team) }, (Type[])null)) && !(methodInfo == AccessTools.Method(typeof(UnitSpawner), "Start", (Type[])null, (Type[])null)))
					{
						if (methodInfo.ReturnType == typeof(GameObject[]))
						{
							Function20(h, methodInfo, "Function14");
						}
						else
						{
							Function20(h, methodInfo, "Function13");
						}
					}
				}
			}
		}

		private static bool Function12(string name)
		{
			if (!name.Contains("spawn") && !name.Contains("respawn") && !name.Contains("revive") && !name.Contains("initialize") && !name.Contains("initialise") && !name.Contains("recreate") && !name.Contains("createcopy") && !name.Contains("copyofunit") && !name.Contains("waitingtospawn") && !name.Contains("linkingtopooled") && !name.Contains("reanimate") && !name.Contains("reincarnate") && !name.Contains("reappear") && !name.Contains("returntopool") && !name.Contains("activatepool"))
			{
				return name.Contains("restore");
			}
			return true;
		}

		private static bool Function13(object __instance)
		{
			if (!Function288() || __instance == null)
			{
				return true;
			}
			Unit val = Function15(__instance);
			if ((Object)(object)val != (Object)null && Function188((Object)(object)val) && !Function185((Object)(object)val))
			{
				Function180(val);
				return false;
			}
			return true;
		}

		private static bool Function14(object __instance, ref GameObject[] __result)
		{
			if (!Function288() || __instance == null)
			{
				return true;
			}
			Unit val = Function15(__instance);
			if ((Object)(object)val != (Object)null && Function188((Object)(object)val) && !Function185((Object)(object)val))
			{
				Function180(val);
				__result = null;
				return false;
			}
			return true;
		}

		private static Unit Function15(object value)
		{
			if (value == null)
			{
				return null;
			}
			Unit val = (Unit)((value is Unit) ? value : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				return val;
			}
			Component val2 = (Component)((value is Component) ? value : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				return val2.GetComponentInParent<Unit>();
			}
			GameObject val3 = (GameObject)((value is GameObject) ? value : null);
			if (Object.op_Implicit((Object)(object)val3))
			{
				return val3.GetComponentInParent<Unit>();
			}
			return null;
		}

		private static bool Function16(Unit __instance)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if (!Function288() || !Object.op_Implicit((Object)(object)__instance))
			{
				return true;
			}
			if (Function281((Object)(object)__instance))
			{
				return true;
			}
			if (Function188((Object)(object)__instance))
			{
				Function180(__instance);
				return false;
			}
			for (int i = 0; i < HiBans.Count; i++)
			{
				HiBan hiBan = HiBans[i];
				if (hiBan == null || (Object)(object)hiBan.Blueprint != (Object)(object)__instance.unitBlueprint || __instance.Team != hiBan.Team)
				{
					continue;
				}
				Vector3 val = ((Component)__instance).transform.position - hiBan.SpawnPosition;
				if (((Vector3)(ref val)).sqrMagnitude <= 9f)
				{
					try
					{
						Object.Destroy((Object)(object)((Component)__instance).gameObject);
					}
					catch
					{
					}
					return false;
				}
			}
			return true;
		}

		private static void Function17(Harmony h)
		{
			Function20(h, AccessTools.PropertySetter(typeof(Transform), "position"), "Function65");
			Function20(h, AccessTools.PropertySetter(typeof(Transform), "rotation"), "Function93");
			Function20(h, AccessTools.PropertySetter(typeof(Transform), "localScale"), "Function94");
			Function20(h, AccessTools.PropertySetter(typeof(BoxCollider), "size"), "Function95");
			Function20(h, AccessTools.PropertySetter(typeof(SphereCollider), "radius"), "Function96");
			Function20(h, AccessTools.PropertySetter(typeof(CapsuleCollider), "radius"), "Function97");
			Function20(h, AccessTools.PropertySetter(typeof(CapsuleCollider), "height"), "Function98");
			Function20(h, AccessTools.PropertySetter(typeof(CharacterController), "radius"), "Function99");
			Function20(h, AccessTools.PropertySetter(typeof(CharacterController), "height"), "Function100");
			Function20(h, AccessTools.PropertySetter(typeof(Transform), "localPosition"), "Function66");
			Function20(h, AccessTools.PropertySetter(typeof(Transform), "localEulerAngles"), "Function67");
			MethodInfo method = typeof(Transform).GetMethod("SetLocalPositionAndRotation", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2]
			{
				typeof(Vector3),
				typeof(Quaternion)
			}, null);
			if (method != null)
			{
				Function20(h, method, "Function68");
			}
			else
			{
				Function20(h, AccessTools.Method(typeof(Transform), "SetPositionAndRotation", (Type[])null, (Type[])null), "Function68");
			}
			Function20(h, AccessTools.Method(typeof(Transform), "SetPositionAndRotation", (Type[])null, (Type[])null), "Function69");
			Function20(h, AccessTools.PropertySetter(typeof(Transform), "parent"), "Function70");
			Function20(h, AccessTools.Method(typeof(Transform), "SetParent", new Type[2]
			{
				typeof(Transform),
				typeof(bool)
			}, (Type[])null), "Function71");
			Function20(h, AccessTools.Method(typeof(Transform), "SetParent", new Type[1] { typeof(Transform) }, (Type[])null), "Function72");
			Function20(h, AccessTools.PropertySetter(typeof(Rigidbody), "mass"), "Function73");
			Function20(h, AccessTools.PropertySetter(typeof(Rigidbody), "position"), "Function74");
			Function20(h, AccessTools.PropertySetter(typeof(Rigidbody), "velocity"), "Function75");
			Function20(h, AccessTools.PropertySetter(typeof(Rigidbody), "angularVelocity"), "Function76");
			Function20(h, AccessTools.PropertySetter(typeof(Rigidbody), "isKinematic"), "Function77");
			Function20(h, AccessTools.PropertySetter(typeof(Rigidbody), "useGravity"), "Function78");
			Function20(h, AccessTools.PropertySetter(typeof(Rigidbody), "constraints"), "Function79");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "MovePosition", (Type[])null, (Type[])null), "Function80");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "MoveRotation", (Type[])null, (Type[])null), "Function81");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddForce", new Type[1] { typeof(Vector3) }, (Type[])null), "Function82");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddForce", new Type[2]
			{
				typeof(Vector3),
				typeof(ForceMode)
			}, (Type[])null), "Function85");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddRelativeForce", new Type[1] { typeof(Vector3) }, (Type[])null), "Function82");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddRelativeForce", new Type[2]
			{
				typeof(Vector3),
				typeof(ForceMode)
			}, (Type[])null), "Function85");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddForceAtPosition", new Type[2]
			{
				typeof(Vector3),
				typeof(Vector3)
			}, (Type[])null), "Function83");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddForceAtPosition", new Type[3]
			{
				typeof(Vector3),
				typeof(Vector3),
				typeof(ForceMode)
			}, (Type[])null), "Function86");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddExplosionForce", new Type[3]
			{
				typeof(float),
				typeof(Vector3),
				typeof(float)
			}, (Type[])null), "Function88");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddExplosionForce", new Type[4]
			{
				typeof(float),
				typeof(Vector3),
				typeof(float),
				typeof(float)
			}, (Type[])null), "Function89");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddExplosionForce", new Type[5]
			{
				typeof(float),
				typeof(Vector3),
				typeof(float),
				typeof(float),
				typeof(ForceMode)
			}, (Type[])null), "Function87");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddTorque", new Type[1] { typeof(Vector3) }, (Type[])null), "Function84");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddTorque", new Type[2]
			{
				typeof(Vector3),
				typeof(ForceMode)
			}, (Type[])null), "Function90");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddRelativeTorque", new Type[1] { typeof(Vector3) }, (Type[])null), "Function84");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "AddRelativeTorque", new Type[2]
			{
				typeof(Vector3),
				typeof(ForceMode)
			}, (Type[])null), "Function90");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "Sleep", (Type[])null, (Type[])null), "Function91");
			Function20(h, AccessTools.Method(typeof(WilhelmPhysicsFunctions), "AddForceWithMinWeight", new Type[4]
			{
				typeof(Rigidbody),
				typeof(Vector3),
				typeof(ForceMode),
				typeof(float)
			}, (Type[])null), "Function111");
			Function20(h, AccessTools.Method(typeof(WilhelmPhysicsFunctions), "AddForceWithMinWeight", new Type[5]
			{
				typeof(Rigidbody),
				typeof(Vector3),
				typeof(Vector3),
				typeof(ForceMode),
				typeof(float)
			}, (Type[])null), "Function112");
			Function20(h, AccessTools.Method(typeof(WilhelmPhysicsFunctions), "AddAxplosionForceWithMinWeight", new Type[6]
			{
				typeof(Rigidbody),
				typeof(float),
				typeof(Vector3),
				typeof(float),
				typeof(ForceMode),
				typeof(float)
			}, (Type[])null), "Function113");
			Function20(h, AccessTools.Method(typeof(Rigidbody), "WakeUp", (Type[])null, (Type[])null), "Function92");
			Function20(h, AccessTools.Method(typeof(Physics), "IgnoreCollision", new Type[3]
			{
				typeof(Collider),
				typeof(Collider),
				typeof(bool)
			}, (Type[])null), "Function60");
			Function20(h, AccessTools.PropertySetter(typeof(Behaviour), "enabled"), "Function117");
			Function20(h, AccessTools.PropertySetter(typeof(Collider), "enabled"), "Function118");
			Function20(h, AccessTools.PropertySetter(typeof(Renderer), "enabled"), "Function119");
			Function20(h, AccessTools.PropertySetter(typeof(Renderer), "sharedMaterials"), "Function101");
			Function20(h, AccessTools.PropertySetter(typeof(Renderer), "materials"), "Function101");
			Function20(h, AccessTools.PropertySetter(typeof(Renderer), "sharedMaterial"), "Function102");
			Function20(h, AccessTools.PropertySetter(typeof(Renderer), "material"), "Function102");
			Function20(h, AccessTools.PropertySetter(typeof(GameObject), "layer"), "Function106");
			Function20(h, AccessTools.PropertySetter(typeof(GameObject), "tag"), "Function107");
			Function20(h, AccessTools.PropertySetter(typeof(Object), "name"), "Function108");
			Function20(h, AccessTools.PropertySetter(typeof(Object), "hideFlags"), "Function103");
			Function20(h, AccessTools.Method(typeof(GameObject), "SetActive", new Type[1] { typeof(bool) }, (Type[])null), "Function120");
			Function20(h, AccessTools.Method(typeof(GameObject), "AddComponent", new Type[1] { typeof(Type) }, (Type[])null), "Function121");
			Function20(h, AccessTools.Method(typeof(GameObject), "AddComponent", new Type[1] { typeof(string) }, (Type[])null), "Function122");
			Function20(h, AccessTools.Method(typeof(Transform), "SetAsFirstSibling", (Type[])null, (Type[])null), "Function104");
			Function20(h, AccessTools.Method(typeof(Transform), "SetAsLastSibling", (Type[])null, (Type[])null), "Function104");
			Function20(h, AccessTools.Method(typeof(Transform), "SetSiblingIndex", new Type[1] { typeof(int) }, (Type[])null), "Function105");
			Function20(h, AccessTools.Method(typeof(Transform), "DetachChildren", (Type[])null, (Type[])null), "Function104");
			Function20(h, AccessTools.Method(typeof(Object), "Destroy", new Type[1] { typeof(Object) }, (Type[])null), "Function123");
			Function20(h, AccessTools.Method(typeof(Object), "Destroy", new Type[2]
			{
				typeof(Object),
				typeof(float)
			}, (Type[])null), "Function123");
			Function20(h, AccessTools.Method(typeof(Object), "DestroyImmediate", new Type[1] { typeof(Object) }, (Type[])null), "Function123");
			Function20(h, AccessTools.Method(typeof(Object), "DestroyImmediate", new Type[2]
			{
				typeof(Object),
				typeof(bool)
			}, (Type[])null), "Function123");
			Function20(h, AccessTools.Method(typeof(Object), "DestroyObject", new Type[2]
			{
				typeof(Object),
				typeof(float)
			}, (Type[])null), "Function123");
			Function20(h, AccessTools.Method(typeof(Object), "Instantiate", new Type[1] { typeof(Object) }, (Type[])null), "Function126");
			Function20(h, AccessTools.Method(typeof(Object), "Instantiate", new Type[3]
			{
				typeof(Object),
				typeof(Vector3),
				typeof(Quaternion)
			}, (Type[])null), "Function127");
			Function20(h, AccessTools.Method(typeof(Object), "Instantiate", new Type[2]
			{
				typeof(Object),
				typeof(Transform)
			}, (Type[])null), "Function128");
			Function20(h, AccessTools.Method(typeof(Object), "Instantiate", new Type[4]
			{
				typeof(Object),
				typeof(Vector3),
				typeof(Quaternion),
				typeof(Transform)
			}, (Type[])null), "Function129");
			Function20(h, AccessTools.Method(typeof(Object), "Instantiate", new Type[3]
			{
				typeof(Object),
				typeof(Transform),
				typeof(bool)
			}, (Type[])null), "Function130");
			Function20(h, AccessTools.Method(typeof(Object), "DestroyObject", new Type[1] { typeof(Object) }, (Type[])null), "Function123");
			Function20(h, AccessTools.Method(typeof(Object), "FindObjectOfType", new Type[1] { typeof(Type) }, (Type[])null), null, "Function124");
			Function20(h, AccessTools.Method(typeof(Object), "FindObjectsOfType", new Type[1] { typeof(Type) }, (Type[])null), null, "Function125");
			MethodInfo method2 = typeof(Object).GetMethod("FindObjectsOfType", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2]
			{
				typeof(Type),
				typeof(bool)
			}, null);
			if (method2 != null)
			{
				Function20(h, method2, null, "Function125");
			}
			Function20(h, AccessTools.PropertySetter(typeof(SkinnedMeshRenderer), "sharedMesh"), "Function133");
			PropertyInfo property = typeof(SkinnedMeshRenderer).GetProperty("mesh", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (property != null && property.CanWrite)
			{
				Function20(h, property.GetSetMethod(nonPublic: true), "Function133");
			}
			Function20(h, AccessTools.PropertySetter(typeof(MeshFilter), "sharedMesh"), "Function134");
			Function20(h, AccessTools.PropertySetter(typeof(MeshFilter), "mesh"), "Function134");
			Function20(h, AccessTools.Method(typeof(SkinnedMeshRenderer), "SetBlendShapeWeight", (Type[])null, (Type[])null), "Function135");
			Function20(h, AccessTools.PropertySetter(typeof(SkinnedMeshRenderer), "rootBone"), "Function136");
			Function20(h, AccessTools.PropertySetter(typeof(SkinnedMeshRenderer), "bones"), "Function137");
			Function20(h, AccessTools.PropertySetter(typeof(SkinnedMeshRenderer), "localBounds"), "Function138");
			PropertyInfo property2 = typeof(SkinnedMeshRenderer).GetProperty("updateWhenOffscreen", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (property2 != null && property2.CanWrite)
			{
				Function20(h, property2.GetSetMethod(nonPublic: true), "Function139");
			}
			Function20(h, AccessTools.PropertySetter(typeof(MeshCollider), "sharedMesh"), "Function140");
		}

		private static void Function18(Harmony h)
		{
			Function20(h, AccessTools.Method(typeof(MeleeWeapon), "StopSwing", (Type[])null, (Type[])null), "Function144");
			Function21(h, typeof(MeleeWeapon), "DoSwing", null, "Function141");
			Function20(h, AccessTools.Method(typeof(CollisionWeapon), "OnCollisionEnter", new Type[1] { typeof(Collision) }, (Type[])null), "Function61");
			Function20(h, AccessTools.Method(typeof(CollisionWeapon), "OnCollisionEnter", new Type[1] { typeof(Collision) }, (Type[])null), null, "Function64");
			Function20(h, AccessTools.Method(typeof(CollisionWeapon), "DoCollisionEffects", new Type[2]
			{
				typeof(Transform),
				typeof(Collision)
			}, (Type[])null), "Function62");
			Function20(h, AccessTools.Method(typeof(CollisionWeapon), "WeaponCollision", new Type[2]
			{
				typeof(Collision),
				typeof(float)
			}, (Type[])null), "Function63");
		}