Decompiled source of Overwatch Shion v1.0.0

plugins/ShionMod/ShionMod.dll

Decompiled 21 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using HarmonyLib;
using KinematicCharacterController;
using R2API;
using Rewired;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace ShionMod;

public static class BikeBalance
{
	public const float ContactInterval = 0.5f;

	public const float ContactDamage = 1f;

	public const float ContactRadius = 1.6f;

	public const float DamageMultiplier = 0.7f;

	public const float ExplosionRadius = 10f;
}
public sealed class BikeContactDamage : MonoBehaviour
{
	private readonly Dictionary<HealthComponent, float> nextHits = new Dictionary<HealthComponent, float>();

	private CharacterBody body;

	private EntityStateMachine machine;

	private Vector3 previous;

	private bool riding;

	public bool Riding
	{
		get
		{
			if (Object.op_Implicit((Object)(object)machine))
			{
				return machine.state is JoyrideState;
			}
			return false;
		}
	}

	private void Awake()
	{
		body = ((Component)this).GetComponent<CharacterBody>();
		EntityStateMachine[] components = ((Component)this).GetComponents<EntityStateMachine>();
		foreach (EntityStateMachine val in components)
		{
			if (val.customName == "Body")
			{
				machine = val;
			}
		}
	}

	private void FixedUpdate()
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: 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_013e: 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_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: 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_01de: 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_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Expected O, but got Unknown
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive)
		{
			return;
		}
		if (!Riding)
		{
			if (riding)
			{
				nextHits.Clear();
			}
			riding = false;
			return;
		}
		Vector3 val = body.footPosition + Vector3.up * 0.8f;
		if (!riding)
		{
			previous = val;
			riding = true;
		}
		Vector3 val2 = previous;
		LayerIndex entityPrecise = LayerIndex.entityPrecise;
		Collider[] array = Physics.OverlapCapsule(val2, val, 1.6f, LayerMask.op_Implicit(((LayerIndex)(ref entityPrecise)).mask), (QueryTriggerInteraction)2);
		foreach (Collider val3 in array)
		{
			HurtBox component = ((Component)val3).GetComponent<HurtBox>();
			if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.healthComponent) || !component.healthComponent.alive)
			{
				continue;
			}
			HealthComponent healthComponent = component.healthComponent;
			CharacterBody val4 = healthComponent.body;
			if (Object.op_Implicit((Object)(object)val4) && !((Object)(object)val4 == (Object)(object)body) && Object.op_Implicit((Object)(object)val4.teamComponent) && val4.teamComponent.teamIndex != body.teamComponent.teamIndex && (int)val4.teamComponent.teamIndex != 0 && (!nextHits.TryGetValue(healthComponent, out var value) || !(Time.fixedTime < value)))
			{
				Vector3 val5 = val - previous;
				float num;
				if (!(((Vector3)(ref val5)).sqrMagnitude > 1E-05f))
				{
					num = 0f;
				}
				else
				{
					Bounds bounds = val3.bounds;
					num = Mathf.Clamp01(Vector3.Dot(((Bounds)(ref bounds)).center - previous, val5) / ((Vector3)(ref val5)).sqrMagnitude);
				}
				float num2 = num;
				Vector3 val6 = previous + val5 * num2;
				Vector3 val7 = val3.ClosestPoint(val6);
				LayerIndex world = LayerIndex.world;
				if (!Physics.Linecast(val6, val7, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
				{
					nextHits[healthComponent] = Time.fixedTime + 0.5f;
					DamageInfo val8 = new DamageInfo();
					val8.attacker = ((Component)this).gameObject;
					val8.inflictor = ((Component)this).gameObject;
					val8.damage = body.damage * 1f;
					val8.position = val7;
					val8.procCoefficient = 0.5f;
					val8.crit = body.RollCrit();
					val8.force = Vector3.zero;
					DamageInfo val9 = val8;
					healthComponent.TakeDamage(val9);
					GlobalEventManager.instance.OnHitEnemy(val9, ((Component)healthComponent).gameObject);
					GlobalEventManager.instance.OnHitAll(val9, ((Component)healthComponent).gameObject);
				}
			}
		}
		previous = val;
	}
}
[HarmonyPatch(typeof(HealthComponent), "TakeDamage")]
public static class BikeDamageReduction
{
	private static bool Prefix(HealthComponent __instance, DamageInfo damageInfo, out float __state)
	{
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		__state = damageInfo.damage;
		if (!NetworkServer.active)
		{
			return true;
		}
		CharacterBody body = __instance.body;
		if (!Object.op_Implicit((Object)(object)body) || body.baseNameToken != "SHION_NAME")
		{
			return true;
		}
		bool flag = false;
		bool flag2 = false;
		EntityStateMachine[] components = ((Component)body).GetComponents<EntityStateMachine>();
		foreach (EntityStateMachine val in components)
		{
			if (val.customName == "Body")
			{
				flag = val.state is JoyrideState;
				flag2 = val.state is SpreeState;
				break;
			}
		}
		if (flag && DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)2097152)) != 0)
		{
			return false;
		}
		if (flag || flag2)
		{
			damageInfo.damage *= 0.7f;
		}
		return true;
	}

	private static void Postfix(DamageInfo damageInfo, float __state)
	{
		damageInfo.damage = __state;
	}
}
internal static class BikeEquipmentLock
{
	internal static bool IsShion(CharacterBody body)
	{
		if (Object.op_Implicit((Object)(object)body))
		{
			return body.baseNameToken == "SHION_NAME";
		}
		return false;
	}

	internal static bool Locked(Inventory inventory)
	{
		CharacterMaster component = ((Component)inventory).GetComponent<CharacterMaster>();
		if (Object.op_Implicit((Object)(object)component))
		{
			if (!IsShion(component.GetBody()))
			{
				if (Object.op_Implicit((Object)(object)component.bodyPrefab))
				{
					return IsShion(component.bodyPrefab.GetComponent<CharacterBody>());
				}
				return false;
			}
			return true;
		}
		return false;
	}
}
[HarmonyPatch]
internal static class BikeInventoryLockPatch
{
	private static MethodBase TargetMethod()
	{
		return AccessTools.Method(typeof(Inventory), "SetEquipment", new Type[2]
		{
			typeof(EquipmentState).MakeByRefType(),
			typeof(EquipmentLocation).MakeByRefType()
		}, (Type[])null);
	}

	private static bool Prefix(Inventory __instance, ref EquipmentState equipmentState, ref EquipmentLocation location)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)Plugin.BikeEquipment) && location.slot == 0 && BikeEquipmentLock.Locked(__instance))
		{
			return equipmentState.equipmentIndex == Plugin.BikeEquipment.equipmentIndex;
		}
		return true;
	}
}
[HarmonyPatch(typeof(EquipmentDef), "AttemptGrant")]
internal static class BikePickupLockPatch
{
	private static bool Prefix(ref GrantContext context)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		if (!BikeEquipmentLock.IsShion(context.body) || !Object.op_Implicit((Object)(object)context.body.inventory))
		{
			return true;
		}
		EquipmentLocationQueryArgs defaultPickup = EquipmentLocationQueryArgs.defaultPickup;
		if (context.body.inventory.FindBestEquipmentLocationOrCurrent(ref defaultPickup).slot != 0)
		{
			return true;
		}
		context.shouldDestroy = false;
		context.shouldNotify = false;
		if (Object.op_Implicit((Object)(object)context.controller))
		{
			context.controller.StartWaitTime();
		}
		return false;
	}
}
[DefaultExecutionOrder(12020)]
public sealed class BikeRideVfx : MonoBehaviour
{
	private CharacterBody body;

	private EntityStateMachine machine;

	private Material tireMaterial;

	private Material originalMaterial;

	private SkinnedMeshRenderer tires;

	private readonly TrailRenderer[] wakes = (TrailRenderer[])(object)new TrailRenderer[4];

	private Vector3 lastPosition;

	private bool wasRiding;

	private float speed;

	public float VisualSpeed => speed;

	public static Color SpeedColor(float metersPerSecond)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		return Color.Lerp(new Color(0.025f, 0.45f, 1f), new Color(1f, 0.035f, 0.015f), Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(8f, 23f, metersPerSecond)));
	}

	private void Start()
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Expected O, but got Unknown
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		body = ((Component)this).GetComponent<CharacterBody>();
		machine = ((Component)this).GetComponents<EntityStateMachine>().First((EntityStateMachine m) => m.customName == "Body");
		ShionVfx.Warmup();
		for (int num = 0; num < wakes.Length; num++)
		{
			GameObject val = new GameObject("BikeAirWake" + num);
			val.layer = 0;
			val.transform.SetParent(((Component)this).transform, false);
			TrailRenderer val2 = val.AddComponent<TrailRenderer>();
			wakes[num] = val2;
			((Renderer)val2).sharedMaterial = ShionVfx.TrailMaterial;
			val2.time = 0.22f;
			val2.minVertexDistance = 0.08f;
			val2.widthCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
			{
				new Keyframe(0f, 0f),
				new Keyframe(0.15f, 1f),
				new Keyframe(1f, 0f)
			});
			val2.widthMultiplier = ((num < 2) ? 0.09f : 0.035f);
			val2.numCornerVertices = 2;
			((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0;
			val2.emitting = false;
			((Renderer)val2).enabled = false;
		}
		lastPosition = ((Component)this).transform.position;
	}

	private void Bind()
	{
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Expected O, but got Unknown
		if (Object.op_Implicit((Object)(object)tires) || !Object.op_Implicit((Object)(object)body.modelLocator) || !Object.op_Implicit((Object)(object)body.modelLocator.modelTransform))
		{
			return;
		}
		OriginalModel componentInChildren = ((Component)body.modelLocator.modelTransform).GetComponentInChildren<OriginalModel>();
		if (Object.op_Implicit((Object)(object)componentInChildren))
		{
			tires = ((IEnumerable<SkinnedMeshRenderer>)componentInChildren.bike).FirstOrDefault((Func<SkinnedMeshRenderer, bool>)((SkinnedMeshRenderer r) => Object.op_Implicit((Object)(object)((Renderer)r).sharedMaterial) && ((Object)((Renderer)r).sharedMaterial).name == "ShionMaterial3"));
			if (Object.op_Implicit((Object)(object)tires))
			{
				originalMaterial = ((Renderer)tires).sharedMaterial;
				tireMaterial = new Material(originalMaterial);
				((Object)tireMaterial).name = "ShionSpeedTires";
				tireMaterial.SetTexture("_EmTex", (Texture)(object)Texture2D.whiteTexture);
				((Renderer)tires).sharedMaterial = tireMaterial;
			}
		}
	}

	private void LateUpdate()
	{
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: 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_013f: 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_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_028c: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
		Bind();
		JoyrideState joyrideState = (Object.op_Implicit((Object)(object)machine) ? (machine.state as JoyrideState) : null);
		bool flag = joyrideState != null && !joyrideState.Charging && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive;
		Vector3 val = ((Component)this).transform.position - lastPosition;
		lastPosition = ((Component)this).transform.position;
		float num;
		if (!wasRiding || !(((Vector3)(ref val)).magnitude < 5f))
		{
			num = 0f;
		}
		else
		{
			Vector3 val2 = Vector3.ProjectOnPlane(val, Vector3.up);
			num = ((Vector3)(ref val2)).magnitude / Mathf.Max(Time.deltaTime, 0.001f);
		}
		float num2 = num;
		if (joyrideState == null || !joyrideState.Charging)
		{
			speed = Mathf.Lerp(speed, flag ? Mathf.Min(num2, 30f) : 0f, 1f - Mathf.Exp((0f - Time.deltaTime) * 12f));
		}
		Color val3 = SpeedColor(speed);
		if (Object.op_Implicit((Object)(object)tireMaterial))
		{
			tireMaterial.SetColor("_EmColor", (joyrideState != null) ? val3 : Color.black);
			tireMaterial.SetFloat("_EmPower", (joyrideState != null) ? 1.8f : 0f);
		}
		Vector3 val4 = ((Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.characterDirection)) ? body.characterDirection.forward : ((Component)this).transform.forward);
		Vector3 val5 = Vector3.Cross(Vector3.up, val4);
		bool emitting = flag && speed > 2f;
		for (int i = 0; i < wakes.Length; i++)
		{
			TrailRenderer val6 = wakes[i];
			if (Object.op_Implicit((Object)(object)val6))
			{
				if (flag != wasRiding || ((Vector3)(ref val)).magnitude >= 5f)
				{
					val6.Clear();
				}
				((Component)val6).transform.position = body.footPosition + Vector3.up * ((i < 2) ? 0.5f : 1.15f) + val5 * ((float)((i % 2 != 0) ? 1 : (-1)) * ((i < 2) ? 0.34f : 0.6f)) - val4 * 0.65f;
				val6.emitting = emitting;
				((Renderer)val6).enabled = flag;
				Color val7 = Color.Lerp(val3, Color.white, 0.75f);
				val7.a = Mathf.Lerp(0.06f, 0.24f, Mathf.Clamp01(speed / 23f));
				val6.startColor = val7;
				val7.a = 0f;
				val6.endColor = val7;
				val6.time = Mathf.Lerp(0.12f, 0.28f, Mathf.Clamp01(speed / 23f));
			}
		}
		wasRiding = flag;
	}

	private void OnDisable()
	{
		wasRiding = false;
		speed = 0f;
		TrailRenderer[] array = wakes;
		foreach (TrailRenderer val in array)
		{
			if (Object.op_Implicit((Object)(object)val))
			{
				val.emitting = false;
				val.Clear();
				((Renderer)val).enabled = false;
			}
		}
		if (Object.op_Implicit((Object)(object)tireMaterial))
		{
			tireMaterial.SetFloat("_EmPower", 0f);
		}
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)tires) && Object.op_Implicit((Object)(object)originalMaterial))
		{
			((Renderer)tires).sharedMaterial = originalMaterial;
		}
		if (Object.op_Implicit((Object)(object)tireMaterial))
		{
			Object.Destroy((Object)(object)tireMaterial);
		}
	}
}
[DefaultExecutionOrder(12000)]
public sealed class BlueGunVfx : MonoBehaviour
{
	private struct Shot
	{
		public bool left;

		public bool flash;

		public bool electric;

		public Vector3 end;
	}

	private sealed class Beam
	{
		public LineRenderer glow;

		public LineRenderer core;

		public LineRenderer arc;

		public bool electric;

		public Transform muzzle;

		public Vector3 end;

		public float until;

		public float duration;
	}

	private readonly Queue<Shot> pending = new Queue<Shot>();

	private readonly List<Beam> pool = new List<Beam>();

	private int cursor;

	private OriginalModel model;

	private ParticleSystem sparks;

	private readonly Transform[] muzzles = (Transform[])(object)new Transform[2];

	private readonly ParticleSystem[] flashes = (ParticleSystem[])(object)new ParticleSystem[2];

	private readonly TrailRenderer[] spreeRibbons = (TrailRenderer[])(object)new TrailRenderer[2];

	private EntityStateMachine bodyMachine;

	private bool ribbonActive;

	public int QueuedShots { get; private set; }

	private OriginalModel ResolveModel()
	{
		CharacterBody component = ((Component)this).GetComponent<CharacterBody>();
		if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.modelLocator) || !Object.op_Implicit((Object)(object)component.modelLocator.modelTransform))
		{
			return ((Component)this).GetComponentInChildren<OriginalModel>();
		}
		return ((Component)component.modelLocator.modelTransform).GetComponentInChildren<OriginalModel>();
	}

	private void BindMuzzles()
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Expected O, but got Unknown
		//IL_014d: 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)
		for (int i = 0; i < 2; i++)
		{
			if (!Object.op_Implicit((Object)(object)muzzles[i]))
			{
				string name = ((i == 0) ? "bone_0931" : "bone_0932");
				muzzles[i] = Array.Find(model.bones, (Transform b) => ((Object)b).name == name);
				if (Object.op_Implicit((Object)(object)muzzles[i]))
				{
					flashes[i] = ShionVfx.Make(muzzles[i], "BlueGunOriginalFlash", 8);
					MainModule main = flashes[i].main;
					((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0;
					((MainModule)(ref main)).startRotation = new MinMaxCurve(-0.2f, 0.2f);
					((Renderer)((Component)flashes[i]).GetComponent<ParticleSystemRenderer>()).sharedMaterial = ShionVfx.FlashMaterial;
					GameObject val = new GameObject("SpreeGunRibbon");
					val.layer = 0;
					val.transform.SetParent(muzzles[i], false);
					TrailRenderer val2 = val.AddComponent<TrailRenderer>();
					spreeRibbons[i] = val2;
					((Renderer)val2).sharedMaterial = ShionVfx.TrailMaterial;
					val2.time = 0.18f;
					val2.minVertexDistance = 0.015f;
					val2.startWidth = 0.09f;
					val2.endWidth = 0f;
					val2.startColor = new Color(0.3f, 0.85f, 1f, 0.7f);
					val2.endColor = new Color(0.02f, 0.3f, 1f, 0f);
					((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0;
					val2.emitting = false;
					((Renderer)val2).enabled = false;
				}
			}
		}
	}

	public void QueueShot(bool left, Vector3 end, bool flash, bool electric = false)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		if (pending.Count < 64)
		{
			pending.Enqueue(new Shot
			{
				left = left,
				end = end,
				flash = flash,
				electric = electric
			});
			QueuedShots++;
		}
	}

	public static LineRenderer Line(Transform parent, string name, float width)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		GameObject val = new GameObject(name);
		val.transform.SetParent(parent, false);
		val.layer = 0;
		LineRenderer val2 = val.AddComponent<LineRenderer>();
		((Renderer)val2).sharedMaterial = ShionVfx.TrailMaterial;
		val2.useWorldSpace = true;
		val2.positionCount = 2;
		val2.startWidth = width;
		val2.endWidth = width * 0.45f;
		val2.numCapVertices = 2;
		((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0;
		((Renderer)val2).enabled = false;
		return val2;
	}

	private void Start()
	{
		ShionVfx.Warmup();
		model = ResolveModel();
		sparks = ShionVfx.Make(((Component)this).transform, "BlueMuzzleFlames", 256);
		for (int i = 0; i < 32; i++)
		{
			pool.Add(new Beam
			{
				glow = Line(((Component)this).transform, "BlueTracer", 0.12f),
				core = Line(((Component)this).transform, "TracerWhiteCore", 0.035f),
				arc = Line(((Component)this).transform, "SpreeTracerLightning", 0.16f)
			});
		}
	}

	private void LateUpdate()
	{
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_03af: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0400: Unknown result type (might be due to invalid IL or missing references)
		//IL_0419: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0441: Unknown result type (might be due to invalid IL or missing references)
		//IL_045e: 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_0467: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Unknown result type (might be due to invalid IL or missing references)
		//IL_046e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0473: Unknown result type (might be due to invalid IL or missing references)
		//IL_0477: Unknown result type (might be due to invalid IL or missing references)
		//IL_047c: Unknown result type (might be due to invalid IL or missing references)
		//IL_047e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0480: Unknown result type (might be due to invalid IL or missing references)
		//IL_0485: Unknown result type (might be due to invalid IL or missing references)
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		//IL_0495: Unknown result type (might be due to invalid IL or missing references)
		//IL_0497: Unknown result type (might be due to invalid IL or missing references)
		//IL_0499: Unknown result type (might be due to invalid IL or missing references)
		//IL_049e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: 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_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_051e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0522: Unknown result type (might be due to invalid IL or missing references)
		//IL_0529: Unknown result type (might be due to invalid IL or missing references)
		//IL_052e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0540: Unknown result type (might be due to invalid IL or missing references)
		//IL_0545: Unknown result type (might be due to invalid IL or missing references)
		//IL_0555: Unknown result type (might be due to invalid IL or missing references)
		//IL_055a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0561: Unknown result type (might be due to invalid IL or missing references)
		//IL_056b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0570: Unknown result type (might be due to invalid IL or missing references)
		//IL_0575: Unknown result type (might be due to invalid IL or missing references)
		//IL_0580: Unknown result type (might be due to invalid IL or missing references)
		//IL_027b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_028c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)model))
		{
			model = ResolveModel();
		}
		if (!Object.op_Implicit((Object)(object)model) || !Object.op_Implicit((Object)(object)sparks))
		{
			return;
		}
		BindMuzzles();
		if (!Object.op_Implicit((Object)(object)bodyMachine))
		{
			EntityStateMachine[] components = ((Component)this).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (val.customName == "Body")
				{
					bodyMachine = val;
				}
			}
		}
		bool flag = (Object.op_Implicit((Object)(object)bodyMachine) ? (bodyMachine.state as SpreeState) : null)?.IsFiring ?? false;
		TrailRenderer[] array = spreeRibbons;
		foreach (TrailRenderer val2 in array)
		{
			if (Object.op_Implicit((Object)(object)val2))
			{
				if (flag != ribbonActive)
				{
					val2.Clear();
				}
				bool enabled = (val2.emitting = flag);
				((Renderer)val2).enabled = enabled;
			}
		}
		ribbonActive = flag;
		while (pending.Count > 0)
		{
			Shot shot = pending.Dequeue();
			int num = (shot.left ? 1 : 0);
			Transform val3 = muzzles[num];
			if (!Object.op_Implicit((Object)(object)val3))
			{
				continue;
			}
			Beam beam = pool[cursor++ % pool.Count];
			beam.muzzle = val3;
			beam.end = shot.end;
			beam.duration = (shot.electric ? 0.085f : 0.12f);
			beam.until = Time.time + beam.duration;
			beam.electric = shot.electric;
			beam.glow.startWidth = (shot.electric ? 0.22f : 0.12f);
			beam.glow.endWidth = (shot.electric ? 0.1f : 0.054f);
			beam.arc.positionCount = 13;
			if (shot.flash)
			{
				Vector3 val4 = shot.end - val3.position;
				Vector3 normalized = ((Vector3)(ref val4)).normalized;
				ShionVfx.Emit(flashes[num], Vector3.zero, Vector3.zero, new Color(0.35f, 0.8f, 1f, 0.9f), 0.65f, 0.075f);
				for (int k = 0; k < 5; k++)
				{
					ShionVfx.Emit(sparks, val3.position, (normalized + Random.insideUnitSphere * 0.3f) * Random.Range(3f, 8f), new Color(0.08f, 0.5f, 1f), Random.Range(0.035f, 0.09f), 0.08f);
				}
			}
		}
		foreach (Beam item in pool)
		{
			bool flag3 = Object.op_Implicit((Object)(object)item.muzzle) && Time.time < item.until;
			LineRenderer glow = item.glow;
			bool enabled2 = (((Renderer)item.core).enabled = flag3);
			((Renderer)glow).enabled = enabled2;
			((Renderer)item.arc).enabled = flag3 && item.electric;
			if (!flag3)
			{
				continue;
			}
			float num2 = Mathf.Clamp01((item.until - Time.time) / item.duration);
			LineRenderer glow2 = item.glow;
			Color startColor = (item.glow.endColor = new Color(0.02f, 0.35f, 1f, num2));
			glow2.startColor = startColor;
			LineRenderer core = item.core;
			Color startColor2 = (item.core.endColor = new Color(0.55f, 0.95f, 1f, num2));
			core.startColor = startColor2;
			item.glow.SetPosition(0, item.muzzle.position);
			item.core.SetPosition(0, item.muzzle.position);
			item.glow.SetPosition(1, item.end);
			item.core.SetPosition(1, item.end);
			if (item.electric)
			{
				Vector3 position = item.muzzle.position;
				Vector3 val7 = item.end - position;
				Vector3 normalized2 = ((Vector3)(ref val7)).normalized;
				Vector3 val8 = Vector3.Cross(normalized2, Vector3.up);
				Vector3 normalized3 = ((Vector3)(ref val8)).normalized;
				Vector3 val9 = Vector3.Cross(normalized2, normalized3);
				int num3 = Mathf.FloorToInt(Time.time * 30f);
				item.arc.startColor = new Color(0.45f, 0.9f, 1f, num2);
				item.arc.endColor = new Color(0.08f, 0.45f, 1f, num2 * 0.4f);
				for (int l = 0; l < 13; l++)
				{
					float num4 = (float)l / 12f;
					float num5 = Mathf.Sin(num4 * (float)Math.PI);
					Vector3 val10 = Vector3.Lerp(position, item.end, num4) + (normalized3 * Mathf.Sin((float)(l * 17 + num3 * 3)) + val9 * Mathf.Cos((float)(l * 23 + num3))) * num5 * 0.24f;
					item.arc.SetPosition(l, val10);
				}
			}
		}
	}
}
public sealed class CombatController : MonoBehaviour
{
	public bool leftHand;

	public readonly PrimaryCadence primaryCadence = new PrimaryCadence();

	public int primaryHandShots;

	public float charge;

	public int shotsFired;

	public Vector3 lastShotOrigin;

	public Vector3 lastShotDirection;

	public float minimumForwardDot = 1f;

	public string lastMuzzle;

	public string lastOriginCorrection;

	public int leftMuzzleShots;

	public int rightMuzzleShots;
}
public abstract class GunState : BaseSkillState
{
	protected CombatController controller;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		controller = ((EntityState)this).GetComponent<CombatController>();
		if (!Object.op_Implicit((Object)(object)controller))
		{
			controller = ((EntityState)this).gameObject.AddComponent<CombatController>();
		}
		((BaseState)this).StartAimMode(2f, false);
	}

	protected void Bullet(Vector3 direction, float coefficient, float radius, bool? firingLeft = null, bool muzzleFlash = true)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_035a: Unknown result type (might be due to invalid IL or missing references)
		//IL_035b: 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_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: 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_0385: Unknown result type (might be due to invalid IL or missing references)
		//IL_0389: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a4: Expected O, but got Unknown
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_0428: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0434: Unknown result type (might be due to invalid IL or missing references)
		//IL_0439: Unknown result type (might be due to invalid IL or missing references)
		//IL_0488: Unknown result type (might be due to invalid IL or missing references)
		//IL_0489: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0494: Unknown result type (might be due to invalid IL or missing references)
		//IL_0499: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0477: Unknown result type (might be due to invalid IL or missing references)
		//IL_0481: Expected O, but got Unknown
		//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_0545: Unknown result type (might be due to invalid IL or missing references)
		//IL_0546: Unknown result type (might be due to invalid IL or missing references)
		//IL_052a: Unknown result type (might be due to invalid IL or missing references)
		//IL_052f: 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_00e1: 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_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: 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_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: 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_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_027b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		if (!((EntityState)this).isAuthority)
		{
			return;
		}
		Ray aimRay = ((BaseState)this).GetAimRay();
		Vector3 val = ((Ray)(ref aimRay)).origin;
		controller.lastOriginCorrection = "none";
		KiraBurst kiraBurst = this as KiraBurst;
		bool left = (firingLeft.HasValue ? firingLeft.Value : (kiraBurst?.FiringLeft ?? false));
		if (kiraBurst != null || firingLeft.HasValue)
		{
			OriginalModel componentInChildren = ((Component)((EntityState)this).GetModelTransform()).GetComponentInChildren<OriginalModel>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				bool flag = (firingLeft.HasValue ? firingLeft.Value : kiraBurst.FiringLeft);
				string bone = (flag ? "bone_0932" : "bone_0931");
				Transform val2 = Array.Find(componentInChildren.bones, (Transform b) => ((Object)b).name == bone);
				if (Object.op_Implicit((Object)(object)val2))
				{
					Ray val3 = default(Ray);
					((Ray)(ref val3))..ctor((this is SpreeState) ? ((EntityState)this).characterBody.corePosition : ((Ray)(ref aimRay)).origin, direction);
					Vector3 point = ((Ray)(ref val3)).GetPoint(100f);
					float num = 100f;
					RaycastHit[] array = Physics.RaycastAll(val3, 100f, LayerMask.op_Implicit(CommonMasks.bullet), (QueryTriggerInteraction)1);
					for (int num2 = 0; num2 < array.Length; num2++)
					{
						RaycastHit val4 = array[num2];
						HurtBox component = ((Component)((RaycastHit)(ref val4)).collider).GetComponent<HurtBox>();
						if ((!Object.op_Implicit((Object)(object)component) || !((Object)(object)component.healthComponent == (Object)(object)((EntityState)this).healthComponent)) && !((Component)((RaycastHit)(ref val4)).collider).transform.IsChildOf(((EntityState)this).transform) && !((Object)(object)((Component)((RaycastHit)(ref val4)).collider).GetComponentInParent<CharacterBody>() == (Object)(object)((EntityState)this).characterBody) && ((RaycastHit)(ref val4)).distance < num)
						{
							num = ((RaycastHit)(ref val4)).distance;
							point = ((RaycastHit)(ref val4)).point;
						}
					}
					val = val2.position;
					Vector3 val5 = point - val;
					if (Vector3.Dot(val5, ((Ray)(ref val3)).direction) > 0.05f)
					{
						direction = ((Vector3)(ref val5)).normalized;
					}
					else
					{
						direction = ((Ray)(ref val3)).direction;
						controller.lastOriginCorrection = "target behind muzzle: forward only";
					}
					Vector3 val6 = val - ((Ray)(ref val3)).origin;
					if (((Vector3)(ref val6)).sqrMagnitude > 0.001f)
					{
						Vector3 origin = ((Ray)(ref val3)).origin;
						Vector3 normalized = ((Vector3)(ref val6)).normalized;
						float magnitude = ((Vector3)(ref val6)).magnitude;
						LayerIndex world = LayerIndex.world;
						RaycastHit[] array2 = Physics.RaycastAll(origin, normalized, magnitude, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1);
						for (int num3 = 0; num3 < array2.Length; num3++)
						{
							RaycastHit val7 = array2[num3];
							HurtBox component2 = ((Component)((RaycastHit)(ref val7)).collider).GetComponent<HurtBox>();
							if ((!Object.op_Implicit((Object)(object)component2) || !((Object)(object)component2.healthComponent == (Object)(object)((EntityState)this).healthComponent)) && !((Component)((RaycastHit)(ref val7)).collider).transform.IsChildOf(((EntityState)this).transform) && !((Object)(object)((Component)((RaycastHit)(ref val7)).collider).GetComponentInParent<CharacterBody>() == (Object)(object)((EntityState)this).characterBody))
							{
								val = ((Ray)(ref val3)).origin;
								controller.lastOriginCorrection = "cover: " + ((Object)((RaycastHit)(ref val7)).collider).name;
								break;
							}
						}
					}
					controller.lastMuzzle = bone;
					if (flag)
					{
						controller.leftMuzzleShots++;
					}
					else
					{
						controller.rightMuzzleShots++;
					}
				}
			}
		}
		controller.lastShotOrigin = val;
		controller.lastShotDirection = direction;
		CombatController combatController = controller;
		float minimumForwardDot = controller.minimumForwardDot;
		Vector3 val8 = direction;
		Vector3 direction2 = ((Ray)(ref aimRay)).direction;
		combatController.minimumForwardDot = Mathf.Min(minimumForwardDot, Vector3.Dot(val8, ((Vector3)(ref direction2)).normalized));
		BulletAttack val9 = new BulletAttack();
		val9.owner = ((EntityState)this).gameObject;
		val9.weapon = ((EntityState)this).gameObject;
		val9.origin = val;
		val9.aimVector = direction;
		val9.damage = ((BaseState)this).damageStat * coefficient;
		val9.force = 10f;
		val9.radius = radius;
		val9.maxDistance = 100f;
		val9.bulletCount = 1u;
		val9.procCoefficient = 1f;
		val9.isCrit = ((BaseState)this).RollCrit();
		val9.falloffModel = (FalloffModel)1;
		val9.hitMask = CommonMasks.bullet;
		val9.stopperMask = CommonMasks.bullet;
		val9.smartCollision = true;
		val9.tracerEffectPrefab = null;
		val9.hitEffectPrefab = ShionVfx.HitEffect;
		BulletAttack val10 = val9;
		if (this is ExecutionVolley)
		{
			val10.sniper = true;
			val10.modifyOutgoingDamageCallback = new ModifyOutgoingDamageCallback(ExecutionWeakpoints.ModifyDamage);
		}
		val10.Fire();
		Vector3 endpoint = val + direction * 100f;
		float num4 = 100f;
		RaycastHit[] array3 = Physics.RaycastAll(val, direction, 100f, LayerMask.op_Implicit(CommonMasks.bullet), (QueryTriggerInteraction)1);
		for (int num5 = 0; num5 < array3.Length; num5++)
		{
			RaycastHit val11 = array3[num5];
			HurtBox component3 = ((Component)((RaycastHit)(ref val11)).collider).GetComponent<HurtBox>();
			if ((!Object.op_Implicit((Object)(object)component3) || !((Object)(object)component3.healthComponent == (Object)(object)((EntityState)this).healthComponent)) && !((Component)((RaycastHit)(ref val11)).collider).transform.IsChildOf(((EntityState)this).transform) && ((RaycastHit)(ref val11)).distance < num4)
			{
				num4 = ((RaycastHit)(ref val11)).distance;
				endpoint = ((RaycastHit)(ref val11)).point;
			}
		}
		ShotPresentation.Send(((EntityState)this).gameObject, val, endpoint, left, muzzleFlash, this is ExecutionVolley);
		controller.shotsFired++;
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		return (InterruptPriority)1;
	}

	protected void FireSpreePulse(int pulse)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: 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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: 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_00c1: 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_00c4: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Expected O, but got Unknown
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: 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_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_028c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: 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_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: 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_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03be: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c5: Expected O, but got Unknown
		//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_044e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0455: Unknown result type (might be due to invalid IL or missing references)
		//IL_045a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0461: Unknown result type (might be due to invalid IL or missing references)
		//IL_0466: Unknown result type (might be due to invalid IL or missing references)
		//IL_0494: Unknown result type (might be due to invalid IL or missing references)
		//IL_0495: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0379: Unknown result type (might be due to invalid IL or missing references)
		//IL_0389: Unknown result type (might be due to invalid IL or missing references)
		if (!((EntityState)this).isAuthority)
		{
			return;
		}
		Vector3 corePosition = ((EntityState)this).characterBody.corePosition;
		Ray aimRay = ((BaseState)this).GetAimRay();
		Vector3 direction = ((Ray)(ref aimRay)).direction;
		Vector3 normalized = ((Vector3)(ref direction)).normalized;
		Vector3 val = Vector3.Cross((Mathf.Abs(normalized.y) > 0.98f) ? Vector3.forward : Vector3.up, normalized);
		Vector3 normalized2 = ((Vector3)(ref val)).normalized;
		Vector3 val2 = Vector3.Cross(normalized, normalized2);
		Vector3 normalized3 = ((Vector3)(ref val2)).normalized;
		RaycastHit val4 = default(RaycastHit);
		for (int i = 0; i < 8; i++)
		{
			float num = (float)(i * 45 + pulse * 13) * ((float)Math.PI / 180f);
			Vector3 val3 = normalized2 * Mathf.Cos(num) + normalized3 * Mathf.Sin(num) + normalized * 0.18f;
			Vector3 normalized4 = ((Vector3)(ref val3)).normalized;
			LayerIndex world = LayerIndex.world;
			Vector3 endpoint = (Physics.Raycast(corePosition, normalized4, ref val4, 18f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val4)).point : (corePosition + normalized4 * 18f));
			ShotPresentation.Send(((EntityState)this).gameObject, corePosition, endpoint, (i & 1) != 0, i < 2, electric: true);
		}
		BullseyeSearch val5 = new BullseyeSearch();
		val5.searchOrigin = corePosition;
		val5.searchDirection = Vector3.forward;
		val5.maxDistanceFilter = 18f;
		val5.maxAngleFilter = 180f;
		val5.filterByLoS = false;
		val5.teamMaskFilter = TeamMask.GetEnemyTeams(((EntityState)this).characterBody.teamComponent.teamIndex);
		val5.sortMode = (SortMode)1;
		BullseyeSearch val6 = val5;
		val6.RefreshCandidates();
		val6.FilterOutGameObject(((EntityState)this).gameObject);
		HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>();
		List<Vector3> list = new List<Vector3>();
		foreach (HurtBox result in val6.GetResults())
		{
			if (!Object.op_Implicit((Object)(object)result) || !Object.op_Implicit((Object)(object)result.healthComponent) || !result.healthComponent.alive || hashSet.Contains(result.healthComponent))
			{
				continue;
			}
			Vector3 position = ((Component)result).transform.position;
			Vector3 val7 = position - corePosition;
			if (!(((Vector3)(ref val7)).sqrMagnitude > 324f))
			{
				LayerIndex world2 = LayerIndex.world;
				if (!Physics.Linecast(corePosition, position, LayerMask.op_Implicit(((LayerIndex)(ref world2)).mask), (QueryTriggerInteraction)1))
				{
					hashSet.Add(result.healthComponent);
					list.Add(position);
				}
			}
		}
		for (int j = 0; j < list.Count; j++)
		{
			Vector3 val8 = list[j] - corePosition;
			float magnitude = ((Vector3)(ref val8)).magnitude;
			if (magnitude < 0.001f)
			{
				continue;
			}
			Vector3 val9 = val8 / magnitude;
			Vector3 endpoint2 = list[j];
			float num2 = magnitude;
			RaycastHit[] array = Physics.RaycastAll(corePosition, val9, magnitude, LayerMask.op_Implicit(CommonMasks.bullet), (QueryTriggerInteraction)1);
			for (int k = 0; k < array.Length; k++)
			{
				RaycastHit val10 = array[k];
				HurtBox component = ((Component)((RaycastHit)(ref val10)).collider).GetComponent<HurtBox>();
				if ((!Object.op_Implicit((Object)(object)component) || !((Object)(object)component.healthComponent == (Object)(object)((EntityState)this).healthComponent)) && !((Component)((RaycastHit)(ref val10)).collider).transform.IsChildOf(((EntityState)this).transform) && (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.healthComponent) || !Object.op_Implicit((Object)(object)component.healthComponent.body) || component.healthComponent.body.teamComponent.teamIndex != ((EntityState)this).characterBody.teamComponent.teamIndex) && ((RaycastHit)(ref val10)).distance < num2)
				{
					num2 = ((RaycastHit)(ref val10)).distance;
					endpoint2 = ((RaycastHit)(ref val10)).point;
				}
			}
			BulletAttack val11 = new BulletAttack();
			val11.owner = ((EntityState)this).gameObject;
			val11.weapon = ((EntityState)this).gameObject;
			val11.origin = corePosition;
			val11.aimVector = val9;
			val11.maxDistance = magnitude + 0.1f;
			val11.radius = 0f;
			val11.bulletCount = 1u;
			val11.damage = ((BaseState)this).damageStat * 2f;
			val11.force = 3f;
			val11.procCoefficient = 0.5f;
			val11.isCrit = ((BaseState)this).RollCrit();
			val11.falloffModel = (FalloffModel)0;
			val11.hitMask = CommonMasks.bullet;
			val11.stopperMask = CommonMasks.bullet;
			val11.smartCollision = true;
			val11.tracerEffectPrefab = null;
			val11.hitEffectPrefab = ShionVfx.SpreeHitEffect;
			val11.Fire();
			ShotPresentation.Send(((EntityState)this).gameObject, corePosition, endpoint2, ((j + pulse) & 1) != 0, j < 2, electric: true);
			controller.shotsFired++;
		}
	}
}
public sealed class KiraBurst : GunState
{
	public const float ShotInterval = 0.24f;

	public const float BurstDuration = 0.71999997f;

	public const float FirstShotDelay = 0f;

	private float poseClock;

	private OriginalAudio originalAudio;

	public bool FiringLeft;

	public float PoseProgress => Mathf.Clamp01(poseClock / 0.24f);

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		return (InterruptPriority)2;
	}

	public override void OnEnter()
	{
		base.OnEnter();
		originalAudio = ((EntityState)this).GetComponent<OriginalAudio>();
		if (!Object.op_Implicit((Object)(object)originalAudio))
		{
			originalAudio = ((EntityState)this).gameObject.AddComponent<OriginalAudio>();
		}
		if (((EntityState)this).isAuthority)
		{
			FiringLeft = controller.leftHand;
		}
		TryFireShot();
	}

	private void TryFireShot()
	{
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		if (controller.primaryCadence.TryShot(Time.fixedTime, ((BaseState)this).attackSpeedStat))
		{
			if (controller.primaryHandShots >= 3)
			{
				controller.leftHand = !controller.leftHand;
				controller.primaryHandShots = 0;
			}
			FiringLeft = controller.leftHand;
			Ray aimRay = ((BaseState)this).GetAimRay();
			Bullet(((Ray)(ref aimRay)).direction, 1f, 0.12f);
			poseClock = 0f;
			if (OriginalAudio.Ready)
			{
				originalAudio.Shot(FiringLeft);
			}
			else
			{
				Util.PlaySound("Play_commando_M1", ((EntityState)this).gameObject);
			}
			controller.primaryHandShots++;
		}
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		float num = Time.fixedDeltaTime * Mathf.Max(0.1f, ((BaseState)this).attackSpeedStat);
		poseClock += num;
		if (((EntityState)this).isAuthority && !((EntityState)this).inputBank.skill1.down)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
		else
		{
			TryFireShot();
		}
	}

	public override void OnSerialize(NetworkWriter w)
	{
		((BaseSkillState)this).OnSerialize(w);
		w.Write(FiringLeft);
	}

	public override void OnDeserialize(NetworkReader r)
	{
		((BaseSkillState)this).OnDeserialize(r);
		FiringLeft = r.ReadBoolean();
	}
}
public sealed class ExecutionVolley : GunState
{
	public const float VolleyInterval = 0.025f;

	private bool fired;

	private float firedAt;

	private float lastEmission = -10f;

	private int emitted;

	private Vector3 releaseDirection;

	private readonly Vector3[] rays = (Vector3[])(object)new Vector3[13];

	private readonly bool[] hands = new bool[13];

	public int Emitted => emitted;

	public float ChargeAge
	{
		get
		{
			if (!fired)
			{
				return ((EntityState)this).fixedAge;
			}
			return firedAt;
		}
	}

	public bool Fired => fired;

	public float ReleaseAge
	{
		get
		{
			if (!fired)
			{
				return 0f;
			}
			return ((EntityState)this).fixedAge;
		}
	}

	public override void OnEnter()
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: 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_00b1: 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_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		base.OnEnter();
		if (!Object.op_Implicit((Object)(object)((EntityState)this).GetComponent<ExecutionWeakpoints>()))
		{
			((EntityState)this).gameObject.AddComponent<ExecutionWeakpoints>();
		}
		if (!fired)
		{
			return;
		}
		controller.charge = Mathf.Clamp01(firedAt / 0.9f);
		Vector3 normalized = ((Vector3)(ref releaseDirection)).normalized;
		Vector3 val = Vector3.Cross(Vector3.up, normalized);
		Vector3 val2 = ((Vector3)(ref val)).normalized;
		if (((Vector3)(ref val2)).sqrMagnitude < 0.1f)
		{
			val2 = Vector3.right;
		}
		Vector3 val3 = Vector3.Cross(normalized, val2);
		Vector3 normalized2 = ((Vector3)(ref val3)).normalized;
		float num = Mathf.Lerp(0.13f, 0.012f, controller.charge);
		rays[0] = normalized;
		int num2 = 1;
		for (int i = 1; i <= 3; i++)
		{
			for (int j = -1; j <= 1; j += 2)
			{
				for (int k = -1; k <= 1; k += 2)
				{
					ref Vector3 reference = ref rays[num2];
					Vector3 val4 = normalized + num * (float)i * ((float)j * val2 + (float)k * normalized2);
					reference = ((Vector3)(ref val4)).normalized;
					hands[num2++] = j * k < 0;
				}
			}
		}
		if (!OriginalAudio.Ready)
		{
			Util.PlaySound("Play_commando_M2", ((EntityState)this).gameObject);
		}
	}

	public override void FixedUpdate()
	{
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: 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_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (!fired)
		{
			controller.charge = Mathf.Clamp01(((EntityState)this).fixedAge / 0.9f);
		}
		if (!fired && ((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 0.04f && (!((EntityState)this).inputBank.skill2.down || ((EntityState)this).fixedAge >= 1.5f))
		{
			EntityStateMachine outer = ((EntityState)this).outer;
			ExecutionVolley executionVolley = new ExecutionVolley
			{
				fired = true,
				firedAt = ((EntityState)this).fixedAge
			};
			Ray aimRay = ((BaseState)this).GetAimRay();
			executionVolley.releaseDirection = ((Ray)(ref aimRay)).direction;
			outer.SetNextState((EntityState)(object)executionVolley);
			return;
		}
		if (((EntityState)this).isAuthority && fired && emitted < rays.Length && ReleaseAge >= (float)emitted * 0.025f && ((EntityState)this).fixedAge > lastEmission)
		{
			Vector3 normalized = ((Vector3)(ref releaseDirection)).normalized;
			Ray aimRay2 = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay2)).direction;
			Bullet(Quaternion.FromToRotation(normalized, ((Vector3)(ref direction)).normalized) * rays[emitted], 1.5f, 0.16f, hands[emitted]);
			OriginalSoundMixer.Secondary(hands[emitted], ((EntityState)this).transform.position);
			emitted++;
			lastEmission = ((EntityState)this).fixedAge;
		}
		if (((EntityState)this).isAuthority && fired && emitted == rays.Length && ((EntityState)this).fixedAge - lastEmission >= 0.12f)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	public override void OnSerialize(NetworkWriter w)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		((BaseSkillState)this).OnSerialize(w);
		w.Write(fired);
		w.Write(firedAt);
		w.Write(releaseDirection);
	}

	public override void OnDeserialize(NetworkReader r)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		((BaseSkillState)this).OnDeserialize(r);
		fired = r.ReadBoolean();
		firedAt = r.ReadSingle();
		releaseDirection = r.ReadVector3();
	}

	public override void OnExit()
	{
		controller.charge = 0f;
		((EntityState)this).OnExit();
	}
}
public sealed class CombatHud : MonoBehaviour
{
	private CharacterBody body;

	private CombatController combat;

	private EntityStateMachine bodyMachine;

	private EntityStateMachine weaponMachine;

	private HUD hud;

	private GameObject root;

	private ShionTimerRing ring;

	private HGTextMeshProUGUI timer;

	private HGTextMeshProUGUI left;

	private HGTextMeshProUGUI right;

	private ShionChargeBar charge;

	private ShionSpreeStocks stocks;

	private float labelClock;

	public string StatusText { get; private set; }

	public float FillAmount { get; private set; }

	public int DrawCount { get; private set; }

	public bool Visible
	{
		get
		{
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)combat) && Object.op_Implicit((Object)(object)Run.instance) && body.isPlayerControlled && body.healthComponent.alive && Util.HasEffectiveAuthority(((Component)this).gameObject) && !PauseManager.isPaused)
			{
				return !PauseManager.PauseScreenIsOpen();
			}
			return false;
		}
	}

	private void Start()
	{
		body = ((Component)this).GetComponent<CharacterBody>();
		combat = ((Component)this).GetComponent<CombatController>();
		EntityStateMachine[] components = ((Component)this).GetComponents<EntityStateMachine>();
		bodyMachine = ((IEnumerable<EntityStateMachine>)components).FirstOrDefault((Func<EntityStateMachine, bool>)((EntityStateMachine m) => m.customName == "Body"));
		weaponMachine = ((IEnumerable<EntityStateMachine>)components).FirstOrDefault((Func<EntityStateMachine, bool>)((EntityStateMachine m) => m.customName == "Weapon"));
	}

	private HGTextMeshProUGUI Text(string name, Vector2 position, Vector2 size)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
		val.transform.SetParent(root.transform, false);
		RectTransform val2 = (RectTransform)val.transform;
		Vector2 anchorMin = (val2.anchorMax = new Vector2(0.5f, 0.5f));
		val2.anchorMin = anchorMin;
		val2.anchoredPosition = position;
		val2.sizeDelta = size;
		HGTextMeshProUGUI val4 = val.AddComponent<HGTextMeshProUGUI>();
		((TMP_Text)val4).fontSize = 18f;
		((TMP_Text)val4).alignment = (TextAlignmentOptions)514;
		((Graphic)val4).raycastTarget = false;
		((Graphic)val4).color = Color.white;
		HGTextMeshProUGUI componentInChildren = ((Component)hud).GetComponentInChildren<HGTextMeshProUGUI>();
		if (Object.op_Implicit((Object)(object)componentInChildren))
		{
			((TMP_Text)val4).font = ((TMP_Text)componentInChildren).font;
			((TMP_Text)val4).spriteAsset = ((TMP_Text)componentInChildren).spriteAsset;
		}
		return val4;
	}

	private void Build()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Expected O, but got Unknown
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Expected O, but got Unknown
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Expected O, but got Unknown
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Expected O, but got Unknown
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Expected O, but got Unknown
		//IL_01c3: 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_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Expected O, but got Unknown
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Unknown result type (might be due to invalid IL or missing references)
		hud = ((IEnumerable<HUD>)HUD.readOnlyInstanceList).FirstOrDefault((Func<HUD, bool>)((HUD h) => (Object)(object)h.targetBodyObject == (Object)(object)((Component)this).gameObject));
		if (Object.op_Implicit((Object)(object)hud))
		{
			root = new GameObject("ShionReticleSkillHUD", new Type[1] { typeof(RectTransform) });
			RectTransform val = (RectTransform)root.transform;
			((Transform)val).SetParent(hud.mainContainer.transform, false);
			Vector2 anchorMin = (val.anchorMax = new Vector2(0.5f, 0.5f));
			val.anchorMin = anchorMin;
			val.sizeDelta = new Vector2(600f, 240f);
			val.anchoredPosition = Vector2.zero;
			GameObject val3 = new GameObject("WhiteCountdownRing", new Type[1] { typeof(RectTransform) });
			val3.transform.SetParent(root.transform, false);
			RectTransform val4 = (RectTransform)val3.transform;
			val4.sizeDelta = new Vector2(80f, 80f);
			ring = val3.AddComponent<ShionTimerRing>();
			((Graphic)ring).raycastTarget = false;
			timer = Text("Seconds", new Vector2(0f, -52f), new Vector2(100f, 28f));
			GameObject val5 = new GameObject("VerticalCharge", new Type[1] { typeof(RectTransform) });
			val5.transform.SetParent(root.transform, false);
			charge = val5.AddComponent<ShionChargeBar>();
			((Graphic)charge).raycastTarget = false;
			((Graphic)charge).rectTransform.sizeDelta = new Vector2(20f, 256f);
			((Graphic)charge).rectTransform.anchoredPosition = new Vector2(110f, 0f);
			GameObject val6 = new GameObject("SpreeShots", new Type[1] { typeof(RectTransform) });
			val6.transform.SetParent(root.transform, false);
			stocks = val6.AddComponent<ShionSpreeStocks>();
			((Graphic)stocks).raycastTarget = false;
			((Graphic)stocks).rectTransform.sizeDelta = new Vector2(90f, 30f);
			left = Text("PrimaryBinding", new Vector2(-235f, 0f), new Vector2(240f, 40f));
			right = Text("SecondaryEquipmentBinding", new Vector2(235f, 0f), new Vector2(240f, 40f));
			((TMP_Text)left).fontSize = 15f;
			((TMP_Text)right).fontSize = 15f;
		}
	}

	private string Key(string action)
	{
		return Glyphs.GetGlyphString(((Component)hud).GetComponent<MPEventSystemProvider>().eventSystem, action, (AxisRange)0);
	}

	private void Update()
	{
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)combat))
		{
			return;
		}
		SpreeState spreeState = (Object.op_Implicit((Object)(object)bodyMachine) ? (bodyMachine.state as SpreeState) : null);
		JoyrideState joyrideState = (Object.op_Implicit((Object)(object)bodyMachine) ? (bodyMachine.state as JoyrideState) : null);
		ExecutionVolley executionVolley = (Object.op_Implicit((Object)(object)weaponMachine) ? (weaponMachine.state as ExecutionVolley) : null);
		bool flag = executionVolley != null && !executionVolley.Fired;
		bool flag2 = Visible && (spreeState != null || joyrideState != null || flag);
		if (!Object.op_Implicit((Object)(object)root) && flag2)
		{
			Build();
		}
		if (!Object.op_Implicit((Object)(object)root))
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)hud) || (Object)(object)hud.targetBodyObject != (Object)(object)((Component)this).gameObject)
		{
			Object.Destroy((Object)(object)root);
			return;
		}
		root.SetActive(flag2);
		if (!flag2)
		{
			return;
		}
		DrawCount++;
		float num = ((spreeState != null) ? Mathf.Max(0f, spreeState.Remaining - spreeState.PhaseAge) : ((joyrideState == null) ? Mathf.Max(0f, 1.5f - executionVolley.ChargeAge) : (joyrideState.Charging ? Mathf.Max(0f, 1.5f - joyrideState.ChargeAge) : Mathf.Max(0f, 6f - joyrideState.Elapsed))));
		float num2 = ((spreeState != null) ? 8f : ((joyrideState != null && !joyrideState.Charging) ? 6f : 1.5f));
		FillAmount = Mathf.Clamp01(num / num2);
		ring.SetProgress(FillAmount, spreeState != null);
		((TMP_Text)timer).text = num.ToString("0.0") + "s";
		StatusText = ((TMP_Text)timer).text;
		bool active = (joyrideState != null && joyrideState.Charging) || flag;
		((Component)charge).gameObject.SetActive(active);
		charge.SetProgress(joyrideState?.LaunchCharge ?? combat.charge);
		((Graphic)stocks).rectTransform.anchoredPosition = new Vector2(0f, -63f);
		((TMP_Text)timer).rectTransform.anchoredPosition = new Vector2(0f, (float)((spreeState != null) ? (-105) : (-52)));
		((Component)stocks).gameObject.SetActive(spreeState != null);
		if (spreeState != null)
		{
			int count = Mathf.Max(0, 3 - spreeState.Uses);
			stocks.SetCount(count);
		}
		labelClock -= Time.unscaledDeltaTime;
		if (!(labelClock > 0f))
		{
			labelClock = 0.1f;
			if (spreeState != null)
			{
				((TMP_Text)left).text = Language.GetString("SHION_HINT_RUSH") + "  " + Key("PrimarySkill");
				((TMP_Text)right).text = Key("SecondarySkill") + "  " + Language.GetString("SHION_HINT_BURST");
			}
			else if (joyrideState != null)
			{
				((TMP_Text)left).text = Language.GetString(joyrideState.Charging ? "SHION_HINT_RELEASE" : ((Object.op_Implicit((Object)(object)body.characterMotor) && !body.characterMotor.isGrounded) ? "SHION_HINT_HOLD" : "SHION_HINT_THROW")) + "  " + Key("PrimarySkill");
				((TMP_Text)right).text = Key("Equipment") + "  " + Language.GetString("SHION_HINT_THROW");
			}
			else
			{
				((TMP_Text)left).text = Language.GetString("SHION_HINT_HOLD") + "  " + Key("SecondarySkill");
				((TMP_Text)right).text = Key("SecondarySkill") + "  " + Language.GetString("SHION_HINT_RELEASE");
			}
		}
	}

	private void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)root))
		{
			root.SetActive(false);
		}
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)root))
		{
			Object.Destroy((Object)(object)root);
		}
	}
}
public sealed class ShionTimerRing : MaskableGraphic
{
	private float progress = 1f;

	private bool arc;

	public void SetProgress(float value, bool curved)
	{
		if (Mathf.Abs(progress - value) > 0.001f || arc != curved)
		{
			progress = value;
			arc = curved;
			((Graphic)this).SetVerticesDirty();
		}
	}

	protected override void OnPopulateMesh(VertexHelper vh)
	{
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: 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_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: 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_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: 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_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		vh.Clear();
		for (int i = 0; i < 96; i++)
		{
			float num = (arc ? 220 : 90);
			float num2 = (arc ? (-100) : 360);
			float num3 = (num - (float)i * num2 / 96f) * ((float)Math.PI / 180f);
			float num4 = (num - (float)(i + 1) * num2 / 96f) * ((float)Math.PI / 180f);
			float num5 = (arc ? 83 : 34);
			float num6 = num5 + 3f;
			Color32 color = Color32.op_Implicit(((float)i / 96f < progress) ? new Color(1f, 1f, 1f, 0.95f) : new Color(1f, 1f, 1f, 0.18f));
			int currentVertCount = vh.currentVertCount;
			Vector2[] array = (Vector2[])(object)new Vector2[4]
			{
				new Vector2(Mathf.Cos(num3), Mathf.Sin(num3)) * num5,
				new Vector2(Mathf.Cos(num3), Mathf.Sin(num3)) * num6,
				new Vector2(Mathf.Cos(num4), Mathf.Sin(num4)) * num6,
				new Vector2(Mathf.Cos(num4), Mathf.Sin(num4)) * num5
			};
			foreach (Vector2 val in array)
			{
				UIVertex simpleVert = UIVertex.simpleVert;
				simpleVert.position = Vector2.op_Implicit(val);
				simpleVert.color = color;
				vh.AddVert(simpleVert);
			}
			vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2);
			vh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3);
		}
	}
}
public sealed class ShionSpreeStocks : MaskableGraphic
{
	private int count = 3;

	public void SetCount(int value)
	{
		if (count != value)
		{
			count = value;
			((Graphic)this).SetVerticesDirty();
		}
	}

	protected override void OnPopulateMesh(VertexHelper vh)
	{
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: 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_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_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		vh.Clear();
		Vector2 val = default(Vector2);
		for (int i = 0; i < 3; i++)
		{
			((Vector2)(ref val))..ctor((float)((i - 1) * 23), (float)((i == 1) ? (-2) : 0));
			Color32 color = Color32.op_Implicit((i < count) ? new Color(1f, 1f, 1f, 0.98f) : new Color(0.33f, 0.36f, 0.41f, 0.65f));
			float num = (i - 1) * 12 + 15;
			int currentVertCount = vh.currentVertCount;
			UIVertex simpleVert = UIVertex.simpleVert;
			simpleVert.position = Vector2.op_Implicit(val);
			simpleVert.color = color;
			vh.AddVert(simpleVert);
			for (int j = 0; j < 12; j++)
			{
				float num2 = (num + (float)(j * 30)) * ((float)Math.PI / 180f);
				float num3 = ((j % 2 == 0) ? 8f : 3.2f);
				simpleVert.position = Vector2.op_Implicit(val + new Vector2(Mathf.Cos(num2), Mathf.Sin(num2)) * num3);
				vh.AddVert(simpleVert);
			}
			for (int k = 0; k < 12; k++)
			{
				vh.AddTriangle(currentVertCount, currentVertCount + 1 + k, currentVertCount + 1 + (k + 1) % 12);
			}
		}
	}
}
public sealed class ShionChargeBar : MaskableGraphic
{
	public float Progress { get; private set; }

	public void SetProgress(float value)
	{
		value = Mathf.Clamp01(value);
		if (Mathf.Abs(Progress - value) > 0.001f)
		{
			Progress = value;
			((Graphic)this).SetVerticesDirty();
		}
	}

	private void Box(VertexHelper vh, float x, float y, float w, float h, Color c)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		int currentVertCount = vh.currentVertCount;
		Vector2[] array = (Vector2[])(object)new Vector2[4]
		{
			new Vector2(x, y),
			new Vector2(x + w, y),
			new Vector2(x + w, y + h),
			new Vector2(x, y + h)
		};
		foreach (Vector2 val in array)
		{
			UIVertex simpleVert = UIVertex.simpleVert;
			simpleVert.position = Vector2.op_Implicit(val);
			simpleVert.color = Color32.op_Implicit(c);
			vh.AddVert(simpleVert);
		}
		vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2);
		vh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3);
	}

	protected override void OnPopulateMesh(VertexHelper vh)
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		vh.Clear();
		Box(vh, -6f, -128f, 12f, 256f, new Color(0.025f, 0.035f, 0.06f, 0.7f));
		Box(vh, -9f, -120f, 2f, 240f, new Color(0.8f, 0.9f, 1f, 0.8f));
		Box(vh, 7f, -120f, 2f, 240f, new Color(0.8f, 0.9f, 1f, 0.8f));
		Cap(vh, 128f, 1f);
		Cap(vh, -128f, -1f);
		if (Progress > 0f)
		{
			float num = 248f * Progress;
			Box(vh, -5f, -124f, 10f, num, new Color(0.8f, 0.03f, 0.12f, 0.9f));
			Box(vh, -3f, -124f, 4f, num, new Color(1f, 0.18f, 0.27f, 1f));
			Box(vh, -5f, -124f + num - 2f, 10f, 2f, new Color(1f, 0.75f, 0.78f, 1f));
		}
	}

	private void Cap(VertexHelper vh, float y, float sign)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		int currentVertCount = vh.currentVertCount;
		Vector2[] array = (Vector2[])(object)new Vector2[4]
		{
			new Vector2(-9f, y - sign * 8f),
			new Vector2(0f, y),
			new Vector2(9f, y - sign * 8f),
			new Vector2(0f, y - sign * 3f)
		};
		foreach (Vector2 val in array)
		{
			UIVertex simpleVert = UIVertex.simpleVert;
			simpleVert.position = Vector2.op_Implicit(val);
			simpleVert.color = Color32.op_Implicit(Color.white);
			vh.AddVert(simpleVert);
		}
		vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 3);
		vh.AddTriangle(currentVertCount + 1, currentVertCount + 2, currentVertCount + 3);
	}
}
public sealed class DisplayPose : MonoBehaviour
{
	private OriginalModel model;

	private OriginalAnimation idle;

	private OriginalAnimation intro;

	private Dictionary<string, Transform> bones;

	private Vector3[] positions;

	private Vector3[] scales;

	private Quaternion[] rotations;

	private float elapsed;

	private Transform[] frontHair;

	private float[] hairOffsets;

	private Vector3[] hairTargets;

	public int Samples { get; private set; }

	public void Initialize(OriginalModel value)
	{
		model = value;
		bones = model.bones.ToDictionary((Transform b) => ((Object)b).name, (Transform b) => b);
		positions = model.bones.Select((Transform b) => b.localPosition).ToArray();
		rotations = model.bones.Select((Transform b) => b.localRotation).ToArray();
		scales = model.bones.Select((Transform b) => b.localScale).ToArray();
		idle = OriginalAnimation.Load(Path.Combine(Plugin.Assets, "animations/00000001AB27.owanimclip"));
		intro = OriginalAnimation.Load(Path.Combine(Plugin.Assets, "animations/00000001AB24.owanimclip"));
		foreach (SkinnedMeshRenderer item in model.bike)
		{
			((Renderer)item).enabled = false;
		}
		foreach (SkinnedMeshRenderer weapon in model.weapons)
		{
			((Renderer)weapon).enabled = true;
		}
		Dictionary<string, float> offsets = new Dictionary<string, float>
		{
			{ "cloth_0155", 0.015231f },
			{ "cloth_0156", 0.063437f },
			{ "cloth_0157", 0.058031f },
			{ "cloth_0158", 0.065f },
			{ "cloth_0159", 0.065f },
			{ "cloth_015A", 0.023875f },
			{ "cloth_015B", 0.019452f },
			{ "cloth_015C", 0.029985f },
			{ "cloth_015D", 0.034156f },
			{ "cloth_015E", 0.011038f },
			{ "cloth_015F", 0.049945f },
			{ "cloth_0160", 0.05519f },
			{ "cloth_0161", 0.040806f },
			{ "cloth_0162", 0.035818f },
			{ "cloth_0163", 0.043383f },
			{ "cloth_0165", 0.048496f },
			{ "cloth_0166", 0.065f },
			{ "cloth_0167", 0.065f },
			{ "cloth_0168", 0.010985f },
			{ "cloth_0169", 0.023683f },
			{ "cloth_016A", 0.031058f },
			{ "cloth_016B", 0.037279f },
			{ "cloth_016C", 0.042351f },
			{ "cloth_016D", 0.05154f },
			{ "cloth_016E", 0.059578f },
			{ "cloth_0170", 0.065f },
			{ "cloth_0171", 0.065f },
			{ "cloth_0176", 0.063437f },
			{ "cloth_0177", 0.058031f },
			{ "cloth_0179", 0.065f },
			{ "cloth_017A", 0.065f },
			{ "cloth_017F", 0.023875f },
			{ "cloth_0180", 0.019452f },
			{ "cloth_0181", 0.029985f },
			{ "cloth_0182", 0.034156f },
			{ "cloth_0184", 0.011051f },
			{ "cloth_0185", 0.015252f },
			{ "cloth_0186", 0.049945f },
			{ "cloth_0187", 0.05519f },
			{ "cloth_0188", 0.040806f },
			{ "cloth_0189", 0.035818f },
			{ "cloth_018A", 0.043383f },
			{ "cloth_018B", 0.048496f },
			{ "cloth_018D", 0.065f },
			{ "cloth_018E", 0.065f },
			{ "cloth_0191", 0.010976f },
			{ "cloth_0192", 0.023683f },
			{ "cloth_0193", 0.031058f },
			{ "cloth_0194", 0.037279f },
			{ "cloth_0195", 0.042351f },
			{ "cloth_0197", 0.05154f },
			{ "cloth_0198", 0.059578f },
			{ "cloth_0199", 0.065f },
			{ "cloth_019A", 0.065f }
		};
		frontHair = (from b in model.bones
			where offsets.ContainsKey(((Object)b).name)
			orderby Depth(b)
			select b).ToArray();
		hairOffsets = frontHair.Select((Transform b) => offsets[((Object)b).name]).ToArray();
		hairTargets = (Vector3[])(object)new Vector3[frontHair.Length];
		Apply();
	}

	private void Apply()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: 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_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: 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_0158: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < model.bones.Length; i++)
		{
			Transform val = model.bones[i];
			val.localPosition = positions[i];
			val.localRotation = rotations[i];
			val.localScale = scales[i];
		}
		if (elapsed < intro.Duration)
		{
			intro.Sample(bones, elapsed);
		}
		else
		{
			idle.Sample(bones, (elapsed - intro.Duration) % idle.Duration);
		}
		Samples++;
		for (int j = 0; j < frontHair.Length; j++)
		{
			ref Vector3 reference = ref hairTargets[j];
			reference = frontHair[j].position + ((Component)model).transform.TransformVector(Vector3.forward * (hairOffsets[j] * 2f));
		}
		for (int k = 0; k < frontHair.Length; k++)
		{
			frontHair[k].position = hairTargets[k];
		}
	}

	private static int Depth(Transform t)
	{
		int num = 0;
		while (Object.op_Implicit((Object)(object)t.parent))
		{
			num++;
			t = t.parent;
		}
		return num;
	}

	private void LateUpdate()
	{
		if (idle != null)
		{
			elapsed += Time.unscaledDeltaTime;
			Apply();
		}
	}
}
[HarmonyPatch(typeof(EquipmentSlot), "PerformEquipmentAction")]
public static class BikeEquipmentAction
{
	private static bool Prefix(EquipmentSlot __instance, EquipmentDef equipmentDef, ref bool __result)
	{
		if ((Object)(object)equipmentDef != (Object)(object)Plugin.BikeEquipment)
		{
			return true;
		}
		BikeInput bikeInput = (Object.op_Implicit((Object)(object)__instance.characterBody) ? ((Component)__instance.characterBody).GetComponent<BikeInput>() : null);
		__result = NetworkServer.active && Object.op_Implicit((Object)(object)bikeInput) && bikeInput.Mount();
		return false;
	}
}
[HarmonyPatch(typeof(EquipmentSlot), "ExecuteIfReady")]
public static class BikeEquipmentRelease
{
	private static bool Prefix(EquipmentSlo