Decompiled source of Celestial War Tank v1.1.5

TanksMod.dll

Decompiled 18 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.ClayBruiser.Weapon;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.SurvivorPod;
using EntityStates.Toolbot;
using EntityStates.Treebot.Weapon;
using HG;
using HG.BlendableTypes;
using JetBrains.Annotations;
using KinematicCharacterController;
using MaterialHud;
using On.RoR2;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Items;
using RoR2.Networking;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.Stats;
using RoR2.SurvivorMannequins;
using RoR2.UI;
using TMPro;
using TanksMod.Content;
using TanksMod.Modules;
using TanksMod.Modules.Characters;
using TanksMod.Modules.Components;
using TanksMod.Modules.Components.BasicTank;
using TanksMod.Modules.Components.Projectile;
using TanksMod.Modules.Components.UI;
using TanksMod.Modules.Networking;
using TanksMod.Modules.Networking.Skills;
using TanksMod.Modules.Pods.ShippingContainerPod;
using TanksMod.Modules.Survivors;
using TanksMod.SkillStates;
using TanksMod.SkillStates.AAProjectile;
using TanksMod.SkillStates.BasicTank;
using TanksMod.SkillStates.BasicTank.ArtilleryCannon;
using TanksMod.SkillStates.BasicTank.CritCannon;
using TanksMod.SkillStates.BasicTank.CritCannon.StandaloneAcientScepter;
using TanksMod.SkillStates.BasicTank.DashRam;
using TanksMod.SkillStates.BasicTank.HowitzerCannon;
using TanksMod.SkillStates.BasicTank.Minigun;
using TanksMod.SkillStates.BasicTank.MissleLauncher;
using TanksMod.SkillStates.Landmine;
using TanksMod.SkillStates.MiniLandmine;
using TanksMod.SkillStates.Projectile;
using TanksMod.States;
using TanksMod.States.Tank;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.Serialization;
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: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("CheeseWithHoles")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TanksMod")]
[assembly: AssemblyTitle("TanksMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace TanksMod
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.cheesewithholes.TanksMod", "TanksMod", "1.0.0")]
	[R2APISubmoduleDependency(new string[] { "PrefabAPI", "LanguageAPI", "SoundAPI", "UnlockableAPI", "NetworkingAPI" })]
	public class TanksPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.cheesewithholes.TanksMod";

		public const string MODNAME = "TanksMod";

		public const string MODVERSION = "1.0.0";

		public const string DEVELOPER_PREFIX = "CHEESEWITHHOLES";

		public static TanksPlugin instance;

		public static GameObject player;

		public static bool is_RiskOfOptions_Mod_Installed => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		public static bool is_RiskUI_Mod_Installed => Chainloader.PluginInfos.ContainsKey("bubbet.riskui");

		public static bool is_StandaloneAncientScepter_Mod_Installed => Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter");

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Assets.Initialize();
			Config.myConfig = ((BaseUnityPlugin)this).Config;
			Config.ReadConfig();
			TanksMod.Modules.States.RegisterStates();
			Buffs.RegisterBuffs();
			Projectiles.RegisterProjectiles();
			Tokens.AddTokens();
			ItemDisplays.PopulateDisplays();
			RegisterMessages();
			new BasicTank().Initialize();
			new ContentPacks().Initialize();
		}

		private void RegisterMessages()
		{
			NetworkingAPI.RegisterMessageType<SendInputToBankRequest>();
			NetworkingAPI.RegisterMessageType<Fuel>();
			NetworkingAPI.RegisterMessageType<Velocity>();
			NetworkingAPI.RegisterMessageType<SendStuntStateNetworkRequest>();
			NetworkingAPI.RegisterMessageType<PerformCrashEffectsNetworkRequest>();
			NetworkingAPI.RegisterMessageType<PerformRotateRootNetworkRequest>();
			NetworkingAPI.RegisterMessageType<PerformRotateGroundRotationNetworkRequest>();
			NetworkingAPI.RegisterMessageType<PerformSetGroundRotationNetworkRequest>();
			NetworkingAPI.RegisterMessageType<PerformSoundNetworkRequest>();
			NetworkingAPI.RegisterMessageType<PerformThrusterLoopSoundNetworkRequest>();
			NetworkingAPI.RegisterMessageType<SendThrusterEffectsNetworkRequest>();
			NetworkingAPI.RegisterMessageType<Minigun>();
			NetworkingAPI.RegisterMessageType<Shotgun>();
			NetworkingAPI.RegisterMessageType<PerformRamForceNetworkRequest>();
		}

		private void Update()
		{
			if ((Object)(object)player == (Object)null && Object.op_Implicit((Object)(object)Object.FindObjectOfType<NetworkManagerConfiguration>()) && Object.op_Implicit((Object)(object)Object.FindObjectOfType<NetworkManagerConfiguration>().PlayerPrefab))
			{
				GameObject playerPrefab = Object.FindObjectOfType<NetworkManagerConfiguration>().PlayerPrefab;
				if ((Object)(object)playerPrefab.GetComponent<CheesePlayerHandler>() == (Object)null)
				{
					player = playerPrefab;
					playerPrefab.AddComponent<CheesePlayerHandler>();
				}
			}
		}
	}
}
namespace TanksMod.States
{
	internal class Cannon : BaseState
	{
		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			PerformInputs();
		}

		protected void PerformInputs()
		{
			if (((EntityState)this).isAuthority)
			{
				HandleSkill(((EntityState)this).skillLocator.secondary, ref ((EntityState)this).inputBank.skill2);
			}
		}

		private void HandleSkill(GenericSkill skillSlot, ref ButtonState buttonState)
		{
			if (buttonState.down && Object.op_Implicit((Object)(object)skillSlot) && (!skillSlot.mustKeyPress || !buttonState.hasPressBeenClaimed) && CanExecuteSkill(skillSlot) && skillSlot.ExecuteIfReady())
			{
				buttonState.hasPressBeenClaimed = true;
			}
		}

		protected virtual bool CanExecuteSkill(GenericSkill skillSlot)
		{
			return true;
		}
	}
	internal class DeathState : GenericCharacterDeath
	{
		private Vector3 previousPosition;

		private float upSpeedVelocity;

		private float upSpeed;

		private Animator modelAnimator;

		public override void OnEnter()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_0039: 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)
			((GenericCharacterDeath)this).OnEnter();
			Vector3 val = Vector3.up * 3f;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				val += ((EntityState)this).characterMotor.velocity;
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
			}
			if (Object.op_Implicit((Object)(object)((GenericCharacterDeath)this).cachedModelTransform))
			{
				RagdollController component = ((Component)((GenericCharacterDeath)this).cachedModelTransform).GetComponent<RagdollController>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.BeginRagdoll(val);
				}
			}
		}

		public override void FixedUpdate()
		{
			((GenericCharacterDeath)this).FixedUpdate();
			if (NetworkServer.active && ((EntityState)this).fixedAge > 4f)
			{
				EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
			}
		}

		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;
		}
	}
	internal class GenericTankMain : BaseCharacterMain
	{
		private CheesePlayerHandler cheese;

		private NetworkUser myUser;

		private TankController tank;

		private AimAnimator aimAnimator;

		protected bool jumpInputReceived;

		protected bool sprintInputReceived;

		private Vector3 moveVector = Vector3.zero;

		private Vector3 aimDirection = Vector3.forward;

		private bool hasAimAnimator;

		public float speedBonus = 0f;

		public float jumpPowerBonus = 0f;

		public float armorBonus = 0f;

		public float baseAttackSpeed;

		public float attackSpeedBonus = 0f;

		public float thrustPowerBonus = 0f;

		public float hoverPowerBonus = 0f;

		public override void OnEnter()
		{
			((BaseCharacterMain)this).OnEnter();
			if (Object.op_Implicit((Object)(object)((Component)((EntityState)this).characterBody.master).GetComponent<PlayerCharacterMasterController>()))
			{
				myUser = ((Component)((EntityState)this).characterBody.master).GetComponent<PlayerCharacterMasterController>().networkUser;
			}
			if (Object.op_Implicit((Object)(object)((Component)myUser).GetComponent<CheesePlayerHandler>()))
			{
				cheese = ((Component)myUser).GetComponent<CheesePlayerHandler>();
			}
			tank = ((EntityState)this).GetComponent<TankController>();
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				aimAnimator = ((Component)modelTransform).GetComponent<AimAnimator>();
				if (Object.op_Implicit((Object)(object)aimAnimator))
				{
					((Behaviour)aimAnimator).enabled = true;
				}
			}
			hasAimAnimator = Object.op_Implicit((Object)(object)aimAnimator);
			tank.newFuelAmount = tank.baseFuelAmount;
			tank.maxFuelAmount = tank.newFuelAmount;
			tank.currentFuelAmount = tank.newFuelAmount;
			tank.previousFuelAmount = tank.newFuelAmount;
			tank.expectedFuelAmount = tank.newFuelAmount;
			tank.newJumpFuelConsumption = tank.baseJumpFuelConsumption;
			tank.newFuelRechargeRate = tank.baseFuelRechargeRate;
			tank.newDelayRechargeTime = tank.baseDelayRechargeTime;
			tank.currentDelayRechargeTime = tank.newDelayRechargeTime;
			tank.newJumpThrustMultiplier = tank.baseJumpThrustMultiplier;
			tank.newJumpHoverMultiplier = tank.baseJumpHoverMultiplier;
			baseAttackSpeed = ((EntityState)this).characterBody.baseAttackSpeed;
			UpdateCharacteristics();
		}

		public override void Update()
		{
			((BaseCharacterMain)this).Update();
		}

		public override void FixedUpdate()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).GetComponent<TankController>()) && (Object)(object)tank == (Object)null)
			{
				tank = ((EntityState)this).GetComponent<TankController>();
			}
			((BaseCharacterMain)this).FixedUpdate();
			if (tank.IsNotCrashed())
			{
				GatherInputs();
				HandleMovements();
				PerformInputs();
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				UpdateFuelStats();
				if ((Object)(object)cheese != (Object)null)
				{
					ApplyFuelBaseAmount();
					ApplyBonusesIfAvailable();
					UpdateCharacteristics();
				}
			}
		}

		private void ModDetection()
		{
			if (!TanksPlugin.is_StandaloneAncientScepter_Mod_Installed)
			{
				return;
			}
			if (((EntityState)this).characterBody.inventory.GetItemCount(((ItemBase)ItemBase<AncientScepterItem>.instance).ItemDef) >= 1)
			{
				if (((EntityState)this).skillLocator.secondary.skillDef.skillName == "Crit Cannon")
				{
					((EntityState)this).skillLocator.secondary.AssignSkill(BasicTank.chargeCannonSkillDef);
				}
			}
			else if (((EntityState)this).skillLocator.secondary.skillDef.skillName == "Doctor's Cannon")
			{
				((EntityState)this).skillLocator.secondary.AssignSkill(BasicTank.cannonSkillDef);
			}
		}

		private void UpdateCharacteristics()
		{
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			StaticModels.BodyType[] array = Enum.GetValues(typeof(StaticModels.BodyType)).Cast<StaticModels.BodyType>().ToArray();
			StaticModels.TurretType[] array2 = Enum.GetValues(typeof(StaticModels.TurretType)).Cast<StaticModels.TurretType>().ToArray();
			float num = StaticValues.GetHealthValueFromBody(array[cheese.currentBodyId]) + StaticValues.GetHealthValueFromTurret(array2[cheese.currentTurretId]);
			float num2 = StaticValues.GetArmorValueFromBody(array[cheese.currentBodyId]) + StaticValues.GetArmorValueFromTurret(array2[cheese.currentTurretId]);
			((EntityState)this).characterBody.baseMaxHealth = num;
			((EntityState)this).characterBody.baseArmor = num2 + armorBonus;
			((EntityState)this).characterBody.baseAcceleration = StaticValues.baseAcceleration;
			((EntityState)this).characterBody.baseAttackSpeed = baseAttackSpeed + attackSpeedBonus;
			float num3 = StaticValues.baseJumpPower - StaticValues.baseJumpPower * ((num + num2) / 1000f);
			((EntityState)this).characterBody.baseJumpPower = num3 + jumpPowerBonus;
			float num4 = StaticValues.baseSpeed - StaticValues.baseSpeed * ((num + num2) / 1000f);
			((EntityState)this).characterBody.baseMoveSpeed = num4 + speedBonus;
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			characterMotor.mass = num + num2;
			tank.weightRatio = 1f - (num + num2) / (BasicTank.baseHealth + BasicTank.baseArmor);
			float num5 = 0.1f;
			float num6 = 0.225f;
			float num7 = 0.3f;
			float num8 = num / BasicTank.baseHealth;
			AnimationCurve val = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
			{
				new Keyframe(0f, num5),
				new Keyframe(1f, num6),
				new Keyframe(2f, num7)
			});
			AnimationCurve val2 = new AnimationCurve((Keyframe[])(object)new Keyframe[4]
			{
				new Keyframe(0f, 10f),
				new Keyframe(0.5f, 1f),
				new Keyframe(1f, 1f),
				new Keyframe(2f, 1f)
			});
			float num9 = val.Evaluate(num8);
			float num10 = val2.Evaluate(num8);
			((EntityState)this).characterBody.levelMaxHealth = num * num9 * num10;
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RecalculateStats();
			}
		}

		private void ApplyFuelBaseAmount()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.utility))
			{
				if (((EntityState)this).skillLocator.utility.baseSkill.skillName == "Dash Spikes")
				{
					tank.baseFuelAmount = 150f;
				}
				if (((EntityState)this).skillLocator.utility.baseSkill.skillName == "Mobility Assistance")
				{
					tank.baseFuelAmount = 150f;
				}
			}
		}

		private void ApplyBonusesIfAvailable()
		{
			float num = 0f;
			float num2 = 0f;
			float num3 = 0f;
			float num4 = 0f;
			float num5 = 0f;
			float num6 = 0f;
			if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && ((EntityState)this).isAuthority)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.primary) && ((EntityState)this).skillLocator.primary.skillNameToken.Contains("EMPTY"))
				{
					num += 0.5f;
					num4 += 0.5f;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.utility) && ((EntityState)this).skillLocator.utility.skillNameToken.Contains("EMPTY"))
				{
					num += 1f;
					num2 += 0.5f;
					num5 += 0.1f;
					num6 += 0.01f;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.special) && ((EntityState)this).skillLocator.special.skillNameToken.Contains("EMPTY"))
				{
					num3 += 25f;
				}
				num5 += tank.weightRatio / 2f;
				num6 += tank.weightRatio / 2f;
			}
			speedBonus = num;
			jumpPowerBonus = num2;
			attackSpeedBonus = num4;
			armorBonus = num3;
			thrustPowerBonus = num5;
			hoverPowerBonus = num6;
		}

		private void UpdateFuelStats()
		{
			if (!((Object)(object)cheese != (Object)null))
			{
				return;
			}
			tank.newFuelAmount = SetMaxFuelAmount();
			tank.newFuelRechargeRate = SetNewRechargeRate();
			tank.newJumpThrustMultiplier = (SetNewJumpThrustMultiplier() + thrustPowerBonus) * tank.powerRatio;
			tank.newJumpHoverMultiplier = (tank.baseJumpHoverMultiplier + hoverPowerBonus) * tank.powerRatio;
			tank.newDelayRechargeTime = SetNewDelayRecharge();
			tank.maxFuelAmount = tank.newFuelAmount;
			tank.newFuelAmount = Mathf.Clamp(tank.newFuelAmount, 0f, float.PositiveInfinity);
			tank.currentFuelAmount = Mathf.Clamp(tank.currentFuelAmount, 0f, tank.newFuelAmount);
			tank.previousFuelAmount = Mathf.Clamp(tank.previousFuelAmount, 0f, tank.newFuelAmount);
			tank.expectedFuelAmount = Mathf.Clamp(tank.expectedFuelAmount, 0f, tank.newFuelAmount);
			tank.newFuelRechargeRate = Mathf.Clamp(tank.newFuelRechargeRate, 0f, float.PositiveInfinity);
			tank.newJumpThrustMultiplier = Mathf.Clamp(tank.newJumpThrustMultiplier, tank.baseJumpThrustMultiplier, 1f);
			tank.newJumpHoverMultiplier = Mathf.Clamp(tank.newJumpHoverMultiplier, tank.baseJumpHoverMultiplier, 0.25f);
			tank.newDelayRechargeTime = Mathf.Clamp(tank.newDelayRechargeTime, 0.1f, float.PositiveInfinity);
			if (tank.currentFuelAmount < tank.previousFuelAmount)
			{
				tank.currentDelayRechargeTime = tank.newDelayRechargeTime;
				tank.previousFuelAmount = tank.currentFuelAmount;
				tank.expectedFuelAmount = tank.currentFuelAmount;
			}
			else
			{
				tank.previousFuelAmount = tank.currentFuelAmount;
			}
			if (tank.expectedFuelAmount > tank.currentFuelAmount || !tank.IsNotInFlight())
			{
				tank.currentDelayRechargeTime = tank.newDelayRechargeTime;
			}
			if (tank.currentDelayRechargeTime > 0f && !((EntityState)this).inputBank.skill3.down && !((EntityState)this).inputBank.jump.down)
			{
				tank.currentDelayRechargeTime -= Time.deltaTime;
			}
			if (tank.currentDelayRechargeTime <= 0f)
			{
				if (tank.currentFuelAmount < tank.newFuelAmount)
				{
					tank.currentFuelAmount += Time.deltaTime * tank.newFuelRechargeRate;
				}
				if (tank.expectedFuelAmount < tank.newFuelAmount)
				{
					tank.expectedFuelAmount += Time.deltaTime * tank.newFuelRechargeRate;
				}
				tank.currentDelayRechargeTime = 0f;
			}
		}

		private float SetMaxFuelAmount()
		{
			return tank.baseFuelAmount + 5f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.WarCryOnMultiKill) + 5f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.AttackSpeedOnCrit) + 5f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.IgniteOnKill) + 35f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.Feather) + 10f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.StrengthenBurn) + 25f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.JumpBoost) + 100f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.UtilitySkillMagazine) + 15f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.ShinyPearl) + 50f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.FallBoots);
		}

		private float SetNewRechargeRate()
		{
			return tank.baseFuelRechargeRate * ((EntityState)this).characterBody.attackSpeed;
		}

		private float SetNewJumpThrustMultiplier()
		{
			return tank.baseJumpThrustMultiplier + 0.08f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.UtilitySkillMagazine) + 0.05f * (float)((EntityState)this).characterBody.inventory.GetItemCount(Items.ShinyPearl);
		}

		private float SetNewDelayRecharge()
		{
			return tank.baseDelayRechargeTime - (((EntityState)this).characterBody.attackSpeed - 1f);
		}

		public virtual void HandleMovements()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Invalid comparison between Unknown and I4
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			if (base.useRootMotion)
			{
				if (base.hasCharacterMotor)
				{
					((EntityState)this).characterMotor.moveDirection = Vector3.zero;
				}
				if (base.hasRailMotor)
				{
					((EntityState)this).railMotor.inputMoveVector = moveVector;
				}
			}
			else
			{
				if (base.hasCharacterMotor)
				{
					((EntityState)this).characterMotor.moveDirection = moveVector;
				}
				if (base.hasRailMotor)
				{
					((EntityState)this).railMotor.inputMoveVector = moveVector;
				}
			}
			bool isGrounded = ((BaseState)this).isGrounded;
			if (!base.hasRailMotor && base.hasCharacterDirection && base.hasCharacterBody)
			{
				if (hasAimAnimator && (int)aimAnimator.aimType == 1)
				{
					Vector3 val = ((moveVector == Vector3.zero) ? ((EntityState)this).characterDirection.forward : moveVector);
					float num = Vector3.Angle(aimDirection, val);
					float num2 = Mathf.Max(aimAnimator.pitchRangeMax + aimAnimator.pitchGiveupRange, aimAnimator.yawRangeMax + aimAnimator.yawGiveupRange);
					((EntityState)this).characterDirection.moveVector = ((Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && ((EntityState)this).characterBody.shouldAim && num > num2) ? aimDirection : val);
				}
				else
				{
					((EntityState)this).characterDirection.moveVector = ((Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && ((EntityState)this).characterBody.shouldAim) ? aimDirection : moveVector);
				}
			}
			if (((EntityState)this).isAuthority && base.hasCharacterBody)
			{
				bool isSprinting = sprintInputReceived;
				if (((Vector3)(ref moveVector)).magnitude <= 0.5f)
				{
					isSprinting = false;
				}
				((EntityState)this).characterBody.isSprinting = isSprinting;
			}
		}

		protected virtual bool CanExecuteSkill(GenericSkill skillSlot)
		{
			return true;
		}

		protected void PerformInputs()
		{
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			if (base.hasSkillLocator)
			{
				if (((EntityState)this).skillLocator.primary.skillDef.skillName != "Empty" && ((EntityState)this).skillLocator.primary.skillDef.skillName != "DISABLED")
				{
					HandleSkill(((EntityState)this).skillLocator.primary, ref ((EntityState)this).inputBank.skill1);
				}
				if (((EntityState)this).skillLocator.secondary.skillDef.skillName != "Empty" && ((EntityState)this).skillLocator.secondary.skillDef.skillName != "DISABLED")
				{
					HandleSkill(((EntityState)this).skillLocator.secondary, ref ((EntityState)this).inputBank.skill2);
				}
				if (((EntityState)this).skillLocator.utility.skillDef.skillName != "Empty" && ((EntityState)this).skillLocator.utility.skillDef.skillName != "DISABLED")
				{
					HandleSkill(((EntityState)this).skillLocator.utility, ref ((EntityState)this).inputBank.skill3);
				}
				if (((EntityState)this).skillLocator.special.skillDef.skillName != "Empty" && ((EntityState)this).skillLocator.special.skillDef.skillName != "DISABLED")
				{
					HandleSkill(((EntityState)this).skillLocator.special, ref ((EntityState)this).inputBank.skill4);
				}
			}
			jumpInputReceived = false;
			sprintInputReceived = false;
		}

		protected void GatherInputs()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (base.hasInputBank)
			{
				moveVector = ((EntityState)this).inputBank.moveVector;
				aimDirection = ((EntityState)this).inputBank.aimDirection;
				jumpInputReceived = ((ButtonState)(ref ((EntityState)this).inputBank.jump)).justPressed;
				sprintInputReceived |= ((EntityState)this).inputBank.sprint.down;
			}
		}

		[CompilerGenerated]
		private void HandleSkill(GenericSkill skillSlot, ref ButtonState buttonState)
		{
			if (buttonState.down && Object.op_Implicit((Object)(object)skillSlot) && (!skillSlot.mustKeyPress || !buttonState.hasPressBeenClaimed) && CanExecuteSkill(skillSlot) && skillSlot.ExecuteIfReady())
			{
				buttonState.hasPressBeenClaimed = true;
			}
		}

		public override void OnExit()
		{
			//IL_0007: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			NetMessageExtensions.Send((INetMessage)(object)new PerformThrusterLoopSoundNetworkRequest(((NetworkBehaviour)((EntityState)this).characterBody).netId, play: false), (NetworkDestination)1);
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				AimAnimator component = ((Component)modelTransform).GetComponent<AimAnimator>();
				if (Object.op_Implicit((Object)(object)component))
				{
					((Behaviour)component).enabled = false;
				}
			}
			if (((EntityState)this).isAuthority)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.moveDirection = Vector3.zero;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).railMotor))
				{
					((EntityState)this).railMotor.inputMoveVector = Vector3.zero;
				}
			}
			((BaseCharacterMain)this).OnExit();
		}
	}
}
namespace TanksMod.States.Tank
{
	internal class ControlLoss : BaseState
	{
		private TankController tank;

		private VisualRuntime visual;

		private SoundRuntime sound;

		private EntityStateMachine tankStateMachine;

		public override void OnEnter()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			tank = ((EntityState)this).gameObject.GetComponent<TankController>();
			visual = ((EntityState)this).gameObject.GetComponent<VisualRuntime>();
			sound = ((EntityState)this).gameObject.GetComponent<SoundRuntime>();
			tankStateMachine = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Tank");
			((BaseState)this).OnEnter();
			float num = 3f;
			tank.flailRotation = new Vector3(Random.Range(0f - num, num), Random.Range(0f - num, num), Random.Range(0f - num, num));
		}

		public override void Update()
		{
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			((EntityState)this).Update();
			visual.ThrusterEffects(play: false, loop: false, 1f, open: false);
			sound.PerformThrusterLoopSound(play: false);
			visual.resetRootRotationToGround = false;
			if (tank.IsNotCrashedEntirely())
			{
				val.Rotate(tank.flailRotation, (Space)0);
				if (tank.currentPitchAngle > tank.criticalLimitAngle || tank.currentRollAngle > tank.criticalLimitAngle)
				{
					if (((EntityState)this).characterMotor.isGrounded)
					{
						if (((EntityState)this).isAuthority)
						{
							NetMessageExtensions.Send((INetMessage)(object)new PerformCrashEffectsNetworkRequest(((NetworkBehaviour)((EntityState)this).characterBody).netId, play: true), (NetworkDestination)1);
						}
						tank.currentCrashWaitTime = tank.baseCrashWaitTime;
						if (((EntityState)this).isAuthority)
						{
							tankStateMachine.SetNextState((EntityState)(object)new Crash());
						}
					}
				}
				else if (((EntityState)this).characterMotor.isGrounded && ((EntityState)this).isAuthority)
				{
					tankStateMachine.SetNextState((EntityState)(object)new Normal());
				}
			}
			tank.previousVelocity = Vector3.zero;
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			visual.resetRootRotationToGround = false;
		}
	}
	internal class Crash : BaseState
	{
		private TankController tank;

		private VisualRuntime visual;

		private SoundRuntime sound;

		private EntityStateMachine tankStateMachine;

		public override void OnEnter()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			tank = ((EntityState)this).gameObject.GetComponent<TankController>();
			visual = ((EntityState)this).gameObject.GetComponent<VisualRuntime>();
			sound = ((EntityState)this).gameObject.GetComponent<SoundRuntime>();
			tankStateMachine = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Tank");
			((BaseState)this).OnEnter();
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			((Component)val).transform.up = -((EntityState)this).modelLocator.modelTransform.up;
			((Component)val).transform.localPosition = new Vector3(0f, 1f, 0f);
		}

		public override void FixedUpdate()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			((EntityState)this).FixedUpdate();
			visual.ThrusterEffects(play: false, loop: false, 1f, open: false);
			sound.PerformThrusterLoopSound(play: false);
			visual.resetRootRotationToGround = false;
			((EntityState)this).characterMotor.moveDirection = Vector3.zero;
			((EntityState)this).characterDirection.moveVector = Vector3.zero;
			if (((Vector3)(ref ((EntityState)this).characterMotor.velocity)).magnitude <= 1f)
			{
				if (!((EntityState)this).healthComponent.isInFrozenState)
				{
					tank.currentCrashWaitTime -= Time.deltaTime;
				}
				if (((EntityState)this).isAuthority)
				{
					NetMessageExtensions.Send((INetMessage)(object)new PerformCrashEffectsNetworkRequest(((NetworkBehaviour)((EntityState)this).characterBody).netId, play: false), (NetworkDestination)1);
				}
				if (tank.currentCrashWaitTime <= 0f)
				{
					tank.currentRecoverWaitTime = tank.baseRecoverWaitTime;
					if (((EntityState)this).isAuthority)
					{
						tankStateMachine.SetNextState((EntityState)(object)new CrashRecover());
					}
				}
			}
			tank.missleLauncherAiming = false;
		}
	}
	internal class CrashRecover : BaseState
	{
		private TankController tank;

		private VisualRuntime visual;

		private EntityStateMachine tankStateMachine;

		private bool recovered;

		public override void OnEnter()
		{
			tank = ((EntityState)this).gameObject.GetComponent<TankController>();
			visual = ((EntityState)this).gameObject.GetComponent<VisualRuntime>();
			tankStateMachine = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Tank");
			((BaseState)this).OnEnter();
		}

		public override void Update()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			((EntityState)this).Update();
			((Component)val).transform.localRotation = Quaternion.Lerp(((Component)val).transform.localRotation, new Quaternion(0f, 0f, 0f, 1f), 10f * Time.deltaTime);
			visual.resetRootRotationToGround = false;
		}

		public override void FixedUpdate()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				NetMessageExtensions.Send((INetMessage)(object)new PerformCrashEffectsNetworkRequest(((NetworkBehaviour)((EntityState)this).characterBody).netId, play: false), (NetworkDestination)1);
			}
			if (tank.currentPitchAngle > tank.criticalLimitAngle || tank.currentRollAngle > tank.criticalLimitAngle)
			{
				if (((EntityState)this).characterMotor.isGrounded && !recovered)
				{
					Util.PlaySound("Play_ThrusterSound", ((EntityState)this).gameObject);
					((EntityState)this).characterMotor.Jump(0f, 1f, false);
				}
				return;
			}
			if (((EntityState)this).isAuthority)
			{
				tank.currentRecoverWaitTime -= Time.deltaTime;
			}
			if (tank.currentRecoverWaitTime <= 0f && ((EntityState)this).isAuthority)
			{
				Normal normal = new Normal();
				normal.forceState = true;
				tankStateMachine.SetNextState((EntityState)(object)normal);
			}
		}

		public override void OnExit()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			((EntityState)this).OnExit();
			((Component)val).transform.localRotation = new Quaternion(0f, 0f, 0f, 1f);
			visual.resetRootRotationToGround = false;
		}
	}
	internal class Flight : BaseState
	{
		private TankController tank;

		private VisualRuntime visual;

		private SoundRuntime sound;

		private EntityStateMachine tankStateMachine;

		public override void OnEnter()
		{
			//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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			tank = ((EntityState)this).gameObject.GetComponent<TankController>();
			visual = ((EntityState)this).gameObject.GetComponent<VisualRuntime>();
			sound = ((EntityState)this).gameObject.GetComponent<SoundRuntime>();
			tankStateMachine = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Tank");
			((BaseState)this).OnEnter();
			sound.PerformThrusterLoopSound(play: true);
			Util.PlaySound("Play_ThrusterSound", ((EntityState)this).gameObject);
			visual.ThrusterEffects(play: true, loop: true, 1f, open: true);
			tank.newRootRotation = Vector3.zero;
			((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground();
			tank.previousVelocity = ((Vector3)(ref ((EntityState)this).characterMotor.velocity)).normalized * base.moveSpeedStat;
		}

		public override void FixedUpdate()
		{
			//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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: 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_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: 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_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			((EntityState)this).FixedUpdate();
			tank.powerRatio = 1f;
			if (!tank.IsFuelEmpty())
			{
				Vector3 val2 = Vector3.ProjectOnPlane(((EntityState)this).inputBank.aimDirection, Vector3.up);
				float num = Vector3.SignedAngle(Vector3.forward, val2, Vector3.up);
				Vector3 val3 = Vector3.ProjectOnPlane(val.forward, Vector3.up);
				float num2 = Vector3.SignedAngle(Vector3.forward, val3, Vector3.up);
				float num3 = Mathf.LerpAngle(0f, num - num2, 1f) * 0.1f * Mathf.Abs(Mathf.Clamp(Vector3.Dot(val.up, Vector3.up), 0f, 1f));
				Vector3 val4 = Vector3.Cross(-((EntityState)this).characterDirection.moveVector * 2f, Vector3.up);
				float num4 = 1f + tank.weightRatio;
				Vector3 val5 = new Vector3(val4.x, num3, val4.z) * num4;
				tank.newRootRotation = Vector3.Lerp(tank.newRootRotation, val5, 5f * Time.deltaTime);
				val.Rotate(tank.newRootRotation, (Space)0);
				if (!tank.IsNotInFlight() && ((EntityState)this).inputBank.jump.down)
				{
					if (((EntityState)this).inputBank.skill3.down)
					{
						tank.powerRatio -= 0f;
					}
					tank.currentFuelAmount -= Time.deltaTime * tank.newJumpFuelConsumption;
					visual.ThrusterEffects(play: true, loop: true, 1.5f, open: true);
					AkSoundEngine.SetRTPCValueByPlayingID("ThrusterLoopPitch", 100f, sound.thrusterLoop);
					Vector3 val6 = tank.previousVelocity - ((EntityState)this).characterMotor.velocity;
					val6.y = 0f;
					CharacterMotor characterMotor = ((EntityState)this).characterMotor;
					characterMotor.velocity += val6 * Time.fixedDeltaTime + val.up * tank.newJumpThrustMultiplier;
					tank.previousVelocity = Vector3.zero;
				}
				else if (!tank.IsNotInFlight())
				{
					if (((EntityState)this).inputBank.skill3.down)
					{
						tank.powerRatio -= 0f;
					}
					tank.currentFuelAmount -= Time.deltaTime * tank.newJumpFuelConsumption * 0.25f;
					visual.ThrusterEffects(play: true, loop: true, 0.5f, open: true);
					AkSoundEngine.SetRTPCValueByPlayingID("ThrusterLoopPitch", 0f, sound.thrusterLoop);
					CharacterMotor characterMotor2 = ((EntityState)this).characterMotor;
					characterMotor2.velocity += val.up * tank.baseJumpHoverMultiplier;
				}
			}
			else if (((EntityState)this).isAuthority)
			{
				tankStateMachine.SetNextState((EntityState)(object)new FuelEmpty());
			}
			if (((EntityState)this).healthComponent.timeSinceLastHit <= 0.05f)
			{
				float fullCombinedHealth = ((EntityState)this).healthComponent.fullCombinedHealth;
				float serverDamageTakenThisUpdate = ((EntityState)this).healthComponent.serverDamageTakenThisUpdate;
				if (serverDamageTakenThisUpdate >= fullCombinedHealth * 0.1f)
				{
					visual.ThrusterEffects(play: false, loop: false, 1f, open: false);
					sound.PerformThrusterLoopSound(play: false);
					if (((EntityState)this).isAuthority)
					{
						tankStateMachine.SetNextState((EntityState)(object)new ControlLoss());
					}
				}
				if (serverDamageTakenThisUpdate >= fullCombinedHealth * 0.05f && serverDamageTakenThisUpdate < fullCombinedHealth * 0.1f)
				{
					GameObject gameObject = ((EntityState)this).gameObject;
					GameObject lastHitAttacker = ((EntityState)this).healthComponent.lastHitAttacker;
					Quaternion val7 = Quaternion.Inverse(Quaternion.LookRotation(Vector3.ProjectOnPlane(((EntityState)this).inputBank.aimDirection, Vector3.up)));
					Vector3 val8 = lastHitAttacker.transform.position - gameObject.transform.position;
					Vector3 val9 = val7 * ((Vector3)(ref val8)).normalized;
					Vector3 val10 = Vector3.Cross(val9, Vector3.up);
					tank.stumbleDirection = val10 * 5f;
					tank.stumbleRecoveryTime = tank.baseStumbleRecoveryTime;
				}
				((EntityState)this).healthComponent.serverDamageTakenThisUpdate = 0f;
			}
			if (tank.stumbleRecoveryTime > 0f)
			{
				tank.stumbleRecoveryTime -= Time.deltaTime;
				if (tank.stumbleRecoveryTime <= 0f)
				{
					tank.stumbleRecoveryTime = 0f;
				}
			}
			if (tank.currentPitchAngle > tank.criticalLimitAngle || tank.currentRollAngle > tank.criticalLimitAngle)
			{
				if (((EntityState)this).characterMotor.isGrounded)
				{
					if (((EntityState)this).isAuthority)
					{
						NetMessageExtensions.Send((INetMessage)(object)new PerformCrashEffectsNetworkRequest(((NetworkBehaviour)((EntityState)this).characterBody).netId, play: true), (NetworkDestination)1);
					}
					visual.ThrusterEffects(play: false, loop: false, 1f, open: false);
					tank.currentCrashWaitTime = tank.baseCrashWaitTime;
					if (((EntityState)this).isAuthority)
					{
						tankStateMachine.SetNextState((EntityState)(object)new Crash());
					}
				}
			}
			else if (((EntityState)this).characterMotor.isGrounded && ((EntityState)this).fixedAge > 0.25f)
			{
				visual.ThrusterEffects(play: false, loop: false, 1f, open: false);
				sound.PerformThrusterLoopSound(play: false);
				if (((EntityState)this).isAuthority)
				{
					tankStateMachine.SetNextState((EntityState)(object)new Normal());
				}
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			visual.ThrusterEffects(play: false, loop: false, 1f, open: false);
			sound.PerformThrusterLoopSound(play: false);
		}
	}
	internal class FuelEmpty : BaseState
	{
		private TankController tank;

		private VisualRuntime visual;

		private SoundRuntime sound;

		private EntityStateMachine tankStateMachine;

		public override void OnEnter()
		{
			tank = ((EntityState)this).GetComponent<TankController>();
			visual = ((Component)tank).GetComponent<VisualRuntime>();
			sound = ((Component)tank).GetComponent<SoundRuntime>();
			tankStateMachine = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Tank");
			((BaseState)this).OnEnter();
			visual.ThrusterEffects(play: false, loop: false, 1f, open: true);
			sound.PerformThrusterLoopSound(play: false);
		}

		public override void FixedUpdate()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			((EntityState)this).FixedUpdate();
			val.Rotate(tank.newRootRotation, (Space)0);
			if (!tank.IsNotCrashedEntirely())
			{
				return;
			}
			if (tank.currentPitchAngle > tank.criticalLimitAngle || tank.currentRollAngle > tank.criticalLimitAngle)
			{
				if (((EntityState)this).characterMotor.isGrounded)
				{
					if (((EntityState)this).isAuthority)
					{
						NetMessageExtensions.Send((INetMessage)(object)new PerformCrashEffectsNetworkRequest(((NetworkBehaviour)((EntityState)this).characterBody).netId, play: true), (NetworkDestination)1);
					}
					tank.currentCrashWaitTime = tank.baseCrashWaitTime;
					if (((EntityState)this).isAuthority)
					{
						tankStateMachine.SetNextState((EntityState)(object)new Crash());
					}
				}
			}
			else if (((EntityState)this).characterMotor.isGrounded && ((EntityState)this).isAuthority)
			{
				tankStateMachine.SetNextState((EntityState)(object)new Normal());
			}
		}
	}
	internal class InAir : BaseState
	{
		private TankController tank;

		private EntityStateMachine tankStateMachine;

		public override void OnEnter()
		{
			tank = ((EntityState)this).gameObject.GetComponent<TankController>();
			tankStateMachine = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Tank");
			((BaseState)this).OnEnter();
		}

		public override void FixedUpdate()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			((EntityState)this).FixedUpdate();
			TankController tankController = tank;
			tankController.groundRotation *= Quaternion.Euler(val.InverseTransformDirection(-new Vector3(0f - tank.groundMoveVector.z, 0f, tank.groundMoveVector.x)));
			val.rotation = tank.groundRotation;
			if (!tank.IsNotCrashedEntirely())
			{
				return;
			}
			if (tank.IsNotInFlight() && !tank.IsFuelEmpty() && ((EntityState)this).inputBank.jump.down)
			{
				tank.previousMoveDirection = ((EntityState)this).characterDirection.moveVector;
				if (((EntityState)this).isAuthority)
				{
					tankStateMachine.SetNextState((EntityState)(object)new Flight());
				}
			}
			if (tank.currentPitchAngle > tank.criticalLimitAngle || tank.currentRollAngle > tank.criticalLimitAngle)
			{
				if (((EntityState)this).characterMotor.isGrounded)
				{
					if (((EntityState)this).isAuthority)
					{
						NetMessageExtensions.Send((INetMessage)(object)new PerformCrashEffectsNetworkRequest(((NetworkBehaviour)((EntityState)this).characterBody).netId, play: true), (NetworkDestination)1);
					}
					tank.currentCrashWaitTime = tank.baseCrashWaitTime;
					if (((EntityState)this).isAuthority)
					{
						tankStateMachine.SetNextState((EntityState)(object)new Crash());
					}
				}
			}
			else if (((EntityState)this).characterMotor.isGrounded && ((EntityState)this).isAuthority)
			{
				tankStateMachine.SetNextState((EntityState)(object)new Normal());
			}
		}
	}
	internal class Normal : BaseState
	{
		private TankController tank;

		private VisualRuntime visual;

		private SoundRuntime sound;

		private EntityStateMachine tankStateMachine;

		private Vector3 previousDirection;

		public bool forceState = false;

		public override void OnEnter()
		{
			tank = ((EntityState)this).gameObject.GetComponent<TankController>();
			visual = ((EntityState)this).gameObject.GetComponent<VisualRuntime>();
			sound = ((EntityState)this).gameObject.GetComponent<SoundRuntime>();
			tankStateMachine = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Tank");
			((BaseState)this).OnEnter();
		}

		public override void Update()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			previousDirection = Vector3.Cross(((Component)val).transform.right, Vector3.up);
			((EntityState)this).Update();
			if (((EntityState)this).characterDirection.moveVector != Vector3.zero)
			{
				visual.RotateTowardVectorDirection(((Component)val).transform.position + ((EntityState)this).characterDirection.moveVector, ((Component)((EntityState)this).transform).gameObject, ((Component)val).gameObject, new Vector3(1f, 0f, 1f), Vector3.zero, "Up", 5f);
			}
			if (!visual.resetRootRotationToGround)
			{
				Vector3 val2;
				if (((Vector3)(ref ((EntityState)this).characterMotor.velocity)).normalized == Vector3.zero)
				{
					val2 = new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f));
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					visual.RotateTowardVectorDirection(((Component)val).transform.position + normalized, ((Component)((EntityState)this).transform).gameObject, ((Component)val).gameObject, new Vector3(1f, 0f, 1f), Vector3.zero, "Up", 20f);
				}
				else
				{
					val2 = new Vector3(((EntityState)this).characterMotor.velocity.x, 0f, ((EntityState)this).characterMotor.velocity.z);
					Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
					visual.RotateTowardVectorDirection(((Component)val).transform.position + normalized2, ((Component)((EntityState)this).transform).gameObject, ((Component)val).gameObject, new Vector3(1f, 0f, 1f), Vector3.zero, "Up", 20f);
				}
				visual.resetRootRotationToGround = true;
			}
		}

		public override void FixedUpdate()
		{
			//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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((BaseState)this).FindModelChild("ROOT");
			((EntityState)this).FixedUpdate();
			visual.ThrusterEffects(play: false, loop: false, 1f, open: false);
			sound.PerformThrusterLoopSound(play: false);
			tank.groundRotation = val.rotation;
			tank.groundMoveVector = ((EntityState)this).characterDirection.moveVector;
			visual.ThrusterEffects(play: false, loop: false, 1f, open: false);
			if (tank.IsNotInFlight() && !tank.IsFuelEmpty() && ((EntityState)this).inputBank.jump.down)
			{
				tank.previousMoveDirection = ((EntityState)this).characterDirection.moveVector;
				if (((EntityState)this).isAuthority)
				{
					tankStateMachine.SetNextState((EntityState)(object)new Flight());
				}
			}
			if (tank.IsNotInAir() && !((EntityState)this).characterMotor.isGrounded && ((EntityState)this).isAuthority)
			{
				tankStateMachine.SetNextState((EntityState)(object)new InAir());
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			visual.resetRootRotationToGround = false;
		}
	}
}
namespace TanksMod.SkillStates
{
	internal class Disabled : BaseState
	{
		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
		}

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

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}
	}
	internal class Empty : BaseState
	{
		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
		}

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

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}
	}
}
namespace TanksMod.SkillStates.Projectile
{
	internal class BarrelController : MonoBehaviour
	{
		public OverlapAttack attack;

		public HitBoxGroup hitBoxGroup;

		public void Start()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			ProjectileController component = ((Component)this).GetComponent<ProjectileController>();
			GameObject owner = component.owner;
			ModelLocator component2 = owner.GetComponent<ModelLocator>();
			ChildLocator component3 = ((Component)component2.modelTransform).GetComponent<ChildLocator>();
			((Component)this).transform.up = ((Component)component3.FindChild("BarrelMuzzle")).transform.right;
		}

		public void Update()
		{
			ProjectileController component = ((Component)this).GetComponent<ProjectileController>();
			hitBoxGroup = Array.Find(component.ghostPrefab.GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "MainHitBox");
			Attack();
		}

		public void Attack()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			ProjectileController component = ((Component)this).GetComponent<ProjectileController>();
			GameObject owner = component.owner;
			attack = new OverlapAttack();
			attack.damageType = (DamageType)0;
			attack.attacker = owner.gameObject;
			attack.inflictor = owner.gameObject;
			attack.teamIndex = owner.GetComponent<TeamComponent>().teamIndex;
			attack.damage = 2.5f;
			attack.procCoefficient = 1f;
			attack.forceVector = Vector3.zero;
			attack.pushAwayForce = 0f;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = owner.GetComponent<CharacterBody>().RollCrit();
			attack.Fire((List<HurtBox>)null);
		}
	}
	internal class CannonProjectileController : MonoBehaviour
	{
		public float downforceMultiplier = 0f;

		private void FixedUpdate()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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)
			Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
			if (downforceMultiplier > 0f)
			{
				component.AddForce(Vector3.up * Physics.gravity.y * downforceMultiplier);
			}
		}
	}
	internal class FlamethrowerPelletController : MonoBehaviour
	{
		private ProjectileController controller;

		public GameObject chosenGhost;

		public void Awake()
		{
			controller = ((Component)this).GetComponent<ProjectileController>();
		}

		public void Start()
		{
			if (Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.ghostPrefab))
			{
				Object.Destroy((Object)(object)controller.ghostPrefab);
			}
		}
	}
	[RequireComponent(typeof(ProjectileGhostController))]
	internal class LandmineGhostController : MonoBehaviour
	{
		public bool dropImmediately = true;

		private ProjectileGhostController projectileGhostController;

		private EntityStateMachine armingStateMachine;

		private bool cachedArmed;

		private Light blinker;

		private void Awake()
		{
			projectileGhostController = ((Component)this).GetComponent<ProjectileGhostController>();
			blinker = ((Component)this).GetComponentInChildren<Light>();
		}

		private void Start()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			Transform authorityTransform = projectileGhostController.authorityTransform;
			if (Object.op_Implicit((Object)(object)authorityTransform))
			{
				ProjectileController component = ((Component)authorityTransform).GetComponent<ProjectileController>();
				ModelLocator component2 = component.Networkowner.GetComponent<ModelLocator>();
				ChildLocator component3 = ((Component)component2.modelTransform).GetComponent<ChildLocator>();
				authorityTransform.position = component3.FindChild("LandmineDropPoint").position;
				armingStateMachine = EntityStateMachine.FindByCustomName(((Component)authorityTransform).gameObject, "Arming");
			}
		}

		private bool IsArmed()
		{
			EntityStateMachine val = armingStateMachine;
			return (((((Object)(object)val != (Object)null) ? val.state : null) is TanksMod.SkillStates.Landmine.BaseMineArmingState baseMineArmingState) ? baseMineArmingState.damageScale : 0f) > 1f;
		}

		private void Update()
		{
			blinker.intensity = Mathf.SmoothStep(0.1f, 1f, Mathf.PingPong(Time.time, 1f));
		}

		private void FixedUpdate()
		{
			if ((Object)(object)projectileGhostController == (Object)null)
			{
				projectileGhostController = ((Component)this).GetComponent<ProjectileGhostController>();
			}
			bool flag = IsArmed();
			if (flag != cachedArmed)
			{
				cachedArmed = flag;
			}
		}
	}
	[RequireComponent(typeof(ProjectileGhostController))]
	internal class MiniMineGhostController : MonoBehaviour
	{
		private ProjectileGhostController projectileGhostController;

		private EntityStateMachine armingStateMachine;

		private bool cachedArmed;

		private Light blinker;

		private void Awake()
		{
			projectileGhostController = ((Component)this).GetComponent<ProjectileGhostController>();
			blinker = ((Component)this).GetComponentInChildren<Light>();
		}

		private void Start()
		{
			Transform authorityTransform = projectileGhostController.authorityTransform;
			if (Object.op_Implicit((Object)(object)authorityTransform))
			{
				armingStateMachine = EntityStateMachine.FindByCustomName(((Component)authorityTransform).gameObject, "Arming");
			}
		}

		private bool IsArmed()
		{
			EntityStateMachine val = armingStateMachine;
			return (((((Object)(object)val != (Object)null) ? val.state : null) is TanksMod.SkillStates.Landmine.BaseMineArmingState baseMineArmingState) ? baseMineArmingState.damageScale : 0f) > 1f;
		}

		private void Update()
		{
			blinker.intensity = Mathf.SmoothStep(0.1f, 1f, Mathf.PingPong(Time.time, 1f));
		}

		private void FixedUpdate()
		{
			if ((Object)(object)projectileGhostController == (Object)null)
			{
				projectileGhostController = ((Component)this).GetComponent<ProjectileGhostController>();
			}
			bool flag = IsArmed();
			if (flag != cachedArmed)
			{
				cachedArmed = flag;
			}
		}
	}
	internal class TankAimThrowableBase : BaseSkillState
	{
		private struct CalculateArcPointsJob : IJobParallelFor, IDisposable
		{
			[ReadOnly]
			private Vector3 origin;

			[ReadOnly]
			private Vector3 velocity;

			[ReadOnly]
			private float indexMultiplier;

			[ReadOnly]
			private float gravity;

			[WriteOnly]
			public NativeArray<Vector3> outputPositions;

			public void SetParameters(Vector3 origin, Vector3 velocity, float totalTravelTime, int positionCount, float gravity)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: 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_000a: 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)
				this.origin = origin;
				this.velocity = velocity;
				if (outputPositions.Length != positionCount)
				{
					if (outputPositions.IsCreated)
					{
						outputPositions.Dispose();
					}
					outputPositions = new NativeArray<Vector3>(positionCount, (Allocator)4, (NativeArrayOptions)0);
				}
				indexMultiplier = totalTravelTime / (float)(positionCount - 1);
				this.gravity = gravity;
			}

			public void Dispose()
			{
				if (outputPositions.IsCreated)
				{
					outputPositions.Dispose();
				}
			}

			public void Execute(int index)
			{
				//IL_0013: 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_0025: Unknown result type (might be due to invalid IL or missing references)
				float num = (float)index * indexMultiplier;
				outputPositions[index] = Trajectory.CalculatePositionAtTime(origin, velocity, num, gravity);
			}
		}

		protected struct TrajectoryInfo
		{
			public Ray finalRay;

			public Vector3 hitPoint;

			public Vector3 hitNormal;

			public float travelTime;

			public float speedOverride;
		}

		[SerializeField]
		public float maxDistance;

		[SerializeField]
		public float rayRadius;

		[SerializeField]
		public GameObject arcVisualizerPrefab;

		[SerializeField]
		public GameObject projectilePrefab;

		[SerializeField]
		public GameObject endpointVisualizerPrefab;

		[SerializeField]
		public float endpointVisualizerRadiusScale;

		[SerializeField]
		public bool setFuse;

		[SerializeField]
		public float damageCoefficient;

		[SerializeField]
		public float baseMinimumDuration;

		protected LineRenderer arcVisualizerLineRenderer;

		protected Transform endpointVisualizerTransform;

		protected float projectileBaseSpeed;

		protected float detonationRadius;

		protected float minimumDuration;

		protected bool useGravity;

		private CalculateArcPointsJob calculateArcPointsJob;

		private JobHandle calculateArcPointsJobHandle;

		private Vector3[] pointsBuffer = Array.Empty<Vector3>();

		private Action completeArcPointsVisualizerJobMethod;

		protected TrajectoryInfo currentTrajectoryInfo;

		public override void OnEnter()
		{
			//IL_0025: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			if (Object.op_Implicit((Object)(object)arcVisualizerPrefab))
			{
				arcVisualizerLineRenderer = Object.Instantiate<GameObject>(arcVisualizerPrefab, ((EntityState)this).transform.position, Quaternion.identity).GetComponent<LineRenderer>();
				calculateArcPointsJob = default(CalculateArcPointsJob);
				completeArcPointsVisualizerJobMethod = CompleteArcVisualizerJob;
				RoR2Application.onLateUpdate += completeArcPointsVisualizerJobMethod;
			}
			if (Object.op_Implicit((Object)(object)endpointVisualizerPrefab))
			{
				endpointVisualizerTransform = Object.Instantiate<GameObject>(endpointVisualizerPrefab, ((EntityState)this).transform.position, Quaternion.identity).transform;
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.hideCrosshair = true;
			}
			if ((Object)(object)projectilePrefab != (Object)null)
			{
				ProjectileSimple component = projectilePrefab.GetComponent<ProjectileSimple>();
				if (Object.op_Implicit((Object)(object)component))
				{
					projectileBaseSpeed = component.velocity;
				}
				Rigidbody component2 = projectilePrefab.GetComponent<Rigidbody>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					useGravity = component2.useGravity;
				}
				minimumDuration = baseMinimumDuration / ((BaseState)this).attackSpeedStat;
				ProjectileImpactExplosion component3 = projectilePrefab.GetComponent<ProjectileImpactExplosion>();
				if (Object.op_Implicit((Object)(object)component3))
				{
					detonationRadius = ((ProjectileExplosion)component3).blastRadius;
					if (Object.op_Implicit((Object)(object)endpointVisualizerTransform))
					{
						endpointVisualizerTransform.localScale = new Vector3(detonationRadius, detonationRadius, detonationRadius);
					}
				}
			}
			UpdateVisualizers(currentTrajectoryInfo);
			SceneCamera.onSceneCameraPreRender += new SceneCameraDelegate(OnPreRenderSceneCam);
		}

		public override void OnExit()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SceneCamera.onSceneCameraPreRender -= new SceneCameraDelegate(OnPreRenderSceneCam);
			if (!((EntityState)this).outer.destroying)
			{
				if (((EntityState)this).isAuthority)
				{
				}
				OnProjectileFiredLocal();
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.hideCrosshair = false;
			}
			((JobHandle)(ref calculateArcPointsJobHandle)).Complete();
			if (Object.op_Implicit((Object)(object)arcVisualizerLineRenderer))
			{
				EntityState.Destroy((Object)(object)((Component)arcVisualizerLineRenderer).gameObject);
				arcVisualizerLineRenderer = null;
			}
			if (completeArcPointsVisualizerJobMethod != null)
			{
				RoR2Application.onLateUpdate -= completeArcPointsVisualizerJobMethod;
				completeArcPointsVisualizerJobMethod = null;
			}
			((CalculateArcPointsJob)(ref calculateArcPointsJob)).Dispose();
			pointsBuffer = Array.Empty<Vector3>();
			if (Object.op_Implicit((Object)(object)endpointVisualizerTransform))
			{
				EntityState.Destroy((Object)(object)((Component)endpointVisualizerTransform).gameObject);
				endpointVisualizerTransform = null;
			}
			((EntityState)this).OnExit();
		}

		protected virtual bool KeyIsDown()
		{
			return ((BaseSkillState)this).IsKeyDownAuthority();
		}

		protected virtual void OnProjectileFiredLocal()
		{
		}

		protected virtual void FireProjectile()
		{
			//IL_0003: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			FireProjectileInfo val = default(FireProjectileInfo);
			val.crit = ((BaseState)this).RollCrit();
			val.owner = ((EntityState)this).gameObject;
			val.position = ((Ray)(ref currentTrajectoryInfo.finalRay)).origin;
			val.projectilePrefab = projectilePrefab;
			val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref currentTrajectoryInfo.finalRay)).direction, Vector3.up);
			((FireProjectileInfo)(ref val)).speedOverride = currentTrajectoryInfo.speedOverride;
			val.damage = damageCoefficient * ((BaseState)this).damageStat;
			FireProjectileInfo fireProjectileInfo = val;
			if (setFuse)
			{
				((FireProjectileInfo)(ref fireProjectileInfo)).fuseOverride = currentTrajectoryInfo.travelTime;
			}
			ModifyProjectile(ref fireProjectileInfo);
			if ((Object)(object)projectilePrefab != (Object)null)
			{
				ProjectileManager.instance.FireProjectile(fireProjectileInfo);
			}
		}

		protected virtual void ModifyProjectile(ref FireProjectileInfo fireProjectileInfo)
		{
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && !KeyIsDown() && ((EntityState)this).fixedAge >= minimumDuration)
			{
				UpdateTrajectoryInfo(out currentTrajectoryInfo);
				EntityState val = PickNextState();
				if (val == null)
				{
				}
			}
		}

		protected virtual EntityState PickNextState()
		{
			return null;
		}

		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)1;
		}

		public override void Update()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			if (CameraRigController.IsObjectSpectatedByAnyCamera(((EntityState)this).gameObject))
			{
				UpdateTrajectoryInfo(out currentTrajectoryInfo);
				UpdateVisualizers(currentTrajectoryInfo);
			}
		}

		protected virtual void UpdateTrajectoryInfo(out TrajectoryInfo dest)
		{
			//IL_0002: 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_0011: 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_003b: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			dest = default(TrajectoryInfo);
			Ray aimRay = ((BaseState)this).GetAimRay();
			RaycastHit val = default(RaycastHit);
			bool flag = false;
			if (rayRadius > 0f && Util.CharacterSpherecast(((EntityState)this).gameObject, aimRay, rayRadius, ref val, maxDistance, CommonMasks.bullet, (QueryTriggerInteraction)0) && Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponent<HurtBox>()))
			{
				flag = true;
			}
			if (!flag)
			{
				flag = Util.CharacterRaycast(((EntityState)this).gameObject, aimRay, ref val, maxDistance, CommonMasks.bullet, (QueryTriggerInteraction)0);
			}
			if (flag)
			{
				dest.hitPoint = ((RaycastHit)(ref val)).point;
				dest.hitNormal = ((RaycastHit)(ref val)).normal;
			}
			else
			{
				dest.hitPoint = ((Ray)(ref aimRay)).GetPoint(maxDistance);
				dest.hitNormal = -((Ray)(ref aimRay)).direction;
			}
			Vector3 val2 = dest.hitPoint - ((Ray)(ref aimRay)).origin;
			if (useGravity)
			{
				float num = projectileBaseSpeed;
				Vector2 val3 = default(Vector2);
				((Vector2)(ref val3))..ctor(val2.x, val2.z);
				float magnitude = ((Vector2)(ref val3)).magnitude;
				float num2 = Trajectory.CalculateInitialYSpeed(magnitude / num, val2.y);
				Vector3 val4 = default(Vector3);
				((Vector3)(ref val4))..ctor(val3.x / magnitude * num, num2, val3.y / magnitude * num);
				dest.speedOverride = ((Vector3)(ref val4)).magnitude;
				dest.finalRay = new Ray(((Ray)(ref aimRay)).origin, val4 / dest.speedOverride);
				dest.travelTime = Trajectory.CalculateGroundTravelTime(num, magnitude);
			}
			else
			{
				dest.speedOverride = projectileBaseSpeed;
				dest.finalRay = aimRay;
				dest.travelTime = projectileBaseSpeed / ((Vector3)(ref val2)).magnitude;
			}
		}

		private void CompleteArcVisualizerJob()
		{
			((JobHandle)(ref calculateArcPointsJobHandle)).Complete();
			if (Object.op_Implicit((Object)(object)arcVisualizerLineRenderer))
			{
				Array.Resize(ref pointsBuffer, calculateArcPointsJob.outputPositions.Length);
				calculateArcPointsJob.outputPositions.CopyTo(pointsBuffer);
				arcVisualizerLineRenderer.SetPositions(pointsBuffer);
			}
		}

		private void UpdateVisualizers(TrajectoryInfo trajectoryInfo)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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)
			if (Object.op_Implicit((Object)(object)arcVisualizerLineRenderer) && ((JobHandle)(ref calculateArcPointsJobHandle)).IsCompleted)
			{
				((CalculateArcPointsJob)(ref calculateArcPointsJob)).SetParameters(((Ray)(ref trajectoryInfo.finalRay)).origin, ((Ray)(ref trajectoryInfo.finalRay)).direction * trajectoryInfo.speedOverride, trajectoryInfo.travelTime, arcVisualizerLineRenderer.positionCount, useGravity ? Physics.gravity.y : 0f);
				calculateArcPointsJobHandle = IJobParallelForExtensions.Schedule<CalculateArcPointsJob>(calculateArcPointsJob, calculateArcPointsJob.outputPositions.Length, 32, default(JobHandle));
			}
			if (Object.op_Implicit((Object)(object)endpointVisualizerTransform))
			{
				endpointVisualizerTransform.SetPositionAndRotation(trajectoryInfo.hitPoint, Util.QuaternionSafeLookRotation(trajectoryInfo.hitNormal));
				if (!endpointVisualizerRadiusScale.Equals(0f))
				{
					endpointVisualizerTransform.localScale = new Vector3(endpointVisualizerRadiusScale, endpointVisualizerRadiusScale, endpointVisualizerRadiusScale);
				}
			}
		}

		private void OnPreRenderSceneCam(SceneCamera sceneCam)
		{
			if (Object.op_Implicit((Object)(object)arcVisualizerLineRenderer))
			{
				((Renderer)arcVisualizerLineRenderer).renderingLayerMask = (((Object)(object)sceneCam.cameraRigController.target == (Object)(object)((EntityState)this).gameObject) ? 1u : 0u);
			}
			if (Object.op_Implicit((Object)(object)endpointVisualizerTransform))
			{
				((Component)endpointVisualizerTransform).gameObject.layer = (((Object)(object)sceneCam.cameraRigController.target == (Object)(object)((EntityState)this).gameObject) ? LayerIndex.defaultLayer.intVal : LayerIndex.noDraw.intVal);
			}
		}
	}
}
namespace TanksMod.SkillStates.PiercingProjectile
{
	internal class DetonateAtTarget : BaseState
	{
		private AAProjectileSphereTargetFinder targetFinder;

		private ProjectileTargetComponent projectileTargetComponent;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			projectileTargetComponent = ((EntityState)this).GetComponent<ProjectileTargetComponent>();
			targetFinder = ((EntityState)this).GetComponent<AAProjectileSphereTargetFinder>();
			if (NetworkServer.active)
			{
				((Behaviour)targetFinder).enabled = true;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active && Object.op_Implicit((Object)(object)targetFinder) && Object.op_Implicit((Object)(object)projectileTargetComponent.target))
			{
				Explode();
			}
		}

		private void Explode()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0099: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			ProjectileDamage component = ((EntityState)this).GetComponent<ProjectileDamage>();
			new BlastAttack
			{
				procChainMask = ((EntityState)this).projectileController.procChainMask,
				procCoefficient = ((EntityState)this).projectileController.procCoefficient,
				attacker = ((EntityState)this).projectileController.owner,
				inflictor = ((EntityState)this).gameObject,
				teamIndex = ((EntityState)this).projectileController.teamFilter.teamIndex,
				baseDamage = component.damage,
				damageType = component.damageType,
				baseForce = component.force,
				falloffModel = (FalloffModel)0,
				crit = component.crit,
				radius = 1f,
				position = ((EntityState)this).transform.position,
				damageColorIndex = component.damageColorIndex
			}.Fire();
			EffectManager.SpawnEffect(Assets.aaCannonNearTargetExplodeEffect, new EffectData
			{
				origin = ((EntityState)this).transform.position,
				rotation = ((EntityState)this).transform.rotation,
				scale = 1f
			}, true);
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (Object.op_Implicit((Object)(object)targetFinder))
			{
				((Behaviour)targetFinder).enabled = false;
			}
		}
	}
}
namespace TanksMod.SkillStates.MiniLandmine
{
	internal class Arm : BaseMineState
	{
		public static float duration;

		protected override bool shouldStick => true;

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (NetworkServer.active && duration <= ((EntityState)this).fixedAge)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new WaitForTarget());
			}
		}
	}
	internal class BaseMineArmingState : BaseState
	{
		[SerializeField]
		public float damageScale = 1f;

		[SerializeField]
		public float forceScale;

		[SerializeField]
		public float blastRadiusScale = 1f;

		[SerializeField]
		public float triggerRadius = 3f;

		[SerializeField]
		public string onEnterSfx;

		[SerializeField]
		public float onEnterSfxPlaybackRate;

		[SerializeField]
		public string pathToChildToEnable;

		private Transform enabledChild;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			Util.PlayAttackSpeedSound(onEnterSfx, ((EntityState)this).gameObject, onEnterSfxPlaybackRate);
			if (!string.IsNullOrEmpty(pathToChildToEnable))
			{
				enabledChild = ((EntityState)this).transform.Find(pathToChildToEnable);
				if (Object.op_Implicit((Object)(object)enabledChild))
				{
					((Component)enabledChild).gameObject.SetActive(true);
				}
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)enabledChild))
			{
				((Component)enabledChild).gameObject.SetActive(false);
			}
			((EntityState)this).OnExit();
		}
	}
	public class BaseMineState : BaseState
	{
		[SerializeField]
		public string enterSoundString;

		public ProjectileStickOnImpact projectileStickOnImpact;

		public EntityStateMachine armingStateMachine;

		protected virtual bool shouldStick => false;

		protected virtual bool shouldRevertToWaitForStickOnSurfaceLost => false;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			projectileStickOnImpact = ((EntityState)this).GetComponent<ProjectileStickOnImpact>();
			armingStateMachine = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Arming");
			if (((Behaviour)projectileStickOnImpact).enabled != shouldStick)
			{
				((Behaviour)projectileStickOnImpact).enabled = shouldStick;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active && shouldRevertToWaitForStickOnSurfaceLost && !projectileStickOnImpact.stuck)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new WaitForStick());
			}
		}
	}
	internal class Detonate : BaseMineState
	{
		public static float blastRadius = 3.5f;

		public static GameObject explosionEffectPrefab = Assets.miniLandmineExplosionEffect;

		protected override bool shouldStick => false;

		protected override bool shouldRevertToWaitForStickOnSurfaceLost => false;

		public override void OnEnter()
		{
			base.OnEnter();
			if (NetworkServer.active)
			{
				Explode();
			}
		}

		private void Explode()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			ProjectileDamage component = ((EntityState)this).GetComponent<ProjectileDamage>();
			float num = 0f;
			float num2 = 0f;
			float num3 = 0f;
			EntityStateMachine val = armingStateMachine;
			if ((((Object)(object)val != (Object)null) ? val.state : null) is BaseMineArmingState baseMineArmingState)
			{
				num = baseMineArmingState.damageScale;
				num2 = baseMineArmingState.forceScale;
				num3 = baseMineArmingState.blastRadiusScale;
			}
			float num4 = blastRadius * num3;
			new BlastAttack
			{
				procChainMask = ((EntityState)this).projectileController.procChainMask,
				procCoefficient = ((EntityState)this).projectileController.procCoefficient,
				attacker = ((EntityState)this).projectileController.owner,
				inflictor = ((EntityState)this).gameObject,
				teamIndex = ((EntityState)this).projectileController.teamFilter.teamIndex,
				baseDamage = component.damage * num,
				baseForce = component.force * num2,
				falloffModel = (FalloffModel)0,
				crit = component.crit,
				radius = num4,
				position = ((EntityState)this).transform.position,
				damageColorIndex = component.damageColorIndex
			}.Fire();
			if (Object.op_Implicit((Object)(object)explosionEffectPrefab))
			{
				EffectManager.SpawnEffect(explosionEffectPrefab, new EffectData
				{
					origin = ((EntityState)this).transform.position,
					rotation = ((EntityState)this).transform.rotation,
					scale = num4
				}, true);
			}
			Util.PlaySound("Play_MiniLandmineSound", ((EntityState)this).gameObject);
			EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
		}
	}
	internal class MineArmingFull : BaseMineArmingState
	{
	}
	internal class MineArmingUnarmed : BaseMineArmingState
	{
	}
	internal class MineArmingWeak : BaseMineArmingState
	{
		public static float duration;

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active && duration <= ((EntityState)this).fixedAge)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new MineArmingFull());
			}
		}
	}
	internal class PreDetonate : BaseMineState
	{
		public static float duration;

		public static string pathToPrepForExplosionChildEffect;

		public static float detachForce;

		protected override bool shouldStick => false;

		protected override bool shouldRevertToWaitForStickOnSurfaceLost => false;

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

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (NetworkServer.active && duration <= ((EntityState)this).fixedAge)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new Detonate());
			}
		}
	}
	internal class WaitForStick : BaseMineState
	{
		protected override bool shouldStick => true;

		protected override bool shouldRevertToWaitForStickOnSurfaceLost => false;

		public override void OnEnter()
		{
			base.OnEnter();
			if (NetworkServer.active)
			{
				armingStateMachine.SetNextState((EntityState)(object)new MineArmingUnarmed());
			}
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (NetworkServer.active && projectileStickOnImpact.stuck)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new Arm());
			}
		}
	}
	internal class WaitForTarget : BaseMineState
	{
		private ProjectileSphereTargetFinder targetFinder;

		private ProjectileTargetComponent projectileTargetComponent;

		private ProjectileImpactExplosion projectileImpactExplosion;

		protected override bool shouldStick => true;

		public override void OnEnter()
		{
			base.OnEnter();
			projectileTargetComponent = ((EntityState)this).GetComponent<ProjectileTargetComponent>();
			targetFinder = ((EntityState)this).GetComponent<ProjectileSphereTargetFinder>();
			if (NetworkServer.active)
			{
				((Behaviour)targetFinder).enabled = true;
				armingStateMachine.SetNextState((EntityState)(object)new MineArmingWeak());
			}
		}

		public override