Decompiled source of HedgehogUtils v1.1.3

HedgehogUtils.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using HG;
using HG.BlendableTypes;
using HG.Reflection;
using HarmonyLib;
using HedgehogUtils.Boost;
using HedgehogUtils.Boost.EntityStates;
using HedgehogUtils.Forms;
using HedgehogUtils.Forms.EntityStates;
using HedgehogUtils.Forms.SuperForm;
using HedgehogUtils.Forms.SuperForm.EntityStates;
using HedgehogUtils.Internal;
using HedgehogUtils.Launch;
using HedgehogUtils.Miscellaneous;
using JetBrains.Annotations;
using LookingGlass.ItemStatsNameSpace;
using LookingGlass.LookingGlassLanguage;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Audio;
using RoR2.ContentManagement;
using RoR2.Hologram;
using RoR2.Navigation;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HedgehogUtils")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6b9aade5deb531e658025a70a7e7b25526597591")]
[assembly: AssemblyProduct("HedgehogUtils")]
[assembly: AssemblyTitle("HedgehogUtils")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HedgehogUtils
{
	public static class Assets
	{
		private const string assetbundleName = "hedgehogutilsbundle";

		private const string dllName = "HedgehogUtils.dll";

		internal static AssetBundle mainAssetBundle;

		internal static GameObject powerBoostFlashEffect;

		internal static GameObject powerBoostAuraEffect;

		public static GameObject boostHUD;

		internal static GameObject launchAuraEffect;

		internal static GameObject launchCritAuraEffect;

		internal static GameObject launchHitEffect;

		internal static GameObject launchCritHitEffect;

		internal static GameObject launchWallCollisionEffect;

		internal static GameObject launchWallCollisionLargeEffect;

		public static Material superFormOverlay;

		public static GameObject superFormTransformationEffect;

		public static GameObject transformationEmeraldSwirl;

		public static GameObject superFormAura;

		public static GameObject superFormWarning;

		public static LoopSoundDef superLoopSoundDef;

		public static Material ringMaterial;

		public static void Initialize()
		{
			LoadAssetBundle();
			LoadSoundbank();
			BoostAndLaunch();
			SuperForm();
			Miscellaneous();
		}

		internal static void LoadAssetBundle()
		{
			try
			{
				if ((Object)(object)mainAssetBundle == (Object)null)
				{
					mainAssetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("HedgehogUtils.dll", "hedgehogutilsbundle"));
				}
			}
			catch (Exception ex)
			{
				Log.Error("Failed to load assetbundle. Make sure your assetbundle name is setup correctly\n" + ex);
			}
		}

		internal static void LoadSoundbank()
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HedgehogUtils.HedgehogUtilsBank.bnk");
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			SoundBanks.Add(array);
		}

		public static void BoostAndLaunch()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: 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)
			powerBoostFlashEffect = MaterialSwap(LoadEffect("SonicPowerBoostFlash", parentToTransform: true), "RoR2/Base/Common/VFX/matDistortionFaded.mat", "Distortion");
			powerBoostAuraEffect = LoadAsyncedEffect("SonicPowerBoostAura");
			boostHUD = mainAssetBundle.LoadAsset<GameObject>("BoostMeter");
			launchAuraEffect = CreateNewBoostAura("DS_GAMING_HEDGEHOG_UTILS_LAUNCH_AURA_VFX", 1f, 0.4f, new Color(1f, 1f, 1f), new Color(0.7f, 0.7f, 0.7f), new Color(0.4f, 0.45f, 0.5f), Color.black);
			launchCritAuraEffect = CreateNewBoostAura("DS_GAMING_HEDGEHOG_UTILS_LAUNCH_CRIT_AURA_VFX", 1f, 0.4f, new Color(1f, 1f, 1f), new Color(0.7f, 0.7f, 0.7f), new Color(0.8f, 0.1f, 0.2f), new Color(0.3f, 0f, 0f));
			AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ArmorReductionOnHit/PulverizedEffect.prefab");
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				launchHitEffect = CreateLaunchHitEffect(x.Result, "HedgehogUtilsLaunchHitEffect", new Color(1f, 0.8f, 0.4f), new Color(0.8f, 0.8f, 0.8f));
				launchCritHitEffect = CreateLaunchHitEffect(x.Result, "HedgehogUtilsLaunchCritHitEffect", new Color(1f, 0.1f, 0.2f), new Color(0.9f, 0.7f, 0.7f));
			};
			AsyncOperationHandle<GameObject> val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/SurvivorPod/PodGroundImpact.prefab");
			val2.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_021b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0245: Unknown result type (might be due to invalid IL or missing references)
				//IL_024a: Unknown result type (might be due to invalid IL or missing references)
				//IL_024e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0253: Unknown result type (might be due to invalid IL or missing references)
				//IL_0271: 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_029e: 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_02cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d7: 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_02ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
				launchWallCollisionLargeEffect = PrefabAPI.InstantiateClone(x.Result, "HedgehogUtilsLaunchWallCollisionLarge");
				launchWallCollisionLargeEffect.AddComponent<NetworkIdentity>();
				launchWallCollisionLargeEffect.GetComponent<ShakeEmitter>().wave.amplitude = 0.4f;
				Object.Destroy((Object)(object)launchWallCollisionLargeEffect.GetComponent<AlignToNormal>());
				Object.Destroy((Object)(object)((Component)launchWallCollisionLargeEffect.transform.Find("Particles/Flash")).gameObject);
				Object.Destroy((Object)(object)((Component)launchWallCollisionLargeEffect.transform.Find("Particles/Sparks")).gameObject);
				Object.Destroy((Object)(object)((Component)launchWallCollisionLargeEffect.transform.Find("Particles/Point Light")).gameObject);
				ShapeModule shape = ((Component)launchWallCollisionLargeEffect.transform.Find("Particles/Dust, Directional")).GetComponent<ParticleSystem>().shape;
				((ShapeModule)(ref shape)).radius = 6f;
				launchWallCollisionLargeEffect.GetComponent<EffectComponent>().soundName = "Play_titanboss_impact";
				launchWallCollisionEffect = PrefabAPI.InstantiateClone(x.Result, "HedgehogUtilsLaunchWallCollision");
				launchWallCollisionEffect.AddComponent<NetworkIdentity>();
				Object.Destroy((Object)(object)launchWallCollisionEffect.GetComponent<AlignToNormal>());
				Object.Destroy((Object)(object)((Component)launchWallCollisionEffect.transform.Find("Particles/Flash")).gameObject);
				Object.Destroy((Object)(object)((Component)launchWallCollisionEffect.transform.Find("Particles/Sparks")).gameObject);
				Object.Destroy((Object)(object)((Component)launchWallCollisionEffect.transform.Find("Particles/Point Light")).gameObject);
				Object.Destroy((Object)(object)((Component)launchWallCollisionEffect.transform.Find("Particles/Debris, 3D")).gameObject);
				Object.Destroy((Object)(object)launchWallCollisionEffect.GetComponent<ShakeEmitter>());
				GameObject gameObject = ((Component)launchWallCollisionEffect.transform.Find("Particles/Dust, Directional")).gameObject;
				MainModule main = gameObject.GetComponent<ParticleSystem>().main;
				MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
				((MinMaxCurve)(ref startLifetime)).constantMax = 0.3f;
				((MinMaxCurve)(ref startLifetime)).constantMax = 0.6f;
				((MainModule)(ref main)).startLifetime = startLifetime;
				MinMaxCurve startSize = ((MainModule)(ref main)).startSize;
				((MinMaxCurve)(ref startSize)).constantMin = 0.4f;
				((MinMaxCurve)(ref startSize)).constantMax = 1.3f;
				((MainModule)(ref main)).startSize = startSize;
				GameObject gameObject2 = ((Component)launchWallCollisionEffect.transform.Find("Particles/Dust")).gameObject;
				MainModule main2 = gameObject2.GetComponent<ParticleSystem>().main;
				MinMaxCurve startLifetime2 = ((MainModule)(ref main2)).startLifetime;
				((MinMaxCurve)(ref startLifetime2)).constantMin = 0.6f;
				((MinMaxCurve)(ref startLifetime2)).constantMax = 1.4f;
				((MainModule)(ref main2)).startLifetime = startLifetime2;
				MinMaxCurve startSize2 = ((MainModule)(ref main2)).startSize;
				((MinMaxCurve)(ref startSize2)).constantMin = 1.5f;
				((MinMaxCurve)(ref startSize2)).constantMax = 3f;
				((MainModule)(ref main2)).startSize = startSize2;
				ParticleSystem component = ((Component)launchWallCollisionEffect.transform.Find("Particles/Debris")).gameObject.GetComponent<ParticleSystem>();
				EmissionModule emission = component.emission;
				Burst burst = ((EmissionModule)(ref emission)).GetBurst(0);
				((Burst)(ref burst)).count = MinMaxCurve.op_Implicit(10f);
				EmissionModule emission2 = component.emission;
				((EmissionModule)(ref emission2)).SetBurst(0, burst);
				launchWallCollisionEffect.GetComponent<EffectComponent>().soundName = "Play_golem_impact";
				AddNewEffectDef(launchWallCollisionEffect, "Play_golem_impact");
				AddNewEffectDef(launchWallCollisionLargeEffect, "Play_titanboss_impact");
			};
		}

		private static GameObject CreateLaunchHitEffect(GameObject baseHitEffect, string name, Color ringColor, Color beamColor)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_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)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(baseHitEffect, name);
			val.AddComponent<NetworkIdentity>();
			Object.Destroy((Object)(object)val.GetComponent<ParticleSystem>());
			MainModule main = ((Component)val.transform.Find("Ring")).gameObject.GetComponent<ParticleSystem>().main;
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(ringColor);
			MainModule main2 = ((Component)val.transform.Find("Beams")).gameObject.GetComponent<ParticleSystem>().main;
			((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(beamColor);
			Object.Destroy((Object)(object)((Component)val.transform.Find("Mesh")).gameObject);
			Object.Destroy((Object)(object)((Component)val.transform.Find("Point Light")).gameObject);
			val.GetComponent<EffectComponent>().soundName = "Play_beetle_guard_impact";
			AddNewEffectDef(val, "");
			return val;
		}

		public static void SuperForm()
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			superFormTransformationEffect = LoadEffect("SonicSuperTransformation");
			if (Object.op_Implicit((Object)(object)superFormTransformationEffect))
			{
				ShakeEmitter val = superFormTransformationEffect.AddComponent<ShakeEmitter>();
				val.amplitudeTimeDecay = true;
				val.duration = 0.7f;
				val.radius = 200f;
				val.scaleShakeRadiusWithLocalScale = false;
				val.wave = new Wave
				{
					amplitude = 0.7f,
					frequency = 40f,
					cycleOffset = 0f
				};
			}
			transformationEmeraldSwirl = LoadEffect("SonicChaosEmeraldSwirl");
			superFormAura = LoadAsyncedEffect("SonicSuperAura");
			superFormWarning = LoadEffect("SonicSuperWarning");
			superFormWarning.AddComponent<DestroyOnExitForm>();
			EffectComponent component = superFormWarning.GetComponent<EffectComponent>();
			component.parentToReferencedTransform = true;
			AsyncOperationHandle<Material> val2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/LunarGolem/matLunarGolemShield.mat");
			val2.Completed += delegate(AsyncOperationHandle<Material> x)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				//IL_0030: 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)
				superFormOverlay = new Material(x.Result);
				superFormOverlay.SetColor("_TintColor", new Color(1f, 0.8f, 0.4f, 1f));
				superFormOverlay.SetColor("_EmissionColor", new Color(1f, 0.8f, 0.4f, 1f));
				superFormOverlay.SetFloat("_OffsetAmount", 0.01f);
			};
			superLoopSoundDef = ScriptableObject.CreateInstance<LoopSoundDef>();
			superLoopSoundDef.startSoundName = "Play_hedgehogutils_super_loop";
			superLoopSoundDef.stopSoundName = "Stop_hedgehogutils_super_loop";
		}

		public static void Miscellaneous()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<Material> val = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC2/Elites/EliteAurelionite/matEliteAurelioniteAffixOverlay.mat");
			val.Completed += delegate(AsyncOperationHandle<Material> x)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				ringMaterial = new Material(x.Result);
				ringMaterial.SetFloat("_NormalStrength", 0f);
				ringMaterial.SetColor("_Color", new Color(0.9f, 0.8f, 0.1f, 1f));
			};
		}

		public static GameObject MaterialSwap(GameObject prefab, string assetPath, string pathToParticle = "")
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			Transform val = prefab.transform.Find(pathToParticle);
			if (Object.op_Implicit((Object)(object)val))
			{
				((Renderer)((Component)val).GetComponent<ParticleSystemRenderer>()).sharedMaterial = Addressables.LoadAssetAsync<Material>((object)assetPath).WaitForCompletion();
			}
			return prefab;
		}

		public static GameObject MaterialSwap(GameObject prefab, Material material, string pathToParticle = "")
		{
			Transform val = prefab.transform.Find(pathToParticle);
			if (Object.op_Implicit((Object)(object)val))
			{
				((Renderer)((Component)val).GetComponent<ParticleSystemRenderer>()).sharedMaterial = material;
			}
			return prefab;
		}

		public static GameObject CreateNewBoostFlash(string name, float size, float alpha, Color color1, Color color2, Color color3, Color lightColor)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_00a0: 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_00a3: 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_00cb: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(powerBoostFlashEffect, name);
			AddNewEffectDef(val);
			MainModule main = ((Component)val.transform.Find("BlueCone")).GetComponent<ParticleSystem>().main;
			MinMaxCurve startSize = ((MainModule)(ref main)).startSize;
			((MainModule)(ref main)).startSize = new MinMaxCurve(((MinMaxCurve)(ref startSize)).constant * size);
			MainModule main2 = ((Component)val.transform.Find("BlueCone/BlueCone2")).GetComponent<ParticleSystem>().main;
			startSize = ((MainModule)(ref main2)).startSize;
			((MainModule)(ref main2)).startSize = new MinMaxCurve(((MinMaxCurve)(ref startSize)).constant * size);
			ParticleSystemRenderer component = ((Component)val.transform.Find("BlueCone")).GetComponent<ParticleSystemRenderer>();
			((Renderer)component).material = CreateNewBoostMaterial(alpha, color1, color2, color3);
			ParticleSystemRenderer component2 = ((Component)val.transform.Find("BlueCone/BlueCone2")).GetComponent<ParticleSystemRenderer>();
			((Renderer)component2).material = CreateNewBoostMaterial(alpha, color1, color2, color3);
			MainModule main3 = ((Component)val.transform.Find("BlueCone/StartFlash")).GetComponent<ParticleSystem>().main;
			if (lightColor == Color.black)
			{
				LightsModule lights = ((Component)val.transform.Find("BlueCone/StartFlash")).GetComponent<ParticleSystem>().lights;
				((LightsModule)(ref lights)).enabled = false;
			}
			else
			{
				((MainModule)(ref main3)).startColor = MinMaxGradient.op_Implicit(lightColor);
				((Component)val.transform.Find("BlueCone/StartFlash/Point Light")).GetComponent<Light>().color = lightColor;
			}
			return val;
		}

		public static GameObject CreateNewBoostAura(string name, float size, float alpha, Color color1, Color color2, Color color3, Color lightColor)
		{
			//IL_001e: 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_0045: 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_0048: 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_0057: 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)
			GameObject val = PrefabAPI.InstantiateClone(powerBoostAuraEffect, name);
			Transform obj = val.transform.Find("Aura");
			obj.localScale *= size;
			((Renderer)((Component)val.transform.Find("Aura")).GetComponent<MeshRenderer>()).material = CreateNewBoostMaterial(alpha, color1, color2, color3);
			if (lightColor == Color.black)
			{
				((Behaviour)((Component)val.transform.Find("Point Light")).GetComponent<Light>()).enabled = false;
			}
			else
			{
				((Component)val.transform.Find("Point Light")).GetComponent<Light>().color = lightColor;
			}
			return val;
		}

		private static Material CreateNewBoostMaterial(float alpha, Color color1, Color color2, Color color3)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0029: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(mainAssetBundle.LoadAsset<Material>("matPowerBoost"));
			val.SetFloat("_AlphaBoost", alpha);
			val.SetColor("_Color1", color1);
			val.SetColor("_Color2", color2);
			val.SetColor("_Color3", color3);
			return val;
		}

		private static GameObject LoadEffect(string resourceName)
		{
			return LoadEffect(resourceName, "", parentToTransform: false);
		}

		private static GameObject LoadEffect(string resourceName, string soundName)
		{
			return LoadEffect(resourceName, soundName, parentToTransform: false);
		}

		private static GameObject LoadEffect(string resourceName, bool parentToTransform)
		{
			return LoadEffect(resourceName, "", parentToTransform);
		}

		private static GameObject LoadAsyncedEffect(string resourceName)
		{
			GameObject val = mainAssetBundle.LoadAsset<GameObject>(resourceName);
			val.AddComponent<NetworkIdentity>();
			return val;
		}

		private static GameObject LoadEffect(string resourceName, string soundName, bool parentToTransform)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = mainAssetBundle.LoadAsset<GameObject>(resourceName);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error("Failed to load effect: " + resourceName + " because it does not exist in the AssetBundle");
				return null;
			}
			val.AddComponent<DestroyOnTimer>().duration = 12f;
			val.AddComponent<NetworkIdentity>();
			VFXAttributes val2 = val.AddComponent<VFXAttributes>();
			val2.vfxPriority = (VFXPriority)2;
			val2.DoNotPool = true;
			EffectComponent val3 = val.AddComponent<EffectComponent>();
			val3.applyScale = false;
			val3.effectIndex = (EffectIndex)(-1);
			val3.parentToReferencedTransform = parentToTransform;
			val3.positionAtReferencedTransform = true;
			val3.soundName = soundName;
			AddNewEffectDef(val, soundName);
			return val;
		}

		private static void AddNewEffectDef(GameObject effectPrefab)
		{
			AddNewEffectDef(effectPrefab, "");
		}

		private static void AddNewEffectDef(GameObject effectPrefab, string soundName)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			EffectDef val = new EffectDef();
			val.prefab = effectPrefab;
			val.prefabEffectComponent = effectPrefab.GetComponent<EffectComponent>();
			val.prefabName = ((Object)effectPrefab).name;
			val.prefabVfxAttributes = effectPrefab.GetComponent<VFXAttributes>();
			val.spawnSoundEventName = soundName;
			Content.AddEffectDef(val);
		}
	}
	public static class Buffs
	{
		public static BuffDef superFormBuff;

		public static BuffDef launchedBuff;

		internal static void RegisterBuffs()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			superFormBuff = AddNewBuff("bdHedgehogSuperForm", Assets.mainAssetBundle.LoadAsset<Sprite>("texSuperBuffIcon"), Color.white, canStack: false, isDebuff: false, hidden: false);
			launchedBuff = AddNewBuff("bdHedgehogLaunch", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/Weak").iconSprite, new Color(1f, 1f, 1f), canStack: false, isDebuff: false, hidden: true);
		}

		internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff, bool hidden)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val).name = buffName;
			val.buffColor = buffColor;
			val.canStack = canStack;
			val.isDebuff = isDebuff;
			val.eliteDef = null;
			val.iconSprite = buffIcon;
			val.isHidden = hidden;
			Content.AddBuffDef(val);
			return val;
		}
	}
	public static class Config
	{
		public static ConfigEntry<bool> EnableLogs()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<bool>("Misc.", "Enable Logs", false, "This controls whether this mod will put any information in the logs. This information can help the mod creator fix issues should any come up, but it does impact performance a bit. Default is false.");
		}

		public static ConfigEntry<bool> AnnounceSuperTransformation()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<bool>("Forms", "Announce Super Transformation", false, "If true, a message will be sent in chat when someone transforms. The message will include the name of the player who transformed. The message won't be sent for anyone who transforms in the 10 second window after someone else transforms. Host's config takes priority. Default is false.");
		}

		public static ConfigEntry<int> EmeraldsPerStage()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<int>("Chaos Emeralds", "Emeralds Per Stage", 3, "The maximum number of Chaos Emeralds that can spawn in one stage. Host's config takes priority. Default is 3.");
		}

		public static ConfigEntry<int> EmeraldsPerSimulacrumStage()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<int>("Chaos Emeralds", "Emeralds Per Simulacrum Stage", 5, "The maximum number of Chaos Emeralds that can spawn in one stage in Simulacrum. Host's config takes priority. Default is 5.");
		}

		public static ConfigEntry<int> EmeraldCost()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<int>("Chaos Emeralds", "Cost", 50, "How much it costs to buy a Chaos Emerald. Host's config takes priority. Default is 50.\nFor reference:\nChest: 25\nLarge Chest: 50\nAltar of Gold: 200\nLegendary Chest: 400");
		}

		public static ConfigEntry<FormItemSharing> NeededItemSharing()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<FormItemSharing>("Chaos Emeralds", "Item Sharing", FormItemSharing.All, "Handles how Chaos Emeralds are shared between teammates and determines who has permission to transform based on the items they have. The restrictions only apply to the first person to transform and don't apply to anyone who transforms in the 10 second window afterwards. Host's config takes priority. Default is All.\n\nAssuming all items have been collected across the team...\nAll: Anyone, whether they HAVE ANY ITEMS OR NOT, can transform.\nContributor: Players that have AT LEAST ONE of the needed items can transform\nMajorityRule: The player(s) with the MAJORITY number of the needed items can transform\nNone: Only the player with ALL items can transform\n\nWARNING: A mod that lets you drop items to your teammates is reccommended if you are changing this setting. Otherwise, transforming may be impossible if items are split between players in certain ways.");
		}

		public static ConfigEntry<bool> SuperFormInvincible()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<bool>("Super Form", "Invincible", true, $"Whether the Super form grants complete invincibility. Without invincibility, the Super form grants {200} armor. Host's config takes priority. Default is true.");
		}

		public static ConfigEntry<float> SuperFormDuration()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<float>("Super Form", "Duration", 50f, "How long the Super form will last in seconds. Host's config takes priority. Default is 50.");
		}

		public static ConfigEntry<bool> ConsumeEmeraldsOnUse()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<bool>("Super Form", "Consume Emeralds On Use", true, "Whether the Chaos Emeralds will be consumed when transforming into Super Sonic. If not, the emeralds will stay but won't be able to be used until the next stage. Host's config takes priority. Default is true.");
		}

		public static ConfigEntry<bool> LaunchBodyBlacklist()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<bool>("Launch", "Use Body Blacklist", true, "Determines whether certain characters, such as final bosses and worms, are impossible to be launched. Regardless of what this value is set to, launching may fail for other reasons, such as the target having knockback immunity or being too high mass. Host's config takes priority. Default is true.");
		}

		public static ConfigEntry<float> BoostMeterLocationX()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<float>("Boost", "X Location", 90f, "X Coordinate of the boost meter's location relative to the crosshair. Default is 90.");
		}

		public static ConfigEntry<float> BoostMeterLocationY()
		{
			return ((BaseUnityPlugin)HedgehogUtilsPlugin.instance).Config.Bind<float>("Boost", "Y Location", -50f, "Y Coordinate of the boost meter's location relative to the crosshair. Default is -50.");
		}

		public static void RiskOfOptionsSetup()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Expected O, but got Unknown
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: 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_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Expected O, but got Unknown
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Expected O, but got Unknown
			Sprite modIcon = Assets.mainAssetBundle.LoadAsset<Sprite>("texSuperBuffIcon");
			ModSettingsManager.SetModIcon(modIcon);
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(EmeraldsPerStage(), new IntSliderConfig
			{
				min = 1,
				max = 7
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(EmeraldsPerSimulacrumStage(), new IntSliderConfig
			{
				min = 1,
				max = 7
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(EmeraldCost(), new IntSliderConfig
			{
				min = 0,
				max = 400
			}));
			EmeraldCost().SettingChanged += ChaosEmeraldInteractable.UpdateInteractableCost;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConsumeEmeraldsOnUse()));
			ConsumeEmeraldsOnUse().SettingChanged += SuperFormDef.UpdateConsumeEmeraldsConfig;
			ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)NeededItemSharing()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(AnnounceSuperTransformation()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SuperFormInvincible()));
			SuperFormInvincible().SettingChanged += SuperFormDef.UpdateSuperFormInvincibleConfig;
			ModSettingsManager.AddOption((BaseOption)new SliderOption(SuperFormDuration(), new SliderConfig
			{
				min = 15f,
				max = 600f,
				formatString = "{0:0}s"
			}));
			SuperFormDuration().SettingChanged += SuperFormDef.UpdateSuperFormDurationConfig;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(EnableLogs()));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(LaunchBodyBlacklist()));
			float min = -500f;
			float max = 500f;
			ModSettingsManager.AddOption((BaseOption)new SliderOption(BoostMeterLocationX(), new SliderConfig
			{
				min = min,
				max = max,
				formatString = "{0:0}"
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(BoostMeterLocationY(), new SliderConfig
			{
				min = min,
				max = max,
				formatString = "{0:0}"
			}));
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.ds_gaming.HedgehogUtils", "HedgehogUtils", "1.1.3")]
	public class HedgehogUtilsPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.ds_gaming.HedgehogUtils";

		public const string PluginAuthor = "ds_gaming";

		public const string PluginName = "HedgehogUtils";

		public const string PluginVersion = "1.1.3";

		public const string Prefix = "DS_GAMING_HEDGEHOG_UTILS_";

		public static HedgehogUtilsPlugin instance;

		public static bool lookingGlassLoaded;

		public static bool riskOfOptionsLoaded;

		public void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			lookingGlassLoaded = Chainloader.PluginInfos.ContainsKey("droppod.lookingglass");
			Log.Message("Looking Glass exists? " + lookingGlassLoaded);
			riskOfOptionsLoaded = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
			Log.Message("Risk of Options exists? " + riskOfOptionsLoaded);
			Assets.Initialize();
			Buffs.RegisterBuffs();
			HedgehogUtils.Boost.OnHooks.Initialize();
			Items.RegisterItems();
			SuperFormDef.Initialize();
			ChaosEmeraldInteractable.Initialize();
			HedgehogUtils.Forms.OnHooks.Initialize();
			Stats.Initialize();
			Artifact.Initialize();
			DamageTypes.Initialize();
			LaunchManager.Initialize();
			HedgehogUtils.Launch.OnHooks.Initialize();
			MomentumStats.Initialize();
			Language.Initialize();
			States.RegisterStates();
			if (riskOfOptionsLoaded)
			{
				Config.RiskOfOptionsSetup();
			}
			NetworkingAPI.RegisterMessageType<NetworkTransformation>();
			new ContentPacks().Initialize();
		}
	}
	public static class Helpers
	{
		public static string ScepterDescription(string desc)
		{
			return "\n<color=#d299ff>SCEPTER: " + desc + "</color>";
		}

		public static string SuperFormText(string desc)
		{
			return "<color=#ffee00>" + desc + "</color>";
		}

		public static T[] Append<T>(ref T[] array, List<T> list)
		{
			int num = array.Length;
			int count = list.Count;
			Array.Resize(ref array, num + count);
			list.CopyTo(array, num);
			return array;
		}

		public static Func<T[], T[]> AppendDel<T>(List<T> list)
		{
			return (T[] r) => Append(ref r, list);
		}

		public static bool Flying(GameObject gameObject, out ICharacterFlightParameterProvider flight)
		{
			if (Object.op_Implicit((Object)(object)gameObject))
			{
				flight = gameObject.GetComponent<ICharacterFlightParameterProvider>();
				return Flying(flight);
			}
			flight = null;
			return false;
		}

		public static bool Flying(GameObject gameObject)
		{
			ICharacterFlightParameterProvider flight;
			return Flying(gameObject, out flight);
		}

		public static bool Flying(ICharacterFlightParameterProvider flight)
		{
			return flight != null && flight.isFlying;
		}

		public static void EndChrysalis(GameObject gameObject)
		{
			if (NetworkServer.active)
			{
				JetpackController val = JetpackController.FindJetpackController(gameObject);
				if (Object.op_Implicit((Object)(object)val) && val.stopwatch >= val.duration)
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
			}
		}

		public static T CopySkillDef<T>(SkillDef originDef) where T : SkillDef
		{
			//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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			T val = ScriptableObject.CreateInstance<T>();
			((SkillDef)val).skillName = originDef.skillName;
			((Object)(object)val).name = ((Object)originDef).name;
			((SkillDef)val).skillNameToken = originDef.skillNameToken;
			((SkillDef)val).skillDescriptionToken = originDef.skillDescriptionToken;
			((SkillDef)val).icon = originDef.icon;
			((SkillDef)val).activationState = originDef.activationState;
			((SkillDef)val).activationStateMachineName = originDef.activationStateMachineName;
			((SkillDef)val).baseMaxStock = originDef.baseMaxStock;
			((SkillDef)val).baseRechargeInterval = originDef.baseRechargeInterval;
			((SkillDef)val).beginSkillCooldownOnSkillEnd = originDef.beginSkillCooldownOnSkillEnd;
			((SkillDef)val).canceledFromSprinting = originDef.canceledFromSprinting;
			((SkillDef)val).forceSprintDuringState = originDef.forceSprintDuringState;
			((SkillDef)val).fullRestockOnAssign = originDef.fullRestockOnAssign;
			((SkillDef)val).interruptPriority = originDef.interruptPriority;
			((SkillDef)val).resetCooldownTimerOnUse = originDef.resetCooldownTimerOnUse;
			((SkillDef)val).isCombatSkill = originDef.isCombatSkill;
			((SkillDef)val).mustKeyPress = originDef.mustKeyPress;
			((SkillDef)val).cancelSprintingOnActivation = originDef.cancelSprintingOnActivation;
			((SkillDef)val).rechargeStock = originDef.rechargeStock;
			((SkillDef)val).requiredStock = originDef.requiredStock;
			((SkillDef)val).stockToConsume = originDef.stockToConsume;
			((SkillDef)val).keywordTokens = originDef.keywordTokens;
			return val;
		}

		public static T CopyBoostSkillDef<T>(HedgehogUtils.Boost.SkillDefs.BoostSkillDef originDef) where T : SkillDef, HedgehogUtils.Boost.SkillDefs.IBoostSkill
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			SerializableEntityStateType boostIdleState = originDef.boostIdleState;
			SerializableEntityStateType brakeState = originDef.brakeState;
			T val = CopySkillDef<T>((SkillDef)(object)originDef);
			val.boostIdleState = boostIdleState;
			val.brakeState = brakeState;
			val.boostHUDColor = originDef.boostHUDColor;
			return val;
		}

		public static T CopyBoostSkillDef<T>(HedgehogUtils.Boost.SkillDefs.RequiresFormBoostSkillDef originDef) where T : SkillDef, HedgehogUtils.Boost.SkillDefs.IBoostSkill
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			SerializableEntityStateType boostIdleState = originDef.boostIdleState;
			SerializableEntityStateType brakeState = originDef.brakeState;
			T val = CopySkillDef<T>((SkillDef)(object)originDef);
			val.boostIdleState = boostIdleState;
			val.brakeState = brakeState;
			val.boostHUDColor = originDef.boostHUDColor;
			return val;
		}
	}
	public static class Language
	{
		public const string launchKeyword = "DS_GAMING_HEDGEHOG_UTILS_LAUNCH_KEYWORD";

		public const string momentumPassiveNameToken = "DS_GAMING_HEDGEHOG_UTILS_MOMENTUM_PASSIVE_NAME";

		public const string momentumPassiveDescriptionToken = "DS_GAMING_HEDGEHOG_UTILS_MOMENTUM_PASSIVE_DESCRIPTION";

		public const string EGGFACE_LINE_0 = "    /";

		public const string EGGFACE_LINE_1 = "X\\ /  O___O";

		public const string EGGFACE_LINE_2 = " \\H\\L=_/ \\_=";

		public const string EGGFACE_LINE_3 = " _+X/\\| | |/";

		public const string EGGFACE_LINE_4 = "    \\";

		public static void Initialize()
		{
			string text = "<color=#ffee00>";
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_SUPER_FORM_PREFIX", "Super {0}");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_SUPER_FORM", "Super");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_SUPER_FORM_ANNOUNCE_TEXT", text + "<size=110%>{0} has transformed into their {1} form!</color></size>");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_SUPER_FORM_ANNOUNCE_TEXT_2P", text + "<size=110%>You transformed into your {1} form!</color></size>");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_ARTIFACT_CHAOS_EMERALD_NAME", "Artifact of Chaos Emeralds");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_ARTIFACT_CHAOS_EMERALD_DESCRIPTION", "The Chaos Emeralds are scattered across the planet.");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_NAME", "Chaos Emerald");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_CONTEXT", "Receive Emerald");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_INSPECT", "When activated by a survivor the Chaos Emerald will be dropped. Once all seven are collected, survivors can transform into their Super form.");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_TITLE", "Chaos Emerald");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_YELLOW", "Chaos Emerald: Yellow");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_BLUE", "Chaos Emerald: Blue");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_RED", "Chaos Emerald: Red");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_GRAY", "Chaos Emerald: Gray");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_GREEN", "Chaos Emerald: Green");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_CYAN", "Chaos Emerald: Cyan");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_EMERALD_TEMPLE_PURPLE", "Chaos Emerald: Purple");
			string text2 = " of the <style=cIsUtility>seven</style> Chaos Emeralds." + Environment.NewLine + string.Format("When all <style=cIsUtility>seven</style> are collected by you and/or other players, press {0} to transform into your {1} for {2} seconds. Transforming increases <style=cIsDamage>damage</style> by <style=cIsDamage>+{3}%</style>. Increases <style=cIsDamage>attack speed</style> by <style=cIsDamage>+{4}%</style>. Increases <style=cIsUtility>movement speed</style> by <style=cIsUtility>+{5}%</style>. Grants <style=cIsHealing>complete invincibility</style> and <style=cIsUtility>flight</style>. Certain <style=cIsUtility>characters</style> have {6}.", Helpers.SuperFormText("V"), Helpers.SuperFormText("Super Form"), Helpers.SuperFormText(50f.ToString()), 100f, 30.000002f, 100f, Helpers.SuperFormText("all of their skills upgraded")) + Environment.NewLine + Environment.NewLine + "This will <style=cIsUtility>consume</style> all seven Chaos Emeralds.";
			string text3 = $"One out of seven. When all are collected, transform into your Super form by pressing V, granting invincibility, flight, and incredible power for {50f} seconds. Consumed on use.";
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_YELLOW_EMERALD", "Chaos Emerald: <style=cIsDamage>Yellow</style>");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_YELLOW_EMERALD_PICKUP", text3);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_YELLOW_EMERALD_DESC", "<style=cIsDamage>One</style>" + text2);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_BLUE_EMERALD", "Chaos Emerald: <color=#2b44d6>Blue</color>");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_BLUE_EMERALD_PICKUP", text3);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_BLUE_EMERALD_DESC", "<color=#2b44d6>One</color>" + text2);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_RED_EMERALD", "Chaos Emerald: <style=cDeath>Red</style>");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_RED_EMERALD_PICKUP", text3);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_RED_EMERALD_DESC", "<style=cDeath>One</style>" + text2);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_GRAY_EMERALD", "Chaos Emerald: <color=#b8c5d6>Gray</color>");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_GRAY_EMERALD_PICKUP", text3);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_GRAY_EMERALD_DESC", "<color=#b8c5d6>One</color>" + text2);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_GREEN_EMERALD", "Chaos Emerald: <style=cIsHealing>Green</style>");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_GREEN_EMERALD_PICKUP", text3);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_GREEN_EMERALD_DESC", "<style=cIsHealing>One</style>" + text2);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_CYAN_EMERALD", "Chaos Emerald: <style=cIsUtility>Cyan</style>");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_CYAN_EMERALD_PICKUP", text3);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_CYAN_EMERALD_DESC", "<style=cIsUtility>One</style>" + text2);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_PURPLE_EMERALD", "Chaos Emerald: <color=#c437c0>Purple</color>");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_PURPLE_EMERALD_PICKUP", text3);
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_PURPLE_EMERALD_DESC", "<color=#c437c0>One</color>" + text2);
			string text4 = "\n\n<style=cMono>Translation Errors:</style>\n";
			int num = 3;
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_BLUE_EMERALD_LORE", EggFace("<style=cMono>Welcome to the Egg-Net archives.", num - 13, "$ Combing for data relevant to", num, "$ \"Ancients and Chaos Emeralds\"...", num, "$ Results found in folder: Starfall", num, "$ Translating audio file...", num) + "$ Displaying result [1/7].</style>\n\nThat sight is burned into my memory. The sight of the fiery rift burned straight through the planet's surface. Our entire homeworld crumbled to the sheer power of that entity mere moments after its appearance eclipsed our sun. I'm one of the few that made it off the planet before the attack.\n\nSeven Chaos Emeralds divided amongst our ships provided enough power for us to escape, flying blindly into outer space. The Chaos Emeralds continuously produce energy. One emerald is enough to power a small fleet of ships, all flying fast enough to outrun that thing that destroyed our world. With the power of the emeralds, we could flee indefinitely.\n\nWe could continue furthering the gap between us such that it could never reach us again. We could keep on running. Never turn back.\n\nWho am I kidding? Running endlessly would be unbearable. Who could possibly live like that forever?");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_CYAN_EMERALD_LORE", EggFace("<style=cMono>Welcome to the Egg-Net archives.", num - 13, "$ Combing for data relevant to", num, "$ \"Ancients and Chaos Emeralds\"...", num, "$ Results found in folder: Starfall", num, "$ Translating audio file...", num) + "$ Displaying result [2/7].</style>\n\nThere's far more to the Chaos Emeralds than we know about. It couldn't have just been random chance that drew us to this world. The emeralds reacted to something.. no.. something took control of the emeralds, and by extension, our ships. We were forced to land on this planet by that force.\n\nWe landed not far from its source, a lone emerald much like our Chaos Emeralds, but far larger. Fascinating how things from different worlds have such a deep connection to eachother. This connection needs to be studied further, I believe it can lead to a breakthrough in our understanding of these emeralds. Imagine what miracles could come from further harnessing the emeralds' power.\n\nSince our arrival on this planet, we have been scanning this planet. With this, we'll know everything we need to know about this planet, including information on all of its native life.\n\nThe initial results of our scans show no signs of developed civilizations. We will continue gathering data as time goes on, but these initial results paint a clear picture of what this planet's native inhabitants are like. This world is primitive, many millenia behind us. Hypothetically speaking, there would be nothing on this planet that could resist an incursion from us.\n\nWe will isolate ourselves on this uninhabited archipelago to avoid interfering too much with this world's life. With our numbers so slim, these islands have plenty of room for us. Besides, we are no conquerors.\n\nNo one should have their home taken away from them.");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_GRAY_EMERALD_LORE", EggFace("<style=cMono>Welcome to the Egg-Net archives.", num - 13, "$ Combing for data relevant to", num, "$ \"Ancients and Chaos Emeralds\"...", num, "$ Results found in folder: Starfall", num, "$ Translating audio file...", num) + "$ Displaying result [3/7].</style>\n\nThoughts are power. The power of the Chaos Emeralds is closely tied to the user's thoughts. Our hearts enrich the power of the Chaos Emeralds, which in turn, grant us protection in our dire moments. To preserve our thoughts is to preserve the power to keep moving. To preserve our past is to preserve our future. That is the foundation on which Cyber Space was created.\n\nCyber Space is a dimension which stored information on everything about us. Our history, our memories, our desires. Every aspect of us as individuals can be uploaded and stored in Cyber Space at any time. The digital copies of us can think, feel, and speak just as their true selves can. It's too late for those we lost from our homeworld. But with this, we can \"save people\". We will never truly lose someone ever again.\n\nMaybe that's a bit too optimistic. As much I want to truly be able to save people, I can't ignore that the copies stored in Cyber Space are not perfect recreations of their true selves.\n\nStrange results have repeatedly appeared in stress tests of the system. When left unchecked for too long, the functioning minds of people within Cyber Space tend to trap themselves within a loop. Memories with strong emotions tied to them, especially those of regret, fester until they gradually take over the mind's ability to process information. Their perception of time and the world around them start to degrade, confusing past with present.\n\nThese issues can be managed with maintenance, but the existence of these problems is concerning. Is it a flaw in Cyber Space's data storage? Or, is the problem not with Cyber Space, but something that originates from much deeper within the mind? Memory truly is a finicky thing.");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_GREEN_EMERALD_LORE", EggFace("<style=cMono>Welcome to the Egg-Net archives.", num - 13, "$ Combing for data relevant to", num, "$ \"Ancients and Chaos Emeralds\"...", num, "$ Results found in folder: Starfall", num, "$ Translating audio file...", num) + "$ Displaying result [4/7].</style>\n\nSorry for the danger we've brought upon this world.\n\nThat entity has been detected quickly approaching this planet. It must've followed us after we escaped its last attack. I had thought it to be a mindless destructive force, but these actions imply a level of intelligence and determination. Running away will only delay its inevitable return while putting more lives in harm's way.\n\nThe Chaos Emeralds bring our thoughts to life. Thoughts of fear had manifested as the speed that let us escape its previous attack.\n\nLet the emeralds sense that there are no longer thoughts of cowardice among our warriors.\n\nLet them sense our resolve to protect this planet we now call home.\n\nLet our hearts draw out their true power. Only that power could stand before that monster's unthinkable might.");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_PURPLE_EMERALD_LORE", EggFace("<style=cMono>Welcome to the Egg-Net archives.", num - 13, "$ Combing for data relevant to", num, "$ \"Ancients and Chaos Emeralds\"...", num, "$ Results found in folder: Starfall", num, "$ Translating audio file...", num) + "$ Displaying result [5/7].</style>\n\nBefore now, I believed the power of the Chaos Emeralds to be limitless. That entity has made the limits of their power very clear. Our emerald-fueled weapons, with enough force to destroy the planet we stand on, seemed to do nothing against it.\n\nAs it overpowered our best efforts at destroying it, it spoke to us.\n\nIt called itself [The End]. It spoke in our language. It spoke with intelligence and conviction. It spoke of moments of our past that it should never have had a chance to witness.\n\nIt knows every one of us on a personal level. Why would a being with no purpose other than to indiscriminately destroy need to know so much? Is it just another means to an end for it? [The End] is more than just powerful. It's cunning.\n\nWith any attempts at destroying it failing, it was decided we would contain it. Cyber Space turned into [The End]'s prison, completely cut off from the outside world. No matter how great its power, it cannot tear down the walls between dimensions through brute force alone.\n\n[The End] is sealed within Cyber Space. It has no means of escaping on its own. It has no way of interacting with anything outside of Cyber Space.\n\nSo why...\n\nWhy can I still hear it speak?" + text4 + "# [The End] could not be fully translated.");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_RED_EMERALD_LORE", EggFace("<style=cMono>Welcome to the Egg-Net archives.", num - 13, "$ Combing for data relevant to", num, "$ \"Ancients and Chaos Emeralds\"...", num, "$ Results found in folder: Starfall", num, "$ Translating audio file...", num) + "$ Displaying result [6/7].</style>\n\nI keep forgetting things. No... \"forgetting\" isn't the right word. These memories were never mine to begin with. It's all just environmental data being pulled into my mind. It never stays long. That outside information never meshes well with my head. My real memories end at that moment from thousands of years ago. The last time my consciousness was uploaded here into Cyber Space.\n\nLooking back on it objectively, things had gone quite well. We put a stop to [The End] without bringing destruction to this planet. With that great threat gone, the remainders of our people were able to fade away in peace.\n\nI'm... not exactly sure what happened to us after our battle with [The End]. What happened to the real me? No information was recorded by our people after the battle. All I know is that we didn't last long. If there was a danger, I'm sure there would be some hint as to what it was. I can only assume our last moments were in peace. That's the best conclusion anyone could hope for.\n\nJust escaping our home planet and stopping [The End] from attacking further has been a miracle. Every second we've had since this began has been a gift from the Chaos Emeralds. Now the Chaos Emeralds are our parting gift to this planet. Should they face more great dangers in the future, the Chaos Emeralds will protect them as they had protected us.\n\nAs for me and what's left of our civilization, we'll remain in seclusion so [The End]'s prison can never be found. Not much different from what we've been doing. I've needed some time alone to think anyway..." + text4 + "# [The End] could not be fully translated.");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_YELLOW_EMERALD_LORE", EggFace("<style=cMono>Welcome to the Egg-Net archives.", num - 13, "$ Combing for data relevant to", num, "$ \"Ancients and Chaos Emeralds\"...", num, "$ Results found in folder: Starfall", num, "$ Translating audio file...", num) + "$ Displaying result [7/7].</style>\n\nIf you were able, would you go change the past? I know of our future and I am satisfied with how everything went. Even if I could return to the past, there's nothing I could do to improve the final outcome of our battle. Yet, I can't stop imagining how things could have gone differently... How I... could have done more than I did.\n\nIt's stupid. I don't know why I keep thinking about this. Going back in time is a delusion. Theoretically, the Chaos Emeralds could warp time and space, but there's no way a living being could withstand it. Only something carefully designed to interface with the emeralds' power would be able to harness their power to such an extent. It would be a dream to go back into my past, even if only to put my mind at ease. Then again, dreams are all I have left. What's the harm in forgetting the present and dreaming once again? The present is for them, not for us.\n\nMaybe this time my dreams will take a different path. Maybe someone will come to save me. Maybe I'll be able to save someone else.\n\nMaybe that will be enough for me to move on.");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_LAUNCH_KEYWORD", "<style=CKeywordName>Launch</style><style=cSub>Turn the hit enemy into a projectile that <style=cIsUtility>flys in the direction hit</style> and <style=cIsDamage>deals damage</style> to other enemies it hits equal to the damage that launched it.</style>");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_MOMENTUM_PASSIVE_NAME", "Momentum");
			LanguageAPI.Add("DS_GAMING_HEDGEHOG_UTILS_MOMENTUM_PASSIVE_DESCRIPTION", "<style=cIsUtility>Build up speed</style> by <style=cIsUtility>running down hill</style> to move up to <style=cIsUtility>100% faster</style>. <style=cIsHealth>Lose speed by running up hill to move up to 33% slower.</style>\nIf <style=cIsUtility>flying</style>, <style=cIsUtility>build up speed</style> by <style=cIsUtility>moving in a straight line.</style>");
		}

		public static string EggFace(string line0, int adjust0, string line1, int adjust1, string line2, int adjust2, string line3, int adjust3, string line4, int adjust4)
		{
			int num = line0.Length + adjust0;
			string[] array = new string[5] { line0, line1, line2, line3, line4 };
			int[] array2 = new int[5] { adjust0, adjust1, adjust2, adjust3, adjust4 };
			for (int i = 1; i < 4; i++)
			{
				if (array[i].Length + array2[i] > num)
				{
					num = array[i].Length + array2[i];
				}
			}
			StringBuilder stringBuilder = new StringBuilder();
			string[] array3 = new string[5] { "    /", "X\\ /  O___O", " \\H\\L=_/ \\_=", " _+X/\\| | |/", "    \\" };
			for (int j = 0; j < array3.Length; j++)
			{
				stringBuilder.Append(array[j]);
				for (int k = 0; k < num - (array[j].Length + array2[j]) + 1; k++)
				{
					stringBuilder.Append(" ");
				}
				stringBuilder.Append(array3[j]);
				stringBuilder.Append("\n");
			}
			return stringBuilder.ToString();
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

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

		internal static void Error(object data)
		{
			if (Config.EnableLogs().Value)
			{
				_logSource.LogError(data);
			}
		}

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

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

		internal static void Message(object data)
		{
			if (Config.EnableLogs().Value)
			{
				_logSource.LogMessage(data);
			}
		}

		internal static void Warning(object data)
		{
			if (Config.EnableLogs().Value)
			{
				_logSource.LogWarning(data);
			}
		}
	}
	public static class States
	{
		internal static void RegisterStates()
		{
			Content.AddEntityState(typeof(InteractablePurchased));
			Content.AddEntityState(typeof(SuperSonic));
			Content.AddEntityState(typeof(SuperSonicTransformation));
			Content.AddEntityState(typeof(Launched));
			Content.AddEntityState(typeof(BoostIdle));
			Content.AddEntityState(typeof(Brake));
		}
	}
}
namespace HedgehogUtils.Miscellaneous
{
	public class DestroyOnExitForm : MonoBehaviour
	{
		protected FormComponent formComponent;

		protected EffectComponent effectComponent;

		public FormDef neededForm;

		private void Start()
		{
			effectComponent = ((Component)this).GetComponent<EffectComponent>();
			if (Object.op_Implicit((Object)(object)effectComponent) && effectComponent.effectData != null && Object.op_Implicit((Object)(object)effectComponent.effectData.rootObject))
			{
				formComponent = effectComponent.effectData.rootObject.GetComponent<FormComponent>();
				if (Object.op_Implicit((Object)(object)formComponent))
				{
					formComponent.OnFormChanged += FormChanged;
				}
			}
		}

		private void FormChanged(FormDef previous, FormDef current)
		{
			if ((Object)(object)current != (Object)(object)neededForm)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class MomentumPassive : MonoBehaviour
	{
		private CharacterBody body;

		private EntityStateMachine bodyStateMachine;

		private ICharacterFlightParameterProvider flight;

		public float momentum = 0f;

		private float desiredMomentum = 0f;

		private bool calced = false;

		private Vector3 prevVelocity = Vector3.zero;

		private static float cutoffAngle = 30f;

		private int frame = 0;

		private static int framesBetweenRecalc = 20;

		private static float aerialDecay = 0.2f;

		private static float groundDecay = 0.5f;

		private static float fastDecay = 0.8f;

		private static float slowDecay = 1.35f;

		public virtual float maxSpeedMultiplier => 1f;

		public virtual float minSpeedMultiplier => 1f / 3f;

		private void Start()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			bodyStateMachine = EntityStateMachine.FindByCustomName(((Component)body).gameObject, "Body");
			flight = ((Component)body).GetComponent<ICharacterFlightParameterProvider>();
		}

		private void FixedUpdate()
		{
			frame = (frame + 1) % framesBetweenRecalc;
			if (frame == 0)
			{
				CalculateMomentum();
			}
		}

		private void CalculateMomentum()
		{
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: 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_0081: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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)
			if (flight != null && flight.isFlying)
			{
				if (body.characterMotor.velocity != Vector3.zero && typeof(GenericCharacterMain).IsAssignableFrom(((object)bodyStateMachine.state).GetType()))
				{
					calced = false;
					Vector3 val = Vector3.Normalize(body.characterMotor.velocity);
					Vector3 val2 = Vector3.Normalize(prevVelocity);
					if (body.characterMotor.isGrounded)
					{
						val.y = 0f;
						val2.y = 0f;
						Vector3.Normalize(val);
						Vector3.Normalize(val2);
					}
					if (body.inputBank.moveVector != Vector3.zero)
					{
						desiredMomentum = Mathf.Lerp(1f, -0.8f, Vector3.Angle(val, val2) / cutoffAngle);
					}
					else
					{
						desiredMomentum = 0f;
					}
					MomentumCalculation(1.2f, 0.4f);
				}
				else
				{
					momentum = 0f;
					if (!calced)
					{
						calced = true;
						body.MarkAllStatsDirty();
					}
				}
				prevVelocity = body.characterMotor.velocity;
			}
			else if (body.characterMotor.velocity != Vector3.zero && body.characterMotor.isGrounded && typeof(GenericCharacterMain).IsAssignableFrom(((object)bodyStateMachine.state).GetType()))
			{
				calced = false;
				Vector3 val3 = VelocityOnGround(body.characterMotor.velocity);
				float num = Vector3.Dot(val3, Vector3.down);
				desiredMomentum = Mathf.Clamp(num * 2f, -1f, 1f);
				MomentumCalculation(slowDecay, fastDecay);
			}
			else
			{
				desiredMomentum = 0f;
				float num2 = (body.characterMotor.isGrounded ? groundDecay : aerialDecay);
				MomentumCalculation(num2, num2);
			}
		}

		private Vector3 VelocityOnGround(Vector3 velocity)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			velocity.y = 0f;
			Vector3 val = Vector3.ProjectOnPlane(velocity, body.characterMotor.estimatedGroundNormal);
			return ((Vector3)(ref val)).normalized;
		}

		private void MomentumCalculation(float slowDecay, float fastDecay)
		{
			if (Mathf.Abs(desiredMomentum - momentum) > 0.1f)
			{
				if (desiredMomentum > momentum)
				{
					momentum = Mathf.Clamp(momentum + (desiredMomentum - momentum) * Time.fixedDeltaTime * slowDecay * (float)framesBetweenRecalc, -1f, desiredMomentum);
				}
				else
				{
					momentum = Mathf.Clamp(momentum + (desiredMomentum - momentum) * Time.fixedDeltaTime * fastDecay * (float)framesBetweenRecalc, desiredMomentum, 1f);
				}
				body.MarkAllStatsDirty();
				return;
			}
			momentum = desiredMomentum;
			if (!calced)
			{
				calced = true;
				body.MarkAllStatsDirty();
			}
		}
	}
	public static class MomentumStats
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StatHookEventHandler <0>__RecalculateStats;
		}

		public static void Initialize()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__RecalculateStats;
			if (obj == null)
			{
				StatHookEventHandler val = RecalculateStats;
				<>O.<0>__RecalculateStats = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
		}

		public static void RecalculateStats(CharacterBody self, StatHookEventArgs stats)
		{
			MomentumPassive component = ((Component)self).GetComponent<MomentumPassive>();
			if (Object.op_Implicit((Object)(object)component))
			{
				if (component.momentum >= 0f)
				{
					stats.moveSpeedMultAdd += component.momentum * component.maxSpeedMultiplier;
				}
				else
				{
					stats.moveSpeedReductionMultAdd += Mathf.Abs(component.momentum) * component.minSpeedMultiplier;
				}
			}
		}
	}
	[RequireComponent(typeof(CharacterMotor))]
	public class StayOnGround : MonoBehaviour
	{
		protected CharacterMotor characterMotor;

		public float strength = 7f;

		private void Awake()
		{
			characterMotor = ((Component)this).GetComponent<CharacterMotor>();
		}

		private void Update()
		{
			//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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			if (characterMotor.isGrounded)
			{
				Vector3 val = characterMotor.velocity;
				val.y = 0f;
				val = ((Vector3)(ref val)).normalized;
				CharacterMotor obj = characterMotor;
				Vector3 val2 = Vector3.ProjectOnPlane(val, characterMotor.estimatedGroundNormal);
				obj.AddDisplacement((1f + Vector3.Dot(((Vector3)(ref val2)).normalized, Vector3.down)) * Time.deltaTime * strength * Vector3.down);
			}
		}
	}
}
namespace HedgehogUtils.Launch
{
	public static class DamageTypes
	{
		public static ModdedDamageType launch;

		public static ModdedDamageType launchOnKill;

		public static ModdedDamageType removeLaunchAutoAim;

		public static void Initialize()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			launch = DamageAPI.ReserveDamageType();
			launchOnKill = DamageAPI.ReserveDamageType();
			removeLaunchAutoAim = DamageAPI.ReserveDamageType();
		}
	}
	public class DieOnLaunchEnd : MonoBehaviour
	{
		private VehicleSeat launchVehicle;

		private CharacterBody body;

		private bool die;

		private void Start()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)body))
			{
				launchVehicle = body.currentVehicle;
				if (Object.op_Implicit((Object)(object)launchVehicle))
				{
					launchVehicle.onPassengerExit += OnLaunchEnd;
					return;
				}
			}
			Object.Destroy((Object)(object)this);
		}

		private void OnLaunchEnd(GameObject self)
		{
			if (Object.op_Implicit((Object)(object)body.healthComponent) && !body.healthComponent.alive)
			{
				die = true;
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
		}

		private void FixedUpdate()
		{
			if (!Object.op_Implicit((Object)(object)body))
			{
				Object.Destroy((Object)(object)this);
			}
			if (die && !body.HasBuff(Buffs.launchedBuff))
			{
				CharacterDeathBehavior component = ((Component)body).gameObject.GetComponent<CharacterDeathBehavior>();
				Object.Destroy((Object)(object)this);
				if (Object.op_Implicit((Object)(object)component))
				{
					component.OnDeath();
				}
				die = false;
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)launchVehicle))
			{
				launchVehicle.onPassengerExit -= OnLaunchEnd;
			}
		}
	}
	public class Launched : EntityState
	{
		private SetStateOnHurt idleStateMachineProvider;

		public bool endLaunchASAP;

		public override void OnEnter()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			((EntityState)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.isSprinting = false;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
			{
				((EntityState)this).characterDirection.moveVector = ((EntityState)this).characterDirection.forward;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).rigidbodyMotor))
			{
				((EntityState)this).rigidbodyMotor.moveVector = Vector3.zero;
			}
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			idleStateMachineProvider = ((EntityState)this).gameObject.GetComponent<SetStateOnHurt>();
			if (Object.op_Implicit((Object)(object)idleStateMachineProvider))
			{
				EntityStateMachine[] idleStateMachine = idleStateMachineProvider.idleStateMachine;
				for (int i = 0; i < idleStateMachine.Length; i++)
				{
					if ((Object)(object)idleStateMachine[i] != (Object)(object)base.outer)
					{
						idleStateMachine[i].SetNextState((EntityState)new Idle());
					}
				}
			}
			if (NetworkClient.active)
			{
				((EntityState)this).gameObject.AddComponent<DieOnLaunchEnd>();
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)6;
		}
	}
	public static class LaunchManager
	{
		public static GameObject launchProjectilePrefab;

		public static string[] bodyBlacklist = new string[16]
		{
			"BrotherBody", "BrotherGlassBody", "BrotherHurtBody", "FalseSonBossBody", "FalseSonBossBodyBrokenLunarShard", "FalseSonBossBodyLunarShard", "MagmaWormBody", "ElectricWormBody", "ShopkeeperBody", "MiniVoidRaidCrabBodyBase",
			"MiniVoidRaidCrabBodyPhase1", "MiniVoidRaidCrabBodyPhase2", "MiniVoidRaidCrabBodyPhase3", "ScorchlingBody", "GravekeeperTrackingFireball", "DeltaConstructBody"
		};

		public const float launchSpeed = 55f;

		public const float baseDuration = 0.85f;

		public static void Launch(CharacterBody target, CharacterBody attacker, Vector3 direction, float speed, float damage, float wallCollisionDamage, bool crit, float procCoefficient, float duration)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && TargetCanBeLaunched(target, out var currentLaunchController))
			{
				if (Object.op_Implicit((Object)(object)currentLaunchController))
				{
					currentLaunchController.Restart(attacker, direction, speed, damage, wallCollisionDamage, crit, procCoefficient, duration);
					return;
				}
				GameObject val = Object.Instantiate<GameObject>(launchProjectilePrefab, target.corePosition, Quaternion.LookRotation(direction));
				LaunchProjectileController component = val.GetComponent<LaunchProjectileController>();
				component.Restart(attacker, direction, speed, damage, wallCollisionDamage, crit, procCoefficient, duration);
				VehicleSeat component2 = val.GetComponent<VehicleSeat>();
				component2.AssignPassenger(((Component)target).gameObject);
				target.AddBuff(Buffs.launchedBuff);
				NetworkServer.Spawn(val);
			}
		}

		public static void Launch(CharacterBody target, CharacterBody attacker, Vector3 direction, float damage, bool crit, float procCoefficient)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			Launch(target, attacker, direction, 55f, damage, damage * 0.5f, crit, 1f, 0.85f * procCoefficient);
		}

		public static Vector3 AngleAwayFromGround(Vector3 input, Vector3 groundNormal)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_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_0055: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = input;
			if (Vector3.Dot(((Vector3)(ref input)).normalized, ((Vector3)(ref groundNormal)).normalized) <= 0.1f)
			{
				Vector3 val2 = Vector3.ProjectOnPlane(val, groundNormal);
				val = ((Vector3)(ref val2)).normalized;
				val = Vector3.Lerp(val, groundNormal, 0.1f);
				val *= ((Vector3)(ref input)).magnitude;
			}
			return val;
		}

		public static Vector3 AngleTowardsEnemies(Vector3 direction, Vector3 position, GameObject target, TeamIndex attackerTeam)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0022: 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_002a: 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_007d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			BullseyeSearch val = new BullseyeSearch();
			val.teamMaskFilter = TeamMask.GetEnemyTeams(attackerTeam);
			val.filterByLoS = true;
			val.searchOrigin = position;
			val.searchDirection = direction;
			val.sortMode = (SortMode)2;
			val.maxDistanceFilter = 49.5f;
			val.minDistanceFilter = 0f;
			val.maxAngleFilter = 45f;
			val.RefreshCandidates();
			val.FilterOutGameObject(target);
			HurtBox val2 = val.GetResults().FirstOrDefault();
			if (Object.op_Implicit((Object)(object)val2))
			{
				Vector3 val3 = ((Component)val2).transform.position - target.transform.position + new Vector3(0f, 0.5f, 0f);
				return ((Vector3)(ref val3)).normalized * ((Vector3)(ref direction)).magnitude;
			}
			return direction;
		}

		public static bool TargetCanBeLaunched(CharacterBody target)
		{
			LaunchProjectileController currentLaunchController;
			return TargetCanBeLaunched(target, out currentLaunchController);
		}

		public static bool TargetCanBeLaunched(CharacterBody target, out LaunchProjectileController currentLaunchController)
		{
			//IL_0028: 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)
			currentLaunchController = null;
			if ((!Config.LaunchBodyBlacklist().Value || !bodyBlacklist.Contains(BodyCatalog.GetBodyName(target.bodyIndex))) && !((Enum)target.bodyFlags).HasFlag((Enum)(object)(BodyFlags)16384))
			{
				EntityStateMachine val = EntityStateMachine.FindByCustomName(((Component)target).gameObject, "Body");
				if (Object.op_Implicit((Object)(object)val) && val.CanInterruptState((InterruptPriority)6))
				{
					if (!target.HasBuff(Buffs.launchedBuff))
					{
						return true;
					}
					LaunchProjectileController launchProjectileController = default(LaunchProjectileController);
					if (Object.op_Implicit((Object)(object)target.currentVehicle) && ((Component)target.currentVehicle).gameObject.TryGetComponent<LaunchProjectileController>(ref launchProjectileController))
					{
						currentLaunchController = launchProjectileController;
						return launchProjectileController.age > 0.3f;
					}
				}
			}
			return false;
		}

		public static bool AttackCanLaunch(HealthComponent target, CharacterBody attacker, DamageInfo damageInfo)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			return AttackCanLaunch(target.body, attacker, damageInfo.rejected, damageInfo.procCoefficient, damageInfo.force);
		}

		public static bool AttackCanLaunch(CharacterBody target, CharacterBody attacker, bool targetInvincible, float procCoefficient, Vector3 force)
		{
			//IL_007f: 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)
			if (Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)attacker) && !targetInvincible && procCoefficient > 0.3f)
			{
				Rigidbody component = ((Component)target).gameObject.GetComponent<Rigidbody>();
				if (Object.op_Implicit((Object)(object)component) && component.mass <= ((Vector3)(ref force)).magnitude)
				{
					if (Object.op_Implicit((Object)(object)target.characterMotor) && target.characterMotor.isGrounded)
					{
						return Vector3.Dot(((Vector3)(ref force)).normalized, target.characterMotor.estimatedGroundNormal) >= -0.6f;
					}
					return true;
				}
			}
			return false;
		}

		public static void Initialize()
		{
			//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)
			launchProjectilePrefab = Assets.mainAssetBundle.LoadAsset<GameObject>("LaunchProjectile");
			launchProjectilePrefab.AddComponent<NetworkIdentity>();
			VehicleSeat val = launchProjectilePrefab.AddComponent<VehicleSeat>();
			val.disablePassengerMotor = false;
			val.isEquipmentActivationAllowed = false;
			val.shouldProximityHighlight = false;
			val.seatPosition = ((Component)val).transform;
			val.passengerState = new SerializableEntityStateType(typeof(Launched));
			val.hidePassenger = false;
			val.exitVelocityFraction = 0.3f;
			launchProjectilePrefab.AddComponent<LaunchProjectileController>();
			HitBoxGroup val2 = launchProjectilePrefab.AddComponent<HitBoxGroup>();
			HitBox val3 = ((Component)launchProjectilePrefab.transform.Find("Hitbox")).gameObject.AddComponent<HitBox>();
			((Component)val3).gameObject.layer = LayerIndex.entityPrecise.intVal;
			val2.hitBoxes = (HitBox[])(object)new HitBox[1] { val3 };
			launchProjectilePrefab.gameObject.layer = LayerIndex.projectileWorldOnly.intVal;
			launchProjectilePrefab.GetComponent<Rigidbody>().interpolation = (RigidbodyInterpolation)2;
			PrefabAPI.RegisterNetworkPrefab(launchProjectilePrefab);
		}
	}
	public class LaunchProjectileController : NetworkBehaviour
	{
		private const float attacksPerSecond = 10f;

		public float wallCollisionDamage = 0.5f;

		public float damage;

		public float procCoefficient;

		[SyncVar]
		public bool crit;

		public CharacterBody attacker;

		[SyncVar]
		public Vector3 movementVector;

		[SyncVar]
		public float duration;

		private const float fadeDurationPercent = 0.8f;

		private const float noImpactDuration = 0.2f;

		private const float hitStopDuration = 0.1f;

		protected OverlapAttack attack;

		private float attackTimer;

		public float age;

		protected bool collidedWithWall;

		protected GameObject vfxObject;

		protected Renderer vfxRenderer;

		protected VehicleSeat vehicle;

		protected Rigidbody rigidbody;

		protected bool vehicleInit;

		protected SphereCollider collider;

		protected HitBoxGroup hitBoxGroup;

		protected float radius;

		protected CharacterModel characterModel;

		protected CharacterBody body;

		public void Awake()
		{
			vehicle = ((Component)this).GetComponent<VehicleSeat>();
			rigidbody = ((Component)this).GetComponent<Rigidbody>();
			collider = ((Component)this).GetComponent<SphereCollider>();
			hitBoxGroup = ((Component)this).GetComponent<HitBoxGroup>();
			vehicle.enterVehicleAllowedCheck.AddCallback((CallbackDelegate<Interactability, CharacterBody>)NoInteractingWithLaunchVehicle);
			vehicle.exitVehicleAllowedCheck.AddCallback((CallbackDelegate<Interactability, CharacterBody>)NoInteractingWithLaunchVehicle);
		}

		public void Start()
		{
			if (Object.op_Implicit((Object)(object)vehicle.passengerBodyObject))
			{
				VehicleReady();
			}
		}

		public void VehicleReady()
		{
			vehicleInit = true;
			body = vehicle.passengerInfo.body;
			radius = 2.5f;
			if (Object.op_Implicit((Object)(object)body))
			{
				radius = Mathf.Max(radius, body.bestFitRadius);
				VFXAura();
				collider.radius = radius;
			}
			Physics.IgnoreCollision((Collider)(object)collider, vehicle.passengerInfo.collider, true);
			PrepareOverlapAttack();
		}

		protected virtual void VFXAura()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)vfxObject))
			{
				Object.Destroy((Object)(object)vfxObject);
			}
			vfxObject = Object.Instantiate<GameObject>(crit ? Assets.launchCritAuraEffect : Assets.launchAuraEffect, ((Component)this).transform);
			Transform transform = vfxObject.transform;
			transform.localScale *= radius;
			vfxRenderer = ((Component)vfxObject.transform.Find("Aura")).GetComponent<Renderer>();
		}

		public void FixedUpdate()
		{
			if (!vehicleInit)
			{
				if (!Object.op_Implicit((Object)(object)vehicle.passengerBodyObject))
				{
					return;
				}
				VehicleReady();
			}
			age += Time.fixedDeltaTime;
			Move();
			AttemptAttack();
			if (age > duration && NetworkServer.active)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public void Move()
		{
			//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_00e4: 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: Unknown result type (might be due to invalid IL or missing references)
			float num = ((Vector3)(ref movementVector)).magnitude;
			if (age > duration * 0.8f)
			{
				float num2 = age - duration * 0.8f - duration * 0.19999999f;
				if (Object.op_Implicit((Object)(object)vfxRenderer))
				{
					vfxRenderer.material.SetFloat("_AlphaBoost", Mathf.Lerp(0.2f, 0f, num2));
				}
				num = Mathf.Lerp(((Vector3)(ref movementVector)).magnitude, ((Vector3)(ref movementVector)).magnitude / 2f, num2);
			}
			rigidbody.rotation = Quaternion.LookRotation(((Vector3)(ref movementVector)).normalized);
			rigidbody.velocity = ((age <= 0.1f) ? Vector3.zero : (((Vector3)(ref movementVector)).normalized * num));
		}

		public void AttemptAttack()
		{
			if (Util.HasEffectiveAuthority(((Component)this).gameObject))
			{
				attackTimer += Time.fixedDeltaTime;
				if (attackTimer > 0.1f)
				{
					attackTimer %= 0.1f;
					attack.Fire((List<HurtBox>)null);
				}
			}
		}

		public void OnDestroy()
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)body))
			{
				body.RemoveBuff(Buffs.launchedBuff);
				if (Object.op_Implicit((Object)(object)body.healthComponent) && !body.healthComponent.alive)
				{
					CharacterDeathBehavior component = ((Component)body).gameObject.GetComponent<CharacterDeathBehavior>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.OnDeath();
					}
				}
			}
			if (Object.op_Implicit((Object)(object)attacker) && Util.HasEffectiveAuthority(((Component)attacker).gameObject))
			{
				FinalImpactAttack();
			}
		}

		protected void FinalImpactAttack()
		{
			ResizeHitBox(3.5f);
			attack.Fire((List<HurtBox>)null);
		}

		protected virtual void PrepareOverlapAttack()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			attack = new OverlapAttack();
			ResizeHitBox(2f);
			attack.procCoefficient = procCoefficient;
			attack.attacker = ((Component)attacker).gameObject;
			attack.isCrit = crit;
			attack.damage = damage;
			attack.damageType = DamageTypeCombo.op_Implicit((DamageType)32);
			attack.teamIndex = attacker.teamComponent.teamIndex;
			attack.attackerFiltering = (AttackerFiltering)2;
			attack.pushAwayForce = 1500f;
			attack.hitEffectPrefab = (crit ? Assets.launchCritHitEffect : Assets.launchHitEffect);
			attack.impactSound = NetworkSoundEventCatalog.FindNetworkSoundEventIndex("Play_beetle_guard_impact");
			attack.addIgnoredHitList(body.healthComponent);
		}

		private void ResizeHitBox(float mult)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)hitBoxGroup.hitBoxes[0]).transform;
			float num = radius * mult;
			transform.localScale = new Vector3(num, num, num);
			attack.hitBoxGroup = hitBoxGroup;
		}

		public void Restart(CharacterBody attacker, Vector3 direction, float speed, float damage, float wallCollisionDamage, bool crit, float procCoefficient, float duration)
		{
			//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)
			age = 0f;
			this.attacker = attacker;
			movementVector = direction * speed;
			this.damage = damage;
			this.wallCollisionDamage = wallCollisionDamage;
			this.crit = crit;
			this.procCoefficient = procCoefficient;
			this.duration = duration;
			if (Object.op_Implicit((Object)(object)attacker.characterMotor))
			{
				Physics.IgnoreCollision((Collider)(object)collider, (Collider)(object)attacker.characterMotor.capsuleCollider, true);
			}
			vehicleInit = false;
		}

		public void OnCollisionStay(Collision collisionInfo)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008c: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			if (!collidedWithWall && NetworkServer.active && vehicleInit && !(age < 0.2f))
			{
				Vector3 impulse = collisionInfo.impulse;
				if (!(((Vector3)(ref impulse)).magnitude < 20f))
				{
					GameObject obj =